Shop System Bug

Hello developers! I have a problem with my shopping system; it works fine whenever there’s only one person in the server. Whenever there’s more than one, and you go to shop, the script gives you an item for every person in the server instead of just one. For example, if there’s 3 people in the server, the system gives you 3 items.

Local Script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local shop = workspace.JerryIsland.JerrysShop
local shopRemote = ReplicatedStorage:WaitForChild("JerryRemote")

local player = Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid

for i, v in ipairs(shop:GetDescendants()) do
	if v:IsA("ProximityPrompt") then
		if v.Name == "KnifePrompt" then
			v.PromptButtonHoldEnded:Connect(function()
				shopRemote:FireServer(v.Name)
			end)
		end
		
		if v.Name == "SSPrompt" then
			v.PromptButtonHoldEnded:Connect(function()
				shopRemote:FireServer(v.Name)
			end)
		end
		
		if v.Name == "ShieldPrompt" then
			v.PromptButtonHoldEnded:Connect(function()
				shopRemote:FireServer(v.Name, character)
			end)
		end
	end
end

Server Script:

local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local WeldMod = require(ServerScriptService.ShieldWeld)

local shopRemote = ReplicatedStorage:WaitForChild("JerryRemote")
local shopItems = ServerStorage:FindFirstChild("ShopItems")

shopRemote.OnServerEvent:Connect(function(player, promptName, character)
	local backpack = player:FindFirstChildOfClass("Backpack")
	local cost = 0 
	
	if promptName == "KnifePrompt" then
		cost = 7
		if player.leaderstats.Marks.Value >= cost then
			local knifeClone = shopItems.Knife:Clone()
			knifeClone.Parent = backpack
			player.leaderstats.Marks.Value -= cost
		else
			return
		end
	end
	
	if promptName == "SSPrompt" then
		cost = 13
		if player.leaderstats.Marks.Value >= cost then
			local swordClone = shopItems.ShortSword:Clone()
			swordClone.Parent = backpack
			player.leaderstats.Marks.Value -= cost 
		else
			return
		end
	end
	
	if promptName == "ShieldPrompt" then
		cost = 6
		if player.leaderstats.Marks.Value >= cost then
			local originalShield = shopItems:FindFirstChild("Shield")
			local shield = originalShield:Clone()
			local attachPoint = shield:FindFirstChild("Attach")
			shield.Parent = workspace

			WeldMod.Weld(shield, attachPoint, character)
			player.leaderstats.Marks.Value -= cost
		else
			return
		end
	end
end)

What can I do to solve my dilemma?

Put everything in a local script. A server-script(by the name you can tell) is a server. It can access all of the clients and thus causing your problem. You don’t need a remote evens, just put everything in a local script.

Could it be possible that the server script is adding up for each player? If that was the case, three server scripts executing the same details wouldn’t be a surprise.

Ok but what i’m not getting is - what’s the point if you already have the player variable lol

Why wouldnt you do player:FindFirstChildOfClass("Backpack")

This wouldn’t work; I need to access ServerStorage and ServerScriptService for the script to work which can’t be accessed from a LocalScript, sorry!