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
 

On Touch GUI Scripting Problem

Previous Thread :: Next Thread 
rowerowe71 is not online. rowerowe71
Joined: 14 Apr 2013
Total Posts: 1999
29 Mar 2014 08:43 PM
This is supposed to make a GUI pop up when you collide with a certain part.



function onTouched(part)
if part.Parent then
local h = part.Parent:FindFirstChild("Humanoid")
if h then
game.ServerStorage.Checking:Clone() .Parent = h.PlayerGUI()
end
end
end
script.Parent.Touched:connect(onTouched)
Report Abuse
largepumpkinhead is not online. largepumpkinhead
Joined: 13 Mar 2011
Total Posts: 20
29 Mar 2014 08:47 PM
.PlayerGUI()

that's not how you get PlayerGui
Report Abuse
Imacheeseburger is not online. Imacheeseburger
Joined: 16 Jun 2011
Total Posts: 142
29 Mar 2014 08:51 PM
..Omg, people can't script for their lives today.. Try this:
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
check=game.ServerStorage.Checking:clone()
plrgui=game.Players:PlayerFromCharacter(hit.Parent).PlayerGui
check.Parent=plrgui
end
end
script.Parent:connect(onTouched)
Report Abuse
Rapster2 is not online. Rapster2
Joined: 16 Oct 2009
Total Posts: 1865
29 Mar 2014 08:57 PM
You need to use:

game:GetService("ServerStorage")

in order to get it.

You also need the Player, not just the character.


Here's my version:

function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local storage = game:GetService("ServerStorage")
local plyr = game.Players:GetPlayerFromCharacter(hit.Parent)
storage.Checking:Clone().Parent = plyr.PlayerGui
end
end
script.Parent.Touched:connect(onTouched)
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