Hello, so i have this script and im trying to check if the part it hit name is “FireDebris” but for some reason its still being able to hit it
elseif hit:IsA("BasePart") then
local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
if ehum and ehum ~= player.Character.Humanoid then
print("hit humanoid")
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local FireDebris = game.ReplicatedStorage.FireRelease.FireDebris:Clone()
FireDebris.Parent = workspace
FireDebris.Position = ehum.Parent.HumanoidRootPart.Position
local Explode = game.ReplicatedStorage.FireRelease.Explode:Clone()
Explode.Position = ehum.Parent.HumanoidRootPart.Position
Explode.Parent = workspace
for i, v in pairs(Explode.AMain:GetChildren()) do
v:Emit()
end
local FireHitSound = script.Parent.FlameHitSound:Clone()
FireHitSound.Parent = FireDebris
FireDebris.FlameHitSound:Play()
Debris:AddItem(Explode, 3)
Debris:AddItem(FireDebris, 5)
bullet:Destroy()
ehum:TakeDamage(damage)
else
if hit.Parent.Name ~= "FireDebris" or hit.Parent.Parent.Name ~= "FireDebris" then
print("HitPart")
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local FireDebris = game.ReplicatedStorage.FireRelease.FireDebris:Clone()
FireDebris.Parent = workspace
FireDebris.Position = bullet.Position
local Explode = game.ReplicatedStorage.FireRelease.Explode:Clone()
Explode.Position = bullet.Position
Explode.Parent = workspace
for i, v in pairs(Explode.AMain:GetChildren()) do
v:Emit()
end
local FireHitSound = script.Parent.FlameHitSound:Clone()
FireHitSound.Parent = FireDebris
FireDebris.FlameHitSound:Play()
Debris:AddItem(Explode, 3)
Debris:AddItem(FireDebris, 5)
bullet:Destroy()
end
I want it to only do the stuff if its the parts name is not equal to that, if it does touch a part thats named that, i want it to just not do anything and contunue, but after touching it, it doesnt do the code if it touches a part thats not named that. If it makes any sense
Yeah so if that doesn’t work, you could possibly parent the fire particles to a folder in workspace instead of just workspace, then use the same code except check if it is a descendant of it:
FireDebris.Parent = workspace.FireFolder
if hit:IsDescendantOf(workspace.FireFolder) == false then
THis works the exact same as my other script, it allow it to go through without touching it, but if it touches something after touching the FireDebris then it wont do anything
I don’t really see a reason in this portion of the code as to why it wouldn’t. I would recommend to debug you just print every part it hits that is a base part and comment out the rest:
If it hits the parts past the fire part, then it is a problem in this portion, but if it doesn’t hit the parts past it, then it’s a problem outside of this
elseif hit:IsA("BasePart") then
print(hit.Name)
--[[local ehum = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:findFirstChild("Humanoid")
if ehum and ehum ~= player.Character.Humanoid then
print("hit humanoid")
I’ll need to see a little more of your code to have a better understanding of what is going wrong. Important parts such as the event that connects this function and the rest of the if statement
Well can i just say that the ability is a fireball, And when it touches a part the ability explodes. But firedebris is sopposed to appear where it exploded and when the player touches it, they take damage. But, the fireball is able to touch the part that Holds the firedebris particle making it explode(which i dont want). I could just make it so that the part that holds the particle cant be touched, but then the player cant be damaged
So what is the desired sequence of events? You shoot the fireball, the fireball explodes, if a player touches the debris they take damage? I’m just confused on what the current sequence of events are and where the issue is taking place. Does it take place after the fireball explodes? Does it take place right when you shoot it?
No the fireball disappears, but the the debris replaces it, the after 3 seconds, the debris gets deleted, and the debris works as intended, but since the debris is touchable, if you shot a fireball, then shoot on again before the debris gets deleted, the fire ball disappears when touching the fire debris, but i dont want it to explode when touching it lmao, i kinda just want the fireball to ignore it and be able to go through the fire debris
Do you have a debounce anywhere? Also, did you try seeing if the hit function registers parts after hitting the firedebris by using a print(hit.Name)? If it’s able to ignore the firedebris but just doesn’t work afterwards either it’s not registering parts for some reason or there’s a delay in the hits it registers. Also I would recommend changing this if hit.Parent.Name ~= "FireDebris" or hit.Parent.Parent.Name ~= "FireDebris" then to this if hit.Parent.Name ~= "FireDebris" and hit.Parent.Parent.Name ~= "FireDebris" then because if one of those returns true but the other returns false then the statement will be satisfied and the code will run