Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

Try putting that in a localscript that should work..

This discussion is preserved as it was. New answers, comments, and votes are closed.