saka34
|
  |
| Joined: 11 Oct 2010 |
| Total Posts: 369 |
|
|
| 03 Aug 2015 04:48 PM |
When the player clicks the 'play' button I need two things to happen.
1. The player resets and spawns at the team spawn point(or one of them). and 2. The gui disappears forever.
I have #1 down. How do I make the whole GUI disappear? I have a little script written. You're welcome to look.
local Button = script.Parent
function onButtonClicked() script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 Button.Parent.Visible = false
end
script.Parent.MouseButton1Click:connect(onButtonClicked) |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 03 Aug 2015 04:49 PM |
| Don't put it in startergui, but replicatedstorage and clone it to the player when it first joins. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2015 04:58 PM |
-- If this is in a LocalScript, you can also try this:
local Button, Create = script.Parent, assert(LoadLibrary("RbxUtility")).Create local Player = game:GetService("Players").LocalPlayer
function onScriptLoaded() if (Player:FindFirstChild(Button.Parent.Name.."_Hidden")) then Button.Parent.Visible = false end end
function onButtonClicked() Player.Character.Humanoid.Health = 0 Button.Parent.Visible = false Create"BoolValue"{Name=Button.Parent.Name.."_Hidden";Parent=Player} end
Button.MouseButton1Click:connect(onButtonClicked) onScriptLoaded() |
|
|
| Report Abuse |
|
|
saka34
|
  |
| Joined: 11 Oct 2010 |
| Total Posts: 369 |
|
| |
|
saka34
|
  |
| Joined: 11 Oct 2010 |
| Total Posts: 369 |
|
| |
|
saka34
|
  |
| Joined: 11 Oct 2010 |
| Total Posts: 369 |
|
|
| 04 Aug 2015 09:23 AM |
| How would I clone it to the player? |
|
|
| Report Abuse |
|
|
| |
|
saka34
|
  |
| Joined: 11 Oct 2010 |
| Total Posts: 369 |
|
|
| 04 Aug 2015 09:41 AM |
| It IS in StarterGui. I just don't know how to remove it from the screen. |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2015 09:49 AM |
| script.Parent.Visible = false |
|
|
| Report Abuse |
|
|
Darkenus
|
  |
| Joined: 17 Jul 2014 |
| Total Posts: 1997 |
|
|
| 04 Aug 2015 10:04 AM |
| Put it in Replicated Storage. When their PLAYER IS ADDED, clone it to their gui. Then, when they click play, destroy the gui. |
|
|
| Report Abuse |
|
|
|
| 04 Aug 2015 10:21 AM |
-- Create a new Script in ServerScriptService, paste in the following code, and place your GUI inside the script. This should work.
local Players = game:GetService("Players")
function OnPlayerAdded(Player) repeat wait() until #script:GetChildren() > 0 local CloneGUI = script:GetChildren()[1]:Clone() CloneGUI.Parent = Player.PlayerGui end
Players.PlayerAdded:connect(OnPlayerAdded) |
|
|
| Report Abuse |
|
|