So i've made an obby and in one of the levels at the start your walkspeed is set to 74 and you have to finish the whole level at that speed then at the end there is a slowdown that sets your speed to the default 16.This was all fine and well until i've introduced gamepasses into the game, some of them increase the speed of the player. So my question is how would i make it so that at the end of the level your speed is set to what ever it was before you started the level and your speed was set to 74?
this is the script at the start of the level, the one at the end is basicly the same but with different speed
local SpeedBoost = script.Parent local function steppedOn(part) local parent = part.Parent if game.Players:GetPlayerFromCharacter(parent)then parent.Humanoid.WalkSpeed = 74 end end SpeedBoost.Touched:connect(steppedOn)
I've adding scripts inside all parts of the level so that while the player is touching them his speed is 74 and then when he completes the level his speed is set to what it was, but if you have any cleaner and more effective solutions i'm all ears.
Thanks for your time.
local SpeedBoost = script.Parent SpeedBoost.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.WalkSpeed = 74 end end
this will work