I absolutely hate using Instance:WaitForChild()
though, I don’t like spamming it, and second the Touched event ran but the weld creation didn’t, so it isn’t a loading issue.
Give it a shot to see if it works however as I have experienced this error before and it was fixed with that.
Don’t shoot down a legitimate solution by stating you “hate” it.
WaitForChild may be your only solution here or it could be a typo/hierarchy dispute since you didn’t include a screenshot of your explorer.
if he doesnt want to use waitforchild then he can simply put
repeat wait() until orb1:FindFirstChild("Core")
I just don’t like using it, doesn’t mean I won’t try it.
I don’t use repeat wait()
loops because it’s bad practice to use them, it’s basically the same thing as Instance:WaitForChild()
.
Read this post by @Kampfkarren and you’ll probably never want to use wait()
again.
I’m talking about wait()
by the way, not wait(n)
.
I don’t mind the inaccuracies.
It’s better than using delay(function() as a wait, in fact that itself is far worse.
Also, wait is pretty useful when used properly.
I’d rather use wait than doing this:
local t = tick()
while true do
if tick()-t > 5 then
print("reached")
break
end
end
I don’t mind it at all.
If you are not open to using certain functions, then the things you can do will be extremely limited.
You will get a really high memory loss, I don’t recommend doing that, just use the roblox functions, that’s why they are there.
Precisely why I use wait()…
You didn’t get what I meant, I meant that it’s better to use the “WaitForChild()” function as it is already developed by roblox and it doesn’t have memory loss.
I am open to most of the functions/events of Roblox, it’s just this one function that I just don’t like using. I still use it when I absolutely have to though.
There isn’t really anything wrong with that function… It exists so you could wait for an object to load, rather than setting a specific wait time such as wait(n).
xKai said " I don’t use repeat wait()
loops because it’s bad practice to use them, it’s basically the same thing as Instance:WaitForChild()
."
So basically either both have memory loss or either have none.
There are times when I have to use WaitForChild and wait… also wait is developed by roblox…
Can you show us a screenshot of how the model looks like in the explorer? I think I know the issue.
When you use :Wait()
, the code passes the statement as soon as the function is ready, when you use repeat wait()
you wait even if that certain condition is met, that’s why I don’t use repeat wait()
loops anymore, because there is usually a :Wait()
event that can do the same thing, just better.
You shouldn’t script something inefficient knowing there’s a better way to do it, it just doesn’t make sense.
I know, but the
repeat until
loop is the part of the memory loss
If that’s a concern to you why not just rewrite the wait() function so that it’s reliant on tick
and Heartbeat
?
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
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.