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: How would i say...

Previous Thread :: Next Thread 
paulruffy is not online. paulruffy
Joined: 04 Jan 2011
Total Posts: 76
28 Apr 2014 11:55 AM
How would i say "If a brick is touched by a robloxian then"... "Do something to that robloxian"
Report Abuse
StealthKing95 is not online. StealthKing95
Joined: 13 Dec 2008
Total Posts: 4263
28 Apr 2014 11:56 AM
brick = workspace.Part

brick.Touched:connect(function(hit)
if hit.Parent:findFirstChild("Humanoid") then
if game.Players:findFirstChild(hit.Parent.Name) then
local robloxian = hit.Parent
robloxian.Humanoid.Health = 0
end
end
end)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
28 Apr 2014 11:56 AM
script.Parent.Touched:connect(function(hit)
plr=game.Players:findFirstChild(hit.Parent.Name)
if plr then
--code
end
end)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
28 Apr 2014 11:57 AM
@above,
"if hit.Parent:findFirstChild("Humanoid") then"
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
28 Apr 2014 11:58 AM
...is a pointless line.

(Accidently pressed send - I'm on my phone)
Report Abuse
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
28 Apr 2014 11:59 AM
when something touches a brick you can use .Touched to connect function and it also gives you the brick that has touched that brick is usualy robloxians leg so you need to check if it rly is

function onTouch(part2)
if game.Players:GetPlayerFromCharacter(part2.Parent)then
local player = game.Players:GetPlayerFromCharacter(part2.Parent)
--what you want to do here
end
end

part1.Touched:connect(onTouch)
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