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

why wont my screengui show up when your touching a block?

Asked by 4 years ago
Edited 4 years ago

I am sorry for my bad explaining here:

I have a Script Which will Show An Gui. I've set Visible to false on properties

The problem is that the gui wont show up when i touch the part.

Heres the script:

01local parent = script.Parent
02local Gui1 = game.StarterGui.WelcomeScene.Text1
03 
04parent.Touched:Connect(function()
05    parent.CanCollide = false
06    print("Starting['welcomeScene']")
07    Gui1.Visible = true
08    wait(2)
09    Gui1.Visible = false
10end)

When i check the Output there is no errors. Is there anyone that know how to fix this? (or is my studio glitched)

1 answer

Log in to vote
0
Answered by
raid6n 2196 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

First, you forgot the debounce variables, and you're doing it incorrect, second, make sure WelcomeScene is visible as well, and use PlayerGui so it's visible for only the person who touched it. Also, make sure script.Parent is the part.

Code:

01local debounce = false
02script.Parent.Touched:Connect(
03    function(hit)
04        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
05        if player then
06            local WelcomeScene = player.PlayerGui.WelcomeScene
07            if debounce == false then
08                debounce = true
09                parent.CanCollide = false
10                print("Starting WelcomeScene")
11 
12                WelcomeScene.Enabled = true
13                WelcomeScene.Text1.Visible = true
14                wait(2)
15                WelcomeScene.Enabled = false
View all 21 lines...
0
script.Parent was the part. But yeah thank you! i learned mutch about this (or am i just stupid lol?) HKprogram 48 — 4y
Ad

Answer this question