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

How can I make this script Compatible with FE?

local Player = game.Players.LocalPlayer
local Teams = game.Lighting.Teams
CurrentGroup = 1020134
-- Colombians

if Player:IsInGroup(CurrentGroup) then
	local Colombians = Teams["Colombians"]
	Colombians.Parent = game.Teams
	Player.TeamColor = BrickColor.new("Bright green")

else

-- Tourist
local Tourist = Teams["Tourist"]
Tourist.Parent = game.Teams
Player.TeamColor = BrickColor.new("Bright yellow")

end	

1 comment

0

When I did your answer, The teams Disappeared.

1 answer

I would use RemoteEvents for client-server communications like this.

Firstly you'd make the serverside code:

local Event = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage")) --Make the event
Event.Name = "MakeTeam" --Give it an obvious name

Event.OnServerEvent:connect(function(Player, TeamName, TeamColor) --Will fire when "Event:FireServer()" is called
	local Team = game:GetService("Lighting")[TeamName]
	Team.TeamColor = TeamColor
	Team.Parent = game:GetService("Teams")
end)

Now for the client-side (your script):

local Player = game.Players.LocalPlayer
local Teams = game.Lighting.Teams
local Event = game:GetService("ReplicatedStorage"):WaitForChild("MakeTeam") --Get our event
CurrentGroup = 1020134
-- Colombians

if Player:GetRankInGroup(CurrentGroup) > 0 then --GetRankInGroup is better as it updates every time you call it
    
	Event:FireServer("Columbians", BrickColor.new("Bright green")) --Will run the function in the serverscript

else

-- Tourist
	Event:FireServer("Tourist", BrickColor.new("Bright yellow")) --Will run the function in the serverscript

end 

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