Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How do you make people spawn with items?

Asked by 8 years ago

i want only certain people to spawn with a certain item.

1 answer

Log in to vote
0
Answered by 8 years ago

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)

Ad

Answer this question