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

Expected identifier, got '='?

local chatstorage 				= game.Workspace.ChatHistory
game.Players.PlayerAdded:connect(function(plr)
	plr.Chatted:connect(function(ChatSender)
		local StringValue 		= Instance.new("StringValue", chatstorage)
		local ColorVal 			= Instance.new("Color3Value", StringValue)
		if plr.Name == "LetterSlayer" then
			StringValue.Value    = plr.Name.." : "..ChatSender..
			ColorVal.Value		= (20/255, 20/255, 20/255)  --Error
		else
			StringValue.Value 	= plr.Name.." : "..ChatSender..
			ColorVal.Value 		= (255/255, 255/255, 255/255) --Error
			
		end
	end)
end)

Why does this not work? Line 8) "Expected identifier, got '='" Line 11 is the same way, but I don't understand what is wrong with it.

2 comments

0

Use Color3.new() with the nums in the parentheses

0

It's still giving the same error.

1 answer

✓ Accepted answer

You're actually getting this error because you forgot to close StringValue.Value by adding two quotations after to signal it is closed.

Even after that, another error appears. When calling the Color3 Value, you still must act as if it is a property. By this I mean you must include the Color3.new string before you add the numbers, it should work after this revision

Here is your revised code:

local chatstorage               = game.Workspace.ChatHistory
game.Players.PlayerAdded:connect(function(plr)
    plr.Chatted:connect(function(ChatSender)
        local StringValue       = Instance.new("StringValue", chatstorage)
        local ColorVal          = Instance.new("Color3Value", StringValue)
        if plr.Name == "LetterSlayer" then
            StringValue.Value    = plr.Name.." : "..ChatSender..""
            ColorVal.Value 		 = Color3.new(20/255, 20/255, 20/255)  --Error
        else
            StringValue.Value   = plr.Name.." : "..ChatSender..""
            ColorVal.Value      = Color3.new(255/255, 255/255, 255/255) --Error

        end
    end)
end)

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