Game gets softlocked when falling

What I want to make

  • I want to make my own gravity controller/wall walking script, and I’ve made some considerable progress. I’ve already made the player able to walk on walls by making my own player movement script and all I have to do is re-create the jump button, make the player rotate their character depending on where the camera is pointing at, and make the player tilt their character when walking on rotated surfaces in order to change their gravity.

THE ISSUES

  • When making the player rotate, it works completely fine until the player the falls off of the surface they’re walking on. Whenever the player falls off of the surface they’re walking on, the game seems to softlock (I can’t move my character at all).

  • A second issue I have is that the script I have can cling on to any walls that are touched instead of focusing on the walls/floors beneath the player

Video examples with “Streaming Integrity mode” both enabled and disabled

below are videos of the slope tilting script clinging on to vertical walls that the player shouldn’t cling on unless the player went on a slope that gradually changed from horizontal to vertical

(In these videos, I fall off of the wall, but the issue I stated before can happen anytime I fall off of a wall. I was just lucky in these videos)


I have not thought of any possible solutions as I don’t know why this would happen in the first place

I used a script that tilts the character based on the slope the character is standing on. I then edited it so it can work with my gravity controller script. Here is both the slope tilting script I’m using and I the post I originally got it from

local char = script.Parent
local rootPart = char.CustomMovementModel.MoverBlock
local xzGyro = char.CustomMovementModel.MoverBlock.AlignOrientation
local yGyro = char.CustomMovementModel.MoverBlock.AlignOrientation


while wait(.5) do
	local params = RaycastParams.new()
	params.FilterDescendantsInstances = {char}
	params.FilterType = Enum.RaycastFilterType.Blacklist
	local result = workspace:Raycast(rootPart.Position, Vector3.new(-10,-10,-10), params)

	yGyro.CFrame = CFrame.new(rootPart.Position, rootPart.Position + char.Humanoid.MoveDirection*10)

	if (result) then
		--print(result.Normal)
		local currentRightVector = rootPart.CFrame.RightVector
		local upVector = result.Normal
		local newFacialVector = currentRightVector:Cross(upVector)
		xzGyro.CFrame = CFrame.fromMatrix(rootPart.Position, currentRightVector, upVector, newFacialVector)
	end

end

Lastly, yes I know there is an open sourced gravity controller out there, but I want to make my own

1 Like

from my experience when the player is dissapearing and the gameplay pause thing pops up it means that the player is being flung or teleported an infinite distance

you’re dividing by 0, or have a 0/nil value somewhere. I’ve had this same issue pop up twice before when making a vehicle and character controller. Could be an issue with making the direction Vector3.new(-10,-10,-10). What’s that for?

1 Like

The un-modified version of the slope-tilting script I used didn’t rotate the player when the player tried to walk on a wall, so I changed it from Vector3.new(0,-10,0) to Vector3.new(-10,-10,-10). When I did that, the script allowed my player to tilt on a wall, allowing the gravity controller to make the player walk on the wall.

You said that the script seems like its dividing by 0, so how would I stop it from doing that?

I originally thought so too, but I decreased the gravity/the speed that the player falls at (essentially making the player glide), and the issue still happened

boosting the post. I still haven’t come up with a solution to this

I still have many problems with the script I’m using, but as a (sort of) solution, I just used slope alignment script, but this still comes with issues.

The new script I used: Slope alignment clipping - #10 by CrazyAlternetive

My new post about my current problems: How would I make a slope alignment script that also works when the player is upside down

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