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

This script isn't running because he needs "function arguements" Help?

Asked by
Retroc 35
10 years ago

So I have a script placed in Workspace as well as a BindableFunction that forces the script to update. Basically, the script is suppose to remove all weapons if you are on a team. I have scripts that award you weapons if you have a gamepass, and that is why I want this script to remove tools. In case people have these weapons inside the lobby. Anyways, the output says "Workspace.Script:8: function arguments expected near 'for'" I'm actually not sure what a function argument is, I tried the Wiki. I couldn't understand it. If someone could also give a briefing on what that is, it would be very helpful. Here is the script.

local Workspace = script.Parent
local ForceUpdateFunction = Workspace:WaitForChild("ForceUpdate")

local function Update()
    local player = game.Players.LocalPlayer
    if player.TeamColor == game.Teams.Lobby.TeamColor then
        local p = player.Backpack:GetChildren
        for i = 1,#p do
            p[i]:Remove()
        end
    end
end
function ForceUpdateFunction.OnInvoke()
    Update()
end
while true do
    wait(2)
    Update()
end

1 answer

Log in to vote
2
Answered by 10 years ago

I think your problem is in line 7, simply because you forgot the two parentheses after GetChildren. It should be GetChildren().

Ad

Answer this question