So i got a global death script for my minigame so when a player dies that he wont be in the Game anymore ( like registered ) so the game says "the blabla won" it did all work but now it says that :
Workspace.Globaldeath:5: bad argument #1 to 'Connect' (RBXScriptSignal expected, got function)
here is the script
game:GetService("Players").PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) character:waitForChild("Humanoid").Died.connect(function() local Update = {} for i,v in pairs(_G.gameplayers) do if v ~= player.Name then table.insert(Update,1,v) end end _G.gameplayers = Update end) end) end)
and how can i add that if a player dies he goes into the team "Medium stone grey" ? :) ty
I see your problem now! In line 3 of your posted code, you are supposed to use :Connect()
, not .connect()
. Also, :connect()
is already deprecated, so you MUST get used to that (use :Connect()
instead).
Now, let me show you the fix:
game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(character) character:waitForChild("Humanoid").Died:Connect(function() -- Use :Connect() local Update = {} for i,v in pairs(_G.gameplayers) do if v ~= player.Name then table.insert(Update,1,v) end end _G.gameplayers = Update end) end) end)
If you have any questions, please leave them in the comments. Thanks!