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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 05 Sep 2011 |
| Total Posts: 68 |
|
|
| 21 Nov 2017 12:05 PM |
| Thanks Kiriot22 it worked out perfectly. :) |
|
|
| Report Abuse |
|
|