Im trying to do a updateServers script , and it does run but with an exception , why? (RE-ASK)
Asked by
6 years ago Edited 6 years ago
Hello , i have been creating a script builder , i made two places one for waiting and another to give the info that the servers will update... The problem i have is that when i try to give the request it doesn't work
Code of the request of updates
02 | game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect( function (plr) |
03 | print ( "Received request." ) |
04 | local data = game:GetService( "DataStoreService" ) |
05 | local startUpdate = data:GetDataStore( "CENSORED" ) |
06 | startUpdate:UpdateAsync( "UPDTSRVS" , function (old) |
Code of the script that will action on update
02 | function MessageToScreen(msg,isperm,waitt) |
03 | local a = Instance.new( "Message" ) |
04 | a.Name = "ys27h872hs3gd7agd726ds8agwd972gdsga78wgd27d3" |
07 | if isperm = = false then |
12 | function UpdateServers(key) |
14 | MessageToScreen( "Servers Are Updating , Please wait..." , true , math.huge ) |
16 | for i,v in pairs (game:GetService( "Players" ):GetPlayers()) do |
17 | game:GetService( "TeleportService" ):Teleport( 838000617 ,v) |
20 | connection = startUpdate:OnUpdate( "UPDTSRVS" ,UpdateServers) |
I found out that this works , but when i join the game the connection runs , and i did not even change any value in DataStore.. Please help