Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why doesn't this PlayerAdded script work?

I made a script that gives me or the solo test "Player" a tool when they join a game. However, it doesn't work, and the output doesn't tell me anything. Here is the script.

local Players = game:GetService("Players")

function onPlayerAdded(player)
	local l = game.ServerStorage.LASM:Clone()
	if player.Name == "Wizardel" or player.Name == "Player" then
		l.Parent = player.Backpack
	end
end

Players.PlayerAdded:connect(onPlayerAdded)

for _,player in pairs(Players:GetPlayers()) do
     onPlayerAdded(player)
end


I need the

for _,player in pairs(Players:GetPlayers()) do
     onPlayerAdded(player)
end

bit so that it works in Solo Test mode. Can anybody help?

1 answer

Usually, the player is called "Player1" and "Player2" and so on... Try changing the string to that.

1 comment

0

Except it's not, It's called "Player" whenever I test it. Also, it doesn't work for me in online mode.

This discussion is preserved as it was. New answers, comments, and votes are closed.