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

Does anyone know why tween gui isn't doing anything in this localscript? (No errors)

Asked by
8jxms 9
4 years ago

I have a frame that pops out the bottom of the screen when you click a part. I followed a tutorial on how to tween gui. Instead of making it so that you click a button on screen I used clickdetector. Even after trying to make it Gui it still didn't work. Here is the localscript:

script.Parent.ClickDetector.MouseClick:Connect(function()
    local frame = game.StarterGui.ScreenGui.CheckinGUI
    frame:TweenPosition(UDim2.new({0.257, 0},{0.215, 0}))
end)
0
You must remove the brackets first and also put the easing direction and easing style along with the seconds the tween would last. DizzyGuy70 38 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

These are very common mistakes, but research will help you improve and degrade these mistakes. Hope this helps!

First, you shouldn't use LocalScripts in parts. You should use a ServerScript.

You also can't change GUI's inside of StarterGui because they will have no effect on the player's screen. You have to change them inside of the Player's PlayerGui to have it changed on their screen.

Part Hierarchy

To start, you have to get the player from when they click on the part. To do that, you pass the argument of the player when they click it, like this.

This is all being done in a ServerScript inside of the part.

script.Parent.ClickDetector.MouseClick:Connect(function(player) --// The player Is The Player Who Clicked The Part

end)

After that, you would want to reference the Screen GUI inside of the Player's PlayerGui, like this.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local screenGui = player:WaitForChild("PlayerGui"):FindFirstChild("ScreenGui")
end)

Then from there, you would use that and tween the frame, like so.

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    local screenGui = player:WaitForChild("PlayerGui"):FindFirstChild("ScreenGui")
    screenGui.CheckinGUI:TweenPosition(UDim2.new(0.257, 0, 0.215, 0),"Out","Quad",1,true)
end)

Just for your knowledge, I'd recommend doing more research on GUI's, LocalScripts, ServerScripts, and Tweening GUI's.

LocalScripts Wiki

ServerScripts Wiki

GUI's Wiki

Tweening Position Wiki

Tweening Size Wiki

Tweening Size And Position Wiki

There are multiple ways to change the behavior of GUI's and how they move. Try some more research and watch some more detailed YouTube videos. For example, you can watch AlvinBLOX, INOOBE, TheDevKing, okeanskiy, Y3llow Mustang, ETC. There's plenty of videos and plenty of people to watch.

If this helped you, let me know by taking this as the answer. If it didn't or you don't understand comment down below what I can do to help you.

~killerbrenden

Ad
Log in to vote
0
Answered by 4 years ago

I don't know what the explorer tab looks like in your game, or how far down this is in children, but try doing Parent.Parent---.whatever.you're.trying.to.tween. Do that until it goes far enough up to directly find what you're tweening for.

Hope this helps!

0
No sorry it didn't work. But thanks for answering! 8jxms 9 — 4y

Answer this question