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: Weapon Damage

Previous Thread :: Next Thread 
MrCrazyman42 is not online. MrCrazyman42
Joined: 01 Feb 2011
Total Posts: 740
23 Jan 2012 05:49 PM
I need to change the damage for my RPG on my wooden sword. Here is the script.

r = game:service("RunService")

ching = false

sword = script.Parent.Handle
Tool = script.Parent

function blow(hit)
if ching == true then return end
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil then --and humanoid ~= hum and hum ~= nil then <<-----i just dont like these LOL
print("SWORD HIT")
tagHumanoid(humanoid, vPlayer)
local damage = math.random(0,5)
humanoid:TakeDamage(damage)
local part = Instance.new("Part")
if (damage == 2) then
part.BrickColor = BrickColor.new(23)
else
part.BrickColor = BrickColor.new(1)
end
part.formFactor = "Plate"
part.Shape = "Block"
part.TopSurface = "0"
part.BottomSurface = "0"
part.Size = Vector3.new(1, 0.4, 1)
part.Position = hit.Parent.Head.Position+Vector3.new(0,3,0)--(math.random(-3.6,3.6),3.5,math.random(-3.6,3.6)) --<<<--Delete the "(0,3,0) and the "--" next to it if you want it to put the damage randomly around the enemy
part.Anchored = true
local m = Instance.new("Model")
part.Parent = m
m.Parent = hit.Parent
m.Name = ""..damage..""
part.Name = "Head"
local h = Instance.new("Humanoid")
h.Parent = m
local body = Instance.new("BodyPosition")
body.position = Vector3.new(0,7.85,0)
body.Parent = part
part.CanCollide = false
part.Reflectance = 0.11
part.Transparency = 0.25
h.MaxHealth = 0
h.Health = 0
ching = true
wait(1)
ching = false
m:remove()
wait(.1)
untagHumanoid(humanoid)
end
end



function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end

function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end


function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end

function lunge()

local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool


force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.25)
swordOut()
wait(.25)
force.Parent = nil
wait(.5)
swordUp()

damage = slash_damage
end

function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end

function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end

function swordAcross()
-- parry
end


Tool.Enabled = true

function onActivated()

if not Tool.Enabled then
return
end

Tool.Enabled = false

local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end

attack()

wait(0.4)

Tool.Enabled = true
end


function onEquipped()

end


script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


connection = sword.Touched:connect(blow)


Help.
Report Abuse
socccerstar is not online. socccerstar
Joined: 23 Aug 2008
Total Posts: 489
23 Jan 2012 06:04 PM
This is a bit of a request...

But some advice: test the script, read the output, and try to fix it. If you can't do that, then go learn. Once you can do basic scripting and debugging, then come back. This is Scripting HELPERS, not Scripting TEACHERS or Scripting WEMAKEFREESCRIPTERS.

Sorry.
Report Abuse
xvgigakid is not online. xvgigakid
Joined: 22 Jun 2008
Total Posts: 4407
23 Jan 2012 06:07 PM
Ok then here is how you change the damage,
local damage = math.random(0,5) --This should be the 18th line or around that.
Just change it to this.
local damage = DamageAmmountHere
Report Abuse
shawncoool is not online. shawncoool
Joined: 09 Jun 2009
Total Posts: 401
23 Jan 2012 06:20 PM
@Socccerstar

-_- I don't need a teacher. I am using an advanced version.

Should I use the other one? Where it is like this?

local.lunge = number here
Report Abuse
xvgigakid is not online. xvgigakid
Joined: 22 Jun 2008
Total Posts: 4407
23 Jan 2012 06:21 PM
advanced version of what?
And is this your other account?
Report Abuse
shawncoool is not online. shawncoool
Joined: 09 Jun 2009
Total Posts: 401
23 Jan 2012 06:28 PM
Yes...
Report Abuse
TheComputerNinja101 is not online. TheComputerNinja101
Joined: 17 Nov 2010
Total Posts: 37
23 Jan 2012 07:29 PM
Heyo,

If I were you I would copy the Mesh in the wooden sword, and paste in a normal sword

{sword}
{script}
{script}
Handle <---- that is were your mesh goes.

Now in the normal sword is easy to edit the damage. Follow the instructions on how to edit the script:

PS this is the top part of the actual script, not the full thing.



%B7Yc4g3cVF2vsIKTu48R1nScXPd5Vo60+xN0Q76AakHULM5fe1mr5zRUX5JSWoGHEo1edTgpe64xv21qdoLhD/SPEfbcHqsq1yly+4qaywNLH/YfQ7Hg7BosLHdrvJ45miA7slD6WHxMwAIne/oTw6Xs2G7dH4j1MSnDIsxiy8I=%%1014475%

r = game:service("RunService")


local damage = 5 <------ that is the normal 1 hit sword damage. say you want it to be one damage, change test to "1"
---------------------------

local slash_damage = 10 <------- this is the SLASH damage to change it, do the same thing you did before. JUST change the text


local lunge_damage = 30 <-------- And finally, the LUNGE. exactly the same. just change the text.


Your welcome,

-- Comninja!
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