OK. So here's what's making me very frustrated; I made a few scripts, so the camera locks on to a position and target . That works! Ok. My problem is, when I try to disable it from my teleporter script, the camera breaks and doesn't change subjects or target. Here's the Camera script:
wait(0.01) --for studio. forget about it local player=script.Parent.Parent local cam=game.Workspace.Camera cam1=game.Workspace.cam1 cam.CameraType="Scriptable" pos=cam1.Position targ=player.Character.Torso.Position cam.CoordinateFrame=CFrame.new(pos,targ) while cam~=nil and wait() do cam.CoordinateFrame=CFrame.new(pos,player.Character.Torso.Position) end
This works, however, in studio, it shows this: http://i.imgur.com/5juwrNX.png yes, i created a surfacegui to show me And in Online mode, it shows this: http://i.imgur.com/ZByKxap.png I know it has something to do with Local or something.. Ok, so this probably won't matter, but just in case; here's the Teleport script, where everything goes to hell:
game.Players.PlayerAdded:connect(function(currentplayer) local ccurrentplayer=currentplayer script.Parent.Touched:connect(function(onTouch) ccurrentplayer.PlayerGui.camera1.Disabled=true local player=onTouch.Parent if player.Humanoid~=nil then player.Torso.CFrame=game.Workspace.teleport1.CFrame for i=1,0,-0.1 do ccurrentplayer.PlayerGui.black.base.BackgroundTransparency=i wait() end local camera=game.Workspace.Camera camera.CameraType="Custom" --DOESN'T WORK..... wait(1.55) for i=0,0.75,0.01 do ccurrentplayer.PlayerGui.black.base.BackgroundTransparency=i wait() end else return end end) end)
The whole script above works except for the Camera part. If ANYONE can help me, it would be VERY much appreciated, because I can't continue on with my game if It keeps on being like this.
Use game.Workspace.CurrentCamera in a LocalScript. This may or may not help.