Force Field

Force Field Part

local forcePart = script.Parent

local canActivate = true


local function forceField(otherPart)

local humanoid = otherPart.Parent:FindFirstChild('Humanoid')

if humanoid and canActivate then

canActivate = false

forcePart.Transparency = 1

forcePart.CanCollide = false

local force = Instance.new('ForceField')

force.Parent = humanoid.Parent

wait(5)

forcePart.Transparency = 0

forcePart.CanCollide = true

force:Destroy()

canActivate = true

end

end


forcePart.Touched:Connect(forceField)

Damage Part

local damagePart = script.Parent


local function damage(otherPart)

local humanoid = otherPart.Parent:FindFirstChild('Humanoid')

if humanoid then

humanoid:TakeDamage(5)

end

end


damagePart.Touched:Connect(damage)