Instant property changes

Here is my script.

local DeletePart = script.Parent.Parent.Delete
local Green = script.Parent.Parent.Signals.Green
local Red = script.Parent.Parent.Signals.Red
local Signal1 = script.Parent.Parent.Signal1
local Signal2 = script.Parent.Parent.Signal2
local Manual = game.ServerStorage.Values.Manual1
local SignallerMenu = game.StarterGui.SignallerMenu
local GreenSignallerMenu = SignallerMenu.Frame.Green1
local RedSignallerMenu = SignallerMenu.Frame.Red1

function onTouched(part)
	print("Касание красного маркера (Signal1)")
	if Manual.Value == false then
		print("Не в ручном управлении (Signal1)")
		print(part.Name)
		if part.Name == "SignalPart" then
			print("Красный включен (Signal1)")
			Red.BrickColor = BrickColor.Red()
			Green.BrickColor = BrickColor.new("Black")
			Signal1.Value = BrickColor.new("Really red")
			Signal2.Value = BrickColor.new("Black")
			DeletePart.Script.Enabled = true
			GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
			RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)
		end
	end
end

script.Parent.Touched:connect(onTouched)

I want to make these two script lines change color instantly. Can anyone tell me how to do this?

GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)

Does it not change the color instantly? what does it do instead?

1 Like

The color changes only after death. This happens because the contents of StarterGui are cloned.

You need to figure out which player touched the part and change their gui

function onTouched(part)
    local player = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
    if player then
        player.PlayerGui.SignallerMenu.Frame.Green1.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
        -- etc ...

Oh i just realized it says StarterGUI in there, you can’t change UI on a player’s screen through there you need to do it on a local script by getting the player’s gui, by doing game.Players.LocalPlayer.PlayerGui