Hello, I want to create a beam that when he touch the boss, the boss is hurt. But i don’t know how to make the detection when the beam part and humanoidrootpart of the boss (they are anchored and the beam part don’t have collision).
Can someone help me ? : (
Here a video :
Are you saying you want the boss to take damage when the player is hit by the beam? An easy option for you is to raycast from where the beam starts, to the direction it is going.
No, I want the beam to take damage when the beam passes over it, but I don’t know how to do it because both parts are anchored and collision is disabled.
Oh, do you mean when the beam passes over the boss? You can make a raycast from where the beam starts and in the direction it is going and check if the instance from the result is a child of the boss. Then, deal damage.
Sorry, but I’ve never used raycast and couldn’t do the script
local handAttachment = workspace.Hand.Attachment
local boss = workspace.Boss
local result = workspace:Raycast(handAttachment.WorldPosition, handAttachment.WorldCFrame.LookVector * 100)
if not result or result.Instance.Parent ~= boss then return end
Here’s some code that can help you out, just make sure to turn the attachment like shown in the video.
You could make an invisible kill part maybe…underneath the beam? (and traveling with it)
A part is already undernear the beam, but the two parts are anchores, the touched() event is not working.
Try putting this script in the part, and changing the code to your needs.
local part = [partLocation]
It don’t work…
Here a video of the test :
How does your attachment look?
I tried with a part and it work
Are you getting any errors in the console?
I think I can add a anchored part with collision because I think it’s because the boss don’t have collision
It work, thank you dor helping !
Hi, I have another problem… Can you help me again
The raycast detect ce part where the player walk but not the boss, why ? The raycast detect the boss only if only the boss is in the raycast…
That’s what a raycast does, it detects anything that the ray ‘hits’.
Yes but he detect only the base part and not the bosses part : ( like he have priority on certains parts.