Linear velocity wall clip

So basically i have dash system based on linear velocity. But if you try to jump vertically next to the wall it can just clip through.

So here is smth like corner clip (part above is union)

And here there is just a straight invisible wall. I just spammed dash in different directions (sry, couldn`t replicate clip with visible wall for better understanding)

Here is my dash script

local function dash(actionName, inputState)
	if inputState == Enum.UserInputState.Begin then
		if not player:GetAttribute("Dash") then return end
		if player:GetAttribute("DashDisabled") then return end
		if player.Character and player.Character:FindFirstChild("Humanoid") then
			if player.Character:FindFirstChild("Humanoid").WalkSpeed <= 0 then return end
			player:SetAttribute("Dash", false)
			sitting = false
			
			animtrack1:Stop() animtrack2:Stop() animtrack3:Stop() animtrack7:Stop() animtrack7:Play()
			local LinearVelocity = Instance.new("LinearVelocity")
			LinearVelocity.MaxForce = 99999
			LinearVelocity.Attachment0 = player.Character.HumanoidRootPart.RootAttachment
			if player.Character.DirectionHandler:GetAttribute("VerticalDirection") and player.Character.DirectionHandler:GetAttribute("VerticalDirection") == "up" and player.Character.DirectionHandler:GetAttribute("HorizontalDirection") and player.Character.DirectionHandler:GetAttribute("HorizontalDirection") == "neutral" then
				LinearVelocity.VectorVelocity = player.Character.DirectionHandler.CFrame.LookVector * 60
			elseif lookingdown and player.Character.Humanoid.FloorMaterial ~= Enum.Material.Air then
				LinearVelocity.VectorVelocity = player.Character.DirectionHandler.CFrame.LookVector * 0
			elseif lookingdown and player.Character.Humanoid.FloorMaterial == Enum.Material.Air then
				LinearVelocity.VectorVelocity = player.Character.DirectionHandler.CFrame.LookVector * 175
			else
				LinearVelocity.VectorVelocity = player.Character.DirectionHandler.CFrame.LookVector * 75
			end
			LinearVelocity.Parent = player.Character.HumanoidRootPart
			if not lookingdown then
				for count = 1, 8 do
					task.wait(0.05)
					if count == 1 then
						createclone()
					elseif count == 2 then
						createclone()
					elseif count == 4 then
						createclone()
					elseif count == 5 then
						break
					end
					LinearVelocity.VectorVelocity *= 0.6
				end
			elseif lookingdown then
				for count = 1, 10 do
					task.wait(0.01)
					if count == 2 then
						createclone()
					elseif count == 5 then
						createclone()
						break
					end
					if player.Character.Humanoid.FloorMaterial ~= Enum.Material.Air then break end
					LinearVelocity.VectorVelocity *= 0.7
				end
			end
			lookingdown = false
			canupdatedashcooldown = true
			LinearVelocity:Destroy()
			updatedashcd()
		end
	end
end

And here is some anti-fling scripts if needed

local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
hrp.Touched:Connect(function(hit)
	if hit then
		if hit.Parent then
			if hit.Parent.ClassName ~= ("Model") and hit.Parent.ClassName ~= ("Accessory") then
				if script.Parent:WaitForChild("HumanoidRootPart"):FindFirstChild("LinearVelocity") then
					script.Parent:WaitForChild("HumanoidRootPart"):FindFirstChild("LinearVelocity").VectorVelocity = Vector3.new(0,0,0)
					script.Parent:WaitForChild("HumanoidRootPart"):FindFirstChild("LinearVelocity"):Destroy()
				end
			end
		end
	end
end)
local rs = game:GetService("RunService")
local char = player.Character or player.CharacterAdded:Wait()
rs.RenderStepped:Connect(function()
	if char and char:FindFirstChild("DirectionHandler") then
		if char:FindFirstChild("DirectionHandler").CFrame.Position.X < -1 or char:FindFirstChild("DirectionHandler").CFrame.Position.X > 1 then
			char:MoveTo(Vector3.new(0,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z))
		end
	end
end)

Is there any way to fix this?

I would be very grateful for help, because this greatly affects the gameplay, and I don’t know how to fix or replace it

2 Likes

Ok nvm i found the problem it was a script that keep the player in the middle of the path (the last script i provided)
Here is fixed version if anyone needs it

local rs = game:GetService("RunService")
local char = player.Character or player.CharacterAdded:Wait()
rs.RenderStepped:Connect(function()
	if char and char:FindFirstChild("DirectionHandler") then
		if char:FindFirstChild("DirectionHandler").CFrame.Position.X < -1 or char:FindFirstChild("DirectionHandler").CFrame.Position.X > 1 then
			char.HumanoidRootPart.CFrame = CFrame.new(0,char.HumanoidRootPart.Position.Y,char.HumanoidRootPart.Position.Z)
		end
	end
end)

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