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

Camera CoordinateFrame changed OnTouch only working in Solo mode. Help?

Asked by
Ryzox 220 Moderation Voter
10 years ago

Okay so I am making a script that when I touch the detector it triggers the camera to look at the door opening (I used to blocks to position where the camera is and where it looks at)

I am new to Camera Manipulation and moving the camera and making cutscenes so I am not familiar with any of the problems I face without anything in the output, any of you know why this is happening and how to fix? Here's my code:

RGate = workspace.RGate
LGate = workspace.LGate
detector = script.Parent
hum = nil
char = nil
plr = nil
cam = workspace.CurrentCamera
touched = false

detector.Touched:connect(function(hit)
    if touched == false then
        if hit.Name ~= "Hat" then
            if hit.Parent:FindFirstChild("Humanoid") then
                touched = true
                char = hit.Parent
                plr = game.Players:GetPlayerFromCharacter(char)
                hum = hit.Parent:FindFirstChild("Humanoid")
                if char:FindFirstChild("Torso") then
                    char.Torso.Anchored = true
                    cam.CameraType = "Scriptable"
                    cam.CoordinateFrame = CFrame.new(workspace.CamPosition.Position)
                    cam.Focus = CFrame.new(workspace.LookAt.Position)
                    for i = 1,72 do
                        LGate.CFrame = LGate.CFrame * CFrame.new(-0.125,0,0)
                        RGate.CFrame = RGate.CFrame * CFrame.new(0.125,0,0)
                        wait()
                    end
                    wait(2)
                    cam.CameraType = "Custom"
                    plr.CameraMode = Enum.CameraMode.Classic
                    plr.CameraMode =  Enum.CameraMode.LockFirstPerson
                    char.Torso.Anchored = false
                end
            end
        end
    end
end)

And yes I know that I don't set touched back to false, as this is a 1 player first person strategy game I am making, just working on cutscenes and how to make it nicer.

1 answer

Log in to vote
0
Answered by 9 years ago

Try putting that in a localscript that should work..

Ad

Answer this question