Nothing is working. I cannot get KILLZONE to detect if a part from a character. I've actually tried everything I can think of [SOLVED]

But the character does. Roblox adds a CollisionGroup to the Character when they spawn in. I’d recommend finding a way to set your KILLZONE the same CollisionGroup as the Player.

I am an independent advisor here to help. Please try these steps in order and message me the output:

  1. print the returned table from :GetPartsInPart()
  2. print the returned table from :GetPartsInBoundingBox()
  3. make sure CanQuery is turned on, and constantly on, for every single part in your game.
  4. Make sure all above changes have been made. Make the KILLZONE stationary, and observe.

If none of the above work, I’d be happy to help in private if you’re willing to provide the files containing this independent system, or the entire Studio, in my own time, if you can provide a payment of at minimum 5$ or 1,200R$. I will treat this as a professional commission. Finalized satisfactory files will be exported upon receival of stated payment.

2 Likes

Output of Moving Part:

{} --GetPartsInPart() [I knew this existed]
{ --GetPartBoundsInBox() [wow, I never knew this existed]
                    [1] = KILLZONE,
                    [3] = Handle,
                    [4] = Handle,
                    [5] = LeftLowerLeg,
                    [6] = Handle,
                    [7] = RightLowerLeg,
                    [8] = Handle,
                    [9] = RightUpperLeg,
                    [10] = Handle,
                    [11] = LeftUpperLeg,
                    [12] = Handle,
                    [13] = RightHand,
                    [14] = Handle,
                    [15] = Handle,
                    [16] = RightLowerArm,
                    [17] = LowerTorso,
                    [18] = LeftLowerArm,
                    [19] = Handle,
                    [20] = HumanoidRootPart,
                    [21] = UpperTorso,
                    [22] = LeftHand,
                    [23] = RightUpperArm,
                    [24] = LeftUpperArm,
                    [25] = Handle,
                    [26] = Handle,
                    [27] = Handle,
                    [28] = Head,
                    [29] = Handle
}

Thank you so much for telling me about :GetPartBoundsInBox square_smile

2 Likes

Orientation is hard, don’t worry, you can only gain knowledge.

2 Likes

It’s not true that Touched event doesn’t work with non-collideable parts.

You can put a script inside the kill part:

script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.Humanoid.Health = 0
	end
end)

If you don’t want the Touched event to fire too many times, just use a debounce or set the part to CanTouch false when someone touches the part:

local debounce = true
script.Parent.Touched:Connect(function(hit)
	if hit and hit.Parent:FindFirstChild("Humanoid") then
		if debounce == true then debounce = false
			hit.Parent.Humanoid:TakeDamage(33) -- or hit.Parent.Humanoid.Health = #
			task.wait(1)
			debounce = true
		end
	end
end)

But if you are doing this on the server side only and also using a debounce or setting it to CanTouch false, then while it can’t be touched because it’s killing one player, other players won’t be harmed. So you can use a LocalScript to do the touching while using a remoteevent to send it to a server script to do the killing.
image
TouchingScript:

local character = script.Parent
local root = character:WaitForChild("HumanoidRootPart")

local remote = script:WaitForChild("RemoteEvent")

local debounce = true
root.Touched:Connect(function(hit)
	if hit and hit.Name == "KillPart" then
		if debounce == true then debounce = false
			remote:FireServer()
			task.wait(1)
			debounce = true
		end		
	end
end)

KillScript:

local remote = script.Parent:WaitForChild("TouchingScript"):WaitForChild("RemoteEvent")

remote.OnServerEvent:Connect(function(player) -- player is always the first argument in a remoteevent on the serverside
	--player.Character.Humanoid.Health = 0
	--or
	player.Character.Humanoid:TakeDamage(33)
end)

If you want the player to be killed with just the TouchingScript (LocalScript) and be killed instantly, you can use the Humanoid.ChangeState:

local character = script.Parent
local root = character:WaitForChild("HumanoidRootPart")

local debounce = true
root.Touched:Connect(function(hit)
	if hit and hit.Name == "KillPart" then
		if debounce == true then debounce = false
			character.Humanoid:ChangeState(Enum.HumanoidStateType.Dead)
			task.wait(1)
			debounce = true
		end		
	end
end)

This ^ is incorrect and bad practice. Please ignore the above message, everyone!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.