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

How do I call on a player in a regular script?

I'm making this script for testing and I'm having trouble figuring out how to check if the player is in group and team, but not when they joined the game.

local weapon = game.Lighting:FindFirstChild("M3 Grease Gun")

game.Players.PlayerAdded:connect(function(player)
	if player:IsInGroup(4057855, 4057998) then
		if player.TeamColor == BrickColor.new("Bright red") then
		weapon:clone().Parent = player.Backpack
	end
end
end)

3 comments

0

Any errors?

0

The teamcolor statement looks fine. Probably has to be something from the group statement

0

So you want to know if they're in a certain group or team outside of the PlayerAdded event?

1 answer

Try this:

local weapon = game.Lighting:FindFirstChild("M3 Grease Gun")

game.Players.PlayerAdded:connect(function(player)
    if player:IsInGroup(4057855) or player:IsInGroup(4057998) then
        if player.TeamColor == BrickColor.new("Bright red") then
        weapon:clone().Parent = player.Backpack
    end
end
end)

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