Hi! I’m really sorry if this has already been answered before. I looked but couldn’t find anything on this topic.
As the title suggests, “wait()” doesn’t work in functions… I think it’s functions they don’t work in, at least. I’ve run into issues that require the use of wait(), but never known how to use it since the script basically just ignores it if it’s inside of a function.
Here’s an example:
part.Touched:Connect(function(hit)
local humanoid = hit.Parent:FindFirstChild(“Humanoid”)
if humanoid ~= nil then
part.Orientation = Vector3.new(0, -15, 0)
part.Position = Vector3.new(-36.625, 4.125, -9)
wait(1) <----- That wait is always ignored
end
end)
Also, I know this is probably a stupid problem and the answer is really obvious, so sorry about that.
So far I’ve tried putting the wait() everywhere within the function, but to no avail. I’ve also looked in the forums as stated previously, once again to no avail. All I want to know is how you can use a wait() AFTER doing whatever action you want done. In this example that would be changing the orientation and position.
Thanks for any help, guys!