roblox lua if the player has a character code example
Example: roblox studio how to get the character
local player = game.Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
character = player.CharacterAdded:wait()
end