WIP: Make Script schedule itself to run when parented to a DataModel#93
WIP: Make Script schedule itself to run when parented to a DataModel#93
Conversation
lib/instances/Script.lua
Outdated
| local game = nil | ||
|
|
||
| local now = instance | ||
| while now do |
There was a problem hiding this comment.
What's the point of this whole loop? If you really can't just use the game global, changing this to now:FindFirstAncestorWhichIsA("DataModel") would make this more readable.
There was a problem hiding this comment.
Right, there is no game global here, since we have no environment.
I forgot that FindFirstAncestorWhichIsA was a function we have, that's the way to go. I'll remove the existing ScreenGui checks and replace them with that too.
There was a problem hiding this comment.
On second thought, FindFirstAncestorWhichIsA isn't actually implemented on lemur. Wouldn't be hard though.
|
Make sure it doesn't run when it shouldn't, by the way (I think only in ReplicatedStorage?). I have plenty of scripts in ReplicatedStorage for placeholder reasons that don't run. Edit: ServerStorage too. |
This PR takes advantage of the new task scheduler to cause
Script(and nowLocalScript) objects to schedule themselves to execute when parented to aDataModel.This logic is right now sort of shaky. I'm not confident that it's correct right now.
Things to do before merge:
FindFirstAncestorWhichIsA