For some reason, when ever i try to make a GUI shop, it says, "leaderstats is not a valid member of DataModel". This is the script i used:
Cash = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points
function onClick()
if Cash.Value >= 50 then
Cash.Value = Cash.Value - 50
local RockLaunch = game.Lighting.EconomyClassTicket:clone()
RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.StarterGear
local RockLaunch = game.Lighting.EconomyClassTicket:clone()
RockLaunch.Parent = script.Parent.Parent.Parent.Parent.Parent.Backpack
RockLaunch.Handle.Anchored = false
end
end
script.Parent.MouseButton1Click:connect(onClick)
This is my leaderboard script:
game.Players.PlayerAdded:connect(function(player)
wait(.1)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
stats.Value = 0
stats.Parent = player
local newStat = Instance.new("IntValue")
newStat.Name = "Credits"
newStat.Value = 50
newStat.Parent = stats
local newStat = Instance.new("BoolValue")
newStat.Name = "Tycoon"
newStat.Value = false
newStat.Parent = player
end)
