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

How to use LoadAsset to give a certain player a hat every respawn?

Asked by 10 years ago

I don't know how to use LoadAsset to give certain players hat. Can someone please explain how to do this?

1 answer

Log in to vote
1
Answered by 10 years ago
wait(1)
plrs = {"someone","devs"}
for k,v in pairs(game.Players:GetPlayers() do
    for l,t in pairs(plrs) do
        if v.Name == t then
            hat = game:GetService("InsertService"):LoadAsset(id) --change the id to the id you want.
            for g,h in pairs(hat:GetChildren()) do
                if v.ClassName == "Hat" then --The reason I did a loop because when you use LoadAsset the thing comes inside the model so I made a loop that will loop through the model and look for hats
                    h.Parent =  v.Character
                end
            end --It might not work because I was lazy so I didn't do my best.
        end
    end
end
0
Can you fix it so that it wil work? It's very important. MUSHR0OM 0 — 10y
0
Huh it might work you just have to try it. SilenceCore 25 — 10y
Ad

Answer this question