Problem
I'm 90% sure this is a bug and even filed a bug report. But in the case that I missed something crucial here's what I'm having trouble on.You can clone a script via :Clone()
and it’ll create a facsimile of itself and run the code inside of it.
If you clone a script with this code print("Hello world!")
it’ll print out Hello world!
.
But if a script with this code is cloned workspace.Value.Changed:Connect(function() print("A") end)
, assuming you have a IntValue Named Value
inside workspace and you changed it’s Value (either via command, or Inspector), nothing will print out.
Same goes for if you binded a function to a BindableEvent and pass an Object Pointer towards the IntValue and execute the same code.
I’ve already tried using :GetAttributeChangedSignal()
with and had no luck.
Code (Cloning)
The cloning problem is why I filed the bug report and I intend to add the Bindable Event to it later.I already have made a place file where this occurs here. Bug.rbxl (18.1 KB)
Code (BindableEvent)
For reasons I can’t share the whole script but here’s the file structure and watered down versions of scripts I’m using.
- workspace
-
- Folder
-
-
- Folder
-
-
-
-
- Script2
-
-
-
-
- Script1
-
-
-
- BindableEvent
-
-
- Value (IntValue)
- Value (IntValue)
Script1
Event = script.Parent.Event
function FireEvent()
Event:Fire({Object = workspace.Value})
end
FireEvent()
Script2
Event = script.Parent.Parent.Event
function Main(Data)
print("started")
local Object = Data.Object
if not Object then error("Invalid Format.") end
Object.Changed:Connect(function()
print("Changed")
end)
end
Event.Event:Connect(function(Data) Main(Data) end)
Afterwards I tired to change Script 1 like so
Script1 Changed
function Main()
workspace.Value.Changed:Connect(function()
print("Changed")
end)
end
Main()
But it still doesn’t work. Which is weird to me because running the same exact code in the command console ingame works, and prints out Changed
whenever the value is changed.
This leads me to believe that either .Changed
is now deprecated and I didn’t hear about it or I’m missing some crucial thing that makes it not functional.
Summary
Please let me know if it works for you or not or if I made an error with the way I wrote .Changed
. I double checked to make sure that there wasn’t any syntax errors. There was nothing printed out to the console at all. Like before I’m highly sure that this is a bug but I wanted a second view on things.