for i, Flag in pairs(Flags:GetChildren()) do
for i, FlagChild in pairs(Flag:GetChildren()) do
if FlagChild.Name == "Flag" then
for i, FlagDecal in pairs(FlagChild:GetChildren()) do
if FlagDecal:IsA("Decal") then
if plr.TeamColor == BrickColor.new("Dark stone grey") then
FlagDecal.Texture = "rbxassetid://1"
elseif plr.TeamColor == BrickColor.new("Deep orange") then
FlagDecal.Texture = "rbxassetid://0"
end
end
end
end
end
end
But my script doesn’t work, and I don’t get any errors in the output.
local Player = whatever.Parent
local Flags = whatevermodel.Parent
for index, Decal in pairs(Flags:GetDescendants()) do
if Decal:IsA("Decal") and Player.TeamColor == BrickColor.new("COLORHERE") then
-- function here
elseif Decal:IsA("Decal") and Player.TeamColor == BrickColor.new("COLORHERE") then
-- function here
end
end
Are you sure the TeamColors are correct? Because it’s working for me in studio
local Flags = workspace:WaitForChild'Flags'
for i, Flag in pairs(Flags:GetChildren()) do
for i, FlagChild in pairs(Flag:GetChildren()) do
if FlagChild.Name == "Flag" then
print(FlagChild:GetFullName())
for i, FlagDecal in pairs(FlagChild:GetChildren()) do
if FlagDecal:IsA("Decal") then
print'Changing flag decal'
end
end
end
end
end
ProximityPrompt.Triggered:Connect(function(promptObject, plr)
if NeutralizedV.Value == false then
for i, Flag in pairs(Flags:GetDescendants()) do
for i, FlagChild in pairs(Flag:GetDescendants()) do
if FlagChild.Name == "Flag" then
for i, FlagDecal in pairs(FlagChild:GetDescendants()) do
if FlagDecal:IsA("Decal") and plr.TeamColor == BrickColor.new("Dark stone grey") then
FlagDecal.Texture = "rbxassetid://1"
if FlagDecal:IsA("Decal") and plr.TeamColor == BrickColor.new("Deep orange") then
FlagDecal.Texture = "rbxassetid://0"
end
end
end
end
end
end
end
end)
EDIT: I think I realized, I just forgot to set the NeutralizedV.Value to false in studio EDIT2: nope, still didnt work