Hi, first I present you what I am trying to get. The goal is to get an item from object A in the picture and then press E on object B and earn money. It’s like a delivery system in a way.
The problem is that when I take the item (a cardboard) from object A, all the other players can’t take a cardboard anymore and have to wait for me to put it on object B (the shelf) to be able to take a cardboard in their turn.
This problem is probably related to the fact that the script makes sure that a player cannot take several cards at the same time. Except that it works but not independently for each player.
Script from object A
local prp = script.Parent
local cardboard = game.ServerStorage.Cardboard
prp.Triggered:Connect(function(player)
cardboard:Clone()
cardboard.Parent = player.Backpack
game.StarterPlayer.cardboard.Value = true
prp.Enabled = false
end)
Script from object B
local cardboardtool = game.ServerStorage.Cardboard
local BoxStock = game.Workspace.BoxStock
local prp = script.Parent
local customer = prp.Parent
script.Parent.Triggered:Connect(function(player)
if game.StarterPlayer.cardboard.Value == true then
player.leaderstats.Money.Value = player.leaderstats.Money.Value + 5
game.StarterPlayer.cardboard.Value = false
cardboardtool.Parent = game.ServerStorage
wait(5)
game.Workspace.BoxStock.ProximityPrompt.Enabled = true
end
end)
Thanks in advance to those who will help me