-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdroptool.lua
More file actions
48 lines (43 loc) · 1.15 KB
/
droptool.lua
File metadata and controls
48 lines (43 loc) · 1.15 KB
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
local lp = game:service("Players").LocalPlayer
local rgui = game:service("CoreGui"):WaitForChild("RobloxGui")
if rgui:FindFirstChild("droptool") then
for _,v in rgui:GetChildren() do
if v.Name == "droptool" then
v:Destroy()
end
end
end
local btn = Instance.new("TextButton",rgui)
btn.Name = "droptool"
btn.AnchorPoint = Vector2.new(0.5,1)
btn.Position = UDim2.new(0.5,0,1,-68)
btn.Size = UDim2.new(0,60,0,20)
btn.BorderSizePixel = 0
btn.BackgroundColor3 = Color3.new(0,0,0)
btn.BackgroundTransparency = 2/3
btn.TextColor3 = Color3.new(1,1,1)
btn.Text = "Drop"
local conA = game:service("RunService").Heartbeat:Connect(function()
local char = lp.Character
if char then
local tool = char:FindFirstChildWhichIsA("Tool")
btn.Visible = tool and tool.CanBeDropped
end
end)
local conB = btn.MouseButton1Click:Connect(function()
local char = lp.Character
if char then
local tool = char:FindFirstChildWhichIsA("Tool")
if tool and tool.CanBeDropped then
for _,v in char:GetChildren() do
if v:IsA("Tool") then
v.Parent = workspace
end
end
end
end
end)
btn.Destroying:Once(function()
conA:Disconnect()conA=nil
conB:Disconnect()conB=nil
end)