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

how do i make a script that makes it when you touch a part it turns visible?

Asked by 4 years ago
Edited 4 years ago

i want a script that when you touch a part it makes so that a part turns visible but the part does not turn visible and I get no output

this is my script:

script.Parent.Touched:Connect(function()

game.StarterGui.ScreenGui.Frame.Visible = true

end)

0
StarterGui is not a working thing.It just replicates the GUIs to everyone.So you need to do is player.PlayerGui DERP9487 41 — 4y
0
oh ok thank you so much enderlazerthemlg 9 — 4y
0
still doesnt work do i keep it the screengui on startergui or do i just leave it there and switch the game.startergui into game.player.startergui? enderlazerthemlg 9 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Hi, your script is close to correct, just that there are some errors. Here is the correct script:

script.Parent.Touched:Connect(function()
    for number,player in pairs(game.Players:GetPlayers()) do
        player.PlayerGui.ScreenGui.Enabled = true --Set ScreenGui.Enabled to false at first.
    end
end)

So basically this is what it does:

1. We get a table of the players using game.Players:GetPlayers()
2. Check for the part being touched
3. Use a generic for loop to handle ScreenGui.Enabled
0
oh ok thats better enderlazerthemlg 9 — 4y
0
sure HomieFirePGN 137 — 4y
Ad

Answer this question