Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 19 Aug 2013 01:21 PM |
--I have many errors in the script, could someone please correct them? The main one is the 'takedamage' part, it's supppsed to taked amage according to the player's maxhealth divided by 2.
enabled = false power = 80 reloadtime = 0.8 lighting = game.Lighting player = game.Players.LocalPlayer mouse = player:GetMouse() run = game:GetService("RunService") torso = game.Players.LocalPlayer.Character.Torso RightShoulder = player.Character.Torso["Right Shoulder"] mouse.KeyDown:connect(function(key) if key:lower() == (script.Parent.Text) and enabled == false then enabled = true x = Instance.new("Part") x.BrickColor = BrickColor.new("Bright red") x.Size = Vector3.new(5, 5, 5) x.CanCollide = false x.TopSurface = "Smooth" x.Shape = "Ball" x.BottomSurface = "Smooth" x.Transparency = 0.3 y = Instance.new("BodyVelocity") x.CFrame = CFrame.new(player.Character["Right Arm"].Position) y.maxForce = Vector3.new(math.huge, math.huge, math.huge) y.velocity = (mouse.hit.p - torso.Position).unit * power x.Parent = Workspace y.Parent = x x.Touched:connect(function(hit) human = hit.Parent:findFirstChild("Humanoid") if (human~= nil) and hit.Parent.Name ~= (script.Parent.Parent.Parent.Parent.Parent.Name) then hit:TakeDamage(script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.MaxHealth / 2) RightShoulder.MaxVelocity = 0.5 RightShoulder.CurrentAngle = 3.14 game.Debris:AddItem(x, 6) wait(reloadtime) enabled = false end end) end end) |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 19 Aug 2013 01:57 PM |
'hit:TakeDamage(script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.MaxHealth / 2)'
You use the ':TakeDamage()' method on a Humanoid, not a part. |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 19 Aug 2013 02:00 PM |
| I know. I thought I used 'if (human ~= nil) then', to check if it was a humanoid? |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 19 Aug 2013 02:05 PM |
Yes, but 'hit' would be the part that touched it, not the humanoid. Perhaps you mean...
'human:TakeDamage(Etc, etc)'
|
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 19 Aug 2013 02:11 PM |
| OOOOOOHHHHHH. THAT IS WHAT I MEANT. :D |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
|
| 19 Aug 2013 02:17 PM |
| Well NOW that I've got that settled...anyone know why this doesn't work in play mode? O3O |
|
|
| Report Abuse |
|
|
Kasumo
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 2467 |
|
| |
|