--This file holds a bunch of common functions that happen in items. They're seperated out here so that they're easy to change if there's a bug somewhere. --[[ Provides: startProcessGeneric(player_player, string_message, number_time, function_ondone(player_player)) Freezes the player, creates the loading bar, and calls ondone when the timer is up. ]] function startProcessGeneric(player, string, time, ondone) if (player.InProcess) then player:SendMessage("You can't do that much at once!", 3, Color(255, 255, 255, 255)) return end player.InProcess = true player:Freeze(true) player:MakeProcessBar( string, time, false ) timer.Create( "process", time, 1, function() player:Freeze(false) player.InProcess = false player:StopProcessBar() ondone(player) end) end