-
Notifications
You must be signed in to change notification settings - Fork 0
/
1758401491_Public-Bathroom-Simulator.lua
43 lines (37 loc) · 1.37 KB
/
1758401491_Public-Bathroom-Simulator.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
local _wait = task.wait -- defining task wait
local ins = table.insert -- defining table insert
--local whitelist = {} -- tools that will not be effected by the script
local trash = {} -- this will cache our item we want to drop
local cons = {}
local player = game:GetService('Players').LocalPlayer
local character = player.Character -- less indexing
local click = game:GetService('Workspace')['Trash can'].Trash.Can.ClickDetector -- less indexing
ins(cons, workspace.ChildAdded:Connect(function(tool)
if tool:IsA('Tool') then --:IsA('ClassName')
_wait() -- you have to wait before putting something to nil if you connect with a Added signal
tool:Destroy()
end
end))
ins(cons, player.Backpack.ChildAdded:Connect(function(tool)
if tool.Name == 'TrashCola' then
ins(trash, tool)
_wait()
tool.Parent = character
end
end))
ins(cons, character['Right Arm'].ChildAdded:Connect(function(grip) -- this will drop the item since this is the weld for the tool to your hand
if grip:IsA('Weld') then
_wait()
grip:Destroy()
end
end))
for i = 1, 500 do
fireclickdetector(click)
end
repeat wait()print(#trash) until #trash==500
for i, v in next, trash do --next() is faster than pairs if you are iterating a table for an object
v.Parent = character
_wait()
v.Parent = workspace
end
-- add trigger to run :Disconnect() on all of the signals in cons table to disable