You guys can discuss this but my thoughts are to use whatever is given by roblox because it’s safe and there are ways of preventing memory leaks.
Here 'ya go.
Kinda messy.
Honestly dude I think you should just use :WaitForChild()
This’ll probably be the best solution, I guess I was too stubborn, but there’s no way I’m using this.
local RunService = game:GetService("RunService")
local wait = function(waitTime)
local startTime = tick()
repeat RunService.Heartbeat:Wait() until startTime+waitTime < tick()
return tick()-startTime, elapsedTime()
end
Way too extra.
Did I do it right? It’s still error’ing.
I put :WaitForChild()
before the touched function.
I have two orbs by the way.
Personally, I would do.
weld.Part1 = orbl:WaitForChild("Core")
weld.Parent = orbl:WaitForChild("Core")
that can probably be simplified.
Can you show us where Core
is located? Like show us how it looks like in the explorer.
This is what it looks like, nothing out of the ordinary.
I think I might’ve figured out the problem though. It could’ve been because I didn’t disconnect the event, but I guess I still learned to use :WaitForChild()
.
Hmm. You should make sure that there isn’t a space before, or after Core
's name.
For anyone reading, the problem is: he is somehow not able to find the member or child Core
of orb1
yet he connected a Touched
event to Core
of orb1
successfully.
Thus, the problem could be that orb1.Core
is somehow disappearing after the event is connected as the event connects first.
@xKaihatsu Try making a variable for orb1.Core
as doing orb1.Core
manually will attempt to find Core
from orb1
instead of just looking for the same Core
that was used in the Touched event when it worked correctly.
local core = orb1.Core -- then use core instead of orb1.Core
Otherwise, Core
is just disappearing after the Touched event connection if it still doesn’t work. Print out orb1.Core ~= nil
in the beginning of the script and it would be true
if it was a valid member before the event connection.
Dude, Roblox automatically removes any whitespaces behind it, and this,
I think I figured out my problem though, so I’m good.
I don’t think you understand what I’m saying . What I’m saying is make sure that the name of Core
in the explorer shouldn’t have a space before or after it.
I had a similar issue like this one, and it was because there was a space after the object’s name in the explorer. Roblox does remove whitespace in scripts, but what I’m saying is you should make sure there aren’t any spaces in the name of the object in the explorer you are trying to reference.
There would be no whitespace, it’d be removed automatically.
It wouldn’t be removed from the object’s name in the explorer.
Do you not understand me? I could add all the whitespace I could to “Core”, like this, "Core ", and it’d be removed automatically…
How did you not understand this 2 replies ago?
EDIT: Seems like my whitespace example was edited to no whitespace, but I think you understand by now.
I have noticed that you are not using the debounce technique. If this is run more than once, Core could have been destroyed in the first run (orb1:Destroy()).
If you figured out the problem share and mark the solution so that this topic can help future users with the same issue