This used to work, but now, the shop only works when you spawn in with enough money, but when you earn money a different way, or change the money value, it does not work, but does not give any errors.
The scripts are really simple, and used to work. In Server script service:
game.Players.PlayerAdded:connect(function(plr)
local folder = Instance.new("Folder", plr)
folder.Name = "leaderstats"
local cash = Instance.new("IntValue", folder)
cash.Name = "Rubble"
cash.Value = 100
end)
In the touch block:
local price = 20
local db = true
script.Parent.Touched:connect(function(hit)
if db == true then
if hit.Parent:FindFirstChild(“Humanoid”) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player.leaderstats.Rubble.Value >= price then
player.leaderstats.Rubble.Value = player.leaderstats.Rubble.Value - price
db = false
script.Parent.BrickColor = BrickColor.new(“Bright red”)
print(“Has enough”)
wait(3)
script.Parent.BrickColor = BrickColor.new("Bright green")
db = true
end
end
end
end)
Did roblox change something? Thanks for the help.