I want to make a setting in my settings tab as a localscript were if its turned on, players on the team “fans” would become invisible on that clientside
and if the textbutton is clicked again they would become uninvisible.
i guess you can do something like this:
local TextButton = --Your text button
local IsActive = false
local plrs = game.Players
TextButton.Activated:Connect(function(obj,clicks)
if IsActive then
IsActive = false
for i,v in pairs(plrs:GetPlayers()) do
if v.Team ~= game.Teams.Fans then return end--Your team
for i,v in pairs(v.Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
v.Transparency = 0
end
end
end
else
IsActive = true
for i,v in pairs(plrs:GetPlayers()) do
if v.Team ~= game.Teams.Fans then return end--Your team again
for i,v in pairs(v.Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
v.Transparency = 1
end
end
end
end
end)
BreakDown
so this Source needs to be inserted into a localscript,
when the textbutton is clicked it checks if the button is on(to determine if the plrs are invisible)
if not it loops through all players, checks if their team is “fans” , then loops through their valid bodyparts and sets their transparency to 0 making them visible for the client, on the server it does the same, but it sets their transparency to 1 making them invisible to the client.
change the team name on the line with comments to your team and the textbutton variable to your textbutton
Keep in mind this needs to be in a local script
there!
1 issue. It will show Humanoid Root Part with should be transparent.
ah, sorry for the oversight here is a new script:
(local again)
local TextButton = --Your text button
local IsActive = false
local plrs = game.Players
TextButton.Activated:Connect(function(obj,clicks)
if IsActive then
IsActive = false
for i,v in pairs(plrs:GetPlayers()) do
if v.Team ~= game.Teams.Fans then continue end--Your team
for i,v in pairs(v.Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
if v.Name == "HumanoidRootPart "then continue end
v.Transparency = 0
end
end
end
else
IsActive = true
for i,v in pairs(plrs:GetPlayers()) do
if v.Team ~= game.Teams.Fans then continue end--Your team again
for i,v in pairs(v.Character:GetChildren()) do
if v:IsA("Part") or v:IsA("MeshPart") then
if v.Name == "HumanoidRootPart" then continue end
v.Transparency = 1
end
end
end
end
end)
edit: continue in plr team checks