Hey I’ve recently come back to roblox after 2 years and I’ve been doing good till I got here,
My wait script isn’t working no matter where I put it in the script (Client), this leads into a server event to add cash to a players account depending on the speed they are traveling.
I’ve tried putting it in almost every line using Task wait and wait but nothing so far, I assume this is something so simple that I am looking over but apparently I can’t catch it.
local bike = script.Parent.Bike.Value
local handler = bike:WaitForChild("add")
local values = script.Parent.Values
function sendCash(amt, plr)
if bike and values.Parent.IsOn then
print(amt,plr)
--handler:FireServer(amt, plr)
end
end
values.Velocity.Changed:Connect(function()
task.wait(0.2)
local spd = math.floor((10/12) * (60/88)*values.Velocity.Value.Magnitude)
if spd >= 30 then
local plr = game.Players.LocalPlayer
local amt2 = spd/10*(spd/100+1)
local amt3 = math.floor(amt2+0)
local amt4 = math.clamp(amt3, 1, 65)
sendCash(amt4,plr)
task.wait(0.2)
end
end)