I am making a point capture game and I have made it so that these specific point capture parts change colors when a person on a team touch them. I want a spawn button gui to change color as well to match with these parts.
Update: I have done it but the problem is that the gui does not change color until you reset your character. Is there a way that I can make it update live?
Mind showing us your code? So we could help
team = script.Parent
flag = script.Parent.Parent.Flag
pole = script.Parent.Parent.Pole
button = game.StarterGui.Main[“Background 1”].TextButton
function onTouch(hit)
local user = game.Players:GetPlayerFromCharacter(hit.Parent)
if user ~= nil then
team.BrickColor = user.TeamColor
flag.BrickColor = user.TeamColor
pole.Handles.Color = user.TeamColor
button.BackgroundColor = user.TeamColor
end
end
script.Parent.Touched:connect(onTouch)
local part = —
local textbuttom = —
if part.Touched:Connect(unction()
textbutton.color3 = color3.new(“Color”)
end)
This might help. You can change it to fit according to your other scripts.
Localscript:
local button = script.Parent.Button
local capture = workspace.CaptureZone
capture:GetAttributeChangedSignal("BrickColor"):Connect(function()
button.BackgroundColor = capture.BrickColor.Color
end)
sorry for the late replies everyone. ExoticAlpha’s solution was what ended up working. there were a couple of typos and other errors in his solution but I fixed em all and it ended up working. Here is my code. I did not put the local script inside of the text button but rather the main frame that it is a part of. Massive thanks to him, and everyone who replied.
local textbutton = script.Parent.TextButton
local part = workspace.alpha[“flag capture”].Part
part.Touched:Connect(function()
textbutton.BackgroundColor = part.BrickColor
end)
Gah, use code tags people. It takes one click on this button </> and then paste. Not giving anything to this post unless you do this.
sorry im new here was wandering how people did that. thanks for teaching me. the code works too even if u copy and paste what i wrote with the huge gaps in between each line. I tested it.
Ye I know, but we can instantly see the code if you do. The stuff you posted looks like text not code, makes it really hard to see logic, indentation etc… If you want serious answers press the button, it’s all it takes, and will get you more involvement.
Like this:
local textbutton = script.Parent.TextButton
local part = workspace.alpha[“flag capture”].Part
part.Touched:Connect(function()
textbutton.BackgroundColor = part.BrickColor
end)