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 » Scripting Helpers
Home Search
 

Re: Why doesn't this work?

Previous Thread :: Next Thread 
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 02:47 PM
function onChildAdded(child)
if child.Name == "SeatWeld" then
game.StarterGui.ScreenGui.TextLabel.Visible = true
end
end

script.Parent.ChildAdded:connect(onChildAdded)
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 02:48 PM
There is no error in the output
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 02:53 PM
bump
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:00 PM
bump#2
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:00 PM
Why not just make it a .Touched and then remove with a .TouchEnded?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:02 PM
I have also tried that, and that doesn't work either. Here is what I did for the onTouched(hit)


function onTouched(hit)
game.StarterGui.ScreenGui.TextLabel.Visible = true
end

script.Parent.Touched:connect(onTouched)
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:06 PM
You realize that you are trying to change something in the StarterGui and not the PlayerGui right?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:06 PM
I'm so dumb sometimes -.-
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:07 PM
LOLZ
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:09 PM
For the player's name do I use LocalPlayer or plyrname?
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:12 PM
Or something completely different? ^
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:15 PM
Here's how I would do it:

local seat = script.Parent
seat.Touched:connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
local char = hit.Parent
local plyr = game.Players:GetPlayerFromCharacter(char)
plyr.PlayerGui.ScreenGui.TextLabel.Visible = true
end
end)
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:16 PM
In a normal script.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:17 PM
I have absolutely no idea what any of that means, but you've helped me with all of my problems so far and they've all worked, so I'll just take your word for it :3
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:20 PM
Lol lemme break this down for you.

local seat = script.Parent --Derp
seat.Touched:connect(function(hit) --Function right here with connection line in one line
local h = hit.Parent:FindFirstChild("Humanoid") --Checks to see if whatever touched the seat has a humanoid in it
if h then --If it is then
local char = hit.Parent --Character in game
local plyr = game.Players:GetPlayerFromCharacter(char) --Gets thePlayerFromCharacter basically lets you get the Player name from character like how you could by using game.Players.PlayerName.Character
plyr.PlayerGui.ScreenGui.TextLabel.Visible = true --Derpy
end --Ends if
end) --Ends function/event
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:23 PM
Thank you, it works great! But now, the second part of the script: removing the gui. This is the suggestion I got the other day, would this work?

ply.Character.Humanoid.Jumping:connect(function()
Frame.Visible = false
end)
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:27 PM
I tried it, it didn't work. What's wrong with it?
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:28 PM
Place it all under one script.

local seat = script.Parent
---[[Touched Event]]
seat.Touched:connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
local char = hit.Parent
local plyr = game.Players:GetPlayerFromCharacter(char)
plyr.PlayerGui.ScreenGui.TextLabel.Visible = true
end
end)
---[[ToucheEnded Event]]
seat.TouchEnded:connect(function(hit)
local h = hit.Parent:FindFirstChild("Humanoid")
if h then
local char = hit.Parent
local plyr = game.Players:GetPlayerFromCharacter(char)
plyr.PlayerGui.ScreenGui.TextLabel.Visible = false
end
end)

Basically the same script twice.
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:28 PM
It didn't work because ply and Frame weren't declared.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:39 PM
Yet again, WhiteRain is here to save me from being eaten up by my own stupidity.

Thank you so much.
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:40 PM
It happens to all of us from time to time.
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:42 PM
And your welcome.
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 03:49 PM
Give it half an hour and I'll probably have another problem :L
Report Abuse
WhiteRain is not online. WhiteRain
Joined: 24 Apr 2010
Total Posts: 2723
30 Jun 2012 03:52 PM
lolK
Report Abuse
Shadowknight619 is not online. Shadowknight619
Joined: 28 Sep 2010
Total Posts: 2453
30 Jun 2012 04:03 PM
Haha, didn't even last half an hour.

I'm having trouble with the indicators/blinkers (brickcolor issue). The scripts don't work, as expected; I've never done BrickColor before.

--On Gui:

while true do
game.Workspace.Plymouth.ModelBody.IndicatorL.BrickColor.new(Br. yellowish orange)
game.Workspace.Plymouth.ModelBody.IndicatorR.BrickColor.new(Br. yellowish orange)
wait(0.5)
game.Workspace.Plymouth.ModelBody.IndicatorL.BrickColor.new(Mid gray)
game.Workspace.Plymouth.ModelBody.IndicatorR.BrickColor.new(Mid gray)
end

--Off Gui:

function
game.Workspace.Plymouth.ModelBody.IndicatorL.BrickColor.new(Mid gray)
game.Workspace.Plymouth.ModelBody.IndicatorR.BrickColor.new(Mid gray)
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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