Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my humanoid don't take Damage?

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

✓ Accepted answer

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)

4 comments

0

Uhhhh

0

But where do i put it tho?

0

you can paste that into a script in serverscriptservice

0

oh tysm it worked

This discussion is preserved as it was. New answers, comments, and votes are closed.