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

Giving all players a hat?

Asked by
FiredDusk 1466 Moderation Voter
8 years ago

I want for all players that join, they will have the hat that I put in the id below.

I have tryed other things but cant seem to find the problem..

game.Players.PlayerAdded:connect(function(player)
    repeat wait()until player.Character
    local hatId=0000000  --Hat ID
    if player.Name=="name"then
        hatId=0000000 --Hat ID
    end
    local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
    hat.Parent=player.Character
end)
0
Looking at your code, it's lines 3 and 5; You did not set a valid Asset ID for the 'InsertService' to add the specific object into the game, also (in my opinion), it is a bad idea to set the Object's Parent property to the Parent right after calling the 'LoadAsset' function of 'InsertService'; The Object may not be existant at the time of execution. TheeDeathCaster 2368 — 8y
0
Line 7. game:GetService("InsertService") OniiCh_n 410 — 8y

Answer this question