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: Why does this script crash my game?

Previous Thread :: Next Thread 
Beta2 is not online. 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 is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
18 Jun 2012 08:25 AM
Is PlatformStand a value?
Report Abuse
Beta2 is not online. Beta2
Joined: 11 Apr 2008
Total Posts: 1038
18 Jun 2012 08:29 AM
It's a bool value property of humanoids.
Report Abuse
MetroidSlayer is not online. MetroidSlayer
Joined: 14 Dec 2009
Total Posts: 845
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
MetroidSlayer is not online. MetroidSlayer
Joined: 14 Dec 2009
Total Posts: 845
18 Jun 2012 08:39 AM
Opps, I put 'icon' by accident. Replace it with 't' for your script.
Report Abuse
Beta2 is not online. Beta2
Joined: 11 Apr 2008
Total Posts: 1038
18 Jun 2012 09:07 AM
what is icon?
Report Abuse
Beta2 is not online. Beta2
Joined: 11 Apr 2008
Total Posts: 1038
18 Jun 2012 09:07 AM
oh nvm
Report Abuse
Beta2 is not online. 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 is not online. 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 is not online. 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
MetroidSlayer is not online. MetroidSlayer
Joined: 14 Dec 2009
Total Posts: 845
18 Jun 2012 10:54 AM
Because "remove()" has been dipricated. Now you should start using "Destroy()"
Report Abuse
mrpricetoyou is not online. mrpricetoyou
Joined: 25 Nov 2011
Total Posts: 5160
18 Jun 2012 11:18 AM
It has???? I have to go fix half of my scripts now...
Report Abuse
Beta2 is not online. 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 is not online. 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
ap3ratesl3fe is not online. ap3ratesl3fe
Joined: 02 Apr 2012
Total Posts: 822
18 Jun 2012 12:00 PM
:remove() is one of my instincts! They can't change that!
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