i want only certain people to spawn with a certain item.
COMMUNITY QUESTION
How do you make people spawn with items?
1 answer
If you want only certain Players to have a certain Item I suggest you make a table with the Name of Players you want to have the Item. I also suggest you Store the Item your want to give to Certain Player inside a Lighting or ReplicatedStorage.
local ItemPeople = {"Player","Bob","UserOnly16Characters","Steve"}--Replace these Random Players Name with your own.
local Item = game.Lighting:FindFirstChild("Sword")--Replace the Sword with your chosen Item name
game.Players.PlayerAdded:connect(function(Player)--The Function listen for the PlayerAdded event.
for _, v in pairs(ItemPeople) do--Loops through the Table
if Player.Name == v then--Check if Player's Name matches with the Table name.
wait(1)--Prevent the script from run before the Player's Backpack has even loaded.
Item:Clone().Parent = Player.Backpack--Clone's your Item to the Players Backpack
Item:Clone().Parent = Player.StarterGear--Clone's the Item to the Player's StarterGear so when ever the Player dies he can respawn with the item.
end
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
