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

Positioning this brick doesn't work?

Asked by 7 years ago

I have a localscript inside StarterGui with a part inside it called 'Health' with a billboard gui inside. I am trying to weld it to the players head then move it up 10 studs. It succesfully welds to the players head but at the origin of the head. How could I fix this? I have tried:

gui.CFrame = playershead.CFrame + Vector3.new(0,10,0)

My code -

wait(1)
local camera = game.Workspace.CurrentCamera
local playershead = game.Workspace:FindFirstChild(game.Players.LocalPlayer.Name).Head
local gui = script.Health
gui.Parent = camera
gui.Position = playershead.Position + Vector3.new(0,10,0)
local weld = Instance.new("ManualWeld")
weld.Parent = gui
weld.Part0 = gui
weld.Part1 = playershead

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You need to use

weld.C0 = CFrame.new(playershead.Position.X, playershead.Position.Y+10, playershead.Position.Z) 

instead of gui.Position

Ad

Answer this question