Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

event Changed(Property property) - How To

Hi guys; I have a script that I want to be fired when a numbervalue changes from 0 to 1 however I cannot find any good tuts on how to use the Changed event. The value is kept in an another group called values from the script.

Script > Values > Value 1 (This has the number value)

Thanks for your time guys. Goldenggamper

Edit --- I'm hoping that one of you guys might be able to lead me into the right direction on how to use the Changed event. How do you tell it what value it should be looking at for it to trigger the event, etc.

1 comment

0

I'm not sure what you're asking. Could you clarify?

3 answers

✓ Accepted answer

To use the change event, you should use it on a part/value, I will use an IntValue as an example:

game.Workspace.IntValue.Changed:connect(function()
	-- do stuff
end)

The above function will run every time a property of the object has been modified. Hope I helped.

Ah, so you want to learn about the Changed event.

What it does is fire every time any of an object's properties changes, and supplies an Property argument, which is a string name of the property that changed (such as "BrickColor" or "Transparency").

To make it watch a specific property, just add an if statement for the property.

SomeObject.Changed:connect(function(Property)
	if Property == "Transparency" then
		print("Transparency changed!")
	end
end)

That would pring Transparency changed! every time SomeObject's Transparency property changed.

1 comment

0

Is there a way to check the value of said property as well? Such as if I want the script to do one thing when Property is "Transparency" and true, but something else when Property is "Transparency" and false?

Thanks to 18cwatford and Owenrules12 for their previous help :)

This discussion is preserved as it was. New answers, comments, and votes are closed.