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

Tweening Gui only working in studio?

Asked by
yoshi8080 445 Moderation Voter
8 years ago

I dunno why, I was making this little test gui, but it works in studio but doesn't work in the server and it shows no errors.

Button Gui below I've tried local and server scripts for the gui, but it didn't work.

local gui = game.StarterGui.TestGui
local questframe = gui:FindFirstChild("QuestionOneFrame") or gui:WaifForChild("QuestionOneFrame")
local titleframe = gui:FindFirstChild("TitleFrame") or gui:WaitForChild("TitleFrame")
        function Tween()
                    titleframe.BeginButton:TweenPosition(UDim2.new(-4, 0,0, 0), "Out", "Quad", 3, false)
                    titleframe:TweenPosition(UDim2.new(-4, 0,0, 0), "Out", "Quad", 3, false)
                    titleframe.Title:TweenPosition(UDim2.new(0, -1000,0, 0), "Out", "Quad", 3, false)
                questframe.Visible = true
                    questframe.Question:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad", 3, false)
                                                            end
                script.Parent.MouseButton1Down:connect(Tween)

No errors in output.

2 answers

Log in to vote
2
Answered by 8 years ago

You are only manipulating what is inside of StarterGUI, this is not what the player sees. The GUI they see is in PlayerGui, which is where you want to manipulate the GUI.

Simply change up your variables to fit correctly; MAKE SURE THIS IS A LOCAL SCRIPT

Add: local Player = game.Players.LocalPlayer

Change local gui = game.StarterGui.TestGui into: local gui = Player.PlayerGui.TestGui

Finished script is bellow!

local Player = game.Players.LocalPlayer
local gui = Player.PlayerGui.TestGui
local questframe = gui:FindFirstChild("QuestionOneFrame") or gui:WaifForChild("QuestionOneFrame")
local titleframe = gui:FindFirstChild("TitleFrame") or gui:WaitForChild("TitleFrame")
        function Tween()
                    titleframe.BeginButton:TweenPosition(UDim2.new(-4, 0,0, 0), "Out", "Quad", 3, false)
                    titleframe:TweenPosition(UDim2.new(-4, 0,0, 0), "Out", "Quad", 3, false)
                    titleframe.Title:TweenPosition(UDim2.new(0, -1000,0, 0), "Out", "Quad", 3, false)
                questframe.Visible = true
                    questframe.Question:TweenPosition(UDim2.new(0, 0,0, 0), "Out", "Quad", 3, false)
                                                            end
                script.Parent.MouseButton1Down:connect(Tween)


Ad
Log in to vote
1
Answered by 8 years ago

Tweening only works properly in LocalScripts, and not in StarterGui

Move your code to a LocalScript, and get it from PlayerGui instead of StarterGui.

Answer this question