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

Syntax error expected identifier when phrasing '['?

im pretty new to scripting; messy code :p

local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
UserInputService.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Space then
		print("neko-neko-nii~!")
		wait(1)
		local TweenService = game:GetService("TweenService")
		local part = player.PlayerGui.IntroductionScreen.CoverFrame
		local Info = TweenInfo.new(
			5,
			Enum.EasingStyle.Sine,
			Enum.EasingDirection.In,
			0,
			false,
			0
		)
		local Goals = 
			{ 
				BorderColor3 = [255, 255, 255]
				BackgroundColor3 = [255, 255, 255]
			}
		local tween = TweenService:Create(part, Info, Goals)
		tween:Play()
	end
end)


1 comment

0

Please provide more context.

1 answer

After taking a careful look at your code, I realized one flaw you likely have in your code.

See, you need to use Color3.new(), not []. You used the latter which is what you used here:

BorderColor3 = [255, 255, 255]
BackgroundColor3 = [255, 255, 255]

The brackets are supposed to be used for cases when you are getting a value by a table, like Table[6], but since it didn't get a table variable to index from, it threw an error because as you told us the error was; Identifier expected when phrasing "[", which meant it was looking for a table variable to index. What you must do to fix this error is by doing this instead:

BorderColor3 = Color3.new(255, 255, 255)
BackgroundColor3 = Color3.new(255, 255, 255)

That should fix the error, allowing your script to run smoothly!

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