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

MouseButtonClick Isnt working correctly, Please help?

Asked by 3 years ago
Edited 3 years ago
click.MouseButton1Click:Connect(function()
        local name = frame2.Name
        local plrname = plr.Name
        if not debounce then
            debounce = true

            game.ReplicatedStorage.add:FireServer(name, plrname)
            wait(2)

            debounce = false
        end
    end)

This works fine and how its supposed to, the next part is the issue

game.ReplicatedStorage.add.OnServerEvent:Connect(function(plr, name, plrname)
        local hatimage = game.ReplicatedStorage.Images:FindFirstChild(name)
        local plrside = person.PlayerGui.TradeGui.Frame:FindFirstChild(plrname)
        local plrside2 =    guy.PlayerGui.TradeGui.Frame:FindFirstChild(plrname)
                ------------------------------
        if plrside.one.Value.Value == false then
            print("Put In One")
            plrside.one.ImageLabel.Image = hatimage.Image
            plrside2.one.ImageLabel.Image = hatimage.Image
            plrside.one.Value.Value = true
            -----------------------------------
        elseif plrside.two.Value.Value == false then
                print("Put In two")
                plrside.two.ImageLabel.Image = hatimage.Image
                plrside2.two.ImageLabel.Image = hatimage.Image
                plrside.two.Value.Value = true
                -----------------------------------
            elseif plrside.three.Value.Value == false then
            print("Put In three")
                    plrside.three.ImageLabel.Image = hatimage.Image
                    plrside2.three.ImageLabel.Image = hatimage.Image
                    plrside.three.Value.Value = true
                    -----------------------------------
                elseif plrside.four.Value.Value == false then
            print("Put In four")
                        plrside.four.ImageLabel.Image = hatimage.Image
                        plrside2.four.ImageLabel.Image = hatimage.Image
                        plrside.four.Value.Value = true
                        -----------------------------------
                        elseif plrside.five.Value.Value == false then
                            print("Put In five")
                            plrside.five.ImageLabel.Image = hatimage.Image
                            plrside2.five.ImageLabel.Image = hatimage.Image
                            plrside.five.Value.Value = true
                        else        

                    end
                end)
            end)

The code runs like how its supposed to but more times then its supposed to.

any every time i click. it doesnt register as one click, it registers as a ton more

03:13:31.398 Put In One - Server - Script:38 03:13:31.398 Put In One - Server - Script:38 2nd Click 03:17:01.371 Put In One - Server - Script:38 03:17:01.371 Put In One - Server - Script:38 03:17:01.371 Put In two - Server - Script:44

Is there anything wrong with my script?

0
I Think You Need Another "End" At The End Of Your Script Magicdevice3 58 — 3y
0
ive tried this and it hasnt worked, thank you though! TeaWithMee 76 — 3y
0
have you tried using "MouseButton1Up" instead? TheDude646 72 — 3y
0
Still nope TeaWithMee 76 — 3y
0
Once again, there is nothing wrong with the first part, just the second TeaWithMee 76 — 3y

Answer this question