Why aren't this Tools working properly?

Hello guys, Im spideyalvaro999
I have a problem with these tools because the powers of the scripts aren’t working, for example, the speed coils doesn’t run or a body weapon, such as a sword, doesnt even generate. This only happend when you buy it from the shop I created, because when I put it on the starter pack works perfectly. Here I leave you the scripts:
-Leaderstats script(It includes leaderstats, DataStore and some irrelevant lines about remotes events)(Normal Script)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local shopItems = game:GetService(“ServerStorage”):WaitForChild(“ShopItems”) – Where tools are held
local DataStore = game:GetService(“DataStoreService”)
local ds = DataStore:GetDataStore(“CashSaveSystem”)
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
game.Players.PlayerAdded:Connect(function(player)

	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	
	local points = Instance.new("IntValue",leaderstats)
	points.Name = "Points"
	points.Value = ds:GetAsync(player.UserId)or 0
	ds:SetAsync(player.UserId, points.Value)
	points.Changed:connect(function()
	    ds:SetAsync(player.UserId, points.Value)
	end)
	while true do
	wait(20)
	points.Value = points.value + 1
	end
end)
	

game.Players.PlayerRemoving:Connect(function(player)
	ds:SetAsync(player.UserId, player.leaderstats.point.Value)
end)

replicatedStorage.GetInfo.OnServerInvoke = function(player,item)
	return shopItems[item].Points.Value
end

RemoteEvent.OnServerEvent:Connect(function(player, Value)
    player.leaderstats.Points.Value = player.leaderstats.Points.Value - Value
end)

replicatedStorage.CheckSale.OnServerInvoke = function(player,item)
	
	local price = shopItems[item].Points.Value
	
	if player.leaderstats.Points.Value >= price then
		
		player.leaderstats.Points.Value = player.leaderstats.Points.Value - price
		
		local gear = shopItems[item][item]:Clone()
		gear.Parent = player.StarterGear
		
		local gear = shopItems[item][item]:Clone()
		gear.Parent = player.Backpack
		
		return true
		
	else
		
		return false	
	
	end

	
	
end

-Script of the Shop(I only have script on the buy button so I leave one)(LocalScript)

local player = game:GetService(“Players”).LocalPlayer
local RemoteEvent = game.ReplicatedStorage.RemoteEvent

script.Parent.MouseButton1Click:Connect(function(click)
	if player.leaderstats.Points.Value >= 900 then
		RemoteEvent:FireServer(900)
		game.ReplicatedStorage.Library.DualMegaCoil:Clone().Parent = player:WaitForChild("Backpack")
	end
end)

An image of where are the tools stored:


I hope you can help me because my game depends on this. Thank you for spending your time on reading this
Spideyalvaro999

Ok, so the remote event I told you about earlier, you want to include the game.ReplicatedStorage.Library.DualMegaCoil:Clone().Parent = player:WaitForChild("Backpack") inside of the OnServerEvent as well.

But This happendbefore you told me that, but what do I have to change?

You just need to move the game.ReplicatedStorage.Library.DualMegaCoil:Clone().Parent = player:WaitForChild("Backpack") into the server script with the onserverevent function. Any replication of tools needs to be handled by the server. If you desire, you could do

RemoteEvent:FireServer(900, "DualMegaCoil")

and then in the server script, have it like this

RemoteEvent.OnServerEvent:Connect(function(player, Value, Item) --
    player.leaderstats.Points.Value = player.leaderstats.Points.Value - Value
    game.ReplicatedStorage.Library[Item]:Clone().Parent = player:WaitForChild("Backpack")
end)

This time, I have added another parameter for what item they are buying.

I did what you told me and broke the currency system. Any solution to that?

Look at the output and tell me if there are any erros

You’re not going to belive this. I wrote some things wrong and now it seems to work but it clone the tools 3 times when i buy it once. Do I have to do osmething with the fire server?

That’s strange. Open up the output and see if anything errors. You can also add a print statement in your server script to see if it prints that three times as well

But the thing comes stranger. When I buy an object, it buys me 4 objects more without oaying it. For example I buy 1 coil and they give me4 for the price of 1

So, when you click the button, it automatically gives you four without having to click again?

Yes. Im going to fo the print thing but I dont have a clue of what is going on


It puts lots of objects in there as you can see

Can you show me what your local and server script looks like? I know I told you what to put in, I just want to confirm you included it correctly

Give me a second but I had an idea of putin this:
RemoteEvent.OnServerEvent:Connect(function(player, Value, Item) –
player.leaderstats.Points.Value = player.leaderstats.Points.Value - Value
game.ReplicatedStorage.Library[Item]:Clone().Parent = player:WaitForChild(“Backpack”)
end)
For every object

Ohh, you need to do it for every object, but it’s not the server script you need to edit… That will only work for the DualMegaCoil. The server script is designed to accept whatever input you pass from the local script. So for each button click, you will need to set each individual parameter, but you can fire the same event. So like for another object, the 1st parameter could be 500, and the second one would be like “SpeedCoil”.

Look I did it like this on the script of the leaderstats(the principal)


And I think Im a Dummy and I make it really bad

Ohhh yeah… just stick with what I did with the game.ReplicatedStorage.Library[Item]:Clone().Parent = player:WaitForChild("Backpack"), and you will only get the item you buy, if you set up each button individually, in a local script. You really won’t need to touch the server script much.

Well I did it the long way and I hope It doesnt blow up, but in any case Im going to test it out and see what happends

So I did it this way:


But it was a fail, the error stills there. What was your proposal?

Oh, you can only have one onserverevent per remote event. You should stick with just one of those functions, and use game.ReplicatedStorage.Library[Item]:Clone().Parent = player:WaitForChild("Backpack") But instead, create multiple MouseButton1Down functions for each button, with each one passing their own Value and Item to the server, in the FireServer parameters