You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
i want to make a script that reduces my health in a loop when i jump into the water and stop reducing my health when im out of the water
What is the issue? Include screenshots / videos if possible!
the code below is not killing me in a certain time
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
i didnt
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local lava = script.Parent
local isTouched = false
local function killPlayer()
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChild("Humanoid")
for count = 1, 10 do
humanoid.Health = count / 20
end
end
local Lava = script.Parent
local Debounce = false
local function killPlayer(Object)
if Object.Parent:FindFirstChild("Humanoid") then
if Debounce == false then
Debounce = true
Object.Parent.Humanoid.Health -= 5
task.wait(2)
Debounce = false
end
end
end
Lava.Touched:Connect(killPlayer)
1- You forgot to put ‘otherPart’ as an argument in the fuction killPlayer()
2- I don’t see any call to the function
3-When using for loops, you should add a delay [doesn’t have to be too long]