So, i'm wondering how to make it, well you know in the title. Basically someone clicks a shell and the shell gets deleted so it acts like it got collected.
This is the click to delete script.
function onClicked() script.Parent:remove() end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Below is the badge script. How can i make it award at 10 items?
print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value) -- ROBLOX scripter hackers, see what you can do with this: -- game:GetService("BadgeService"):UserHasBadge(userid, badgeid) function OnTouch(part) if (part.Parent:FindFirstChild("Humanoid") ~= nil) then local p = game.Players:GetPlayerFromCharacter(part.Parent) if (p ~= nil) then print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId) local b = game:GetService("BadgeService") b:AwardBadge(p.userId, script.Parent.BadgeID.Value) end end end script.Parent.Touched:connect(OnTouch)
Also i just signed up.
Alright so im doing this in the editor but this should work ok. When you click the shell or whatever it adds 1 to the int value, wherever that ends up. Once you have 10 the badge script will award it once, then once its awarded the nobadge variable should stop it from continuing to try to.
"Click to delete" script.
local db = false local Collected = -- you'll need to add in an IntValue somewhere, if you have a leaderstats script you can use that to add the "Collected" value to the player then reference it here function onClicked() if not db then -- I added a DB but may not be needed, but just in case. db = true Collected.Value = Collected.Value + 1 -- we add 1 to value script.Parent:remove() wait(.25) db = false end end script.Parent.ClickDetector.MouseClick:Connect(onClicked)
local Collected = -- again reference that int value we're making local nobadge = true Collected.Changed:Connect(function(player) if Collected.Value >= 10 and nobadge then nobadge = false print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. player.userId) local b = game:GetService("BadgeService") b:AwardBadge(player.userId, script.Parent.BadgeID.Value) end end)