I am trying to create a leaderboard and im trying to use datastore but it forgot how to use it. here is the script *database script at line 32
--/By Sabrna563 --Variables local Assets = script.Parent -- The Leaderboard --Player1 Assets local Player1 = Assets.Player1 -- Player 1 local P1Shirt = Assets.Player1.Shirt -- Shirt of Player 1 local P1Pants = Assets.Player1.Pants -- Pants of Player 1 local P1Name = Assets.Player1Box.SurfaceGui.PlayerName.Text -- TextBox of Player 1 --Player2 Assets local Player2 = script.Parent.Player2 -- Player 2 local P2Shirt = Player2.Shirt -- Shirt of Player 2 local P2Pants = Player2.Pants -- Pants of Player 2 local P2Name = Assets.Player2Box.SurfaceGui.PlayerName.Text --TextBox of --Player3 Assets local Player3 = script.Parent.Player3 -- Player 3 local P3Shift = Player3.Shirt -- Player 3 Shirt local P3Pants = Player3.Pants local P3Name = Assets.Player3Box.SurfaceGui.PlayerName.Text --Faces local Face1 = script.Parent.Player1.Head.face.Texture-- Face Of Player 1 local Face2 = script.Parent.Player2.Head.face.Texture-- Face of Player 2 local Face3 = script.Parent.Player3.Head.face.Texture--Face of Player 3 --Checks If Player Should Be On Leaderboard local DataStore = game:GetService("DataStoreService")
Also how do you count the accesories on a player? or just a number of a specific type of object in a parent.
This is my script so far
local NumberOfaccesories = game.Players.LocalPlayer.Character
Hello, you can just make a simple leaderboard script, then, in another script, use DataStoreService to save the data when the player joins and leaves. from there you can setup a system to add/remove points from the player. Thanks -DragonSpawner12.
Try checking for the number of accessories this way:
local numOfAccessories = 0 for _, v in pairs(game.Players.LocalPlayer.Character:GetChildren()) do if v:IsA("Accessory") then numOfAccessories = numOfAccessories + 1 end end print(numOfAccessories)
I think this tutorial will help you in creating your leaderboard. https://www.youtube.com/watch?v=sXpuGnVzsxw