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!
I want, when a part collides to something, to make a raycast from the part to the direction the part is going to detect if the collision was in front of it. -
What is the issue? Include screenshots / videos if possible
I made a print to see if it works but it doesn’t print… here is the script:
script.Parent.Touched:Connect(function(collisionPart)
local raycastParams = RaycastParams.new()
print("c")
local raycast = workspace:Raycast(script.Parent.Position , script.Parent.Velocity, raycastParams)
if raycast then
print("r")
end
end)
here is a gif:
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I read again the documentation, and tried to replace Velocity byVector3.new(0,-1,0)
as the part is falling down, to see if velocity was the problem. Anyone has an idea? Thank you in advance.
tried adding this:
raycastParams.FilterDescendantsInstances = {script.Parent}
raycastParams.FilterType = Enum.RaycastFilterType.Exclude