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!
So im making a script that checks if the fireball is hitting the player who casts it, if it does then it would stop the current touched event until the event was fired again.
What is the issue? Include screenshots / videos if possible!
I don’t know how to stop it in the middle.
script.Parent.Touched:Connect(function(hit)
i = 0
humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
if humanoid.Parent.Name ~= _G.ZJUZNSW then
--How do I end the function here?
end
end
script.Parent.CanCollide = false
script.Parent.Transparency = 0.5
script.Parent.Reflectance = 0
if humanoid then
if humanoid.Parent.Name ~= _G.ZJUZNSW then
print(humanoid.Parent.Name)
print(_G.ZJUZNSW)
humanoid.Health = humanoid.Health - 10
wait(4)
script.Parent:Destroy()
end
end
end)
wait(6)
script.Parent:Destroy()
script.Parent.Touched:Connect(function(hit)
humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
if humanoid.Parent.Name == _G.ZJUZNSW then
return
end
script.Parent.CanCollide = false
script.Parent.Transparency = 0.5
script.Parent.Reflectance = 0
if humanoid then
if humanoid.Parent.Name ~= _G.ZJUZNSW then
print(humanoid.Parent.Name)
print(_G.ZJUZNSW)
humanoid.Health = humanoid.Health - 10
wait(4)
script.Parent:Destroy()
end
end
wait(6)
script.Parent:Destroy()
end
end)