of     1   

tarrdo
#141095417Monday, July 21, 2014 9:32 PM GMT

function blow(hit) if ching == true then return end local humanoid = hit.Parent:findFirstChild("Human") local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) if humanoid~=nil then ching = true print("SWORD HIT") tagHumanoid(humanoid, vPlayer) local damage = math.random(4,9) local slash_damage = math.random(4,9) local lunge_damage = math.random(7,11) humanoid:TakeDamage(damage) local part = Instance.new("ScreenGui") local part2 = Instance.new("TextLabel") part2.BackgroundTransparency = 1 part2.Size = UDim2.new(0,50,0,50) part2.FontSize = "Size14" part2.Position = UDim2.new(0.5,0,0.25,0) part2.Parent = part part.Parent = vPlayer.PlayerGui if (damage == 0) then part2.TextColor3 = Color3.new(0/255,102/255,255/255) else part2.TextColor3 = Color3.new(255/255,255/255,255/255) end part2.Text = ""..damage.."" wait(0.8) ching = false part:remove() wait(.1) untagHumanoid(humanoid) end end function critical (damage, human) v = math.random (1,2) if v == 1 then damage = math.random (200,300) if v == 1 then slash_damage = math.random (200,300) if v == 1 then lunge_damage = math.random (200,300) end end end end The critical is set high for testing purposes, the critical does not work right now :/
brinkokevin
#141095903Monday, July 21, 2014 9:36 PM GMT

good to know anything u need help with ??
tarrdo
#141099809Monday, July 21, 2014 10:10 PM GMT

Well that question itself has an obvious answer, how to I figure out what is wrong with it. And or could someone fix it for me?
cntkillme
#141100429Monday, July 21, 2014 10:16 PM GMT

Handle criticals from here 'humanoid:TakeDamage(damage)' because your damage variables are impossible to access from the critical function since they are local to a scope.
tarrdo
#141100828Monday, July 21, 2014 10:19 PM GMT

Yes but if I move them into the damage script they don't work and error my sword.
cntkillme
#141101286Monday, July 21, 2014 10:23 PM GMT

You never use slash or lunge damage. Just do this: local damage = math.random(4,9) * (math.random() < 0.5 and 2 or 1); humanoid:TakeDamage(damage) 50% chance of doubling the damage which you can easily change. If you want it set: local damage = math.random() < 0.5 and math.random(minCrit, maxCrit) or math.random(4, 9)
tarrdo
#141101734Monday, July 21, 2014 10:27 PM GMT

2 or 1 is the chance to get the critical still right cause that isn't what it looks like.
tarrdo
#141101863Monday, July 21, 2014 10:28 PM GMT

I have a question, if I wanted to lower the chance like put it at 10% would I do 10 or 1?
cntkillme
#141101880Monday, July 21, 2014 10:28 PM GMT

Change it yourself if you don't want to double the damage. The other line of code I gave you where you can manually enter caps.
cntkillme
#141102001Monday, July 21, 2014 10:29 PM GMT

'math.random() < 0.5' Is what you change to change the change of critical The and x or y is the scalar, so and 2 or 1 means if the random part is successful, multiply by 2, otherwise multiply by 1
tarrdo
#141102108Monday, July 21, 2014 10:30 PM GMT

Also what if I were to add a Damage = script.Parent.Parent.Damage.Value function onTouched(part) local h = part.Parent:findFirstChild("Humanoid") if h~=nil then h.Health = h.Health - Damage end end script.Parent.Touched:connect(onTouched) --Dont touch this script. That way I can add other ways to increase damage?
cntkillme
#141102526Monday, July 21, 2014 10:34 PM GMT

If you want, it's not my script

    of     1