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

How to show a gui only to electric blue team color with a script?

Okey so i tried to make a script that if the player team color is electric blue , it will give the player a gui but when i test the game and spawn in electric blue color nothing happens

the script:

game.Players.PlayerAdded:connect(function(plr)

    if plr.TeamColor == BrickColor("Electric blue") then

        local gui = game.ReplicatedStorage.Gui:Clone()

        gui.Parent = plr.PlayerGui

    end

end

help me please

[btw Gui is the only gui in replicated storage]

1 comment

0

sorry if the title is extrange but it didnt let me ask this

1 answer

✓ Accepted answer

Put the GUI in StarterGui, works better. Use a localscript inside the Gui.

--LocalScript
local plr = game.Players.LocalPlayer
local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function() --Fires every frame
	if plr.TeamColor == BrickColor.new("Electric Blue") then --Use BrickColor.new when referencing a color
		script.Parent.Enabled = true --Enables the UI
	else
		script.Parent.Enabled = false --Disables the UI
	end
end)

Comment any additional questions!

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