How do I make this work in a global script:
local player=game.Players.LocalPlayer
You can have a local script make the value of an object value the player
Local Script
--assuming the local script is in starterpack and the objectvalue is under the name of "player" in the workspace workspace.player.Value = game.Players.LocalPlayer script:Destroy()
Server Script
--workspace.player.Changed:connect(function(value) player = value end --now you can reference the player using player.
Alternatively, you could have a table that is changed whenever a player joins or leaves.
Server Script
local players = {} game.Players.PlayerAdded:connect(function(player) players[player.Name] = player end) game.Players.PlayerRemoving:connect(function(player) players[player.Name] = nil end)