Try and change
local Region = Region3.new(part.Position-(part.Size/2),part.Position+(part.Size/2))
From what I can tell is that the region isn’t picking up anything give this a go.
Try and change
local Region = Region3.new(part.Position-(part.Size/2),part.Position+(part.Size/2))
From what I can tell is that the region isn’t picking up anything give this a go.
Try printing the name of Hit, Hit.Name
, and see what is being detected
Problem doesn’t come from zone detection, if I remove the teams lines, it works “fine”, it damage correctly player
It lists the name of every part that touches the zone (UpperTorso, leg…)
Can you print local plr
? I have some digging to do with you
It probably wouldn’t work because I’m testing on a dummy
– Edit –
It prints the player that trigger the event
Wait can you clarify the current problem then, sorry let me get this straight…
Then wouldn’t this mean it damages the player that trigger’s it?
Take this function if you want I made it a while back for a similar purpose
function GetPlayersInPart(part,plr,allies) -- name of zone/plr that triggers it/list of allies
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 not table.find(allies,Part.Parent.Name) then
table.insert(Players,Part.Parent)
end
end
end
return Players
end
EDIT: I Did all the zones and everything for you so you don’t have to deal with it all you have to do is run the function and handle the damage
Where should I put it (Sorry if the question is dumb)
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 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 not table.find(allies,Part.Parent.Name) then
table.insert(Players,Part.Parent)
end
end
end
return Players
end
game.ReplicatedStorage.MusicSCP.OnServerEvent:Connect(function()
script.Parent.Head.Music:Resume()
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)
while wait(1) do
GetPlayersInPart()
end
end)
game.ReplicatedStorage.MusicSCPStop.OnServerEvent:Connect(function()
script.Parent.Head.Music:Stop()
end)``` like this?
In the script, let me give an example
local ally = {"JohnDoe6666666","BuffNoob123"}
while wait(1) do
local players = GetPlayersInPart(#ThePart,#PlayerWhoTrigger,ally)
for _,v in pairs(players) do
v.Humanoid:TakeDamage(20)
end
end
EDIT: Yes exactly how you have done it
EDIT2: MB fixed
which line is that?
Sorry it gives line 29 but i can’t be bothered to count ;-;
No problem ^^’
if Part.Parent.Name ~= plr.Name and not table.find(allies,Part.Parent.Name) then
Sorry i rushed the allies option just now so I never tested that bit out.
if Part.Parent.Name ~= plr.Name and table.find(allies,Part.Parent.Name) == nil then
No problem !
Thanks for helping me mate
Changed the line please use the new line i edited
It returns the same error as above
Can you show the variables your passing through the function, so I can run a test.
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 = {}
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 = {}
-- Full script :
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)