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: LUA Help!

Previous Thread :: Next Thread 
pokemonmaster61550 is not online. pokemonmaster61550
Joined: 17 Oct 2008
Total Posts: 6058
20 Jan 2013 08:16 PM
How would I write a script that when a player steps on the brick (Parent)
It would teleport the player to "SpawnLocation"
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
20 Jan 2013 08:21 PM
Lua*

Use the touched event, and locate the spawnlocation's position.
When the player touches it, use the MoveTo method or CFrame the players torso to the SpawnLocations position + 5 up so they won't get stuck in the brick.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
pokemonmaster61550 is not online. pokemonmaster61550
Joined: 17 Oct 2008
Total Posts: 6058
20 Jan 2013 08:33 PM
so jonah i would use findfirstchild("SpawnLoaction")?
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
20 Jan 2013 09:05 PM
workspace:findFirstChild("SpawnLocation")

or

workspace:FindFirstChild("SpawnLocation")

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
20 Jan 2013 09:08 PM
I didn't even notice it was you poke..

script.Parent.Touched:connect(function(hit)
if hit.Parent.Humanoid then
if game.Workspace:FindFirstChild("SpawnLocation") then
hit.Parent:MoveTo(game.Workspace.SpawnLocation.Position + Vector3.new(10, 10, 10))
end
end
end)

Was that your mom? Tell her she needs to exercise a little more, those legs had a little flab.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
20 Jan 2013 09:13 PM
@crouton

That will teleport zombies, and NPC's as well.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2013 09:14 PM
It would also error if the Humanoid was missing. Use :GetPlayerFromCharacter( ).

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
20 Jan 2013 09:15 PM
It wont error..

if hit.Parent.Humanoid then

It's not stating, it's asking if. If it's not there it wont do anything.

Was that your mom? Tell her she needs to exercise a little more, those legs had a little flab.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2013 09:24 PM
It would error.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
20 Jan 2013 09:28 PM
I've tested this.. It never errors.

Was that your mom? Tell her she needs to exercise a little more, those legs had a little flab.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
20 Jan 2013 09:28 PM
It's true, it would error. It would say something about how "Humanoid is not a valid member of Workspace" or something.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2013 09:30 PM
If it did, FindFirstChild would be probably be deprecated and of no use.

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
20 Jan 2013 09:37 PM
FindFirstChild...

That is finding child, mine is stating if there is the child

So basically when finding a child it should error also. Saying it's not there.

Else, roblox lua needs to implement more on that.

Was that your mom? Tell her she needs to exercise a little more, those legs had a little flab.
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
20 Jan 2013 09:38 PM
Have you ever used FindFirstChild?

¤ ¤ † K M <( •д• )> X D † ¤ ¤
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
20 Jan 2013 09:40 PM
I'm pretty sure that FindFirstChild works by returning true if there is a child, and nil if there isn't. So if there is a child, it will continue on, if there isn't, it'll stop there.

While hit.Parent.Humanoid will make it seem as if there actually is a Humanoid, and the script will acknowledge it, but because there isn't, it will error.

~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】
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