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

cant make a screen gui visible?

I wanted to make a screen gui that pops-up when player touchs a part and closes after the player stops touching the part and i want it to be clickable but i could only do this

script.Parent.Touched:connect(function(hit)
	humanoid = hit.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		player = game.Players:GetPlayerFromCharacter(hit.Parent)
		player.PlayerGui.ScreenGui.TextButton.Visible = true
		wait()
	end
end)

4 comments

0

You need to add Textbutton.Visible = false, but I think you have that covered. Did you even call the function anyways?

0

does this work already ? plus you might wanna add a debounce

0

I don't suggest you to use the Touched event, instead check for the distance of the player from the part, so that you can easily tell whenever the player steps in / out.

0

You've done it right, but you gotta do player.PlayerGui.ScreenGui.Enabled = true instead for player.PlayerGui.ScreenGui.TextButton.Visible = true at line 5!

2 answers

✓ Accepted answer
script.Parent.Touched:Connect(function(hit)
    humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid ~= nil then
        player = game.Players:GetPlayerFromCharacter(hit.Parent)
        player.PlayerGui.ScreenGui.Enabled = true
        wait()
    end
end)

You were making thee TextButton visible rather than enabling the ScreenGui.

script.Parent.Touched:Connect(function(hit)
    humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid ~= nil then
        player = game.Players:GetPlayerFromCharacter(hit.Parent)
        player.PlayerGui.ScreenGui.Enabled = true
        wait()
    end
end)

All you did was make only the button visible instead of the gui itself

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