-
What do you want to achieve? Make my 4D engine I was going to release as part of Project Sand Cat as a demo for what libraries and games will stem from what I will release when the 4D engine I was developing was done. I am making the 4D engine because I need to practice scripting.
-
What is the issue? After the limit for size gets exceeded 2 times and will call itself 2 times when the increase4d function is called once it will not change the size of an object and will just error on the else function 4997 times. First time it did this it filled the module with the log when moving my mouse around.
-
What solutions have you tried so far? I haven’t tried any yet. I am afraid to crash my laptop and corrupt Windows.
This is the code that was giving me issues
local function changeSize(object)
local defaultSize = get4d(object)[2]
local newSize = Vector3.new(defaultSize.X + get4d(object)[3],defaultSize.Y + get4d(object)[3],defaultSize.Z + get4d(object)[3])
object.Size = newSize
end
function module.change4D(object, isAddition, number)
local function add(bool, intvalue)
if isAddition then
if get4d(object)[3] > module.MaximumSize or (get4d(object)[3] + intvalue) > module.MaximumSize then
local correctValue = (get4d(object)[3] + intvalue) - module.MaximumSize
add(false,correctValue)
else
get4d(object)[3] += intvalue
end
else
if get4d(object)[3] < -module.MaximumSize or (get4d(object)[3] - intvalue) < -module.MaximumSize then
local correctValue = (get4d(object)[3] - intvalue) + module.MaximumSize
add(true,correctValue)
else
get4d(object)[3] -= intvalue
end
end
end
if is4d(object) then
add(isAddition, number)
changeSize(object)
else
error("Expected 4D object, not 3D object.")
end
end
I ran this until it would be the first time it gets the correctValue and returns it is also over 10 so it would reset back to 0 but it just doesn’t
_G["4DService"].change4D(game.Workspace.Baseplate, true, 11)