I keep getting an error no matter how many ways I try and define lives. Any ideas why this keeps happening?
while _G.Lives == nil do wait() end lives = _G.Lives lives.Changed:connect(function(NewValue) if _G.Lives <= 2 then textBox.Text = "test" end end)
lives
is not an object, it’s a number. Variables don’t have changed events. Make lives
an IntValue
or NumberValue
and it should work.local lives = Instance.new"IntValue" lives.Name = "Lives" lives.Parent = game.Workspace -- put wherever lives.Changed:Connect(function(newVal) if newVal <= 2 then textBox.Text = "test" end end)
Connect
, as ROBLOX may remove connect
in the future.Looks like it thinks lives is a number value such as 10 or 20, not a NumberValue as in the object you can use the .Changed event on.