How do i make this constantly Update?

Hello, i have a cold and hot temperature system but i want it where once the Value turns false the sprint Begins, if the value turns true it Ends, it only uses the value that first happens and if it changes it doesnt change, how do i make it updated?

if game.Players.LocalPlayer.PlayerGui.Uis.ColdOrHot.HotValue.Value == false then
	sprint("Began")
end

if game.Players.LocalPlayer.PlayerGui.Uis.ColdOrHot.HotValue.Value == true then
	sprint("Ended")
end
1 Like

Use instance:GetPropertyChangedSignal()
https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal

You need to use some sort of event handler with a function. I think for the context of your system, you should implement the .Changed event for the HotValue instance. For example:

local hotValue = game.Players.LocalPlayer.PlayerGui.Uis.ColdOrHot.HotValue

local function Update()
	if hotValue.Value == false then
		sprint("Began")
	else
		sprint("Ended")
	end
end

hotValue.Changed:Connect(Update)

EDIT: You can use both Changed and GetPropertyChangedSignal():
changed - Instance | Roblox Creator Documentation
GetPropertyChangedSignal - Instance | Roblox Creator Documentation