Is anyone able to find a way to make this more reliable?
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") ~= nil then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr.Protected.Value = true
script.Parent.TouchEnded:Connect(function(hit)
plr.Protected.Value = false
end)
end
end)
Basically a part is a protection zone and if the player enters it, they won't be affected by an explosion.
When they leave however they will. Sometimes however the player still gets affected even though they are inside the force field

2 comments
Region3
Don't define your TouchEnded inside the Touched event's function. Definie it independent of Touched.