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

How do i Multiply the Damage of my fireball script by my strength leader stats?

Asked by 4 years ago

I have been trying to figure out a way to multiply the damage of my fireball script but every time i try, it doesn't multiply or the fireball wont work at all

I hope you can tell me exactly how to do this as i'm not a very experienced scripter and sometimes mess up, Anyway heres the script, let me know how i can add a multiplying script

--// Services \\--
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService('Debris')

--// Variables \\--
local player = game.Players.LocalPlayer 
local Remote = ReplicatedStorage.FireBallEvent
local FireBall = ReplicatedStorage.FireBall

--// Settings \\--
local Damage = 1 


local ServerDebounces = {}

Remote.OnServerEvent:Connect(function(plr, Mouse)
if not ServerDebounces[plr] then
ServerDebounces[plr] = true local Char = plr.Character or plr.CharacterAdded:Wait() local FireBallClone = FireBall:Clone()
FireBallClone.CFrame = Char.HumanoidRootPart.CFrame * CFrame.new(0,0,-3)
FireBallClone.Parent = workspace local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
BodyVelocity.Velocity = Mouse.lookVector
BodyVelocity.Parent = FireBallClone spawn(function()
for i = 0, 1000 do wait() FireBallClone.Size = FireBallClone.Size + Vector3.new(0.07,0.07,0.07) BodyVelocity.Velocity = Mouse.lookVector*i
end
end)
ServerDebounces[plr] = false
Debris:AddItem(FireBallClone, 10) local Debounce = true
FireBallClone.Touched:Connect(function(h)
if h.Parent:FindFirstChild('Humanoid') and h.Parent.Name ~= plr.Name and Debounce then Debounce = false local Enemy = h.Parent.Humanoid Enemy:TakeDamage(Damage) FireBallClone.Transparency = 1 BodyVelocity:Destroy() FireBallClone.Effect.Speed = NumberRange.new(8,8) wait(1) FireBallClone.Effect.Enabled = false wait(1) FireBallClone:Destroy() wait(3) Debounce = true
end
end)
end
end)



0
Grab the value of the players strength and use * to multiply ...... Enemy:TakeDamage(Damage*Strength) ForeverBrown 356 — 4y
0
It works except now its says its a nil value how do i fix that? scarymasterman123 4 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

If I understand correctly, you just need to multiply damage(passed to TakeDamage), so I assume your player has leader stars . You just need to take plr provided by remote event and find its strength inside leaderstats, then you can pass this to TakeDamage(damage*strength.Value)

Ad

Answer this question