Alright, so I am making a simulator shop that uses the camera. But, I don’t know how to make it so hen the player resets the camera goes back to the player. Please help. I’ve been stuck on this for 3 days.
Maybe just use .Died
event? (By the way this should go on StarterPlayer > StarterCharacterScripts on a LocalScript to make it work)
local Cam = workspace.CurrentCamera
local Humanoid = script.Parent:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
Cam.CameraType = Enum.CameraType.Custom
end)
1 Like
Hi there! There is actually a super simple solution to this, as Sarchyx has stated. Basically, you will need to connect the died event to the player. The Humanoid.Died event is a default event and is fired any time that a character dies. To pickup this event, you need a local script inside of the starter-character-scripts. Then there’s just some really simple code.
local camera = game.Workspace.CurrentCamera --Gets the camera from the workspace. We are accessing from a local script, so this will not affect all the players. Only the local one.
local humanoid = game.Players.LocalPlayer.Character.Humanoid --Gets the humanoid object, which is located in every character model, and contains things like health and walkspeed
local originalCamera = Enum.CameraType.Custom --The default camera that follows the characters movement.
humanoid.Died:Connect(function() --Fires when the character dies
camera.CameraType = originalCamera --Resets to default camera
end)
And that’s it. I hope I could help!
1 Like