Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Auto hat giver On player Joined?

Basically, I want to make it so. When I join my game if I am in this certain group. With a certain rank, it would give me a hat.

I already have the hat in my workspace. The hat is not created by roblox. It is created using meshparts and a mesh [http://prntscr.com/m7n7rt]

I have already created my auto uniform and this is the last thing I need to do to finish this.

4 comments

0

Connect a function on CharacterAdded that clones the hat and puts it inside the player's character.

0

Will everyone be able to see that hat, and will it be positioned correctly?

0

It didnt work, This is the script i did. local function onCharacterAdded(character) local x = script.Parent.GENERALSTAFF:clone() x.Parent = character end local function onPlayerAdded(player) player.CharacterAdded:Connect(onCharacterAdded) end

1

If it is in a server script, everyone can see it. You need to weld the hat to the character's head. To position it correctly, you can create an invisible head and put it in the hat. You can then set the CFrame of the fake head to the character's actual head, and it will be positioned correcty.

1 answer

✓ Accepted answer

Place your hat model in ServerStorage. Make sure the hat model is unanchored and welded together, here is a plugin you may use for this.

Clone it, and then weld the PrimaryPart of the clone onto the Character's head.

local hatModel = game.ServerStorage.CustomHat --This is your hat
local head = workspace.Goulstem.Head --This is your head

local hat = hatModel:Clone() --Clone it
local weld = Instance.new("Weld") --Create a weld
weld.Part0 = head --Configure properties
weld.Part1 = hat.PrimaryPart --Make sure you set the PrimaryPart
weld.Parent = head

You may set the weld object's C0 property in case the orientation is off.

######More on welds.

1 comment

0

How do i make it so everyone can see it? Ive already tried Rhenies way.. It didnt work for me

This discussion is preserved as it was. New answers, comments, and votes are closed.