#Need Help Making Safe Zone Script

10 messages · Page 1 of 1 (latest)

dense harbor
#

Above ^
I'm not sure how to make it but I've got this script so far with help but it wont work

script.Parent.Touched:Connect(function(touched)
    if touched.Parent:FindFirstChild("Humanoid") then
        local InSafeZone = Instance.new("BoolValue")
        InSafeZone.Name = "InSafeZone"
        InSafeZone.Value = true
        
        while true do
            local character = touched.Parent
            local humanoid = character:FindFirstChild("Humanoid")
            humanoid.MaxHealth = math.huge
            humanoid.Health = math.huge
        end
    end    
end)

script.Parent.TouchEnded:Connect(function(touched)
    if not touched.Parent:FindFirstChild("Humanoid") then return end
        InSafeZone.Value = false
        time.Value = time.Value + 1

end)
#

This is for a time stealing type of game and the safezone is the most annoying part cause idk how to make it

dense harbor
#

Help pls anyone

main dune
#
local InSafeZone = Instance.new("BoolValue")
InSafeZone.Name = "InSafeZone"
InSafeZone.Value = true
script.Parent.Touched:Connect(function(touched)
    if touched.Parent:FindFirstChild("Humanoid") then
        while wait() do
            local character = touched.Parent
            local humanoid = character:FindFirstChild("Humanoid")
            humanoid.MaxHealth = math.huge
            humanoid.Health = math.huge
        end
    end    
end)

script.Parent.TouchEnded:Connect(function(touched)
    if not touched.Parent:FindFirstChild("Humanoid") then return end
        InSafeZone.Value = false
        time.Value = time.Value + 1
end)```
hot cipher
#

it will create hundreds or thousands of unnecessary loops that will never stop CryRoll

main dune
#

Because u don’t have a defined InSafeZone for TouchedEnded

hot cipher
#

you don't need a while loop here at all

main dune
#

I’m talking about u had it in the Touched script