|
| 09 May 2015 10:16 AM |
I'm trying to make an NPC auto-jump when a block is close to them, I currently have this, but it seems to be inconsistent:
while true do wait(.5) ray = Ray.new(script.Parent.Torso.CFrame.p,((script.Parent.Torso.CFrame.p + Vector3.new(0,-1.5,-2)) - script.Parent.Torso.CFrame.p).unit*2) hit,pos = workspace:FindPartOnRay(ray,script.Parent) if hit then print(hit.Name) mag = (script.Parent.Torso.CFrame.p - pos).magnitude script.Parent.Humanoid.Jump = true end end
Anyone with something better or any modifications to this? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 09 May 2015 02:40 PM |
local Torso = script.Parent:WaitForChild("Torso")
while true do wait(0.5) local ray = Ray.new(Torso.Position,Torso.CFrame.lookVector*2.3) local hit,pos = workspace:FindPartOnRay(ray,script.Parent,false,true) if hit then script.Parent:WaitForChild("Humanoid").Jump = true end end
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 01:29 AM |
| Ah, thank you, it works perfectly. |
|
|
| Report Abuse |
|
|
|
| 10 May 2015 06:59 AM |
hi deaf watchu doin here
[INSERT WONDERFUL SIGGY HERE] |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 May 2015 07:35 AM |
omg u so mean
[INSERT WONDERFUL SIGGY HERE] |
|
|
| Report Abuse |
|
|