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

how can i freeze player's camera when he dies?

Asked by 3 years ago
Edited 3 years ago

i want that when a player dies, they can't move the camera until they respawn again thanks

1 answer

Log in to vote
2
Answered by 3 years ago

insert a localscript in startergui and do like:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local cam = workspace.CurrentCamera -- Gets the camera

char.Humanoid.Died:Connect(function()
    --Locks camera when everytime character dies
    cam.CameraType = Enum.CameraType.Scriptable
end)

plr.CharacterAdded:Connect(function()
    --Unlocks camera everytime when character spawns
    cam.CameraType = Enum.CameraType.Custom
end)
0
I'm pretty sure Enum.CameraType.Fixed instead of Enum.CameraType.Scriptable also works NGC4637 602 — 3y
Ad

Answer this question