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: Why won't this work?

Previous Thread :: Next Thread 
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:20 PM
function onXPChanged(player, XP, level)
if XP.Value>=level.Value * 80 then
XP.Value = XP.Value - level.Value * 5
level.Value = level.Value + 1
end
end

function onLevelUp(player, XP, level)
for i, player in pairs(game.Players:GetPlayers()) do
local m = Instance.new("ScreenGui", player.PlayerGui)
local c = Instance.new("TextLabel", m)
c.BackgroundTransparency = 1
c.TextTransparency = 0
c.TextColor3 = Color3.new(255/255,255/255,255/255)
c.Size = UDim2.new(0,1000,0,1050)
c.TextSize = "Size14"
c.Text = player.Name.." Has Leveled Up"
wait(5)
m:Destroy()
end
end
function onPlayerRespawned(player)
wait(5)
player.Character.Humanoid.Health = player.leaderstats.Level * 20 + 20
player.Character.Humanoid.MaxHealth = player.leaderstats.Level * 20 + 20
--[[
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 level = Instance.new("IntValue")
level.Name = "Lvl"
level.Value = 1

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

local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 50

level.Parent = stats
xp.Parent = stats
gold.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)
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:24 PM
Output.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:26 PM
I am unable to see output as the leaderboard doesn't work in roblox studio. Only in online mode.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:27 PM
Remote erroring script. Use it.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:35 PM
Text size is not a valid member of text label, Level is not a valid member of intvalue,
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:39 PM
function onXPChanged(player, XP, level)
if XP.Value>=level.Value * 80 then
XP.Value = XP.Value - level.Value * 5
level.Value = level.Value + 1
end
end

function onLevelUp(player, XP, level)
for i, player in pairs(game.Players:GetPlayers()) do
local m = Instance.new("ScreenGui", player.PlayerGui)
local c = Instance.new("TextLabel", m)
c.BackgroundTransparency = 1
c.TextTransparency = 0
c.TextColor3 = Color3.new(255/255,255/255,255/255)
c.Size = UDim2.new(0,1000,0,1050)
c.FontSize = "Size14"
c.Text = player.Name.." Has Leveled Up"
wait(5)
m:Destroy()
end
end
function onPlayerRespawned(player)
wait(5)
player.Character.Humanoid.Health = player.leaderstats.Level * 20 + 20
player.Character.Humanoid.MaxHealth = player.leaderstats.Level * 20 + 20
--[[
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 level = Instance.new("IntValue")
level.Name = "Lvl"
level.Value = 1

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

local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 50

level.Parent = stats
xp.Parent = stats
gold.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)

For the second error give me a line number.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:42 PM
It says 24 and 65
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:44 PM
function onXPChanged(player, XP, level)
if XP.Value>=level.Value * 80 then
XP.Value = XP.Value - level.Value * 5
level.Value = level.Value + 1
end
end

function onLevelUp(player, XP, level)
for i, player in pairs(game.Players:GetPlayers()) do
local m = Instance.new("ScreenGui", player.PlayerGui)
local c = Instance.new("TextLabel", m)
c.BackgroundTransparency = 1
c.TextTransparency = 0
c.TextColor3 = Color3.new(255/255,255/255,255/255)
c.Size = UDim2.new(0,1000,0,1050)
c.FontSize = "Size14"
c.Text = player.Name.." Has Leveled Up"
wait(5)
m:Destroy()
end
end
function onPlayerRespawned(player)
wait(5)
player.Character.Humanoid.Health = player.leaderstats.Level.Value * 20 + 20
player.Character.Humanoid.MaxHealth = player.leaderstats.Level.Value * 20 + 20
--[[
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 level = Instance.new("IntValue")
level.Name = "Lvl"
level.Value = 1

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

local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 50

level.Parent = stats
xp.Parent = stats
gold.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)
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:51 PM
It works but how to I make it in the center of the screen?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:52 PM
Get out, I am disappointed in myself due to the fact that I helped you.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:52 PM
Why?
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:53 PM
- I HATE free modelers. I am 100% against them.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:55 PM
Its one script.....I build my own games.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 07:57 PM
Don't care. If you want to benefit from scripts you should make them.
Report Abuse
Toughlizard1345 is not online. Toughlizard1345
Joined: 13 Jul 2010
Total Posts: 1077
04 Aug 2013 07:59 PM
I learn how to script from other peoples scripts.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
04 Aug 2013 08:01 PM
No. You asked me to fix every issue. Learning how to script with the latter would be using it to see what works and what doesn't, then branching off from there not what you're doing.
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