Ignored String Value to Touch Problem for my Eletric Ball

Hi There, So, i’ve Added an Eletric Ball Tool that allow us to create our own Eletric Ball, We Can Pick Eletric Ball Back Up 5 Seconds Later. But, I Got a Problem for my Eletric Ball, i was trying to Catch a Eletric ball using Eletric Ball Tool, But, it completely Ignored it and i got killed by my own Eletric Ball.

Here’s the Main of Eletric Ball Script Script:

local Health = script.Parent.ShockHealth.Value
local Speed = script.Parent.Velocity.Magnitude

script.Parent.Touched:Connect(function(hit)
	if script.Parent.Velocity.Magnitude >= 120 then
		if script.Parent.Velocity.Magnitude >= 120 * 2 then
			if hit.Mass <= 500 and hit.CanCollide == true and hit:FindFirstChildOfClass("WeldConstraint") or hit:FindFirstChildOfClass("Weld") then
				if hit:FindFirstChildOfClass("WeldConstraint") then
					hit:FindFirstChildOfClass("WeldConstraint"):Destroy()
				end
				if hit:FindFirstChildOfClass("Weld") then
					hit:FindFirstChildOfClass("Weld"):Destroy()
				end
				script.Parent.HardImpactSpeeding:Play()
				script.Parent.HitWhileSpeeding:Play()
				script.Parent.PartBreak:Play()
				script.Parent.ShockHealth.Value -= math.floor(script.Parent.Velocity.Magnitude/10)
				local explosion = Instance.new("Explosion")
				explosion.Position = hit.Position
				explosion.BlastRadius = 5
				explosion.ExplosionType = Enum.ExplosionType.NoCraters
				explosion.Parent = workspace
			end
		end
		if hit.Mass <= 250 and hit.CanCollide == true and hit:FindFirstChildOfClass("WeldConstraint") or hit:FindFirstChildOfClass("Weld") then
			if hit:FindFirstChildOfClass("WeldConstraint") then
				hit:FindFirstChildOfClass("WeldConstraint"):Destroy()
			end
			if hit:FindFirstChildOfClass("Weld") then
				hit:FindFirstChildOfClass("Weld"):Destroy()
			end
			script.Parent.HardImpactSpeeding:Play()
			script.Parent.HitWhileSpeeding:Play()
			script.Parent.PartBreak:Play()
			script.Parent.ShockHealth.Value -= math.floor(script.Parent.Velocity.Magnitude/20)
			hit.CanCollide = true
			local explosion = Instance.new("Explosion")
			explosion.Position = hit.Position
			explosion.BlastRadius = 3
			explosion.ExplosionType = Enum.ExplosionType.NoCraters
			explosion.Parent = workspace 
		end
		if hit.Parent.Name ~= script.Parent.Owner.Value then
			if hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 then
			hit.Parent.Humanoid.Health = 0
			script.Parent.HitWhileSpeeding:Play()
			script.Parent.HardImpactSpeeding:Play()
			script.Parent.ShockHealth.Value -= math.floor(script.Parent.Velocity.Magnitude/150)
			script.Parent.Combo:Fire()
			local explosion = Instance.new("Explosion")
			explosion.Position = hit.Position
			explosion.BlastRadius = 0
			explosion.ExplosionType = Enum.ExplosionType.NoCraters
			explosion.Parent = workspace
			end
		end
	elseif script.Parent.Velocity.Magnitude >= 40 then
		if hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and hit.Parent.Name ~= script.Parent.Owner.Value then
			hit.Parent.Humanoid.Health = math.floor(script.Parent.Velocity.Magnitude/120)
		end
	end
end)

while wait() do
	script.Parent.PointLight.Brightness = script.Parent.Velocity.Magnitude/9
	script.Parent.Moving.Volume = script.Parent.Velocity.Magnitude/60
	script.Parent.Size = Vector3.new(script.Parent.ShockHealth.Value/15 + 2, script.Parent.ShockHealth.Value/15 + 2, script.Parent.ShockHealth.Value/15 + 2)
	if script.Parent.ShockHealth.Value <= 0 then
		break
	end
	if script.Parent.Velocity.Magnitude >= 120 * 2 then
		script.Parent.Material = Enum.Material.Neon
		script.Parent.BrickColor = BrickColor.new("White")
		script.Parent.Speeding:Resume()
		script.Parent.SuperSpeeding:Resume()
		script.Parent.ShockHealth.Value -= 0.02 * script.Parent.Velocity.Magnitude/175
		script.Parent.Trail.Enabled = true
		script.Parent.Particle.ParticleEmitter.Enabled = true
	elseif script.Parent.Velocity.Magnitude >= 120 then
		script.Parent.Material = Enum.Material.Neon
		script.Parent.BrickColor = BrickColor.new("White")
		script.Parent.Speeding:Resume()
		script.Parent.SuperSpeeding:Pause()
		script.Parent.Trail.Enabled = true
		script.Parent.Particle.ParticleEmitter.Enabled = true
	else
		script.Parent.Material = Enum.Material.SmoothPlastic
		script.Parent.BrickColor = BrickColor.new("Toothpaste")
		script.Parent.Speeding:Pause()
		script.Parent.SuperSpeeding:Pause()
		script.Parent.Trail.Enabled = false
		script.Parent.Particle.ParticleEmitter.Enabled = false
	end
end

--explode effect
script.Parent.Moving:Play()
local explosion = Instance.new("Explosion")
explosion.Position = script.Parent.Position
explosion.BlastRadius = 15
explosion.ExplosionType = Enum.ExplosionType.Craters
explosion.Parent = workspace
script.Parent:Destroy()

The Problem is Located on 43th Line.
Any Solutions?

2 Likes

Most Roblox tools have a creator object value in them so they don’t damage themselves or they know who hit the other player. You can use that.

1 Like

But, it still killed me, Show a Solution Script Please?

1 Like

I don’t have the time at the moment to write that script.

Simply just make the tool not damage the player who used the Electric Ball