Hi, I’m AE_TG, and I would like to ask if you can access the player’s character from a server script. I’m trying to make an ability for a small project which the player’s HumanoidRootPart is covered by particles and essentially covering the whole body. However, I forgot that you cannot access the LocalPlayer from a script and so I’m trying to find out how I can without LocalPlayer. I am using RemoteEvents, but I believe you cannot pass the player in arguments on the OnServer() event (please correct me if I’m wrong). Help would be appreciated!
The Player that activated a RemoteEvent is always implicitly/automatically sent through as the first argument when activating it from the client. Since this allows you to have a reference to the Player, you can access their Character:
RemoteEvent.OnServerEvent:Connect(function(player)
local Character = player.Character or player.CharacterAdded:Wait()
end)