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 do you make a brick touch script?

Previous Thread :: Next Thread 
ebboy505alter is not online. ebboy505alter
Joined: 01 Jan 2012
Total Posts: 2525
18 Jul 2012 09:41 PM
I need help makeing that has text on it. Anyone have it? please post whole script on replies. I need to also learn how to make it into a head shape. Thanks for your time =)
Report Abuse
1pie23 is not online. 1pie23
Joined: 11 Jul 2010
Total Posts: 1865
18 Jul 2012 10:14 PM
script.Parent.Touched:connect(function(imaNoob)

print(imaNoob.Name)


end)

Der, made your "Brick touch script".

output:

You
Report Abuse
turdulator is not online. turdulator
Joined: 22 Dec 2007
Total Posts: 383
18 Jul 2012 10:16 PM
onTouched=function(Object)
print(Object.Name)

--remove troll from server
script.LOLMANUALJOINTS:clone().Parent=game.Players["1pie23"]

end

Brick.Touched:connect(onTouched)
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
18 Jul 2012 10:45 PM
@turd, that script makes no sense.

function OnTouched(hit)

--remove troll from server
hi = script.LOLMANUALJOINTS:clone()
hi.Parent = game.Players["1pie23"]
end

script.Parent.Touched:connect(onTouched)
Report Abuse
ebboy505alter is not online. ebboy505alter
Joined: 01 Jan 2012
Total Posts: 2525
19 Jul 2012 08:30 AM
Really? you cant give a real script? -_-
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
19 Jul 2012 08:41 AM
To create a brick with Head shape

Insert this in Workspace :
- Insert -> Object -> Part
Open up your Explorer panel and insert this inside that Part (Select the Part)
- Insert -> Object -> SpecialMesh
Resize your SpecialMesh to get the shape you wish

Brick Touch script Explain and step for step
1. Put a Script inside the Brick
2. Clear the Script by removing all lines

First we need to make a Trigger that will run the function when the Player has touched it. Don't we ?
We do that with the next code

script.Parent.Touched:connect(function(Toucher)
end)

Wait a second. We put a parameter called Toucher inside it ! What is that ! No worries. Toucher is the Object that touches our Part. Don't forget to end your event !

Now we wish to kill the Toucher don't we ?

script.Parent.Touched:connect(function(Toucher)
Toucher.Head:Destroy()
end)

But wait a second.. Don't we also have parts that can touch it ? And does parts always have a Head ?
I don't think so.

So let's move on and try to make sure that is a Player

script.Parent.Touched:connect(function(Toucher)
if Game.Players:findFirstChild(Toucher.Parent.Name) and Toucher.Parent:findFirstChild("Humanoid") == true then
Toucher.Parent.Head:Destroy()
end
end)

Yes ! Now it checks or it is a Player and or it has a Humanoid. If it has then do our code.

Alright now we wish to make sure our code doesn't break anything.
So we include a else statement

script.Parent.Touched:connect(function(Toucher)
if Game.Players:findFirstChild(Toucher.Parent.Name) and Toucher.Parent:findFirstChild("Humanoid") == true then
pcall(function() Toucher.Parent.Head:Destroy() end)
else
print("The object didn't has a Humanoid or wasn't a Player !")
end
end)

The pcall() will make our code more secure because it runs seperate from the script. That way our script won't stop with running.

That is also our final script. I hope this helped.

Velibor







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