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

Syntax error expected identifier when phrasing '['?

Asked by 3 years ago

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)


0
Please provide more context. deeskaalstickman649 475 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

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!

Ad

Answer this question