Ok, so this is my dilemma. I am making a tracking gui for a moving hand, and to track where the player is in between the start, and finish of a map. This is the code. Can someone show me how I can get the speed of the moving hand, and check if it is in between the start, and finish?
local Player = game.Players.LocalPlayer local pos1 = nil local pos2 = nil local playerspeed = Player.Character.Humanoid.WalkSpeed --studs a second local torso = Player.Character.Torso.Position local initX = script.Parent.Size.X.Offset while wait() do pos1 = game.Workspace.TheHand.Hand.Position pos2 = game.Workspace:FindFirstChild(Player.Name).Torso.Position point = game.Workspace.TheHand.Finish.Position local handdistance = (pos1 - point).magnitude local fromplayer = (pos1 - point).magnitude local pointdistance = (pos2 - point).magnitude local handtime = fromplayer/25 local arrivaltime = pointdistance/playerspeed --print('The hand is '..handaway..' seconds away!') local Pie = (pointdistance / 16) script.Parent.LPlayername:TweenPosition(UDim2.new(1, -115, 0, 1000/initX*Pie),"Out","Sine",0.25) script.Parent.Hand:TweenPosition(UDim2.new(-1.5, 0, 0, 1000/initX*handtime),"Out","Sine",0.25) end
Well, I have noticed a few errors in the script. You set the "local pos1" to "nil" same as pos2, meaning you have no record of positions. as in:
You should set pos1 to your start line, then pos2 to the finish. Then add checkpoints throughout your map. For this each checkpoint should have a script which says to give a point to a table next to the players name in the players tab. which entails that you know how to make a table. So each time you pass a checkpoint you gain a point.
Then if you were to time it, I suggest using a wait feature. every second add another section to the table and every second it adds a point to the new section named time "(secs)".