Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Player's camera breaks when you die/reset?

Help, I'm making an RC car game. When you use the RC car without death it works like normal. But when you reset/die, the vehicle camera completely breaks and it is stuck at the place you died. When you go into a car, it just does this weird eye-breaking thing where your screen flickers and let's just say that was not a good experience. The scripts are parented to a vehicleseat. First there's a server script inside the vehicleseat, then there's a localscript parented to the server script.

ServerScript:

print("Camera script loading")

script.Parent.ChildAdded:Connect(function(weld)
	if weld.Name == "SeatWeld" then
		local h = script.Parent.Occupant
		wait()
		if h.Sit == true then
			local newscript = script.CameraChange:Clone()
			newscript.Parent = h.Parent	
		end  
	end
end)

LocalScript:

Camera = game.Workspace.CurrentCamera
Object = game.Workspace.Toyota.Toyota.Shell
Player = script.Parent.Humanoid
Camera.CameraSubject = Object
Camera.CameraType=3
while wait() do
	if Player.Sit == false then
	Camera.CameraSubject = Player
	script:Destroy()
	end
end

1 answer

I've fixed it, the while wait() loop wasn't necessary, I deleted it and it works now.

This discussion is preserved as it was. New answers, comments, and votes are closed.