Can anyone tell me what I'm doing wrong because i copied exactly what
a youtuber showed on his video and it worked for him
local db = true script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db == true then db = false script.Parent.Transparency = 1 local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Coins.Value = player.leaderstats.Value +1 script.Sound:Play() wait (1) script.Parent:Remove() end end end)
i did the leaderboard correctly and this so im confused
Well, you did everything correctly except line 08
player.leaderstats.Coins.Value = player.leaderstats.Value +1
first part was correct but second you missed out Coins
Oh and one final thing, connect
and Remove()
are Deprecated meaning roblox will remove them anytime and might not be able to be used in the future. So instead of using them, use Connect
and Destroy()
instead!
So the finished code would be:
local db = true script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then if db == true then db = false script.Parent.Transparency = 1 local player = game.Players:GetPlayerFromCharacter(hit.Parent) player.leaderstats.Coins.Value = player.leaderstats.Coins.Value +1 script.Sound:Play() wait (1) script.Parent:Destroy() end end end)
player.leaderstats.Coins.Value = player.leaderstats.Value +1 you forgot the coins in the other side so u have to do player.leaderstats.Coins.Value = player.leaderstats.Coins.Value+1
Closed as Not Constructive by hiimgoodpack and maumaumaumaumaumua
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?