This script takes away 100 health. I want it to take away 50%
script.Parent.Touched:connect(function(Obj) -- When you touch it gets the "Leg" or "Arm" local Player = game:GetService("Players"):GetPlayerFromCharacter(Obj.Parent) -- Gets the Instance "Player" if Player and Player.Character then -- Obv its gonna be there... local Humanoid = Player.Character:WaitForChild("Humanoid") -- Find the Humanoid Humanoid:TakeDamage(50) -- Easy damage function.. :) end end)
you need a debounce, you hit a part like 1 million times in a second, it probaly works, the script is called tonns of times
debounce = false script.Parent.Touched:connect(function(Obj) if debounce == false then debounce = true local Player = game:GetService("Players"):GetPlayerFromCharacter(Obj.Parent) if Player and Player.Character then local Humanoid = Player.Character:WaitForChild("Humanoid") Humanoid:TakeDamage(50) wait(3) debounce = false end end end)
:) try this for half damage
debounce = false script.Parent.Touched:connect(function(Obj) if debounce == false then local Player = game:GetService("Players"):GetPlayerFromCharacter(Obj.Parent) if Player and Player.Character then local Humanoid = Player.Character:WaitForChild("Humanoid") local damage = Humanoid.Maxhealth/2 Humanoid:TakeDamage(damage) debounce = true end end end)