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

Help with a unexpected symbol?

Asked by 10 years ago

I'm trying to make some Guis in a screen gui but I keep getting a error saying

Workspace.Script:6: unexpected symbol near '.'

Why am I getting this error if I am using the correct symbol to access the property?

Hierarchy Picture

How would I fix this?

game.Players.PlayerAdded:event(function(Player)
    Parent = Player.PlayerGui.ScreenGui
function CreateButtons()
----------------------Button----------------------
local Button = Instance.new("TextButton",Parent)
local Button.Style = Enum.ButtonStyle.RobloxRoundDropdownButton
local Button.Size = UDim2.new(0.2, 0,0.14, 0)
local Button.Text = "PlayerName"
local Button.Name = "Button"
local Button.Position = UDim2.new(0.08,0,0.13,0)
----------------------ButtonUnderImage----------------------
local Buttonunderimage = Instance.new("Frame",Parent)
local Buttonunderimage.Style = Enum.FrameStyle.DropShadow
local Buttonunderimage.Size = UDim2.new(0,0,0.13,0)
local Buttonunderimage.Name = "ButtonUnderImage"
local Buttonunderimage.Position = UDim2.new(0.08,0},{0.14,0)
----------------------PlayerImage----------------------
local PlayerImage = Instance.new("ImageLabel",Parent)
local PlayerImage.BackgroundTransparency = 0
local PlayerImage.Image = "rbxassetid://"
local PlayerImage.Name = "PlayerImage"
local PlayerImage.Position = UDim2.new(0,0,0.13,0)
local PlayerImage.Size = UDim2.new(0.08,0,0.14,0)
end
end)
CreateButtons()


1 answer

Log in to vote
2
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

Properties of objects aren't variables.

You cannot declare them as local (they don't have any meaningful scope).

Because of the use of local, it didn't "expect" to see a ".", which is what the error is informing you of.

Remove the unnecessary locals on the assignments to properties and it will be fine.


Note: This is a syntax error. Lua didn't even start evaluating your script; that means the hierarchy or whatever other configuration actually isn't relevant (though thank you for providing it in case!)

Ad

Answer this question