here is my script for my Stick Wepon
on line 5, isn't it a table of numbers?
on line 18 I thought it would pick a random damage nuber between in the values but its not...
What is wrong
local fired = script.Parent.Remotes.damage
local candmg = script.Parent.CanDamage
local damage = {7,5,6}
-------
fired.OnServerEvent:Connect(function(player)
candmg = true
end)
script.Parent.Handle.Touched:Connect(function(hit)
if candmg == true then
candmg = false
local ehum = hit and hit.Parent:FindFirstChild("Humanoid")
if ehum then
ehum:TakeDamage(damage[math.random()])
print("You Dealed " .. damage.." Damage")
else
print("the Humanoid you ARE looking for is NIL")
candmg = false
end
end
end)
--Scripted by Tizzel40
now it look like this but now it wont print that random damage number!
on line 19
local fired = script.Parent.Remotes.damage
local candmg = script.Parent.CanDamage
local damage = math.random(5,7,8)
-------
fired.OnServerEvent:Connect(function(player)
candmg = true
end)
script.Parent.Handle.Touched:Connect(function(hit)
if candmg == true then
candmg = false
local ehum = hit and hit.Parent:FindFirstChild("Humanoid")
if ehum then
ehum:TakeDamage(damage)
print("You Dealed " .. damage .." Damage")
else
print("the Humanoid you ARE looking for is NIL")
candmg = false
end
end
end)
--Scripted by Tizzel40

2 comments
local damage = math.random(5,7)
omlllllllll thats cause ur setting it to that certain number, put damage after line 14