Quick question - I have a standard script in my workspace that fires when a user clicks on a block. The script that fires when the block is clicked needs to point to an object within the the player's player-folder, so I'm looking for an alternative to LocalPlayer that doesn't need to be ran inside of a LocalScript in order to work properly. Any suggestions? Thanks in advance.
Considering that you're using the script to get the person who clicked the brick's name,
.MouseClick should do the trick. https://www.robloxdev.com/api-reference/event/ClickDetector/MouseClick
script.Parent.ClickDetector.MouseClick:connect(function(player) print(player) end)
the output should be the person who clicked on the button's name ^ based on the example, you probably would already know what'd you need to do after that.
if you're trying to find the player's character, then just do
workspace:FindFirstChild(player)
if you're trying to find the player's player, just do
game.Players:FindFirstChild(player)
et cetera, the rest are self explanatory.
First: make a remote event anywhere, preferably replicated storage.
Second: Name the remote event "Event" and make a local script.
in the local script do the following
game.ReplicatedStorage.Event:FireServer()
Third: Make a script in serverscript service. In the script write the following
local event = game.ReplicatedStorage.Event event.OnServerEvent:Connect(function(player) print(player.Name) --Boom! end)