generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Please Help Me With This

Previous Thread :: Next Thread 
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
05 Jun 2016 09:07 PM
Tying to make a gui appear when you die. Won't work. Thanks in advance.

Code Below.

local plr = game.Players.LocalPlayer
local gui = game.StarterGui.ScreenGui
local txt = gui.TextLabel
local char = game.Workspace.Player1

function sequence(text)
text.Visible=true
wait(1)
text.Visible=false
wait(1)
text.Visible=true
wait(1)
text.Visible=false
wait(1)
text.Visible=true
wait(1)
text.Visible=false
wait(1)
text.Visible=true
wait(1)
text.Visible=false
wait(1)
end

char.Health.Changed:connect(function()
if char.Health==0 then
gui:Clone().Parent=plr.PlayerGui
if plr.PlayerGui:findFirstChild("ScreenGui") then
sequence(plr.PlayerGui:findFirstChild("ScreenGui").TextLabel)
end
end
end)
Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
05 Jun 2016 09:10 PM
Bump
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 09:11 PM
Using Local scripts to do things when the player dies is a little problematic because the local scripts typically get reset, or the character that they are referencing does, and all that nasty voodoo.

Why doesn't this work? What are the errors, or what does it do that you don't want it to do?


Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
05 Jun 2016 09:11 PM
Error Says 22:05:31.353 - Player1 is not a valid member of Workspace
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 09:20 PM
Change it to

char = player.Character


Report Abuse
Robobloxguy10 is not online. Robobloxguy10
Joined: 06 Sep 2012
Total Posts: 526
05 Jun 2016 09:20 PM
kk ty
Report Abuse
Soybeen is not online. Soybeen
Joined: 17 Feb 2010
Total Posts: 21462
05 Jun 2016 09:22 PM
or, plr.Character, as you have it referenced. <3


Report Abuse
eRanged is not online. eRanged
Joined: 15 Jun 2013
Total Posts: 9746
05 Jun 2016 09:42 PM
use PlayerGui instead of StarterGui btw
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image