So, I am working on a team script for someone, and it’s not working as I planned to.
Explanation: https://gyazo.com/66d8113832b958e52a4fdcef72c700c2
So, in the GUI the text color should be the color of the team, which is only achieved by the name of the group and the client found that. But in the server, it somehow didn’t find it?
Client Code:
local gids = {
[7813751] = [[//Security Containment Procedures Foundation\\\\]],
[8667044] = [[///Scientific Department\\\]],
[8666926] = [[///Security Department\\\]],
[8670890]=[[//SCPF// InternaI Security Department]],
[8864196]=[[///Department of External Affairs\\\]],
[8717740]=[[//Tactical Security Detachment\\]],
[8718347]=[[///Medical Department\\\]],
[8718214]=[[///Ethics Committee\\\]],
[8718251]=[[///Intelligence Agency\\\]],
[8717163]=[[///Mobile Task Force\\\]],
}
local ex = script.example
ex.Parent = nil
local p = game:GetService('Players')
local player = p.LocalPlayer
local ts = game:GetService('TweenService')
local O = TweenInfo.new(.2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,false,0)
local I = TweenInfo.new(.2,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0)
local tcg = script.Parent.tcg
for i,n in next,gids do
if player:IsInGroup(i) then
local c = ex:Clone()
c.Parent = tcg.l
c.Name = i
c.Text = n
local tea = game:GetService('Teams')
if tea:FindFirstChild(n) then
c.TextColor3 = tea[n].TeamColor.Color
end
c.MouseButton1Click:connect(function()
local rs = game:GetService('ReplicatedStorage')
local req = rs:FindFirstChild('tc')
if req then
req:FireServer(c.Name)
CLOSE()
end
end)
end
end
local uis = game:GetService('UserInputService')
local open = false
function OPEN()
tcg.Visible = true
local prop = {
BackgroundTransparency = 0
}
local p2 = {
TextTransparency = 0
}
local b = ts:Create(tcg,I,prop)
b:Play()
local d = ts:Create(tcg.TextLabel,I,p2)
d:Play()
open = true
end
function CLOSE()
local prop = {
BackgroundTransparency = 1
}
local p2 = {
TextTransparency = 1
}
local b = ts:Create(tcg,I,prop)
b:Play()
local d = ts:Create(tcg.TextLabel,I,p2)
d:Play()
open = false
wait(.2)
tcg.Visible = false
end
local req = {
[Enum.KeyCode.F] = {
limit=1,
func=function()
if open == false then
OPEN()
else
CLOSE()
end
end,
pressed=0
}
}
uis.InputBegan:connect(function(o,gm)
if not gm then
if req[o.KeyCode] then
local i = req[o.KeyCode].limit
local f = req[o.KeyCode].func
local p = req[o.KeyCode].pressed
if p >= i then
f()
else
req[o.KeyCode].pressed = req[o.KeyCode].pressed + 1
spawn(function()
wait(.4)
req[o.KeyCode].pressed = 0
end)
end
end
end
end)
Server code:
local cache = {}
local c = {
[7813751] = [[//Security Containment Procedures Foundation\\\\]],
[8667044] = [[///Scientific Department\\\]],
[8666926] = [[///Security Department\\\]],
[8670890]=[[//SCPF// InternaI Security Department]],
[8864196]=[[///Department of External Affairs\\\]],
[8717740]=[[//Tactical Security Detachment\\]],
[8718347]=[[///Medical Department\\\]],
[8718214]=[[///Ethics Committee\\\]],
[8718251]=[[///Intelligence Agency\\\]],
[8717163]=[[///Mobile Task Force\\\]],
}
game.ReplicatedStorage.tc.OnServerEvent:Connect(function(player,requesting)
if not requesting then player:Kick(' - Exploiting. -') end
if not typeof(requesting) == 'number' then player:Kick(' - Exploiting. -') end
if player:IsInGroup(requesting) then
local name = c[requesting]
local ts = game:GetService('Teams')
if ts:FindFirstChild(name) then
local t=game.Teams[name]
local rank = player:GetRankInGroup(requesting)
if rank ~= 0 then
player.Team = t
player:LoadCharacter()
end
else
print('Team not found.')
end
end
end)