Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

2 comments

0

explain your code.

0

Oh, sorry, forgot

This discussion is preserved as it was. New answers, comments, and votes are closed.