Hello, What I'm trying to create is when a player clicks on a part, which would activate the MouseClick event on the ClickDetector, and when clicked, it changes the camera position to the part, and rotates around it, for some reason when I tried it out, nothing happens... Here is the script that I was talking about...
Note: The Child inside the Part is the Local Script and the ClickDetector.
local target = script.Parent local camera = game.Workspace.CurrentCamera local angle = 0 local isPlaying = false script.Parent.ClickDetector.MouseClick:connect(function() camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = target isPlaying = true end) while isPlaying do camera.CFrame = CFrame.new(target.Position) * CFrame.Angles(0, angle, 0) * CFrame.new(0, 3, 5) angle = angle + math.rad(1) wait() end
Thank you!
~NanotechSci
Hi Nano! Your issue here is that the while loop checks for variable "isPlaying" once, and since isPlaying returns false, the loop will end and will not be repeated. Without going into the heavier stuff, I'd recommend you place your while loop inside of your ClickDetector event!
Nice work!