LinearForce going forward for some reason?

I made a simple pogo localscript for a tool, but for some reason, it sometimes glitches out and sends me forward a little bit or just straight up flings me
I have no idea of what could be causing this to be honest

Flings:


Throwing me slightly away:

My script:

local player = game.Players.LocalPlayer
local tool = script.Parent
local attachment = Instance.new("Attachment")
attachment.Parent = player.Character.HumanoidRootPart

local canclick = true

function Hitbox()
	if not canclick then return end
	canclick = false

	local handle = tool.Handle
	local handlePos = handle.Position

	local hitbox = Instance.new("Part")
	hitbox.Name = "Hitbox"
	hitbox.Size = Vector3.new(4, 7, 4)
	hitbox.Material = Enum.Material.ForceField
	hitbox.CanCollide = false
	hitbox.Massless = true
	hitbox.Color = Color3.new(1, 0, 0.0156863)
	hitbox.CFrame = CFrame.new(handlePos.X, handlePos.Y - 6, handlePos.Z)
	hitbox.Parent = tool

	local weld = Instance.new("Weld")
	weld.Part0 = handle
	weld.Part1 = hitbox
	weld.C0 = handle.CFrame:ToObjectSpace(hitbox.CFrame)
	weld.Parent = handle

	hitbox.Touched:Connect(function(hit)
		if hit.Parent == workspace.Spikes then
			local Bounce = Instance.new("LinearVelocity")
			Bounce.MaxForce = math.huge
			Bounce.Parent = player.Character.HumanoidRootPart
			Bounce.Attachment0 = player.Character.HumanoidRootPart.Attachment
			Bounce.VectorVelocity = Vector3.new(0,40,0)
			task.wait(0.1)
			Bounce:Destroy()
		end
	end)

	game:GetService("Debris"):AddItem(hitbox, 0.1)
	task.delay(0.3, function()
		canclick = true
	end)
end

tool.Activated:Connect(Hitbox)

1 Like

I find this is enough
player.Character.HumanoidRootPart.AssemblyLinearVelocity = Vector3.new(0, 100, 0)
to make character jump upward.
Instead of using “LinearVelocity”.

1 Like

i think linearvelocity moves upwards relative to the humanoidrootpart direction and something is causing it to shift, maybe collision with the spikes

if you set assemblylinearvelocity it should push in the absolute Y direction instead of relative to hmr

1 Like

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