My Local Script Inside Screen Gui " Testing " https://i.gyazo.com/dd2417159cc577ed4a0850adb7fdd9cd.png
Inside local script " UpgradClick" - The mouse button down and up are the only code that are associated with give player a cookie...the upgrades add cookies per click....at baseline with no upgrade when the decal cookie image is clicked it gives player 1 cookie....
-- Variables
local cookiev = script.Parent.ckiesv
local rebirthv = script.Parent.rbv
local cookie = script.Parent.cookie
local upg1 = script.Parent.Box.upg1
local plr = game.Players.LocalPlayer
local upg2 = script.Parent.Box.upg2
local upg3 = script.Parent.Box.upg3
local tip = script.Parent.TextLabel
local sug1 = script.Parent.Box.sug1
local rb1 = script.Parent.rb1
local cc = true
local wt = script.Parent.wt
cookie.MouseButton1Down:Connect(function()
if cc == true then
cc = false
cookie.Size = UDim2.new(0,250,0,250)
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value + cookiev.Value
tip.Visible = true
tip.Text = ("+"..cookiev.Value.." cookies")
cookie.Rotation = math.random(-30,30)
tip.TextColor3 = Color3.new(math.random(0,255)/255, math.random(0,255)/255, math.random(0,255)/255)
wait(script.Parent.wt.Value)
cc = true
end
end)
cookie.MouseButton1Up:Connect(function()
cookie.Size = UDim2.new(0,300,0,300)
tip.Visible = false
cookie.Rotation = 0
end)
upg1.MouseButton1Click:Connect(function()
if plr.leaderstats.Cookies.Value >= 50 then
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 50
cookiev.Value = cookiev.Value + 5
end
end)
upg2.MouseButton1Click:Connect(function()
if plr.leaderstats.Cookies.Value >= 150 then
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 150
cookiev.Value = cookiev.Value + 15
end
end)
upg3.MouseButton1Click:Connect(function()
if plr.leaderstats.Cookies.Value >= 250 then
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 250
cookiev.Value = cookiev.Value + 25
end
end)
sug1.MouseButton1Click:Connect(function()
if plr.leaderstats.Cookies.Value >= 5000 then
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 5000
wt.Value = wt.Value - 0.1
if wt.Value <= 0 then
sug1.Visible = false
end
end
end)
rb1.MouseButton1Click:Connect(function()
if plr.leaderstats.Cookies.Value >= 2000000 then
plr.leaderstats.Cookies.Value = plr.leaderstats.Cookies.Value - 2000000
cookiev.Value = cookiev.Value * 1.3
plr.leaderstats.Rebirths.Value = plr.leaderstats.Rebirths.Value + rebirthv.Value
end
end)
Whats Inside My Server Script Service ( https://i.gyazo.com/7a165e7345dffa90379fe08a77dc5890.png)
Inside Script " leaderboard"
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("CookiesSaveSystem")
function savetablefunc(player)--a table is much more efficient for saving
local savetable = {
cookies = player.leaderstats.Cookies.Value,
rebirths = player.leaderstats.Rebirths.Value
}
return savetable
end
game.Players.PlayerAdded:Connect(function(player)
local clone = script.leaderstats:Clone()--here we clone the files over
clone.Parent = player
local save = savetablefunc(player)
local savedstuff = ds1:GetAsync(player.userId)
function datapull(player,save) -- here we pull the saved data into the ints we cloned
player.leaderstats.Cookies.Value = savedstuff.cookies
player.leaderstats.Rebirths.Value = savedstuff.rebirth
end
datapull(player,save)
end)
function savedata(player) --this is just the function to call on leaving
local save = savetablefunc(player)
ds1:SetAsync(player.userId,save)
end
game.Players.PlayerRemoving:Connect(savedata)-- here we save the data on player leaving, you dont need on change its wasteful in most cases

8 comments
I meant more like make a NEW question but i suppose this works. Also post your localscript where the cookies are given, inside seperate LUA brackets above.
uhhh
uhhh
DinozCreates you still there?
yes, ok so ill give you the gist and let you figure the rest out. hold up.
refresh page updated some thing
also yes, just give me the gist and will follow it when i have more time to mess with my game and learn more lua. I didn't expect you to do it for me haha even though would be nice right..Anyways much appreicate the help you been giving me, am learning new things from just chatting with you...
Im not good but i have a general enough understanding of data stores and remote events to get you started!