Text will not update

Hi,
I have a GUI in my game that tells players what zone and floor they’re on (It’s a roguelike) but I can’t get it to work.
I tried using GetPropertyChangedSignal but I got an error:

11:48:27.355
Players.Foxxive.PlayerGui.MainGui.RunStats.RunStats:8: 
attempt to index number with 'GetPropertyChangedSignal' 

And I tried using RenderStepped to try to update the text every frame but that didn’t work either.

This is my current code:

local replicatedStorage = game:GetService("ReplicatedStorage")
local runStats = replicatedStorage.RoundSystem
local floorStat = runStats.Floor.Value

local floorText = script.Parent.Floor
local zoneText = script.Parent.Zone

floorStat:GetPropertyChangedSignal("Value"):Connect(function()
	floorText.Text = "floor " .. floorStat .. ""
	if floorStat <=5 then
		zoneText.Text = "Surface"
	elseif floorStat >=6 and floorStat < 11 then... --Cutting it off here because it's basically the same thing repeating

would appreciate any help, thanks in advance

Make floorStat refer to the instance instead of the value of the instance. If you want to use the actual value in another part of this script, use floorStat.Value to get the value at that moment.

Also, you don’t need to get the property changed signal for ValueObjects, the Changed event will only fire when the value changes which seems like what you’re trying to accomplish.

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