I wanted to make a script so that when a player dies, their camera is reset to the default one. Since Humanoid.died only works on the server side, and Enum.CameraMode only works on the client side, I did some research and discovered that I needed to use remote events.
Server Script:
toggle = false
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
toggle = true
game.ReplicatedStorage.RemoteEvent:FireClient()
print("ToggledOn")
print("SentToClient")
toggle = false
end)
end)
end)
local RunService = game:GetService("RunService")
RunService.Stepped:Connect(function()
if toggle == false then
print("ToggledOff")
end
end)
I believe it should fire a remote event to the client script. (I don't really understand Remote Event that much.)
LocalScript:
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(player)
print("RecievedFromServer")
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
end)
so they should both print something but I don't see the recieve or sent message. All I see is this in the output: Argument 1 missing or nil
can someone help me with this?

1 comment
Thank you, all I had to do was put player inside of the brackets just like you said