I know I've done this before, I just forgot how. This is what I tried:
1 | function blind() |
2 | game.StarterGui.ScreenGui.BLIND.Visible = true |
3 | end |
4 |
5 | script.Parent.Touched:connect(blind) |
Here, try this one. In order for this to work, the gui can't be visible.
01 | local part = script.Parent -- We declare the part as a variable since it has the script inside |
02 |
03 |
04 | part.Touched:connect( function (plr) -- We connect the part into a function with a parameter |
05 | local humanoid = plr.Parent:FindFirstChild( "Humanoid" ) -- We are looking for a humanoid since we don't want anything else to touch the part except the player |
06 | if humanoid then -- if there's a humanoid then.. |
07 | local name = game.Players:FindFirstChild(plr.Parent.Name) -- We look for the player's name to be sure he/she exists |
08 | name.PlayerGui.ScreenGui.BLIND.Visible = true -- We look inside his/her PlayerGui to make the frame visible to true |
09 | end |
10 | end ) |
You are making the one in the StarterGui visible, not the one in PlayerGui.
To get the playerGui do this:
1 | script.Parent.Touched:connect( function (hit) |
2 | if game.Players:FindFirstChild(hit.Parent.Name) then --Make sure that the player exists |
3 | local pl = game.Players:FindFirstChild(script.Touched.Parent.Name) --Get the player |
4 | local plGui = pl:FindFirstChild( "PlayerGui" ) --Find "PlayerGui" in the player |
5 | plGui.ScreenGui.BLIND.Visible = true |
6 | end |
7 | end ) |