You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
Seem like this error is crashing my game, it only appears like a few minutes after I execute the game, I really dont know what can cause the issue
What is the issue? Include screenshots / videos if possible!
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Yes I did but found nothing with this specific problem
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
this is the code part that is calling the function:
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
I think the issue seen is that Spherecast’s parameters is getting something larger than 1024, which of course is making errors. (Don’t know what the crashes are from)
According to Spherecast’s documentation, the distance is taken from the third argument, which is also used as a direction for some reason?
So as a compromise, you could do something like this:
local sphereDirection = (projPos - currentPos).Unit * 1024
local hitBox = WorkSpace:Spherecast(currentPos, 2, sphereDirection, self.Params)