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

How to put a hat on a player?

Asked by 9 years ago

I was wondering how I would put a hat on a player?

I really dont have any idea.

1 answer

Log in to vote
0
Answered by 9 years ago

Firstly, Parent the hat to the player

game.ServerStorage.Hat:clone().Parent = player.Character

Then, use this equation to place the hat onto the right position of the body of the character.

hat.Handle.CFrame = char.Head.CFrame * CFrame.new(0, char.Head.Size.Y / 2, 0) * hat.AttachmentPoint:inverse()

So, In all, If I were to have variable named player that represented the character, the script would be this:

player = game.Players.LocalPlayer.Character
local hat = game.ServerStorage.Hat:clone().Parent = player
hat.Handle.CFrame = player.Head.CFrame * CFrame.new(0, player.Head.Size.Y / 2, 0) * hat.AttachmentPoint:inverse()
Ad

Answer this question