Hey! I have never used coroutine before. Basically, when the player collects it it disappears for 40 seconds. Since there could be multiple being used, and it is a ModuleScript, I believe that a coroutine would be needed here. What would the best way to use it be?
Thanks for the help!
Code
local R_Functions = {}
function R_Functions.Function1_ScrapCollect(scrap, player, points)
scrap.Collectable.Value = false
scrap.CanCollide = false
scrap.Transparency = 1
player.leaderstats.Points += script.Parent.PointsValue.Value
player.PlayerGui.PointsGui.PointsGained.Text = "Gained "..script.Parent.PointsValue.Value.." Points!"
player.PlayerGui.PointsGui.PointsGained.Visible = true
task.wait(2)
player.PlayerGui.PointsGui.PointsGained.Text = "Gained (Points)"
player.PlayerGui.PointsGui.PointsGained.Visible = false
task.wait(38)
scrap.Collectable.Value = true
scrap.CanCollide = true
scrap.Transparency = 0
end
return R_Functions