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

I can't change the camera back to classic on death! Can someone help me?!

I'm having trouble trying to change the camera back to Classic once you die. Can someone help me fix my script?

game:GetService('Players').PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild('Humanoid').Died:connect(function()
			local player = game.Players.LocalPlayer
			player.CameraMode = "Classic"
		end)
	end)
end)

3 comments

0

by the way, the camera mode is currently set on LockFirstPerson

0

you can simply put a local script in StarterCharacterScripts to reset the camera on the players death.

0

how would i do that?

1 answer

#What You Need

FilteringEnabled is stipping you from doing what you want to do.. You're going to have to either setup a RemoteEvent to do this for you, or do everything on the client.


##RemoteEvent Option

Place a RemoteEvent in ReplicatedStorage, use FireClient on the server, and OnClientEvent on the client. Do any camera manipulation on the client.


Script in ServerScriptStorage;

local death = game.ReplicatedStorage.Died --This is the RemoteEvent

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild('Humanoid').Died:connect(function()
			death:FireClient(player)
		end)
	end)
end)

LocalScript in StarterPack;

local player = game.Players.LocalPlayer
local re = game.ReplicatedStorage.Died

re.OnClientEvent:Connect(function()
	player.CameraMode = "Classic"
end)

##Client-Sided Option

If you do everything on the client, there's no need to setup a RemoteEvent. Place a LocalScript in StarterPack;

local plr = game.Players.LocalPlayer

repeat wait() until plr.Character

local char = plr.Character
local hum = char:WaitForChild("Humanoid")

hum.Died:Connect(function()
	player.CameraMode = "Classic"
end)

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