Answered by
4 years ago Edited 4 years ago
Ok first of all you have to have the hat in your game, so let’s say you have it in your replicated storage for now. So put your hat in the service replicated service, and put the following code in ServerScriptService
1 | local HatName = “Hat” — Name of the hat |
2 | Local Hat = game.ReplicatedStorage:WaitForChild(HatName) — The hat |
3 | game.Players.PlayerAdded:Connect( function (Player) — Player event |
4 | Player.CharacterAdded:Connect( function () — Character Event |
5 | local char = workspace:WaitForChild(Player.Name) |
6 | local Clone = Hat:Clone() — Clones the hat |
Lemme know if this works!
MAKE SURE that you put the hat in Replicated Storage and put the EXACT name of the hat in the HatName variable.
This code will give the player the hat whenever the player joins, when they die, etc.
Closed as off-topic by JesseSong
This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.
Why was this question closed?