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

How do I get client leaderboard points to the servers leaderboard? (SOLVED)

Asked by
xsodar 19
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:

game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:Connect(function(plr)
    game.Workspace.DoorOne.Name = "DoorOneDel"
    game.Workspace.DoorOneDel:Destroy()
end)

part = Instance.new("Part",game.Workspace)
clicka = Instance.new("ClickDetector",part)

clicka.MaxActivationDistance = 10

part.Name = "DoorOne"
part.BrickColor = BrickColor.new("Black")
part.Transparency = 0.6
part.Size = Vector3.new(8,10,10)
part.Anchored = true
part.Position = Vector3.new(-171.37, 4.29, -98.26)

game.Workspace.DoorOne.ClickDetector.MouseClick:Connect(function(player)

    if player.leaderstats.Rubies.Value >= 100 then
        player.leaderstats.Rubies.Value = player.leaderstats.Rubies.Value - 100
        game.Workspace.DoorOne.CanCollide = false
        game.Workspace.DoorOne:Destroy()
        game.Workspace.DoorOneText:Destroy()
        game.StarterGui.DoorOne:Destroy()

    else
        game.Workspace.DoorOneText.SurfaceGui.Buy.Visible = false
        game.Workspace.DoorOneText.SurfaceGui.Not_Enough.Visible = true
        wait(3)
        game.Workspace.DoorOneText.SurfaceGui.Buy.Visible = true
        game.Workspace.DoorOneText.SurfaceGui.Not_Enough.Visible = false

    end

end)

I hope you understand what I mean and sorry for a long description. Thanks

0
I read that like 3 times but I always get lost at "when I touch a part that gives 1 "Rubies" if I touch it, then all the "Rubies" that disappeared before is now back" Amiaa16 3227 — 6y
0
I know, it is a bit confusing, I'll link a video that you can watch instead. I just need to upload it to YouTube. xsodar 19 — 6y
0
Watch this YouTube clip: https://www.youtube.com/watch?v=XXU1CxBoqdg xsodar 19 — 6y
0
remote functions & events RetroGalacticGamer 331 — 6y
0
Thanks, hope it works :) xsodar 19 — 6y

Answer this question