Camera Custom in reset Character

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    check video

  2. What is the issue? Include screenshots / videos if possible!

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Fix please! Thanks For reading
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Script Client :


local camera = workspace.CurrentCamera
game.ReplicatedStorage.Calledcamera.OnClientEvent:Connect(function(Locate)
camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = Locate.CFrame
	script.Parent.StopView.Visible = true
end)
script.Parent.StopView.MouseButton1Click:Connect(function()
	camera.CameraType = Enum.CameraType.Custom
	script.Parent.StopView.Visible = false
	end)
1 Like

As far as I can see, you can set the .CameraType property back to Custom when your LocalScript detects that the character’s Humanoid dies. Something like:

local plr = game:GetService(“Players”).LocalPlayer
local plrCamera = workspace.CurrentCamera

-- other code here…

plr.CharacterAdded:Connect(function(character)
   local humanoid = character:WaitForChild(“Humanoid”)
   if humanoid and humanoid:IsA(“Humanoid”) then
     humanoid.Died:Connect(function()
        plrCamera.CameraType = Enum.CameraType.Custom
     end)
   end
end)

Since the player’s character gets destroyed, we’ll connect this specific piece of code to the LocalPlayer’s CharacterAdded event, so we can always find the LocalPlayer’s newest humanoid and connect the .Died event to setting the player’s CurrentCamera’s CameraType back to the default.

Try using RunService to set the camera to scriptable until a boolean is false
For Eg.

local RunService = game:GetService("RunService")
local CameraScriptable = false

local camera = workspace.CurrentCamera
game.ReplicatedStorage.Calledcamera.OnClientEvent:Connect(function(Locate)
       CameraScriptable = true
end)
script.Parent.StopView.MouseButton1Click:Connect(function()
	 CameraScriptable = false
	end)

RunService.RenderStepped:Connect(function ()

       if CameraScriptable then

           camera.CameraType = Enum.CameraType.Scriptable
	       camera.CFrame = Locate.CFrame
	       script.Parent.StopView.Visible = true
       else

           camera.CameraType = Enum.CameraType.Custom
	       script.Parent.StopView.Visible = false

       end

end)

I might have accidently gave a whole script…not much of a problem right?
Anyways let me know if it works well.

thanks for working

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.