I've made a script which damages the player that touches the part, but only the 1st one of them...Is it possible so I can damage evryone it touches witha bool value in the part?

wait(3)
local debounce =  false
Player = script.Parent.Parent.Parent
n = script.Parent
mouse = Player:GetMouse()
run = game:GetService("RunService")
duh = 0

function pizza(mouse)
	if debounce == false then
		debounce = true
		local d = Instance.new("Part", Workspace)
		d.Size = Vector3.new(5, 5, 1)
		d.CanCollide = false
		d.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, 5, 0)
		d.Transparency = 1
		game.Debris:AddItem(d, 5)
		RS = Player.Character.Torso["Right Shoulder"]
		for i = 1, 15 do
			RS.C0 = RS.C0 *CFrame.Angles(-0.1, 0, 0)
			wait(0.01)
		end
		LS = Player.Character.Torso["Left Shoulder"]
		for i = 1, 15 do
			LS.C0 = LS.C0 *CFrame.Angles(-0.1, 0, 0)
			wait(0.01)
		end
		wait(0.1)
		local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=147722098"
SlashSound.Parent = d
SlashSound.Volume = .7
SlashSound:play()
		wait(.2)
			local x = Instance.new("Part")
			x.Shape = "Ball"
			x.Anchored = true
			x.CanCollide = false
			x.Reflectance = 0
			x.Transparency = 1
			x.TopSurface = "Smooth"
			x.BottomSurface = "Smooth"
			x.Parent = Workspace
			x.Size = Vector3.new(270.05, 70.48, 289.81)
			x.BrickColor = BrickColor.new("White")
			x.Name = Player.Name
			x.Parent = Workspace
			x.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, -3, 0)
			b = Instance.new("BoolValue", x)
			b.Value = false
			local x1 = Instance.new("Part")
			x1.Shape = "Ball"
			x1.Anchored = true
			x1.CanCollide = false
			x1.Reflectance = 0.1
			x1.Transparency = 0.8
			x1.TopSurface = "Smooth"
			x1.BottomSurface = "Smooth"
			x1.Parent = Workspace
			x1.Size = Vector3.new(150, 150, 150)
			x1.BrickColor = BrickColor.new("White")
			x1.Name = Player.Name
			x1.Parent = Workspace
			x1.CFrame = Player.Character.Torso.CFrame *CFrame.new(0, -3, 0)
			m = Instance.new("SpecialMesh", x1)
			m.MeshType = "Sphere"
			m.Scale = Vector3.new(2, 1, 2)
				x.Touched:connect(function(Part) 
    if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent:FindFirstChild("Humanoid") ~= Player.Character.Humanoid and b.Value == false then
			b.Value = true
			Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -30
			Part.Parent.Humanoid.Sit = true
			wait(0.1)
			Part.Parent.Torso.Velocity = Vector3.new(math.random(-500,500),650,math.random(-500,500))
	end
	wait(0.025)
				end)
				wait(1)
				for i = 1, 15 do
			RS.C0 = RS.C0 *CFrame.Angles(0.1, 0, 0)
			wait(0.01)
		end
		for i = 1, 15 do
			LS.C0 = LS.C0 *CFrame.Angles(0.1, 0, 0)
			wait(0.01)
		end
			game.Debris:AddItem(x, 5)
			game.Debris:AddItem(x1, 5)
	
	wait(60)
	debounce = false
	end
end


function onSelected(mouse)
	mouse.Button1Down:connect(function() pizza(mouse) end)
end

n.Selected:connect(onSelected)

3 comments

0

May we see the script

1

Not really sure what you're asking. Can you make damage occur to the person who touches if a value is true and not do anything when touched if the value is false? Yes, this is possible. Do you mean 1 person touches and everyone gets hurt? Yes, this is possible.

0

Sure, so I want that if more than one dummy/player(not me) touches the part, all of them take damage not just one of them.I edited so you can see the script.