a small thing i made for a failed plugin
you need your own copy of vide, which is NOT provided
makes a new Router.
local RouterClass = require(path.to.module)
local Router = RouterClass.new()makes the Router usable. this should be called once! if you want to add more routes, you can insert them into the Router.routes table. you can also edit the length of the tween (which is set to 0 by default) by editing the Router.tweenLength value.
vide is your Vide module.
target is where the router screengui should be made (this is usually the player's playergui, although it can also be placed under another guiobject.)
routes is a table of routes.
local Vide = path.to.vide
local Player = path.to.player
local Routes = {
["/"] = function()
local Frame = Instance.new("Frame")
Frame.Size = UDim2.fromScale(1, 1)
Frame.Parent = Router.ui
return Frame
end
}
Router:init(Vide, Player.PlayerGui, Routes)
Router:render()sets the current page.
you must init the Router first!
local Router = path.to.router
Router:push(Routes["/page"])goes back a page.
you must init the Router first!
local Router = path.to.router
Router:back()returns the current page.
you must init the Router first!
local Router = path.to.router
print(Router:getCurrent())renders the current page.
you must init the Router first!
local Router = path.to.router
Router:render()