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

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

Asked by 10 years ago

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

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
10 years ago
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.

Ad
Log in to vote
-1
Answered by 10 years ago
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)

0
Um, thats just a copy of what I did lol adspace44 20 — 10y
0
Um, I'm pretty sure it wasn't m8! Y0UNGK1NG 0 — 9y

Answer this question