So this script for some reason doesn't work inside the actual game, but if I test it in Roblox Studio it works?
01 | local ShopButton = script.Parent |
02 | local Shop = script.Parent.Parent.Frame |
03 | local Close = script.Parent.Parent.Frame.X |
04 | local GunGUI 1 = Shop.Gun 1 |
05 | local GunGUI 2 = Shop.Gun 2 |
06 | local Gun 1 = game.ServerStorage:FindFirstChild( "Gun1" ) |
07 | local Gun 2 = game.ServerStorage:FindFirstChild( "Gun2" ) |
08 | Player = game.Players.LocalPlayer |
09 |
10 | ShopButton.MouseButton 1 Down:connect( function () |
11 | ShopButton.Visible = false |
12 | Shop.Visible = true |
13 | Close.MouseButton 1 Down:connect( function () |
14 | ShopButton.Visible = true |
15 | Shop.Visible = false |
If its a local script I would say its correct, theres no problem.
If its a normal script then theres a problem at line 8.
The variable have : LocalPlayer
which means it needs localscript or local before the variable name.
Like this for line 8 :
1 | local Player = game.Players.LocalPlayer |
its because the normal script doesn't know what is LocalPlayer so we need to put local behind the variable. This code is for the one that doesn't use local script.
For line number 10 untill 17 I recomend you using 'if' and 'else' than making 2 functions. 1 function and if and else is okay.