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

The velocity of the wheels isnt changing?

Asked by
Il_5x5 10
4 years ago
local Wheel1 = script.Parent.Wheels.FL
local wheel2 = script.Parent.Wheels.FR
local Wheel3 = script.Parent.Wheels.RL
local Wheel4 = script.Parent.Wheels.RR
local rep = game.ReplicatedStorage
local Vel = Wheel1.Velocity
local Vel2 = wheel2.Velocity
local Vel3 = Wheel3.Velocity
local Vel4 = Wheel4.Velocity

rep.V.OnServerEvent:Connect(function(player)
    local SpeedPerStud = 1
    local character1 = player.Character
    local LastPosition = character1.HumanoidRootPart.Position
    local DistanceFromLastPosition = (character1.HumanoidRootPart.Position-LastPosition).magnitude
    Vel = Vel+(DistanceFromLastPosition+SpeedPerStud)
    local LastPosition = character1.HumanoidRootPart.Position
    print("works") -- this prints
end)
0
any errors? AlexanderYar 788 — 4y
0
what type of velocity is it? AlexanderYar 788 — 4y
0
No there is no errors and i am not sure i just typed in velocity Il_5x5 10 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

ok 3 problems...

1) Velocities have 3 vectors, and it goes in that direction relative to the world i think. so trying to do

 Vel = Vel+(DistanceFromLastPosition+SpeedPerStud)

wont work, distance fromlast position is one number, and vector 3s have 3 values

2) To change a velocity, you need its velocity property, so to change it, you gotta do

VelocityName.Velocity = a Vector3

3) when you declare last position at the beginning, it doesnt do anything, its the same as calling the normal position because it happens at the same time almost cause scripts are fast, so distancefromalast position is actually 0, or close to it. I dont understand exactly what your trying to do so i cant make a script but i jsut want you to know these things so you can fix your code if you need.

i hope this helps :>

1
THANK YOU cutie ;) Il_5x5 10 — 4y
0
thx ',:3 AlexanderYar 788 — 4y
Ad

Answer this question