Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How exactly do I use a script to affect a person?

How exactly do I use a script to affect a person?I don't really know I just do something like game.Workspace.Players.(player name). stuff but that doesn't work :/

1 answer

This looks like a request but I can see what your trying to do.

First of all, Players aren't located in the workspace, only their characters! here's how to get the player service:

game:GetService("Players")

You can then make a service event for the players called "PlayerAdded" like so:

game:GetService("Players").PlayerAdded

To then make this work, you will need to connect a function, this can be done TWO ways..!

One:

local function Added(Player) -- player argument is the player as its the first argument of playeradded
  warn(Player.Name)
end

game:GetService("Players").PlayerAdded:Connect(Added) -- connects the function to the event

Two:

game:GetService("Players").PlayerAdded:Connect(function(Player) -- Player is the player.
      warn(Player.Name)
end)

Both these scripts warn the players names, to get the character you call Player.Character. all of these scripts can be made in local or server script.

For more reference to the players service click here

This discussion is preserved as it was. New answers, comments, and votes are closed.