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

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

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)

3 comments

0

Wait, is the money a leaderstat or a intvalue INIDE the character playing the game

0

Its a int value inside the character playing the game.

0

Any help guys?

1 answer

Use your argument.

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

script.Parent.MouseButton1Click:connect(onClicked)

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