Hello, i want to make infinity platform generator but its not generating.
here is code
local TICKS_PER_UPDATE_CYCLE = 30
local updateCount = 0
repeat
if (updateCount == 0) then
if script.Parent:FindFirstChild("HumanoidRootPart") then
local humRP = script.Parent:FindFirstChild("HumanoidRootPart")
if humRP.Velocity.Magnitude >0 then
for x = humRP.Position.X - 100, humRP.Position.X + 100,1 do
if x%15 == 0 then
for z = humRP.Position.Z - 100, humRP.Position.Z + 100,1 do
if z%15 == 0 then
local chunkExists = false
for index, chunk in ipairs(game.Workspace.World:GetChildren()) do
if chunk.Position.x == x and chunk.Position.z == z then
chunkExists = true
break
end
end
if not chunkExists then
local clone = game.ReplicatedStorage.Part:clone()
clone.Position = Vector3.new(x,0,z)
clone.Parent = game.Workspace.World
end
end
end
end
end
end
end
end
updateCount = (updateCount + 1) % TICKS_PER_UPDATE_CYCLE
until not wait()
I put it in Starter character script and even with this it didnt work:
for count,player in pairs(game.Players:GetChildren()) do
if player.character.HumanoidRootPart then
local humRP = player.character.HumanoidRootPart
if humRP.Velocity.Magnitude >0 then
Part in replicated storage size is 15,1,15
What wrong in my code?