What solutions have you tried so far? Did you look for solutions on the Developer Hub?
no I tried to fix this script by the help of the YouTube
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- game.Players.CharacterAutoLoads = false
game.Players.PlayerAdded:Connect(function(player)
local introGui = game.ServerStorage:WaitForChild("IntroGui")
local introGuiClone = introGui:Clone()
introGuiClone.Parent = player.PlayerGui
layer.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid.Died:Connect(function()
wait(5)
player:LoadCharacter()
end)
end
end)
end)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.
Did you remove IntroGui from the game? causing the script to break? If yes it can be solved by removing the lines below:
local introGui = game.ServerStorage:WaitForChild("IntroGui")
local introGuiClone = introGui:Clone()
introGuiClone.Parent = player.PlayerGui
Also it may be because the characters load before the .CharacterAdded event fires. In that case the script must assume the character may have already loaded:
game.Players.PlayerAdded:Connect(function(player)
--player added code
local function CharacterAdded(char)
--character added code
end
CharacterAdded(player.Character or player.CharacterAdded:Wait())
player.CharacterAdded:Connect(CharacterAdded)
end)
You need to provide more information if you want help with your problem. What is the script supposed to do? What’s going wrong? Are there errors that appear in the output?
The only thing that seems to be off with the code you’ve provided is a typo on line 7
-- "layer" instead of "player"
layer.CharacterAdded:Connect(function(character)