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

Why does my giver not work?

Asked by
jacobwow 140
9 years ago

Argument line 7: StrikeBall not a valid member of backpack Also, this giver is to give a player that does not already have an the item and is on the same team as the color of the block.

local Giver = script.Parent
local Gear = game.ServerStorage.StrikeBall
local debounce = false

local function FindTool(player, tool)
    local Character = player.Character
    local HoldingTool = Character:FindFirstChild(tool)
    local BackpackTool = player.Backpack:FindFirstChild(tool)

    if HoldingTool ~= nil or BackpackTool ~= nil then
        return true
    end
end

Giver.Touched:connect(function(part)
    local Player  = game.Players:GetPlayerFromCharacter(part.Parent)

    if Player ~= nil and Player.TeamColor == Giver.BrickColor and debounce == false and Player:FindTool("StrikeBall") == nil then
    debounce = true
        Gear:Clone().Parent = Player.Backpack
    end

    wait(5)
    debounce = false
end)

0
The main error I can see is on line 18; You only gave 'FindTool' one Argument, and not the required two Arguments! TheeDeathCaster 2368 — 9y
0
Change 'Player:FindTool("StrikeBall")' to 'FindTool(Player,"StrikeBall")' DigitalVeer 1473 — 9y

Answer this question