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

Gui not responding on mousebuttonclick?

Asked by 4 years ago

Heyo! So i'm making a script that when u click on "Play" u teleport and the menu disappears, now i got the teleport part working.. But the menu wont go away when u click on it. I have tried to figure it out last night and tried every possible situation i knew..

Here is the script please change it so it works, or any tips and improvements would be helpful. Thank you for reading, good luck.

local text = script.Parent.TextButton
local size = 50
local blur = game.Lighting.Blur
local credits = script.Parent.credits
local birthday = script.Parent.birthday
local CutBlur = game.Lighting.CutBlur

wait(38)
text.Visible = true
credits.Visible = true
birthday.Visible = true

blur.Enabled = true
wait(.1)
blur.Size = 1
wait(.1)
blur.Size = 2
wait(.1)
blur.Size = 3
wait(.1)
blur.Size = 4
wait(.1)
blur.Size = 5
wait(.1)
blur.Size = 6
wait(.1)
blur.Size = 7
wait(.1)
blur.Size = 8
wait(.1)
blur.Size = 9
wait(.1)
blur.Size = 10

text.MouseButtonClick:connect(function()
    CutBlur.Enabled = false
    game.StarterGui.TPGUI.Enabled = false
    blur.Size = 10
    wait(.1)
    blur.Size = 9
    wait(.1)    
    blur.Size = 8
    wait(.1)
    blur.Size = 7
    wait(.1)
    blur.Size = 6
    wait(.1)
    blur.Size = 5
    wait(.1)
    blur.Size = 4
    wait(.1)
    blur.Size = 3
    wait(.1)
    blur.Size = 2
    wait(.1)
    blur.Size = 1
    wait(.1)
    blur.Enabled = false
print("Menu succefull")
end)

3 answers

Log in to vote
0
Answered by 4 years ago

Hello, your script is not working because of THIS:

This is what you have to have:


text.MouseButton1Click:Connect(function()

This is what you had:


text.mousebuttonclick:connect(function()

Hope it helps! Just woke up, so sorry if does not work.

0
Thank u so so so much! Ur a hero! DFROBUXX 28 — 4y
0
Np! alexfinger21 341 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

From what I can see, the waits you have seem to be yielding the script. So if I were you I'd close them in a function;

local text = script.Parent.TextButton
local size = 50
local blur = game.Lighting.Blur
local credits = script.Parent.credits
local birthday = script.Parent.birthday
local CutBlur = game.Lighting.CutBlur

local wrap = coroutine.wrap(function()
wait(38)
text.Visible = true
credits.Visible = true
birthday.Visible = true

blur.Enabled = true
wait(.1)
blur.Size = 1
wait(.1)
blur.Size = 2
wait(.1)
blur.Size = 3
wait(.1)
blur.Size = 4
wait(.1)
blur.Size = 5
wait(.1)
blur.Size = 6
wait(.1)
blur.Size = 7
wait(.1)
blur.Size = 8
wait(.1)
blur.Size = 9
wait(.1)
blur.Size = 10
end)()

text.MouseButtonClick:connect(function()
    CutBlur.Enabled = false
    game.StarterGui.TPGUI.Enabled = false
    blur.Size = 10
    wait(.1)
    blur.Size = 9
    wait(.1)    
    blur.Size = 8
    wait(.1)
    blur.Size = 7
    wait(.1)
    blur.Size = 6
    wait(.1)
    blur.Size = 5
    wait(.1)
    blur.Size = 4
    wait(.1)
    blur.Size = 3
    wait(.1)
    blur.Size = 2
    wait(.1)
    blur.Size = 1
    wait(.1)
    blur.Enabled = false
print("Menu succefull")
end)
wrap()

I have just woken up so I apologize if that didn't work!

0
Ill try that ty! But the blur doesnt really matter if it doesnt fade out, its more that the text button and the other buttons wont disappear. DFROBUXX 28 — 4y
Log in to vote
0
Answered by 4 years ago

The reason this code is not working is because on line 37 you are disabling the gui in the StarterGui. Every time your character loads in, everything in the starterGui is replicated to the player Gui. So in order to fix this, line 37 would look like this:

game.Players.LocalPlayer:WaitForChild("PlayerGui").TPGUI.Enabled = false 

So this code would get the local player in which the script in is and go to THEIR playerGui and disable it.

Whenever you are dealing with guis, never to into starterGui

I hope this helps!

(P.S. when you are blurring the gui, instead of making long lines of code just use a for loop):

--Blur is going up
for i = 1, 10 do 
    blur.Size = i 
    wait(.1) 
end

--For going down 
for i = 1, 10, -1 do 
    blur.Size = i 
    wait(.1) 
end
0
Thank you, the blur works with fading now but the gui still doesnt disappear.. DFROBUXX 28 — 4y
0
nvm it works now ty for the blur help! DFROBUXX 28 — 4y
0
No problem! Can you upvote my answer please! Sir_Ragealot 72 — 4y

Answer this question