I made a simple spectate UI, how it works is when the player open the spectate window they have a next button and everytime they press it, it shows them the character of a different player they can spectate. This script is in a local script. The issue is that when a player dies if anyone is spectating them the camera will get stuck where they died and doesn’t respawn when the player respawns, it just stays in the spot they died. I tried to make a variable called “SpecPlr” and when that player dies, the camera switches to the new character spawn. The issue here was that from a local script you can’t get information if a different player dies so the event wasn’t even able to run.
script.Parent.Next.MouseButton1Up:Connect(function()
local Players = game.Players:GetPlayers()
number = number + 1
if Players[number] ~= nil then
camera.CameraSubject = Players[number].Character.Humanoid
script.Parent.Player.Text = Players[number].Name
SpecPlr = Players[number]
end
end)
I thought of this but do you think that this would cause too much lag because I am making an obby game with 25 players in one server who will be constantly dying.
I don’t think it will lag, but I think you Can try and test around and see does it lag , if you want, It should not tho the servers can easily handle a ton of death events
I don’t know any smarter or more efficient way at the moment , But I Don’t think its a problem. I suggest you use the remote event method unless you find a better way