Will a sprint script cancel out other walkspeed scripts?

Say I have a LShift to sprint script and another script(w/ remote events) for powerups, will the sprint script cancel out the powerup script?

Im asking because I have a sprint w/ stamina GUI setup i got from CovertCode and little powerup tools scattered around which gives the player a temporary speed boost but it seems like the sprint script is canceling out the powerup script. I even put print statements such as player name, and current walkspeed all over to debug and theyre all printing fine and everything else is working besides the speed change. Maybe because the walkspeed is being changed in the sprint script it wont let the powerup change the walkspeed? Im not exactly sure how that works…

1 Like

you could try having using shared, which is a table containing variables that can be accessed by multiple scripts ( which is the same thing as _G ) and and set it to true when the powerup script is activated.

Example:

-- Script #1

shared["DisableSprint"] = false

if shared["DisableSprint"] == false then
   -- Execute Sprint Code
end
-- Script #2

if game.Players.LocalPlayer.Character:HasTag("PowerupEnabled") then
   shared["DisableSprint"] = true
end

ahh okay i didnt know that was a thing, ill have to do some research on it! since the powerup speed is faster than regular sprinting could I use something along the line of
if WalkSpeed == 30 then
shared[“DisableSprint”] = true
end

or is it better to use HasTag?

i just used :HasTag for the example, so the WalkSpeed check should work too.

I figured it out lol. I disabled the sprint stamina gui and script then retried it and it worked. still not too sure why exactly it happens but i stamina isnt a necessity in game so i got rid of it entirely.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.