Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to have you camera set on a subject when you spawn or respawn?

Asked by 7 years ago

I am currently making a game right now and I was woundering if someone could help me to see if you can have a camera subject when you spawn or respawn.

0
..Try the wiki. It's a 2 line script to switch the camera iamnoamesa 674 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Well, an event called .CharacterAdded exists. This is run when the player is reset, or dies and respawns. Here's what you could do (this is in a server script):

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:conect(function(char)
        game.ReplicatedStorage.SetCamera:FireClient(plr, "Set Camera")
    end)
end)

As you can see, I created a RemoteEvent inside of ReplicatedStorage and called it 'SetCamera' and from the script above I'm firing it every time a player respawns.

In a local script:

game.ReplicatedStorage.SetCamera.ClientFired:connect(function(plr, request)
    if request == "Set Camera" then
        -- Your camera code.. I'm assuming you know how to do that
    end
end)

Hope I helped, let me know if I did :)

Ad

Answer this question