-
So I want the player to pick up the “random” object that they found and have it in their backpack. The random tool is randomly chosen from a model in ServerStorage. I want the player to only have 1 of the tools from the model and if they have more, it gets removed.
-
The issue is that A) I have no clue how to do it and B) I tried but I don’t think I’m getting it.
-
I have tried searching on it but nothing came up of what I wanted.
This is the code I have right now
local Spawner = game.Workspace.Spawner
local Players = game:GetService("Players")
local equipped = false
local Packages = game:GetService("ServerStorage").Packages:GetChildren()
local randomPackage = Packages[math.random(1,#Packages)]:Clone()
--// Main
while wait(math.random(10,20)) do
local Packages = game:GetService("ServerStorage").Packages:GetChildren()
randomPackage.Parent = workspace
randomPackage.Handle.CFrame = Spawner.CFrame
end
Players.PlayerAdded:Connect(function(player)
if player.Backpack:FindFirstChild(randomPackage) or randomPackage.equipped == true then
print("Player already has the package")
else
randomPackage.Parent = player.Backpack
end
end)
Can anyone help?