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: Positioning Inside a player?

Previous Thread :: Next Thread 
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
05 Sep 2013 05:32 PM
So, I wrote a little script to cause a fire to appear inside a brick when you touch it. I want to make it so that when you touch it, the fire appears inside your torso. Here's the script:

function onFire(part)
local fire = Instance.new("Fire",script.Parent)
fire.Position = script.Parent.Position
end

script.Parent.Touched:connect(onFire)

How would I do that? I'ma novice scripter, and haven't yet learned.
Report Abuse
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
05 Sep 2013 05:34 PM
function spread(hit)
if hit.Parent.Humanoid then local f=Instance.new("Fire",hit.Parent.Torso)
end
script.Parent.Touched:connect(spread)

you would put that in the brick
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
05 Sep 2013 05:48 PM
Are spread and hit a function? How do they work?
Report Abuse
Wolves25 is not online. Wolves25
Joined: 24 Feb 2009
Total Posts: 208
05 Sep 2013 06:08 PM
A function is anything you want it to be. It can have any name you want. So say we create a function named fire.

function fire(hit)

In the parentheses is your argument. So in the case of a touched script, the argument is what is touching the brick.

so then you'd type out your script and then end it with this

script.Parent.Touched:connect(fire)

What that means is that you are calling the function fire when the brick is touched. Hope this helped!
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
05 Sep 2013 06:11 PM
Wolves, thanks, but I know that stuff. What I don't know are what hit and spread are. Are they functions, or arguments, or what? And what do they do?
Report Abuse
Wolves25 is not online. Wolves25
Joined: 24 Feb 2009
Total Posts: 208
05 Sep 2013 06:15 PM
Spread is the name of the function. And hit is the argument. What that means is, hit is the object that touches the brick. So it'd be the player's body part that touched the brick. Think of hit as a tag for the thing that touches the brick. So let's say that the players torso touches the brick. Hit would represent game.Workspace.PlayerName.Torso
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
06 Sep 2013 08:00 PM
The script still just adds fire to the brick, not player torso. Here it is, with what you guys made:

function onFire(part)
local fire = Instance.new("Fire",script.Parent)
fire.Position = script.Parent.Position
end

script.Parent.Touched:connect(onFire)

function spread(hit)
if hit.Parent.Humanoid then local f=Instance.new("Fire",hit.Parent.Torso)
end
script.Parent.Touched:connect(spread)
end
Report Abuse
KodakKid3 is not online. KodakKid3
Joined: 25 Dec 2008
Total Posts: 2860
06 Sep 2013 08:06 PM
Nevermind guys.
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