Greatings there so i have script from the Infinite Scripter. Everithing is good,and i wanna use the script for my game, but the problem is, that this script would run on local script and not in server script and i wanna that this script would run compleatly oposide aka run on server script but i have no idea how i could do it
-
What do you want to achieve?
As i said, i wanna that this script would run on server script and not in local script
and learn a lil bit more how this script runs, because in some part my confiuzed lool. -
What is the issue?
It runs on local script (lol), and i have no idea what i should change because my pretty new in scripting, soo don’t be suprised if i dont understnad someting
The Script in explorer

The code:
if script.Parent.ClassName ~= "Actor" then
local size = script:GetAttribute("Size") or 64
local load = script:GetAttribute("Load") or 16
local unload = script:GetAttribute("Unload") or 32
local actors = {}
local loaded = {}
local cameraX = math.huge
local cameraZ = math.huge
local focusX = math.floor(cameraX / size)
local focusZ = math.floor(cameraZ / size)
local selected = nil
local amount = (load * 2 + 1) ^ 2
local distance = size ^ 2
load = load ^ 2 + 1
unload = unload ^ 2 + 1
local actorScript = script:Clone()
script:ClearAllChildren()
local function ActorAmount(amount)
while #actors < amount do
local actor = Instance.new("Actor", script)
actorScript:Clone().Parent = actor
actor.Initialize:Fire()
table.insert(actors, actor)
end
while #actors > amount do
local actor = table.remove(actors)
actor:Destroy()
end
end
local function LoadChunk(chunkX, chunkZ)
if loaded[chunkX] == nil then loaded[chunkX] = {} end
if loaded[chunkX][chunkZ] ~= nil then return end
loaded[chunkX][chunkZ] = true
actors[selected].Load:Fire(chunkX, chunkZ)
selected += 1
if selected > #actors then selected = 1 task.wait() end
end
local function UnloadChunk(chunkX, chunkZ)
loaded[chunkX][chunkZ] = nil
if next(loaded[chunkX]) == nil then loaded[chunkX] = nil end
actors[selected].Unload:Fire(chunkX, chunkZ)
selected += 1
if selected > #actors then selected = 1 task.wait() end
end
ActorAmount(script:GetAttribute("Actors") or 2)
script.AttributeChanged:Connect(function(attribute)
if attribute == "Actors" then
ActorAmount(script:GetAttribute("Actors") or 2)
end
if attribute == "Size" then
size = script:GetAttribute("Size") or 64
distance = size ^ 2
end
if attribute == "Load" then
load = script:GetAttribute("Load") or 16
amount = (load * 2 + 1) ^ 2
load = load ^ 2 + 1
end
if attribute == "Unload" then
unload = script:GetAttribute("Unload") or 32
unload = unload ^ 2 + 1
end
end)
workspace.CurrentCamera:GetPropertyChangedSignal("Focus"):Connect(function()
local x, z = workspace.CurrentCamera.Focus.Position.X, workspace.CurrentCamera.Focus.Position.Z
focusX, focusZ = math.floor(x / size), math.floor(z / size)
if (cameraX - x) ^ 2 + (cameraZ - z) ^ 2 <= distance then return end
cameraX, cameraZ = x, z
local chunkX, chunkZ, directionX, directionZ, count, length = focusX, focusZ, 1, 0, 0, 1
selected = 1
for i = 1, amount do
if (chunkX - focusX) ^ 2 + (chunkZ - focusZ) ^ 2 <= load then LoadChunk(chunkX, chunkZ) end
chunkX += directionX chunkZ += directionZ count += 1
if count == length then count = 0 directionX, directionZ = -directionZ, directionX if directionZ == 0 then length += 1 end end
end
if unload < load then return end
for chunkX, data in loaded do
for chunkZ, value in data do
if (chunkX - focusX) ^ 2 + (chunkZ - focusZ) ^ 2 <= unload then continue end
UnloadChunk(chunkX, chunkZ)
end
end
end)
else
local events = {["Initialize"] = {}, ["Deinitialize"] = {}, ["Load"] = {}, ["Unload"] = {}}
local parallel = {["Initialize"] = false, ["Deinitialize"] = false, ["Load"] = true, ["Unload"] = true}
local modules = {}
for i, descendant in script:GetDescendants() do
if descendant.ClassName ~= "ModuleScript" then continue end
local module = require(descendant)
modules[descendant] = module
if type(module) ~= "table" then continue end
for name, callbacks in events do
if type(module[name]) == "function" then table.insert(callbacks, module[name]) end
end
end
for name, callbacks in events do
local event = Instance.new("BindableEvent")
event.Name = name
event.Parent = script.Parent
if parallel[name] == false then
event.Event:Connect(function(...) for i, callback in callbacks do callback(script, modules, ...) end end)
else
event.Event:ConnectParallel(function(...) for i, callback in callbacks do callback(script, modules, ...) end end)
end
end
end
And thanks to everyone helping me this out
P.S I’m most of time inactive soo i woun’t responed imedeatly or in short time