#roblox leaderstats problem script

52 messages · Page 1 of 1 (latest)

ornate trout
#

Hi

#

local mouse = game.Players.LocalPlayer:GetMouse()

local cas = game:GetService("ContextActionService")
local plr = game.Players.LocalPlayer
local c = plr.Character or plr.CharacterAdded:Wait()
local h = c:WaitForChild("Humanoid")

local tool = plr.Backpack:FindFirstChild("Hammer")

local alreadyCounted = false

tool.Activated:Connect(function()
wait(0.5)
local animator = h:WaitForChild("Animator")
if animator then
local animation = animator:LoadAnimation(tool:FindFirstChild("Animation"))
animation:Play()
end

if mouse.Target then
    local model = mouse.Target.Parent
    
    if model and model:FindFirstChild("Humanoid") and model:FindFirstChild("Humanoid").Health > 0 and model ~= c then
        local humanoid = model:FindFirstChild("Humanoid")
        
        humanoid.Died:Connect(function()
            if not alreadyCounted then
                plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
                alreadyCounted = true
            end
        end)
    end
end

end)

#

I have corrected the code. Here is the correct version that should work for you. I hope it helps!

#

@vital current

queen patioBOT
#

studio** You are now Level 1! **studio

ornate trout
#

it's work?

vital current
#

wait

#

imma test it

ornate trout
#

Look this.

vital current
#

i already did

ornate trout
#

it's work?

vital current
#

wait

ornate trout
#

i need vouch for get scripter role :)

vital current
#

aight aight imma see

#

its js my wifi keep disconnecting

#

and make me leave studio

ornate trout
#

i'll wait

vital current
#

wait the location for this script is the same ?

#

and i have a question , isnt the client script is the same as the local script

queen patioBOT
#

studio** You are now Level 2! **studio

ornate trout
#

My bad

vital current
#

ay bro so the script location is the same wich is startercharacterservice and its a local script ?

#

and sorry for being lat

queen patioBOT
#

studio** You are now Level 7! **studio

vital current
#

e

ornate trout
#

Oh

#

i'm back

vital current
#

ok ok

ornate trout
#

u did???

vital current
#

wait im trying to see whats going on

ornate trout
#

umm?

vital current
#

idk bro my tool dont work no more idk what happend

#

u good when i solve all of this i will tell u

vital current
#

lol the problem was is when u corrected my script you removed the fire event line and that broke my tool i couldent figure it out fast bc im new i fix it now

#

and i just tested it wit ur corrected script and it didnt work

#

it count only 1 kill and dont count any other kills

#

@ornate trout

ornate trout
#

my code didn't work?

#

@vital current

vital current
#

its still counting 1 kill only and not counting other kills

ornate trout
#

wait

#

i try fix

#

@vital current

vital current
#

yea i did