I made a script to kill players that touch lava parts in an obby I'm making. However, using the .Touched event seems to have a glitch. Is there any working alternative that would be fast and efficient? Script:
local CS = game:GetService("CollectionService")
local Players = game:GetService("Players")
function OnHumanoidTouched(otherpart, limb)
local player = Players:GetPlayerFromCharacter(limb.Parent)
if CS:HasTag(otherpart, "Checkpoint") then
--some checkpoint stuff
elseif CS:HasTag(otherpart, "KillBrick") then
player.Character:WaitForChild("Humanoid"):TakeDamage(100)
end
end
function OnCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid");
humanoid.Touched:Connect(OnHumanoidTouched)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(OnCharacterAdded)
end)
Thanks!

1 comment
ALL I NEEDED TO DO WAS SET THE CANCOLLIDE OF THE LAVA PARTS OFF!