Everytime I walk into a new 50 by 50 chunk, it’s supposed to create a part. However, it seems it’s slightly off from where it should be. It’s visible in the video.
There are two problems with my chunk loader:
- It doesn’t load the chunk till it’s halfway in it.
- It sometimes loads chunks it shouldn’t.
local CurrentChunkPosition = math.floor(HumanoidRootPart.Position.X / 50) .. math.floor(HumanoidRootPart.Position.Z / 50)
if ChunkPosition ~= CurrentChunkPosition then
ChunkPosition = CurrentChunkPosition
local a = Instance.new("Part")
task.synchronize()
a.Parent = workspace
a.CanCollide = false
a.Anchored = true
a.Position = Vector3.new(math.floor(HumanoidRootPart.Position.X / 50) * 50, 0, math.floor(HumanoidRootPart.Position.Z / 50) * 50)
a.Size = Vector3.new(50,50,50)
end
This is my script. It’s ran in parallel and uses RunService.Heartbeat. I don’t know why it’s not working right. I believe the problem is how I handle chunk alignment, which is written in the first line of the script.
Some things for context:
-
I won’t change RunService.Heartbeat. It’s used for my anticheat and it’s relatively optimized, under 1% script activity for 8 players. I used Heartbeat so I never miss a frame of character movement.
-
Please suggest solutions/ideas that don’t involve me creating any sort of parts. I’m trying to make everything serversided and having no impact on the actual game. I really don’t want to use .Touched or any other call that would mean I have to create parts/objects in Workspace.
Any help is appreciated a lot!!
