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

Why does "Expected identifier got =" happen? I need help

Asked by 5 years ago
Edited 5 years ago

I am trying to make a game but nothing but this gives me error so that confuses me and i dont know how to fix it

Heres the script:

local Tycoons = ("")
local Teams = game:GetService("Teams")
local Settings = require("script.Parent.Settings")
local BC = BrickColor
local storage = Instance.new("Folder",game.ReplicatedStorage)
storage.Name = "PlayerMoney"
Instance.new("Model", workspace).Name = "PartStorage"

function returnColorTaken(color)
    for i,v in pairs(Teams:GetChildren()) do
        if v:IsA("Team") then
            if v.Teamcolor == color then
                return true
            end
        end
    end
    return false
end 

if not  Settings("AutoAssignTeam") then
    local TeamHire = Instance.new("Team", Teams)
    TeamHire.TeamColor = BC.new("White")
    TeamHire.Name = "For Hire!"
end

for i,v in pairs (script.Parent:WaitForChild("Tycoons"):GetChildren()) do
    Tycoons(v.Name) = v.Clone()
    if returnColorTaken(v.TeamColor) then
        local newColor:
        repeat
            wait()
            newColor = BC.Random()
        until returnColorTaken(newColor) == false
        v.TeamColor.Value = newcColor
    end

    end
end

Got any ideas???

0
Maybe where you have "newColor:". I'm not sure if roblox lua supports colons. LawlR 182 — 5y
0
Not in that case, no. User#24403 69 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

There's a lot wrong here, and I'm just assuming it's not your own script. The problem is line 27. You called Tycoons like it was a function, instead of indexing a table value. Therefore, you should have used brackets instead of parentheses.

local Tycoons = ("")
local Teams = game:GetService("Teams")
local Settings = require(script.Parent.Settings) --you only use strings in require if you're requiring a module via roblox's library
local storage = Instance.new("Folder",game.ReplicatedStorage)
storage.Name = "PlayerMoney"
Instance.new("Model", workspace).Name = "PartStorage"

function returnColorTaken(color)
    for i,v in pairs(Teams:GetChildren()) do
        if v:IsA("Team") then
            if v.Teamcolor == color then
                return true
            end
        end
    end
    return false
end 

if not Settings("AutoAssignTeam") then
    local TeamHire = Instance.new("Team", Teams)
    TeamHire.TeamColor = BrickColor.new("White")
    TeamHire.Name = "For Hire!"
end

for i,v in pairs (script.Parent:WaitForChild("Tycoons"):GetChildren()) do
    Tycoons[v.Name] = v.Clone()
    if returnColorTaken(v.TeamColor) then
        local newColor
        repeat
            wait()
            newColor = BrickColor.Random()
        until returnColorTaken(newColor) == false
        v.TeamColor.Value = newColor
    end
end
Ad

Answer this question