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

Speed calculation script not working accurately?

Asked by
lucas4114 607 Moderation Voter
9 years ago

First, I have 2 scripts that work together to get the tanks speed this is 1:

wait(0.35)
script.LastPositionUpdater.Disabled = false

while wait(1) do
    local Plr = game.Players.LocalPlayer
    local Tank = game.Workspace:FindFirstChild(""..Plr.Name.."'s_Tank")
    local speed = (Tank.Hitbox.Position - script.LastPosition.Value).magnitude
    print(speed)
    Tank.Hitbox.TankSpeed.Value = speed
end

this is 2:

while wait(1) do
    local Plr = game.Players.LocalPlayer
    local Tank = game.Workspace:FindFirstChild(""..Plr.Name.."'s_Tank")
    script.Parent.LastPosition.Value = Tank.Hitbox.Position
end

What they should do is get the speed of the tank in studs per second, it doesn't work or I dont think it does because what the script is outputing doesn't look like what the tank is really going. Here's an example, you can see by the texture in the baseplate that tank is going atleast 1.5 studs per second atleast 1 stud per second even, but the output is showing lower numbers: https://gyazo.com/8a5e5dc9e0c82341c68ae2f65a354b9e

Answer this question