How? I tried searching online but they do it in a Server Script not in a Local Script. CharacterAdded doesn't work in local scripts so how?
COMMUNITY QUESTION
How to know if character respawns in a Local Script?
3 answers
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
Use this
local Players = game:GetService("Players")
local function onCharacterAdded(character)
-- Code when character is added
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
Players.PlayerAdded:Connect(onPlayerAdded)
from this https://developer.roblox.com/en-us/api-reference/event/Player/CharacterAdded
edit
local Players = game:GetService("Players")
local function onCharacterAdded(character)
-- Code when character is adeed
end
local function onCharacterRemoving(character)
-- Code when character is removing
end
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
player.CharacterRemoving:Connect(onCharacterRemoving)
end
Players.PlayerAdded:Connect(onPlayerAdded)
Already fixed! Thx for the help!
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
um maybe do it in a serverscript xd
Cant becuz i will blur the screen of that player only