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: on touch gui giver problem?

Previous Thread :: Next Thread 
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 02:54 PM
The script only gives the gui once for the whole game. I tried reseting and touching it but it will only give it to me once. Any help?

gui = game.Lighting.Q1:clone()
script.Parent.Touched:connect(function(plr)
if plr.Parent:findFirstChild("Humanoid") then
local plyr = game.Players:findFirstChild(plr.Parent.Name)
gui.Parent = plyr.PlayerGui
end end)
Report Abuse
xXTheRobotXx is not online. xXTheRobotXx
Joined: 05 May 2012
Total Posts: 13343
19 Sep 2012 02:57 PM
function ont(hit)
local g = game.Players:GetPlayerFromCharacter(hit.Parent)
game.Lighting.QI:clone().Parent = g.PlayerGui
end

script.Parent.Touched:connect(ont)
Report Abuse
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 02:59 PM
Tried it. Here's the output:

15:58:49.700 - Workspace.Q1.Script:3: attempt to index local 'g' (a nil value)
15:58:49.701 - Script "Workspace.Q1.Script", Line 3
15:58:49.707 - stack end
15:58:49.724 - Disconnected event because of exception
Report Abuse
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 03:04 PM
B
BU
BUM
BUMP
BUM
BU
B
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
19 Sep 2012 03:05 PM
Make sure g is there.
Report Abuse
MonkeyForBananas is not online. MonkeyForBananas
Joined: 17 Sep 2012
Total Posts: 52
19 Sep 2012 03:11 PM
I fixed the problem. All it needed was an if statement. Thanks for the help. :)
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
19 Sep 2012 03:25 PM

local plyr = game.Players:findFirstChild(plr.Parent.Name)

script.Parent.Touched:connect(function(plr)
a = plr.Parent:findFirstChild("Humanoid") then
gui = game.Lighting.Q1:clone().Parent = plyr.PlayerGui
end end) --dunno about ends
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