generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: How to check if a Value Parented to something has changed?

Previous Thread :: Next Thread 
rickje139 is not online. rickje139
Joined: 05 Sep 2011
Total Posts: 68
21 Nov 2017 11:28 AM
Title says it ^^ A Script has to update something whenever a Value has Changed.


Please let me know if you know anything.
Report Abuse
Kiriot22 is not online. Kiriot22
Joined: 19 Jul 2015
Total Posts: 226
21 Nov 2017 11:35 AM
workspace.StringValue.Changed:connect(function(prop)
if prop == "Value" then
print("New value: " .. workspace.StringValue.Value)
end
end)


Report Abuse
rickje139 is not online. rickje139
Joined: 05 Sep 2011
Total Posts: 68
21 Nov 2017 11:39 AM
I meant if theres a Model with inside a lot of Values and if one of them changed it activates the Function.
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
21 Nov 2017 11:54 AM
local watchedModel = game.Workspace.Model function changed(valueObject) print(valueObject.Name, valueObject.Value) end for _, instance in pairs(watchedModel:GetChildren()) do -- note: the line below was being filtered change it to -- ################################################################### if instance.ClashName:match("Value") then instance.Changed:Connect(function() changed(instance) end) end end
Report Abuse
WillieTehWierdo200 is not online. WillieTehWierdo200
Joined: 13 Aug 2008
Total Posts: 1147
21 Nov 2017 11:56 AM
local watchedModel = game.Workspace.Model

function changed(valueObject)
print(valueObject.Name, valueObject.Value)
end

for _, instance in pairs(watchedModel:GetChildren()) do
-- note: the line below was being filtered
-- replace the underscores with "ss"
if instance.Cla__Name:match("Value") then
instance.Changed:Connect(function()
changed(instance)
end)
end
end


Report Abuse
Kiriot22 is not online. Kiriot22
Joined: 19 Jul 2015
Total Posts: 226
21 Nov 2017 11:57 AM
function asd()
print("OMG I HAVE BEEN CALLED! THE WORLD IS ENDING!!!!!111one")
end

for i,v in pairs(model:GetChildren()) do
if v:IsA("StringValue") then
v:GetPropertyChangedSignal("Value"):Connect(asd)
end
end


Report Abuse
rickje139 is not online. rickje139
Joined: 05 Sep 2011
Total Posts: 68
21 Nov 2017 12:01 PM
I never heard of GetPropertyChangedSignal before but i'll give it a try.
Report Abuse
Kiriot22 is not online. Kiriot22
Joined: 19 Jul 2015
Total Posts: 226
21 Nov 2017 12:02 PM
http://wiki.roblox.com/index.php?title=API:Class/Instance/GetPropertyChangedSignal


Report Abuse
rickje139 is not online. rickje139
Joined: 05 Sep 2011
Total Posts: 68
21 Nov 2017 12:05 PM
Thanks Kiriot22 it worked out perfectly. :)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image