Accesoire only showing on server

Hello so I have the problem that the accesoire in this code only shows on Serverside not in the client so in the game i can’t see it but when i go to CurrentClient(Studio option) it shows up

code:

local tool = script.Parent

tool.Equipped:Connect(function()
	local char = tool.Parent
	if char:FindFirstChild("ClassicSwordAccessory") then
		char.ClassicSwordAccessory:Destroy()
	end
end)


tool.Unequipped:Connect(function()
	local char = tool.Parent.Parent.Character
	if not char:FindFirstChild("ClassicSwordAccessory") then
		game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone().Parent = char
	end
end)



The client doesn’t have access to stuff inside ServerStorage, only the server does. Put it in ReplicatedStorage instead.

But it is a server script it should work?

Why are u using a normal script for tool(client related) stuff anyway.

He is trying to make an accessory appear on the character when the tool is unequipped.

I would suggest using a local script for the tool. Send a remote event to the server and handle all serverstorage stuff from there

1 Like

Consider switching to a local script and then firing a remote event from the local script that adds the accessory.

Didn’t work :frowning:
Only shows when I am switching to server :frowning:

code(Serverscript):

game.ReplicatedStorage.Accessoire.Equip.ClassicSword.OnServerEvent:Connect(function(player)
	local char = player.Character or player.CharacterAdded:Wait()
	if char:FindFirstChild("ClassicSwordAccessory") then
		char.ClassicSwordAccessory:Destroy()
	end
end)

game.ReplicatedStorage.Accessoire.Unequip.ClassicSword.OnServerEvent:Connect(function(player)
	local char = player.Character or player.CharacterAdded:Wait()
	if not char:FindFirstChild("ClassicSwordAccessory") then
		game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone().Parent = char
	end
end)

code(Local script):

local player = game.Players.LocalPlayer
local tool = script.Parent

tool.Equipped:Connect(function()
	game.ReplicatedStorage.Accessoire.Equip.ClassicSword:FireServer(player)
end)

tool.Unequipped:Connect(function()
	game.ReplicatedStorage.Accessoire.Unequip.ClassicSword:FireServer(player)
end)

Try doing Humanoid:EquipTool(); instead of parenting the tool to the character

local humanoid = char:WaitForChild("Humanoid")
local tool = game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone()
humanoid:EquipTool(tool)

But it’s an accessory this wouldn’t work!

My mistake then. Try this Humanoid:AddAccessory()

local humanoid = char:WaitForChild("Humanoid")
local accessory = game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone()
humanoid:AddAccessory(accessory)

still only showing on the server :frowning:

Could you upload a place file with this script, tool and accessory

1 Like

I send you a message via the message system!