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

function arguments expected near '=' (line 115) Help?

Hi, I am not sure why this is happening. Can anyone help?


107 local musicInfo = musicFrame:WaitForChild("info")
108 local musicList = musicInfo:WaitForChild("musicList")
109 local song = musicFrame:WaitForChild("song")
110 local selectedSong = nil
111 local imageID = nil
112
113 musicFrame:WaitForChild("Image").MouseButton1Down:connect(function()
114	if imageID ~= nil then
115	 musicInfo:imageID = "rbxassetid://"..image.id
116	end
117 end)

(ignore the lines that are already given by the system)

Thanks.

2 comments

1

why ':'?

0

because it's the image ID which is being from another part of the script, so its basically trying to put a image id i placed on to another part of the script, and its replacing the Id thats given on the Image to the ID which is given on the script

1 answer

✓ Accepted answer

musicInfo:imageID is your problem. The colon operator in Lua is used for sugar syntax for function calling and definitions. imageID is never a valid property of any GUI object musicInfo could be, so you want to fix that by using the proper property name. image is not defined either, so that will also error because you are attempting to access nil.

As a side note, you should use RBXScriptSignal:Connect(), because RBXScriptSignal:connect() is deprecated.

Furthermore, you do not need to use Instance:WaitForChild() for descendants of a GUI object that are not created during runtime. You only need to use Instance:WaitForChild() for the player's PlayerGui and top-level children of PlayerGui, not its descendants.

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