Quick question: Why does this only work for the first resume, I performed? I know I have to use coroutine.yield() but I don’t where I would use it. I’m sure it’s the while wait() loop that will restrict me from using yield()
local Interaction = coroutine.create(function(Frame, KeyText, ActionText, Action, Key, TaggedParts)
while wait() do
Frame.Visible = false
for _,item in pairs(TaggedParts) do
if (item.PrimaryPart.Position - humanoid.Position).magnitude <= 6 and mouse.Target == item.PrimaryPart then
Frame.Visible = true
ActionText.Text = Action
KeyText.Text = Key
break
end
end
end
end)
coroutine.resume(Interaction, AboveHoverFrame, AboveKey, AboveAction, "Open", "E", Doors)
coroutine.resume(Interaction, BelowHoverFrame, BelowKey, BelowAction, "Dispose", "LMB", Disposables)
It perfectly shows the GUI, for the Doors. But the disposables isn’t working.