Ad
Log in to vote
0

Why does my humanoid don't take Damage?

Asked by 15 days ago

I placed it in starterplayerscripts in localscript, but it still dont work I tried to put it in serverscriptservice but it still don't work Pls help!

local Players = game:GetService("Players") local plr = Players.LocalPlayer

local PlayerMoneyValue = plr.leaderstats.Reality

while true do wait(0.5) if PlayerMoneyValue.Value >= 0 then local char = plr.Character if not char then continue end
char.Humanoid:Takedamage(10) end end

1 answer

Log in to vote
0
Answered by 14 days ago

I would recommend checking from the server to prevent exploiters and you should probably make sure the leaderstats are loaded by using waitforchild instead of just going straight to plr.leaderstats.Reality

local Players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(player)
    local PlayerMoneyValue = player:WaitForChild'leaderstats':WaitForChild'Reality'
    player.CharacterAdded:Connect(function(character)
        local Humanoid = character:WaitForChild'Humanoid'
        while true do
            task.wait(.05)
            if PlayerMoneyValue.Value >= 0 then
                Humanoid:TakeDamage(10)
            end
            if Humanoid.Health <= 0 then break end
        end
    end)
end)
0
Uhhhh xGlacier101x 9 — 13d
0
But where do i put it tho? xGlacier101x 9 — 13d
0
you can paste that into a script in serverscriptservice BulletproofVast 776 — 12d
0
oh tysm it worked xGlacier101x 9 — 12d
Ad

Answer this question