Need Help On this
Yeah I’m a bit new on scripting a leaderstats value but here is the bug, player can buy it without cash like it goes to -60 when they buy it how to fix this
Need Help On this
Yeah I’m a bit new on scripting a leaderstats value but here is the bug, player can buy it without cash like it goes to -60 when they buy it how to fix this
In nowhere in this script does it compare the cost and their cash value, so just have it check.
Also do you know how to make kills leaderstats that actually count 1, do i need to make a script inside tool
Yes, you can create a script within the tool. And check if the health is 0 or less.
can you give me full advice, i did change on script like i try if its 0 then return end and then i try the <0 but still won’t work
Here is an example:
local Tool = script.Parent
local player = script:FindFirstAncestorWhichIsA("Player") or game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
local Handle = script.Parent:FindFirstChild("Handle")
local Damage = 10
Handle.Touched:Connect(function(part)
local Humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
if Humanoid and Humanoid.Health > 0 then
Humanoid:TakeDamage(Damage)
if Humanoid.Health <= 0 then
player.leaderstats.Kills.Value += 1
end
end
end)