Hey everyone! So today I was practicing with GUI tweening, I wanted to make it so when the Player clicks play on the TextButton, the button slides to the left, I tested it out with no errors and I clicked on it and nothing happened, does anyone know why? Here is my script…
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
character:WaitForChild("HumanoidRootPart").Anchored = true
local TweenService = game:GetService("TweenService")
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.Camerapart.CFrame
local info = TweenInfo.new(20,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local rotating = true
while rotating do
local cameraTween = TweenService:Create(Camera,info, {CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, 360, 0);})
cameraTween:Play()
local blur = Instance.new("BlurEffect")
blur.Parent = workspace.CurrentCamera
blur.Enabled = true
blur.Size = 10
wait(0.02)
end
local MainMenu = script.Parent
local PlayButton = MainMenu:WaitForChild("TextButton")
local pT = PlayButton:TweenPosition(UDim2.new({-0.2, 0},{0.725, 0}))
local tween = TweenService:Create(PlayButton,info,pT)
PlayButton.MouseButton1Click:Connect(function()
tween:Play()
wait(3)
character.HumanoidRootPart.Anchored = false
character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
Camera.CameraType = Enum.CameraType.Custom
MainMenu:Destroy()
end)
It is fixed now, but without me even clicking on the button the tween plays and it goes to a random position that I didn’t pick. (I’m still new to scripting, so sorry for the obvious mistakes.)