axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 06:54 AM |
| Is there any way to add a script to the workspace make any humanoid named "Monster" spin around so that they're un stuck? |
|
|
| Report Abuse |
|
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
| |
|
Kodran
|
  |
| Joined: 15 Aug 2013 |
| Total Posts: 5330 |
|
|
| 28 Sep 2014 07:30 AM |
You could do like
monster.Torso.CFrame = CFrame.new(monster.Torso.Position + Vector3.new(0, 1, 0)) |
|
|
| Report Abuse |
|
|
|
| 28 Sep 2014 07:38 AM |
Simply make them walk at random if they don't find a path. Like, humanoid.WalkToPoint = torso.Position + Vector3.new(math.random(-10,10),0,math.random(-10,10)) You can enhance this by making them not walk into a wall again, using rays checking their path. If it hits a wall, simply walk to the hitpoint - 2*direction.unit (hope this makes sense)
The reason they can't find path is because they are too close to a wall in most cases. |
|
|
| Report Abuse |
|
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 07:42 AM |
Okay, so where do I have to put this at in here? Scryppii:
local sp = script.Parent local newCharacter = sp:Clone() newCharacter.Parent = game.ServerStorage wait(0.5) pathFind = game:GetService("PathfindingService") local humanoid = sp:WaitForChild("Humanoid") local torso = sp:WaitForChild("Torso") local target = sp:WaitForChild("Target") local location = sp:WaitForChild("Location")
local sp = script.Parent local humanoid = sp:WaitForChild("Humanoid") local toolNone = script:FindFirstChild("toolnone") local toolNoneAnim = toolNone:FindFirstChild("ToolNoneAnim")
local a = Vector3.new(100,5,-100) local b = Vector3.new(75,5,-200) local debounce = true local debounce2 = false local toolNoning = humanoid:LoadAnimation(toolNoneAnim) local list = game.Players:GetChildren() local loco = 100000
sp.PrimaryPart = sp:WaitForChild("Head")
if target.Value then local targetTorso = target.Value:FindFirstChild("Torso") end
function attack(hit) if hit and hit.Parent then local enemy = hit.Parent:FindFirstChild("Humanoid") if enemy then if enemy:IsA("Humanoid") and hit.Parent.Name ~= sp.Name then debounce = true while debounce do toolNoning:Play() wait(1) torso.TouchEnded:connect(function(hit2) if hit2 == hit then debounce = false end end) end end else if hit.CanCollide then humanoid.Jump = true end end end end
function findPlayers() list = game.Players:GetChildren() for i=1,#list do if list[i] and list[i]:IsA("Player") then local found = list[i].Character:FindFirstChild("Humanoid") if found and found.Health>0 then local loc = (torso.Position - list[i].Character.Torso.Position).magnitude if loc < loco then loco = loc target.Value = list[i].Character end end end end end
while humanoid.Health > 0 do target = sp:WaitForChild("Target") location = sp:WaitForChild("Location") findPlayers() if target.Value then targetTorso = target.Value:FindFirstChild("Torso") if targetTorso then path = pathFind:ComputeRawPathAsync(torso.Position,targetTorso.Position,15) points = path:GetPointCoordinates() if #points <10 or #points == 10 then mx = #points l = true else mx = 10 l = false end for i = 1,mx/2 do wait(0.25) humanoid:MoveTo(points[i*2]) if i == mx/2 and l then humanoid:MoveTo(targetTorso.Position,targetTorso) end end end else path = pathFind:ComputeRawPathAsync(torso.Position,location.Value,15) points = path:GetPointCoordinates() if #points <10 then mx = #points else mx = 10 end for i = 1,mx do humanoid:MoveTo(points[i]) wait(0.25) end humanoid:MoveTo(location.Value) end loco = 100000 torso.Touched:connect(attack) wait(0.5) end
if humanoid.Health == 0 or humanoid.Health < 0 then wait(5) newCharacter.Parent = Workspace wait(0.1) sp:Destroy() end |
|
|
| Report Abuse |
|
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 08:04 AM |
| e-e Really need this by the end of today...... |
|
|
| Report Abuse |
|
|
Mintacle
|
  |
| Joined: 28 Aug 2013 |
| Total Posts: 498 |
|
| |
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 08:09 AM |
| _-_ That's why I usually don't post long script to the forum..... |
|
|
| Report Abuse |
|
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 08:12 AM |
| Because then too many people start to ignore it JUST for that reason..... |
|
|
| Report Abuse |
|
|
axelvts
|
  |
| Joined: 27 Apr 2008 |
| Total Posts: 3029 |
|
|
| 28 Sep 2014 09:30 AM |
| NM but thanks anyways guys! I fixed it! : D |
|
|
| Report Abuse |
|
|