Hello. I've been trying to make it so when this script is executed, it turns the Gui located in startergui visible. By default, I disabled the visible feature. I included a print statement after the visible code and it does print, however it doesn't show on your screen. I was wondering how can you make it so it shows on the players screen? Thanks!
Code:
01 | pop = script.Parent.Sound |
02 |
03 | function crash(hit) |
04 | if hit.Parent.Name = = "Hammer" then |
05 | wait( 0.1 ) |
06 | game.StarterGui.bankg.b 1. Visible = true |
07 | game.StarterGui.bankg.b 2. Visible = true |
08 | game.StarterGui.bankg.b 3. Visible = true |
09 | print ( "gui visible" ) |
10 |
11 | script.Parent.Transparency = 1 |
12 | script.Parent.CanCollide = false |
13 | script.Parent.Parent.BrokenWindow [ "Broken Window" ] .Transparency = 0.7 |
14 | script.Parent.Parent.BrokenWindow [ "Broken Window" ] .CanCollide = true |
15 | pop:Play() |
this should work for a server script.
if it doesnt, let me know
01 | game.Players.PlayerAdded:connect( function (player)) |
02 | pop = script.Parent.Sound |
03 |
04 |
05 | function crash(hit) |
06 | if hit.Parent.Name = = "Hammer" then |
07 | wait( 0.1 ) |
08 | player.Playergui.bankg.b 1. Visible = true |
09 | player.Playergui.bankg.b 2. Visible = true |
10 | player.Playergui.bankg.b 3. Visible = true |
11 | print ( "gui visible" ) |
12 |
13 | script.Parent.Transparency = 1 |
14 | script.Parent.CanCollide = false |
15 | script.Parent.Parent.BrokenWindow [ "Broken Window" ] .Transparency = 0.7 |
Please, for the sake of scripting future, don't edit StarterGui unless necessary!!!!!! You can use loops to iterate through the players..
01 | pop = script.Parent.Sound |
02 |
03 | local function changeGui(boolean) --Lets make a function to change the GUI. In our case, "true"means visible, and "false" means invisible |
04 | for i,v in pairs (game.Players:GetPlayers()) do --Iterate through players |
05 | v:FindFirstChild( "PlayerGui" ).bankg.b 1. Visible = boolean |
06 | v:FindFirstChild( "PlayerGui" ).bankg.b 2. Visible = boolean |
07 | v:FindFirstChild( "PlayerGui" ).bankg.b 3. Visible = boolean |
08 | end |
09 | end |
10 |
11 | function crash(hit) |
12 | if hit.Parent.Name = = "Hammer" then |
13 | wait( 0.1 ) |
14 | changeGui( true ) --Visible |
15 | print ( "gui visible" ) |
StarterGui will ONLY update for player's who join or respawn after the change!
Okay so don't use game.StarterGui. That doesn't do. If you a using a server script, change it to a local script.
01 | plr = game.Players.LocalPlayer |
02 | pop = script.Parent.Sound |
03 |
04 | function crash(hit) |
05 | if hit.Parent.Name = = "Hammer" then |
06 | wait( 0.1 ) |
07 | game.StarterGui.bankg.b 1. Visible = true |
08 | game.StarterGui.bankg.b 2. Visible = true |
09 | game.StarterGui.bankg.b 3. Visible = true |
10 | print ( "gui visible" ) |
11 |
12 | script.Parent.Transparency = 1 |
13 | script.Parent.CanCollide = false |
14 | script.Parent.Parent.BrokenWindow [ "Broken Window" ] .Transparency = 0.7 |
15 | script.Parent.Parent.BrokenWindow [ "Broken Window" ] .CanCollide = true |