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

How do I make a Group-Only spawn?

Asked by 10 years ago

Well, I'm trying to make a place for a group, and I need to make a group only spawn, and I can't script for nothing, so, if I could get some help?

1 answer

Log in to vote
1
Answered by
digpoe 65 Badge of Merit
10 years ago

You would check if they're in the group that the user is in using the 'IsInGroup' method of Player.

Some code would look like this:

local groupId = 0 -- Replace this with your group Id.

game.Players.PlayerAdded:connect(function(plr)
    if plr:IsInGroup(groupId) then
        -- Either teleport them to the 'spawn'
        -- Or change their TeamColor to a 'Group' Team's TeamColor.
    end
end)

EDIT: If you're teleporting them to the spawn, don't forget to wait for the character to load;

plr.CharacterAdded:wait() -- waits for the 'CharacterAdded' event to fire. This would signal that the player's character has loaded and there should be no errors when you teleport them.
Ad

Answer this question