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 move the textbutton in the middle to the right so that it dosen’t get in the way for the player, and set the textbutton 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.Main
local ButtonRight = game.StarterGui.View.Right
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, 1) then
wait(1)
ButtonRight.Visible = false
ButtonMain:TweenPosition(UDim2.new(0.903, 0, 0, 0), "Out", "Sine", 0.4)
end
end)
I tried to do this by Tweening the buttons position, but it doesn’t seem to work.