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: I can't get this script working.

Previous Thread :: Next Thread 
poke114 is not online. poke114
Joined: 06 Dec 2009
Total Posts: 2801
29 Sep 2012 11:13 PM
This script is one of the first ones I'm trying to develop, and I can't seem to get it to work properly. I've tested and altered it multiple times. I expect it to make a certain brick transparent and turning it's CanCollide property to false for 5 seconds when touched. I've tested and altered it multiple times, but I still can't seem to find the problem. Some help would be appreciated a lot. The script is below.

local brick = Test Piece

function (OnTouch) part
brick.Transparency=1
wait (5)
brick.Transparency=0

brick.touched:connect (OnTouch)

end

function (OnTouch) part
brick.CanCollide=false
wait(5)
brick.CanCollide-false

brick.touched:connect (OnTouch)
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
29 Sep 2012 11:13 PM
Whats 'Test Piece"?
Report Abuse
poke114 is not online. poke114
Joined: 06 Dec 2009
Total Posts: 2801
29 Sep 2012 11:15 PM
@thedeathmaster01

The specific brick the script is referring to. I just named it that to make the script easier to make.
Report Abuse
VanityComplex is not online. VanityComplex
Joined: 28 Aug 2012
Total Posts: 236
29 Sep 2012 11:23 PM
Easier or no, it's no surprise it doesn't work. You listed your argument incorrectly; it should be-

function OnTouch(part)

after that, any instance of 'part' will be the part that touched the brick, but that's irrelevant to this. Another thing; 'Test Piece' should have been equivalent to 'script.Parent', unless that's what 'brick' is.

Also, you didn't need two separate functions. You can combine a transparency function with a cancollide function. It'd look something like this...

X.Transparency = 1
X.CanCollide = false

Ultimately, you end up with something like this. But obviously not like this.


function Monkeyfarts(hooplah)
script.Parent.BrickColor = tostring("Bright Red")
script.Parent.Velocity = Vector3.new(math.random(-100,100),math.random(-100,100),math.random(-100,100))
end

script.Parent.Touched:connect(Monkeyfarts)
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