Hello, I want to make a script (server script not local because then no one can see the hat) but the only problem is this script won't work in test but it works in play mode. I want that this work when you click on the gui you get this hat that everyone can see on server side not client side.
Ps. this is a server script in startergui but i think server scripts don't work in startergui.
function die()
local player = script.Parent.Parent.Parent.Parent
if player.Character:FindFirstChild(Hat")then
else
local arm = player.Character.Head
local rift = game.ServerStorage.Hat:Clone()
rift.Parent = player.Character
rift.Head.Anchored = false
local w = Instance.new("Weld")
w.Name = "Weld"
w.Parent = player.Character.Torso
w.Part0 = rift.Head
w.Part1 = arm
end
end
script.Parent.MouseButton1Down:connect(die)

1 comment
Use RemoteEvent