I was just trying to make a simple Gui that stays on the screen for 3 seconds, then it Tweens
off, but I've been having trouble with getting this to work. I've tried just disabling the visibility to test it, but it only works in studio. Help?
This is a local script in a Screen Gui. The screen Gui contains two image labels that should move off screen when the script is activated.
Here is the code:
local player = script.Parent.Parent local mainGui = script.Parent function testFunction() local folder = mainGui.SplashScreen local test1 = folder.test1 local test2 = folder.test2 wait(3) test1:TweenPosition(UDim2.new(-1, 0, 0, -100), "In") test2:TweenPosition(UDim2.new(1, 0, 0, -100), "In") end testFunction()
I'm new to Roblox scripting so I don't know if it's simple or not.
Thanks! -Kyleo
Following wfvj014's advice, your script should look like this:
local player = game:GetService("Players").LocalPlayer local mainGui = script.Parent function testFunction() local folder = mainGui.SplashScreen -- What is this? local test1 = folder.test1 local test2 = folder.test2 wait(3) test1:TweenPosition(UDim2.new(-1, 0, 0, -100), Enum.EasingDirection.In) test2:TweenPosition(UDim2.new(1, 0, 0, -100), Enum.EasingDirection.In) end testFunction()
if your explorer looks like this:
StarterGui ScreenGui LocalScript SplashScreen test1 test2
Then I don't see anything wrong with your script.
PS: You should also probably change the test1 and 2 to Test1 and 2, and change
local test1 = folder.test1 local test2 = folder.test2
to
local test1 = folder.Test1 local test2 = folder.Test2