You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make a SpeedGUI, which shows the player the current speed he is traveling at. What currently works is the driving and the GUI showing up to the player after he sat down.
What is the issue? Include screenshots / videos if possible!
So if the Train drives forward, the IntValue gets changed to its current speed. Now the TextLabel isn’t changing and just staying at 0. My guess is, that the IntegerValue of the Number and StringValue of the TextLabel aren’t cooperating.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried looking up for Integer/ String converters or functions, but couldn’t find any helpful.
-- This is the GUI Giver local Players = Game:GetService("Players") local workspace = Game:GetService("Workspace") local Seat = script.Parent local GUI = script.TestGui local Active = false local Player = nil local NewGui = nil Seat.ChildAdded:connect(function(Child) if Active == false then if Child.Name == "SeatWeld" then Active = true Player = Players:GetPlayerFromCharacter(Child.Part1.Parent) if Player ~= nil then PlayerGui = Player:FindFirstChild("PlayerGui") if PlayerGui ~= nil then NewGui = GUI:Clone() NewGui.Parent = PlayerGui end end end end end) Seat.ChildRemoved:connect(function(child) if child.Name == "SeatWeld" then if Active == true then Active = false pcall(function() NewGui:Destroy() end) Player = nil NewGui = nil end end end) while true do GUI.Frame.TextLabel.Text = Seat.SpeedInt.Value wait(1) end
-- This is the DriveScript while true do wait() if script.Parent.Throttle == 1 then script.Parent.SpeedInt.Value = script.Parent.SpeedInt.Value + 1 wait(.3) end if script.Parent.Throttle == -1 then script.Parent.SpeedInt.Value = script.Parent.SpeedInt.Value - 1 wait(.3) end if script.Parent.Throttle == -1 then script.Parent.SpeedInt.Value = 0 wait() end script.Parent.BodyVelocity.Velocity = script.Parent.CFrame.LookVector * (script.Parent.SpeedInt.Value) end
This is the TrainChassis if you want to look at it.
TrainChassis.rbxm (12,1 KB)