Skip to content

Commit 830fa79

Browse files
author
AUTOr986
authored
Add AUTO👾 Dance GUI with animation controls
This script creates a dance GUI for players, allowing them to play and stop a dance animation, as well as toggle an anti-AFK feature. It includes UI elements and functionality for user interaction.
1 parent 0d2c9de commit 830fa79

File tree

1 file changed

+196
-0
lines changed

1 file changed

+196
-0
lines changed

AUTO👾

Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
-- AUTO👾 Dance GUI (LocalScript)
2+
-- วางไฟล์นี้เป็น LocalScript ใต้ StarterGui
3+
4+
local Players = game:GetService("Players")
5+
local TweenService = game:GetService("TweenService")
6+
local VirtualUser = game:GetService("VirtualUser")
7+
8+
local player = Players.LocalPlayer
9+
10+
-- Animation ID ตามที่ขอ
11+
local ANIM_ID = "rbxassetid://104767795538635"
12+
13+
-- สร้าง GUI programmatically
14+
local screenGui = Instance.new("ScreenGui")
15+
screenGui.Name = "AUTO👾"
16+
screenGui.ResetOnSpawn = false
17+
screenGui.Parent = player:WaitForChild("PlayerGui")
18+
19+
local mainFrame = Instance.new("Frame")
20+
mainFrame.Name = "Main"
21+
mainFrame.Size = UDim2.new(0, 300, 0, 140)
22+
mainFrame.Position = UDim2.new(0, 20, 0, 80)
23+
mainFrame.AnchorPoint = Vector2.new(0, 0)
24+
mainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
25+
mainFrame.BackgroundTransparency = 0
26+
mainFrame.BorderSizePixel = 0
27+
mainFrame.Parent = screenGui
28+
29+
local uiCorner = Instance.new("UICorner", mainFrame)
30+
uiCorner.CornerRadius = UDim.new(0, 12)
31+
32+
local gradient = Instance.new("UIGradient", mainFrame)
33+
gradient.Color = ColorSequence.new{
34+
ColorSequenceKeypoint.new(0, Color3.fromRGB(30,30,45)),
35+
ColorSequenceKeypoint.new(1, Color3.fromRGB(18,18,28))
36+
}
37+
gradient.Rotation = 90
38+
39+
local title = Instance.new("TextLabel", mainFrame)
40+
title.Size = UDim2.new(1, -24, 0, 36)
41+
title.Position = UDim2.new(0, 12, 0, 8)
42+
title.BackgroundTransparency = 1
43+
title.Text = "AUTO👾"
44+
title.TextColor3 = Color3.fromRGB(200,200,255)
45+
title.Font = Enum.Font.GothamBold
46+
title.TextSize = 20
47+
title.TextXAlignment = Enum.TextXAlignment.Left
48+
49+
local openCloseBtn = Instance.new("TextButton", mainFrame)
50+
openCloseBtn.Name = "OpenClose"
51+
openCloseBtn.Size = UDim2.new(0, 36, 0, 36)
52+
openCloseBtn.Position = UDim2.new(1, -48, 0, 8)
53+
openCloseBtn.BackgroundColor3 = Color3.fromRGB(40,40,60)
54+
openCloseBtn.AutoButtonColor = true
55+
openCloseBtn.Text = "▤"
56+
openCloseBtn.TextColor3 = Color3.fromRGB(220,220,255)
57+
openCloseBtn.Font = Enum.Font.GothamMedium
58+
openCloseBtn.TextSize = 20
59+
local ocCorner = Instance.new("UICorner", openCloseBtn)
60+
ocCorner.CornerRadius = UDim.new(0,8)
61+
62+
-- Container for controls (so we can hide/show nicely)
63+
local controls = Instance.new("Frame", mainFrame)
64+
controls.Name = "Controls"
65+
controls.Size = UDim2.new(1, -24, 1, -56)
66+
controls.Position = UDim2.new(0, 12, 0, 48)
67+
controls.BackgroundTransparency = 1
68+
69+
local function makeButton(name, posY, text)
70+
local btn = Instance.new("TextButton", controls)
71+
btn.Name = name
72+
btn.Size = UDim2.new(1, 0, 0, 36)
73+
btn.Position = UDim2.new(0, 0, 0, posY)
74+
btn.BackgroundColor3 = Color3.fromRGB(50,50,70)
75+
btn.Text = text
76+
btn.TextColor3 = Color3.fromRGB(235,235,255)
77+
btn.Font = Enum.Font.Gotham
78+
btn.TextSize = 16
79+
local c = Instance.new("UICorner", btn)
80+
c.CornerRadius = UDim.new(0,10)
81+
local stroke = Instance.new("UIStroke", btn)
82+
stroke.Color = Color3.fromRGB(80,80,110)
83+
stroke.Transparency = 0.6
84+
return btn
85+
end
86+
87+
local playBtn = makeButton("PlayDance", 0, "เล่นท่าเต้น")
88+
local stopBtn = makeButton("StopDance", 44, "หยุดท่าเต้น")
89+
local lockToggleBtn = makeButton("AntiLock", 88, "กันล็อค: ปิด")
90+
91+
-- Nicely animate open/close
92+
local opened = true
93+
openCloseBtn.MouseButton1Click:Connect(function()
94+
opened = not opened
95+
local goal = {}
96+
if opened then
97+
goal.Size = UDim2.new(1, -24, 1, -56)
98+
openCloseBtn.Rotation = 0
99+
else
100+
goal.Size = UDim2.new(1, -24, 0, 0)
101+
openCloseBtn.Rotation = 90
102+
end
103+
TweenService:Create(controls, TweenInfo.new(0.3, Enum.EasingStyle.Quad), {Size = goal.Size or controls.Size}):Play()
104+
end)
105+
106+
-- Animation handling
107+
local animation = Instance.new("Animation")
108+
animation.Name = "AutoDanceAnim"
109+
animation.AnimationId = ANIM_ID
110+
111+
local currentTrack = nil
112+
local function getHumanoid()
113+
local char = player.Character or player.CharacterAdded:Wait()
114+
return char:FindFirstChildOfClass("Humanoid")
115+
end
116+
117+
local function playDance()
118+
local humanoid = getHumanoid()
119+
if not humanoid then return end
120+
-- stop existing
121+
if currentTrack and currentTrack.IsPlaying then
122+
currentTrack:Stop()
123+
end
124+
local track = humanoid:LoadAnimation(animation)
125+
track.Priority = Enum.AnimationPriority.Action
126+
track:Play()
127+
currentTrack = track
128+
end
129+
130+
local function stopDance()
131+
if currentTrack then
132+
currentTrack:Stop()
133+
currentTrack = nil
134+
end
135+
end
136+
137+
playBtn.MouseButton1Click:Connect(playDance)
138+
stopBtn.MouseButton1Click:Connect(stopDance)
139+
140+
-- Anti-lock (Anti-AFK)
141+
local antiLockEnabled = false
142+
local idledConn = nil
143+
144+
local function setAntiLock(on)
145+
antiLockEnabled = on
146+
if antiLockEnabled then
147+
lockToggleBtn.Text = "กันล็อค: เปิด"
148+
-- Connect to Idled and simulate input
149+
if not idledConn then
150+
idledConn = player.Idled:Connect(function()
151+
-- Simulate controller to avoid idle kick
152+
VirtualUser:CaptureController()
153+
VirtualUser:ClickButton2(Vector2.new(0,0))
154+
end)
155+
end
156+
else
157+
lockToggleBtn.Text = "กันล็อค: ปิด"
158+
if idledConn then
159+
idledConn:Disconnect()
160+
idledConn = nil
161+
end
162+
end
163+
end
164+
165+
lockToggleBtn.MouseButton1Click:Connect(function()
166+
setAntiLock(not antiLockEnabled)
167+
end)
168+
169+
-- Ensure humanoid reconnection across respawn
170+
player.CharacterAdded:Connect(function(char)
171+
-- small delay to allow humanoid to exist
172+
wait(0.2)
173+
-- Stop previous track on respawn to avoid errors; you can auto-play if desired
174+
if currentTrack then
175+
currentTrack:Stop()
176+
currentTrack = nil
177+
end
178+
end)
179+
180+
-- Initial state
181+
setAntiLock(false)
182+
183+
-- Optional: hotkeys (P = play/stop)
184+
local UserInputService = game:GetService("UserInputService")
185+
UserInputService.InputBegan:Connect(function(input, gameProcessed)
186+
if gameProcessed then return end
187+
if input.KeyCode == Enum.KeyCode.P then
188+
if currentTrack and currentTrack.IsPlaying then
189+
stopDance()
190+
else
191+
playDance()
192+
end
193+
end
194+
end)
195+
196+
-- End of script

0 commit comments

Comments
 (0)