rocketlad
|
  |
| Joined: 01 Jan 2008 |
| Total Posts: 1132 |
|
|
| 28 Dec 2011 11:26 AM |
function onTouched(hit) if hit.Name == "Paintball" then script.Parent.Parent.Humanoid:MoveTo(Vector3.new(math.random(-453.5,690.5),math.random(2.8, 2.9),math.random(-1016,456))) end end
script.Parent.Touched:connect(onTouched)
In the output it says: Argument 2 missing or nil
I'm trying to make it so when a Paintball hits the model, the model moves to a random spot between those coordinates, but it doesn't do anything. Please help me out here. :) |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 28 Dec 2011 11:28 AM |
| There's no int value between 2.8 and 2.9 |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 28 Dec 2011 11:28 AM |
| So in in practice it's a nil value |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 11:29 AM |
script.Parent.Parent:MoveTo(Vector3.new(math.random(-453.5,690.5),math.random(2.8, 2.9),math.random(-1016,456)))
try that
~I've been to nil and back. |
|
|
| Report Abuse |
|
|
rocketlad
|
  |
| Joined: 01 Jan 2008 |
| Total Posts: 1132 |
|
|
| 28 Dec 2011 11:38 AM |
Su8, what would I do then? I changed it to this: script.Parent.Parent.Humanoid:MoveTo(Vector3.new(math.random(-453.5,690.5),2.8,math.random(-1016,456))) But it didn't work.
Also, how come this works if this respawn script that I made works? name="Humanoid"
deer = script.Parent:clone()
while true do wait(5) if script.Parent.Humanoid.Health<1 then deer1 = deer:clone() deer1.Parent = script.Parent.Parent deer1:makeJoints() script.Parent:remove() deer1:MoveTo(Vector3.new(math.random(-453.5,690.5),math.random(2.8, 2.9),math.random(-1016,456))) end end
And MrgamesNwatch, wouldn't that just teleport it without it walking there like in my respawn script above? |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 11:54 AM |
ooohhhh... well in that case :MoveTo() doesn't work on player controlled Humanoids. :\
~I've been to nil and back. |
|
|
| Report Abuse |
|
|
rocketlad
|
  |
| Joined: 01 Jan 2008 |
| Total Posts: 1132 |
|
|
| 28 Dec 2011 12:03 PM |
| It isn't player controlled. It is supposed to move the deer to a random position if it is touched by a bullet. |
|
|
| Report Abuse |
|
|
Wil2
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 728 |
|
| |
|
Wil2
|
  |
| Joined: 01 Feb 2008 |
| Total Posts: 728 |
|
|
| 28 Dec 2011 12:12 PM |
MoveTo() has 2 arguments if you use it on Humanoids. 1 is the position, 2nd is the part your mainly walk on. Ex: hum:MoveTo(Vector3.new(0,0,0),workspace.Ground) |
|
|
| Report Abuse |
|
|
|
| 28 Dec 2011 12:32 PM |
^ oyus i totally forgot about the second argument :O
~I've been to nil and back. |
|
|
| Report Abuse |
|
|