Hello, I am trying to make a fps game and I want to make it where whenever you spawn, you spawn with the guns/tools. The local script is located in StarterPlayer.StarterPlayerScripts and I have already tried using a normal script in ServerScriptService with no changes to the code. Basically, the script runs when the player is added. It checks a folder in ReplicatedStorage with tools using GetChildren: and detects if the child is a Tool. If it detects a tool, it should take that tool, clone it, and make its parent the players’ backpack. But it doesn’t work. No errors in output, nothing.
Here’s the script:
local StarterPack = true --If true, player will spawn with the tools located in game.ReplicatedStorage.SAE["SAE - Tools"]
game.Players.PlayerAdded:Connect(function(Player)
if StarterPack == true then
for i, v in game.ReplicatedStorage.SAE["SAE - Tools"]:GetChildren() do
if v:IsA("Tool") then
v:Clone().Parent = Player.Backpack
end
end
end
end)
You can use both PlayerAdded() and CharacterAdded() in Server and Client-Sided script. However, if you are listening to PlayerAdded() in LocalScript , it will only fire when another player joins, not when the player who runs the LocalScript joins . Which means the “2” will only be printed when someone else joins.
No, doing player added in client side never work for us (the client), it work only for the next players added after you joined the game, because all local script are starting to run only once your player object was already added.