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

How do I make this script Compatible with Filtering Enabled? Accepting more Answers

Asked by 8 years ago
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 


0
you're trying to change the player's team from the client. the game will not accept the change because filtering is enabled, so the client needs to invoke some signal to a server-sided script that will respond by changing the team. All of the things that you do on the client that directly change things in the game are not going to replicate with filtering enabled. 1waffle1 2908 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

I don't have time to provide a full answer, but here is one of your errors:

-- your code should be:

local Teams = {}
for _,v in pairs (game.Lighting.Teams:GetChildren()) do
    Teams[v.Name] = v
end

print(Teams["Tourist"].Name) -- will not return nil now, previously the keys were numbers, but I set them to the team's name

Hopefully I helped with part of your code.

~TDP

Ad
Log in to vote
0
Answered by 8 years ago

Use a regular script
That was easy

Your code doesn't appear to be doing anything important other than getting the LocalPlayer. Instead of using the LocalPlayer, put it in a regular Script to run on the server and move your code into an appropriate event such as PlayerAdded.

Result? Success.

Answer this question