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

Auto hat giver On player Joined?

Asked by 6 years ago

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.

0
Connect a function on CharacterAdded that clones the hat and puts it inside the player's character. Rheines 661 — 6y
0
Will everyone be able to see that hat, and will it be positioned correctly? NinjaXDpro 22 — 6y
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 NinjaXDpro 22 — 6y
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. Rheines 661 — 6y

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago
Edited 6 years ago

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.
0
How do i make it so everyone can see it? Ive already tried Rhenies way.. It didnt work for me NinjaXDpro 22 — 6y
Ad

Answer this question