Delivery system shows other players the drop-off location

So I have this delivery system that lets players pick up a box and it shows the player where to deliver it and gives player a reward and after a while the box spawns back.

The problem is when a player clicks the box the drop-off point shows up but other players can also see the drop off point and I don’t want this to happen.

Another problem I have is that the box they click disappears for other players too.

How can I solve this?

Here are the scripts

Pick-Up Script:

local DropOff = workspace.DropOff
local DropOff2 = workspace.DropOff2
DropOff2.Transparency = 1
DropOff.Transparency = 1
script.Parent.ClickDetector.MouseClick:Connect(function(plr)
local gui = script.BoxUI:Clone()
gui.Parent = plr.PlayerGui
script.Parent:Destroy()
local Chooser = math.random(1,2)
print(Chooser)
if Chooser == 1 then
DropOff.Transparency = 0.5
else
if Chooser == 2 then
DropOff2.Transparency = 0.5
wait(5)
end
end
end)

Drop-Off Script:

script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local plrgui = player:FindFirstChild(“PlayerGui”)
if plrgui:FindFirstChild(“BoxUI”) then
plrgui:FindFirstChild(“BoxUI”).Parent = nil
local c = script.CompleteBoxUI:Clone()
c.Parent = plrgui
local Deliveryreward = player.leaderstats.Cash
Deliveryreward.Value = Deliveryreward.Value + 5
wait(3)
c.Parent = nil
local original = game.ReplicatedStorage.Box
local copy = original:Clone()
copy.Parent = game.Workspace
copy:SetPrimaryPartCFrame(CFrame.new(51.432, 1.2, -3.084))
print(“Box Duped”)
end
end
end)

This is because you’re making a drop off point on the server; That means that drop off point gets replicated for every single client. You should make a remoteEvent and fire it to the player in question and then show the drop off point from a LocalScript. If you want help with that or you don’t understand it you can message me :smiley:

1 Like