Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 08:18 AM |
This script crashes my game when used to click on a figure with PlatformStand engaged. I have no idea why.
bin=script.Parent
function onButton1Down(mouse) t= mouse.Target if t.Parent:findFirstChild("Humanoid") ~= nil and t.Parent:findFirstChild("Humanoid").PlatformStand == true then t.Parent.Humanoid.PlatformStand = false script.Parent:Remove() end end
function onEquipped(mouse) mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) end
script.Parent.Equipped:connect(onEquipped) |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
| |
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 08:29 AM |
| It's a bool value property of humanoids. |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2012 08:38 AM |
the Target tends to cause a lot of issues; expecually if it is clicked at nil (Clicked towards the sky). Add the following If statement at the beginning of your OnButton1Down function:
if (icon.Target ~= nil) then |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2012 08:39 AM |
| Opps, I put 'icon' by accident. Replace it with 't' for your script. |
|
|
| Report Abuse |
|
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
| |
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
| |
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 09:12 AM |
| No no matter where you click on the person, it says "disconnected because of exception" |
|
|
| Report Abuse |
|
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 09:14 AM |
Shouldn't it be this?
if t~=nil then
I tried it and it crashes again. |
|
|
| Report Abuse |
|
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 09:17 AM |
Never mind. I got it. For some reason the
script.Parent:Remove()
wasn't working. O_o |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2012 10:54 AM |
| Because "remove()" has been dipricated. Now you should start using "Destroy()" |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2012 11:18 AM |
| It has???? I have to go fix half of my scripts now... |
|
|
| Report Abuse |
|
|
Beta2
|
  |
| Joined: 11 Apr 2008 |
| Total Posts: 1038 |
|
|
| 18 Jun 2012 11:36 AM |
| Wait, why'd they do that? For technical reasons? |
|
|
| Report Abuse |
|
|
C0D3Y
|
  |
| Joined: 24 Jul 2010 |
| Total Posts: 1692 |
|
|
| 18 Jun 2012 11:39 AM |
| Remove parents the object to nil, destroy parents the object to nil and locks it. |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2012 12:00 PM |
| :remove() is one of my instincts! They can't change that! |
|
|
| Report Abuse |
|
|