Hello. I've been upgrading the "snake game basic scripting tutorial". Now I want to have a leaderboard that updates and tells the player how big their snake is. I've made a bindable event that fires when the apple is touched by the player but i'm having trouble properly referencing the player that has a folder in it so the leader stats can uptick. Can someone help me?
#How to reference player to update leaderboard
1 messages · Page 1 of 1 (latest)
@pine geyser no need for a bindable, you can directly get the player from the character in the apple script and do player.leaderstats.Size.Value += 1
Also, you cannot get game.Players.LocalPlayer on the server. That is client script exclusive
So I would completely delete the bindable and increase the leaderstat value in the script where you detect snake size increase on apple touch
so I'm attempting to just have the leaderstats update in the apple script but the arg for the function to activate is the character instead of the player. I'm having trouble trying to reference the player because i'm getting an error of "leaderstats is not a member of model "
To get the player from the character you have to do game:GetService('Players'):GetPlayerFromCharacter(character)
Got it to work! Thanks! https://gyazo.com/2c491c9b618a1b88bda5cb3230726072
didnt know you could refer to the player from the character
Yep!