Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script Function Not Properly BodyForce Isn't Working Properly - FIX?!

Asked by 6 years ago
Edited 6 years ago

I have this as a function you know.

It basically has to find a BodyForce objects in the table something.

All it does right now is print naa, which means it is wrong.

bfs is a seperate table that is suppose to be a table of only all the BodyForce objects, excluding other things because I used :GetChildren() to create the table of the list of descendants.

function getStuff(something)

local bfs = {}

for i,v in pairs(something) do

if v:FindFirstChild("BodyForce") then print'yes' bfs[i] = v

else print'naa' return end end

return bfs

end

(Couldn't code block, but this is best format I could do. Sorry)

Can you find out why? because I've tried all I could...unfortunately to no good.

Right now the BodyForce is working, but I'm trying to limit the amount of BodyForce objects that get created.

This is because I use a Touched event, and it parents BodyForce to whatever touches the part. However, sometimes it can create way too many if you continuously step on the same part. I am trying to enforce a limit to how many can be created.

0
Ask me questions if you would like more information. DoYouKnowHowToRead -13 — 6y
0
put it in a code block awesomeipod 607 — 6y
0
yea DoYouKnowHowToRead -13 — 6y
0
It ought to work. Be sure you're checking for the bodyforce in the correct place. Also, use https://wiki.roblox.com/index.php?title=API:Class/Instance/FindFirstChildOfClass whenallthepigsfly 541 — 6y

Answer this question