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

Troubleshoot with my Textbutton?

Asked by 10 years ago
songname=script.Parent.tostring(Text)
script.Parent.MouseButton1Click:connect(function()
    game.Workspace.SongVote.songname.Value=game.Workspace.SongVote.songname.Value+1
    script.Parent.Parent.Parent.Visible=false

end)

I tried adding a (tostring) but it doesnt work, and I really have no idea what to do here So if someone could tell me what to do to fix this, it would help a lot

Parent is a TextButton

0
Please remember to format the code you post to make it easier to read. Select the code section of your post and click the Lua logo. Ekkoh 635 — 10y

1 answer

Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

You were using tostring incorrectly and you didn't need it anyway since Text is already a string. The problem was the way you were trying to index the song.

songname=script.Parent.Text
script.Parent.MouseButton1Click:connect(function()  
    game.Workspace.SongVote[songname].Value=game.Workspace.SongVote[songname].Value+1 
    script.Parent.Parent.Parent.Visible=false
end)
Ad

Answer this question