I changed something about a script which somehow caused another script to error. I know the script is having an error because the script is running before the player’s character is loaded. The issue is that the script is not a local script and it is in the workspace. I have tried to find the answer but it just tells me to use .CharacterAdded:Wait() and whenever I use it, the character is never put into the workspace. Here is the script:
local debounce = false
local inf = true
game.Players.PlayerAdded:connect(function(player)
task.wait()
if player then
repeat
task.wait(1)
debounce = true
if player.Character.Humanoid.Health < .05 and player.Character.Value.Value == 0 then
player.Character.Humanoid.MaxHealth = 0.1
player.Character.Value.Value = 1
task.wait(0.1)
player.Character.Humanoid.Health = 0.1
else
if player.Character.Humanoid.Health <= 0 and player.Character.Value.Value == 1 then
player.Character.Humanoid.MaxHealth = 0.1
player.Character.Value.Value = 2
end
end
debounce = false
until inf == false
end
end)
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
-- Rest of your code
end)
end)
This means your code will not run until a character is added for that player!
.CharacterAdded:Wait() should have done the same thing. Perhaps you implemented it incorrectly.
Also!
Remove if player then and task.wait(). The player will always exist if this connection receives a player ingame. task.wait() also does nothing but delay your script 1 Frame (.01677 seconds).
I figured out that I had accidentally turned off CharacterAutoLoads in Players without realizing it. I’m sorry for the waste of time but thanks for helping.