Frame changes only after death

I made this script, but the color of the Frame changes only after death, is it possible to make it change immediately? Sorry if I don’t speak well, I’m using a translator.

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)")
		if part.Name == "SignalPart" then
			print("Красный включен (Signal1)")
			Red.BrickColor = BrickColor.Red()
			Green.BrickColor ="Black")
			Signal1.Value ="Really red")
			Signal2.Value ="Black")
			DeletePart.Script.Enabled = true
			GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
			RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)

1 Like

Sorry I don’t think I fully understand what your asking? How come it changes when the user dies when the code has nothing to do with death but rather a touch?

These two lines change the color of the Frame, but the color changes only after death. Sorry if I don’t explain well, I repeat, I’m using a translator :frowning:

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

I understand that them lines are the ones that change the colour but what part of the code is causing the death? Or is it just running after they get killed.

I assume somewhere in a different script it’s killing them and because of this it is causing the death to occur before the user touches or however your code stuff is set up. What you really want is to wait untill it changes and then kill them with a remote function or somthing,

You misunderstood :), This color changes only after Reset.

maybe thats because you’re using the StarterGui which essentially is a template that clones the contents to the player’s gui when they respawn/load, try using remote events or the Player.PlayerGui instance

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.