Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a potion of speed that disables running?

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!

3 comments

0

this is all in a local script by the way.

0

What are you trying to achieve clearly?

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.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.