So I want to mention a player in a normal script... I can't use localplayer like I used until now cuz Im not using a local script, I would love help thx :)
local plr game.Players.PlayerAdded:Connect(function(player) plr = player end) wait(1) -- To wait for the player to add print(plr.Name)
It sets another variable (plr
) to the player
that gets defined when the PlayerAdded
function runs. If you need any further explanation just ask.
This is a way you can get a player from a server-side script if you have the players character.
local Players = game:GetService("Players") local part = script.Parent local function onTouched(part) local player = Players:GetPlayerFromCharacter(part.Parent) --part.Parent refers to the Character. print(player.Name .. " pressed me!") end part.Touched:Connect(onTouched)
I don't know what you mean by "mentioning a player". Like, in what context?