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

Giving a user a hat that the user doesn't own? [Solved!]

Asked by 10 years ago

Hi, I'm kind of new to this site and RBX.Lua, so any help is appreciated.

I want to put a hat on a specific user a hat that the user doesn't own, and only for that user.

I've tried using the

game.Players.PlayerAdded:connect(function(player)

end)

, but that doesn't seem to work.

If you could put it in the most simplest terms, that would be great. Thanks.

3 answers

Log in to vote
5
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

Use InsertService to load a hat and get the first child of the model the function returns and add it to the player's character. The hat will be correctly welded to them automatically.

game.Players.PlayerAdded:connect(function(player)
    repeat wait()until player.Character
    local hatId=1045408
    if player.Name=="1waffle1"then
        hatId=21070012
    end
    local hat = game:service("InsertService"):LoadAsset(hatId):GetChildren()[1]
    hat.Parent=player.Character
end)
0
The button on ROBLOX Studio won't give me the "InsertService" service? Or do I do something else to get the InsertService? iRzPWNzr 20 — 10y
0
game:GetService("InsertService"):LoadAsset(hatId):GetChildren()[1].Parent=Character 1waffle1 2908 — 10y
0
OK, but how would I give that hat to only one specific player? iRzPWNzr 20 — 10y
Ad
Log in to vote
-1
Answered by 10 years ago

Scripting Helpers is helping to fix a Script. So please only ask to fix a Script. You are asking for someone to make something for you thats not allowed. Thanks,

Log in to vote
-2
Answered by 10 years ago

I would make a hat, put it on a spawn.

Answer this question