I am wanting to make a script that makes a gui that looks like such
My script is not erroring but is making the position not accurate at all.
local Player = game.Players.LocalPlayer
local rs = game:GetService("RunService")
local HRP = script.Parent:WaitForChild("HumanoidRootPart")
local Frame = Player.PlayerGui.ProgressBarUI.ProgessBar
game.Workspace:WaitForChild("AllDoors") game.Workspace.AllDoors:WaitForChild("Final")
local End = game.Workspace.AllDoors.Final.Ground
local image = script.ImageLabel:Clone()
image.Parent = Player.PlayerGui.ProgressBarUI.ProgessBar
rs.Heartbeat:Connect(function()
local x = (HRP.Position - End.Position).Magnitude
local h = (HRP.Position - game.Workspace.SpawnLocation.Position).Magnitude
local r = Frame.Size
image.Position = UDim2.new(x/h,0,Frame.Size.Y.Scale /2,0)
end)
The position script is in the heartbeat function.