Ad
Log in to vote
0

How to fix "Attempt to call a string value" error?

Asked by
Pejoume 11
2 years ago

I'm trying to make a webhook that tells people how many players are in the game and I keep getting an error. Here is the part of the script that keeps giving me errors, it triggers when a player joins the hostile team.

        local nPlayers = game.Players:GetPlayers()      
        local Strin = " "
            for i,v in ipairs(nPlayers) do
            Strin = Strin.. v.Name " " .. "\n"
        end 

1 answer

Log in to vote
0
Answered by
Pejoume 11
2 years ago

I was able to use this function instead and it worked like a charm.

local function PlayersOnTeamString(Team)
    local TeamString = ""
    for _, v in pairs(Team:GetPlayers()) do
        if v then
            TeamString = TeamString .. v.Name .. "\n"
        end
    end
    return TeamString
end
Ad

Answer this question