Hello, I am getting an error when I try to use coroutines. I’m not really sure what the problem with my code is.
The error:
Players.MegabyteOfficial.PlayerGui.NotificationFrame.LocalScript:78: missing argument #1 to 'create' (function expected)
The code:
function CreateToolTip(TopText, BottomText)
if TopText ~= nil then
print("This client is now creating a notification with TopText: " .. TopText .. " | BottomText: " .. BottomText)
ShowContents()
Frame.Size = UDim2.new(0.25, 0, 0.09, 0)
Frame.Visible = true
TopTextLabel.Text = TopText
BottomTextLabel.Text = BottomText
if TopText == "Bag secured" and script.Parent.Objective.Playing == false then
script.Parent.Objective:Play()
end
Frame.Position = UDim2.new(0.5, 0, -0.125, -32)
local tween1 = Frame:TweenPosition(
UDim2.new(0.5, 0, 0.25, -32),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Quad,
0.75,
true
)
task.wait(4)
Frame.Visible = false
task.wait(0.1)
Frame.Visible = true
task.wait(0.1)
Frame.Visible = false
task.wait(0.1)
Frame.Visible = true
task.wait(0.1)
Frame.Visible = false
task.wait(0.1)
Frame.Visible = true
task.wait(0.1)
HideContents()
local tween2 = Frame:TweenSize(
UDim2.new(0, 0, 0.09, 0),
Enum.EasingDirection.InOut,
Enum.EasingStyle.Quad,
0.75,
true
)
task.wait(0.75)
Frame.Visible = false
end
end
local coro = nil
function ToolTipHandler(TopText, BottomText)
if coro ~= nil then
coroutine.close(coro)
end
coro = coroutine.create(CreateToolTip(TopText, BottomText))
coroutine.resume(coro)
end
Any help would be much appreciated!