Dashing problem

(Im posting this for a friend due too them unable too use dev forum)

both the ring mesh and the dash particles always face forward based on the humanoid root part’s orientation. a bit of a bug when it comes to shift/mouse locking.

local userinput = game:GetService(“UserInputService”)
local tweenservice = game:GetService(“TweenService”)

local player = game:GetService(“Players”).LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local HRP = character:WaitForChild(“HumanoidRootPart”)
local humanoid = character:WaitForChild(“Humanoid”)

local mouse = player:GetMouse()

local cooldown = false
local cooldown_TIME = 1

local playergui = player:WaitForChild(“PlayerGui”)
local abilitiesgui = playergui:WaitForChild(“AbilitiesGui”)
local cooldownblur = abilitiesgui.ImageLabel.DashCooldownBlur

local rotval = script.Rotation.Value

local DefaultFoV = 70

local Properties1 = {FieldOfView = 80}
local Properties2 = {FieldOfView = DefaultFoV}
local Info1 = TweenInfo.new(0.05, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local Info2 = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local abilityimg = abilitiesgui.ImageLabel.DashAbilityImage
local fovtween1 = game:GetService(“TweenService”):Create(game.Workspace.CurrentCamera, Info1, Properties1)
local fovtween2 = game:GetService(“TweenService”):Create(game.Workspace.CurrentCamera, Info2, Properties2)

function tween(object, duration, property, goal, style, direction)

local tweengoal = {}
tweengoal[property] = goal
local tweeninfo = TweenInfo.new(duration)
local tweenplay = tweenservice:Create(object, tweeninfo, tweengoal)
tweenplay:Play()
return tweenplay

end;

local tweenInfoa = TweenInfo.new(0.1)
local tweenappear = tweenservice:Create(cooldownblur, tweenInfoa, {ImageTransparency = 0.25})

local tweenInfob = TweenInfo.new(0.5)
local tweendisappear = tweenservice:Create(cooldownblur, tweenInfob, {ImageTransparency = 1})

local tweenInfoabilityimg = TweenInfo.new(0.025)
local tweenabilityimgin = tweenservice:Create(abilityimg, tweenInfoabilityimg, {Size = UDim2.new(0.164, 0,0.26, 0), Position = UDim2.new(0.306, 0, 0.569, 0)})

local tweenInfoabilityimg = TweenInfo.new(0.25)
local tweenabilityimgout = tweenservice:Create(abilityimg, tweenInfoabilityimg, {Size = UDim2.new(0.181, 0, 0.307, 0), Position = UDim2.new(0.294, 0, 0.543, 0)})

userinput.InputBegan:Connect(function(key, boolen)

if boolen == false then

	if key.KeyCode == Enum.KeyCode.Q and cooldown == false and humanoid.MoveDirection.Magnitude >= 0.5 then

		cooldown = true

		local dashsound = game.ReplicatedStorage.Sounds.Dash:Clone()
		dashsound.Parent = character.HumanoidRootPart
		dashsound:Play()

		tweenappear:Play()

		tweenabilityimgin:Play()

		tweenabilityimgin.Completed:Wait()

		tweenabilityimgout:Play()

		humanoid:LoadAnimation(script.Animation):Play()

		local DashFXRing = game.ReplicatedStorage.JumpFX.JumpRing:Clone()
		DashFXRing.Parent = workspace.Effects
		DashFXRing.CFrame = HRP.CFrame * CFrame.new (0, 0, -5) * CFrame.Angles(math.rad(-80), math.rad(rotval), 0)

		local DashFXParticles = game.ReplicatedStorage.JumpFX.DashParticles.DashEmitter:Clone()
		DashFXParticles.Parent = HRP

		tween(DashFXRing, 0.25, "Transparency", 1)
		tween(DashFXRing, 0.25, "Size", Vector3.new(15,1, 15))

		local body = Instance.new("BodyVelocity")
		body.MaxForce = Vector3.new(100000, 100000, 100000)
		body.Velocity = Vector3.new(0, 20, 0) + humanoid.MoveDirection * 125
		body.Parent = HRP
		game.Debris:AddItem(body, .05)

		fovtween1:Play()

		fovtween1.Completed:Wait(0.001)

		wait(0.05)

		DashFXParticles.Enabled = false

		fovtween2:Play()

		fovtween2.Completed:Wait(0.001)


		wait(cooldown_TIME)

		DashFXRing:Destroy()

		DashFXParticles:Destroy()

		tweendisappear:Play()


		cooldown = false

	else

		return

	end
	
end

end)

1 Like

Its because your setting it based on the humanoid root part’s CFrame. You could instead utilize the MoveDirection property of humanoid.

1 Like