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 5 years ago
Edited 5 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..)

local price = script.Parent.Parent.Price
local tools = game.ReplicatedStorage:WaitForChild("Tools")
local tool = tools:FindFirstChild(script.Parent.Parent.ItemName.Value)
local player = script.Parent.Parent.Parent.Parent.Parent.Parent

script.Parent.MouseButton1Click:connect(function()
    if player.leaderstats:FindFirstChild("Points").Value >= price.Value then --  currency.
        player.leaderstats:FindFirstChild("Points").Value = player.leaderstats:FindFirstChild("Points").Value - price.Value
        local clone = tool:Clone()
        clone.Parent = player.Backpack
       ----------------------------------keep the items after they die
        local clone2 = tool:Clone()
        clone2.Parent = player.StarterGear
    end
end)
0
have you tried double checking? Kul3dud3123 -5 — 5y
0
Yeah, i even tried his own gui thats in the description, still it works only in studio. @Kul3dud3123 MarkusMape 22 — 5y
0
Have you checked the dev console with F5? ScrubSadmir 200 — 5y
0
are you sure its a LocalScript? also im having problems with it too lol. Kul3dud3123 -5 — 5y

2 answers

Log in to vote
0
Answered by 5 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 — 5y
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 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.

local ToolPrice = script.Parent.Parent:WaitForChild("Price")
local Tools = game.ReplicatedStorage:WaitForChild("Tools")
local ToolName = script.Parent.Parent:WaitForChild("ItemName")
local Tool = Tools:WaitForChild(ToolName.Value)
local Player = game:GetService("Players").LocalPlayer
local leaderstats = Player:WaitForChild("leaderstats")
local CurrencyType = "Money"
local Currency = leaderstats:WaitForChild(CurrencyType)

script.Parent.MouseButton1Click:Connect(function()

    if Currency.Value >= ToolPrice.Value then -- Checks if player has right amount

        Currency.Value = Currency.Value - ToolPrice -- Takes Amount of money after purchased

        local clone = tool:Clone() 
        clone.Parent = player.Backpack
        local clone2 = tool:Clone()
        clone2.Parent = player.StarterGear

    else
        -- code here
    end
end)
0
What do i insert in -- code here? MarkusMape 22 — 5y
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 — 5y
0
You don't have to insert anything in --code here AswormeDorijan111 531 — 5y
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 — 5y
View all comments (2 more)
0
Yes, we can contact trough the Discord, you can ADD me AswormeDorijan111 531 — 5y
0
I will send you a message on ROBLOX in period od of 24 hours. AswormeDorijan111 531 — 5y

Answer this question