Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Touched event calling function with part touched plus IntValue argument?



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

2 comments

0

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)?

0

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()

1 answer


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.