I’m trying to make a local script work for a server script but I’m stuck on how to identify the player and the player’s character.
this is the script I’m trying to change
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:FindFirstChild("Head")
local Face = Head:FindFirstChild("face") or Head:FindFirstChild("Face")
Face.Transparency = 1
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local head = character:FindFirstChild("Head")
local Face = Head:FindFirstChild("face") or Head:FindFirstChild("Face")
face.Transparency = 1
end
end)
An alternative here is to just use a server script in StarterCharacterScripts. The script will be added to the player’s character. So long as you don’t need the player variable (you can still get this anyway with GetPlayerFromCharacter) or it’s not inconvenient to put a script in a character, this works too.
local character = script.Parent
local face = character:FindFirstChild("face", true)
face.Transparency = 1