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

How to turn a tool into a Filtered Enabled tool with remote events?

Asked by 6 years ago

My game is filtered Enabled.

I have a store ingame that is purchased with tools. 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

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)

1 answer

Log in to vote
0
Answered by 6 years ago

This should do the trick.

-- 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 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

        workspace.RemoteEvent:FireServer(tool) -- don't forget to add the remote event
        wait(3)
        db = true
        end
end)
--In a server script
workspace.RemoteEvent.OnServerEvent:Connect(function(player, tool)
        tool.BrickColor = BrickColor.new("Bright red")
        local item=game:GetService("ReplicatedStorage"):WaitForChild(item.Value)
        item.Clone().Parent = player.StarterGear
        item:Clone().Parent=player.Backpack
        wait(3)
        tool.BrickColor = BrickColor.new("Bright green")
end
0
explain your code. Axceed_Xlr 380 — 6y
0
Oh, sorry, forgot sweetkid01 176 — 6y
Ad

Answer this question