#The code working twice

1 messages · Page 1 of 1 (latest)

lilac wasp
#

The code is working twice sometimes, i mean the message is shown twice with the same texts.

safe rune
#

I'm gonna need to see more than that

#

where are you using goMessage()

#

show me that part of the script

lilac wasp
safe rune
#

just do button:Once() instead

lilac wasp
safe rune
lilac wasp
safe rune
#

then why'd you turn off CanTouch for your button

lilac wasp
cyan needleBOT
#

studio** You are now Level 2! **studio

lilac wasp
#

It would work 4, 5 times when touched once if i don't add it

safe rune
#

make a seperate function for the code from

button.CanTouch = false

to

elseif stalVal==7 then
end
#

let me know once you've done that

lilac wasp
safe rune
#

make a function at the beginning of the script and name it whatever you want and put everything inside the touched event inside your new function

lilac wasp
#
local function ShowIt(button)
        
        button.CanTouch = false
        stage.Value = button.Name
        task.wait()
        plr.Character:MoveTo(workspace.Bases[plr.Name].Checkpoints[stage.Value].Position)

        local staVal = stage.Value

        if staVal == 2 then

            goMessage("fasfas", "fhdhfhdf")
            return

        elseif staVal == 3 then

        elseif staVal == 4 then
        elseif staVal == 5 then

        elseif staVal == 6 then

        elseif staVal == 7 then

        end
        
    end
        
        button.Touched:Connect(function()
            ShowIt(button)
        end)
#

You meant that right?

safe rune
#

yes

#

but at the end make it button.Touched:Once(function()

lilac wasp