Hey guys! so recently i watched a sword script tutorial heres the script btw
local tool = script.Parent local function onTouch(hit) local human = hit.Parent:FindFirstChild('Humanoid') if not human then return end if human.Parent == tool then return end human:TakeDamage(20) end tool.Handle.Touched:Connect(onTouch)
so the thing is i dont understand what return end means can anyone explain?
local tool = script.Parent local function onTouch(hit) local human = hit.Parent:FindFirstChild('Humanoid') if not human then return --stops the function from running end if human.Parent == tool then return --this stops the function from running too end human:TakeDamage(20) end tool.Handle.Touched:Connect(onTouch)
You can also return values. Here's a link about it. https://education.roblox.com/en-us/resources/returning-values-from-functions