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)
Didn’t work
Only shows when I am switching to server
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)
local humanoid = char:WaitForChild("Humanoid")
local tool = game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone()
humanoid:EquipTool(tool)
local humanoid = char:WaitForChild("Humanoid")
local accessory = game:GetService("ServerStorage").Accessories.ClassicSwordAccessory:Clone()
humanoid:AddAccessory(accessory)