Look, before anyone flags this because of duplicate topics, my old topic hasn’t been replied to in like 8 hours and I still need my problem solved.
I’m making a lightning module, and I need points to show where the lightning, well, bends a bit? (I’m not a lightning expert, okay?) I want the points to be a bit spread out on a line (Well, I mean take out all the points where the lightning bends and it’s a line, isn’t it?) I kind of did it, but it still isn’t solved… Here’s the part of my code which is responsible for doing this:
local lastNumTable = tableOfLerps[#tableOfLerps] --Gets the last indexed item in table
local lastnum = lastNumTable[2] --Gets the alpha of the lerp
if lerpAlpha < lastnum and (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2)) then --Makes sure that all points should be in order AND when subtracted, should give a difference of 0.3 or higher, else the condition is fulfilled
repeat --Repeats the process of making the CFrame for the next point so that it does not fulfill the conditions above.
lerpAlpha = random:NextNumber()
lerpCFrame = point1.CFrame:Lerp(point2.CFrame, lerpAlpha)
until not (lerpAlpha < lastnum) and not (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2))
end
Assume that I already created a point 1 and 2. When creating point 2, I ignore part 1, creating the possibility that part 3 will be near part 1.
Solutions I thought of
for i, v in ipairs: Suppose I check the 2nd v. Does it still take the 1st v into account when checking? NO!
No one here is obligated to help you with anything. There is nothing stating that people have to help you with your issue. Don’t act like people are supposed to do such. It is the choice of others to decide to help you.
Remember to be patient in the event someone does reach out to you. 8 hours is not a very long time to have waited for a FREE SERVICE offered by other developers, and it’s very possible anyone who would have helped you were asleep due to timezone differences.
Don’t post more than one topic for the same issue. If you ABSOLUTELY need to “repost” something, you should bump the topic you already made.
If you needed something done this instant, and you cannot be bothered to wait just a day or two to see if anyone would kindly help you with your issue, you’d have been better off commissioning someone from the Talent Hub.
That all said, I don’t understand what you’re trying to accomplish. Could you please either post more code or go into more detail?
I have 2 parts, part A and part B. My current module makes 3-5 points. Let’s say it makes 3 points, point 1, point 2, and point 3. First it creates the CFrames for the points. When it creates point 1’s CFrame, there are no other points yet so the code runs as normal. When point 2’s CFrame is created, the code checks if there is already a table for point 1’s CFrame, which contains the CFrame and the lerp alpha. (which I added in another bit of code I haven’t sent) Now it checks if lerpAlpha < lastnum and (math.abs(lerpAlpha - lastnum) >= 0.2 or (math.abs(lastnum - lerpAlpha) >= 0.2)), or in simple words, if point 2’s CFrame is too close to point 1’s CFrame. If the condition is fulfilled, it repeats generating a random lerp alpha for the CFrame lerp until the condition is false. Everything functions as it’s supposed to until it makes part 3’s CFrame. The code is designed to check the last created point’s CFrame, in this case point 2’s CFrame. Since it doesn’t take point 1 into account, there’s the possibility of point 3 being close to point 1, which I’m trying to fix.
I only have 1 robux from Premium Payouts, I can’t afford commissioning