Help with Raycast-Based explosion system

  1. What do you want to achieve?
    raycast-based explosion system

  2. What is the issue?
    it does cast rays, but its like misses the character, but if i put the character like on top (close) of the explosion part, it still doesn’t work, here’s the video
    upload.systems | RobloxStudioBeta_f73fQh9lWD.mp4

  3. What solutions have you tried so far?
    tried recreating my damage system and ifDamagable function
    also tried searching on devforum but didn’t really help

-- doesn't really want to send the entire script but here's what could help
local function isDamageablePart(part)
	if part:IsA("BasePart") or 
		part.Parent == nil or 
		part.Parent == workspace.Terrain or 
		part == script.Parent then
		return false
	end

	-- Look directly for the character containing a humanoid
	local character = part:FindFirstAncestorWhichIsA("Model")
	if character and character:FindFirstChildWhichIsA("Humanoid") then
		return true
	end

	return false
end
6 Likes

whats this for? character’s parts such as right arm torso etc counts as basepart too, with the way it is rn it wouldn’t return true even if it directly hits a character

2 Likes

Should i remove just that or anything else?

3 Likes

yeah removing that should be fine

2 Likes

still doesn’t work
https://uploadi.ng/NxfrHU92

3 Likes

that raycast is just not suitable for some explosion like that, the solution i gave isn’t about the way u make raycasts but about when the raycast hits. so as long as the raycast doesn’t hit the solution i gave you would not work.
i wouldn’t suggest detecting if player is in the explosion zone or not with raycasts

1 Like

how can i use the explosions then, becuz the default roblox explosions is just kill pople thru walls

2 Likes

Hello, you could use workspace:GetPartBoundsInRadius(), and then check if the parts are players. If they are, ray cast the distance and if it doesn’t hit anything, they take damage.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.