--[[ want to make a part damage you if you are under than 50 hp, then you can regain 70 hp and
it'll damage you again.--]]
for i, v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Part", game.Workspace) then
local function DealDamage(v)
local hum = v.Parent:FindFirstChild("Humanoid")
if hum then
hum.Health = hum.Health - 1
while hum.Health ==- 50 do
hum.Health = hum.Health - 0
if hum.Health == 70 then
hum.Health = hum.Health - 1
return
end
end
end
end
end
end
local v2 = script.Parent
v2:IsA("Part", game.Workspace)
v2.Touched:Connect(DealDamage)
I’m new to Roblox scripting but not new to Roblox studio, since I played with Roblox 2 years. Expect me to make mistakes, or as well as not explaining as clear as possible I will try to help you understand what I’m trying to do, since I’m only 11 years old. On my script, I’m trying to damage if the client or humanoid is more than 50 hp, however if it is under than 50, then the killbrick no longer damages. I’m trying to define “v2” as “v” but don’t know how to, please help me it will be my pleasure to understand and comprehend what I did wrong and as well as using different strategies since I was trying to figure it out for 4 hours. Thank you.