Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make safe zone that doesnt allow damage from items?

Asked by 4 years ago
Edited 4 years ago

I have a bunch of item givers, that give custom made guns, but they can hurt players, so I decided to make a safe zone, like in most pvp games. So I decided to look up a safe zone model, It would work.. but it wasn't for FE, so it wouldn't work. Next, I've tryed to look on every video online that was related to "Safe Zone". Trying all of the scripts, no, they wont work.

Next, instead of using a ForceField, i tried to set the humanoid health to an very high number, then back to 100 health when they left.

local part = script.Parent
part.Touched:connect(function(Player)
    local Players = game:GetService("Players")
    local ChangeHealth
    Player.CharacterAdded:Connect(function(Character)
        if ChangeHealth ~= nil then
            ChangeHealth:Disconnect()
        end
        local Humanoid = Character:WaitForChild("Humanoid")
        local MaxHealth = 2147483647

        Humanoid.MaxHealth = MaxHealth
        ChangeHealth = Humanoid.HealthChanged:Connect(function()
            Humanoid.Health = MaxHealth
        print(Humanoid.Health)
        end)
    end)
end)

I wanted to print the humanoid's health, and trying that, it gave me "100" Maybe we could fix this code, Or try another code? I dont know, I worked on this for 6 hours, Still no solution.. If you want to be specfic on the solutions i tryed, I tryed: FF script Another FF script A FF script that for some reason refreshes every 500 ms... And the health script I said. I just made my first post btw.

1
do a magnitude or getpartsinregion3 check and if they are in the region set a bool value under their player called "InSafezone" and have the items check if the value is false before damaging. qChaos 86 — 4y

Answer this question