I have the script for it to work but i dont no how to set up the shop for it to use up the coins
the problem is that none of them work for me
In what way? Give more context and post an actual script.
this is my script
local DSS = game:GetService(“DataStoreService”)
local DS = DSS:GetDataStore(“IReallyLikeMoney”)
game.Players.PlayerAdded:Connect(function(player)
local folder = Instance.new(“Folder”,player)
folder.Name = “leaderstats”
local currency1 = Instance.new(“IntValue”)
currency1.Name = “Money”
currency1.Parent = folder
currency1.Value = DS:GetAsync(player.UserId) or 0
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
local tag = character.Humanoid:FindFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
currency1.Value = currency1.Value + 10
end
end
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
DS:SetAsync(player.UserId, player.leaderstats.Money.Value)
end)
game:BindToClose(function()
for _,v in pairs(game.Players:GetPlayers())do
DS:SetAsync(v.UserId, v.leaderstats.Money.Value)
end
end)
Can you just not do if tag and tag.Value ~= nil then
?
Actually though, what do you really want to achieve here? I’m confused
I have a strong feeling that you haven’t looked at any tutorial for this and just want someone to do it for you.
Here’s a basic rundown of how it would need to work.
From what I see is you want to have people buy coins from a shop.
Since the shop is a GUI on the Local Client, you will need to use Remote Events to connect it to a Script in ServerScriptService.
In the local script you prompt the purchase then when the purchase is successful you send a signal to the Event. The server will catch it and add the credits to the player’s leaderstats.
There are plenty of tutorials on YouTube that work. I’m 100% certain you can find one that works.
yes you are right as he made a post previously and someone had to make him the datastore