I am trying to figure out why roblox is not reading when the button is pressed, the script is a local script.
closeButton = Parent
closeButton.MouseButton1Down:connect(function()
print"pressed"
end)
It does not print anything.
I am trying to figure out why roblox is not reading when the button is pressed, the script is a local script.
closeButton = Parent
closeButton.MouseButton1Down:connect(function()
print"pressed"
end)
It does not print anything.
function onClick()
print("Pressed")
end
script.Parent.MouseButton1Click:connect(onClick)
You also wrote print"pressed" instead of print("pressed") <-Works either way
Okay, so, "Parent" was wrong. He should have used "script.Parent" But jay, print"Pressed" is just as legal as print("Pressed"). Lua is flexible like that. The parentheses are just better to use for readability, as well as in special cases when they are necessary.
Never knew that (:
lua seems to be very flexible compared to other languages like c++
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Line 1 is your problem. Change it to this: closeButton = script.Parent