So if you have ever watched Naruto, then you should know about the Jashin Technique. It’s a technique where when a person is standing on a specific circle, they can’t die, and any damage done to that person is reflected to whoever afflicted the damage. So I’m trying to make something similar to that… Kind of exactly the same… But there’s a problem. I don’t know how to make it so that it only works when the player is touching it and when they’re not, it stops working.
What do you want to achieve? So what I need is: when the player is on the part, they become invincible. If they walk off of the part, they revert their health back to what is was.
What is the issue? The issue is I got half of it done so far, but I just need to make it so that when the player is not touching the part, they’re health goes back and they can take damage.
What solutions have you tried so far? I’ve searched the DevForums and google thoroughly and didn’t find anything related to my problem. To make things simple, it’s like a speed boost part, but for health and it stops the speed boost/health boost when you’re not touching it.
local Circle = script.Parent
local function Touching(part)
local parent = part.Parent
if game.Players:GetPlayerFromCharacter(parent) then
parent.Humanoid.MaxHealth = 200
wait (5)
parent.Humanoid.MaxHealth = 100
end
end
So as you can see, when the player touches the circle their health becomes 200, and after 5 seconds it goes back to 100. So I think I need to change the “wait (5)” to something like “wait until not touching” but I’ve tried several similar lines and I got nothing.
local Circle = script.Parent
local Debounce = false
local function Touching(part)
local parent = part.Parent
if game.Players:GetPlayerFromCharacter(parent) then
parent.Humanoid.MaxHealth = 200
repeat wait() until Debounce == true
parent.Humanoid.MaxHealth = 100
end
end
local function TouchEnd(part)
local parent = part.Parent
if game.Players:GetPlayerFromCharacter(parent) then
Debounce = true
end
end
So it’s not local? Or… What, I don’t understand. Sorry, I don’t know too much about scripting.
If you’re talking about the capital d I realized that already and changed it but it still didn’t work
you shouldn’t have it repeat wait until debounce is == true, if you touch it 5 times you will have a 5 time shield after each debounce. Just return it.
local part = script.Parent -- path part you want them be on, in my case its the scripts parent
local touching = {}
part.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
if touching[player.Name] then return end
touching[player.Name] = hit.Parent.Humanoid.Health
hit.Parent.Humanoid.Health = math.huge
end)
part.TouchEnded:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player then return end
if not touching[player.Name] then return end
hit.Parent.Humanoid.Health = touching[player.Name]
touching[player.Name] = nil
end)
I dont know if this would work but it might
it was edited from a slightly broken tool script. it worked fine except i messed up tool cloning