Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a "game.Players.LocalPlayer" for a regular script, or something similar?

Is there a game.Players.LocalPlayer type thing for a regular script, or anything else I could do to access a Player without a localscript?

I'm trying to make a Miner's Haven type game, and I'm getting stuck on adding the ore's value to a cash value in the leaderboard. Here's my script.

(If needed, this is a regular script in a part in the workspace)

local sellValue = 100

script.Parent.Touched:Connect(function(Toucher)
	if Toucher:FindFirstChild("OreValue") then
		local OreValue = Toucher.OreValue
		print("The ore's value is " .. OreValue.Value)
		OreValue.Value = OreValue.Value * sellValue
		print("The ore was sold for " .. OreValue.Value)
		--??? How to add to leaderboard
	end
end)

1 answer

✓ Accepted answer

Kinda.

You can do:

game.Players.PlayerAdded:Connect(function(player)
	...
end)

and inside that function "player" would be like LocalPlayer

1 comment

1

that worked. Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.