Cant tween textbutton position

Im trying to make a script for a fnaf-ish camera system. The script uses 3 textbuttons that detect the players cursor tweening it to a certain positon.

Im trying to make the script detect when the players cursor is on the left textbutton, moving the textbutton in the middle to the right so that it dosen’t get in the way for the player. While setting the visibility of the textbutton that was originally on the right to false.

local Camera = workspace.CurrentCamera
local Views = workspace:WaitForChild("Views")
local tweenService = game:GetService("TweenService")
local Button = script.Parent
local ButtonMain = game.StarterGui.View.MainView
local ButtonRight = game.StarterGui.View.ViewRight

function tweenCamera(pos,tweenTime)
	tweenService:Create(Camera,TweenInfo.new(tweenTime,Enum.EasingStyle.Sine), {CFrame = pos.CFrame}):Play()
end

Button.MouseEnter:Connect(function()
	if tweenCamera(Views.ViewLeft, 0.45) then
		wait(1)
		ButtonRight.Visible = false
		ButtonMain:TweenPosition(UDim2.new(0.903, 0, 0, 0), "Out", "Sine", 0.4):Play()
	end
end)




Script Placement:
Screenshot 2022-06-18 131451

I tried to do this by tweening the buttons position, but it doesn’t seem to work. Can someone help me with this?

Is there any errors?
Also I don’t think you have to do :Play() I don’t personally know if it makes a difference though as I have never used it

When I check the Output, I don’t see any errors.

You also have to put true or false after the time, this should cause errors without it
True means it will override any existing tween on the GUI
False means it will not override

Add a print here and

After here
See if it’s even running that part

This Button.MouseEnter:Connect(function() prints, but this doesn’t
if tweenCamera(Views.ViewLeft, 0.45) then.

What is your goal? I don’t think you can set a function as the if conditions

Alright, I’ll remove the if/then statement from if tweenCamera(Views.ViewLeft, 0.45) then.

Leave it and change the tween part to this

function tweenCamera(pos,tweenTime)
	tweenService:Create(Camera,TweenInfo.new(tweenTime,Enum.EasingStyle.Sine), {CFrame = pos.CFrame}):Play()

wait(tweenTime)
return true

end

Everything is very simple. StarterGui is the starting GUI of the player, so you need to find your way to the object from the script.