Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why do you need parameters without function??

Asked by 2 years ago

i dont mean that parameters are useless but sometimes i see scripts that have parameters for no reason :

game.workspace.Part.Touched:Connect(function(hit)
       print("hit") ---- but what is hit?
end)

i only know that parameters can be used like this :

function kill(PlayerName)
      local player = game.workspace:WaitForChild(PlayerName)
      Player:FindFirstChild("HumanoidRootPart"):Destroy()
end

kill("leoonardo101max1")

if you know pls answer this

0
Hey! horvathmf 10 — 2y
0
Hey! game.workspace.Part.Touched:Connect(function(hit) -- hit = what is touched the part and dont print("hit") thats print(hit.Name) horvathmf 10 — 2y
0
You have discord? i can help you with scripting but not in this comment section horvathmf 10 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

Events like .Touched returns a parameter called a hitPart. The hitPart is any BasePart in the workspace that touched a certain part. If you don't need those parameters, you can just remove them. But some people might have put the parameters they don't need just to be safe or if they will edit their project in the near future and use it.

Ad

Answer this question