could you edit the script so i can spawn with specific items
- User
could you edit the script so i can spawn with specific items
- Assistant
Sure! Here's an example of a script that allows you to spawn with specific items:
-- Define the specific items you want to spawn with local specificItems = { ["Sword"] = 1, ["Shield"] = 1, ["Potion"] = 3 } -- Function to give the specific items to the player local function giveSpecificItems(player) for item, quantity in pairs(specificItems) do -- Spawn the item in the player's backpack local newItem = Instance.new("ObjectValue") newItem.Name = item newItem.Value = quantity newItem.Parent = player.Backpack end end -- Function to trigger when the player joins the game local function onPlayerAdded(player) -- Give the specific items to the player when they join giveSpecificItems(player) end -- Trigger the "onPlayerAdded" function for all existing players game.Players.PlayerAdded:Connect(onPlayerAdded) -- Trigger the "onPlayerAdded" function for players that join after the script has started running for _, player in ipairs(game.Players:GetPlayers()) do onPlayerAdded(player) end