generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Leaderboard problems?

Previous Thread :: Next Thread 
squerpooo is not online. squerpooo
Joined: 18 Feb 2011
Total Posts: 2356
17 Feb 2013 12:17 PM
Minigame leaderboard not functioning right. When I win, gives me 250 cash, 1 win, but 1 fail also, which I dont want. Fix maybe?




local light = game.Lighting
local work = game.Workspace

game.Players.PlayerAdded:connect(function(play)
wait()
local leaderstats = Instance.new("IntValue",play)
leaderstats.Name = "leaderstats"
local cash = Instance.new("IntValue",leaderstats)
cash.Name = "Cash"
cash.Value = 0
local wins = Instance.new("IntValue",leaderstats)
wins.Name = "Wins"
wins.Value = 0
local deaths = Instance.new("IntValue",leaderstats)
deaths.Name = "Deaths"
deaths.Value = 0
local fails = Instance.new("IntValue",leaderstats)
fails.Name = "Fails"
fails.Value = 0
play.CharacterAdded:connect(function()
if play:findFirstChild("leaderstats") then
if play:findFirstChild("bool") then
if play.bool.Value == true then
play.bool.Value = false
play.leaderstats.Deaths.Value = play.leaderstats.Death.Value +1
end
end
play.leaderstats.Deaths.Value = play.leaderstats.Deaths.Value +1
play.bool.Value = false
end
end)
end)

while true do
wait(35)
local plyr = game.Players:GetPlayers()
for i = 1, #plyr do
local bool = Instance.new("BoolValue",plyr[i])
bool.Name = "bool"
msg = Instance.new("Message",game.Workspace)
m = math.random(1,1)
if m == 1 then
wait(1)
msg.Text = "Selecting upcoming Game"
wait(1)
msg.Text = "Selecting upcoming Game."
wait(1)
msg.Text = "Selecting upcoming Game.."
wait(1)
msg.Text = "Selecting upcoming Game..."
wait(1)
msg.Text = "Selecting upcoming Game"
wait(1)
msg.Text = "Selecting upcoming Game."
wait(1)
msg.Text = "Selecting upcoming Game.."
wait(1)
msg.Text = "Selecting upcoming Game..."
wait(1)
msg.Text = "Game selected is:"
wait(2)
msg.Text = "Game selected is: Part Hop!"
wait(2)
msg.Text = "Hop on the blocks to the end."
wait(3)
light["Part Hop"].Parent = work
plyr[i].Character.Humanoid.WalkSpeed = 0
plyr[i].Character.Torso.CFrame = CFrame.new(Vector3.new(3, 203.5, -45))
msg.Text = "3...."
wait(1)
msg.Text = "2..."
wait(1)
msg.Text = "1.."
wait(1)
msg.Text = "GO!"
plyr[i].Character.Humanoid.WalkSpeed = 16
bool.Value = true
wait(1)
msg.Parent = nil
wait(20)
work["Part Hop"].Parent = light
if bool.Value == true then
wait(2)
bool.Value = false
plyr[i].Character.Torso.CFrame = CFrame.new(Vector3.new(0,203.5,0))
plyr[i].leaderstats.Cash.Value = plyr[i].leaderstats.Cash.Value +250
plyr[i].leaderstats.Wins.Value = plyr[i].leaderstats.Wins.Value +1
end
if bool.Value == false then
plyr[i].leaderstats.Fails.Value = plyr[i].leaderstats.Fails.Value +1
end
end
end
end
Report Abuse
Usering is not online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
17 Feb 2013 12:28 PM
local light = game.Lighting
local work = game.Workspace
coroutine.resume(coroutine.create(function()
game.Players.PlayerAdded:connect(function(play)
wait()
local leaderstats = Instance.new("IntValue",play)
leaderstats.Name = "leaderstats"
local cash = Instance.new("IntValue",leaderstats)
cash.Name = "Cash"
cash.Value = 0
local wins = Instance.new("IntValue",leaderstats)
wins.Name = "Wins"
wins.Value = 0
local deaths = Instance.new("IntValue",leaderstats)
deaths.Name = "Deaths"
deaths.Value = 0
local fails = Instance.new("IntValue",leaderstats)
fails.Name = "Fails"
fails.Value = 0
play.CharacterAdded:connect(function()
if play:findFirstChild("leaderstats") then
if play:findFirstChild("bool") then
if play.bool.Value == true then
play.bool.Value = false
play.leaderstats.Deaths.Value = play.leaderstats.Death.Value +1
end
end
play.leaderstats.Deaths.Value = play.leaderstats.Deaths.Value +1
play.bool.Value = false
end
end)
end)end))

while true do
wait(35)
local plyr = game.Players:GetPlayers()
for i = 1, #plyr do
local bool = Instance.new("BoolValue",plyr[i])
bool.Name = "bool"
msg = Instance.new("Message",game.Workspace)
m = math.random(1,1)
if m == 1 then
wait(1)
msg.Text = "Selecting upcoming Game"
wait(1)
msg.Text = "Selecting upcoming Game."
wait(1)
msg.Text = "Selecting upcoming Game.."
wait(1)
msg.Text = "Selecting upcoming Game..."
wait(1)
msg.Text = "Selecting upcoming Game"
wait(1)
msg.Text = "Selecting upcoming Game."
wait(1)
msg.Text = "Selecting upcoming Game.."
wait(1)
msg.Text = "Selecting upcoming Game..."
wait(1)
msg.Text = "Game selected is:"
wait(2)
msg.Text = "Game selected is: Part Hop!"
wait(2)
msg.Text = "Hop on the blocks to the end."
wait(3)
light["Part Hop"].Parent = work
plyr[i].Character.Humanoid.WalkSpeed = 0
plyr[i].Character.Torso.CFrame = CFrame.new(Vector3.new(3, 203.5, -45))
msg.Text = "3...."
wait(1)
msg.Text = "2..."
wait(1)
msg.Text = "1.."
wait(1)
msg.Text = "GO!"
plyr[i].Character.Humanoid.WalkSpeed = 16
bool.Value = true
wait(1)
msg.Parent = nil
wait(20)
work["Part Hop"].Parent = light
if bool.Value == true then
wait(2)
bool.Value = false
plyr[i].Character.Torso.CFrame = CFrame.new(Vector3.new(0,203.5,0))
plyr[i].leaderstats.Cash.Value = plyr[i].leaderstats.Cash.Value +250
plyr[i].leaderstats.Wins.Value = plyr[i].leaderstats.Wins.Value +1
end
if bool.Value == false then
plyr[i].leaderstats.Fails.Value = plyr[i].leaderstats.Fails.Value +1
end
end
end
end

[[ Usering ]]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image