Script doesn't recognize "MouseButton1Down"

Hey Developers!
I am new at scripting and I made one script, but it doesn’t work it says “MouseButton1Down” is not valid member of ImageLabel"
I would love if someone told me whats wrong. thanks :slight_smile:
here is the script:

local CarParams = game.ReplicatedStorage:WaitForChild("GetCarParams"):InvokeServer(script.Parent.Name)
local CarImage = script.Parent.CarImage
local ShowBoughtFrame = script.Parent.Parent.Parent.Parent.Parent.ShowBuyFrame

script.Parent.CarName.Text = CarParams.Name
script.Parent.Cost.Text = CarParams.Cost

script.Parent.MouseButton1Down:Connect(function()
	ShowBoughtFrame:Fire(CarParams.Name, CarParams.Cost, CarParams.Power, script.Parent.CarImage)
end)

Your image label has to be an image button, I’ve made this same mistake before as well. From image button you can use all sorts of button events including mousebutton1down

What if i cannot make image button?

you can make an Invisible one inside of your image label

1 Like

not with image label, but like @3MASTER9 said you could make an invisible button inside the image label and use a click event

I would suggest though you just create an image button

1 Like

ok thanks guys! have a nice day

2 Likes

@SuccessfuIDev Use Activated. Activated works for all platforms