Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 8 years ago
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
0
change ServerStorage to RelicatedStorage in line 8 and 9 UserOnly20Characters 890 — 8y

1 answer

Log in to vote
0
Answered by
drew1017 330 Moderation Voter
8 years ago

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.

0
Thanks! Relampago1204 73 — 8y
Ad

Answer this question