Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you tween a text button when a button is clicked?

Asked by 5 years ago

I would like the text button and a frame to stay on the scene until the button is clicked then I would like to have the button tweened off the scene. Like a play button to a new game.

(Im very new to Lua coding)

This is the code I have:

local player = game.Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")

local button = playerGui.PlayScrene.Screne.Play
local PlayButton = playerGui.PlayScrene.Screne.Play
local object =playerGui.PlayScrene.Screne
local click = game.Workspace.Click

object.Position = UDim2.new(0, -object.Size.X.Offset, 2, 0)

button.MouseButton1Click:connect(function()
    object:TweenPosition(UDim2.new(-0.35, 0,0.35, 0))
end)

I realize that some stuff may be misspelled

Thanks

1 answer

Log in to vote
0
Answered by 5 years ago

when writing the...

object:TweenPosition(UDim2.new(-0.35, 0,0.35, 0))

you forgot the numbers at the end, So it would look like this

object:TweenPosition(UDim2.new(-0.35, 0,0.35, 0),1,1,1,1)
Ad

Answer this question