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

This part of the script is working fine in Roblox Studio, but working differently in game?

This part of my code is working fine in Roblox Studio (with the rest of the script), but in game mode this part of code is working different, the hat is being cloned into the player but not worn, but on the ground...

What could I do to fix it?

local hat = game.Lighting.Hats.KnightHat:Clone()
hat.Parent = player.Character

5 comments

0

Try making it a local script...

0

Is this a LocalScript? Is FilteringEnabled set to true?

0

It is already a local script, I don't know what's FilteringEnabled

0

Try "local hat = game.Lighting:WaitForChild("Hats"):WaitForChild("KnightHat"):Clone()"

0

Tried FilteringEnabled set to true (idk why) but it got even worse in game, Tried also changing that line of code but still works perfect in Roblox Studio but not in game mode. :/

1 answer

✓ Accepted answer

Making a Hat a child of Character won't help as much when playing in the server, You have to set the Hat's handle's CFrame.

hat.Handle.CFrame = char.Head.CFrame * CFrame.new(0, char.Head.Size.Y / 2, 0) * hat.AttachmentPoint:inverse() --  this basically places the hat on the player.

1 comment

0

Thanks alot!

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