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'm trying to make a script, help?

Previous Thread :: Next Thread 
manops5 is not online. manops5
Joined: 06 Nov 2009
Total Posts: 49
04 Sep 2013 11:54 PM
I'm new to scripting, but this should be pretty easy for you guys. I want a script to make a brick hurt/kill you on-touch, but ONLY if the brick is collidable. So if the brick turns uncollidable, it won't hurt you anymore. Help is greatly appreciated! Thank you!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
04 Sep 2013 11:56 PM
go to roblox wiki
Report Abuse
Maileh is not online. Maileh
Joined: 14 Jun 2011
Total Posts: 1067
05 Sep 2013 12:03 AM
http://wiki.roblox.com/index.php/Scripting_Book
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
05 Sep 2013 12:09 AM
Im experimenting with returns, so this may not work.

Inside a part.

lal = script.Parent

lal.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") and hit.CanCollide == false then return end
hit.Parent.Humanoid:TakeDamage(100)
end
end)
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
05 Sep 2013 12:15 AM
OP asked to not kill the player when the BRICK is not collideable, so yeah it broke.
But I dun see wai u has to use return fo dis.

Line4: hit.CanCollide == false change to lal.CanCollide == false then return end

lal = script.Parent

lal.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") and lal.CanCollide == false then return end
hit.Parent.Humanoid:TakeDamage(100)
end
end)
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
05 Sep 2013 12:17 AM
Facepalm, exactly why theres a return, it does nothing if uncancollide.
If its not, it proceeds to the next line. Also error, you were checking if script.Parent was cancollides.

Get on my lvl fro
Lal jk
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
05 Sep 2013 12:19 AM
Meh, screw return, nobody likes it, Roblox, REMOVE IT
Report Abuse
Infocus is not online. Infocus
Joined: 28 Apr 2011
Total Posts: 8022
05 Sep 2013 12:20 AM
True, i kind of still dont get it, but looking at it now, its oretty helpful.
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
05 Sep 2013 12:20 AM
Shaddap,
STAHP LARNIN RETURN U NAB
lel jkbruh cheel

"Meh, dis is my forum signature"
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
05 Sep 2013 04:01 AM
brick = script.Parent
touched = false
brick.Touched:connect(function(part)
if touched then return end
touched = true
if not brick.CanCollide then touched = false return end
local player = game.Players:GetPlayerFromCHaracter(part.Parent)
if not player then touched = false return end
local char = player.Character
it not char then touched = false return end
char:BreakJoints()
touched = false
end)
Report Abuse
baheeg is not online. baheeg
Joined: 19 Jul 2010
Total Posts: 72846
05 Sep 2013 04:49 AM
[ Content Deleted ]
Report Abuse
cheatmaster18 is not online. cheatmaster18
Joined: 29 Oct 2010
Total Posts: 1871
05 Sep 2013 06:42 AM
@Above

What are you talking about?
I use scripts like that everytime and they always work.
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