#ATTEMPT TO CONNECT FAILED: passed value is not a function
1 messages · Page 1 of 1 (latest)
@steel bear very common mistake,
--so luau differentiates between functions and function calls
function ExampleFunction()
return "Banana"
end
ExampleFunction --a var referring to the function
ExampleFunction() -- a function call
--when connecting events it is important to mix these 2 up
Event:Connect(ExampleFunction) -- correctly connects event to a predeclared function
Event:Connect(function() --correctly connects event to a newly declared function
end)
Event:Connect(ExampleFunction()) --no, you passed a call, returning whatever the function returns (in this case, banana) and connected it to an event. The string "Banana" is not a function and it will thus error when trying to connect the event to said string
@cobalt hemlock im doing playerAdded and ut wont work
And I just explained why...
Just send the script here
a snippet of it or the whole thing cuz its long
The line where it says the error is
alr theres 3
im on discord on a different device so holdo n
its
players.PlayerAdded:Connect(playerAdded)
and
for _, player: Player in players:GetPlayers ()do
playerAdded(player)
Can you send me the playeradded script?