Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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)
0
Any errors? hellmatic 1523 — 6y
0
The teamcolor statement looks fine. Probably has to be something from the group statement hellmatic 1523 — 6y
0
So you want to know if they're in a certain group or team outside of the PlayerAdded event? MooMooThalahlah 421 — 6y

1 answer

Log in to vote
0
Answered by
hellmatic 1523 Moderation Voter
6 years ago

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)

Ad

Answer this question