I need to way to find to localplayer and use it as a variable in a normal script that is in ServerScriptService :)
COMMUNITY QUESTION
How do i find a LocalPlayer in a normal script?
1 answer
Yes there is a way to do this see the wiki page http://wiki.roblox.com/index.php?title=API:Class/Players/PlayerAdded
In studio you have to do it like this underneath.
local Players = game:GetService("Players")
function onPlayerAdded(player)
print(player.Name .. " has entered the game")
end
--When a player joins, call the onPlayerAdded function
Players.PlayerAdded:connect(onPlayerAdded)
--Call onPlayerAdded for each player already in the game
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
Maybe this helps i do not know yet how to store the charachter names. I think you should return the function then add the return in a table.
This discussion is preserved as it was. New answers, comments, and votes are closed.
