So I’ve set up a camera, to be used for spectators who have died in the game. Instead of the regular spectator switching or what not, I wanted to give it some uniqueness.
I’m going to also make sure the part is invisible using transparency, this was just for debugging purposes.
Is it also a good idea? Instead of just using the regular switching to a different player shenanigans?Should I just use this instead?
Thanks, i’m happy you liked it. One more question though, you don’t need to be a scripter to answer:
Would you prefer this as a spectating system, or the regular switching from player to player? What I mean is would you rather have this camera system for spectators or this?
Obviously I would make the UI look better but yeah.
What if you unbinded a bound .RenderStep function from within itself?
for instance:
local UIS = game:GetService("UserInputService")
local RS = game:GetService("RunService")
local W_HeldDown = true
UIS.InputEnded:Connect(function(input) -- when you let go of W, make W_HeldDown false
if input.KeyCode == Enum.KeyCode.W then
W_HeldDown = false
end
end)
RS:BindToRenderStep("silly", 199, function()
-- run code
if W_HeldDown == false then
RS:UnbindFromRenderStep("silly")
end
end)
I don’t know about optimizations, but you can always use a repeat until loop as well (so it won’t run every frame, at the cost of it being more static-ey).
In my opinion, you should have both. Free cam is cool, but having to always track the player can be tiring. So why not both? I’m pretty sure I’ve seen both in one game so maybe you can look around to see if it works.
Really? How so? Also if it wasn’t clear, the loop would be intended to have some waiting time in between (e.g every 0.05s (which would be once every 3 frames on 60 FPS)).
Actually, they’d probably be around the same in terms of performance.
However, the X factors are readability and smoothness. I’m pretty sure it would be slightly more smoother than a repeat, also my original code would basically be an infinite loop so I’d have to do:
repeat
until
true
Which looks worse imo rather than just an event with runservice.