Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't my script make a hat attach to the players head?

player = game.Players.LocalPlayer
h = player.Character.Head
script.Parent.MouseButton1Down:connect(function()
    h.face:Destroy()
    for _,v in pairs(player.Character:GetChildren()) do
        if v.ClassName == "Hat" then
            v:Destroy()
            game.ServerStorage.NatsuHair1:clone().Parent = player.Character
         	game.ServerStorage.NatsuHair2:clone().Parent = player.Character
        end
    end

1 comment

0

change ServerStorage to RelicatedStorage in line 8 and 9

1 answer

✓ Accepted answer

ServerStorage can only be accessed by the server; That is, LocalScripts and pretty much everything related to clients or clients themselves cannot access things inside of ServerStorage. Use ReplicatedStorage if you need to store things that both the server and cliens can access.

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.