let me draw what im looking for, one second
so, if the player is touching the delivery part, the part that is currently inside of the player backpack clones itself into rs
Not if you clone it from the RS. If you do it you will give to the player a copy of the item and so you can destroy it as the original one will be keeped in the RS
clone a tool form the players backpack into rs
Why do you need to do it???
A players click a button which clones the tools from RS to the players backpack so they can drop them off at the location, once the location part is touched it has to clone back to RS or the players wont have anymore packages to deliver.
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if plr.Backpack:FindFirstChild("ToolName") then
plr.Backpack:FindFirstChild("ToolName"):Clone().Parent = game.ReplicatedStorage
elseif plr.Character:FindFirstChild("ToolName") then
plr.Character:FindFirstChild("ToolName"):Clone().Parent = game.ReplicatedStorage
end
end
end)
When a player touches the part check if the tool is in the players backpack or in the character then clone it to RS
If you clone the tool when you give it to the player the player will receive just a copy that you can destroy once he touches the part while you will always have the original tool in RS
But since you cloned it to the players backpack there is an extra package in replicated storage. Are you sure you cloned the package to the players backpack instead of just setting the parent of the package?
I think he wants to know how many orders the player has delivered
Then he could just use a table or a value inside the player. Duplicate things a lot of times will just ruin the performances
Yes because if you cloned the package into the backpack then you would still have a package in RS so you could just destroy the players tool so like this:
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
if plr.Backpack:FindFirstChild("ToolName") then
plr.Backpack:FindFirstChild("ToolName"):Destroy()
elseif plr.Character:FindFirstChild("ToolName") then
plr.Character:FindFirstChild("ToolName"):Destroy()
end
end
end)
ohhh, man i really am stupid. Yeah this makes sense know. sorry for wasting everyone’s time.
It’s ok
30