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

I have an error assigning a value, how can I fix it?

Asked by
Sublimus 992 Moderation Voter
10 years ago

So I'm trying to assign an airport to the player when the enter the game but it isn't working correctly and there is no output, yes there is a connection line, I just didn't feel like posting the rest of the script:

function PlayerEntered(player)
    print(player.Name .. " entered the server") 
    --Stats
    airport = Instance.new("IntValue", player)
    airport.Name = "Airport"
    airport.Value = "None"
    --
    wait()
    --Assigning Airport
-------------------------------This part doesn't execute for some reason?
    for _,v in pairs(game.Workspace.Airports:getChildren()) do
        if airport.Value == "None" then
            if v.Owner.Value == "None" then
                airport.Value = tonumber(string.sub(v.Name,7,8))
                v.Owner.Value = player.Name
            end
        end
    end
-------------------------------
end

1 answer

Log in to vote
3
Answered by 10 years ago
airport.Value = "None"

You're attempting to assign a String to an IntValue.

0
Wow, I feel stupid now, thanks for catching that. Sublimus 992 — 10y
0
No problem, that's what this site is for. TheGuyWithAShortName 673 — 10y
Ad

Answer this question