Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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
)

1 comment

0

script.Parent was the part. But yeah thank you! i learned mutch about this (or am i just stupid lol?)

This discussion is preserved as it was. New answers, comments, and votes are closed.