Anime Speed Lines (when sprinting)

Shaking the camera, and adding anime speed lines when sprinting…
I have this script and when the player sprints I want to add thoses anime sprint lines over the screen and shake the screen a tiny bit for emission.

local uis = game:GetService("UserInputService")--User Input Service
local db = false --debounce
local tw = game:GetService("TweenService")--Tween service
local info = TweenInfo.new(0.2,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false,0) --tween info
local tween = tw:Create(workspace.CurrentCamera,info,{FieldOfView = 90}) --Starting Tween
local tweenBack = tw:Create(workspace.CurrentCamera,info,{FieldOfView = 70}) --Ending Tween

local SprintKey = Enum.KeyCode.LeftControl --Sprint Key

uis.InputBegan:Connect(function(key)--User Press Button
	if key.KeyCode == SprintKey then--Detect if player pressed spring Key
		db = true--set debounce to true
		while wait() do--loop
			if db == true and game.Players.LocalPlayer.Character then--detect if player have a character or not and if db = true
				repeat wait() until game.Players.LocalPlayer.Character.Humanoid--wait for humanoid
				game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 35--set walk speed to 22 "you can change that"
				tween:Play()--play the start tween
				break
			else
				break
			end
		end
		while db == true do--detect if db == true
			if game.Players.LocalPlayer.Stamina.Value > 0 then--detect if player stamina > 0
				game.Players.LocalPlayer.Stamina.Value = game.Players.LocalPlayer.Stamina.Value - 1 --dicrease player stamina
			else
				db = false--if player stamina < of = to 0 db will set to false
				break
			end
			wait()
		end
		if db == false and game.Players.LocalPlayer.Stamina.Value < game.Players.LocalPlayer.MaxStamina.Value then--detect if db == false
			game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16--set player speed to normal speed "16"
			tweenBack:Play()--play back tween
		end
	end	
end)

uis.InputEnded:Connect(function(key)--User Stop Pressing The Button
	if key.KeyCode == SprintKey then--Detect if player stoped holding pressed spring Key
		db = false--set debounce to false
		if game.Players.LocalPlayer.Character then--detect if player have a character
			repeat wait() until game.Players.LocalPlayer.Character.Humanoid--wait for humanoid
			game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16--set player speed to 16 "Normal Speed"
			tweenBack:Play()--Play the back tween
			while db == false and game.Players.LocalPlayer.Stamina.Value < game.Players.LocalPlayer.MaxStamina.Value do
				wait()
				game.Players.LocalPlayer.Stamina.Value = game.Players.LocalPlayer.Stamina.Value + 1
			end
		end
	end
end)
1 Like

just have a part with a particle emitter consisting of the effect you desire. then just bind a function to heartbeat that updates the CFrame of that part to the CFrame of the camera. you might have to tweak with it a bit, but that’s the gist.

2 Likes

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