I Make My Own Sonic's Boost But Have's Don't Working

Problem: InputEnded Sometimes Can't Execute

Example: (http://www.youtube.com/watch?v=VcCIbcnKsbg)

I Need Help, Because I'm Beginner & I Don't Know Much Scripting

My Boost Script:

local uis = game:GetService("UserInputService")

local player = game.Players.LocalPlayer

local char = player.Character

local humanoid = char:WaitForChild("Humanoid")

local sound1 = char:WaitForChild("Torso").SoundGroup.Sound1
local sound2 = char:WaitForChild("Torso").SoundGroup.Sound2
local sound3 = char:WaitForChild("Torso").SoundGroup.Sound3
local sound4 = char:WaitForChild("Torso").SoundGroup.Sound4

local RunService = game:GetService("RunService")

uis.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift and humanoid.WalkSpeed == 50 then
		
		mo = char:WaitForChild("Mo")

		mo.Disabled = true
		
		char.Humanoid.WalkSpeed = 300
				
		local blur = game.Lighting.Blur
		
		blur.Size = 10
		
		local bloom = game.Lighting.Bloom
		
		bloom.Threshold = 0.8
		
		bloom.Size = 56
		
		sound1:Play()
		sound2:Play()
		sound3:Play()
		sound4:Play()
		
		game.Workspace.Camera.FieldOfView = 80
		
		gui = Instance.new("ScreenGui",game.Players.LocalPlayer.PlayerGui)

	local image = Instance.new("ImageLabel",gui)

		gui.Name = "Effect"

		gui.Enabled = false

		image.Name = "Wave"

		image.Image = "rbxassetid://11528455881"

		image.BackgroundTransparency = 1

		image.ImageTransparency = 0.3

		image.Size = UDim2.new(0.09,0,0.15,0)

		image.Position = UDim2.new(0.444,0,0.404,0)

		gui.Enabled = true
		
		image:TweenSizeAndPosition(
			UDim2.new(1.727, 0,2.879, 0),
			UDim2.new(-0.364, 0,-0.94, 0),
			Enum.EasingDirection.InOut,
			Enum.EasingStyle.Quad,
			0.3,
			false
		)
			
		wait(0.05)
		
		game.Workspace.Camera.FieldOfView = 90
		
		wait(0.05)
		
		game.Workspace.Camera.FieldOfView = 100
		
		wait(0.01)

		bloom.Threshold = 2

		bloom.Size = 24
		
		wait(0.105)

		blur.Size = 0

	end
end)


uis.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		if humanoid.MoveDirection.Magnitude == 0 then

			mo.Disabled = false
			char.Humanoid.WalkSpeed = 50
			sound1:Stop()
			sound2:Stop()
			sound3:Stop()
			sound4:Stop()

			game.Workspace.Camera.FieldOfView = 100

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 95

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 90

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 85

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 80

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 75

			wait(0.001)

			game.Workspace.Camera.FieldOfView = 70
			char.Humanoid.WalkSpeed = 50
			gui:Destroy()
		end
	end
		
end)

Momentum Script (Don't Mine) = Variable: Mo

local MaxSpeed = 50
local Multiplier = 1.07
local BaseSpeed = 2

while true do wait()
	if script.Parent.Humanoid.MoveDirection == Vector3.new(0, 0, 0) then
		script.Parent.Humanoid.WalkSpeed = BaseSpeed
	else
		script.Parent.Humanoid.WalkSpeed = script.Parent.Humanoid.WalkSpeed * Multiplier
		if script.Parent.Humanoid.WalkSpeed >= MaxSpeed + 1 then 
			script.Parent.Humanoid.WalkSpeed = MaxSpeed
		end
	end
end

Bye.r

1 comment

0

try putting the InputEnded function in the same function as the InputBegan function maybe?