I need help with Safezone! So players wont get killed even with swords

Hi, I made kill players and steal time game and I really need help with the safe zone when players are trying to escape from being killed they land in the safe zone

If anyone knows a script or they can help me that would be awesome
4
I don’t know how to script or make the safe zone
image

Not sure if it’ll work.

game.Workspace.Safezone.Touched:Connect(function(player)
if game.Players: FindFirstChild (player.Parent.Name) then
local forcefield = Instance.New("ForceField", player)
end
end)
game.Workspace.Safezone.TouchEnded:Connect(function(player)
if game.Players: FindFirstChild (player.Parent.Name) then
player: WaitForChild("ForceField"):Destroy()
end
end)
1 Like

Your script will not work considering damage is dealt on the server.
A script could be used that does the exact same thing, but using the player’s character provided in the .Touched event.
Example:
safeZoneExitParts would be folder containing parts next to the bounds of the safezone. (parts that you would have to touch to leave the safezone.)

local safeZone = game.Workspace.safeZone
local safeZoneExitParts = gane.Workspace.safeZoneExits:GetChildren()
safeZone.Touched:Connect(function(part)
    if part.Parent:FindFirstChild("Humanoid") and not part.Parent:FindFirstChild("szFF") then
        local ff = Instance.new("ForceField", part.Parent)
        ff.Name = "szFF"
end)
for i,v in pairs(safeZoneExitParts) do
    v.Touched:Connect(function(part)
        if part.Parent:FindFirstChild("szFF") then
            part.Parent.szFF:Destroy()
        end
    end)
end
2 Likes

Will it work now? I am writing this on mobile so I’m typing blindly.

The forcefield does not work on the player object, but it does work on the character.

Do I add this to the Safezone as a Script? Sorry, I’m new to scripting.

Where do I put the Script? That you entered?

You would put it into ServerScriptService.
Before you can use it, you would need to make a part called safeZone and make sure the part is in a place where it will be touched upon entering or whilst being in the safezone.
After that, you will need to make a folder called safeZoneExits. Inside that folder, you will need to put parts around the safezone that will be touched as someone exits the safezone.

Where do the safeZoneExits go? In the ServerScriptService? I already made the part.

image

The exits go in a folder in the workspace.
The part goes in the workspace.
Read the script and you will know.