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

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

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)

3 comments

0

StarterGui is not a working thing.It just replicates the GUIs to everyone.So you need to do is player.PlayerGui

0

oh ok thank you so much

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?

1 answer

✓ Accepted answer

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

2 comments

0

oh ok thats better

0

sure

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