I'm trying to create a script that kills me until I have an item in my inventory. (a script gives one item to a player everytime they respawn) This is currently my code
repeat local tool = game.Players.leoultrapultra2.Backpack:FindFirstChild("Tool") if tool == nil then game.Players.leoultrapultra2.Character.Humanoid.Health = 0 end until tool == true
I don't understand how I am supposed to check if the player has the item or not. I'm trying to use findfirstchild but I'm not sure how to use this either.
Rather than a repeat loop, use CharacterAdded it's way more efficient.
-- [[ SERVICES ]] -- Players = game:GetService('Players') -- [[ MAIN SCRIPT ]] -- function onCharacterAdded(Player, Character) local Tool = Player.Backpack:FindFirstChild('toolName') if Tool then Character:BreakJoints() end local Tool = Character:FindFirstChild('toolName') if Tool then Character:BreakJoints() end end function onPlayerAdded(Player) Player.CharacterAdded:Connect(Character) onCharacterAdded(Player, Character) end) end -- [[ CONNECTIONS ]] -- Player.PlayerAdded:Connect(onPlayerAdded)