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

Passing a Remote Event through a Click to Purchase Store Part?

Asked by 6 years ago

My game is filtered Enabled.

Here is where the code is placed: https://i.imgur.com/PP2TWws.png

I have a store ingame that is purchased with tools. You click a part to give you the item. How do I get this Tool to be visible with everyone in game

Everytime I try, its not working. The code has a intvalue named Price and a String Value for the name of the TOOLS. I want the code to be versatile, so that I can reuse it to purchase many tools. Here is a code:

The code works, you can click and actually buy the tool, but no1 else sees it but yourself.

Thanks for answering in advance.

local db= true



local button=script.Parent
local price=button:WaitForChild("Price")
local item=button:WaitForChild("ItemName")
local rs=game:GetService("ReplicatedStorage")


script.Parent.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


        script.Parent.BrickColor = BrickColor.new("Bright red")
         local item=rs:WaitForChild(item.Value)
  item:Clone().Parent=player.StarterGear
     item:Clone().Parent=player.Backpack
        wait (3)
        script.Parent.BrickColor = BrickColor.new("Bright green")
        db = true
    end
end)

Answer this question