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: Fail leaderboard script

Previous Thread :: Next Thread 
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
05 Nov 2011 03:57 PM
function onXPChanged(player, XP, level)
if XP.Value>=level.Value * 10 then
XP.Value = XP.Value - level.Value * 30
level.Value = level.Value + 1
hunger.Value = level.Value * 10
end
end

function onLevelUp(player, XP, level)
if player.Character~=nil then
for i = 1,5 do
local fireworks = Instance.new("Part")
fireworks.Shape = 0
fireworks.formFactor = "Symmetric"
fireworks.Size = Vector3.new(1,1,1)
fireworks.BrickColor = BrickColor.Random()
fireworks.CFrame = player.Character.Head.CFrame + Vector3.new(0,2,0)
fireworks.Parent = game.Workspace
game:GetService("Debris"):AddItem(fireworks, 2)
fireworks.Velocity = Vector3.new(math.random(-30,30),math.random(-30,30),math.random(-30,30))
end
end
local m = Instance.new("Hint")
m.Parent = game.Workspace
m.Text = player.Name .. " has leveled up!"
wait(3)
m.Parent = nil
end

function onPlayerRespawned(player)
wait(5)
player.Character.Humanoid.Health = player.leaderstats.Level * 50
player.Character.Humanoid.MaxHealth = player.leaderstats.Level * 50
hunger.Value = level.Value * 10
--[[
local stuff = player.Backpack:GetChildren()
wait(5)
for i = 1,#stuff do
local name = stuff[i].Name
if game.Starterpack:findFirstChild(name)==nil then
stuff[i]:Clone().Parent = player.Backpack
end
end
--]]
end

function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"

local xp = Instance.new("IntValue")
xp.Name = "XP"
xp.Value = 0

local level = Instance.new("IntValue")
level.Name = "Lvl"
level.Value = 1

local c = Instance.new("IntValue")
c.Name = "Gold"
c.Value = 150

local hunger = Instance.new("Intvalue")
hunger.Name = hunger
hunger.Value = level.Value * 10

xp.Parent = stats
level.Parent = stats
c.Parent = stats
hunger.Parent = stats

stats.Parent = newPlayer

xp.Changed:connect(function() onXPChanged(newPlayer, xp, level) end)
level.Changed:connect(function() onLevelUp(newPlayer, xp, level) end)

newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end

game.Players.ChildAdded:connect(onPlayerEntered)

theres no output
sorry its so long
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 01:25 AM
bump
Report Abuse
cooldude816 is not online. cooldude816
Joined: 03 Jan 2009
Total Posts: 27759
06 Nov 2011 01:59 AM
How's it fail?
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 02:59 AM
it doesn't work?
Report Abuse
Lightmaster9 is not online. Lightmaster9
Joined: 14 May 2009
Total Posts: 8659
06 Nov 2011 06:53 AM
Looks like it's free modeled. I don't blame you if you tried using a RPG script from the free models though.
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
06 Nov 2011 07:04 AM
Did you try it on-line? Leaderboards sometimes doesn't work on solo.
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 09:30 AM
@lightmaster, it started as a free model but iv'e edited it loads

@ejorge, no it doesnt work on on-line mode, but good idea
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 01:08 PM
bump
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 01:51 PM
please help
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
06 Nov 2011 03:02 PM
badump
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
07 Nov 2011 01:13 PM
whats wrong with this
Report Abuse
Lightmaster9 is not online. Lightmaster9
Joined: 14 May 2009
Total Posts: 8659
07 Nov 2011 01:59 PM
Add this at the very bottom of the script:

for i, v in pairs(game.Players:GetChildren()) do
onPlayerEntered(v)
end
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
08 Nov 2011 12:44 PM
I tried that but it didnt work
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
09 Nov 2011 10:32 AM
bumpedy bump bump
Report Abuse
pokelord910 is not online. pokelord910
Joined: 26 May 2009
Total Posts: 1045
09 Nov 2011 11:59 AM
nvm im gonna rewrite it myself

ill let this thread die now
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