So this script is a Localscript inside StarterPlayerScripts. I already have another Local script that makes the camera type scriptable. this script COMPLETLEY works but im tryin to find a way to make the script run faster when in game.
local lookaround = 2
local player = game.Players.LocalPlayer
local cam = workspace.CurrentCamera
game.Workspace.HOVER_WORK.ClickDetector.MouseHoverEnter:Connect(function()
--wait()
lookaround = math.rad(lookaround)
repeat wait() until workspace:findFirstChild(player.Name)
--wait()
local mouse = player:GetMouse()
local subject = workspace.CamPos
local measure = Instance.new("ScreenGui",player.PlayerGui)
repeat wait() until measure.AbsoluteSize.X ~= 0
--wait(1)
local screensizex = measure.AbsoluteSize.X
local screensizey = measure.AbsoluteSize.Y
measure:Destroy()
while true and wait() and player.Character.Humanoid.Health ~= 0 and subject do
cam.CoordinateFrame = subject.CFrame * CFrame.Angles(lookaround*(((screensizey/2)-mouse.Y)/screensizey)*2,lookaround*(((screensizex/2)-mouse.X)/screensizex)*2,0)
end
end)
game.Workspace.HOVER_WORK1.ClickDetector.MouseHoverEnter:Connect(function()
lookaround = math.rad(lookaround)
repeat wait() until workspace:findFirstChild(player.Name)
--wait()
local mouse = player:GetMouse()
local subject = workspace.CamPos1
local measure = Instance.new("ScreenGui",player.PlayerGui)
repeat wait() until measure.AbsoluteSize.X ~= 0
--wait(1)
local screensizex = measure.AbsoluteSize.X
local screensizey = measure.AbsoluteSize.Y
measure:Destroy()
while true and wait() and player.Character.Humanoid.Health ~= 0 and subject do
cam.CoordinateFrame = subject.CFrame * CFrame.Angles(lookaround*(((screensizey/2)-mouse.Y)/screensizey)*2,lookaround*(((screensizex/2)-mouse.X)/screensizex)*2,0)
end
print("WORKED")
end)

3 comments
Your question is confusing
then dont comment and move on to another question
You have added "wait()" too many times for it to repeat. That is perhaps why it is so slow in your studio. You can try to remove some of the lines in your script to make it run faster.