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

How to make the camera don't restart on respawn?

Asked by 4 years ago

I made a script the main menu, however, when you reset, the camera also resets. I already disabled the Reset on Spawn option but it doesn't work.

In the main menu, the camera was a block that showed the map and when you press play the camera returns to your character. But when you reset, the camera goes back to the block and there's no way to go back to the character.

This is the main script:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable

camera.CFrame = workspace.CameraPos.CFrame
local blur = Instance.new("BlurEffect",camera)
blur.Size = 10
script.Parent.ScreenGui.SoundEffects.Background:Play()

for i,v in pairs(script.Parent.ScreenGui:GetChildren()) do
    if v.ClassName == "TextButton" then
        v.MouseEnter:Connect(function()
            script.Parent.ScreenGui.SoundEffects.Sound:Play()
        end)
    end
end

This is the script that makes the camera go to your character when you press play:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.SoundEffects.Sound2:Play()
    script.Parent.Parent.SoundEffects.Background:Stop()
    script.Parent.Parent.Enabled = false
    script.Parent.Parent.Parent.Conf.Enabled = true
    workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
    workspace.CurrentCamera.Blur.Enabled = false
end)

1 answer

Log in to vote
0
Answered by
Rinextel 291 Moderation Voter
4 years ago

Hello! You can use this for help with your question. https://developer.roblox.com/en-us/api-reference/event/Humanoid/Died detecting when the player died, then you can manually load their character then change their camera type to whatever you want!

Ad

Answer this question