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

Why does the walkspeed and jumpspeed change so weird?

Asked by 5 years ago

i made a script that gives the player a certain amount of walkspeed and jumppower every 3 seconds if the tool is clicked, but the result shows something else

print("loaded")

debounce = false



script.Parent.Activated:Connect(function()

if not debounce then

debounce = true

if script.Parent.Parent:FindFirstChild("Humanoid") then

script.Parent.Parent.Humanoid.WalkSpeed = script.Parent.Parent.Humanoid.WalkSpeed + 1/5

script.Parent.Parent.Humanoid.JumpPower = script.Parent.Parent.Humanoid.JumpPower + 1/10

wait(3)

debounce = false

end

end

end)

the result is 0.20000000298023 walkspeed and 0.10000000149012 jumppower when its supposed to just be + 0.2 walkspeed and + 0.1 jumppower. I added the / after to check if that would help but no it didnt at all

2 answers

Log in to vote
0
Answered by
ben0h555 417 Moderation Voter
5 years ago
Edited 5 years ago

Are you sure there isn't anything else editing the walkspeed?

If that is the only thing that is editing the walkspeed it is either a glitch or something on the engine side that is doing that, the decimals you are showing are so close to the actual numbers it shouldn't make any noticeable difference if that is the case.

0
i have that value as a screengui so the player can see how much speed and jumppower they currently have since i havent successfully put in a leaderboard yet Gameplayer365247v2 1055 — 5y
0
and yes there is nothing else changing the walkspeed Gameplayer365247v2 1055 — 5y
0
Then its something engine side or a bug. Or maybe your gui is a tad messed up. @Gameplayer365247v2 ben0h555 417 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

As far as I know, that's kinda what happens in Roblox with rounding numbers sometimes. If I were to create a new NumberValue and set its Value to 0.2, then it would instead be set to something like 0.2000000000000000111.

Answer this question