I made a simple demo of the problem that I am facing right here.
local function yield()
wait(5)
print("Done")
end
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
yield()
end
end)
for i = 10, 0, -1 do
print(i)
wait(1)
end
When a character touches the part, I want it to run the yield() function but it waits throughout the whole script and not just through the connection. When I test this out, it keeps running without yielding which is not what I am going for.
Put it simple, I want to yield the entire script from the connected function.
