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
|
  |
| 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
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
| |
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 05 Sep 2011 10:10 AM |
| fixed it myself, although with Variables.. |
|
|
| Report Abuse |
|
|