How can I make it so my script is able to detect a change in config.approaching

hi I have a configuration where a different script can change it to true/false but how can I make it so when it changes while the game is started so it updates live every few seconds?

script:

local board = script.Parent.Board
local config = script.Parent.Parent.Configuration



function default()
	board.defaultscreen.Enabled = true
	wait(5)
	board.defaultscreen.Enabled = false
end

function arriving()
	board.arriving.Enabled = true
	wait(5)
	board.arriving.Enabled = false
end

function message1()
	board.DEST.eta.Text = "test1"
	board.DEST.Enabled = true
	wait(5)
	board.DEST.Enabled = false
end

function message2()
	board.DEST.eta.Text = "test2"
	board.DEST.Enabled = true
	wait(5)
	board.DEST.Enabled = false
end





while true do
	if config.approaching == true then
		arriving()
	else
		message1()
		wait(.5)
		default()
		wait(.5)
		message2()
		wait(.5)
		default()
		wait(.5)
		message1()
		wait(.5)
		default()
		wait(.5)
		message2()
		wait(.5)
		default()
	end
end

is config a value instance? if so you can use the .Changed event.
if it’s a variable or table value u can use metamethods.

1 Like

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