Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Detect a player's name & Place it somewhere in the script? [lol hard to explain]

Asked by
NewGPU 36
6 years ago
Edited 6 years ago

Basically, I can't figure out how to "detect" the player's name and have "PlayersNameHere" be the player's name.

game.Workspace.PlayerHolder.PlayersNameHere

I tried this.

local MarketplaceService = Game:GetService("MarketplaceService")

MarketPlaceService.ProcessReceipt = function(player)
    local plrname = player.name
    local gwpn = game.Workspace.PlayerHolder
    gwpn.plrname.Humanoid.Walkspeed = 25
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

(not a localscript) (a serverside script)

0
Have you tried using connect()? DeceptiveCaster 3761 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

I would recommend reading Roblox Wiki - Leaderboards(Exploiting section) It'll give you some information to secure your purchases among other things.

I also took a gander here Roblox Wiki - MarketplaceService

-- find the player based on the PlayerId in receiptInfo
local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then -- Seems like we can't find the player... already left?
    return Enum.ProductPurchaseDecision.NotProcessedYet -- Can't process
 end

The way I would save the name is when the player first joins the game. Have a running table store their data.

local playersData = {}

game.Players.PlayerAdded:Connect(function(Player)
    playersData[Player.UserId] = Player.Name
end)
0
What does leaderboards have todo with securing my purchases? NewGPU 36 — 6y
0
I specifically wrote "Exploiting section". But if that doesn't make sense as to how it would secure your purchases then ignore it. MooMooThalahlah 421 — 6y
0
And you linked me the "Leaderboards(Exploiting section)" "LEADERBOARDS" NewGPU 36 — 6y
0
http://wiki.roblox.com/index.php?title=LEADERBOARDS <<<<<<< Directly from your post NewGPU 36 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

You can use obj["string"] to find a child of obj called string, it's the same as doing obj.string

So, you would put game.Workspace.PlayerHolder[plrname] to do what you're trying to do.

Also, I don't believe your 3rd line would work, since ProcessReceipt is an event, you have to connect the event to a function for it to work. Change line 3 to

function processReceipt(player)

and add this code to the bottom of your script

MarketPlaceService.ProcessReceipt:connect(processReceipt)
0
Didin't seem to do anything really. NewGPU 36 — 6y

Answer this question