What I mean by the title is I want to make it so that if you press / hold crouch you will not be able to walk of an edge.
I have tried raycasting:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Running:Connect(function()
local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.FilterDescendantsInstances = {character}
local RayResult = workspace:Raycast(character.HumanoidRootPart.Position, Vector3.new(0,-10, 0), RayParams)
if RayResult then
print(RayResult.Instance:GetFullName())
--Check if the player is by the edge or not
end
end)
end)
end)
But I don’t know how I would check if they are on the edge.