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

How do i fix MouseButton1Clickconnect is not a valid member of ImageButton ?

Here is the script

local ItemSlot1 = script.Parent.Parent.Parent.ItemSlot1
local ItemSlot2 = script.Parent.Parent.Parent.ItemSlot2
local ItemSlot3 = script.Parent.Parent.Parent.ItemSlot3

local EquipedSlots1 = script.Parent.Parent.Parent.EquipedSlots1
local EquipedSlots2 = script.Parent.Parent.Parent.EquipedSlots2
local EquipedSlots3 = script.Parent.Parent.Parent.EquipedSlots3

script.Parent.MouseButton1Clickconnect(function()
	if ItemSlot1.Value == false then
		script.Parent.Visible = false
		EquipedSlots1.Visible = true
		ItemSlot1.Value = true
	elseif ItemSlot1.Value == true then
		if ItemSlot2.Value == false then
			script.Parent.Visible = false
			EquipedSlots2.Visible = true
			ItemSlot2.Value = true
		elseif ItemSlot2.Value == true then
			if ItemSlot3.Value == false then
				script.Parent.Visible = false
				EquipedSlots3.Visible = true
				ItemSlot3.Value = true 
				elseif ItemSlot3.Value == true then
					print("All slots are being used.")
			end
		end
	end
end)

i cant seem to fix this

1 comment

0

you forgot a : inbetween MouseButton1Click and connect

2 answers

✓ Accepted answer

Your code seems to messy, also you forgot to end if , andddd you didnt add : for methods, :connect is deprecated use :Connect

local ItemSlot1 = script.Parent.Parent.Parent.ItemSlot1
local ItemSlot2 = script.Parent.Parent.Parent.ItemSlot2
local ItemSlot3 = script.Parent.Parent.Parent.ItemSlot3

local EquipedSlots1 = script.Parent.Parent.Parent.EquipedSlots1
local EquipedSlots2 = script.Parent.Parent.Parent.EquipedSlots2
local EquipedSlots3 = script.Parent.Parent.Parent.EquipedSlots3

script.Parent.MouseButton1Click:Connect(function()
    if ItemSlot1.Value == false then
        script.Parent.Visible = false
        EquipedSlots1.Visible = true
        ItemSlot1.Value = true
return ; 
end
  
        if ItemSlot2.Value == false then
            script.Parent.Visible = false
            EquipedSlots2.Visible = true
            ItemSlot2.Value = true
return ;
end
        
            if ItemSlot3.Value == false then
                script.Parent.Visible = false
                EquipedSlots3.Visible = true
                ItemSlot3.Value = true 
                elseif ItemSlot3.Value == true then
                    print("All slots are being used.")
         end
    
end)

If this helped or answered your question mark this as the answer :D

This is an easy fix, you forgot the ":"

so,

Your incorrect line:

script.Parent.MouseButton1Clickconnect(function()

The correct line:

script.Parent.MouseButton1Click:Connect(function()

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