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.
-
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 -
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