How do I get client leaderboard points to the servers leaderboard? (SOLVED)
Asked by
6 years ago Edited 6 years ago
I have a script that I made, the script should do that if you have 100 "Rubies" and click on a local part then should the local part disappear, it should just disappear for the "LocalPlayer". When I have clicked on the local part it disappears and also 100 "Rubies" disappear from the leaderboard.
The thing is that when I touch a part that gives 1 "Rubies" if I touch it, then all the "Rubies" that disappeared before is now back.
for an example: If I have 100 "Rubies" and click on the local part then it disappears and I have 0 "Rubies" left. Then if I touch the part that gives me 1 "Rubies" then I get 101 "Rubies".
I know why this happens and that is because the part I clicked on only take away my clients "Rubies" but not the "Rubies" from the server. The part that gives one "Rubies" when I touch it is from the server.
Video: http://www.youtube.com/watch?v=XXU1CxBoqdg
So the thing I want know is if anyone of you knows how to transfer the clients "Rubies" to the servers "Rubies"? Or do you have a better idea so it works the same?
Here is my script:
01 | game.Players.LocalPlayer.Character:WaitForChild( "Humanoid" ).Died:Connect( function (plr) |
02 | game.Workspace.DoorOne.Name = "DoorOneDel" |
03 | game.Workspace.DoorOneDel:Destroy() |
06 | part = Instance.new( "Part" ,game.Workspace) |
07 | clicka = Instance.new( "ClickDetector" ,part) |
09 | clicka.MaxActivationDistance = 10 |
12 | part.BrickColor = BrickColor.new( "Black" ) |
13 | part.Transparency = 0.6 |
14 | part.Size = Vector 3. new( 8 , 10 , 10 ) |
16 | part.Position = Vector 3. new(- 171.37 , 4.29 , - 98.26 ) |
18 | game.Workspace.DoorOne.ClickDetector.MouseClick:Connect( function (player) |
20 | if player.leaderstats.Rubies.Value > = 100 then |
21 | player.leaderstats.Rubies.Value = player.leaderstats.Rubies.Value - 100 |
22 | game.Workspace.DoorOne.CanCollide = false |
23 | game.Workspace.DoorOne:Destroy() |
24 | game.Workspace.DoorOneText:Destroy() |
25 | game.StarterGui.DoorOne:Destroy() |
28 | game.Workspace.DoorOneText.SurfaceGui.Buy.Visible = false |
29 | game.Workspace.DoorOneText.SurfaceGui.Not_Enough.Visible = true |
31 | game.Workspace.DoorOneText.SurfaceGui.Buy.Visible = true |
32 | game.Workspace.DoorOneText.SurfaceGui.Not_Enough.Visible = false |
I hope you understand what I mean and sorry for a long description.
Thanks