#hey i need help with raycasting
1 messages · Page 1 of 1 (latest)
** You are now Level 2! **
local start = game.Workspace.start --assuming you have a part in workspace named start)
local End = game.Workspace.End --assuming u have a part named end)
local direction = End.Position - start.Position
local params = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {game.Workspace.Baseplate}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
local direction = End.Position - start.Position
local raycastResult = workspace:Raycast(start.Position, direction, raycastParams)
if raycastResult then
print(raycastResult)
end
ima go now bye
bye 👋
yeah but who wrote this code?
me
what was with all the comments you deleted?
i added some comments
people might flame me
it's easier if you just tell me if it was ai or a friend, it makes it easier to help you
it was me
that's not what the code comments suggested, and it would be nice if you left them in/added them back in for better understanding what is going on with this since you don't describe what the problem is (if any). either way, whoever wrote it, the advice doesn't really change; use https://create.roblox.com/docs/reference/engine/datatypes/RaycastParams#AddToFilter instead of setting .FilterDescendantsInstances directly (i've found setting the table directly to be a bit glitchy), and make sure your ray isn't backwards (negate the direction), and take steps to guarantee the ray will hit something (i.e make sure the code is running without errors or warnings incl. waitforchild infinite yield warnings) etc also given the simplistic nature of the code you show (proof of concept by the look of it), maybe add a task.wait(5) to the top so it waits 5 seconds after the game starting before the ray is cast, beyond all that, more details bruh
I think it’s a friend, AI writes comments better than that.
there were more comments, on practically every line, but op deleted them. looks like a friend wrote it, ai doesnt write comments like that
pass this onto friend 👍
Ahhh, well either way.
Ok, well I’m not here to help, just look at stuff.
So you can forget what you defined for the variables "start" and "End" at any moment ?
?
gng you havent even told us what is wrong.
the script wont print raycast result
also gng u said u not gon help
print(raycastResult.Result)
wat