Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Badge Award, get money what does i wrong?

I made a script for "If you award a badge you will get + "100" Cash or money what you leaderboard says' Here is the script i hope you can help me :)

local BadgeID = 181292972 -- Badge ID

game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Candy" -- Loaderboard stats
money.Value = 0 
while true do
	wait() local b = game:GetService("BadgeService")
	b:AwardBadge (p.userId, script.BadgeID.Value) 
	money.Value = money.Value + 100 --How much
end

2 answers

✓ Accepted answer
local BadgeID = 181292972 -- Badge ID

game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Candy" -- Loaderboard stats
money.Value = 0 
--while true do --Are you sure you want to give him an infinite amount of badges and Candy???
    wait() local b = game:GetService("BadgeService")
    b:AwardBadge (p.userId, BadgeID) --BadgeID, not script.BadgeID.Value Nice try though.
    money.Value = money.Value + 100 --How much
--end --Ends the mysterious infinite loop.

1 comment

0

look my new answer thanks

Its need if you award a badge you will get cash = candy Like: You found a badge you touch the badge and you award the badge and you get 100 cash or something thats was my plan: Is this than corret what you mean?

local BadgeID = 181292972 -- Badge ID

game.Players.PlayerAdded:connect(function(p)
local stats = Instance.new("IntValue", p)
stats.Name = "leaderstats"
local money = Instance.new("IntValue", stats)
money.Name = "Candy" -- Loaderboard stats
money.Value = 100 
while true do --Are you sure you want to give him an infinite amount of badges and Candy???
    wait() local b = game:GetService("BadgeService")
    b:AwardBadge (p.userId, BadgeID) --BadgeID, not script.BadgeID.Value Nice try though.
    money.Value = money.Value + 100 --How much
end --Ends the mysterious infinite loop.

2 comments

0

Look at the event. "PlayerAdded". So It's only going to happen once...

0

Yes if "player touched badge they get the candys and the badge one time"

This discussion is preserved as it was. New answers, comments, and votes are closed.