Hey everyone.
I’ve been working on a new game, but im stuck at a very serious issue that I can’t seem to figure out. I didn’t know what catagory to put this in, but this seemed the most reasonable. Hoping someone here can enlighten me but let me explain the issue.
So last night while testing my game, I noticed that when the player dies to a kill brick, there is a small chance that the player doesn’t respawn, the camera rotates 180 degrees, and the player can keep rotating their camera, not move, only rotate. If the player tries to respawn, the camera would just flip and they wouldn’t repsawn. The game uses a checkpoint system to respawn, code below. I’ve tried to change the system to a different script, yet the issue still appeared. I also tried to change the kill brick code, yet no luck. Now today, I haven’t changed anything about the game, but I can’t replicate the issue. I am still worried though that it can happen. I also do not have any scripts that run anything when players die.
Checkpoint Code:
local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")
local checkpoint = script.Parent
function onTouched(hit)
if hit and hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid") then
local player = Players:GetPlayerFromCharacter(hit.Parent)
local checkpointData = ServerStorage:FindFirstChild("CheckpointData")
if not checkpointData then
checkpointData = Instance.new("Folder")
checkpointData.Name = "CheckpointData"
checkpointData.Parent = ServerStorage
end
local userIdString = tostring(player.UserId)
local checkpointValue = checkpointData:FindFirstChild(userIdString)
if not checkpointValue then
checkpointValue = Instance.new("ObjectValue")
checkpointValue.Name = userIdString
checkpointValue.Parent = checkpointData
player.CharacterAdded:connect(function(character)
wait()
local storedCheckpoint = ServerStorage.CheckpointData[userIdString].Value
character:MoveTo(storedCheckpoint.Position + Vector3.new(math.random(-4, 4), 4, math.random(-4, 4)))
end)
end
checkpointValue.Value = checkpoint
end
end
checkpoint.Touched:Connect(onTouched)
If anyone can help me find out what could be possible issues as what could cause what I describle, please let me know. Thank you.