Yeah, if you want, I can invite you to the game,
Does it work for you if the script RunContext is set to Client?
Sorry for my late reply. Yes, it does. There’s a pretty noticeable delay, but it works for me regardless.
I have no idea why it doesn’t for me. It’s frustrating.
i think pairs loop run till they go through every key value pair in table
i think it seems like the game has not loaded every part yet, so in your pairs loop the table probably dont contain every part and thats probably the reason why touched
is applied to some parts and rest of the parts are ignored
I don’t there is a way to do this on the client. If there is, it’s most likely very complicated. I’m going to need some more time to figure this out. Sorry.
Hello. I just finished a formula for your script. Try this and see if it works. There may be a slight delay.
local Folder = script.Parent
local Filter = {}
local DB = true
function GetHumanoid(v: BasePart)
v.Touched:Connect(function(hit)
local Humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if Humanoid and Humanoid.Health > 0 and DB == true then
DB = false
Humanoid.Health = 0
task.wait(1)
DB = true
end
end)
end
function GetObjects()
local Descendants = Folder:GetDescendants()
for i, v in Descendants do
if not table.find(Filter, v) then
if v:IsA("BasePart") then
GetHumanoid(v)
else
table.insert(Filter, v)
task.wait()
GetObjects()
end
end
end
end
GetObjects()
This works! Omg! Thanks so much! But, I’ll test it out more before I mark it as a solution
Glad I could help!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.