Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Badge Award, get money what does i wrong?

Asked by 10 years ago

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

Log in to vote
0
Answered by 10 years ago
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.
0
look my new answer thanks minetrackmania 186 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

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.
0
Look at the event. "PlayerAdded". So It's only going to happen once... fahmisack123 385 — 10y
0
Yes if "player touched badge they get the candys and the badge one time" minetrackmania 186 — 10y

Answer this question