Ive lately been trying to make a game but i got stuck on detecting the int value when it reached a number.
if you know how, please tell it on the reply section
Ive lately been trying to make a game but i got stuck on detecting the int value when it reached a number.
if you know how, please tell it on the reply section
if IntValue.Value == 5 then
-- Stuff here
end
local number = 20
if (number <= 68) then
print('that\'s not a funny number')
end
do this
IntValue.Changed:Connect(function()
-- put your code here
end)
local YourValue = script.Parent
local Goal = 50
YourValue:GetPropertyChangedSignal("Value"):Connect(function()
if YourValue.Value >= Goal then
print("Goal reached")
end
end)
Or more simply you can just use the .Changed event so like this:
local YourValue = script.Parent
local Goal = 50
YourValue.Changed:Connect(function()
if YourValue.Value >= Goal then
print("Goal reached")
end
end)
yea but Changed will run if the instance changes at all
GetPropertyChangedSignal("Value")
will run when ever the value changes which means it runs less then Changed
True. But I dont think he’ll really be changing the instance itself
With Values, the Changed event only fires when the value changes
no it will also fire if the name gets changed, it isn’t just the value property
you can also change the property Archivable
It’s a special rule with Values
He’s correct, values have a special Changed event that even provides you with the new value rather than the property name like the usual changed event does.
oh well I guess you learn something new every day
my bad guys
lol me too I didn’t know either of those lol
I believe you can do typeof(value) == “number”
Yes but he is trying to find if the number is == to a certain other number not if it’s a number
Ah, so he wants to see if 1 == 1 or something like that?
Yes, exactly.
extra chars
This has so many replies just none from the creator and no solution…