|
| 01 Aug 2017 10:21 AM |
What the tool is supposed to do: It's just for roleplay, however, it has a button called "Sterilize tool", when this is clicked it should delete the tool from the user's inventory AND from their Character (if it's equipped).
What I have so far: So far, the tool only shows the GUI when clicked (good), and is correctly positioned.
How the tool is formatted:
tool Handle Script - (This is the one that has the delete script) LocalScript ScreenGui Frame ImageButton
-------------- I tried to use this script: local Gui = script.Parent.LocalScript.GUI.Frame.ImageButton local player = game.Players.LocalPlayer local tool = player.Character:FindFirstChild'Dental Pick' Gui.MouseButton1Down:Connect(function() tool:Destroy() end)
But it doesn't work. |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Aug 2017 10:31 AM |
| I think you should use the 'If Statement' for the above code |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 10:32 AM |
I think you need to add parentheses on FindFirstChild("Dental Pick")
if that doesn't work try changing the normal script to a local script, as most(if not all) normal scripts can't view guis in the PlayerGui
|
|
|
| Report Abuse |
|
|
|
| 01 Aug 2017 10:33 AM |
if player.Character:FindFirstChild'Dental Pick
then Tool:Destroy |
|
|
| Report Abuse |
|
|
| |
|
Elbixdio
|
  |
| Joined: 03 Aug 2016 |
| Total Posts: 38 |
|
|
| 01 Aug 2017 10:39 AM |
| here: local Gui = script.Parent.LocalScript.GUI.Frame.ImageButton local player = game.Players.LocalPlayer local tool = ###################################### Pick' ####################################### if tool.Parent ~= ### then tool:Destroy() end end) |
|
|
| Report Abuse |
|
|