Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Gui working in studio but its not working in game, Any solution? Codes included.

Hello, im trying to make a soccer game with animated gui's and cool stuff. However, all the GUI's function as coded in Studio but nothing actually happen when i publish the game "Private" and try it out. As well as none of the buttons function ingame. "They don't even show"

Script location: game.StarterGui.Menu.MenuB.Script

If i wanna call it im using: game.Players.LocalPlayer.PlayerGui.Menu.MenuB.Script

Menu button code:

F = script.Parent.Parent.Frame
O = F.Frame
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Frame.Visible = true
F.Position = UDim2.new(-1, -500, 0, 0)
O.Position = UDim2.new(0, -100, 0, 0)

wait(.3) 
F:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", .4) 
O:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Back", 1) 
wait(.3)
script.Parent.Visible = false
script.Parent.Parent.Parent.PLLogo.Enabled = false
script.Parent.Parent.Parent.Player.Enabled = false
script.Parent.Parent.Parent.ScoreboardB.Enabled = false
script.Parent.Parent.Parent.ScoreboardA.Enabled = false
end)

1 comment

1

connect is deprecated use Connect. But the problem is you used a Script so switch your script to a LocalScript and problem solved. ALWAYS have localscripts handle GUI

1 answer

✓ Accepted answer

Problem: GUI does not work in-game, but works in studio.

The reason why your script does not work is because you are you using a Script. Script's run on the server, and cannot access PlayerGUI's. LocalScript's are vice-versa, they only run in certain places. These are the player's Backpack, PlayerGui, Character and PlayerScripts. LocalScripts will also run in the ReplicatedFirst service.

You should have your LocalScript managing the GUI.

This is only true to live testing, which is why it will work in Roblox Studio but not online.

The solution:

Copy all your code and paste it into a localscript. Set the location to: game.Players.LocalPlayer.PlayerGui.Menu.MenuB

And another note, connect is deprecated. Use should be using Connect.

This discussion is preserved as it was. New answers, comments, and votes are closed.