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

Why doesn't this GUI script work? The current answer does not work

Why doesn't this work? Here is how the GUI is setup; http://gyazo.com/064225118cd9ddbffe6fd573d6a61fe8

playerNameforPTS = script.Parent.Parent.TextBox.Text -- Takes the value from the TextBox




function Click(mouse) -- leave this
	playerNameforPTS = script.Parent.Parent.TextBox.Text -- Updates the value
	print(playerNameforPTS) -- Prints it
	if game.Players:FindFirstChild(playerNameforPTS) then
		game.Players.playerNameforPTS.leaderstats.Points.Value = game.Players.playerNameforPTS.leaderstats.Points.Value+1
	end
end

script.Parent.MouseButton1Down:connect(Click)

2 answers

playerNameforPTS = script.Parent.Parent.TextBox.Text -- Takes the value from the TextBox




function Click(mouse) -- leave this
    playerNameforPTS = script.Parent.Parent.TextBox.Text -- Updates the value
    print(playerNameforPTS) -- Prints it
    if game.Players:FindFirstChild(playerNameforPTS) then
        game.Players:findfirstchild(playerNameforPTS).leaderstats.Points.Value = game.Players:findfirstchild(playerNameforPTS).leaderstats.Points.Value+1
    end
end

script.Parent.MouseButton1Down:connect(Click)

You need the "FindFirstChild" command to be able to find the playerNameforPTS. All you did wrong was finding the value. This should work...Leave a comment if not, and i'll see what I can do.

playerNameforPTS = script.Parent.TextBox -- Takes the value from the TextBox
02
 
03
 
04
 
05
 
06
function Click(mouse) -- leave this
07
    playerNameforPTS = script.Parent.TextBox -- Updates the value
08
    print(playerNameforPTS) -- Prints it
09
    if game.Players:FindFirstChild(playerNameforPTS) then
10
        game.Players.playerNameforPTS.leaderstats.Points.Value = game.Players.playerNameforPTS.leaderstats.Points.Value+1
11
    end
12
end
13
 
14
script.Parent.MouseButton1Down:connect(Click)

2 comments

0

Um, thats just a copy of what I did lol

0

Um, I'm pretty sure it wasn't m8!

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