--[=[
██╗ ██╗ ██╗███╗ ██╗ █████╗ ██████╗ ███████╗██╗ ██╗
██║ ██║ ██║████╗ ██║██╔══██╗ ██╔══██╗██╔════╝██║ ██║
██║ ██║ ██║██╔██╗ ██║███████║ ██║ ██║█████╗ ██║ ██║
██║ ██║ ██║██║╚██╗██║██╔══██║ ██║ ██║██╔══╝ ╚██╗ ██╔╝
███████╗╚██████╔╝██║ ╚████║██║ ██║ ██████╔╝███████╗ ╚████╔╝
╚══════╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝ ╚═══╝
L U N A . D E V
OPEN SOURCE PROJECT
---------------------------------------------------------------
PROJECT : Forecast
RELEASE TYPE : READABLE / UNOBFUSCATED SOURCE
MAINTAINER : Luna.dev
ATTRIBUTION : Luna.dev
LICENSE : Luna.dev Open Scripts License (see lunadev.fixseroalt.workers.dev/license)
Free to use, copy and modify, with a short credit to the names
listed above somewhere in your copy. Using fewer than three of
these scripts inside your own, mostly original project also
lets you sell or monetize it. Using three or more, or building
something mainly made of Luna.dev's own scripts, is non-commercial
only, with no reselling and no competing script hub. Provided
as is, no warranty. Full terms on the license page.
---------------------------------------------------------------
LUNA.DEV (c) 2026
MADE TO BE EXPLORED
]=]
local started, problem = xpcall(function()
if game.PlaceId ~= 189707 then
warn('[luna.dev] this script is for natural disaster survival (189707).')
return
end
local env = getgenv and getgenv() or _G
for _, key in ipairs({ 'luna_forecast_unload', 'luna_nds_unload' }) do
if env[key] then
pcall(env[key])
end
end
local players = game:GetService('Players')
local replicatedstorage = game:GetService('ReplicatedStorage')
local runservice = game:GetService('RunService')
local userinputservice = game:GetService('UserInputService')
local lighting = game:GetService('Lighting')
local httpservice = game:GetService('HttpService')
local collectionservice = game:GetService('CollectionService')
local virtualuser = game:GetService('VirtualUser')
local localplayer = players.LocalPlayer
local playergui = localplayer:WaitForChild('PlayerGui')
local remotes = replicatedstorage:WaitForChild('Remotes', 15)
local replicators = replicatedstorage:WaitForChild('State Replicators', 15)
local contentmodel = workspace:WaitForChild('ContentModel', 15)
if not (remotes and replicators and contentmodel) then
warn('[luna.dev] the game layout has changed, stopping.')
return
end
local savepath = 'LunaDev/forecast.json'
local oldsavepath = 'LunaDev/natural_disaster_survival.json'
local reconpath = 'LunaDev/forecast_log.json'
local tint = { 81, 120, 101, 114, 116, 118, 100, 99, 55, 117, 110, 55, 91, 98, 121, 118, 57, 115, 114, 97 }
local function shade(list)
local out = {}
for index, value in ipairs(list) do
out[index] = string.char(bit32.bxor(value, 23))
end
return table.concat(out)
end
local build = shade(tint)
local lobbyspot = { -265, 180, 281 }
local defaults = {
autosurvive = false,
bannerseconds = 10,
countdown = true,
keeplab = true,
nomusic = false,
mode = 'saved',
skyheight = 320,
movedelay = 30,
spot = lobbyspot,
looptp = false,
boardon = false,
boardwhich = 'top10',
boardfollow = true,
boarddistance = 12,
earlypopup = true,
playeresp = false,
glidespeed = 140,
softland = true,
maxfall = 45,
antifling = true,
waterwalk = true,
safetouch = false,
autoapple = true,
applehealth = 70,
hazardesp = true,
banner = true,
speedon = false,
speed = 30,
jumpon = false,
jump = 75,
infjump = false,
fly = false,
flyspeed = 70,
noclip = false,
fullbright = false,
nofog = false,
noflash = false,
antiafk = true,
recon = false,
}
local settings = table.clone(defaults)
local function loadsettings()
if not (isfile and readfile) then return end
local ok, data = pcall(function()
local path = isfile(savepath) and savepath or (isfile(oldsavepath) and oldsavepath)
return path and httpservice:JSONDecode(readfile(path))
end)
if not ok or type(data) ~= 'table' then return end
for key, value in pairs(data) do
if type(defaults[key]) == type(value) then
settings[key] = value
end
end
end
local function savesettings()
if not writefile then return end
pcall(function()
if makefolder and isfolder and not isfolder('LunaDev') then
makefolder('LunaDev')
end
writefile(savepath, httpservice:JSONEncode(settings))
end)
end
loadsettings()
settings.build = build
if #settings.spot ~= 3 or math.abs(settings.spot[1] + 251.008636) < 0.01 then
settings.spot = table.clone(lobbyspot)
end
local connections = {}
local lasterror
local function bind(signal, callback)
local connection = signal:Connect(function(...)
local ok, problem = pcall(callback, ...)
if not ok then
lasterror = tostring(problem)
warn('[luna.dev] forecast: ' .. lasterror)
end
end)
table.insert(connections, connection)
return connection
end
local disasters = {
{ key = 'tsunami', label = 'Tsunami', words = { 'tsunami', 'wave' }, place = 'sky' },
{ key = 'flood', label = 'Flash Flood', words = { 'flood' }, place = 'sky' },
{ key = 'volcano', label = 'Volcanic Eruption', words = { 'volcan', 'lava', 'erupt' }, place = 'sky' },
{ key = 'tornado', label = 'Tornado', words = { 'tornado' }, place = 'sky' },
{ key = 'sandstorm', label = 'Sandstorm', words = { 'sand' }, place = 'sky' },
{ key = 'earthquake', label = 'Earthquake', words = { 'earthquake', 'quake' }, place = 'sky' },
{ key = 'avalanche', label = 'Avalanche', words = { 'avalanche' }, place = 'sky' },
{ key = 'virus', label = 'Deadly Virus', words = { 'virus', 'infect' }, place = 'sky' },
{ key = 'fire', label = 'Fire', words = { 'fire' }, place = 'sky' },
{ key = 'meteor', label = 'Meteor Shower', words = { 'meteor' }, place = 'cover' },
{ key = 'thunder', label = 'Thunder Storm', words = { 'thunder', 'lightning' }, place = 'cover' },
{ key = 'acid', label = 'Acid Rain', words = { 'acid' }, place = 'cover' },
{ key = 'blizzard', label = 'Blizzard', words = { 'blizzard', 'snow' }, place = 'cover' },
}
local knownworkspace = {
Camera = true, NPCs = true, WeatherMachine = true, Spawns = true, BillboardTop10 = true,
Structure = true, Tower = true, Island = true, BillboardBalloon = true, BillboardAd = true,
BillboardApple = true, ContentModel = true, Sandboxes = true, WaterLevel = true,
WeatherDome = true, Terrain = true, ['Secret Lab'] = true, ['1P_Cred'] = true,
}
local moverclasses = {
BodyForce = true, BodyVelocity = true, BodyPosition = true, BodyGyro = true, BodyThrust = true,
BodyAngularVelocity = true, LinearVelocity = true, AngularVelocity = true, VectorForce = true,
Torque = true, AlignPosition = true, AlignOrientation = true, LineForce = true,
}
local state = {
active = {},
warnings = {},
lasthealth = nil,
lastapple = 0,
hold = nil,
holdkind = nil,
manualhold = false,
nextcompute = 0,
creds = 0,
survived = 0,
multi = 0,
hazards = {},
hazardlinks = {},
touched = {},
fog = {},
collide = {},
cover = nil,
covertime = 0,
light = nil,
seen = {},
staletags = {},
ownwarn = {},
earlyname = nil,
earlyclock = nil,
lead = nil,
started = os.clock(),
esp = {},
log = {},
logdirty = false,
history = {},
hiddenscreens = {},
muted = {},
soundseen = {},
historydirty = true,
}
local function now()
return os.clock()
end
local function record(kind, data)
if not settings.recon then return end
if #state.log >= 600 then
table.remove(state.log, 1)
end
data = data or {}
data.kind = kind
data.t = math.floor(workspace:GetServerTimeNow())
data.ms = math.floor((now() - state.started) * 1000)
table.insert(state.log, data)
state.logdirty = true
end
local function savelog()
if not writefile then return false end
return pcall(function()
if makefolder and isfolder and not isfolder('LunaDev') then
makefolder('LunaDev')
end
writefile(reconpath, httpservice:JSONEncode(state.log))
state.logdirty = false
end)
end
record('build', { text = build })
local function getparts()
local character = localplayer.Character
if not character then return nil end
local root = character:FindFirstChild('HumanoidRootPart')
local humanoid = character:FindFirstChildOfClass('Humanoid')
if not (root and humanoid and humanoid.Health > 0) then return nil end
return character, root, humanoid
end
local function vectorlist(vector)
return { math.floor(vector.X), math.floor(vector.Y), math.floor(vector.Z) }
end
local function positionof(instance)
if instance:IsA('BasePart') then return instance.Position end
if instance:IsA('Model') then return instance:GetPivot().Position end
local part = instance:FindFirstChildWhichIsA('BasePart', true)
return part and part.Position
end
local function roundstate()
return replicators.Round:GetAttribute('Round_State')
end
local function disasterphase()
local round = roundstate()
return round == 'Start Round' or round == 'Prepare Disaster'
end
local function inround()
return disasterphase() and localplayer:GetAttribute('Playing') == true
end
local function surfacelevel()
local waterlevel = workspace:FindFirstChild('WaterLevel')
local structure = workspace:FindFirstChild('Structure')
local flood = structure and structure:FindFirstChild('FloodLevel')
local level = waterlevel and waterlevel.Position.Y or 0
return flood and math.max(level, flood.Position.Y) or level
end
local playarea = {
low = Vector3.new(-200, 40, -310),
high = Vector3.new(200, 260, 150),
center = Vector3.new(-14, 150, -11),
}
local function mapbounds()
return playarea
end
local function skyspot(root)
local position = root.Position
return Vector3.new(
math.clamp(position.X, playarea.low.X, playarea.high.X),
settings.skyheight,
math.clamp(position.Z, playarea.low.Z, playarea.high.Z)
)
end
local function savedspot()
local spot = settings.spot
return #spot == 3 and Vector3.new(spot[1], spot[2], spot[3]) or nil
end
local function underspot(root)
local position = root.Position
return Vector3.new(math.clamp(position.X, -100, 90), math.min(surfacelevel() + 8, 36), math.clamp(position.Z, -100, 90))
end
local function roofed(floor, params)
for _, offset in ipairs({ Vector3.zero, Vector3.new(3, 0, 0), Vector3.new(-3, 0, 0), Vector3.new(0, 0, 3), Vector3.new(0, 0, -3) }) do
if not workspace:Raycast(floor + offset, Vector3.new(0, 30, 0), params) then
return false
end
end
return true
end
local function coverspot(root)
local structure = workspace:FindFirstChild('Structure')
if not structure then return nil end
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = { structure }
local bounds = mapbounds()
local surface = surfacelevel()
local best, bestdistance
local step = 20
for x = bounds.low.X, bounds.high.X, step do
for z = bounds.low.Z, bounds.high.Z, step do
local down = workspace:Raycast(Vector3.new(x, bounds.high.Y + 5, z), Vector3.new(0, -(bounds.high.Y - bounds.low.Y) - 10, 0), params)
local hit = down
local floors = 0
while hit and floors < 6 do
floors += 1
local floor = hit.Position + Vector3.new(0, 3.5, 0)
if floor.Y > surface + 8 then
if roofed(floor, params) then
local distance = (floor - root.Position).Magnitude
if not bestdistance or distance < bestdistance then
best, bestdistance = floor, distance
end
end
end
local origin = hit.Position - Vector3.new(0, 6, 0)
if origin.Y < bounds.low.Y then break end
hit = workspace:Raycast(origin, Vector3.new(0, bounds.low.Y - origin.Y - 2, 0), params)
end
end
end
return best
end
local function wantedplace()
if settings.mode ~= 'smart' then return settings.mode end
for _, disaster in ipairs(disasters) do
if state.active[disaster.key] and disaster.place == 'cover' then
return 'cover'
end
end
return 'sky'
end
local function computehold(root)
if settings.looptp and savedspot() then
return savedspot(), 'saved'
end
if state.manualhold then
return skyspot(root), 'sky'
end
if not (settings.autosurvive and next(state.active) and inround()) then
return nil
end
if state.earlyclock and #state.warnings == 0 and now() - state.earlyclock < settings.movedelay then
return nil
end
local place = wantedplace()
if place == 'under' then
return underspot(root), 'under'
end
if place == 'saved' and savedspot() then
return savedspot(), 'saved'
end
if place == 'cover' then
if not state.cover or now() - state.covertime > 3 then
state.cover = coverspot(root)
state.covertime = now()
end
if state.cover then return state.cover, 'cover' end
end
return skyspot(root), 'sky'
end
local function glide(root, target, delta)
local position = root.Position
local offset = target - position
local distance = offset.Magnitude
local travel = settings.glidespeed * delta
local nextposition = distance <= travel and target or position + offset.Unit * travel
root.CFrame = CFrame.new(nextposition) * root.CFrame.Rotation
root.AssemblyLinearVelocity = Vector3.zero
root.AssemblyAngularVelocity = Vector3.zero
end
local function snapto(root, target)
root.CFrame = CFrame.new(target) * root.CFrame.Rotation
root.AssemblyLinearVelocity = Vector3.zero
root.AssemblyAngularVelocity = Vector3.zero
end
local function flystep(root, humanoid, delta)
local camera = workspace.CurrentCamera
local look, right = camera.CFrame.LookVector, camera.CFrame.RightVector
local direction = Vector3.zero
if userinputservice:GetFocusedTextBox() == nil then
local isdown = function(code) return userinputservice:IsKeyDown(code) end
if isdown(Enum.KeyCode.W) then direction += look end
if isdown(Enum.KeyCode.S) then direction -= look end
if isdown(Enum.KeyCode.D) then direction += right end
if isdown(Enum.KeyCode.A) then direction -= right end
if isdown(Enum.KeyCode.Space) then direction += Vector3.yAxis end
if isdown(Enum.KeyCode.LeftControl) then direction -= Vector3.yAxis end
end
if direction.Magnitude == 0 then
direction = humanoid.MoveDirection
end
if direction.Magnitude > 0 then
root.CFrame += direction.Unit * settings.flyspeed * delta
end
root.AssemblyLinearVelocity = Vector3.zero
root.AssemblyAngularVelocity = Vector3.zero
end
local function limitmotion(root, humanoid)
local velocity = root.AssemblyLinearVelocity
local x, y, z = velocity.X, velocity.Y, velocity.Z
local changed = false
if settings.softland and y < -settings.maxfall then
y = -settings.maxfall
changed = true
end
if settings.antifling then
local flat = Vector3.new(x, 0, z)
local limit = math.max(humanoid.WalkSpeed * 2.5, 60)
if flat.Magnitude > limit then
flat = flat.Unit * humanoid.WalkSpeed
x, z = flat.X, flat.Z
changed = true
end
if y > math.max(90, humanoid.JumpPower * 1.2) then
y = 0
changed = true
end
if root.AssemblyAngularVelocity.Magnitude > 30 then
root.AssemblyAngularVelocity = Vector3.zero
end
end
if changed then
root.AssemblyLinearVelocity = Vector3.new(x, y, z)
end
end
local function waterstep(root)
if root.Position.X < -2000 then return end
local floor = surfacelevel() + 4
if root.Position.Y < floor then
local position = root.Position
root.CFrame = CFrame.new(position.X, floor, position.Z) * root.CFrame.Rotation
local velocity = root.AssemblyLinearVelocity
root.AssemblyLinearVelocity = Vector3.new(velocity.X, math.max(velocity.Y, 0), velocity.Z)
end
end
local function eatapple(character, humanoid)
local tool = character:FindFirstChild('RedApple') or (localplayer:FindFirstChild('Backpack') and localplayer.Backpack:FindFirstChild('RedApple'))
if not tool then return end
state.lastapple = now()
task.spawn(function()
humanoid:EquipTool(tool)
task.wait(0.25)
if tool.Parent == character then
tool:Activate()
end
task.wait(2)
if tool.Parent == character then
humanoid:UnequipTools()
end
end)
end
local function nearesthazard(position)
local best, bestdistance
for hazard in pairs(state.hazards) do
if hazard.Parent then
local at = positionof(hazard)
local distance = at and (at - position).Magnitude
if distance and (not bestdistance or distance < bestdistance) then
best, bestdistance = hazard, distance
end
end
end
return best, bestdistance
end
local function watchhealth(root, humanoid, character)
local health = humanoid.Health
local previous = state.lasthealth
state.lasthealth = health
if not previous or health >= previous then return end
local hazard, distance = nearesthazard(root.Position)
record('damage', {
amount = math.floor((previous - health) * 10) / 10,
health = math.floor(health),
at = vectorlist(root.Position),
place = state.holdkind,
nearest = hazard and hazard.Name,
distance = distance and math.floor(distance),
})
if settings.autoapple and health < settings.applehealth and now() - state.lastapple > 6 then
eatapple(character, humanoid)
end
end
local scantime = 0
bind(runservice.Heartbeat, function(delta)
if now() >= scantime then
scantime = now() + 0.1
if state.scantags then state.scantags() end
if state.applyscreens then state.applyscreens() end
if state.applylab then state.applylab() end
end
local character, root, humanoid = getparts()
if not character then
state.lasthealth = nil
state.hold, state.holdkind = nil, nil
return
end
if now() >= state.nextcompute then
state.nextcompute = now() + 0.75
state.hold, state.holdkind = computehold(root)
end
watchhealth(root, humanoid, character)
if state.hold then
if state.holdkind == 'saved' then
snapto(root, state.hold)
else
glide(root, state.hold, delta)
end
elseif settings.fly then
flystep(root, humanoid, delta)
else
limitmotion(root, humanoid)
if settings.waterwalk then
waterstep(root)
end
end
end)
bind(runservice.Stepped, function()
local character = localplayer.Character
local ghost = settings.noclip or state.hold ~= nil
if not character or (not ghost and next(state.collide) == nil) then return end
for _, part in ipairs(character:GetDescendants()) do
if part:IsA('BasePart') then
if ghost then
if part.CanCollide then
state.collide[part] = true
part.CanCollide = false
end
elseif state.collide[part] then
state.collide[part] = nil
part.CanCollide = true
end
end
end
end)
local function protectcharacter(character)
state.lasthealth = nil
table.clear(state.collide)
local humanoid = character:WaitForChild('Humanoid', 10)
if humanoid then
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, not settings.antifling)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, not settings.antifling)
end
local function check(instance)
if settings.antifling and moverclasses[instance.ClassName] and string.sub(instance.Name, 1, 4) ~= 'Luna' and not instance:FindFirstAncestorOfClass('Tool') then
record('mover', { class = instance.ClassName, name = instance.Name, parent = instance.Parent and instance.Parent.Name })
task.defer(function()
if instance.Parent then instance:Destroy() end
end)
end
end
for _, instance in ipairs(character:GetDescendants()) do
check(instance)
end
bind(character.DescendantAdded, check)
end
bind(localplayer.CharacterAdded, protectcharacter)
if localplayer.Character then
task.spawn(protectcharacter, localplayer.Character)
end
bind(userinputservice.JumpRequest, function()
if not settings.infjump then return end
local character, _, humanoid = getparts()
if character then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end)
bind(localplayer.Idled, function()
if settings.antiafk then
pcall(function()
virtualuser:CaptureController()
virtualuser:ClickButton2(Vector2.new())
end)
end
end)
local function releaseboard()
local board = state.board
if not board then return end
state.board = nil
if board.part.Parent then
board.part.CFrame = board.home
board.part.Transparency = board.transparency
board.part.CanCollide = board.collide
end
end
local function findboard()
if settings.boardwhich == 'items' then
local part = collectionservice:GetTagged('AvatarItemsLeaderboard')[1]
if not part then return nil end
local screen = playergui:FindFirstChild('AvatarItemsLeaderboard')
return part, screen and screen.Face or Enum.NormalId.Front
end
local model = workspace:FindFirstChild('BillboardTop10')
local part = model and model:FindFirstChild('Board')
if not part then return nil end
return part, Enum.NormalId.Front
end
local function placeboard(root)
local part, face = findboard()
if not part then
releaseboard()
return false
end
if not state.board or state.board.part ~= part then
releaseboard()
state.board = { part = part, home = part.CFrame, transparency = part.Transparency, collide = part.CanCollide }
part.Transparency = 1
part.CanCollide = false
end
local look = root.CFrame.LookVector * Vector3.new(1, 0, 1)
look = look.Magnitude > 0.01 and look.Unit or Vector3.zAxis
local at = root.Position + look * settings.boarddistance + Vector3.new(0, 2, 0)
local facing = CFrame.lookAt(at, Vector3.new(root.Position.X, at.Y, root.Position.Z))
local turn = CFrame.lookAt(Vector3.zero, Vector3.fromNormalId(face))
part.CFrame = facing * turn:Inverse()
return true
end
bind(runservice.RenderStepped, function()
if not settings.boardon then
state.boardplaced = false
releaseboard()
return
end
if settings.boardfollow or not state.boardplaced then
local character, root = getparts()
if character then
state.boardplaced = placeboard(root)
end
end
end)
local function applytouch(instance)
local function apply(part)
if part:IsA('BasePart') and part.CanTouch then
state.touched[part] = true
part.CanTouch = false
end
end
apply(instance)
for _, part in ipairs(instance:GetDescendants()) do
apply(part)
end
end
local function restoretouch()
for part in pairs(state.touched) do
if part.Parent then part.CanTouch = true end
state.touched[part] = nil
end
end
local function describe(instance)
local count, touch = 0, 0
for _, child in ipairs(instance:GetDescendants()) do
count += 1
if child:IsA('TouchTransmitter') then touch += 1 end
if count >= 300 then break end
end
local at = positionof(instance)
return {
name = instance.Name,
class = instance.ClassName,
parent = instance.Parent and instance.Parent.Name,
at = at and vectorlist(at),
size = instance:IsA('BasePart') and vectorlist(instance.Size) or nil,
children = count,
touch = touch,
}
end
local function calmexplosion(explosion)
if settings.antifling then
explosion.BlastPressure = 0
explosion.DestroyJointRadiusPercent = 0
end
record('explosion', { at = vectorlist(explosion.Position), radius = math.floor(explosion.BlastRadius) })
end
local scenery = { Mountain = true, Cloud = true }
local function addhazard(instance)
if instance:IsA('Explosion') then
calmexplosion(instance)
return
end
if state.hazards[instance] or scenery[instance.Name] then return end
if players:GetPlayerFromCharacter(instance) then return end
if not (instance:IsA('PVInstance') or instance:IsA('Folder')) then
record('object', describe(instance))
return
end
state.hazards[instance] = true
local seen = state.seen[instance.Name]
if seen then
seen.count += 1
else
state.seen[instance.Name] = { count = 1 }
record('hazard', describe(instance))
end
if settings.safetouch then applytouch(instance) end
if not instance:IsA('BasePart') then
state.hazardlinks[instance] = instance.DescendantAdded:Connect(function(part)
if settings.safetouch and part:IsA('BasePart') and part.CanTouch then
state.touched[part] = true
part.CanTouch = false
end
end)
end
end
local function prune()
for hazard in pairs(state.hazards) do
if not hazard.Parent then
state.hazards[hazard] = nil
if state.hazardlinks[hazard] then
state.hazardlinks[hazard]:Disconnect()
state.hazardlinks[hazard] = nil
end
end
end
for part in pairs(state.touched) do
if not part.Parent then state.touched[part] = nil end
end
end
bind(workspace.ChildAdded, function(child)
if child:IsA('Explosion') then
calmexplosion(child)
return
end
if knownworkspace[child.Name] then return end
task.wait()
if child.Parent then addhazard(child) end
end)
local function ismusic(sound)
local structure = workspace:FindFirstChild('Structure')
local node = sound
while node and node ~= structure do
if string.find(string.lower(node.Name), 'music', 1, true) then
return true
end
node = node.Parent
end
return false
end
local function checksound(sound)
if not sound:IsA('Sound') then return end
local path = sound:GetFullName()
if sound.Looped and not state.soundseen[path] then
state.soundseen[path] = true
record('mapsound', { path = path, music = ismusic(sound) })
end
if settings.nomusic and not state.muted[sound] and ismusic(sound) then
state.muted[sound] = sound.Volume
sound.Volume = 0
end
end
local function scansounds()
local structure = workspace:FindFirstChild('Structure')
for _, child in ipairs(structure and structure:GetDescendants() or {}) do
checksound(child)
end
end
local function applymusic()
for sound, volume in pairs(state.muted) do
if not sound.Parent then
state.muted[sound] = nil
elseif not settings.nomusic then
sound.Volume = volume
state.muted[sound] = nil
elseif sound.Volume > 0 then
state.muted[sound] = sound.Volume
sound.Volume = 0
end
end
end
local function applylab()
local lab = replicatedstorage:FindFirstChild('Secret Lab')
if settings.keeplab then
if lab then
lab.Parent = workspace
state.labmoved = true
end
elseif state.labmoved then
local placed = workspace:FindFirstChild('Secret Lab')
local _, root = getparts()
if placed and root and root.Position.X > -2000 then
placed.Parent = replicatedstorage
state.labmoved = false
end
end
end
state.applylab = applylab
local function watchstructure(structure)
bind(structure.DescendantAdded, checksound)
bind(structure.ChildAdded, function(child)
if child:IsA('Explosion') or child.Name == 'FloodLevel' or (disasterphase() and child.Name ~= contentmodel.Information.Value) then
addhazard(child)
end
end)
local flood = structure:FindFirstChild('FloodLevel')
if flood then addhazard(flood) end
end
local structure = workspace:FindFirstChild('Structure')
if structure then watchstructure(structure) end
bind(workspace.ChildAdded, function(child)
if child.Name == 'Structure' then watchstructure(child) end
end)
for _, child in ipairs(workspace:GetChildren()) do
if not knownworkspace[child.Name] then
addhazard(child)
end
end
local function matchdisaster(text)
local lower = string.lower(text)
for _, disaster in ipairs(disasters) do
for _, word in ipairs(disaster.words) do
if string.find(lower, word, 1, true) then
return disaster.key
end
end
end
return 'unknown'
end
bind(remotes.Round.OnClientEvent, function(kind, ...)
if kind == 'Warn Disaster' then
local text = tostring((...))
if state.ownwarn[text] then return end
local key = matchdisaster(text)
state.bannerclock = now()
state.active[key] = true
if state.earlyclock and not state.lead then
state.lead = now() - state.earlyclock
record('lead', { seconds = math.floor(state.lead * 100) / 100, text = text })
end
table.insert(state.warnings, 1, text)
state.warnings[6] = nil
state.nextcompute = 0
record('warning', { text = text, matched = key, round = roundstate(), map = contentmodel.Information.Value })
elseif kind == 'Display Survivors' then
local list = ...
local count = 0
for _, entry in pairs(type(list) == 'table' and list or {}) do
count += 1
if type(entry) == 'table' and entry.Player == localplayer then
state.survived += 1
end
end
record('survivors', { count = count })
local latest = state.history[1]
if latest and latest.survivors == nil then
latest.survivors = count
for _, entry in pairs(type(list) == 'table' and list or {}) do
if type(entry) == 'table' and entry.Player == localplayer then
latest.you = 'you survived'
end
end
state.historydirty = true
end
elseif kind == 'Announce' then
record('announce', { text = tostring((...)) })
end
end)
local eventremote = replicatedstorage:FindFirstChild('Event')
if eventremote then
bind(eventremote.OnClientEvent, function(kind, amount)
if kind == 'Multi-Disaster' then
state.multi = tonumber(amount) or 0
record('multi', { amount = state.multi })
end
end)
end
bind(remotes.Award.OnClientEvent, function(kind, data)
if kind == 'AwardCreds' and type(data) == 'table' then
state.creds += tonumber(data.amount) or 0
end
end)
local function showearly(name)
if not (settings.earlypopup and firesignal) then return end
local text = name .. ' is coming'
state.ownwarn[text] = true
pcall(firesignal, remotes.Round.OnClientEvent, 'Warn Disaster', text)
end
local function readtag(text)
if state.earlyname == text then return end
state.earlyname = text
state.bannerclock = now()
state.earlyclock = state.earlyclock or now()
for piece in string.gmatch(text, '[^,&/]+') do
state.active[matchdisaster(piece)] = true
end
state.nextcompute = 0
record('tag', { text = text, round = roundstate(), map = contentmodel.Information.Value, playing = localplayer:GetAttribute('Playing') })
if #state.warnings == 0 then
showearly(text)
end
end
local closedphases = { ['End Round'] = true, ['Start Intermission'] = true, ['End Intermission'] = true, Paused = true }
local function scantags()
if disasterphase() and localplayer:GetAttribute('Playing') == true then
state.wasplaying = true
end
if closedphases[roundstate()] then return end
for _, player in ipairs(players:GetPlayers()) do
local tag = player.Character and player.Character:FindFirstChild('SurvivalTag')
if tag and tag:IsA('StringValue') and tag.Value ~= '' and state.staletags[tag] ~= tag.Value then
readtag(tag.Value)
return
end
end
end
state.scantags = scantags
local function activelabels()
local labels = {}
for _, disaster in ipairs(disasters) do
if state.active[disaster.key] then table.insert(labels, disaster.label) end
end
if state.active.unknown then table.insert(labels, 'Unknown') end
return labels
end
local function closeround()
if state.roundclock or next(state.active) then
local names = activelabels()
table.insert(state.history, 1, {
map = contentmodel.Information.Value,
disaster = #names > 0 and table.concat(names, ', ') or 'Not seen',
you = state.wasplaying and 'you died' or 'you were not playing',
})
state.history[21] = nil
state.historydirty = true
end
state.roundclock = nil
state.wasplaying = false
local counts = {}
for name, seen in pairs(state.seen) do
counts[name] = seen.count
end
if next(counts) then
record('hazards', { counts = counts })
end
for screen in pairs(state.hiddenscreens) do
if screen.Name ~= 'Damage Flash' then
state.hiddenscreens[screen] = nil
end
end
table.clear(state.seen)
table.clear(state.active)
table.clear(state.warnings)
table.clear(state.staletags)
table.clear(state.ownwarn)
for _, player in ipairs(players:GetPlayers()) do
local tag = player.Character and player.Character:FindFirstChild('SurvivalTag')
if tag and tag:IsA('StringValue') then
state.staletags[tag] = tag.Value
end
end
state.earlyname, state.earlyclock, state.lead = nil, nil, nil
state.multi = 0
state.cover = nil
state.nextcompute = 0
end
bind(replicators.Round:GetAttributeChangedSignal('Round_State'), function()
local round = roundstate()
record('round', { state = round, map = contentmodel.Information.Value })
if round == 'Start Round' then
state.roundclock = now()
end
if closedphases[round] then
closeround()
else
scantags()
end
end)
bind(contentmodel.Status.Changed, function()
record('status', { text = contentmodel.Status.Value })
end)
local screennames = { 'BlizzardGui', 'SandStormGui', 'Damage Flash' }
local function applyscreens()
for _, name in ipairs(screennames) do
local screen = playergui:FindFirstChild(name)
if screen and screen:IsA('ScreenGui') then
if settings.noflash and screen.Enabled then
state.hiddenscreens[screen] = true
screen.Enabled = false
elseif not settings.noflash and state.hiddenscreens[screen] then
state.hiddenscreens[screen] = nil
screen.Enabled = true
end
end
end
end
state.applyscreens = applyscreens
bind(playergui.ChildAdded, applyscreens)
local function applyvisuals()
if settings.fullbright then
if not state.light then
state.light = {
Ambient = lighting.Ambient,
OutdoorAmbient = lighting.OutdoorAmbient,
Brightness = lighting.Brightness,
GlobalShadows = lighting.GlobalShadows,
}
end
lighting.Ambient = Color3.new(1, 1, 1)
lighting.OutdoorAmbient = Color3.new(1, 1, 1)
lighting.Brightness = 2
lighting.GlobalShadows = false
elseif state.light then
for key, value in pairs(state.light) do
lighting[key] = value
end
state.light = nil
end
if settings.nofog then
if not state.fogend then
state.fogend, state.fogstart = lighting.FogEnd, lighting.FogStart
end
lighting.FogEnd, lighting.FogStart = 1e6, 1e6
for _, child in ipairs(lighting:GetChildren()) do
if child:IsA('Atmosphere') and child.Density > 0 then
state.fog[child] = child.Density
child.Density = 0
end
end
elseif state.fogend then
lighting.FogEnd, lighting.FogStart = state.fogend, state.fogstart
state.fogend, state.fogstart = nil, nil
for atmosphere, density in pairs(state.fog) do
atmosphere.Density = density
state.fog[atmosphere] = nil
end
end
applyscreens()
end
local function applymovement()
local character, _, humanoid = getparts()
if not character then return end
if settings.speedon then
humanoid.WalkSpeed = settings.speed
elseif state.speedset then
humanoid.WalkSpeed = 16
end
state.speedset = settings.speedon
if settings.jumpon then
if not state.jumpdefault then
state.jumpdefault = { use = humanoid.UseJumpPower, power = humanoid.JumpPower }
end
humanoid.UseJumpPower = true
humanoid.JumpPower = settings.jump
elseif state.jumpset and state.jumpdefault then
humanoid.UseJumpPower = state.jumpdefault.use
humanoid.JumpPower = state.jumpdefault.power
state.jumpdefault = nil
end
state.jumpset = settings.jumpon
end
local palette = {
back = Color3.fromRGB(16, 13, 26),
panel = Color3.fromRGB(26, 21, 42),
row = Color3.fromRGB(35, 29, 56),
accent = Color3.fromRGB(150, 104, 255),
text = Color3.fromRGB(236, 232, 248),
dim = Color3.fromRGB(160, 150, 186),
warn = Color3.fromRGB(255, 120, 110),
}
local guiparent = (gethui and gethui()) or playergui
local old = guiparent:FindFirstChild('luna_forecast')
if old then old:Destroy() end
local function make(class, props, parent)
local instance = Instance.new(class)
for key, value in pairs(props) do
instance[key] = value
end
instance.Parent = parent
return instance
end
local function rounded(instance, radius)
make('UICorner', { CornerRadius = UDim.new(0, radius or 6) }, instance)
return instance
end
local gui = make('ScreenGui', { Name = 'luna_forecast', ResetOnSpawn = false, IgnoreGuiInset = true, DisplayOrder = 50, ZIndexBehavior = Enum.ZIndexBehavior.Sibling }, guiparent)
gui:SetAttribute('build', build)
local banner = rounded(make('TextLabel', {
AnchorPoint = Vector2.new(0.5, 0),
Position = UDim2.new(0.5, 0, 0, 44),
Size = UDim2.new(0, 360, 0, 28),
BackgroundColor3 = palette.back,
BackgroundTransparency = 0.15,
TextColor3 = palette.warn,
Font = Enum.Font.GothamBold,
TextSize = 13,
Text = '',
Visible = false,
}, gui))
local window = rounded(make('Frame', {
Position = UDim2.new(0, 24, 0, 90),
Size = UDim2.new(0, 320, 0, 430),
BackgroundColor3 = palette.back,
BorderSizePixel = 0,
Active = true,
}, gui), 10)
make('UIStroke', { Color = palette.accent, Transparency = 0.55 }, window)
local header = make('Frame', { Size = UDim2.new(1, 0, 0, 38), BackgroundTransparency = 1 }, window)
make('TextLabel', {
Position = UDim2.new(0, 14, 0, 0),
Size = UDim2.new(1, -150, 1, 0),
BackgroundTransparency = 1,
Font = Enum.Font.GothamBold,
TextSize = 13,
TextColor3 = palette.text,
TextXAlignment = Enum.TextXAlignment.Left,
Text = 'Forecast / Luna.dev',
}, header)
local closebutton = rounded(make('TextButton', {
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, -10, 0.5, 0),
Size = UDim2.new(0, 56, 0, 24),
BackgroundColor3 = palette.row,
TextColor3 = palette.dim,
Font = Enum.Font.GothamMedium,
TextSize = 12,
Text = 'Unload',
AutoButtonColor = false,
}, header))
local hidebutton = rounded(make('TextButton', {
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, -70, 0.5, 0),
Size = UDim2.new(0, 46, 0, 24),
BackgroundColor3 = palette.row,
TextColor3 = palette.dim,
Font = Enum.Font.GothamMedium,
TextSize = 12,
Text = 'Hide',
AutoButtonColor = false,
}, header))
local showbutton = rounded(make('TextButton', {
Position = UDim2.new(0, 12, 0.5, 0),
Size = UDim2.new(0, 46, 0, 28),
BackgroundColor3 = palette.back,
TextColor3 = palette.accent,
Font = Enum.Font.GothamBold,
TextSize = 12,
Text = 'Luna',
AutoButtonColor = false,
Visible = false,
}, gui))
local function setwindow(visible)
window.Visible = visible
showbutton.Visible = not visible
end
bind(hidebutton.MouseButton1Click, function() setwindow(false) end)
bind(showbutton.MouseButton1Click, function() setwindow(true) end)
local function fitwindow()
local camera = workspace.CurrentCamera
local height = camera and camera.ViewportSize.Y or 700
window.Size = UDim2.new(0, 320, 0, math.clamp(height - 120, 240, 430))
end
fitwindow()
if workspace.CurrentCamera then
bind(workspace.CurrentCamera:GetPropertyChangedSignal('ViewportSize'), fitwindow)
end
local tabbar = make('Frame', { Position = UDim2.new(0, 10, 0, 38), Size = UDim2.new(1, -20, 0, 28), BackgroundTransparency = 1 }, window)
make('UIListLayout', { FillDirection = Enum.FillDirection.Horizontal, Padding = UDim.new(0, 4) }, tabbar)
local pagehost = make('Frame', { Position = UDim2.new(0, 10, 0, 72), Size = UDim2.new(1, -20, 1, -82), BackgroundTransparency = 1 }, window)
local pages, tabs = {}, {}
local function showpage(name)
for key, page in pairs(pages) do
page.Visible = key == name
tabs[key].BackgroundColor3 = key == name and palette.accent or palette.row
tabs[key].TextColor3 = key == name and palette.text or palette.dim
end
end
local function addpage(name, width)
local tab = rounded(make('TextButton', {
Size = UDim2.new(width, -3, 1, 0),
BackgroundColor3 = palette.row,
TextColor3 = palette.dim,
Font = Enum.Font.GothamMedium,
TextSize = 12,
Text = name,
AutoButtonColor = false,
}, tabbar))
local page = make('ScrollingFrame', {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1,
BorderSizePixel = 0,
ScrollBarThickness = 3,
ScrollBarImageColor3 = palette.accent,
AutomaticCanvasSize = Enum.AutomaticSize.Y,
CanvasSize = UDim2.new(),
Visible = false,
}, pagehost)
make('UIListLayout', { Padding = UDim.new(0, 5), SortOrder = Enum.SortOrder.LayoutOrder }, page)
pages[name], tabs[name] = page, tab
bind(tab.MouseButton1Click, function() showpage(name) end)
return page
end
local function addrow(page, height)
return rounded(make('Frame', {
Size = UDim2.new(1, -6, 0, height or 32),
BackgroundColor3 = palette.row,
BorderSizePixel = 0,
LayoutOrder = #page:GetChildren(),
}, page))
end
local function rowlabel(row, text, width)
return make('TextLabel', {
Position = UDim2.new(0, 10, 0, 0),
Size = UDim2.new(1, -(width or 60), 1, 0),
BackgroundTransparency = 1,
Font = Enum.Font.Gotham,
TextSize = 12,
TextColor3 = palette.text,
TextXAlignment = Enum.TextXAlignment.Left,
Text = text,
}, row)
end
local function addsection(page, text)
make('TextLabel', {
Size = UDim2.new(1, -6, 0, 20),
BackgroundTransparency = 1,
Font = Enum.Font.GothamBold,
TextSize = 11,
TextColor3 = palette.accent,
TextXAlignment = Enum.TextXAlignment.Left,
Text = text,
LayoutOrder = #page:GetChildren(),
}, page)
end
local function addtoggle(page, text, key, onchange)
local row = addrow(page)
rowlabel(row, text, 60)
local button = rounded(make('TextButton', {
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, -6, 0.5, 0),
Size = UDim2.new(0, 44, 0, 22),
Font = Enum.Font.GothamBold,
TextSize = 11,
AutoButtonColor = false,
}, row))
local function refresh()
button.Text = settings[key] and 'ON' or 'OFF'
button.BackgroundColor3 = settings[key] and palette.accent or palette.panel
button.TextColor3 = settings[key] and palette.text or palette.dim
end
bind(button.MouseButton1Click, function()
settings[key] = not settings[key]
refresh()
savesettings()
if onchange then onchange(settings[key]) end
end)
refresh()
end
local function addstepper(page, text, key, step, low, high)
local row = addrow(page)
rowlabel(row, text, 104)
local function button(label, x, change)
local instance = rounded(make('TextButton', {
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, x, 0.5, 0),
Size = UDim2.new(0, 24, 0, 22),
BackgroundColor3 = palette.panel,
TextColor3 = palette.text,
Font = Enum.Font.GothamBold,
TextSize = 13,
Text = label,
AutoButtonColor = false,
}, row))
bind(instance.MouseButton1Click, change)
end
local value = make('TextLabel', {
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, -32, 0.5, 0),
Size = UDim2.new(0, 36, 0, 22),
BackgroundTransparency = 1,
TextColor3 = palette.text,
Font = Enum.Font.GothamMedium,
TextSize = 12,
Text = tostring(settings[key]),
}, row)
local function change(by)
settings[key] = math.clamp(settings[key] + by, low, high)
value.Text = tostring(settings[key])
savesettings()
end
button('+', -6, function() change(step) end)
button('-', -70, function() change(-step) end)
end
local function addbutton(page, text, callback)
local row = rounded(make('TextButton', {
Size = UDim2.new(1, -6, 0, 30),
BackgroundColor3 = palette.panel,
TextColor3 = palette.text,
Font = Enum.Font.GothamMedium,
TextSize = 12,
Text = text,
AutoButtonColor = false,
LayoutOrder = #page:GetChildren(),
}, page))
bind(row.MouseButton1Click, function() callback(row) end)
return row
end
local function addinfo(page, height)
local row = addrow(page, height)
local label = make('TextLabel', {
Position = UDim2.new(0, 10, 0, 5),
Size = UDim2.new(1, -20, 1, -10),
BackgroundTransparency = 1,
Font = Enum.Font.Gotham,
TextSize = 12,
TextColor3 = palette.text,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Top,
TextWrapped = true,
RichText = true,
Text = '',
}, row)
return label
end
local function teleport(position)
local character, root = getparts()
if not character then return end
character:PivotTo(CFrame.new(position))
root.AssemblyLinearVelocity = Vector3.zero
end
local survive = addpage('Survive', 0.2)
local move = addpage('Move', 0.2)
local round = addpage('Round', 0.2)
local history = addpage('History', 0.2)
local recon = addpage('Log', 0.2)
addsection(survive, 'STATUS')
local statusinfo = addinfo(survive, 44)
addsection(survive, 'EARLY WARNING')
addtoggle(survive, 'Show in the game popup too', 'earlypopup')
addtoggle(survive, 'Warning banner', 'banner')
addtoggle(survive, 'Countdown until it starts', 'countdown')
addstepper(survive, 'Hide banner after (0 = never)', 'bannerseconds', 5, 0, 120)
addsection(survive, 'AUTO')
addtoggle(survive, 'Auto survive on warnings', 'autosurvive', function() state.nextcompute = 0 end)
local modebutton
modebutton = addbutton(survive, '', function()
settings.mode = settings.mode == 'smart' and 'saved' or settings.mode == 'saved' and 'sky' or settings.mode == 'sky' and 'cover' or settings.mode == 'cover' and 'under' or 'smart'
modebutton.Text = 'Safe spot: ' .. settings.mode
state.cover = nil
state.nextcompute = 0
savesettings()
end)
modebutton.Text = 'Safe spot: ' .. settings.mode
addbutton(survive, 'Hold above the map: off', function(button)
state.manualhold = not state.manualhold
state.nextcompute = 0
button.Text = 'Hold above the map: ' .. (state.manualhold and 'on' or 'off')
end)
addstepper(survive, 'Move after early warning (s)', 'movedelay', 2, 0, 40)
addstepper(survive, 'Hover height', 'skyheight', 20, 200, 1500)
addstepper(survive, 'Glide speed', 'glidespeed', 20, 40, 400)
addsection(survive, 'SAVED SPOT')
local spotinfo = addinfo(survive, 26)
local function refreshspot()
local spot = savedspot()
spotinfo.Text = spot and string.format('Saved at %.0f, %.0f, %.0f', spot.X, spot.Y, spot.Z) or 'No spot saved yet'
end
refreshspot()
addbutton(survive, 'Save the spot I am standing in', function()
local character, root = getparts()
if not character then return end
local position = root.Position
settings.spot = { position.X, position.Y, position.Z }
settings.mode = 'saved'
modebutton.Text = 'Safe spot: saved'
state.nextcompute = 0
refreshspot()
savesettings()
end)
addbutton(survive, 'Use the lobby spot', function()
settings.spot = table.clone(lobbyspot)
settings.mode = 'saved'
modebutton.Text = 'Safe spot: saved'
state.nextcompute = 0
refreshspot()
savesettings()
end)
addbutton(survive, 'Go to saved spot', function()
if savedspot() then teleport(savedspot()) end
end)
addtoggle(survive, 'Loop teleport there all the time', 'looptp', function() state.nextcompute = 0 end)
addsection(survive, 'BODY')
addtoggle(survive, 'Soft landing', 'softland')
addstepper(survive, 'Max fall speed', 'maxfall', 5, 15, 120)
addtoggle(survive, 'Anti fling and ragdoll', 'antifling', function()
local character = localplayer.Character
local humanoid = character and character:FindFirstChildOfClass('Humanoid')
if humanoid then
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, not settings.antifling)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, not settings.antifling)
end
end)
addtoggle(survive, 'Stay above water and flood', 'waterwalk')
addtoggle(survive, 'Eat apple when hurt', 'autoapple')
addstepper(survive, 'Apple below health', 'applehealth', 5, 10, 90)
addsection(survive, 'HAZARDS')
addtoggle(survive, 'Disaster objects: ignore touch', 'safetouch', function(enabled)
if enabled then
for hazard in pairs(state.hazards) do
if hazard.Parent then applytouch(hazard) end
end
else
restoretouch()
end
end)
addtoggle(survive, 'Highlight disaster objects', 'hazardesp')
addsection(move, 'MOVEMENT')
addtoggle(move, 'Walk speed', 'speedon')
addstepper(move, 'Speed', 'speed', 2, 16, 150)
addtoggle(move, 'Jump power', 'jumpon')
addstepper(move, 'Power', 'jump', 5, 50, 300)
addtoggle(move, 'Infinite jump', 'infjump')
addtoggle(move, 'Fly (space / ctrl)', 'fly')
addstepper(move, 'Fly speed', 'flyspeed', 10, 20, 300)
addtoggle(move, 'Noclip', 'noclip')
addsection(move, 'VISUALS')
addtoggle(move, 'Full bright', 'fullbright')
addtoggle(move, 'No fog or storm haze', 'nofog')
addtoggle(move, 'No disaster screen effects', 'noflash')
addtoggle(move, 'Player names and health', 'playeresp')
addtoggle(move, 'No map music', 'nomusic', function(enabled)
if enabled then scansounds() else applymusic() end
end)
addtoggle(move, 'Keep Secret Lab in the world', 'keeplab')
addsection(move, 'OTHER')
addtoggle(move, 'Anti AFK', 'antiafk')
addsection(round, 'THIS ROUND')
local roundinfo = addinfo(round, 190)
addsection(round, 'MAP VOTE')
local votebuttons = {}
local refreshvotes
for index = 1, 3 do
votebuttons[index] = addbutton(round, '', function(button)
remotes.Compass:FireServer('Vote Map', index)
task.delay(1, function()
local counted = replicators.Compass:FindFirstChild(tostring(localplayer.UserId)) ~= nil
record('vote', { choice = index, counted = counted })
button.Text = counted and 'Vote counted' or 'Vote not counted'
task.delay(2, refreshvotes)
end)
end)
end
addbutton(round, 'Remove my vote', function()
remotes.Compass:FireServer('Remove Vote')
end)
addsection(round, 'TELEPORT')
addbutton(round, 'Lobby', function()
local spawns = workspace:FindFirstChild('Spawns')
local spot = spawns and spawns:FindFirstChildWhichIsA('SpawnLocation')
teleport(spot and spot.Position + Vector3.new(0, 5, 0) or Vector3.new(-280, 182, 341))
end)
addbutton(round, 'Map centre, on top', function()
local center = playarea.center
local hit = workspace:Raycast(Vector3.new(center.X, 400, center.Z), Vector3.new(0, -420, 0))
teleport(Vector3.new(center.X, hit and hit.Position.Y + 6 or 190, center.Z))
end)
addbutton(round, 'Highest point on the map', function()
local structure = workspace:FindFirstChild('Structure')
if not structure then return end
local targets = {}
local current = structure:FindFirstChild(contentmodel.Information.Value)
if current then
table.insert(targets, current)
else
for _, child in ipairs(structure:GetChildren()) do
if child:IsA('Model') then table.insert(targets, child) end
end
end
local island = workspace:FindFirstChild('Island')
if island then table.insert(targets, island) end
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = targets
local best
for x = playarea.low.X, playarea.high.X, 10 do
for z = playarea.low.Z, playarea.high.Z, 10 do
local hit = workspace:Raycast(Vector3.new(x, 400, z), Vector3.new(0, -400, 0), params)
if hit and (not best or hit.Position.Y > best.Y) then
best = hit.Position
end
end
end
if best then teleport(best + Vector3.new(0, 4, 0)) end
end)
addbutton(round, 'Nearest covered spot', function()
local character, root = getparts()
if not character then return end
local spot = coverspot(root)
if spot then teleport(spot) end
end)
refreshvotes = function()
local choices = string.split(replicators.Compass:GetAttribute('Choices') or '', ', ')
for index, button in ipairs(votebuttons) do
local name = choices[index]
button.Text = name and #name > 0 and ('Vote ' .. name) or 'No choice yet'
end
end
bind(replicators.Compass:GetAttributeChangedSignal('Choices'), refreshvotes)
refreshvotes()
addsection(round, 'LEADERBOARD')
local boardbutton
boardbutton = addbutton(round, '', function()
settings.boardwhich = settings.boardwhich == 'top10' and 'items' or 'top10'
boardbutton.Text = 'Board: ' .. (settings.boardwhich == 'top10' and 'Top 10 survivors' or 'Top avatar items')
releaseboard()
state.boardplaced = false
savesettings()
end)
boardbutton.Text = 'Board: ' .. (settings.boardwhich == 'top10' and 'Top 10 survivors' or 'Top avatar items')
addtoggle(round, 'Bring its screen in front of me', 'boardon')
addtoggle(round, 'Keep following me', 'boardfollow')
addstepper(round, 'Distance', 'boarddistance', 2, 6, 40)
addbutton(round, 'Place it here again', function()
state.boardplaced = false
end)
addsection(round, 'PLAYERS')
local function otherplayers()
local list = {}
for _, player in ipairs(players:GetPlayers()) do
if player ~= localplayer and player.Character and player.Character:FindFirstChildOfClass('Humanoid') then
table.insert(list, player)
end
end
return list
end
local spectatebutton
spectatebutton = addbutton(round, 'Spectate next player', function()
local list = otherplayers()
if #list == 0 then return end
state.watching = (state.watching or 0) % #list + 1
local target = list[state.watching]
state.watched = target
workspace.CurrentCamera.CameraSubject = target.Character:FindFirstChildOfClass('Humanoid')
spectatebutton.Text = 'Spectating ' .. target.Name
end)
addbutton(round, 'Stop spectating', function()
local _, _, humanoid = getparts()
state.watched, state.watching = nil, nil
if humanoid then workspace.CurrentCamera.CameraSubject = humanoid end
spectatebutton.Text = 'Spectate next player'
end)
addbutton(round, 'Teleport to spectated player', function()
local target = state.watched
local root = target and target.Character and target.Character:FindFirstChild('HumanoidRootPart')
if root then teleport(root.Position + Vector3.new(0, 4, 0)) end
end)
addsection(history, 'THIS SESSION')
local historyinfo = addinfo(history, 26)
local historyrows = {}
for index = 1, 20 do
historyrows[index] = addinfo(history, 44)
historyrows[index].Parent.Visible = false
end
local function refreshhistory()
if not state.historydirty then return end
state.historydirty = false
local total = #state.history
historyinfo.Text = total == 0 and 'No finished rounds yet.' or (total .. ' rounds, ' .. state.survived .. ' survived')
for index, label in ipairs(historyrows) do
local entry = state.history[index]
label.Parent.Visible = entry ~= nil
if entry then
local survivors = entry.survivors and (entry.survivors .. ' survived') or 'survivors unknown'
label.Text = '' .. entry.map .. ' ' .. entry.disaster .. '\n' .. survivors .. ', ' .. entry.you
end
end
end
addsection(recon, 'DISASTER LOG')
addtoggle(recon, 'Record disasters', 'recon')
local reconinfo = addinfo(recon, 60)
addbutton(recon, 'Save log to file', function(button)
button.Text = savelog() and 'Saved to the LunaDev folder' or 'Saving is not available'
task.delay(2, function() button.Text = 'Save log to file' end)
end)
addbutton(recon, 'Copy log', function(button)
if setclipboard then
setclipboard(httpservice:JSONEncode(state.log))
button.Text = 'Copied'
task.delay(2, function() button.Text = 'Copy log' end)
end
end)
addbutton(recon, 'Clear log', function()
table.clear(state.log)
end)
showpage('Survive')
local dragging, dragstart, windowstart
bind(header.InputBegan, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging, dragstart, windowstart = true, input.Position, window.Position
end
end)
bind(userinputservice.InputChanged, function(input)
if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
local offset = input.Position - dragstart
window.Position = UDim2.new(windowstart.X.Scale, windowstart.X.Offset + offset.X, windowstart.Y.Scale, windowstart.Y.Offset + offset.Y)
end
end)
bind(userinputservice.InputEnded, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragging = false
end
end)
bind(userinputservice.InputBegan, function(input, processed)
if not processed and input.KeyCode == Enum.KeyCode.RightControl then
setwindow(not window.Visible)
end
end)
local highlights = {}
for index = 1, 20 do
highlights[index] = make('Highlight', {
FillColor = palette.warn,
OutlineColor = palette.warn,
FillTransparency = 0.7,
OutlineTransparency = 0.1,
DepthMode = Enum.HighlightDepthMode.AlwaysOnTop,
Enabled = false,
}, gui)
end
local function refreshhighlights()
local _, root = getparts()
local found = {}
if settings.hazardesp and root then
for hazard in pairs(state.hazards) do
local tiny = hazard:IsA('BasePart') and hazard.Size.Magnitude < 3
if not tiny and hazard.Parent and hazard:IsDescendantOf(workspace) then
local at = positionof(hazard)
if at then
table.insert(found, { hazard = hazard, distance = (at - root.Position).Magnitude })
end
end
end
table.sort(found, function(a, b) return a.distance < b.distance end)
end
for index, highlight in ipairs(highlights) do
local entry = found[index]
local hazard = entry and entry.hazard
highlight.Adornee = hazard and (hazard:IsA('PVInstance') and hazard or hazard:FindFirstChildWhichIsA('BasePart', true)) or nil
highlight.Enabled = entry ~= nil
end
end
local function refreshplayeresp()
for player, board in pairs(state.esp) do
if not settings.playeresp or player.Parent ~= players then
board:Destroy()
state.esp[player] = nil
end
end
if not settings.playeresp then return end
for _, player in ipairs(players:GetPlayers()) do
local character = player.Character
local head = character and character:FindFirstChild('Head')
local humanoid = character and character:FindFirstChildOfClass('Humanoid')
if player ~= localplayer and head and humanoid then
local board = state.esp[player]
if not board then
board = make('BillboardGui', {
Size = UDim2.new(0, 160, 0, 18),
StudsOffset = Vector3.new(0, 3, 0),
AlwaysOnTop = true,
}, gui)
make('TextLabel', {
Size = UDim2.new(1, 0, 1, 0),
BackgroundTransparency = 1,
Font = Enum.Font.GothamMedium,
TextSize = 12,
TextStrokeTransparency = 0.5,
}, board)
state.esp[player] = board
end
board.Adornee = head
local label = board:FindFirstChildOfClass('TextLabel')
label.Text = player.Name .. ' ' .. math.floor(humanoid.Health)
label.TextColor3 = player:GetAttribute('Playing') == true and palette.text or palette.dim
end
end
end
local function statusline()
if lasterror then
return 'Error: ' .. string.gsub(lasterror, '[<>&]', ' ') .. ''
end
if settings.boardon and not state.board then
return 'Board not found yet.'
end
if settings.looptp and not savedspot() then
return 'Loop teleport is on, but no spot is saved.'
end
if state.holdkind then
return 'Holding at: ' .. state.holdkind
end
if not settings.autosurvive then
return 'Auto survive is off.'
end
if settings.mode == 'saved' and not savedspot() then
return 'Safe spot is set to saved, but nothing is saved yet. Using sky.'
end
if localplayer:GetAttribute('Playing') ~= true then
return 'Waiting: you are not in the round.'
end
if not next(state.active) then
return 'Waiting: no disaster known yet.'
end
if state.earlyclock and #state.warnings == 0 then
return string.format('Moving to %s in %.0f s.', wantedplace(), math.max(settings.movedelay - (now() - state.earlyclock), 0))
end
return 'Ready.'
end
local function refreshinfo()
statusinfo.Text = statusline()
local labels = activelabels()
local text = #labels > 0 and table.concat(labels, ', ') or 'None yet'
local counting = settings.countdown and #labels > 0 and #state.warnings == 0
local left = counting and state.roundclock and math.max(41 - (now() - state.roundclock), 0)
local starts = '-'
if #state.warnings > 0 then
starts = 'Started'
elseif counting then
starts = left and (left > 0 and ('in ' .. math.ceil(left) .. 's') or 'any moment') or 'soon'
end
local playing = 0
for _, player in ipairs(players:GetPlayers()) do
if player:GetAttribute('Playing') == true then playing += 1 end
end
local place = state.holdkind and ('Holding: ' .. state.holdkind) or (state.manualhold and 'Holding: sky' or 'Free')
roundinfo.Text = table.concat({
'State ' .. tostring(roundstate() or 'unknown') .. ' / ' .. contentmodel.Status.Value,
'Map ' .. contentmodel.Information.Value,
'Next ' .. tostring(replicators.Round:GetAttribute('Next_Map') or '-'),
'Disasters ' .. text .. (state.multi > 0 and (' (multi x' .. state.multi .. ')') or ''),
'Starts ' .. starts,
'Early by ' .. (state.lead and (string.format('%.1f', state.lead) .. 's') or '-'),
'You ' .. place .. (localplayer:GetAttribute('Playing') == true and ', in round' or ', not in round'),
'Players in round ' .. playing,
'Flood level ' .. math.floor(surfacelevel()),
'Session ' .. state.survived .. ' survived, ' .. state.creds .. ' creds',
}, '\n')
reconinfo.Text = #state.log .. ' entries. Leave this on during rounds. It records warnings, new disaster objects and what damaged you.'
local seconds = settings.bannerseconds
banner.Visible = settings.banner and #labels > 0 and (counting or seconds == 0 or (state.bannerclock and now() - state.bannerclock < seconds) or false)
local early = state.lead and (' / early by ' .. string.format('%.1f', state.lead) .. 's') or ''
if counting then
banner.Text = text .. ' ' .. starts
else
banner.Text = #labels > 0 and (text .. ' / ' .. place .. early) or ''
end
end
local running = true
task.spawn(function()
local tick = 0
while running do
tick += 1
pcall(applyvisuals)
pcall(applymovement)
pcall(refreshinfo)
pcall(refreshhistory)
pcall(applymusic)
pcall(refreshplayeresp)
if tick % 2 == 0 then pcall(refreshhighlights) end
if tick % 4 == 0 then pcall(prune) end
if tick % 60 == 0 and state.logdirty then savelog() end
task.wait(0.5)
end
end)
local function unload()
running = false
for _, connection in ipairs(connections) do
connection:Disconnect()
end
table.clear(connections)
if state.watched then
local humanoid = localplayer.Character and localplayer.Character:FindFirstChildOfClass('Humanoid')
if humanoid then workspace.CurrentCamera.CameraSubject = humanoid end
end
for _, link in pairs(state.hazardlinks) do
link:Disconnect()
end
restoretouch()
releaseboard()
settings.nomusic = false
pcall(applymusic)
settings.fullbright, settings.nofog, settings.noflash = false, false, false
pcall(applyvisuals)
local character = localplayer.Character
local humanoid = character and character:FindFirstChildOfClass('Humanoid')
if humanoid then
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, true)
humanoid:SetStateEnabled(Enum.HumanoidStateType.Ragdoll, true)
if state.speedset then humanoid.WalkSpeed = 16 end
if state.jumpdefault then
humanoid.UseJumpPower = state.jumpdefault.use
humanoid.JumpPower = state.jumpdefault.power
end
end
for part in pairs(state.collide) do
if part.Parent then part.CanCollide = true end
end
if state.logdirty then savelog() end
gui:Destroy()
env.luna_forecast_unload = nil
end
env.luna_forecast_unload = unload
bind(closebutton.MouseButton1Click, function()
savesettings()
unload()
end)
pcall(scansounds)
end, function(message)
return debug.traceback(tostring(message), 2)
end)
if not started then
warn('[luna.dev] forecast failed: ' .. tostring(problem))
pcall(function()
game:GetService('StarterGui'):SetCore('SendNotification', {
Title = 'Forecast / Luna.dev',
Text = 'Could not start. See the console.',
Duration = 10,
})
end)
end