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: Does this work?

Previous Thread :: Next Thread 
Ferseus is not online. Ferseus
Joined: 23 May 2013
Total Posts: 247
26 Jun 2013 06:48 AM
function onEquipped()
script.Parent.GUI.Parent = game.Players.LocalPlayer.PlayerGui
end

function onUnequipped()
if game.Players.LocalPlayer.PlayerGui:findFirstChild("GUI")then
game.Players.LocalPlayer.PlayerGui:findFirstChild("GUI").Parent = script.Parent
end
end

script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)

I put this in a local script.
Report Abuse
Ferseus is not online. Ferseus
Joined: 23 May 2013
Total Posts: 247
26 Jun 2013 06:53 AM
Whenever I equip the tool the Gui doesn't appear
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
26 Jun 2013 06:54 AM
hm... Dunno if it works, I don't know which circumstances you're under. If there's a script changing the name of the Players service, then no, ect.

Also, you can make your script better and more flexible by:
1) Cloning the GUI
2) Storing the cloned GUI as a variable.
(3) Use :GetService or :service? Dunno.)

local tool = script.Parent
local gui = script:FindFirstChild("GUI")
if not gui then return end
local clonedgui

tool.Equipped:connect(function(mouse)
clonedgui = gui:clone()
clonedgui.Parent = game:service("Players").LocalPlayer:FindFirstChild("PlayerGui")
end)

tool.Unequipped:connect(function()
if clonedgui then
clonedgui:Destroy()
end
end)


- As, not a +, but a -
Report Abuse
As8D is online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
26 Jun 2013 06:55 AM
^ Woops, that script is if the ScreenGui named GUI is found inside the LocalScript you're running.

- As, call me master. And give me cake. omnom. c:
Report Abuse
Ferseus is not online. Ferseus
Joined: 23 May 2013
Total Posts: 247
26 Jun 2013 07:01 AM
Thanks master but I dun have cake :3
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