I am currently using this program and here it is.
function run(i) print(i) end script.Parent.Place1.MouseButton1Click:Connect(run(1)) script.Parent.Place2.MouseButton1Click:Connect(run(2)) script.Parent.Place3.MouseButton1Click:Connect(run(3))
When I run this program it keeps saying Attempt to call a nil value. Please tell me why this isn't working!
What is happening when this code is ran is that Connect() tries to run the function inside the parenthesis.
run
by itself is a function
run(3)
is calling the function run.
When you say Connect(run) you are running the function when you click the mouse. When you say Connect(run(3)) you are calling run, which returns nil so the what the code actually sees Connect(nil) resulting in your error.
You should instead do the following:
function run(i) print(i) end script.Parent.Place1.MouseButton1Click:Connect(function() run(1) end) script.Parent.Place2.MouseButton1Click:Connect(function() run(2) end) script.Parent.Place3.MouseButton1Click:Connect(function() run(3) end)