Help with making Slide System

so i mostly just want a way to speed up a player based off a slope

i also have a script that already changes speed off a slope, but it only works while walking up a slope
code:

game:GetService("RunService").Heartbeat:Connect(function()
	local ray = workspace:Raycast(rootPart.Position, Vector3.new(0, -char.Humanoid.HipHeight - 2, 0), params)
	if ray then
		local dot = ray.Normal:Dot(rootPart.CFrame.LookVector)
		local speed = (16 + ((16 * dot) + 2 ))
		print(speed) --only prints while walking UP a slope, and prints 9 when walking up the slope
	else
--stop speed
	end
end)

Does the if block not run at all when walking down? Try making the ray longer?

1 Like

no the if statement seems to only run when going up the slope,

the ray doesnt have a set size so im pretty sure its the the length

The ray length is HipHeight + 2, which seems fine but I can’t see any other reason why this would work going one way but not the other. Are we to assume rootPart is the player’s HumanoidRootPart?

Can you show what you used for rayParams?

local params = RaycastParams.new()
params.FilterDescendantsInstances = {char}
params.FilterType = Enum.RaycastFilterType.Blacklist

solved it, didnt realize r15 and r6 with hipheight would change the ray

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