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
There is a Remote event in Replicated Storage called 'GiveThePlayerTool'
The tools are in replicated storage.
Button store code for buying tools
local player=game.Players.LocalPlayer local leaderboard=player:WaitForChild("leaderstats") local button=script.Parent local price=button:WaitForChild("Price") local item=button:WaitForChild("ItemName") local rs=game:GetService("ReplicatedStorage") local createPartEvent = rs:WaitForChild("GiveThePlayerTool") button.MouseButton1Click:connect(function() if leaderboard.Coins.Value>=price.Value then leaderboard.Coins.Value=leaderboard.Coins.Value-price.Value --[[item:Clone().Parent=player.StarterGear item:Clone().Parent=player.Backpack]]-- rs.GiveThePlayerTool:FireServer(item) end end) while wait()do button.Text=item.Value.."-"..price.Value end
Server Script Service
local rs = game:GetService('ReplicatedStorage') local GiveToolEvent = rs:WaitForChild("GiveThePlayerTool") GiveToolEvent.OnServerEvent:connect(function(player, ItemName) local tool = rs:FindFirstChild(ItemName) tool:Clone().Parent = player.StarterGear tool:Clone().Parent = player.Backpack end)
The code works but the tool doesn't go to your backpack/inventory.