Im trying to locate a local player without using
game.Players.LocalPlayer
Because that does not work with regular scripts. how would i make that work?
Im trying to locate a local player without using
game.Players.LocalPlayer
Because that does not work with regular scripts. how would i make that work?
The scripts that run on the server are independent of any single player.
So in order to pinpoint a specific player within a server script, you would have to know what sets them apart from everyone else.
However, if you wanted to manage every player at the time they joined, then you should use the PlayerAdded event:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
print(player.Name .. " has joined!")
end)
continued from Amanda's one
If your making a tool/gear then you can use
function Equipped()
local Character = script.parent.parent
local Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
end
script.Parent.Equipped:Connect(Equipped)
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Can you clarify what you want to do?
Can you clarify what you want to do?
Of course it doesn't work in "regular" Scripts. In reality, those are ServerScripts (Server-sided Scripts). The Server's purpose is to manage and replicate to Clients**, it is not a user, therefore it will have no Player.