-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMultiStratScript.lua
161 lines (161 loc) · 8.93 KB
/
MultiStratScript.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
spawn(function()
function prints(mess)
appendfile("TDS_AutoStrat/LastPrintLog.txt",tostring(mess).."\n")
print(tostring(mess))
end
local RS = game:WaitForChild('ReplicatedStorage')
local RSRF = RS:WaitForChild("RemoteFunction")
local RSRE = RS:WaitForChild("RemoteEvent")
function EquipTroop(troop)
if game.PlaceId ~= 5591597781 then
local args = {
[1] = "Inventory",
[2] = "Execute",
[3] = "Troops",
[4] = "Add",
[5] = {
["Name"] = tostring(troop)
}
}
game.ReplicatedStorage.RemoteEvent:FireServer(unpack(args))
end
end
function UnEquip()
for TowerName, Tower in next, game.ReplicatedStorage.RemoteFunction:InvokeServer("Session", "Search", "Inventory.Troops") do
if (Tower.Equipped) then
local args = {
[1] = "Inventory",
[2] = "Execute",
[3] = "Troops",
[4] = "Remove",
[5] = {
["Name"] = TowerName
}
}
game:GetService("ReplicatedStorage").RemoteEvent:FireServer(unpack(args))
end;
end;
end
if game.PlaceId == 5591597781 then
getgenv().map = game:GetService("ReplicatedStorage").State.Map.Value
else
spawn(function()
getgenv().timer = 0
while wait(1) do
getgenv().timer = getgenv().timer + 1
end
end)
getgenv().repeating = true
spawn(function()
while wait(1) do
if getgenv().repeating then
getgenv().repeating = false
local jc = true --Wait Mode
for _, Elevators in pairs(game:GetService('Workspace').Elevators:GetChildren()) do
local Name = Elevators.State.Map.Title
local plrs = Elevators.State.Players
local Modes = require(Elevators.Settings).Type
if getgenv().Maps[Name.Value] ~= nil and Modes == getgenv().Mode then
if (plrs.Value <= 0) then
jc = false -- Change to Joined Mode
prints("Join attempt...")
getgenv().status = "Joining..."
RSRF:InvokeServer("Elevators","Enter",Elevators)
UnEquip()
for i,v in next, getgenv().Maps[Name.Value] do
EquipTroop(v)
end
prints("Joined elavator...")
getgenv().status = "Joined"
while wait() do
getgenv().status = "Joined ("..Elevators.State.Timer.Value.."s)"
if Elevators.State.Timer.Value == 0 then
local s = true --Teleporting...
for c = 1,100 do --This Progress Will Leave Elevator If A Player is Joining In 0 Second
if (plrs.Value > 1) then
prints("Someone joined, leaving elevator...")
getgenv().status = "Someone joined..."
RSRF:InvokeServer("Elevators","Leave")
getgenv().repeating = true -- Reset Progress
s = false
break
end
wait(0.01)
end
if Elevators.State.Timer.Value == 0 and s then --Check Elevator Information
getgenv().status = "Teleporting..."
wait(60)
getgenv().status = "Teleport failed!"
RSRF:InvokeServer("Elevators","Leave")
else
getgenv().status = "Teleport failed! (Timer)"
RSRF:InvokeServer("Elevators","Leave")
getgenv().repeating = true -- Reset Progress
end
end
if getgenv().Maps[Name.Value] ~= nil then --This Progress Will Leave Elevator If A Player is Joining In
if getgenv().AntiMulti then
if (plrs.Value > 1) then
RSRF:InvokeServer("Elevators","Leave")
prints("Someone joined, leaving elevator...")
getgenv().status = "Someone joined..."
getgenv().repeating = true -- Reset Progress
break
elseif (plrs.Value == 0) then --Idk What is this maybe check player is in elevator?
wait(1)
if (plrs.Value == 0) then
wait(1)
if (plrs.Value == 0) then
wait(1)
if (plrs.Value == 0) then
wait(1)
if (plrs.Value == 0) then
prints("Error")
getgenv().status = "Error occured, check dev con"
prints("Error occured, please open ticket on Money Maker Development discord server!")
RSRF:InvokeServer("Elevators","Leave")
getgenv().repeating = true -- Reset Progress
break
end
end
end
end
end
end
else --Leave When Map Change Pretty Rare To Occur
RSRF:InvokeServer("Elevators","Leave")
prints("Map changed while joining, leaving...")
getgenv().status = "Map changed..."
getgenv().repeating = true
break
end
end
end
end
end
if jc == true then
getgenv().repeating = true
prints("Waiting for map...")
getgenv().status = "Waiting for map..."
if getgenv().timer >= 15 then -- Change Map After 15 sec
getgenv().status = "Force changing maps..."
getgenv().timer = 0
for i, v in pairs(game:GetService("Workspace").Elevators:GetChildren()) do
local plrs = v.State.Players
local Modes = require(v.Settings).Type
if plrs.Value <= 0 and Modes == getgenv().Mode then
RSRF:InvokeServer("Elevators","Enter",v)
wait(1)
RSRF:InvokeServer("Elevators","Leave")
end
end
wait(0.6)
RSRF:InvokeServer("Elevators","Leave")
wait(1)
end
end
end
end
end)
end
end)