-
I want the tool to subtract the player’s current in-game value by 10
-
The tool subtracts 10, then 20, then 30, etc.
-
I have tried clarifying what the in-game value is
I ASSUME THE PROBLEM IS - the code is not accounting for the player’s regeneration of the value
(in a separate script) and subtracting what the code believes the value is
local Tool = script.Parent;
enabled = true
cd = false
local cooldown = 10
function onActivated()
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
if cd == false and player.Chakra.Value >= 10 then
player.Chakra.Value -= 10
script.Parent.CoolDown:FireClient(player,cooldown)
local Character = Tool.Parent
local blood = game.ReplicatedStorage.Blood:Clone()
local log = game.ReplicatedStorage.Log:Clone()
blood.Position = Character.Torso.Position
blood.Parent = game.Workspace
log.Parent = game.Workspace
log.Position = Character.Torso.Position
log.Sound:Play()
cd = true
Character.HumanoidRootPart.CFrame *= CFrame.new(15, 0, 0)
wait(1)
blood:Destroy()
wait(9)
log:Destroy()
cd = false
end
end
script.Parent.Activated:connect(onActivated)