How can I fix this damage zone?

-_-

Please fill it out as I’ve shown you here I used tags to guide you

also change this line to

I’ve edited so there is no issue

It always return the same error, at the same line

Can I see your current script, sorry just to make sure your using it correctly

local allies = {
	"SH",
	"Pizza",
	"Obamium",
	"BigShaq",
	"IKEA",
	"SCP-035",
	"SCP-049",
	"SCP-076",
	"SCP-106",
	"SCP-407",
	"SCP-457",
	"SCP-745"
}

local Team = game:GetService("Teams")
local players = game:GetService("Players")
local Hits = {}

function GetPlayersInPart(part,plr,allies) -- name of zone/plr that triggers it/list of allies
	local part = script.Parent.FireDamageZone
	local min = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2)
	local max= Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
	local region = Region3.new(min, max)
	local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
	local Players = {}
	for _,Part in pairs(partsInRegion) do
		if Part.Name == "HumanoidRootPart" then
			if Part.Parent.Name ~= plr.Name and table.find(allies,Part.Parent.Name) == nil then
				table.insert(Players,Part.Parent)
			end
		end
	end
	return Players
end

game.ReplicatedStorage.MusicSCP.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Resume()
	
	while wait(1) do
		GetPlayersInPart() 
	end
end)

game.ReplicatedStorage.MusicSCPStop.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Stop()
end)

M8 please refresh I just wrote here

Oh, cuz you edited it with :
Yes exactly what you done
– My bad, sorry i’m dumb

its alr bro as long as you can fix your issue i’m good.

Like this? I honnestly don’t know how :
local players = GetPlayersInPart(part, plr, allies)

or should I replace it with the path?

SORRY I SHOULD READ MY CODE MORE REMOVE THIS IS HOW IT SHOULD BE FORMATTED
(sorry for caps)

 local players = GetPlayersInPart(plr, allies)

FINAL FUNCTION:

function GetPlayersInPart(plr,allies) -- plr that triggers it/list of allies
    local part = script.Parent.FireDamageZone
    local min = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2)
    local max= Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
    local region = Region3.new(min, max)
    local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
    local Players = {}
    for _,Part in pairs(partsInRegion) do
	    if Part.Name == "HumanoidRootPart" then
		    if Part.Parent.Name ~= plr.Name and table.find(allies,Part.Parent.Name) == nil then
			    table.insert(Players,Part.Parent)
		    end
	     end
    end
    return Players
end

It underlines me the “plr” thing. I can’t concentrate, 21h. Imma go sleep. Thanks for your help

Goodnight, plr is the person who creates the field or am I misunderstanding what this is mean’t to be…

If this is something controlled on server and not activated by player then we can remove it entirely here is the new function…

function GetPlayersInPart(allies) -- list of allies
    local part = script.Parent.FireDamageZone
    local min = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2)
    local max= Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
    local region = Region3.new(min, max)
    local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
    local Players = {}
    for _,Part in pairs(partsInRegion) do
        if Part.Name == "HumanoidRootPart" then
            if table.find(allies,Part.Parent.Name) == nil then
                table.insert(Players,Part.Parent)
            end
        end
    end
    return Players
end

Yes, I forgot to mention that it was controlled by the server.

Should work now with that function and it will return the players that are not allies and within the region3 of the part :smiley:

It doesn’t seems to care about the allies thing

Post script please let me see the changes

local allies = {
	"SH",
	"Pizza",
	"Obamium",
	"BigShaq",
	"IKEA",
	"SCP-035",
	"SCP-049",
	"SCP-076",
	"SCP-106",
	"SCP-407",
	"SCP-457",
	"SCP-745"
}

local Team = game:GetService("Teams")
local players = game:GetService("Players")
local part = script.Parent.FireDamageZone
local Hits = {}

function GetPlayersInPart(allies) -- list of allies
	local part = script.Parent.FireDamageZone
	local min = Vector3.new(part.Position.X-part.Size.X/2, part.Position.Y-part.Size.Y/2, part.Position.Z-part.Size.Z/2)
	local max= Vector3.new(part.Position.X+part.Size.X/2, part.Position.Y+part.Size.Y/2, part.Position.Z+part.Size.Z/2)
	local region = Region3.new(min, max)
	local partsInRegion = workspace:FindPartsInRegion3(region,nil,math.huge)
	local Players = {}
	for _,Part in pairs(partsInRegion) do
		if Part.Name == "HumanoidRootPart" then
			if table.find(allies,Part.Parent.Name) == nil then
				table.insert(Players,Part.Parent)
			end
		end
	end
	return Players
end

game.ReplicatedStorage.MusicSCP.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Resume()
	
	while wait(1) do
		local players = GetPlayersInPart(allies)
		for _,v in pairs(players) do
			v.Humanoid:TakeDamage(20)
		end
	end
end)

game.ReplicatedStorage.MusicSCPStop.OnServerEvent:Connect(function()
	script.Parent.Head.Music:Stop()
end)

Also tried with
local players = GetPlayersInPart()

Just to make sure variables aren’t mixing up chance

to local ally, sorry just don’t wanna take chances