I was working on a plane and thought of adding a gui to show the plane velocty and altitude but it doesnt work the gui doesnt show up
local Plane = script.Parent.Plane.Value
local Settings = require(Plane.Parent.Settings.Config)
Plane.PilotSeat:GetPropertyChangedSignal("Occupant"):Connect(function()
local plr = game.Players:GetPlayerFromCharacter(Plane.PilotSeat.Occupant.Parent)
print(plr.."seated")
if plr then
local gui= Instance.new("ScreenGui")
gui.Parent = plr.PlayerGui
gui.Name = "PlaneGui"
local Frame = script.Frame:Clone()
Frame.Parent = gui
while wait() do
local Engine = Plane:FindFirstChild("Engine")
local vSpeed = math.sqrt((Engine.Velocity.x)^2+(Engine.Velocity.y)^2+(Engine.Velocity.z)^2)
Frame.ALT.Text = ' ALTITUDE: ' .. math.ceil(Plane.Engine.Position.Y -5)
if math.floor(vSpeed) <= Settings.StallSpeed then
Frame.SPD.TextColor3 = Color3.new(1, 0.462745, 0.415686)
elseif math.floor(vSpeed) > Settings.StallSpeed then
Frame.SPD.TextColor3 = Color3.new(255, 255, 255)
end
Frame.SPD.Text = " SPEED: ".. math.floor(vSpeed).." Kt"
Frame.COORDS.Text = "COORDS:("..math.ceil(Engine.Position.X)..","..math.ceil(Engine.Position.Z)..")"
end
else
plr.PlayerGui.PlaneGui:Destroy()
end
end)
pls help thx