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

Need help with making a Gui show up and dissapear if the player clicked somewhere else?

Asked by
Admin8483 -21
6 years ago
Edited 6 years ago

I need this script to make the Gui disappear if the player clicked somewhere other than the certain area.

local Time = 4
script.Parent.MouseButton1Down:connect(function()
script.Parent.Selected.Visible = true
wait(4)
script.Parent.Selected.Visible = false
end)
script.Parent.MouseButton1Down:connect(function()
wait(0.5)
--[[I am stuck here. I need a way to tell if the Player clicked somewhere else other than script.Parent.Selected.Click (The name of the thing to click), and still let them click other things.]]--
0
please paste entire script wookey12 174 — 6y

1 answer

Log in to vote
0
Answered by
DanzLua 2879 Moderation Voter Community Moderator
6 years ago

Im guessing that the gui you were talking about was on line 16 so what I did was I created a debounce so that you couldn't click it multiple times and it would make the gui visible, wait 4 seconds, then make it invisible

local Time = 4
script.Parent.MouseButton1Down:connect(function()
script.Parent.Selected.Visible = true
end)
script.Parent.MouseButton1Down:connect(function()
    while true do
    wait(1)
    if Time == 0  then
        script.Parent.Selected.Visible = false
    else
        wait(1)
    end
end
end)
local d = true
script.Parent.Selected.Click.MouseButton1Down:connect(function()
    if d==true then d=false
        script.Parent.Parent.Parent.Load.Assassin.Visible = true
        wait(4)
        script.Parent.Parent.Parent.Load.Assassin.Visible = false
        d=true
    end
end)
0
Sorry, I got that part done (The Gui to show up was script.Parent.Selected), but I also need it to dissapear if the player clicked somewhere else than script.Parent.Selected.Click (Name of the button) Admin8483 -21 — 6y
Ad

Answer this question