Hi, what I'm trying to do is have a place where you can see a gun model and if you click on it, it will go to you. But, there are some other things too. The first is that if you already have the gun you cant pick it up again. The second thing is that after one person takes it, it will still be there for another person to come take. So pretty much, it will be like the shotgun and pistol pick up area in the volcano criminal base in Roblox jailbreak for those who have heard of, or played that.
Use the original gun and put it in replicated storage, then clone it so it goes into workspace or wherever you want it to be. You can use workspace.ChildRemoved (replace workspace with where the gun is) to detect when a player picks it up, then clone the original gun again to go back into workspace.
Here is the respawning gun script:
local area = -- where will the gun be located? local gun = -- your gun in replicated storage area.ChildRemoved:Connect(function(child) if child.Name == gun.Name then -- you can do child.Name == "" then put the name in quotations wait(5) -- wait time :) local clone = gun:Clone() -- clones gun clone.Parent == area end end)
Here is the clicking on gun to equip if they need it, and also checking if they already have it
local gun = -- your gun with a click detector gun.ClickDetector.MouseClick:Connect(function(player) local char = player.Character or player.CharacterAdded:Wait() -- get character if player.Backpack:FindFirstChild(gun) == nil or char:FindFirstChild(gun) == nil then -- do they have gun? gun.Parent = char -- gun.Parent = player.Backpack (alternate) end end)
Hope that helps