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: Working with variables?

Previous Thread :: Next Thread 
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Sep 2011 02:14 PM
I need help with this script im making, for when a Gui is clicked once. The Gui clones a tool from the lighting to the player's backpack and selects it. When the Gui is clicked next, I want the tool to deselect (so the tool dosent magically stay selected) and delete the tool in the backpack. Please help? I have no idea no how to do this so i dont know how to start scripting it.
Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
03 Sep 2011 02:16 PM
script.Parent.MouseButton1Click:connect(function()

--Check to see if the tool is inside of the players character, If there is then delete it

--If the tool wasn't in the players character then clone it from the lighting and put it in the players character

end)
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Sep 2011 02:18 PM
so an if/else statement?
Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
03 Sep 2011 02:20 PM
Uhuh


If found == true then

--remove

else

--clone and place

end
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Sep 2011 02:21 PM
How would I find if the tool is in the backpack?
Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
03 Sep 2011 02:22 PM
Search for it's name,

:FindFirstChild("Tool's Name")
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Sep 2011 02:33 PM
I feel like being a newbie to scripting by asking this, but would

if script.Parent.Paremt.Parent.Parent.Parent.Backpack:FindFirstChild("Clone Part") work as the If statement to checking the part is there?
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
03 Sep 2011 02:34 PM
I ment tool when i said "checking the part is...".
Report Abuse
Xsitsu is not online. Xsitsu
Joined: 28 Jul 2009
Total Posts: 2921
03 Sep 2011 02:39 PM
Yeah that would work. But you would want to do this to remove the tool if it's in their backpack or if they have it equipped.



if navigation.to.players.Backpack:FindFirstChild("ToolName")==false and navigation.to.players.Character:FindFirstChild("ToolName")==false then

tool:clone().Parent = players.Character

else

if navigation.to.players.Backpack:FindFirstChild("ToolName") then
navigation.to.players.Backpack:FindFirstChild("ToolName"):remove()
end

if navigation.to.players.Character:FindFirstChild("ToolName") then
navigation.to.players.Character:FindFirstChild("ToolName"):remove()
end

end
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
04 Sep 2011 04:52 AM
navigation.to.?
Report Abuse
digpoe is not online. digpoe
Joined: 02 Nov 2008
Total Posts: 9092
05 Sep 2011 10:10 AM
fixed it myself, although with Variables..
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