So, I wrote a script to give a player a knife when they talk to a NPC, they receive a knife just fine but the issue is that they receive a number of knives relative to the numbers of players in the server, For example if there is 1 player in the server they will receive one knife, but if there are 4 the player will receive 4 knives when they talk to the NPC.
I want the player to only receive 1 knife no matter how many players there are. I've tried using a script that checks if the player already has the knife, and if they do not to give them one but that did not work.
It uses a remote function to go from a Local script (Where the NPC dialogue is) to a server script so that other players can see the knife in the players hand. It worked fine in the local script but as mentioned other players could not see the knife.
Here's my script
local RM = game.ReplicatedStorage:WaitForChild("GiveKnife")
local Knife = game.ReplicatedStorage.Knife
local function GiveKnife(player)
print(player)
Knife:Clone().Parent = player.Backpack
end
RM.OnServerEvent:Connect(GiveKnife)

2 comments
What does it print?
For anyone curious for how it was solved, I just moved the script from StarterGui. Not sure why I put it in there