Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()
- local svc = {
- RS = game:GetService("ReplicatedStorage"),
- RunService = game:GetService("RunService")
- }
- local cfg = {
- flowOn = false,
- flowNodeDelay = 0.04,
- flowLineDelay = 0.60
- }
- local Window = Rayfield:CreateWindow({
- Name = "Or4ng3_Fru1t's scripts",
- Icon = 0,
- LoadingTitle = "Or4ng3_Fru1t SCRIPTS",
- LoadingSubtitle = "By Or4ng3_Fru1t",
- Theme = "AmberGlow",
- DisableRayfieldPrompts = false,
- ConfigurationSaving = {
- Enabled = true,
- FolderName = "Or4ng3_Fru1T_Config",
- FileName = "Or4ng3_Fru1T HUB"
- },
- KeySystem = true,
- KeySettings = {
- Title = "Or4ng3 | Key System",
- Subtitle = "Forsaken Access",
- Note = "Join Discord For Key",
- FileName = "Or4ng3_Saken_Key",
- SaveKey = true,
- GrabKeyFromSite = false,
- Key = {"ORANGEN"},
- Actions = {
- [1] = {
- Name = "Copy Discord",
- Callback = function()
- setclipboard("https://discord.gg/your_orange_link")
- end
- }
- }
- }
- })
- local function flowKey(n) return n.row.."-"..n.col end
- local function flowDirFlip(d)
- return ({up="down",down="up",left="right",right="left"})[d]
- end
- local function flowDir(r1,c1,r2,c2)
- if r2<r1 then return"up" elseif r2>r1 then return"down" elseif c2<c1 then return"left" elseif c2>c1 then return"right" end
- end
- local function flowNeighbour(r1,c1,r2,c2)
- if r2==r1-1 and c2==c1 then return"up" end
- if r2==r1+1 and c2==c1 then return"down" end
- if r2==r1 and c2==c1-1 then return"left" end
- if r2==r1 and c2==c1+1 then return"right" end
- return false
- end
- local function flowConnections(prev,curr,nxt)
- local t={}
- if prev and curr then
- local d=flowDir(curr.row,curr.col,prev.row,prev.col)
- if d then t[flowDirFlip(d)]=true end
- end
- if nxt and curr then
- local d=flowDir(curr.row,curr.col,nxt.row,nxt.col)
- if d then t[d]=true end
- end
- return t
- end
- local function flowOrder(path,endpoints)
- if not path or #path==0 then return path end
- local lookup={}
- for _,n in ipairs(path) do lookup[flowKey(n)]=n end
- local start
- for _,ep in ipairs(endpoints or{}) do
- for _,n in ipairs(path) do
- if n.row==ep.row and n.col==ep.col then start={row=ep.row,col=ep.col};break end
- end
- if start then break end
- end
- if not start then
- for _,n in ipairs(path) do
- local nb=0
- for _,d in ipairs({{-1,0},{1,0},{0,-1},{0,1}}) do
- if lookup[(n.row+d[1]).."-"..(n.col+d[2])] then nb+=1 end
- end
- if nb==1 then start={row=n.row,col=n.col};break end
- end
- end
- if not start then start={row=path[1].row,col=path[1].col} end
- local pool={}
- local ordered={}
- for _,n in ipairs(path) do pool[flowKey(n)]={row=n.row,col=n.col} end
- local cur=start
- table.insert(ordered,{row=cur.row,col=cur.col})
- pool[flowKey(cur)]=nil
- while next(pool) do
- local moved=false
- for k,node in pairs(pool) do
- if flowNeighbour(cur.row,cur.col,node.row,node.col) then
- table.insert(ordered,{row=node.row,col=node.col})
- pool[k]=nil
- cur=node
- moved=true
- break
- end
- end
- if not moved then break end
- end
- return ordered
- end
- local function flowSolve(puzzle)
- if not puzzle or not puzzle.Solution then return end
- local indices={}
- for i=1,#puzzle.Solution do indices[i]=i end
- for i=#indices,2,-1 do
- local j=math.random(1,i)
- indices[i],indices[j]=indices[j],indices[i]
- end
- for _,ci in ipairs(indices) do
- local ordered=flowOrder(puzzle.Solution[ci],puzzle.targetPairs[ci])
- puzzle.paths[ci]={}
- for i,node in ipairs(ordered) do
- table.insert(puzzle.paths[ci],{row=node.row,col=node.col})
- puzzle.gridConnections=puzzle.gridConnections or{}
- puzzle.gridConnections[flowKey(node)]=flowConnections(ordered[i-1],node,ordered[i+1])
- puzzle:updateGui()
- task.wait(cfg.flowNodeDelay)
- end
- task.wait(cfg.flowLineDelay)
- puzzle:checkForWin()
- end
- end
- task.spawn(function()
- local mod = svc.RS:FindFirstChild("Modules") and svc.RS.Modules:FindFirstChild("Misc") and svc.RS.Modules.Misc:FindFirstChild("FlowGameManager") and svc.RS.Modules.Misc.FlowGameManager:FindFirstChild("FlowGame")
- if mod then
- local FG=require(mod)
- local orig=FG.new
- FG.new=function(...)
- local p=orig(...)
- if cfg.flowOn then
- task.spawn(function() task.wait(0.3); flowSolve(p) end)
- end
- return p
- end
- end
- end)
- local Tab = Window:CreateTab("Generator", 4483362458)
- Tab:CreateSection("Auto Solve")
- Tab:CreateToggle({
- Name = "Auto Solve Enabled",
- CurrentValue = cfg.flowOn,
- Flag = "FlowToggle",
- Callback = function(Value)
- cfg.flowOn = Value
- end,
- })
- Tab:CreateSlider({
- Name = "Node Speed",
- Range = {0.01, 0.50},
- Increment = 0.01,
- Suffix = "s",
- CurrentValue = cfg.flowNodeDelay,
- Flag = "NodeSlider",
- Callback = function(Value)
- cfg.flowNodeDelay = Value
- end,
- })
- Tab:CreateSlider({
- Name = "Line Pause",
- Range = {0, 1},
- Increment = 0.1,
- Suffix = "s",
- CurrentValue = cfg.flowLineDelay,
- Flag = "LineSlider",
- Callback = function(Value)
- cfg.flowLineDelay = Value
- end,
- })
Advertisement
Add Comment
Please, Sign In to add comment