Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Which Part of This Script Kills You?

I'm trying to make it so a Subspace Bomb is fixed (as in it won't suck you in and kill you) and I can't seem to find the part where it kills you. Here's the script without the part where it's getting bigger.

function onTouched(part)

	local h = part.Parent:findFirstChild("Humanoid")

	if h~=nil then

wait(0.001)
h.Health = 0
children = h.Parent:children()

	for i=1,#children do

		if(children[i].className == "Part" and children[i].Name ~= "Torso") then stick(children[i], h.Parent.Torso) end

		if(children[i].className == "Hat") then stick(children[i].Handle, h.Parent.Torso) end

	end

	h.Parent.Head.Velocity = h.Parent.Head.Velocity + Vector3.new(5,0,0)

	end

end



script.Parent.Touched:connect(onTouched)local hole = script.Parent

local childList = {}

local childSize = {}



local massConstant = 1



local mass = 200000 * massConstant



function checkObject(obj)

	if (obj ~= hole) and (obj.className == "Part") then

		if (obj.Anchored == false) then

			table.insert(childList, 1, obj)

			table.insert(childSize, 1, obj.Size)

		end

	else

		if (obj.className == "Model") or (obj == workspace) then

			local child = obj:GetChildren()

			for x = 1, #child do

				if (child[x] ~= hole) and (child[x].className == "Part") and (child[x].Anchored == false) then

					table.insert(childList, 1, child[x])

					table.insert(childSize, 1, child[x].Size)

				end

				if child[x].className == "Model" then

					checkObject(child[x])

				end

			end

			obj.ChildAdded:connect(checkObject)

		end

	end

end



checkObject(workspace)



function cross(v1, v2)

	return Vector3.new(v1.y * v2.z - v2.y * v1.z, v1.z * v2.x - v1.x * v2.z, v1.x * v2.y - v2.x * v1.y)

end



print("Black Hole script loaded.")

Getting bigger...

local min = 0

local max = 10

while true do

	wait()

	local n = 0

	while n < #childList do

		if n % 800 == 0 then

			wait()

		end

		n = n + 1

		local child = childList[n]

		if (child ~= hole) and (child.className == "Part") and (child.Anchored == false) then

			local relPos = hole.Position - child.Position

			if relPos.magnitude * 240 * massConstant < mass then

				child.RotVelocity = cross(child.CFrame.lookVector, relPos) * 20 / relPos.magnitude

				local canContinue = true

				if relPos.magnitude * 320 * massConstant < mass then

					local length = mass / (320 * relPos.magnitude * massConstant)

					if childSize[n].z * length >  relPos.magnitude * 2 then

						mass = mass + child:GetMass()

						child:Remove()

						table.remove(childList, n)

						table.remove(childSize, n)

						canContinue = false

						n = n - 1

					else

						child.CanCollide = false

					end

				end

				if canContinue then

					local motivator = child:FindFirstChild("BlackHole Influence")

					if motivator == nil then

						motivator = Instance.new("BodyPosition")

						motivator.Parent = child

						motivator.Name = "BlackHole Influence"

					end

					motivator.position = hole.Position

					motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (relPos.magnitude * massConstant)

				end

			else

				local motivator = child:FindFirstChild("BlackHole Influence")

				if motivator ~= nil then

					motivator:Remove()

				end

			end

		end

	end

end


1 answer

I think it is h.Health = 0 where "h" refers to "humanoid"

So to explain more, h.Humanoid gets the health of the humanoid to change it. While number 0 changes the humanoid's health to 0 and kills him.

I am not sure about that, try it and tell me if it works.

2 comments

0

It didn't work, but I found a solution. Stay at least 25 studs away or it will start to pull you in.

0

Congratulations!

This discussion is preserved as it was. New answers, comments, and votes are closed.