fun = workspace.CurrentCamera:GetPropertyChangedSignal("CFrame"):Connect(function()
if debounce == false then
debounce = true
local campos = workspace.CurrentCamera.CFrame.p
if (lastpos-Vector3.new(campos.X, 0, campos.Z)).Magnitude > seafunctions.basics.MaxDistanceBeforeBone/2 then
lastpos = Vector3.new(campos.X, 0, campos.Z)
getbones()
--if config.Value == true then task.wait(seafunctions.basics.RainingRange) else task.wait(seafunctions.basics.MaxDistanceBeforeBone/200) end
end
end
task.wait(coolDownTime)
debounce = false
end)
#any way i can do this faster and less laggier?
14 messages · Page 1 of 1 (latest)
function getbones()
warn("getting nearest bones..")
local campos = workspace.CurrentCamera.CFrame.p
table.clear(boners)
local counter = 1
table.sort(allbones, function(a, b) -- sorting so when i go down the list and find something out of range i can just stop and not process it all
local apos = Vector3.new(a.WorldCFrame.Position.X, campos.Y, a.WorldCFrame.Position.Z)
local bpos = Vector3.new(b.WorldCFrame.Position.X, campos.Y, b.WorldCFrame.Position.Z)
if (apos-campos).Magnitude < (bpos-campos).Magnitude then
return true
else
return false
end
end)
local counter = 1
if isitraining.Value == false then
for v, i in pairs(allbones) do
local pos = i.WorldCFrame.Position
if check(pos, seafunctions.basics.MaxDistanceBeforeBone) == false then
break
else
boners[counter] = i
counter+=1
end
end
elseif isitraining.Value == true then
for v, i in pairs(allbones) do
local pos = i.WorldCFrame.Position
if check(pos, seafunctions.basics.RainingRange) == false then
--if i.Transform == seafunctions.basics.NORMALTRANSFORM then else i.Transform = seafunctions.basics.NORMALTRANSFORM end
break
else
boners[counter] = i
counter+=1
end
end
end
warn("done getting nearest bones!", boners)
end
getting the nearest bones is laggy rn
any way i can make this go fast
this is very laggy
9 planes being used
1 second of frozen screen each time it runs
2704 bones per plane
you can try to thread getbones
man task
parralell lua?
kk i see
just threading like tasks and coroutine
👍