Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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???

2 comments

0

Maybe where you have "newColor:". I'm not sure if roblox lua supports colons.

0

Not in that case, no.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.