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

Group Rank team change and spawns?

Asked by 6 years ago

I am running into an issue and wanted to know if someone might be able to help out with this scripting logic. - We have multi spawn points on the map (example: BCT, Enlisted, Officers, Visitors, ect...) - We want to be able to use our groupID and rankID to spawn them and group them

This is what i have so far for the spawn:

--Put the script in starterpack; The part MUST be in game.Workspace--

wait(1)
player = script.Parent.Parent
GroupID = 3437316 --Put the group ID here
GroupRole = 254 -- Put the group role here, found in the group admin section.
TargetPart = game.Workspace:FindFirstChild("Officer") --Change the stuff in quotes to the part you want him to spawn at

function CheckPlayerStatus()
if player:IsInGroup(GroupID) then
CheckRank()
else end
end

function CheckRank()
Rank = player:GetRankInGroup(GroupID)
if Rank == GroupRole then
character = player.Character
torso = character.Torso
torso.CFrame = TargetPart.CFrame
else 
end
end

CheckPlayerStatus()

This is what i have so far for the Team change:

groupID = 3465376 -- The Group ID
GroupRole = 254 -- The Group Rank
teamColor = "Wheat" -- The team color

game.Players.PlayerAdded:connect(function(player)
if (player:IsInGroup(groupID)) and (player:GetRankInGroup(GroupRole)) then
player.TeamColor = BrickColor.new(teamColor)
end
end)

The issue i am running into is I have too many of those scrips and they stop working the way i like. When i do One script at a time it works great.

Group ranks and spawns are as follow:

    0 = Visitor
    1 = BCT
    2 = Enlisted
    3 = Enlisted
  94 = Enlisted
  95 = Enlisted
  97 = Enlisted
  98 = Enlisted
  99 = Enlisted
247 = Officer
248 = Officer
249 = Officer
250 = Officer
251 = Officer
252 = Officer
253 = Officer
254 = Officer
255 = Officer

I am also adding some complexion this a little more as well by having it move the play to a different spawn location if they are in another group as well. So Example: if you are in another group then you spawn in another location

function onPlayerEntered(player)
if player:IsInGroup(3460370) then --In the ( )"s put the Group Id
player.TeamColor = BrickColor.new("Really red") -- Color must match with team color.
end
end

function onPlayerEntered(player)
if player:IsInGroup(3489553) then --In the ( )"s put the Group Id
player.TeamColor = BrickColor.new("Deep orange") -- Color must match with team color.
end
end

function onPlayerEntered(player)
if player:IsInGroup(3493238) then --In the ( )"s put the Group Id
player.TeamColor = BrickColor.new("Forest green") -- Color must match with team color.
end
end

function onPlayerEntered(player)
if player:IsInGroup(3465419) then --In the ( )"s put the Group Id
player.TeamColor = BrickColor.new("Wheat") -- Color must match with team color.
end
end

function onPlayerEntered(player)
if player:IsInGroup(3465376) then --In the ( )"s put the Group Id
player.TeamColor = BrickColor.new("Forest green") -- Color must match with team color.
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)

maybe I am over thinking this but i can not seem to figure this out

0
The Only other way i know i can get it to work is make a group for each and have then join the group but i don't want to do that cause i don't want to take up useless space in their groups GamerKids080 0 — 6y

1 answer

Log in to vote
0
Answered by 3 years ago

I also have this question, but I only know about doing spawn by the script and that's it

function onPlayerEntered(plr) if plr.UserId == UserId then

plr.TeamColor = BrickColor.new("Team Color") plr:LoadCharacter() end end

game.Players.PlayerAdded:connect(onPlayerEntered)

Ad

Answer this question