--onlineone
--Varaibles
char = script.Parent;
hum = char:WaitForChild("Humanoid");
UIS = game:GetService("UserInputService");
RS = game:GetService("ReplicatedStorage");
Remote = RS:WaitForChild("Remote");
UpdateWalkSpeed = Remote:WaitForChild("UpdateWalkSpeed");
speeds = {}
numSpeeds = 0;
callRestart = false;
--Functions
function Speed()print("1")
numSpeeds = numSpeeds + 1;
local function Restart() print(2)
for i, speed in pairs(speeds)do print(3)
if(numSpeeds > 1)then print("call restart")
callRestart = true;
numSpeeds = numSpeeds - 1;
break;
end
if(callRestart == true)then print("restarting")
callRestart = false;
if(i > 1)then
UpdateWalkSpeed:FireServer(hum.WalkSpeed / speeds[i - 1]);----WON'T PUT THIS VALUE IN NO MATTER WHEN
print(hum.WalkSpeed)print("/")print(speeds[i-1])print(hum.WalkSpeed / speeds[i - 1])
end
print("WALKSPEED:" .. hum.WalkSpeed)
Restart();
break;
end
if(i > 1)then
UpdateWalkSpeed:FireServer((hum.WalkSpeed / speeds[i - 1]) * speeds[i]);
print(hum.WalkSpeed / speeds[i - 1])print("*")print(speeds[i])print((hum.WalkSpeed / speeds[i - 1]) * speeds[i])
else
UpdateWalkSpeed:FireServer(hum.WalkSpeed * speeds[i]);
print(hum.WalkSpeed)print("*")print(speeds[i])print(hum.WalkSpeed * speeds[i])
end
wait(0.05 * i);
if(i == #speeds)then
numSpeeds = numSpeeds - 1;
end
end
end
Restart();
end
UIS.InputBegan:Connect(function(input)
if(input.KeyCode == Enum.KeyCode.LeftShift and
hum.WalkSpeed ~= 0)then print("firing")
Speed();
end
end)
--Body
for i = 1, 4 do
table.insert(speeds, i, 1 + (0.35 / i));
end
table.insert(speeds, 5, 1);
The line that says, WON'T PUT THIS VALUE IN NO MATTER WHEN, is the line with the error. The code seemingly updates the player walkspeed, identical to every other time the script does it. However, the feedback shows the following:
restarting 18.800001144409 / 1.175 16.000000973965 WALKSPEED:18.800001144409
The code understands to turn the walkspeed back to 16. It does so, but then, the very next second, it turns back to 18.8. I've tried adding waits everywhere, putting the UpdateWalkSpeed:FireServer in a separate function and calling it from far away, moving it. But no matter how I divide or where I move that line of code ``UpdateWalkSpeed:FireServer(hum.WalkSpeed / speeds[i - 1]); It doesn't change its flawed result. Please, I've been up for the last 3 hours (it's 2:41 am currently) pondering what the possible source of this error could be. I would appreciate it more than anything if someone else knows the solution. Thanks!! :)

2 comments
this is not java, this is lua. this ; is not being used like that in lua
@Gameplayer36547v2, Lua supports putting semi-colons after lines in your code, just certain lines can't have it. It doesn't affect the outcome of the code though.