how to get a localplayer in workspace ik for the game.players its just.LocalPlayer But it doent work in the workspace how to do it
You can only call Localplayer from a localscript. You have to use another method of finding the player with server scripts. For instance, in a RemoteEvent you can do:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:connect(function(player)
Well, I'm assuming you're using a LocalScript (if you aren't using a LocalScript then you need to be using one to define a LocalPlayer) and want to define the player's Character that is located in Workspace (and not the player as in what is found in the Players tab in Studio). If that is what you are asking, then you can define a player and the player's Character like this:
local player = game.Players.LocalPlayer local char = workspace:WaitForChild(player.Name)
Also, when using a LocalScript, you must place it in one of 5 locations. According to the ROBLOX Wiki, these 5 locations are the following:
1) A Player's Backpack, such as a child of a Tool
2) A Player's Character model
3) A Player's PlayerGui
4) A Player's PlayerScripts
5) The ReplicatedFirst service
I don't know if this is what you are looking for, but if it is and this works, please accept my answer. Hope this helps!