I am making an FPS game and everything works fine at the moment but I want to add a feature that players drop 1 single model (or part) on death. I have the ammo box whit full scripts in it but I just need to know how to make players drop that part. The ammo box is a part I will change it to a model if that's better
id like information about all the things I need and where to exactly put them in order to do the right thing.
every answer will be appreciated (:
First, insert that ammo box in "Replicated Storage". Now, insert this in a script in StarterPlayer > StarterCharacterScripts:
wait(5) -- waits for the player to load it script.Parent.Humanoid.Died:Connect(function() local ClonedAmmoBox = game.ReplicatedStorage:WaitForChild("WHATEVER YOU NAMED YOUR AMMO BOX"):Clone() ClonedAmmoBox.Parent = game.Workspace ClonedAmmoBox.CFrame = CFrame.new(script.Parent:WaitForChild("HumanoidRootPart").Position) end)
Also, make sure the ammo box is a part and not a model!
What I did is that when the player dies, the script clones the ammo box into the workspace. Then, I set the position of the cloned ammo box at the player's humanoid root part. You could also insert that ammo box in server storage, cuz this is a script and not a local script, but you will have to change the "ReplicatedStorage" at line 4 to "ServerStorage".
use this: (make sure to put it in StarterCharacterScripts) Put the thing you want them to drop in lighting and rename Handle to whatever you need
script.Parent = local Torso = script.Parent:FindFirstChild('Torso') function onDied() print ("Script Loaded.") wait(1) local n = game.Lighting["Handle"]:Clone() n.Parent = game.Workspace n.Position = Torso.Position n.Handle.Position = script.Parent.Torso.Position end while true do wait(0.00000001) if script.Parent.Humanoid.Health == 0 then onDied() end end