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

I need help with this anti nil (undestructible) script to have the camera the same, can anyone help?

Asked by 2 years ago
Edited 2 years ago

So, I made this as a god mode/anti nil script for just me:

--this is a regular script not localscript
game.Players.CraftyAlphaMan.CharacterAdded:Connect(function(character)
    character:WaitForChild("Humanoid").Died:Connect(function()
        local a = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.X
        local b = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.Y
        local c = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.Z
        game.Players.CraftyAlphaMan:LoadCharacter()
        game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(a, b, c))
    end)
end)

fixing = false
function fixchar()
    fixing = true
    local a = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.X
    local b = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.Y
    local c = game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame.Z
    game.Players.CraftyAlphaMan:LoadCharacter()
    game.Players.CraftyAlphaMan.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(a, b, c))
    wait(1)
    fixing = false
end

game.Workspace.DescendantRemoving:Connect(function(v)
    if v == game.Players.CraftyAlphaMan.Character or v:IsDescendantOf(game.Players.CraftyAlphaMan.Character) then
        if fixing == false then
            fixchar()
        end
    end
end)

and it works fine but I tried to make the camera the original angle it was at but I couldn't do that. Does anyone know a way to do this? Thanks

Answer this question