Coin System Help

You can write your topic however you want, but you need to answer these questions:

  1. I can’t get this coin system to work

–Coin Stuff
local DataStore = game:GetService(“DataStoreService”)
local ps = DataStore:GetDataStore(“WinStoreSystem”)
local cs = DataStore:GetDataStore(“CoinsStoreSystem”)

game.Players.PlayerAdded:Connect(function(player)
local q = Instance.new(“IntValue”)
q.Name = “Queue”
q.Parent = player
script.Stats:Clone().Parent = player
local l = Instance.new(“BoolValue”)
l.Name = “leaderstats”
local ex = Instance.new(“IntValue”)
ex.Name = “Wins”
ex.Value = ps:GetAsync(player.UserId) or 0
ex.Parent = l
ps:SetAsync(player.UserId, ex.Value)
ex.Changed:Connect(function()
ps:SetAsync(player.UserId, ex.Value)

local function onPlayerJoin(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
end
local coins = Instance.new(“IntValue”)
coins.Name = “Coins”
ex.Value = cs:GetAsync(player.UserId) or 0
ex.Parent = 1
coins.Value = 15
coins.Parent = leaderstats
cs:SetAsync(player.UserId, ex.Value)
ex.Changed:Connect(function()
cs:SetAsync(player.UserId, ex.Value)
l.Parent = player
end)

game.Players.PlayerAdded:Connect(onPlayerJoin)
It keeps saying expected end to close function at line 18 got but i’m stupid and can’t figure it out

I tried changing ends and doing other stuff but i’m stuck

“It keeps saying expected end to close function at line 18 got but i’m stupid and can’t figure it out”

This error basically means the script was expecting and end statement to close a function than began at line 18. Instead, there was nothing there or “got ”. To fix this add an end statement to close this function.

but now it’s asking for one at 6 but i dont see how i could put that in

At the bottom just add

end
end

Still getting the error what am i doing wrong

Could you show us a screenshot of your Output window please?

Those red errors are not related to the script. They are decals/ textures/ etc that failed to initially load. You script should do fine. Unless if you are noticing any issues.