I'm having problems with killpart

I am having a lot of problems
I created a tag and CollectionSevices for kill parts. There are some times that in roblox studio the kill parts work, and when I publish it to the game, it just doesnt work anymore.

  1. What do I want to achieve?
    whenever I touch the killparts, either my health goes to 0, or it removes 100 HP from the player

  2. What solutions have you tried so far?
    I have tried sizing the parts, making them bigger, make them can-collide able, ungroup the models, but still nothing happens. And all of the parts have that tag and are enabled.
    It doesn’t show any errors, and sometimes the kill part just do and sometimes it doesn’t kill. I also tried making the TakeDamage(20) and in studio it does work, but then in roblox it DOES NOT!
    I did make sure that the killparts aren’t duplicated, so there is no 50/50 % chance of dying/surviving, I do not know what to do anymore.

These are the scripts : There is no name error I think.

local CollectionService = game:GetService("CollectionService")

local killbrick = CollectionService:GetTagged("Killbrick")

for _, killbrick in pairs(killbrick) do
	
	killbrick.Touched:Connect(function(hit)
		if hit.parent:FindFirstChild('Humanoid') then
			hit.parent.Humanoid:TakeDamage(100)
			
		end
	end)
	
end
local CollectionService = game:GetService("CollectionService")

local AlmostKillbrick = CollectionService:GetTagged("AlmostKillbrick")

for _, AlmostKillbrick in pairs(AlmostKillbrick) do
		AlmostKillbrick.Touched:Connect(function(hit)
		if hit.parent:FindFirstChild('Humanoid') then
			hit.parent.Humanoid:TakeDamage(20)
			
		end
	end)

end

How are you adding the tags? maybe becouse is in the real roblox server, is a bit slower and you get the :GetTagged() before tagging the parts, maybe try waiting a second or adding the tags manually if you dont add then with a script

Check in roblox for errors writing “/console” in the chat

And add a print in the touch event of both type of parts, debugging is important

after days and days of trying, just watch how stupid I was:
I put the tags in a group, and then they just stopped working, and I just removed the group, and the scripts seem to work.
Sorry for the bother and waste of time.

2 Likes

I tried what you told me, there are some parts that the humanoid don’t touch… why’s that? it is canTouch and CanCollide on, so what is the problem? there are some kill parts who kills, if I copy-paste the killing parts, those parts will still not work.

I tried the wait() you told me, it just delays the kill, but some random parts just dont detect the humanoid…

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