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

Problem with basic script, Please Help?

Asked by
B3blx 5
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Hello. I am very new to this forum and very new to scripting. I feel as though I have done everything correct, yet it doesn't work.

b3n = game.Workspace.Partz:GetChildren()

while true do
    wait(2)
    b3n:Remove()

end
0
23:14:22.784 - Workspace.Partz.Script:5: attempt to call method 'Remove' (a nil value) <- Keep getting this message B3blx 5 — 9y
0
Your problem is that you are attempting to call 'Remove' on a Table (b3n) (Table:Remove() -- Lua: What..?); This is a common mistake, so don't worry. :) The Solution is to use a 'for' loop to loop through the Table, and such. :) Also, I recommend using 'Destroy', because 'Remove' (or 'remove') has become Deprecated. :) TheeDeathCaster 2368 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

First of all, "Partz" is NOT a member of workspace. But nor it Parts.

Also, try changing "b3n" to "ben" instead. This is probably not the issue, but just telling you.

This is another thing, change "Remove" to "remove" Take the capital out of it.

Here's the script it should be;

ben = game.Workspace:GetChildren()--If "Partz" is a model, then the next script below this one will help.
while true do
    wait(2)
    ben:remove()--Or you could use "Destroy" instead of "remove"

end

If "Partz" is a model, then here's the correct script;

ben = game.Workspace.Partz:GetChildren
while true do
    wait(2)
    ben:remove()--Or you could use "Destroy" instead of "remove"

end

Hope this helped, if it didn't I still love you!

3
The problem is Remove is not a valid function for a table. Partz would have to be a member of workspace for the script to get to that point of the script. Also, a function can not be called on a table value. You would have to use a loop. M39a9am3R 3210 — 9y
0
sorry im a beginner scripter and i try to answer the best i can. if you think your answer would be better, then post it. i dont care really. Lukeisbossman64 73 — 9y
Ad
Log in to vote
0
Answered by
IcyEvil 260 Moderation Voter
9 years ago

I find that I just re-wrote it, but did it all in one line, this should be a Lot more simple for basic lua.

local b3n = game.Workspace.b3n:ClearAllChildren() --simply going to workspace, finding b3n and clearing everything inside of it also known as "children"

Answer this question