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

so my antigod script is not working please help?

heres the script

if game.Players.LocalPlayer.Character.Humanoid.MaxHealth = math.huge 
then
game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 0
else game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 100
end
	
if game.Players.LocalPlayer.Character.Humanoid.Health = math.huge
then game.Players.LocalPlayer.Character.Humanoid.Health = 0
else game.Players.LocalPlayer.Character.Humanoid.Health = 100

2 answers

I used variables to shorten it also, I would recommend using WaitForChild to get Humanoid and CharacterAdded:wait() to get character.

EDIT: Added a loop

plr = game.Players.LocalPlayer
char = plr.CharacterAdded:wait()
human = char:WaitForChild('Humanoid') -- Waits for Humanoid so it's detected
while wait(5) do  -- every 5 seconds, it checks for the health.
if human.MaxHealth == math.huge then -- It's best to use MaxHealth since the health can't be more than MaxHealth.
human.MaxHealth = 0 -- sets max health to zero if maxhealth = math.huge
human.Health = 0 -- sets health to zero if health = math.huge
else
human.MaxHealth = 100
human.Health = 100
end

9 comments

0

still not working

0

Any errors?

0

Well it should work I have tried it with MaxHealth and it set the player's health to 0

0

what did you use to give yourself the god

0

A normal health pad to increase max health to math.huge

0

link to the model please

0

just look one up in fm, change the script inside to human.Health = math.huge

0

do you also change thr maxhealth

0

I only changed the max health and after the check is done, it'll kill be player if their max health is math.huge

You seem to be missing an end at the end. Also, you might want to do a check every few seconds like this:

while true do
wait (1)
if game.Players.LocalPlayer.Character.Humanoid.MaxHealth = math.huge 
then
game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 0
else game.Players.LocalPlayer.Character.Humanoid.MaxHealth = 100
end

if game.Players.LocalPlayer.Character.Humanoid.Health = math.huge
then game.Players.LocalPlayer.Character.Humanoid.Health = 0
else game.Players.LocalPlayer.Character.Humanoid.Health = 100
end
end

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