Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- multi-hitting raycast for LUA. This is using the program ROBLOX.
- --Any questions involving it ask here
- https://devforum.roblox.com/t/a-multi-hitting-raycast/2308623/3
- -- This is property of me so deal with it kid
- -- code
- local module = {}
- function module.Raycast(po1,po2,ignoreParts)
- local ignoreTable = {table.unpack(ignoreParts)}
- local params = RaycastParams.new()
- params.FilterDescendantsInstances = {ignoreTable}
- params.IgnoreWater = true
- params.FilterType = Enum.RaycastFilterType.Blacklist
- local finished = false
- local hitItems = {}
- repeat
- local params = RaycastParams.new()
- params.FilterDescendantsInstances = {ignoreTable}
- params.IgnoreWater = true
- params.FilterType = Enum.RaycastFilterType.Blacklist
- local raycast = workspace:Raycast(po1,po2 - po1,params)
- if raycast then
- -- we made a raycast!
- if raycast.Instance then
- -- we hit something.
- table.insert(hitItems,raycast.Instance)
- table.insert(ignoreTable,raycast.Instance)
- warn('Hit item '..raycast.Instance.Name)
- else
- -- there was nothing there.
- finished = true
- warn('Nothing hit!')
- end
- task.wait()
- else
- warn('No raycast')
- finished = true
- end
- task.wait()
- until finished == true
- task.wait()
- return hitItems
- end
- return module```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement