Whenever player click easy, normal or hard “Play” button should be come where i want with tweening gui.
So i tried to script it but it didnt work and i dont have a any error massage either.
Here is my script;
local Button = script.Parent
local start = game.StarterGui.Start.Start
function Start()
start:TweenPosition(
UDim2.new(0.5, 0,0.83, 0),
"Out",
"Quad",
1
)
end
function Speed()
Frame:TweenPosition(
UDim2.new(1, 0,0, 0),
"Out",
"Quad",
1
)
end
Button.MouseButton1Up:Connect(function()
Speed()
Start()
end)
What can i do ?
- You’re defining
start as game.StarterGui.Start.Start. StarterGui is not the player’s Gui. The elements within StarterGui get replicated to the PlayerGui so you are tweening correctly it’s just not showing because you’re tweening an object that isn’t visible to the player. To get start you could do something like:
local player = game:GetService("Players").LocalPlayer
local start = player.PlayerGui:WaitForChild("Start"):WaitForChild("Start")
- I recommend using Enums for your tweens. Instead of writing
"Out" and "Quad" use Enum.EasingDirection.Out and Enum.EasingStyle.Quad.
Thank you it worked!
But i have a question for you, why you recommended using Enum.EasingDirection.Out and Enum.EasingStyle.Quad . what are the differences
Enums have something known as “strong typing” where as a string has limited type checking. Basically all this means is there is less chance for user error. They are a form of constants so they don’t change while your strings can change. You could continue using strings if you want it doesn’t matter too much.
EDIT: I forgot to add that performance-wise Enums are also better. When you use a string roblox has to convert the string to an Enum before being able to use it so when you use an Enum you basically skip that step.
Okey i get it, thank you again!
1 Like