Line 5 issue
local id1 = 19453079 local id2 = 20607058 plr = script.Parent.Parent.Parent local aree = os.time script.Parent.f.b.MouseButton1Click:connect(function() g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, id1) end) script.Parent.f.ar.MouseButton1Click:connect(function() DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer) local a=DataStore:GetAsync("user_"..plr.userId) if a then if a >= aree then for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end local pitch = 1 local id = script.Parent.f.ss local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" .. id.Value s.Volume = 1 s.Pitch = pitch s.Looped = true s.archivable = false repeat s:Play() wait(2.5) s:Stop() wait(.5) s:Play() until s.IsPlaying elseif a <= aree then g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, id2) end else DataStore:SetAsync("user_"..plr.userId, 0) g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, id2) end end)
local id1 = 19453079 -- yep. mistake people always do... local id2 = 20607058 -- once again, the mistake happens! -- well, let me fix this two. plr = script.Parent.Parent.Parent local aree = os.time script.Parent.f.b.MouseButton1Click:connect(function() g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idone) end) script.Parent.f.ar.MouseButton1Click:connect(function() DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer) local a=DataStore:GetAsync("user_"..plr.userId) if a then if a >= aree then for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end local pitch = 1 local id = script.Parent.f.ss local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" .. id.Value s.Volume = 1 s.Pitch = pitch s.Looped = true s.archivable = false repeat s:Play() wait(2.5) s:Stop() wait(.5) s:Play() until s.IsPlaying elseif a <= aree then g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, id2) end else DataStore:SetAsync("user_"..plr.userId, 0) g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, id2) end end)
This is the fixed version i've made:
local idone = 19453079 local idtwo = 20607058 plr = script.Parent.Parent.Parent local aree = os.time() function itWasClickedOMG() g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idone) end script.Parent.f.ar.MouseButton1Click:connect(function() DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer) local a=DataStore:GetAsync("user_"..plr.userId) if a then if tonumber(a.keyvalue) >= tonumber(aree) then for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end local pitch = 1 local id = script.Parent.f.ss local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" .. id.Value s.Volume = 1 s.Pitch = pitch s.Looped = true s.archivable = false repeat s:Play() wait(2.5) s:Stop() wait(.5) s:Play() until s.IsPlaying elseif a <= aree then g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idtwo) end else DataStore:SetAsync("user_"..plr.userId, 0) g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idtwo) end end) script.Parent.f.b.MouseButton1Click:connect(itWasClickedOMG)
Hope this helped! Thanks, marcoantoniosantos3
Output: Attempt to compare function with number :17
local idone = 19453079 local idtwo = 20607058 plr = script.Parent.Parent.Parent local aree = os.time function one() g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idone) end script.Parent.f.b.MouseButton1Click:connect(one) function two() DataStore = game:GetService("DataStoreService"):GetGlobalDataStore(shoplistaer) local a=DataStore:GetAsync("user_"..plr.userId) if a then if a >= aree then for i, v in pairs(game.Workspace:GetChildren()) do if v:IsA("Sound") then v:Destroy() end end local pitch = 1 local id = script.Parent.f.ss local s = Instance.new("Sound", game.Workspace) s.SoundId = "http://www.roblox.com/asset/?id=" .. id.Value s.Volume = 1 s.Pitch = pitch s.Looped = true s.archivable = false repeat s:Play() wait(2.5) s:Stop() wait(.5) s:Play() until s.IsPlaying elseif a <= aree then g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idtwo) end else DataStore:SetAsync("user_"..plr.userId, 0) g = game:GetService("MarketplaceService") g:PromptProductPurchase(plr, idtwo) end end script.Parent.f.ar.MouseButton1Click:connect(two)
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.