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

How to make a potion of speed that disables running?

Asked by 2 years ago

Hello! Im making a game and im making a speed potion, but when i press shift it sets the speed to regular running speed, i try to disable the script, as its just a local script inside startergui, but when i disable it through script, it still allows you to press shift and set it back to regular running speed. how do i fix this?

script.Parent.Parent.Activated:connect(function()
    local player = game.Players.LocalPlayer or game.Players.PlayerAdded.Wait()
    local character = player.Character or player.CharacterAdded:Wait()
    local humanoid = character:WaitForChild("Humanoid")
    local uis = game:GetService("UserInputService")
    local anim = Instance.new("Animation")
    anim.AnimationId = "rbxassetid://9622067571"
    humanoid:LoadAnimation(anim):Play()
    script.Parent.Parent.Parent.Parent.Parent.StarterGui["Character Controller "].Disabled = true
    script.Parent.Parent.Parent.Parent.Parent.StarterGui["Character Controller "].ServerSide.Disabled = true
    wait(3.26)
    humanoid.WalkSpeed = 100
end)

thanks!

0
this is all in a local script by the way. nooby14327 2 — 2y
0
What are you trying to achieve clearly? Hudson_UltimateGamer 0 — 2y
0
a speed potion that speeds you up when you drink it that disables your running feature so that you wont be able to press shift and reset the running speed. nooby14327 2 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

I think you should use

humanoid.WalkSpeed = humanoid.WalkSpeed + 25 
wait(3.16)
humanoid.WalkSpeed = humanoid.WalkSpeed - 25 

for both the run script and potion instead of changing it to a direct value

Ad

Answer this question