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

How to retrieve player data through clicking GUI button?[UNSOLVED]

Asked by 10 years ago

I basically need help finding a way to script a GUI button so that when a player clicks the button, the script finds out who clicked it and then goes into game.Workspace.Playerwhoclicked.Intvalue . I made the following script but I am not convinced that it receives only that players info. Script:

function onClicked(Player)


local c = game.Players:GetChildren() 
for i = 1, #c do 
local candy = c[i].Character:findFirstChild("Money")
print(candy.Value)

end 
end


script.Parent.MouseButton1Click:connect(onClicked)
0
Wait, is the money a leaderstat or a intvalue INIDE the character playing the game ConnorVIII 448 — 10y
0
Its a int value inside the character playing the game. lordrex12345 25 — 10y
0
Any help guys? lordrex12345 25 — 10y

1 answer

Log in to vote
0
Answered by
Redbullusa 1580 Moderation Voter
10 years ago

Use your argument.

function onClicked(plr)
    local candy = plr.Character:FindFirstChild("Money")
    print(candy.Value)
end

script.Parent.MouseButton1Click:connect(onClicked)
Ad

Answer this question