I'm new to scripting.. what did i do wrong? !!
function onPlayerRespawned(newPlayer)
local ha = Instance.new("Hat")
AttachmentForward = Vector3.new(-0,-0,-1) --Change this to the AttachmentForward of the hat.
AttachmentPos = Vector3.new(0,-2,0.155) --Change this to the AttachmentPos of the hat.
AttachmentRight = Vector3.new(1,0,0) --Change this to the AttachmentRight of the hat.
AttachmentUp = Vector3.new(0,5,0) --Change this to the AttachmentUp of the that.
ha.Parent = newPlayer.Character
game.Workspace.Handle:Clone().Parent = ha
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered) |