You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Whenever you press E with a Tool it increases its total damage -
What is the issue? Include screenshots / videos if possible!
The Damage value is being modified and added, but whenever you try to use the weapon and damage something it does the same damage as if the values never changed. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried making remote events and seeing if anything changed with any other values but it stayed the same.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- local script inside the tool
local specialready = true
game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(key)
if specialready == true then
if key == "e" then
specialready = false
game.ReplicatedStorage.EnableAbility:FireServer(player)
wait(30)
game.ReplicatedStorage.DisableAbility:FireServer(player)
end
end
end)
-- server script inside serverscriptservice
game.ReplicatedStorage.EnableAbility.OnServerEvent:Connect(function(player)
if player.Character:FindFirstChild("GoldenBlade") then
local GoldenBlade = player.Character:FindFirstChild("GoldenBlade")
GoldenBlade.settingsfldr.DamageMod.Value += 8
end
end)
game.ReplicatedStorage.DisableAbility.OnServerEvent:Connect(function(player)
if player.Character:FindFirstChild("GoldenBlade") then
local GoldenBlade = player.Character:FindFirstChild("GoldenBlade")
GoldenBlade.settingsfldr.DamageMod.Value -= 8
end)
-- the damage script for the weapon
local Tool = script.Parent
local settingsfolder = script.Parent.settingsfldr
local cooldown = settingsfolder.Cooldown.Value
local PlayersHit = {}
local canswing = true
local candamage = false
local multi = Tool.settingsfldr.DamageMod.Value
local Min = Tool.settingsfldr.MinDamage.Value * multi
local Max = Tool.settingsfldr.MaxDamage.Value * multi
Tool.Activated:Connect(function()
if canswing == true then
candamage = true
canswing = false
wait(cooldown)
canswing = true
candamage = false
end
end)
Handle.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent ~= Tool.Parent and not game.Players:FindFirstChild(Hit.Parent.Name) then
if candamage == true and PlayersHit[Hit.Parent] == nil then
Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(math.random(Min, Max))
PlayersHit[Hit.Parent] = true
wait(1)
PlayersHit[Hit.Parent] = nil
end
end
end)
- Extra note all the number variable ( e.g MinDamage ) are all stored inside of a folder inside the tool and they are all number values.