#How to declare a variable that is moving between folders?

1 messages · Page 1 of 1 (latest)

daring robin
#

i dont really know what to really name this thrread, but i will give a more in-depth explanation here.

i have a Model named THE_BOILED_ONE that is in the ReplicatedStorage, and inside of StarterGUI i have his Jumpscare GUI.
I made it so that when Lighting.ClockTime >= 23 THE_BOILED_ONE is cloned from ReplicatedStorage to Workspace.
Problem is, inside of the Jumpscare_GUI script, i said local THE_BOILED_ONE = game.Workspace:WaitForChild("THE_BOILED_ONE")
and since he is not in the workspace, the JUMPSCARE_GUI script doesn't seem to work and returns an error saying *infinite yield*.

How would i go about solving this problem?

arctic oracle
#

Or childadded

#

In workspace

hot geode
daring robin
daring robin
arctic oracle
#

Yeah child added best way

daring robin
#

I did something else and placed the script inside THE_BOILED_ONE instead of having it wait for him

#

BUT

#

noob question

#

how would i make it so that when LIGHTING.ClockTime >= 23 do something

#

i cant just say If (condition)

hot geode
#
local Lighting = game:GetService("Lighting")
local target_time: number = 23

Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
    if Lighting.ClockTime >= target_time then
        -- Do something
    end
end)
#

This will listen for every value change in ClockTime

#

Granted I'm unsure if it's an optimal way