So I need help detecting if the player can place blocks if its not over the void or if the block is not hitting any parts.
I want it to auto place blocks instead of detecting the player mouse hit.
I need to check if it can place blocks inside the bubble.
1 Like
I would use Raycasting in this situation. Or make an invisible hitbox attached to the player. Then you can have a loop check all the things you need it to check.
You can check if the result actually exists:
local result = game:GetService("Workspace"):Raycast(mouseray.Origin, mouseray.Direction * 1000, raycastparams)
where mouseray
= mouse.UnitRay
. If result does not exist (i.e. if not result then
), it means it is in the void. You can also use result.Instance
to check what instance the mouse (ray) is on, thus you can choose which places blocks can or can’t be placed on.
1 Like
I actually decided to change this up a bit. I want to do this:
![image](//devforum-uploads.s3.dualstack.us-east-2.amazonaws.com/uploads/original/5X/6/f/5/4/6f54c05379e7728badc6853bb63242e8b5d3cc69.png)
I want to raycast at an angle.
I’m confused - is your game locked first person? Does this rely on camera or on the mouse?
Either way, this should still work as the above method works based on mouse position, which influences the camera in first person.
No, I want to raycast at the lookvector but down 40 angle.