I'm trying to make a automatic shutdown when every there is a new version and this is the error I'm getting:
Stack Begin Workspace.Script:8: attempt to preform arithmetic on local 'len' (a string value) 'Workspace.Script', Line 8 - global Getversion 'Workspace.Script', Line 12 Stack End
Does anyone have any idea on what's going on??
mps = game:GetService('MarketplaceService')
_Version = nil
function GetVersion()
local str = mps:GetProductInfo(game.PlaceId).Description
print(str)
local len = tostring(str:find('_Version'))
return str.sub(len, len+5)
end
while wait(120) do
local new w= GetVersion()
if _Version then
if _Version ~= new then
local msg = Instance.new('Message', workspace)
for i = 60,1 do
msg.Text = 'The game is shutting down for an update in: ['..i..']'
end
while wait() do
for i,v in pairs(game.Players:GetChildren()) do
if v:IsA'Player' then
v:Kick()
end
end
end
end
end
_Version = new
end
