Minecraft-like Roblox block game rblx.games/135624152691584
roblox roblox-game rojo
at main 48 lines 1.2 kB view raw
1return { 2 Name = "resyncnear", 3 Aliases = {"resyncnearby"}, 4 Description = "Resync chunks around a player's current chunk.", 5 Group = "Debug", 6 Args = { 7 { 8 Type = "player", 9 Name = "player", 10 Description = "Player to resync" 11 }, 12 { 13 Type = "integer", 14 Name = "radius", 15 Description = "Radius around the player chunk", 16 Optional = true, 17 Default = 1 18 } 19 }, 20 Run = function(context, player, radius) 21 local character = player.Character 22 if not character then 23 return "Player has no character" 24 end 25 local root = character:FindFirstChild("HumanoidRootPart") 26 if not root then 27 return "Player has no HumanoidRootPart" 28 end 29 30 local pos = root.Position 31 local cx = math.round(pos.X / 32) 32 local cy = math.round(pos.Y / 32) 33 local cz = math.round(pos.Z / 32) 34 35 local tickRemote = game:GetService("ReplicatedStorage"):WaitForChild("Tick") 36 local r = radius or 1 37 local count = 0 38 for y = -r, r do 39 for x = -r, r do 40 for z = -r, r do 41 tickRemote:FireClient(player, "C_R", cx + x, cy + y, cz + z, 0, 0, 0, 0) 42 count += 1 43 end 44 end 45 end 46 return ("Resync sent to %s (%d chunks around %d,%d,%d)"):format(player.Name, count, cx, cy, cz) 47 end 48}