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

anyone that can help me out with this value things?

Asked by 6 years ago
Edited 6 years ago

ok so im trying to make the damage be the value of the strength but times 2 i think i did something wrong
(The Strength thing is a Number value)

01local tool = script.Parent
02 
03local hitsound = tool:WaitForChild("Hit")
04 
05local canattack = tool:WaitForChild("CanAttack")
06 
07local plr = tool.Parent.Parent
08 
09local char = plr.Character or plr.CharacterAdded:wait()
10 
11local larm = char:WaitForChild("Left Arm")
12 
13local rarm = char:WaitForChild("Right Arm")
14 
15local STR = plr:FindFirstChild("Strenght").Value
16 
17   
18 
19larm.Touched:connect(function(hit)
20 
21local hum = hit.Parent:FindFirstChild("Humanoid")
22 
23if canattack.Value == false then
24 
25if hum then
26 
27canattack.Value = true
28 
29hitsound:Play()
30 
31hum:TakeDamage(STR.Value*2)
32 
33wait()
34 
35canattack.Value = false
36 
37end
38 
39end
40 
41end)
42 
43   
44 
45rarm.Touched:connect(function(hit)
46 
47local hum = hit.Parent:FindFirstChild("Humanoid")
48 
49if canattack.Value == false then
50 
51if hum then
52 
53canattack.Value = true
54 
55hitsound:Play()
56 
57hum:TakeDamage(STR.Value*2)
58 
59wait()
60 
61canattack.Value = false
62 
63end
64 
65end
66 
67end)
0
You defined "STR" as "plr:FindFirstChild("Strenght").Value" I'm not sure if the "Strenght" has a child named Value, but if you refer to STR as the value then when you say "hum:TakeDamage(STR.Value*2)". I think this could be breaking it so try defining "STR" as just "plr:FindFirstChild("Strenght")" P.S. I think you meant to write "Strength instead of Strenght" songboy50 77 — 6y

Answer this question