Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 1 month ago
Edited 1 month 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:

local parent = script.Parent
local Gui1 = game.StarterGui.WelcomeScene.Text1

parent.Touched:Connect(function()
    parent.CanCollide = false
    print("Starting['welcomeScene']")
    Gui1.Visible = true
    wait(2)
    Gui1.Visible = false
end)

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 2290 Moderation Voter Community Moderator
1 month ago
Edited 1 month 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:

local debounce = false
script.Parent.Touched:Connect(
    function(hit)
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
            local WelcomeScene = player.PlayerGui.WelcomeScene
            if debounce == false then
                debounce = true
                parent.CanCollide = false
                print("Starting WelcomeScene")

                WelcomeScene.Enabled = true
                WelcomeScene.Text1.Visible = true
                wait(2)
                WelcomeScene.Enabled = false
                WelcomeScene.Text1.Visible = false
                debounce = false
            end
        end
    end
)

0
script.Parent was the part. But yeah thank you! i learned mutch about this (or am i just stupid lol?) HKprogram 39 — 1mo
Ad

Answer this question