|
| 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 |
|
|
|
| 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 |
|
|
|
| 20 Jan 2013 08:33 PM |
| so jonah i would use findfirstchild("SpawnLoaction")? |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2013 09:05 PM |
workspace:findFirstChild("SpawnLocation")
or
workspace:FindFirstChild("SpawnLocation")
~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】 |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 20 Jan 2013 09:13 PM |
@crouton
That will teleport zombies, and NPC's as well.
~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】 |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2013 09:14 PM |
It would also error if the Humanoid was missing. Use :GetPlayerFromCharacter( ).
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 20 Jan 2013 09:24 PM |
It would error.
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 20 Jan 2013 09:38 PM |
Have you ever used FindFirstChild?
¤ ¤ † K M <( •д• )> X D † ¤ ¤ |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|