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

How to have hats on player joined? [closed]

Asked by 4 years ago
Edited 4 years ago

Well i am asking this because i will use it for a military group but the tutorials i only saw are about uniforms. The hat i will use has a few meshparts and parts.

0
when a player joins parent the hat to the player ShineBright2775 30 — 4y

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?

1 answer

Log in to vote
0
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

local HatName = “Hat” — Name of the hat
Local Hat = game.ReplicatedStorage:WaitForChild(HatName) — The hat
game.Players.PlayerAdded:Connect(function(Player) — Player event
     Player.CharacterAdded:Connect(function() — Character Event
          local char = workspace:WaitForChild(Player.Name)
          local Clone = Hat:Clone() — Clones the hat
          Clone.Parent = char
     end)
end)

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.

0
This cod, iamtryingtofindname 22 — 4y
Ad