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

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

Asked by 4 years ago

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

0
you forgot a : inbetween MouseButton1Click and connect Bloxulen 88 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

Ad
Log in to vote
0
Answered by 4 years ago

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

so,

Your incorrect line:

script.Parent.MouseButton1Clickconnect(function()

The correct line:

script.Parent.MouseButton1Click:Connect(function()

Answer this question