NinjaKitty Posted June 9, 2021 Share Posted June 9, 2021 (edited) I have made a characther mod for DST. I recently added a sword and it works for me just fine. I made a server and asked a friend to join so we could test the mod. However, my friend wasn't able to see or hold the sword. But he was able to see it in my hand. I gave my sword to him and told him to equip it, but he said he doesnt have the sword. I asked another friend to test it out, he downloaded the mod from workshop and said he also doesnt have the sword. Asked him to spawn it from the console and he got an error as shown in the image I uploaded below. I tested both the steam version and the local version I have on my pc and it works for me. Why could it be that it doesn't work for others? Edited June 16, 2021 by NinjaKitty Link to comment https://forums.kleientertainment.com/forums/topic/130706-solved-items-are-visible-to-me-but-not-to-others/ Share on other sites More sharing options...
HarryPPP Posted June 16, 2021 Share Posted June 16, 2021 Did you remind to put: if not TheWorld.ismastersim then return inst end Before adding your item's components? Example from a item in my mod, with comments to help understand: local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("flowersalve") inst.AnimState:SetBuild("flowersalve") inst.AnimState:PlayAnimation("idle") MakeInventoryFloatable(inst, "small", 0.05, 0.95) inst.entity:SetPristine() if not TheWorld.ismastersim then -- This tests if the player is not the host. return inst -- If the player IS NOT the host, then stop the function. end -- If the player IS the host, then load the remaining code. -- Components info is server sided, meaning that it's not meant for clients, or players that aren't the host. inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/flowersalve.xml" inst:AddComponent("healer") inst.components.healer:SetHealthAmount(TUNING.DSTE.FLOWERSALVE_HEALING) MakeHauntableLaunch(inst) return inst end 1 Link to comment https://forums.kleientertainment.com/forums/topic/130706-solved-items-are-visible-to-me-but-not-to-others/#findComment-1469192 Share on other sites More sharing options...
NinjaKitty Posted June 16, 2021 Author Share Posted June 16, 2021 7 hours ago, HarryPPP said: Did you remind to put: if not TheWorld.ismastersim then return inst end Before adding your item's components? Example from a item in my mod, with comments to help understand: local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.AnimState:SetBank("flowersalve") inst.AnimState:SetBuild("flowersalve") inst.AnimState:PlayAnimation("idle") MakeInventoryFloatable(inst, "small", 0.05, 0.95) inst.entity:SetPristine() if not TheWorld.ismastersim then -- This tests if the player is not the host. return inst -- If the player IS NOT the host, then stop the function. end -- If the player IS the host, then load the remaining code. -- Components info is server sided, meaning that it's not meant for clients, or players that aren't the host. inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/flowersalve.xml" inst:AddComponent("healer") inst.components.healer:SetHealthAmount(TUNING.DSTE.FLOWERSALVE_HEALING) MakeHauntableLaunch(inst) return inst end Thank you, this fixed the issue! Link to comment https://forums.kleientertainment.com/forums/topic/130706-solved-items-are-visible-to-me-but-not-to-others/#findComment-1469249 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now