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

cant make a screen gui visible?

Asked by 3 years ago
Edited 3 years ago

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)
0
You need to add Textbutton.Visible = false, but I think you have that covered. Did you even call the function anyways? CatGosCrazy 4 — 3y
0
does this work already ? plus you might wanna add a debounce VerdommeMan 1479 — 3y
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. Ponzimus 15 — 3y
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! xure1 0 — 3y

2 answers

Log in to vote
0
Answered by
ghxstlvty 133
3 years ago
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.

Ad
Log in to vote
0
Answered by 3 years ago
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

Answer this question