Hey everyone! So at the moment I was practicing Tweening GUI’s. I wanted to make something simple, so I made a play button with a main menu. when you click the button, it goes off to the left, and you spawn. For some odd reason, every time I tween a GUI, they never work. I’ve tried multiple things. I don’t think that it is the tween that is causing the issue, because I don’t get any errors. It might be the mouse click event. 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
local MainMenu = game.StarterGui.MainMenu
local PlayButton = game.StarterGui.MainMenu.TextButton
local newinfo = TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)
PlayButton.MouseButton1Click:Connect(function()
print("PlayButton Clicked! Now the Tween will play!")
local goal = {};
goal.Position = UDim2.new(-0.2, 0, 0.71, 0)
TweenService:Create(PlayButton,newinfo,goal):Play()
wait(3)
print("Player Spawned!")
character.HumanoidRootPart.Anchored = false
character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
Camera.CameraType = Enum.CameraType.Custom
MainMenu:Destroy()
end)
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
If anyone knows how to fix this, please let me know.
If it’s still available there is a plugin that allows you to tween anything with ease and it writes the code for you, after that all you need to do is play the tween when needed.
No, it didn’t print the stuff. I also use TweenService because it gives you more options than TweenPosition. TweenService is a more efficient way than TweenPosition.
Not entirely sure, however this may be because the button goes into the PlayerGui instead of the StarterGui, and you’re trying to search for it in the StarterGui. (I’m not really experienced with this, so I may be completely wrong!)