Player teleporting to the void

Hello!
I have been working on a top down game which has jumping disabled it has a look at mouse script.
(I am including this information because I think it might be relevant to the issue)

Basically, when the player gets above y6 they get sent to y 3.4[a bunch of numbers inbetween]e+38 and they die. Sometimes they wont respawn and will just be shown floating on other players’ screens, but on the victim’s screen will be in the void.

Here is an example:
(sorry for the bad quality)
robloxapp-20230514-1548083.wmv (2.3 MB)

1 Like

So the current information does not allow to give an answer, you probably expected it. Can you show the script that disables jumping or any other script that might be relevant to the issue? If you’re simply making the player’s jump power 0 then I see no problem with the disable jumping script. Try checking for script that affect the y position of the player, look for errors and resolve them if there is.

1 Like

sorry about that, here is code I found that edit’s the player’s Y level

local Player = game.Players.LocalPlayer
local Character = Player.Character
local Root = Character:WaitForChild("HumanoidRootPart")

local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function()
	local RootPos, MousePos = Root.Position, Mouse.Hit.Position
	Root.CFrame = CFrame.new(RootPos, Vector3.new(MousePos.X, RootPos.Y, MousePos.Z))
end)
1 Like

Simply enough, just get the humanoid of the player and do

humanoid.JumpPower = 0

I think it’s called JumpPower but I’m not sure

1 Like

That was the mouse look at script. The Humanoid’s jump power is already set.

PS - this bug is not only limited to ladders, it happens anytime the player’s Y level exceeds 6

1 Like

are you sure this is the code that edits the y position? It doesn’t say anything related to y6 or sending things to y about 3.4

edit: the code actually prevents the player (character) from moving in the y-axis

1 Like

This is the only script in my game that has anything to do with the player’s Y axis. I have been very confused because I have no clue what could cause this.

I recommend you search all scripts in your game for “.Y”
There must be something else.
(you can use a search tool already built in studio to do so)

After some troubleshooting, I found the problem. It was my camera script, but I am not sure what here is causing it.

local camera = workspace.CurrentCamera
local char =script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")
local runservice = game:GetService("RunService")

camera.CameraType = Enum.CameraType.Scriptable

local campart = Instance.new("Part")
campart.Name = game.Players.LocalPlayer.Name.."'s camera"
campart.Transparency = 1
campart.CanCollide = false
campart.Anchored = true
campart.Parent = workspace



runservice.RenderStepped:Connect(function()
	campart.CFrame = CFrame.new(char.Head.CFrame.Position + Vector3.new(0,25,0), char.Head.CFrame.Position)
	camera.CFrame = campart.CFrame

end)

Nice! However, are you sure this script is causing the problem? I read it, and it doesn’t change the character’s position in any way. It just access the player’s position (not change it) to calculate where the camera would be.

1 Like

also, local hrp = char:WaitForChild("HumanoidRootPart") is not needed because it isn’t used in the script

1 Like

I am 100% that the bug is fixed because I disabled and enabled scripts until the bug was fixed. Ultimately, this was the one causing the issues.

2 Likes

I just have a habit of listing the root part and the player in every local script I make

1 Like

no problem! that’s fine, just thought there might be more on the bottom!

1 Like

Cool! Could you please try walking on a ramp to see if it still glitches like your issue? (not a truss where you climb)

Perhaps, your camera teleports off because the character’s position disappear when you’re climbing.
Or, try hrp.Position, not char.head.position

1 Like

I tried both of your suggestions, but for some reason the glitch still occurs. Something that confuses me about it is that the camera just follows the player so how is it causing the bug?

1 Like

I understand how you’re feeling. Weird, huh? How about instead of render.stepped for both of your scripts, try using long wait times (as an experiment) like task.wait(0.1) and task.wait(0.15) so both scripts don’t conflict:

1st script is accessing mouse position to calculate head CFrame.
2nd script is editing camera that affects house position based on head CFrame

you get what I’m saying? Both scripts are causing some kind of loop… I’m not too sure if this might be causing it but perhaps you could see if it’s it?

Yeah, I understand. Tested it, but sadly, nothing. For even more assurance, I tested the game without the camera and it does work. I am currently trying to see if it has something to do with the part…

Definitely. Sorry I wasn’t able to see clearly in your video, but did your character die? or did your camera just get teleported?

If your character died, it could be something with the collisions. Try turning off collisions in char.head