You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I’m trying to make a coin that you can collect in my game but it’s not seeming to work
-
What is the issue? when I walk up to it I cant collect it and it’s supposed to put up on the leaderboard that I collected it also it’s supposed to disappear and come back after an amount of time but that’s not working either
-
**What solutions have you tried so far? i tried following the tutorial again but every thing was correct
Lua
– local coins = Instance.new(“IntValue”,leaderboard)
coins.Name = “Coins”
coins.Value = 25
local recived, failed pcall(function()
data = dataStore:GetAsync("User-"..player.UserId)
end)
if recived then
coins.Value = data[1]
print("Data was recived")
else
print("Data was recived")
end
while true do wait(30)
dataStore:SetAsync("User-"..player.UserId,{Coins.Value})
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local leaderboard = player
local coins = leaderboard.Coins
local saved,failed = pcall(function()
dataStore:SetAsync()("User-"..player.UserId,(coins.Value))
end)
if saved then
print("Data was saved")
else
print("Data was not saved")
end
thats my leaderboard script
-- local coinPart = script.Parent
local toggle = false
local amount = 100000
coinPart.Touched:Connect(function(hit)
if hit.parent:FindFirstChild("Humaniod") ~= nil and not toggle then
toggle = true
local player = game.Players:GetPlayerFromCharacter(hit.parent)
local leaderboard = player:FindFirstChild("Leaderboard")
local coins = leaderboard.Coins
coins.Value = coins.Value+ amount
local coinClone = coinPart:Clone()
coinPart:Destroy()
wait(30)
coinClone.Parent = workspace
toggle = false
end
end)
and thats my collect script