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

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

Asked by
RoyMer 301 Moderation Voter
9 years ago

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
0
Try making it a local script... Dr_Doge 100 — 9y
0
Is this a LocalScript? Is FilteringEnabled set to true? Redbullusa 1580 — 9y
0
It is already a local script, I don't know what's FilteringEnabled RoyMer 301 — 9y
0
Try "local hat = game.Lighting:WaitForChild("Hats"):WaitForChild("KnightHat"):Clone()" Redbullusa 1580 — 9y
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. :/ RoyMer 301 — 9y

1 answer

Log in to vote
2
Answered by
rexbit 707 Moderation Voter
9 years ago

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.
0
Thanks alot! RoyMer 301 — 9y
Ad

Answer this question