This statement isn't working or returning any errors. I posted more of the code below the problem lines if you need to look at it.
if humanoid then
coroutine.resume(coroutine.create(function()
hitPart.Decal:Destroy()
particles.Texture = "rbxassetid://233246818"
particles.Enabled = true
wait(1)
particles:Destroy()
end))
humanoid:TakeDamage(damage)
print(damage)
else
coroutine.resume(coroutine.create(function()
particles.Texture = "rbxassetid://233246818"
particles.Enabled = true
wait(1)
particles:Destroy()
end))
end
Either way if humanoid exists or it doesn't it should change the texture of the particles and enable them. However it does not do either. When looking at the code below, hitPart is created and placed, decal is created, particle emitter is created.
--All of needed code below this line--
hitPart = Instance.new("Part")
hitPart.Anchored = true
hitPart.FormFactor = "Custom"
hitPart.Size = Vector3.new(1,1,.1)
hitPart.CFrame = SurfaceCFrame
hitPart.Transparency = 1
hitPart.Parent = workspace.IgnoreModel
game.Debris:AddItem(hitPart,7)
local decal = Instance.new("Decal",hitPart)
decal.Face = "Front"
particles = Instance.new("ParticleEmitter",hitPart)
particles.Enabled = false
particles.Size = .5
particles.Texture = "rbxassetid://233246818"
particles.Acceleration = Vector3.new(0,-10,0)
particles.Lifetime = 1,1.2
particles.Rate = 20
particles.Rotation = 0,180
particles.RotSpeed = 0,10
particles.Speed = 5,5
particles.VelocitySpread = 10
if hit.Parent:FindFirstChild("Humanoid") then
humanoid = hit.Parent.Humanoid
elseif hit.Parent.Parent:FindFirstChild("Humanoid") then
humanoid = hit.Parent.Parent.Humanoid
else
humanoid = nil
end
if humanoid then
coroutine.resume(coroutine.create(function()
hitPart.Decal:Destroy()
particles.Texture = "rbxassetid://233246818"
particles.Enabled = true
wait(1)
particles:Destroy()
end))
humanoid:TakeDamage(damage)
print(damage)
else
coroutine.resume(coroutine.create(function()
particles.Texture = "http://www.roblox.com/asset/?id=233246818"
particles.Enabled = true
wait(1)
particles:Destroy()
end))
end

2 comments
Can you not just set it like that? I didn't think you had to predefine it
Try it.