|
| 11 Nov 2016 12:33 AM |
I did a leaderboard script, so then I decided to do a point earning button, but every time I try and touch it, I get no points on the leaderboard here's the script I have.
game.Players.PlayerAdded:connect(function(player) local leader, score = Instance.new('IntValue'), Instance.new('IntValue') leader.Name = 'leaderstats' score.Name = 'Score' score.Parent = leader leader.Parent = player end) Workspace.Button.Touched:connect(function(hit) local p = game.Players:FindFirstChild(hit.Parent.Name) if pl and enabled == true then enabled = false p.leaderstats.Score.Value = p.leaderstats.Score.Value + 5 wait(20) enabled = true end end)
If anything's wrong with this please correct me on this |
|
|
| Report Abuse |
|
|
|
| 11 Nov 2016 12:34 AM |
| I also inserted that script into a part, so if that was wrong then idk |
|
|
| Report Abuse |
|
|
|
| 11 Nov 2016 12:49 AM |
well in the script u posted above it says "if pl" and you never made a variable called pl thats the only thing i see wrong with it are there any errors? Also i suggest using the 'GetPlayerFromCharacter()' method instead of FindfirshChild() In getPlayerFromCharacter you put the character model as a parameter instead of the player's name. here wiki page for it http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter
R$5,623 |
|
|
| Report Abuse |
|
|
|
| 11 Nov 2016 12:51 AM |
| weird, cause I checked the cookbook to see if I was wrong or right. And it said the same thing. But ok, I'll try your method |
|
|
| Report Abuse |
|
|