So i'm making a drone. I scripted the movement, ect. The camera does attach to the part. When I try to go to the player, it just glitched out. I'm assuming it's coming from the loop. I've tried fixing this myself by removing the loop, which does work, but it only works once.
code:
plr = game.Players.LocalPlayer
cam = game.Workspace.CurrentCamera
chr = nil
plr.CharacterAdded:connect(function(character)
chr=character
end)
script.Parent.Camera.MouseButton1Click:connect(function()
if debounce == true then
debounce = false
while true do
wait()
cam.CoordinateFrame = CFrame.new(game.Workspace.Model.Part.Position)
cam.CameraType = "Scriptable"
end
end
end)
script.Parent.BackToPlayer.MouseButton1Click:connect(function()
while true do
wait()
cam.CameraType = "Custom"
end
debounce = true
end)
If you have any questions, please put them in the comment

2 comments
do I remove the while true do loop?
Nvm I got it to work. Thanks