generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Errors.

Previous Thread :: Next Thread 
Kasumo is online. 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 is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
19 Aug 2013 01:35 PM
Bump[1]
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
19 Aug 2013 01:45 PM
Bump[2]
Report Abuse
Kasumo is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
19 Aug 2013 01:54 PM
Bump[3]
Report Abuse
Desperian is not online. 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 is online. 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 is not online. 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 is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
19 Aug 2013 02:11 PM
OOOOOOHHHHHH. THAT IS WHAT I MEANT. :D
Report Abuse
Kasumo is online. 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 is online. Kasumo
Joined: 22 Mar 2013
Total Posts: 2467
19 Aug 2013 02:48 PM
It only works sometimes.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image