How not to move the cursor to the center of the screen

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local screenGui = Instance.new("ScreenGui", playerGui)

local textButton = Instance.new("TextButton")
textButton.BackgroundTransparency = 1
textButton.Transparency = 1
textButton.Size = UDim2.new(0, 0, 0, 0)

textButton.Modal = true
textButton.Parent = screenGui

if player then
	wait()
	game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
	player.CameraMode = 0
	player.CameraMode = 1
end

script:Destroy()

So here is the problem, when I right click and move the camera everything is fine, but when I just move the cursor and right click again the cursor moves to the center of the screen, question how to fix this?