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

Is the reason this script is not working because roblox updated the system?

Asked by 4 years ago
Edited 4 years ago

This is an item shop script

local player = game.Players
Cash = script.Parent.Parent.Parent.Parent.Parent.RealMoney
local tool = game.Lighting.Spas12
function onClick()
    if Cash.Value >= 10 then
        Cash.Value = Cash.Value - 10
            local clone = tool:Clone()
            clone.Parent = player.Backpack

    end
end

script.Parent.MouseButton1Click:connect(onClick)


the leaderboard

local rs = game:GetService("ReplicatedStorage")

game.Players.PlayerAdded:Connect(function(plr)
    local ls = Instance.new("IntValue", plr)
    ls.Name = "leaderstats"
    local rc = Instance.new("NumberValue", plr)
    rc.Name = "RealMoney"
    local c = Instance.new("StringValue", ls)
    c.Name = "Money"
    c.Value = "$"..rc.Value
    c.Value = 10
    rc.Value = 10

1
Put Spas12 in ReplicatedStorage instead of Lighting. Geobloxia 251 — 4y
0
ok ill try FluffySheep46209 369 — 4y
0
The reason is because "player" is the game.Players not the actual person who is playing Geobloxia 251 — 4y
0
game.Players is where all the players are located, not the specific player. Geobloxia 251 — 4y
View all comments (9 more)
0
What should I replace it with ? FluffySheep46209 369 — 4y
0
What is script.Parent? Geobloxia 251 — 4y
0
That line is the players money FluffySheep46209 369 — 4y
0
Can I see the Leaderboard/Leaderstats script? Geobloxia 251 — 4y
0
the problem with the orig script wasn't the cash, but the tool didn't go into the players backpack FluffySheep46209 369 — 4y
0
The cash has to do with the tool going in the backpack. Geobloxia 251 — 4y
0
Can I see thew Leaderboard/Leaderstats script? Geobloxia 251 — 4y
0
ok FluffySheep46209 369 — 4y
0
I edited my answer. Hope it works! Geobloxia 251 — 4y

1 answer

Log in to vote
1
Answered by
Geobloxia 251 Moderation Voter
4 years ago
Edited 4 years ago

Put Spas12 in ReplicatedStorage and put the script in the model and put a ClickDetector in the model. I'm not sure this will work:

local tool = game.ReplicatedStorage.Spas12
-- put Spas12 in ReplicatedStorage
function onClick(plr)
    if plr.leaderstats.Realmoney.Value >= 10 then
        plr.leaderstats.RealMoney.Value = plr.leaderstats.RealMoney.Value - 10
            local clone = tool:Clone()
            clone.Parent = plr.Backpack

    end
end

script.Parent.ClickDetector.MouseClick:Connect(onClick)
0
Reply in the comments if it doesn't work. Also, cash is the leaderstat, right? Geobloxia 251 — 4y
0
cash is in the player FluffySheep46209 369 — 4y
0
That is the cash's parent exactly? Geobloxia 251 — 4y
0
Sorry this didn't work, the problem with the orig script wasn't the cash, but the tool didn't go into the players backpack FluffySheep46209 369 — 4y
View all comments (5 more)
0
Sorry this didn't work, the problem with the orig script wasn't the cash, but the tool didn't go into the players backpack FluffySheep46209 369 — 4y
0
The cash has to do with the tool going in the backpack. Geobloxia 251 — 4y
0
Thx it worked!! FluffySheep46209 369 — 4y
0
You're welcome. Geobloxia 251 — 4y
0
:D Geobloxia 251 — 4y
Ad

Answer this question