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

How to get a click to buy store to work with RemoteEvents?

Asked by 6 years ago
Edited 6 years ago

I have a store ingame that is purchased with tools. You click a part [named Buy] to purchase the item.

Now the tools are refusing to show up in my backpack. It's working code[No errors] but it's not helping me if it doesn't work

LOCAL SCRIPT


-- In the LocalScript local db= true local button=script.Parent local price=button:WaitForChild("Price") local item=button:WaitForChild("ItemName") local rs=game:GetService("ReplicatedStorage") local GiveTool = rs:WaitForChild("GiveTool")-- THE RemoteEvent is GiveTool local tool = script.Parent tool.ClickDetector.MouseClick:connect (function(player) if player.leaderstats.Coins.Value>=price.Value then player.leaderstats.Coins.Value=player.leaderstats.Coins.Value-price.Value db = false GiveTool:FireServer(tool) wait(3) db = true end end)

ServerScriptService


local rs=game:GetService("ReplicatedStorage") local GiveTool = rs:WaitForChild("GiveTool") -- The RemoteEvent is the GiveTool GiveTool.OnServerEvent:Connect(function(player, tool) tool.BrickColor = BrickColor.new("Bright red") local item=game:GetService("ReplicatedStorage"):WaitForChild(script.item.Value) script.item:Clone().Parent = player.StarterGear script.item().Parent=player.Backpack wait(3) tool.BrickColor = BrickColor.new("Bright green") end)
0
Your image links are broken. Please fix it. Zafirua 1348 — 6y
0
Link buttons aren't working, I tried 3 times, sorry robloxquestionnaire1 30 — 6y

Answer this question