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

I cant get my camera back to the position i want it to when the player dies?

Asked by 6 years ago

so im trying to make a fps game and first the camera is on a part which i called Camera, its CameraSubject is the Camera of course and CameraType is Attach so when the player presses the button it teleports him to the part called "Point" then when the player dies the camera is still of the player but im trying to make it on the Camera part again here is my script pls tell me if i make a mistake and pls try to help and fix it

I put the local script called "CameraScript" inside ServerStorage so this is the script for the CameraScript: local CurrentCamera = game.workspace.CurrentCamera CurrentCamera.CameraSubject = "Camera" CurrentCamera.CameraType = 'Attach' so thats my CameraScript so when the player spawns the Camera is on the Part called Camera my local script under the textbutton p.s i called the text button Deploy , so this is my local script for the textbutton: local button = script.Parent local CurrentCamera = game.Workspace.CurrentCamera local plr = game.Players.LocalPlayer button.MouseButton1Click:connect(function() script.Parent.MouseButton1Click:connect(function() game.Players.LocalPlayer.character.Torso.CFrame = CFrame.new(workspace.Point.Position) CurrentCamera.CameraSubject = plr.Character.Humanoid game.Workspace.CurrentCamera.CameraType = 'Custom' end) end) if plr.Character.Humanoid.Health == 0 then CurrentCamera.CameraSubject = "Camera" CurrentCamera.CameraType = 'Attach' end

1 answer

Log in to vote
0
Answered by 6 years ago

To fix your camera when the player dies, you have to make the subject the player's Humanoid and the type to Custom

Example:

local player = game.Players.LocalPlayer

game.Workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"

Also - make sure you put this script in a LocalScript. It will not work in a regular one.

Ad

Answer this question