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)
in the line 4, It should be local script = game.Players.LocalPlayer. i think
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)