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

How do I define players through a regular script?

So I always struggle define players through regular scripts. When you use a local script, you just use local player = game.Players.LocalPlayer but, I need to do this through a regular script. Is it even possible?

1 comment

0

It's definitely possible, can you show us where you're struggling to define a player so we can offer some help?

1 answer

✓ Accepted answer

You can use multiple things like using a ClickDetector,ClickDetector.MouseClick:Connect(function(player), the PlayerAdded event, Players.PlayerAdded:Connect(function(player), the GetPlayerFromCharacter function, commonly used with the Touched event of a part, Players:GetPlayerFromCharacter(hit.Parent), or using a remote event or function, RemoteEvent.OnServerEvent:Connect(function(player).

4 comments

0

Is it possible to just straight up define the player though?

0

No. You can't use Players.LocalPlayer on a ServerScript (regular script).

0

Oh, okay, thanks!

0

No problem.

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