of     1   

milanomaster
#227351788Wednesday, November 08, 2017 10:11 PM GMT

Could anyone tell me what's wrong with this script. After the player has died three times, he/she/'it' does not teleport. *Error: Unable to cast instance to int (line 14) ------------------------------------------------------------------------------------- local destinationID = ######### lives = 3 game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(loaded) local human = loaded:WaitForChild("Humanoid") if human then human.Died:Connect(function(dead) lives = lives - 1 end) if lives <= 0 then game:GetService("TeleportService"):Teleport(human, destinationID) end end end) end)
chexyalani
#227351966Wednesday, November 08, 2017 10:16 PM GMT

The Teleport function's 1st argument should be a player, not a humanoid instance Also, Died event of the Humanoid instance doesn't have anything fired to it.
milanomaster
#227352227Wednesday, November 08, 2017 10:23 PM GMT

Changed it a little, although I'm afraid that I do not understand what you mean with your second line. local destinationID = ####### lives = 3 game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(loaded) local human = loaded:WaitForChild("Humanoid") if human then human.Died:Connect(function() lives = lives - 1 end) if lives <= 0 then game:GetService("TeleportService"):Teleport(player, destinationID) end end end) end)
K7Q
#227352260Wednesday, November 08, 2017 10:24 PM GMT

local destinationID = ####### lives = 3 game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(loaded) local human = loaded:WaitForChild("Character") if human then human.Died:Connect(function() lives = lives - 1 end) if lives <= 0 then game:GetService("TeleportService"):Teleport(player, destinationID) end end end) end) try dat might not work though.
milanomaster
#227352407Wednesday, November 08, 2017 10:28 PM GMT

The error on line 14 is now gone, however there's one over here v And the player does not teleport Infinite yield possible on 'milanomaster:WaitForChild("Character")' (line 7)
AdminModule
#227352427Wednesday, November 08, 2017 10:29 PM GMT

try :MoveTO
K7Q
#227352536Wednesday, November 08, 2017 10:32 PM GMT

local destinationID = ####### lives = 3 game:GetService("Players").PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(loaded) local human = loaded.Humanoid:WaitForChild("Character") if human then human.Died:Connect(function() lives = lives - 1 end) if lives <= 0 then game:GetService("TeleportService"):Teleport(player, destinationID) end end end) end) try that
milanomaster
#227352537Wednesday, November 08, 2017 10:32 PM GMT

Tried 'MoveTo' instead of 'Teleport' neither that works and the yield is still there.
K7Q
#227352585Wednesday, November 08, 2017 10:33 PM GMT

on the second if statement, use elseif instead of just if and get rid of the end in the middle
milanomaster
#227352775Wednesday, November 08, 2017 10:40 PM GMT

Hmm.. when I try to remove the 'end)' in the middle, I keep getting red lines.
milanomaster
#227353705Wednesday, November 08, 2017 11:05 PM GMT

Anyone?
K7Q
#227355948Thursday, November 09, 2017 12:07 AM GMT

remove the end and turn the second elseif statement into if like this script.Parent:Changed.connect(function() if.Parent.FindFirstChild('BooleanValue') == true then for i,v in pairs (game.Players:GetPlayers()) v:Kick("Reason here") end end
K7Q
#227374975Thursday, November 09, 2017 5:21 PM GMT

lmao sorry i put this in the wrong thread

    of     1