Also do the NPC’s/Players have a HumanoidRootPart I did this assuming they did…
I imported a rig via plugin, so yes they do
Also, the damage system has been completly broken.
After this line in the function
can you
print(table.find(allies,Part.Parent.Name))
It always print
nil (x…)
when I run the function
I see the issue…
Im very sorry I suck at handling lists
You may need to rewrite the list into a dictionary…
local ally = {
["SH"] = true,
["Pizza"] = true,
["Obamium"] = true,
["BigShaq"] = true,
["IKEA"] = true,
["SCP-035"] = true,
["SCP-049"] = true,
["SCP-076"] = true,
["SCP-106"] = true,
["SCP-407"] = true,
["SCP-457"] = true,
["SCP-745"] = true
}
How you would append to the list to add new allies would be assuming you don’t know…
ally[#NAME OF ALLY] = true
And the new function would be this
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 allies[Part.Parent.Name] then wait()
else
table.insert(Players,Part.Parent)
end
end
end
return Players
end
Where should I put it? really bad at nderstanding other people scripts.
If the list name is “ally” should I replace GetPlayersInPart(ally)
Don’t use that, thats if you want to add to the list when your scripts running.(Basically only if you want to add a new ally)
Still bypass the team thing for some reasons
post new script let me see if the changes are correct again…
Here it is :
I’m doing 4 script at the same times lmao
local allies = {
["SH"] = true,
["Pizza"] = true,
["Obamium"] = true,
["BigShaq"] = true,
["IKEA"] = true,
["SCP-035"] = true,
["SCP-049"] = true,
["SCP-076"] = true,
["SCP-106"] = true,
["SCP-407"] = true,
["SCP-457"] = true,
["SCP-745"] = true
}
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 allies[Part.Parent.Name] then wait()
else
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)
sorry for the late reply
can you print allies[Part.Parent.Name]
in the function after
It return the same result :
Print : nil (x…) again and agin
Got a question can I see workspace with these NPC’s? Are their Model names in the list
This is the npc :
Ok but is his name in the allies list
EDIT: Example
is also in the list
I didn’t place it in the allies list since I’m trying to check if it correctly damage the other player,
It’s not an NPC name, but a team name
What do you mean by
the function I gave you checks the all parts in a region3 and gives which ones name is in Allies. Im very lost on what your trying to accomplish now.
If you look here this is what im saying the model should be named exactly as its in the list
It’s not individual players, it’s team name, if the player isn’t in the team, we damage him