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

Data Store Question/Problem????

Asked by 10 years ago

Line 5 issue

01local id1 = 19453079
02local id2 = 20607058
03plr = script.Parent.Parent.Parent
04local aree = os.time
05script.Parent.f.b.MouseButton1Click:connect(function()
06g = game:GetService("MarketplaceService")
07g:PromptProductPurchase(plr, id1)
08end)
09 
10script.Parent.f.ar.MouseButton1Click:connect(function()
11DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer)
12local a=DataStore:GetAsync("user_"..plr.userId)
13if a then
14if a >= aree then
15for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end
View all 28 lines...
0
~~~~~~~~~~~~~~~~ I used that to identify the line... micke3212 35 — 10y

3 answers

Log in to vote
0
Answered by 10 years ago
01local id1 = 19453079 -- yep. mistake people always do...
02local id2 = 20607058 -- once again, the mistake happens!
03-- well, let me fix this two.
04plr = script.Parent.Parent.Parent
05local aree = os.time
06script.Parent.f.b.MouseButton1Click:connect(function()
07g = game:GetService("MarketplaceService")
08g:PromptProductPurchase(plr, idone)
09end)
10 
11script.Parent.f.ar.MouseButton1Click:connect(function()
12DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer)
13local a=DataStore:GetAsync("user_"..plr.userId)
14if a then
15if a >= aree then
View all 29 lines...

This is the fixed version i've made:

01local idone = 19453079
02local idtwo = 20607058
03plr = script.Parent.Parent.Parent
04local aree = os.time()
05function itWasClickedOMG()
06g = game:GetService("MarketplaceService")
07g:PromptProductPurchase(plr, idone)
08end
09 
10script.Parent.f.ar.MouseButton1Click:connect(function()
11DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer)
12local a=DataStore:GetAsync("user_"..plr.userId)
13if a then
14if tonumber(a.keyvalue) >= tonumber(aree) then
15for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end
View all 30 lines...

Hope this helped! Thanks, marcoantoniosantos3

0
Just stated 5 minutes ago ~~~~~~~~~~~~~~~~ to identify the problem to make it easier to see. micke3212 35 — 10y
0
-.- Look, tell us where is aree variable defined at. marcoantoniosantos3 200 — 10y
0
aree is os.time micke3212 35 — 10y
0
tell us the line... marcoantoniosantos3 200 — 10y
View all comments (8 more)
0
Updated question micke3212 35 — 10y
0
send us full script, so we know where os comes from marcoantoniosantos3 200 — 10y
1
okay, let me see if i can fix it marcoantoniosantos3 200 — 10y
0
Ok, it's a TextButton f is a frame. micke3212 35 — 10y
0
ohhh, this is a Gui. Okay marcoantoniosantos3 200 — 10y
0
Try now, it should work, if it doesn't, tell me the whole output line marcoantoniosantos3 200 — 10y
0
Try the newest version. it should work marcoantoniosantos3 200 — 10y
0
By the way, marco, `os` is defined by the Lua library the ROBLOX engine uses. It is automatically defined in every script, although we in ROBLOX can only use one of its members, the time method. adark 5487 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Output: Attempt to compare function with number :17

01local idone = 19453079
02local idtwo = 20607058
03plr = script.Parent.Parent.Parent
04local aree = os.time
05 
06 
07function one()
08g = game:GetService("MarketplaceService")
09g:PromptProductPurchase(plr, idone)
10end
11script.Parent.f.b.MouseButton1Click:connect(one)
12 
13function two()
14DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer)
15local a=DataStore:GetAsync("user_"..plr.userId)
View all 33 lines...
1
Hows it looking? micke3212 35 — 10y
Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
10 years ago

I don't know why the other two answers changed it, but there is absolutely nothing wrong with naming a variable id1 or id2. As long as either an underscore ( '_' ) or english letter starts the variable name, numbers can be freely used.

You problem is that os.time needs to be os.time(), as you are trying to invoke the time method, not access the function itself.

Answer this question