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

Shop with GUI doesnt work in servers and published places, only works in studio? Help

Asked by 6 years ago
Edited 6 years ago

Hello, i just made a shop with gui, got help from youtube. Everything is fine and works in studio, but if i publish the game, then it wont work in game and servers. Only works in studio, does anyone know what could be wrong and what should i do to get it work in servers too? And yes, filteringenabled is enabled.

The gui opens up but the buy button is not working in the server and im not receiving the tools aswell from shop.

Well, just not to make anything confusing, i will just link the shop tutorial video here, i did exactly everything as in video. Also in the description you can find the shop gui to test it out or to see whats wrong.

https://www.youtube.com/watch?v=c8bWOSU7WKw&t=1s

Shop BUY button script, in replicatedstorage i have a folder named tools and inside tools theres the items i sell on store (sword etc..)

01local price = script.Parent.Parent.Price
02local tools = game.ReplicatedStorage:WaitForChild("Tools")
03local tool = tools:FindFirstChild(script.Parent.Parent.ItemName.Value)
04local player = script.Parent.Parent.Parent.Parent.Parent.Parent
05 
06script.Parent.MouseButton1Click:connect(function()
07    if player.leaderstats:FindFirstChild("Points").Value >= price.Value then --  currency.
08        player.leaderstats:FindFirstChild("Points").Value = player.leaderstats:FindFirstChild("Points").Value - price.Value
09        local clone = tool:Clone()
10        clone.Parent = player.Backpack
11       ----------------------------------keep the items after they die
12        local clone2 = tool:Clone()
13        clone2.Parent = player.StarterGear
14    end
15end)
0
have you tried double checking? Kul3dud3123 -5 — 6y
0
Yeah, i even tried his own gui thats in the description, still it works only in studio. @Kul3dud3123 MarkusMape 22 — 6y
0
Have you checked the dev console with F5? User#22980 0 — 6y
0
are you sure its a LocalScript? also im having problems with it too lol. Kul3dud3123 -5 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

in the line 4, It should be local script = game.Players.LocalPlayer. i think

0
This did not fix the problem, it works in studio but not in server. MarkusMape 22 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Already answered this... Guy asked the same question after you. Make sure to put this in LocalScript!

Here just make it compatiable with your values.

01local ToolPrice = script.Parent.Parent:WaitForChild("Price")
02local Tools = game.ReplicatedStorage:WaitForChild("Tools")
03local ToolName = script.Parent.Parent:WaitForChild("ItemName")
04local Tool = Tools:WaitForChild(ToolName.Value)
05local Player = game:GetService("Players").LocalPlayer
06local leaderstats = Player:WaitForChild("leaderstats")
07local CurrencyType = "Money"
08local Currency = leaderstats:WaitForChild(CurrencyType)
09 
10script.Parent.MouseButton1Click:Connect(function()
11 
12    if Currency.Value >= ToolPrice.Value then -- Checks if player has right amount
13 
14        Currency.Value = Currency.Value - ToolPrice -- Takes Amount of money after purchased
15 
View all 24 lines...
0
What do i insert in -- code here? MarkusMape 22 — 6y
0
I also changed local currencytype to Points as my currency is Points, but didnt work. Could you please paste the whole code here? MarkusMape 22 — 6y
0
You don't have to insert anything in --code here AswormeDorijan111 531 — 6y
0
Well, i tried but it didnt work for me atleast, or i did something wrong. Could i contact you anywhere so we can see where is the problem? I also sent you the friend request at roblox to message you. MarkusMape 22 — 6y
View all comments (2 more)
0
Yes, we can contact trough the Discord, you can ADD me AswormeDorijan111 531 — 6y
0
I will send you a message on ROBLOX in period od of 24 hours. AswormeDorijan111 531 — 6y

Answer this question