Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

Is this right?

Asked by
duckyo01 120
9 years ago

I made this script and need it to be a team npc

Target = script.Parent.Target
Me = script.Parent.Parent
RS = script.Parent("Right Shoulder")
Punching = false

function Chase(Part)
if Part.Parent:FindFirstChild("Humanoid") ~= nil then
Target.Value = Part.Parent.Name
for chasing = 1,100 do
if Punching == false then
Me.Humanoid:MoveTo(Part.Parent.Torso.Position,Part.Parent.Torso)
end
wait(0.05)
end
end
end

function Punch(Part)
if Punching == false and Part.Parent:FindFirstChild("Humanoid") ~= nil then
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -25
v = Instance.new("BodyVelocity", Part.Parent.Torso)
game.Debris:AddItem(v, 1)
Part.Parent.Humanoid.Sit = true
v.velocity = Me.Torso.CFrame.lookVector *50
v.maxForce = Vector3.new(math.huge(), math.huge(), math.huge())
punching = true
for RSLOOP = 1, 10 do
RS.C0 = RS.C0 *CFrame.Angles(0, 0, 0.25)
wait(0.1)
end
for RSLOOP = 1, 10 do
RS.C0 = RS.C0 *CFrame.Angles(0, 0, -0.25)
wait(0.1)
end
Punching = false
end
end

script.Parent.Touched:connect(Punch)
script.Parent.Touched:connect(Chase) 

1 answer

Log in to vote
0
Answered by 9 years ago

RSLOOP has to be a variable.

Ad

Answer this question