Im very new to lua code so this is probably simple this is the code I have:
local button = game.StarterGui.PlayScrene.Screne.Play local PlayButton = game.StarterGui.PlayScrene.Screne.Play player = game.Players.LocalPlayer local object = game.StarterGui.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)
Im using a local script in the ScreenGui
(Yes I know some stuff is mispelled)
When I play it, it doesnt do anything when I click the button also if you are wondering the button name is Play.
Thanks
Hello, EmeraldRailYT!
Your script was correctly moving the gui, but you was moving the gui inside game.StarterGui
, that is just the gui that is clonned inside the player when they join.
I just needed to change the gui from game.StarterGui
to game.Players.LocalPlayer.PlayerGui
local player = game.Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") -- waits for the gui to be clonned inside the player... 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)