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

Script Doesnt Change Leaderboard Stats?

Asked by 2 years ago
Edited 2 years ago

so im making a game that when you press a part / button, it creates a part, turns the shape into a ball, turns it into a random color, clones it, make it bigger and a bit transparent, makes a model, clones 2 of the children scripts and parents them to the main ball part and welds everything, also makes a stringvalue that has the players name in it (the one who spawned that ball), and a script that when it touches a part names destroy, it destroys the ball and adds to the players money, but for some reason that script doesn't change the leaderboard, can anyone help

Normal Legacy Script In ServerScriptService, the leaderboard

01game.Players.PlayerAdded:Connect(function(player)
02    local leaderstats= Instance.new("Folder")
03    leaderstats.Name= ("leaderstats")
04    leaderstats.Parent= player
05 
06    local cash= Instance.new("IntValue")
07    cash.Name= ("Money")
08    cash.Parent = leaderstats
09    cash.Value = 0
10 
11 
12end)

Normal Legacy Script In Button in Workspace, the ball maker

01script.Parent.ClickDetector.MouseClick:connect(function(player)
02    local clone = Instance.new("Part")
03    clone.Name = "Ball"
04    clone.Material = Enum.Material.SmoothPlastic
05    clone.Shape = Enum.PartType.Ball
06    clone.Position = Vector3.new(-81.973, 148.927, -24.005)
07    clone.Anchored = false
08    clone.Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
09    clone.Size = Vector3.new(1.3,1.3,1.3)
10    clone.CanCollide = true
11    local cloneOutline = clone:Clone()
12    cloneOutline.Anchored = false
13    cloneOutline.Size = Vector3.new(1.5,1.5,1.5)
14    cloneOutline.Transparency = 0.75
15    cloneOutline.Name = "Outline"
View all 34 lines...

Two Normal Legacy Script In Above Script In Button in Workspace (gets cloned to each ball)

1script.Parent.Touched:Connect(function(hit) -- checks what the ball part clone has touched
2    if hit.Name == "Destroy" then -- checks if the part it touched is named destroy
3        script.Parent.Parent:Destroy() -- destroys the ball clone model
4        local player = game.Players.LocalPlayer
5        if player.leaderstats.Money.Value == script.Parent.Parent.PlayerName.Value then
6            player.leaderstats.Money.Value += 1
7        end
8    end
9end)
01function weld()
02    local parts,last = {}
03    local function scan(parent)
04        for _,v in pairs(parent:GetChildren()) do
05            if (v:IsA("BasePart")) then
06                if (last) then
07                    local w = Instance.new("Weld")
08                    w.Name = ("%s_Weld"):format(v.Name)
09                    w.Part0,w.Part1 = last,v
10                    w.C0 = last.CFrame:inverse()
11                    w.C1 = v.CFrame:inverse()
12                    w.Parent = last
13                end
14                last = v
15                table.insert(parts,v)
View all 27 lines...

Answer this question