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

Attemp to Connect Failed: passed value is not a function?

Asked by 7 years ago

the error on line 1

game.Players.PlayerAdded:connect(onPlayerRespawned)
function onPlayerRespawned(newPlayer)
 wait(1)
 if newPlayer.Name == "killzone45671" then --Change Wacon to your name.
  local gui=Instance.new("BillboardGui")
  gui.Parent=newPlayer.Character.Head
  gui.Adornee=newPlayer.Character.Head
  gui.Size=UDim2.new(3,0,3,0)
  gui.StudsOffset=Vector3.new(0.5,2,0)
  local text=Instance.new("ImageLabel")
  text.Image = "http://www.roblox.com/asset/?id=50540825" 
  text.Size=UDim2.new(1,0,1,0)
  text.Position=UDim2.new(-0.125,0,-0.25,0)
  text.BackgroundTransparency = 1
  text.Parent=gui
 end
end

function onPlayerEntered(newPlayer)
 newPlayer.Changed:connect(function (property)
  if (property == "Character") then
   onPlayerRespawned(newPlayer)
  end
 end)
end

game.Players.PlayerAdded:connect(onPlayerEntered)
0
game.Players.PlayerAdded:connect(function(onPlayerRespawned) fix the first line Verified_Player 9 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

You have to declare the function first, then connect it.

Ad

Answer this question