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

How is this happening?? D:

Asked by
Qorm 100
9 years ago

I'm trying to prevent this from happening, but I got NO CLUE of what's going on here... Take a look:

wait() --ignore. for studio.
--variables--
Raiders=game.Teams.Raiders
Dunno=game.Teams.Dunno
c=game.Workspace.CurrentCamera
angle=0
player = game.Players:GetPlayerFromCharacter(script.Parent.Parent.Character)
--==--
if player.TeamColor==BrickColor.new("Really black") then --Team "Choose a side"
    script.Parent.Parent.PlayerGui.SelectSide.Main.Visible=true
    script.Parent.Parent.Character.Torso.Anchored=true
c=game.Workspace.Camera
c.CameraType="Scriptable"
    target=game.Workspace.Cameramodel.Position
    while true and wait() do
    c.CoordinateFrame=CFrame.new(target)*CFrame.Angles(0,angle,0)
    angle=angle+math.rad(0.1)
    end end

if player.TeamColor==BrickColor.new("Bright red") then --Team "Raiders"
    wait()
    script.Parent.Parent.PlayerGui.SelectSide.Main.Visible=false
    script.Parent.Parent.Character.Torso.Anchored=false
    c.CameraType="Fixed"
    target=script.Parent.Parent.Character.Head.Position
    c.CoordinateFrame=CFrame.new(target)

elseif player.TeamColor == BrickColor.new("Pastel yellow") then --Team "Dunno"
    wait()
    script.Parent.Parent.PlayerGui.SelectSide.Main.Visible=false
    script.Parent.Parent.Character.Torso.Anchored=false
    c.CameraType="Fixed"
    target=script.Parent.Parent.Character.Head.Position
    c.CoordinateFrame=CFrame.new(target)
    end

What it does is it LOCKS the target camera at the place it started off as when you die. I have a GUI with a script that you choose sides from to die, and switch to one of this teams. HELP WOULD BE APPRECIATED!!

1 answer

Log in to vote
1
Answered by 9 years ago

At the end, add the lines:

local hum = game.Players.LocalPlayer.Character:FindFirstChild('Humanoid')
hum.Changed:connect(function()
if hum.Health == 0 or hum.Health < 0 then
c.CameraType = 'Custom'
c.CoordinateFrame = hum
end
end)

What this script does is it checks when the humanoid or person dies. If they do, their camera gets positioned back to the humanoid. If this does not work, create a local script inside the StarterGui and place this script inside.

0
'Local' should be 'local', and 'If' should be 'if', also, 'C' should be 'c', as the script is now, there will be multiple errors, possibly saying 'Incorrect Syntax', and 'Attempt to call 'C' (a nil value)', ect.. TheeDeathCaster 2368 — 9y
0
I was typing on my device. Sorry. Lol killerkill29 35 — 9y
Ad

Answer this question