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 » Scripters
Home Search
 

Re: !@#$%

Previous Thread :: Next Thread 
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 07:41 PM
local ds = game:GetService("DataStoreService"):GetDataStore("Level")

game.Players.PlayerAdded:connect(function(plr)
local l = Instance.new("IntValue", plr)
l.Name = "leaderstats"
local lvl = Instance.new("IntValue",l)
lvl.Name = "Level"
local key = tostring(plr.userId).."_level"
local data = ds:GetAsync(key) or 0
lvl.Value = data
workspace.LevelTPer.Touched:wait()
return data.Value + 1
lvl.Value = data.Value -- ERROR HERE
end
end)

game.Players.PlayerRemoving:connect(function(plr)
local key = tostring(plr.userId).."_level"
local current = plr.leaderstats.Level
local data = ds:GetAsync(key)
if data then
ds:UpdateAsync(key,function(old) return current.Value; end)
else
ds:SetAsync(key,current.Value)
end
end)

what is wrong... also it says expected 'end' near 'function' in line 3, got 'lvl'

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
15 Jan 2015 07:45 PM
You are missing an end.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
15 Jan 2015 07:46 PM
function example()
return 1
lol = 5
end

example()
print(lol)

>> nil

The function ends at the return.

while wait() do
break
lol = 5
end
print(lol)

>> nil

The while loop ends at break.
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
15 Jan 2015 07:47 PM
replace the first part with this


game.Players.PlayerAdded:connect(function(plr)
local l = Instance.new("IntValue", plr)
l.Name = "leaderstats"
local lvl = Instance.new("IntValue",l)
lvl.Name = "Level"
local key = tostring(plr.userId).."_level"
local data = ds:GetAsync(key) or 0
lvl.Value = data
workspace.LevelTPer.Touched:wait()
return data.Value + 1
lvl.Value = data.Value
end)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 08:58 PM
ok thx

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 09:01 PM
@KOT
No, still same problem..

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
15 Jan 2015 09:04 PM
lvl.Value = data.Value -- ERROR HERE
end
end)

You have an extra end.
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
15 Jan 2015 09:04 PM
k, fixed; replace first part with this


local ds = game:GetService("DataStoreService"):GetDataStore("Level")

game.Players.PlayerAdded:connect(function(plr)
local l = Instance.new("IntValue", plr)
l.Name = "leaderstats"
local lvl = Instance.new("IntValue",l)
lvl.Name = "Level"
local key = tostring(plr.userId).."_level"
local data = ds:GetAsync(key) or 0
lvl.Value = data
workspace.LevelTPer.Touched:wait()
data.Value = data.Value + 1
lvl.Value = data.Value -- ERROR HERE
end)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 09:05 PM
thank you

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
morash is not online. morash
Joined: 22 May 2010
Total Posts: 5834
15 Jan 2015 09:07 PM
This wouldn't be to hard to locate and fix if you tabbed your scripts in the traditional ROBLOX way.

function cat()
(tab)return 6
end

if cat == 6 then
(tab)print("I like cats")
end
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
15 Jan 2015 09:31 PM
the biggest problem was this:

"return data.Value + 1
lvl.Value = data.Value -- ERROR HERE"


notice the return
lol
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jan 2015 10:01 PM
@cody

'function example()
return 1
lol = 5
end
'

Actually that would error
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
15 Jan 2015 10:08 PM
@128GB No, it wouldn't. Are you thinking of a different language perhaps?
Report Abuse
LucasLua is not online. LucasLua
Joined: 18 Jun 2008
Total Posts: 7386
15 Jan 2015 10:09 PM
Oh, I see that it does now. That's strange.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jan 2015 10:24 PM
You can't do anything after returning besides ending something (Like an if statement)


(At least that I know of there is nothing else you can do)
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
15 Jan 2015 10:25 PM
And I mean directly after, if you end a statement you can keep doing other stuff

Like

function a()
if (false) then
return nil;
end
return 1;
end

print(a()) -->1

(I did if false because if I did true it would have returned nil and ended)
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 11:28 PM
so i cant use return???

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 11:38 PM
bump bump bump

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 11:48 PM
print(1*10^2*90+1 .."th bump")

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
15 Jan 2015 11:56 PM
PLEASE READ THIS

-{cpmoderator12345}- ||:Conquerer of Role-Playing forum:|| ||:average scripter:||
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
16 Jan 2015 03:02 AM
cody you are using global vars as well, meaning they would be defined outside.

OP you have an extra end for some reason, remove the "end" BEFORE the "end)" and put the return statement after the lvl.Value = lbah
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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