local Tool = game.ServerStorage.Tool game.Players.PlayerAdded:connect(function(player) print(player.Name .. " has joined the game! :D") Tool:Clone() Tool.Parent = player.Backpack end)
It is meant to put a tool in the Player's Backpack when the enter.
[[wiki.roblox.com/index.php?title=PlayerAdded]]
Basically,You need to add an onPlayerAdded function since the script is added to the game after the player is added
local Players = game:GetService("Players") function onPlayerAdded(player) print(player.Name .. " has entered the game") end --When a player joins, call the onPlayerAdded function Players.PlayerAdded:connect(onPlayerAdded) --Call onPlayerAdded for each player already in the game for _,player in pairs(Players:GetPlayers()) do onPlayerAdded(player) end
local Sword = game.ServerStorage:WaitForChild("Tool") function onAdded(player) print(player.Name .. " has joined the game! :D") Sword:Clone() Sword.Parent = player:WaitForChild("Backpack") end game.Players.PlayerAdded:connect(onAdded)
For some reason you cant name it tool, so name it something like Sword or AK47 and also its a good practice to use :WaitForChild, it will yeild(wait/stop) the script until that object is not nil and it will prevent errors, another good practice is using functions, it makes it so you dont half to copy and paste code over and over instead you can just call the function.