i = 5 Local function onTouched(partHit,i) Print(i) game.Workspace. Part.connect(0nTouched(i)) end ————————————————————— What’s wrong with this? I get i = nil inside the function
i = 5 Local function onTouched(partHit,i) Print(i) game.Workspace. Part.connect(0nTouched(i)) end ————————————————————— What’s wrong with this? I get i = nil inside the function
i = 5
Function onTouched(partHit, i)
Print(i)
end
script~~~~~~~~~~~~~~~~~
.Parent.Touched:Connect(onTouched(i)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Could you explain what you are trying to do and format your whole script into the Lua code block (last icon that is a blue sphere and has 'Lua" on it)?
I’m trying to pass a parameter in addition to the touched part with the Touched event. The script shown is a simplified version just containing my issue. i is actually from For i , v Table:GetChildren()