Revert to compiled scripts for every corescript except for RbxGui
This commit is contained in:
parent
9546433e44
commit
1cbc58e175
File diff suppressed because it is too large
Load Diff
|
|
@ -1,52 +1,246 @@
|
|||
local a,b,c,d,e,f,g,h,i,j=Game:GetService'ContextActionService',Game:GetService
|
||||
'UserInputService'.TouchEnabled,{},{},nil,nil,
|
||||
'http://www.banland.xyz/asset/?id=97166756',
|
||||
'http://www.banland.xyz/asset/?id=97166444',{},{[1]=UDim2.new(0,123,0,70),[2]=
|
||||
UDim2.new(0,30,0,60),[3]=UDim2.new(0,180,0,160),[4]=UDim2.new(0,85,0,-25),[5]=
|
||||
UDim2.new(0,185,0,-25),[6]=UDim2.new(0,185,0,260),[7]=UDim2.new(0,216,0,65)}
|
||||
local k=#j Game:GetService'ContentProvider':Preload(g)Game:GetService
|
||||
'ContentProvider':Preload(h)while not Game.Players do wait()end while not Game.
|
||||
Players.LocalPlayer do wait()end function createContextActionGui()if not e and b
|
||||
then e=Instance.new'ScreenGui'e.Name='ContextActionGui'f=Instance.new'Frame'f.
|
||||
BackgroundTransparency=1 f.Size=UDim2.new(0.3,0,0.5,0)f.Position=UDim2.new(0.7,0
|
||||
,0.5,0)f.Name='ContextButtonFrame'f.Parent=e end end function contextButtonDown(
|
||||
l,m,n)if m.UserInputType==Enum.UserInputType.Touch then l.Image=g a:
|
||||
CallFunction(n,Enum.UserInputState.Begin,m)end end function contextButtonMoved(l
|
||||
,m,n)if m.UserInputType==Enum.UserInputType.Touch then l.Image=g a:CallFunction(
|
||||
n,Enum.UserInputState.Change,m)end end function contextButtonUp(l,m,n)l.Image=h
|
||||
if m.UserInputType==Enum.UserInputType.Touch and m.UserInputState==Enum.
|
||||
UserInputState.End then a:CallFunction(n,Enum.UserInputState.End,m)end end
|
||||
function isSmallScreenDevice()return Game:GetService'GuiService':
|
||||
GetScreenResolution().y<=320 end function createNewButton(l,m)local n=Instance.
|
||||
new'ImageButton'n.Name='ContextActionButton'n.BackgroundTransparency=1 n.Size=
|
||||
UDim2.new(0,90,0,90)n.Active=true if isSmallScreenDevice()then n.Size=UDim2.new(
|
||||
0,70,0,70)end n.Image=h n.Parent=f local o=nil Game:GetService'UserInputService'
|
||||
.InputEnded:connect(function(p)i[p]=nil end)n.InputBegan:connect(function(p)if i
|
||||
[p]then return end if p.UserInputState==Enum.UserInputState.Begin and o==nil
|
||||
then o=p contextButtonDown(n,p,l)end end)n.InputChanged:connect(function(p)if i[
|
||||
p]then return end if o~=p then return end contextButtonMoved(n,p,l)end)n.
|
||||
InputEnded:connect(function(p)if i[p]then return end if o~=p then return end o=
|
||||
nil i[p]=true contextButtonUp(n,p,l)end)local p=Instance.new'ImageLabel'p.Name=
|
||||
'ActionIcon'p.Position=UDim2.new(0.175,0,0.175,0)p.Size=UDim2.new(0.65,0,0.65,0)
|
||||
p.BackgroundTransparency=1 if m['image']and type(m['image'])=='string'then p.
|
||||
Image=m['image']end p.Parent=n local q=Instance.new'TextLabel'q.Name=
|
||||
'ActionTitle'q.Size=UDim2.new(1,0,1,0)q.BackgroundTransparency=1 q.Font=Enum.
|
||||
Font.SourceSansBold q.TextColor3=Color3.new(1,1,1)q.TextStrokeTransparency=0 q.
|
||||
FontSize=Enum.FontSize.Size18 q.TextWrapped=true q.Text=''if m['title']and type(
|
||||
m['title'])=='string'then q.Text=m['title']end q.Parent=n return n end function
|
||||
createButton(l,m)local n,o=createNewButton(l,m),nil for p=1,#d do if d[p]==
|
||||
'empty'then o=p break end end if not o then o=#d+1 end if o>k then return end d[
|
||||
o]=n c[l]['button']=n n.Position=j[o]n.Parent=f if e and e.Parent==nil then e.
|
||||
Parent=Game.Players.LocalPlayer.PlayerGui end end function removeAction(l)if not
|
||||
c[l]then return end local m=c[l]['button']if m then m.Parent=nil for n=1,#d do
|
||||
if d[n]==m then d[n]='empty'break end end m:Destroy()end c[l]=nil end function
|
||||
addAction(l,m,n)if c[l]then removeAction(l)end c[l]={n}if m and b then
|
||||
createContextActionGui()createButton(l,n)end end a.BoundActionChanged:connect(
|
||||
function(l,m,n)if c[l]and n then local o=c[l]['button']if o then if m=='image'
|
||||
then o.ActionIcon.Image=n[m]elseif m=='title'then o.ActionTitle.Text=n[m]elseif
|
||||
m=='position'then o.Position=n[m]end end end end)a.BoundActionAdded:connect(
|
||||
function(l,m,n)addAction(l,m,n)end)a.BoundActionRemoved:connect(function(l,m)
|
||||
removeAction(l)end)a.GetActionButtonEvent:connect(function(l)if c[l]then a:
|
||||
FireActionButtonFoundSignal(l,c[l]['button'])end end)local l=a:
|
||||
GetAllBoundActionInfo()for m,n in pairs(l)do addAction(m,n['createTouchButton'],
|
||||
n)end
|
||||
print("[Mercury]: Loaded corescript 152908679")
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local contextActionService = Game:GetService("ContextActionService")
|
||||
local isTouchDevice = Game:GetService("UserInputService").TouchEnabled
|
||||
local functionTable = { }
|
||||
local buttonVector = { }
|
||||
local buttonScreenGui
|
||||
local buttonFrame
|
||||
local ContextDownImage = "http://www.banland.xyz/asset/?id=97166756"
|
||||
local ContextUpImage = "http://www.banland.xyz/asset/?id=97166444"
|
||||
local oldTouches = { }
|
||||
local buttonPositionTable = {
|
||||
UDim2.new(0, 123, 0, 70),
|
||||
UDim2.new(0, 30, 0, 60),
|
||||
UDim2.new(0, 180, 0, 160),
|
||||
UDim2.new(0, 85, 0, -25),
|
||||
UDim2.new(0, 185, 0, -25),
|
||||
UDim2.new(0, 185, 0, 260),
|
||||
UDim2.new(0, 216, 0, 65)
|
||||
}
|
||||
local maxButtons = #buttonPositionTable
|
||||
do
|
||||
local _with_0 = Game:GetService("ContentProvider")
|
||||
_with_0:Preload(ContextDownImage)
|
||||
_with_0:Preload(ContextUpImage)
|
||||
end
|
||||
while not Game.Players do
|
||||
wait()
|
||||
end
|
||||
while not Game.Players.LocalPlayer do
|
||||
wait()
|
||||
end
|
||||
local createContextActionGui
|
||||
createContextActionGui = function()
|
||||
if not buttonScreenGui and isTouchDevice then
|
||||
buttonScreenGui = New("ScreenGui", "ContextActionGui", {
|
||||
New("Frame", "ContextButtonFrame", {
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(0.3, 0, 0.5, 0),
|
||||
Position = UDim2.new(0.7, 0, 0.5, 0)
|
||||
})
|
||||
})
|
||||
end
|
||||
end
|
||||
local contextButtonDown
|
||||
contextButtonDown = function(button, inputObject, actionName)
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch then
|
||||
button.Image = ContextDownImage
|
||||
return contextActionService:CallFunction(actionName, Enum.UserInputState.Begin)
|
||||
end
|
||||
end
|
||||
local contextButtonMoved
|
||||
contextButtonMoved = function(button, inputObject, actionName)
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch then
|
||||
button.Image = ContextDownImage
|
||||
return contextActionService:CallFunction(actionName, Enum.UserInputState.Change)
|
||||
end
|
||||
end
|
||||
local contextButtonUp
|
||||
contextButtonUp = function(button, inputObject, actionName)
|
||||
button.Image = ContextUpImage
|
||||
if inputObject.UserInputType == Enum.UserInputType.Touch and inputObject.UserInputState == Enum.UserInputState.End then
|
||||
return contextActionService:CallFunction(actionName, Enum.UserInputState.End, inputObject)
|
||||
end
|
||||
end
|
||||
local isSmallScreenDevice
|
||||
isSmallScreenDevice = function()
|
||||
return Game:GetService("GuiService"):GetScreenResolution().y <= 320
|
||||
end
|
||||
local createNewButton
|
||||
createNewButton = function(actionName, functionInfoTable)
|
||||
local contextButton = New("ImageButton", "ContextActionButton", {
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new((function()
|
||||
if isSmallScreenDevice() then
|
||||
return 0, 90, 0, 90
|
||||
else
|
||||
return 0, 70, 0, 70
|
||||
end
|
||||
end)()),
|
||||
Active = true,
|
||||
Image = ContextUpImage,
|
||||
Parent = buttonFrame
|
||||
})
|
||||
local currentButtonTouch
|
||||
Game:GetService("UserInputService").InputEnded:connect(function(inputObject)
|
||||
oldTouches[inputObject] = nil
|
||||
end)
|
||||
contextButton.InputBegan:connect(function(inputObject)
|
||||
if oldTouches[inputObject] then
|
||||
return
|
||||
end
|
||||
if inputObject.UserInputState == Enum.UserInputState.Begin and not (currentButtonTouch ~= nil) then
|
||||
currentButtonTouch = inputObject
|
||||
return contextButtonDown(contextButton, inputObject, actionName)
|
||||
end
|
||||
end)
|
||||
contextButton.InputChanged:connect(function(inputObject)
|
||||
if oldTouches[inputObject] or currentButtonTouch ~= inputObject then
|
||||
return
|
||||
end
|
||||
return contextButtonMoved(contextButton, inputObject, actionName)
|
||||
end)
|
||||
contextButton.InputEnded:connect(function(inputObject)
|
||||
if oldTouches[inputObject] or currentButtonTouch ~= inputObject then
|
||||
return
|
||||
end
|
||||
currentButtonTouch = nil
|
||||
oldTouches[inputObject] = true
|
||||
return contextButtonUp(contextButton, inputObject, actionName)
|
||||
end)
|
||||
local actionIcon = New("ImageLabel", "ActionIcon", {
|
||||
Position = UDim2.new(0.175, 0, 0.175, 0),
|
||||
Size = UDim2.new(0.65, 0, 0.65, 0),
|
||||
BackgroundTransparency = 1
|
||||
})
|
||||
if functionInfoTable["image"] and type(functionInfoTable["image"]) == "string" then
|
||||
actionIcon.Image = functionInfoTable["image"]
|
||||
end
|
||||
actionIcon.Parent = contextButton
|
||||
local actionTitle = New("TextLabel", "ActionTitle", {
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
BackgroundTransparency = 1,
|
||||
Font = Enum.Font.SourceSansBold,
|
||||
TextColor3 = Color3.new(1, 1, 1),
|
||||
TextStrokeTransparency = 0,
|
||||
FontSize = Enum.FontSize.Size18,
|
||||
TextWrapped = true,
|
||||
Text = ""
|
||||
})
|
||||
if functionInfoTable["title"] and type(functionInfoTable["title"]) == "string" then
|
||||
actionTitle.Text = functionInfoTable["title"]
|
||||
end
|
||||
actionTitle.Parent = contextButton
|
||||
return contextButton
|
||||
end
|
||||
local createButton
|
||||
createButton = function(actionName, functionInfoTable)
|
||||
local button = createNewButton(actionName, functionInfoTable)
|
||||
local position
|
||||
for i = 1, #buttonVector do
|
||||
if buttonVector[i] == "empty" then
|
||||
position = i
|
||||
break
|
||||
end
|
||||
end
|
||||
if not position then
|
||||
position = #buttonVector + 1
|
||||
end
|
||||
if position > maxButtons then
|
||||
return
|
||||
end
|
||||
buttonVector[position] = button
|
||||
functionTable[actionName]["button"] = button
|
||||
button.Position = buttonPositionTable[position]
|
||||
button.Parent = buttonFrame
|
||||
if buttonScreenGui and not (buttonScreenGui.Parent ~= nil) then
|
||||
buttonScreenGui.Parent = Game.Players.LocalPlayer.PlayerGui
|
||||
end
|
||||
end
|
||||
local removeAction
|
||||
removeAction = function(actionName)
|
||||
if not functionTable[actionName] then
|
||||
return
|
||||
end
|
||||
local actionButton = functionTable[actionName]["button"]
|
||||
if actionButton then
|
||||
actionButton.Parent = nil
|
||||
for i = 1, #buttonVector do
|
||||
if buttonVector[i] == actionButton then
|
||||
buttonVector[i] = "empty"
|
||||
break
|
||||
end
|
||||
end
|
||||
actionButton:Destroy()
|
||||
end
|
||||
functionTable[actionName] = nil
|
||||
end
|
||||
local addAction
|
||||
addAction = function(actionName, createTouchButton, functionInfoTable)
|
||||
if functionTable[actionName] then
|
||||
removeAction(actionName)
|
||||
end
|
||||
functionTable[actionName] = {
|
||||
functionInfoTable
|
||||
}
|
||||
if createTouchButton and isTouchDevice then
|
||||
createContextActionGui()
|
||||
return createButton(actionName, functionInfoTable)
|
||||
end
|
||||
end
|
||||
contextActionService.BoundActionChanged:connect(function(actionName, changeName, changeTable)
|
||||
if functionTable[actionName] and changeTable then
|
||||
do
|
||||
local button = functionTable[actionName]["button"]
|
||||
if button then
|
||||
if changeName == "image" then
|
||||
button.ActionIcon.Image = changeTable[changeName]
|
||||
elseif changeName == "title" then
|
||||
button.ActionTitle.Text = changeTable[changeName]
|
||||
elseif changeName == "position" then
|
||||
button.Position = changeTable[changeName]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
contextActionService.BoundActionAdded:connect(function(actionName, createTouchButton, functionInfoTable)
|
||||
return addAction(actionName, createTouchButton, functionInfoTable)
|
||||
end)
|
||||
contextActionService.BoundActionRemoved:connect(function(actionName, _)
|
||||
return removeAction(actionName)
|
||||
end)
|
||||
contextActionService.GetActionButtonEvent:connect(function(actionName)
|
||||
if functionTable[actionName] then
|
||||
return contextActionService:FireActionButtonFoundSignal(actionName, functionTable[actionName]["button"])
|
||||
end
|
||||
end)
|
||||
local boundActions = contextActionService:GetAllBoundActionInfo()
|
||||
for actionName, actionData in pairs(boundActions) do
|
||||
addAction(actionName, actionData["createTouchButton"], actionData)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,112 +1,527 @@
|
|||
while not Game do wait()end while not Game:FindFirstChild'Players'do wait()end
|
||||
while not Game.Players.LocalPlayer do wait()end while not Game:FindFirstChild
|
||||
'CoreGui'do wait()end while not Game.CoreGui:FindFirstChild'RobloxGui'do wait()
|
||||
end local a=Game:GetService'UserInputService'local b=pcall(function()a:
|
||||
IsLuaTouchControls()end)if not b then script:Destroy()end local c=Game:
|
||||
GetService'GuiService':GetScreenResolution()function isSmallScreenDevice()return
|
||||
c.y<=320 end local d,e=Game.Players.LocalPlayer,120 if isSmallScreenDevice()then
|
||||
e=70 end local f,g,h,i,j='rbxasset://textures/ui/TouchControlsSheet.png',5,0.92,
|
||||
{},90 if isSmallScreenDevice()then j=70 end local k,l,m={},nil,0.007 local n,o,p
|
||||
,q=m*16,0.03,0.2,nil Game:GetService'ContentProvider':Preload(f)function
|
||||
DistanceBetweenTwoPoints(r,s)local t,u=s.x-r.x,s.y-r.y return math.sqrt((t*t)+(u
|
||||
*u))end function transformFromCenterToTopLeft(r,s)return UDim2.new(0,r.x-s.
|
||||
AbsoluteSize.x/2,0,r.y-s.AbsoluteSize.y/2)end function rotatePointAboutLocation(
|
||||
r,s,t)local u,v,w=math.sin(t),math.cos(t),r w=Vector2.new(w.x-s.x,w.y-s.y)local
|
||||
x,y=w.x*v-w.y*u,w.x*u+w.y*v w=Vector2.new(x+s.x,y+s.y)return w end function
|
||||
dotProduct(r,s)return((r.x*s.x)+(r.y*s.y))end function
|
||||
stationaryThumbstickTouchMove(r,s,t)local u=Vector2.new(s.Position.X.Offset+s.
|
||||
AbsoluteSize.x/2,s.Position.Y.Offset+s.AbsoluteSize.y/2)local v=
|
||||
DistanceBetweenTwoPoints(t,u)if v>(e/2)then local w=Vector2.new(t.x-u.x,t.y-u.y)
|
||||
local x=w.unit if x.x==math.nan or x.x==math.inf then x=Vector2.new(0,x.y)end if
|
||||
x.y==math.nan or x.y==math.inf then x=Vector2.new(x.x,0)end local y=u+(x*(e/2))r
|
||||
.Position=transformFromCenterToTopLeft(y,r)else r.Position=
|
||||
transformFromCenterToTopLeft(t,r)end return Vector2.new(r.Position.X.Offset-s.
|
||||
Position.X.Offset,r.Position.Y.Offset-s.Position.Y.Offset)end function
|
||||
followThumbstickTouchMove(r,s,t)local u=Vector2.new(s.Position.X.Offset+s.
|
||||
AbsoluteSize.x/2,s.Position.Y.Offset+s.AbsoluteSize.y/2)if
|
||||
DistanceBetweenTwoPoints(t,u)>e/2 then local v=Vector2.new(r.Position.X.Offset+r
|
||||
.AbsoluteSize.x/2,r.Position.Y.Offset+r.AbsoluteSize.y/2)local w,x=Vector2.new(t
|
||||
.x-v.x,t.y-v.y).unit,Vector2.new(v.x-u.x,v.y-u.y)local y,z=x.unit,Vector2.new(t.
|
||||
x-v.x,t.y-v.y)local A=(y.x*w.y)-(y.y*w.x)local B=math.atan2(A,dotProduct(y,w))
|
||||
local C=B*math.min(z.magnitude/x.magnitude,1)if math.abs(C)>0.00001 then local D
|
||||
=rotatePointAboutLocation(u,v,C)s.Position=transformFromCenterToTopLeft(Vector2.
|
||||
new(D.x,D.y),s)end s.Position=UDim2.new(0,s.Position.X.Offset+z.x,0,s.Position.Y
|
||||
.Offset+z.y)end r.Position=transformFromCenterToTopLeft(t,r)local v,w=Vector2.
|
||||
new(r.Position.X.Offset,r.Position.Y.Offset),Vector2.new(s.Position.X.Offset,s.
|
||||
Position.Y.Offset)if DistanceBetweenTwoPoints(v,w)>e/2 then local x=(w-v).unit*e
|
||||
/2 s.Position=UDim2.new(0,v.x+x.x,0,v.y+x.y)end return Vector2.new(r.Position.X.
|
||||
Offset-s.Position.X.Offset,r.Position.Y.Offset-s.Position.Y.Offset)end function
|
||||
movementOutsideDeadZone(r)return((math.abs(r.x)>g)or(math.abs(r.y)>g))end
|
||||
function constructThumbstick(r,s,t)local u=Instance.new'Frame'u.Name=
|
||||
'ThumbstickFrame'u.Active=true u.Size=UDim2.new(0,e,0,e)u.Position=r u.
|
||||
BackgroundTransparency=1 local v=Instance.new'ImageLabel'v.Name=
|
||||
'OuterThumbstick'v.Image=f v.ImageRectOffset=Vector2.new(0,0)v.ImageRectSize=
|
||||
Vector2.new(220,220)v.BackgroundTransparency=1 v.Size=UDim2.new(0,e,0,e)v.
|
||||
Position=r v.Parent=Game.CoreGui.RobloxGui local w=Instance.new'ImageLabel'w.
|
||||
Name='InnerThumbstick'w.Image=f w.ImageRectOffset=Vector2.new(220,0)w.
|
||||
ImageRectSize=Vector2.new(111,111)w.BackgroundTransparency=1 w.Size=UDim2.new(0,
|
||||
e/2,0,e/2)w.Position=UDim2.new(0,u.Size.X.Offset/2-e/4,0,u.Size.Y.Offset/2-e/4)w
|
||||
.Parent=u w.ZIndex=2 local x,y,z=nil,nil,nil local A=function(A)if x then return
|
||||
end if A==q then return end if A==l then return end if A.UserInputType~=Enum.
|
||||
UserInputType.Touch then return end x=A table.insert(i,x)u.Position=
|
||||
transformFromCenterToTopLeft(x.Position,u)v.Position=u.Position y=a.TouchMoved:
|
||||
connect(function(B)if B==x then local C=nil if t then C=
|
||||
stationaryThumbstickTouchMove(u,v,Vector2.new(B.Position.x,B.Position.y))else C=
|
||||
followThumbstickTouchMove(u,v,Vector2.new(B.Position.x,B.Position.y))end if s
|
||||
then s(C,v.Size.X.Offset/2)end end end)z=a.TouchEnded:connect(function(B)if B==x
|
||||
then if s then s(Vector2.new(0,0),1)end z:disconnect()y:disconnect()u.Position=r
|
||||
v.Position=r for C,D in pairs(i)do if D==x then table.remove(i,C)break end end x
|
||||
=nil end end)end a.Changed:connect(function(B)if B=='ModalEnabled'then u.Visible
|
||||
=not a.ModalEnabled v.Visible=not a.ModalEnabled end end)u.InputBegan:connect(A)
|
||||
return u end function setupCharacterMovement(r)local s,t=nil local u=d.
|
||||
MoveCharacter local v,w=function(v,w)if d then if movementOutsideDeadZone(v)then
|
||||
s=v t=w if v.magnitude/w>h then w=v.magnitude-1 end u(d,v,w)else s=Vector2.new(0
|
||||
,0)t=1 u(d,s,t)end end end,UDim2.new(0,e/2,1,-e*1.75)if isSmallScreenDevice()
|
||||
then w=UDim2.new(0,(e/2)-10,1,-e-20)end local x=constructThumbstick(w,v,false)x.
|
||||
Name='CharacterThumbstick'x.Parent=r local y=function()if d and u and s and t
|
||||
then u(d,s,t)end end return y end function setupJumpButton(r)local s=Instance.
|
||||
new'ImageButton's.Name='JumpButton's.BackgroundTransparency=1 s.Image=f s.
|
||||
ImageRectOffset=Vector2.new(176,222)s.ImageRectSize=Vector2.new(174,174)s.Size=
|
||||
UDim2.new(0,j,0,j)if isSmallScreenDevice()then s.Position=UDim2.new(1,-(j*2.25),
|
||||
1,-j-20)else s.Position=UDim2.new(1,-(j*2.75),1,-j-120)end local t=d.
|
||||
JumpCharacter local u=function()while l do if d then t(d)end wait(
|
||||
1.6666666666666665E-2)end end s.InputBegan:connect(function(v)if v.UserInputType
|
||||
~=Enum.UserInputType.Touch then return end if l then return end if v==q then
|
||||
return end for w,x in pairs(k)do if x==v then return end end l=v s.
|
||||
ImageRectOffset=Vector2.new(0,222)s.ImageRectSize=Vector2.new(174,174)u()end)s.
|
||||
InputEnded:connect(function(v)if v.UserInputType~=Enum.UserInputType.Touch then
|
||||
return end s.ImageRectOffset=Vector2.new(176,222)s.ImageRectSize=Vector2.new(174
|
||||
,174)if v==l then table.insert(k,l)l=nil end end)a.InputEnded:connect(function(v
|
||||
)for w,x in pairs(k)do if x==v then table.remove(k,w)break end end end)a.Changed
|
||||
:connect(function(v)if v=='ModalEnabled'then s.Visible=not a.ModalEnabled end
|
||||
end)s.Parent=r end function isTouchUsedByJumpButton(r)if r==l then return true
|
||||
end for s,t in pairs(k)do if r==t then return true end end return false end
|
||||
function isTouchUsedByThumbstick(r)for s,t in pairs(i)do if r==t then return
|
||||
true end end return false end function setupCameraControl(r,s)local t,u,v,w,x,y,
|
||||
z,A,B=nil,false,a.RotateCamera,-1,false,nil,a.ZoomCamera,{},nil local C,D=
|
||||
function()q=nil u=false t=nil end,function()A={}y=nil x=false B:Destroy()B=nil
|
||||
end local E=function(E,F)if B then B:Destroy()end B=Instance.new'Frame'B.Name=
|
||||
'PinchFrame'B.BackgroundTransparency=1 B.Parent=r B.Size=UDim2.new(1,0,1,0)B.
|
||||
InputChanged:connect(function(G)if not x then D()return end C()if y==nil then if
|
||||
G==E then y=(G.Position-F.Position).magnitude E=G elseif G==F then y=(G.Position
|
||||
-E.Position).magnitude F=G end else local H=0 if G==E then H=(G.Position-F.
|
||||
Position).magnitude E=G elseif G==F then H=(G.Position-E.Position).magnitude F=G
|
||||
end if H~=0 then local I=H-y if I~=0 then z(a,(I*o))end y=H end end end)B.
|
||||
InputEnded:connect(function(G)if G==E or G==F then D()end end)end local F=
|
||||
function(F)if#A<1 then table.insert(A,F)w=tick()x=false elseif#A==1 then x=((
|
||||
tick()-w)<=p)if x then table.insert(A,F)E(A[1],A[2])else A={}end end end r.
|
||||
InputBegan:connect(function(G)if G.UserInputType~=Enum.UserInputType.Touch then
|
||||
return end if isTouchUsedByJumpButton(G)then return end local H=
|
||||
isTouchUsedByThumbstick(G)if not H then F(G)end if q==nil and not H then q=G t=
|
||||
Vector2.new(q.Position.x,q.Position.y)end end)a.InputChanged:connect(function(G)
|
||||
if G.UserInputType~=Enum.UserInputType.Touch then return end if q~=G then return
|
||||
end local H=Vector2.new(q.Position.x,q.Position.y)local I=(t-H)*m if not u and(I
|
||||
.magnitude>n)then u=true t=H end if u and(t~=H)then v(a,I)s()t=H end end)a.
|
||||
InputEnded:connect(function(G)if q==G or q==nil then C()end for H,I in pairs(A)
|
||||
do if I==G then table.remove(A,H)end end end)end function setupTouchControls()
|
||||
local r=Instance.new'Frame'r.Name='TouchControlFrame'r.Size=UDim2.new(1,0,1,0)r.
|
||||
BackgroundTransparency=1 r.Parent=Game.CoreGui.RobloxGui local s=
|
||||
setupCharacterMovement(r)setupJumpButton(r)setupCameraControl(r,s)a.
|
||||
ProcessedEvent:connect(function(t,u)if not u then return end if t==q and t.
|
||||
UserInputState==Enum.UserInputState.Begin then q=nil end end)end do
|
||||
setupTouchControls()end
|
||||
print("[Mercury]: Loaded corescript 153556783")
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
while not Game do
|
||||
wait()
|
||||
end
|
||||
while not Game:FindFirstChild("Players") do
|
||||
wait()
|
||||
end
|
||||
while not Game.Players.LocalPlayer do
|
||||
wait()
|
||||
end
|
||||
while not Game:FindFirstChild("CoreGui") do
|
||||
wait()
|
||||
end
|
||||
while not Game.CoreGui:FindFirstChild("RobloxGui") do
|
||||
wait()
|
||||
end
|
||||
local userInputService = Game:GetService("UserInputService")
|
||||
local success = pcall(function()
|
||||
return userInputService:IsLuaTouchControls()
|
||||
end)
|
||||
if not success then
|
||||
script:Destroy()
|
||||
end
|
||||
local screenResolution = Game:GetService("GuiService"):GetScreenResolution()
|
||||
local isSmallScreenDevice
|
||||
isSmallScreenDevice = function()
|
||||
return screenResolution.y <= 320
|
||||
end
|
||||
local localPlayer = Game.Players.LocalPlayer
|
||||
local thumbstickSize = 120
|
||||
if isSmallScreenDevice() then
|
||||
thumbstickSize = 70
|
||||
end
|
||||
local touchControlsSheet = "rbxasset://textures/ui/TouchControlsSheet.png"
|
||||
local ThumbstickDeadZone = 5
|
||||
local ThumbstickMaxPercentGive = 0.92
|
||||
local thumbstickTouches = { }
|
||||
local jumpButtonSize = 90
|
||||
if isSmallScreenDevice() then
|
||||
jumpButtonSize = 70
|
||||
end
|
||||
local oldJumpTouches = { }
|
||||
local currentJumpTouch
|
||||
local CameraRotateSensitivity = 0.007
|
||||
local CameraRotateDeadZone = CameraRotateSensitivity * 16
|
||||
local CameraZoomSensitivity = 0.03
|
||||
local PinchZoomDelay = 0.2
|
||||
local cameraTouch
|
||||
Game:GetService("ContentProvider"):Preload(touchControlsSheet)
|
||||
local DistanceBetweenTwoPoints
|
||||
DistanceBetweenTwoPoints = function(point1, point2)
|
||||
local dx = point2.x - point1.x
|
||||
local dy = point2.y - point1.y
|
||||
return math.sqrt(dx * dx + dy * dy)
|
||||
end
|
||||
local transformFromCenterToTopLeft
|
||||
transformFromCenterToTopLeft = function(pointToTranslate, guiObject)
|
||||
return UDim2.new(0, pointToTranslate.x - guiObject.AbsoluteSize.x / 2, 0, pointToTranslate.y - guiObject.AbsoluteSize.y / 2)
|
||||
end
|
||||
local rotatePointAboutLocation
|
||||
rotatePointAboutLocation = function(pointToRotate, pointToRotateAbout, radians)
|
||||
local sinAnglePercent = math.sin(radians)
|
||||
local cosAnglePercent = math.cos(radians)
|
||||
local transformedPoint = pointToRotate
|
||||
transformedPoint = Vector2.new(transformedPoint.x - pointToRotateAbout.x, transformedPoint.y - pointToRotateAbout.y)
|
||||
local xNew = transformedPoint.x * cosAnglePercent - transformedPoint.y * sinAnglePercent
|
||||
local yNew = transformedPoint.x * sinAnglePercent + transformedPoint.y * cosAnglePercent
|
||||
transformedPoint = Vector2.new(xNew + pointToRotateAbout.x, yNew + pointToRotateAbout.y)
|
||||
return transformedPoint
|
||||
end
|
||||
local dotProduct
|
||||
dotProduct = function(v1, v2)
|
||||
return v1.x * v2.x + v1.y * v2.y
|
||||
end
|
||||
local stationaryThumbstickTouchMove
|
||||
stationaryThumbstickTouchMove = function(thumbstickFrame, thumbstickOuter, touchLocation)
|
||||
local thumbstickOuterCenterPosition = Vector2.new(thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2)
|
||||
local centerDiff = DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenterPosition)
|
||||
if centerDiff > (thumbstickSize / 2) then
|
||||
local thumbVector = Vector2.new(touchLocation.x - thumbstickOuterCenterPosition.x, touchLocation.y - thumbstickOuterCenterPosition.y)
|
||||
local normal = thumbVector.unit
|
||||
if normal.x == math.nan or normal.x == math.inf then
|
||||
normal = Vector2.new(0, normal.y)
|
||||
end
|
||||
if normal.y == math.nan or normal.y == math.inf then
|
||||
normal = Vector2.new(normal.x, 0)
|
||||
end
|
||||
local newThumbstickInnerPosition = thumbstickOuterCenterPosition + (normal * (thumbstickSize / 2))
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft(newThumbstickInnerPosition, thumbstickFrame)
|
||||
else
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||
end
|
||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset, thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
||||
end
|
||||
local followThumbstickTouchMove
|
||||
followThumbstickTouchMove = function(thumbstickFrame, thumbstickOuter, touchLocation)
|
||||
local thumbstickOuterCenter = Vector2.new(thumbstickOuter.Position.X.Offset + thumbstickOuter.AbsoluteSize.x / 2, thumbstickOuter.Position.Y.Offset + thumbstickOuter.AbsoluteSize.y / 2)
|
||||
if DistanceBetweenTwoPoints(touchLocation, thumbstickOuterCenter) > thumbstickSize / 2 then
|
||||
local thumbstickInnerCenter = Vector2.new(thumbstickFrame.Position.X.Offset + thumbstickFrame.AbsoluteSize.x / 2, thumbstickFrame.Position.Y.Offset + thumbstickFrame.AbsoluteSize.y / 2)
|
||||
local movementVectorUnit = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y).unit
|
||||
local outerToInnerVectorCurrent = Vector2.new(thumbstickInnerCenter.x - thumbstickOuterCenter.x, thumbstickInnerCenter.y - thumbstickOuterCenter.y)
|
||||
local outerToInnerVectorCurrentUnit = outerToInnerVectorCurrent.unit
|
||||
local movementVector = Vector2.new(touchLocation.x - thumbstickInnerCenter.x, touchLocation.y - thumbstickInnerCenter.y)
|
||||
local crossOuterToInnerWithMovement = (outerToInnerVectorCurrentUnit.x * movementVectorUnit.y) - (outerToInnerVectorCurrentUnit.y * movementVectorUnit.x)
|
||||
local angle = math.atan2(crossOuterToInnerWithMovement, dotProduct(outerToInnerVectorCurrentUnit, movementVectorUnit))
|
||||
local anglePercent = angle * math.min(movementVector.magnitude / outerToInnerVectorCurrent.magnitude, 1.0)
|
||||
if math.abs(anglePercent) > 0.00001 then
|
||||
local outerThumbCenter = rotatePointAboutLocation(thumbstickOuterCenter, thumbstickInnerCenter, anglePercent)
|
||||
thumbstickOuter.Position = transformFromCenterToTopLeft(Vector2.new(outerThumbCenter.x, outerThumbCenter.y), thumbstickOuter)
|
||||
end
|
||||
thumbstickOuter.Position = UDim2.new(0, thumbstickOuter.Position.X.Offset + movementVector.x, 0, thumbstickOuter.Position.Y.Offset + movementVector.y)
|
||||
end
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft(touchLocation, thumbstickFrame)
|
||||
local thumbstickFramePosition = Vector2.new(thumbstickFrame.Position.X.Offset, thumbstickFrame.Position.Y.Offset)
|
||||
local thumbstickOuterPosition = Vector2.new(thumbstickOuter.Position.X.Offset, thumbstickOuter.Position.Y.Offset)
|
||||
if DistanceBetweenTwoPoints(thumbstickFramePosition, thumbstickOuterPosition) > thumbstickSize / 2 then
|
||||
local vectorWithLength = (thumbstickOuterPosition - thumbstickFramePosition).unit * thumbstickSize / 2
|
||||
thumbstickOuter.Position = UDim2.new(0, thumbstickFramePosition.x + vectorWithLength.x, 0, thumbstickFramePosition.y + vectorWithLength.y)
|
||||
end
|
||||
return Vector2.new(thumbstickFrame.Position.X.Offset - thumbstickOuter.Position.X.Offset, thumbstickFrame.Position.Y.Offset - thumbstickOuter.Position.Y.Offset)
|
||||
end
|
||||
local movementOutsideDeadZone
|
||||
movementOutsideDeadZone = function(movementVector)
|
||||
return (math.abs(movementVector.x) > ThumbstickDeadZone) or (math.abs(movementVector.y) > ThumbstickDeadZone)
|
||||
end
|
||||
local constructThumbstick
|
||||
constructThumbstick = function(defaultThumbstickPos, updateFunction, stationaryThumbstick)
|
||||
local thumbstickFrame = New("Frame", "ThumbstickFrame", {
|
||||
Active = true,
|
||||
Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize),
|
||||
Position = defaultThumbstickPos,
|
||||
BackgroundTransparency = 1
|
||||
})
|
||||
New("ImageLabel", "InnerThumbstick", {
|
||||
Image = touchControlsSheet,
|
||||
ImageRectOffset = Vector2.new(220, 0),
|
||||
ImageRectSize = Vector2.new(111, 111),
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(0, thumbstickSize / 2, 0, thumbstickSize / 2),
|
||||
Position = UDim2.new(0, thumbstickFrame.Size.X.Offset / 2 - thumbstickSize / 4, 0, thumbstickFrame.Size.Y.Offset / 2 - thumbstickSize / 4),
|
||||
ZIndex = 2,
|
||||
Parent = thumbstickFrame
|
||||
})
|
||||
local outerThumbstick = New("ImageLabel", "OuterThumbstick", {
|
||||
Image = touchControlsSheet,
|
||||
ImageRectOffset = Vector2.new(0, 0),
|
||||
ImageRectSize = Vector2.new(220, 220),
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(0, thumbstickSize, 0, thumbstickSize),
|
||||
Position = defaultThumbstickPos,
|
||||
Parent = Game.CoreGui.RobloxGui
|
||||
})
|
||||
local thumbstickTouch
|
||||
local userInputServiceTouchMovedCon
|
||||
local userInputSeviceTouchEndedCon
|
||||
local startInputTracking
|
||||
startInputTracking = function(inputObject)
|
||||
if thumbstickTouch then
|
||||
return
|
||||
end
|
||||
if inputObject == cameraTouch then
|
||||
return
|
||||
end
|
||||
if inputObject == currentJumpTouch then
|
||||
return
|
||||
end
|
||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||
return
|
||||
end
|
||||
thumbstickTouch = inputObject
|
||||
table.insert(thumbstickTouches, thumbstickTouch)
|
||||
thumbstickFrame.Position = transformFromCenterToTopLeft(thumbstickTouch.Position, thumbstickFrame)
|
||||
outerThumbstick.Position = thumbstickFrame.Position
|
||||
userInputServiceTouchMovedCon = userInputService.TouchMoved:connect(function(movedInput)
|
||||
if movedInput == thumbstickTouch then
|
||||
local movementVector
|
||||
if stationaryThumbstick then
|
||||
movementVector = stationaryThumbstickTouchMove(thumbstickFrame, outerThumbstick, Vector2.new(movedInput.Position.x, movedInput.Position.y))
|
||||
else
|
||||
movementVector = followThumbstickTouchMove(thumbstickFrame, outerThumbstick, Vector2.new(movedInput.Position.x, movedInput.Position.y))
|
||||
end
|
||||
if updateFunction then
|
||||
return updateFunction(movementVector, outerThumbstick.Size.X.Offset / 2)
|
||||
end
|
||||
end
|
||||
end)
|
||||
userInputSeviceTouchEndedCon = userInputService.TouchEnded:connect(function(endedInput)
|
||||
if endedInput == thumbstickTouch then
|
||||
if updateFunction then
|
||||
updateFunction(Vector2.new(0, 0), 1)
|
||||
end
|
||||
userInputSeviceTouchEndedCon:disconnect()
|
||||
userInputServiceTouchMovedCon:disconnect()
|
||||
thumbstickFrame.Position = defaultThumbstickPos
|
||||
outerThumbstick.Position = defaultThumbstickPos
|
||||
for i, object in pairs(thumbstickTouches) do
|
||||
if object == thumbstickTouch then
|
||||
table.remove(thumbstickTouches, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
thumbstickTouch = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
userInputService.Changed:connect(function(prop)
|
||||
if prop == "ModalEnabled" then
|
||||
do
|
||||
local _tmp_0 = not userInputService.ModalEnabled
|
||||
thumbstickFrame.Visible = _tmp_0
|
||||
outerThumbstick.Visible = _tmp_0
|
||||
end
|
||||
end
|
||||
end)
|
||||
thumbstickFrame.InputBegan:connect(startInputTracking)
|
||||
return thumbstickFrame
|
||||
end
|
||||
local setupCharacterMovement
|
||||
setupCharacterMovement = function(parentFrame)
|
||||
local lastMovementVector, lastMaxMovement
|
||||
local moveCharacterFunc = localPlayer.MoveCharacter
|
||||
local moveCharacterFunction
|
||||
moveCharacterFunction = function(movementVector, maxMovement)
|
||||
if localPlayer then
|
||||
if movementOutsideDeadZone(movementVector) then
|
||||
lastMovementVector = movementVector
|
||||
lastMaxMovement = maxMovement
|
||||
if movementVector.magnitude / maxMovement > ThumbstickMaxPercentGive then
|
||||
maxMovement = movementVector.magnitude - 1
|
||||
end
|
||||
return moveCharacterFunc(localPlayer, movementVector, maxMovement)
|
||||
else
|
||||
lastMovementVector = Vector2.new(0, 0)
|
||||
lastMaxMovement = 1
|
||||
return moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement)
|
||||
end
|
||||
end
|
||||
end
|
||||
local thumbstickPos = UDim2.new(0, thumbstickSize / 2, 1, -thumbstickSize * 1.75)
|
||||
if isSmallScreenDevice() then
|
||||
thumbstickPos = UDim2.new(0, (thumbstickSize / 2) - 10, 1, -thumbstickSize - 20)
|
||||
end
|
||||
local characterThumbstick = constructThumbstick(thumbstickPos, moveCharacterFunction, false)
|
||||
characterThumbstick.Name = "CharacterThumbstick"
|
||||
characterThumbstick.Parent = parentFrame
|
||||
local refreshCharacterMovement
|
||||
refreshCharacterMovement = function()
|
||||
if localPlayer and moveCharacterFunc and lastMovementVector and lastMaxMovement then
|
||||
return moveCharacterFunc(localPlayer, lastMovementVector, lastMaxMovement)
|
||||
end
|
||||
end
|
||||
return refreshCharacterMovement
|
||||
end
|
||||
local setupJumpButton
|
||||
setupJumpButton = function(parentFrame)
|
||||
local jumpButton = New("ImageButton", "JumpButton", {
|
||||
BackgroundTransparency = 1,
|
||||
Image = touchControlsSheet,
|
||||
ImageRectOffset = Vector2.new(176, 222),
|
||||
ImageRectSize = Vector2.new(174, 174),
|
||||
Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize),
|
||||
Position = UDim2.new(1, (function()
|
||||
if isSmallScreenDevice() then
|
||||
return -(jumpButtonSize * 2.25), 1, -jumpButtonSize - 20
|
||||
else
|
||||
return -(jumpButtonSize * 2.75), 1, -jumpButtonSize - 120
|
||||
end
|
||||
end)())
|
||||
})
|
||||
local playerJumpFunc = localPlayer.JumpCharacter
|
||||
local doJumpLoop
|
||||
doJumpLoop = function()
|
||||
while currentJumpTouch do
|
||||
if localPlayer then
|
||||
playerJumpFunc(localPlayer)
|
||||
end
|
||||
wait(1 / 60)
|
||||
end
|
||||
end
|
||||
jumpButton.InputBegan:connect(function(inputObject)
|
||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||
return
|
||||
end
|
||||
if currentJumpTouch then
|
||||
return
|
||||
end
|
||||
if inputObject == cameraTouch then
|
||||
return
|
||||
end
|
||||
for _, touch in pairs(oldJumpTouches) do
|
||||
if touch == inputObject then
|
||||
return
|
||||
end
|
||||
end
|
||||
currentJumpTouch = inputObject
|
||||
jumpButton.ImageRectOffset = Vector2.new(0, 222)
|
||||
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||
return doJumpLoop()
|
||||
end)
|
||||
jumpButton.InputEnded:connect(function(inputObject)
|
||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||
return
|
||||
end
|
||||
jumpButton.ImageRectOffset = Vector2.new(176, 222)
|
||||
jumpButton.ImageRectSize = Vector2.new(174, 174)
|
||||
if inputObject == currentJumpTouch then
|
||||
table.insert(oldJumpTouches, currentJumpTouch)
|
||||
currentJumpTouch = nil
|
||||
end
|
||||
end)
|
||||
userInputService.InputEnded:connect(function(globalInputObject)
|
||||
for i, touch in pairs(oldJumpTouches) do
|
||||
if touch == globalInputObject then
|
||||
table.remove(oldJumpTouches, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
userInputService.Changed:connect(function(prop)
|
||||
if prop == "ModalEnabled" then
|
||||
jumpButton.Visible = not userInputService.ModalEnabled
|
||||
end
|
||||
end)
|
||||
jumpButton.Parent = parentFrame
|
||||
end
|
||||
local isTouchUsedByJumpButton
|
||||
isTouchUsedByJumpButton = function(touch)
|
||||
if touch == currentJumpTouch then
|
||||
return true
|
||||
end
|
||||
for _, touchToCompare in pairs(oldJumpTouches) do
|
||||
if touch == touchToCompare then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
local isTouchUsedByThumbstick
|
||||
isTouchUsedByThumbstick = function(touch)
|
||||
for _, touchToCompare in pairs(thumbstickTouches) do
|
||||
if touch == touchToCompare then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
local setupCameraControl
|
||||
setupCameraControl = function(parentFrame, refreshCharacterMoveFunc)
|
||||
local lastPos
|
||||
local hasRotatedCamera = false
|
||||
local rotateCameraFunc = userInputService.RotateCamera
|
||||
local pinchTime = -1
|
||||
local shouldPinch = false
|
||||
local lastPinchScale
|
||||
local zoomCameraFunc = userInputService.ZoomCamera
|
||||
local pinchTouches = { }
|
||||
local pinchFrame
|
||||
local resetCameraRotateState
|
||||
resetCameraRotateState = function()
|
||||
cameraTouch = nil
|
||||
hasRotatedCamera = false
|
||||
lastPos = nil
|
||||
end
|
||||
local resetPinchState
|
||||
resetPinchState = function()
|
||||
pinchTouches = { }
|
||||
lastPinchScale = nil
|
||||
shouldPinch = false
|
||||
pinchFrame:Destroy()
|
||||
pinchFrame = nil
|
||||
end
|
||||
local startPinch
|
||||
startPinch = function(firstTouch, secondTouch)
|
||||
if pinchFrame ~= nil then
|
||||
pinchFrame:Destroy()
|
||||
end
|
||||
pinchFrame = New("Frame", {
|
||||
Name = "PinchFrame",
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Parent = parentFrame
|
||||
})
|
||||
pinchFrame.InputChanged:connect(function(inputObject)
|
||||
if not shouldPinch then
|
||||
resetPinchState()
|
||||
return
|
||||
end
|
||||
resetCameraRotateState()
|
||||
if not (lastPinchScale ~= nil) then
|
||||
if inputObject == firstTouch then
|
||||
lastPinchScale = (inputObject.Position - secondTouch.Position).magnitude
|
||||
firstTouch = inputObject
|
||||
elseif inputObject == secondTouch then
|
||||
lastPinchScale = (inputObject.Position - firstTouch.Position).magnitude
|
||||
secondTouch = inputObject
|
||||
end
|
||||
else
|
||||
local newPinchDistance = 0
|
||||
if inputObject == firstTouch then
|
||||
newPinchDistance = (inputObject.Position - secondTouch.Position).magnitude
|
||||
firstTouch = inputObject
|
||||
elseif inputObject == secondTouch then
|
||||
newPinchDistance = (inputObject.Position - firstTouch.Position).magnitude
|
||||
secondTouch = inputObject
|
||||
end
|
||||
if newPinchDistance ~= 0 then
|
||||
local pinchDiff = newPinchDistance - lastPinchScale
|
||||
if pinchDiff ~= 0 then
|
||||
zoomCameraFunc(userInputService, (pinchDiff * CameraZoomSensitivity))
|
||||
end
|
||||
lastPinchScale = newPinchDistance
|
||||
end
|
||||
end
|
||||
end)
|
||||
return pinchFrame.InputEnded:connect(function(inputObject)
|
||||
if inputObject == firstTouch or inputObject == secondTouch then
|
||||
return resetPinchState()
|
||||
end
|
||||
end)
|
||||
end
|
||||
local pinchGestureReceivedTouch
|
||||
pinchGestureReceivedTouch = function(inputObject)
|
||||
if #pinchTouches < 1 then
|
||||
table.insert(pinchTouches, inputObject)
|
||||
pinchTime = tick()
|
||||
shouldPinch = false
|
||||
elseif #pinchTouches == 1 then
|
||||
shouldPinch = ((tick() - pinchTime) <= PinchZoomDelay)
|
||||
if shouldPinch then
|
||||
table.insert(pinchTouches, inputObject)
|
||||
return startPinch(pinchTouches[1], pinchTouches[2])
|
||||
else
|
||||
pinchTouches = { }
|
||||
end
|
||||
end
|
||||
end
|
||||
parentFrame.InputBegan:connect(function(inputObject)
|
||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||
return
|
||||
end
|
||||
if isTouchUsedByJumpButton(inputObject) then
|
||||
return
|
||||
end
|
||||
local usedByThumbstick = isTouchUsedByThumbstick(inputObject)
|
||||
if not usedByThumbstick then
|
||||
pinchGestureReceivedTouch(inputObject)
|
||||
end
|
||||
if not (cameraTouch ~= nil) and not usedByThumbstick then
|
||||
cameraTouch = inputObject
|
||||
lastPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y)
|
||||
end
|
||||
end)
|
||||
userInputService.InputChanged:connect(function(inputObject)
|
||||
if inputObject.UserInputType ~= Enum.UserInputType.Touch then
|
||||
return
|
||||
end
|
||||
if cameraTouch ~= inputObject then
|
||||
return
|
||||
end
|
||||
local newPos = Vector2.new(cameraTouch.Position.x, cameraTouch.Position.y)
|
||||
local touchDiff = (lastPos - newPos) * CameraRotateSensitivity
|
||||
if not hasRotatedCamera and (touchDiff.magnitude > CameraRotateDeadZone) then
|
||||
hasRotatedCamera = true
|
||||
lastPos = newPos
|
||||
end
|
||||
if hasRotatedCamera and (lastPos ~= newPos) then
|
||||
rotateCameraFunc(userInputService, touchDiff)
|
||||
refreshCharacterMoveFunc()
|
||||
lastPos = newPos
|
||||
end
|
||||
end)
|
||||
return userInputService.InputEnded:connect(function(inputObject)
|
||||
if cameraTouch == inputObject or not (cameraTouch ~= nil) then
|
||||
resetCameraRotateState()
|
||||
end
|
||||
for i, touch in pairs(pinchTouches) do
|
||||
if touch == inputObject then
|
||||
table.remove(pinchTouches, i)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
local setupTouchControls
|
||||
setupTouchControls = function()
|
||||
local touchControlFrame = New("Frame", "TouchControlFrame", {
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
BackgroundTransparency = 1,
|
||||
Parent = Game.CoreGui.RobloxGui
|
||||
})
|
||||
local refreshCharacterMoveFunc = setupCharacterMovement(touchControlFrame)
|
||||
setupJumpButton(touchControlFrame)
|
||||
setupCameraControl(touchControlFrame, refreshCharacterMoveFunc)
|
||||
return userInputService.ProcessedEvent:connect(function(inputObject, processed)
|
||||
if not processed then
|
||||
return
|
||||
end
|
||||
if inputObject == cameraTouch and inputObject.UserInputState == Enum.UserInputState.Begin then
|
||||
cameraTouch = nil
|
||||
end
|
||||
end)
|
||||
end
|
||||
return setupTouchControls()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,25 +1,127 @@
|
|||
local a=script.Parent:FindFirstChild'ControlFrame'if not a then return end local
|
||||
b,c,d=a:FindFirstChild'BottomLeftControl',a:FindFirstChild'BottomRightControl',
|
||||
Instance.new'TextLabel'd.Name='ToolTip'd.Text=''d.Font=Enum.Font.ArialBold d.
|
||||
FontSize=Enum.FontSize.Size12 d.TextColor3=Color3.new(1,1,1)d.BorderSizePixel=0
|
||||
d.ZIndex=10 d.Size=UDim2.new(2,0,1,0)d.Position=UDim2.new(1,0,0,0)d.
|
||||
BackgroundColor3=Color3.new(0,0,0)d.BackgroundTransparency=1 d.TextTransparency=
|
||||
1 d.TextWrap=true local e=Instance.new'BoolValue'e.Name='inside'e.Value=false e.
|
||||
Parent=d function setUpListeners(f)local g=0.1 f.Parent.MouseEnter:connect(
|
||||
function()if f:FindFirstChild'inside'then f.inside.Value=true wait(1.2)if f.
|
||||
inside.Value then while f.inside.Value and f.BackgroundTransparency>0 do f.
|
||||
BackgroundTransparency=f.BackgroundTransparency-g f.TextTransparency=f.
|
||||
TextTransparency-g wait()end end end end)function killTip(h)h.inside.Value=false
|
||||
h.BackgroundTransparency=1 h.TextTransparency=1 end f.Parent.MouseLeave:connect(
|
||||
function()killTip(f)end)f.Parent.MouseButton1Click:connect(function()killTip(f)
|
||||
end)end function createSettingsButtonTip(f)if f==nil then f=b:FindFirstChild
|
||||
'SettingsButton'end local g=d:clone()g.RobloxLocked=true g.Text=
|
||||
'Settings/Leave Game'g.Position=UDim2.new(0,0,0,-18)g.Size=UDim2.new(0,120,0,20)
|
||||
g.Parent=f setUpListeners(g)end wait(5)local f=b:GetChildren()for g=1,#f do if f
|
||||
[g].Name=='Exit'then local h=d:clone()h.RobloxLocked=true h.Text='Leave Place'h.
|
||||
Position=UDim2.new(0,0,-1,0)h.Size=UDim2.new(1,0,1,0)h.Parent=f[g]
|
||||
setUpListeners(h)elseif f[g].Name=='SettingsButton'then createSettingsButtonTip(
|
||||
f[g])end end local g=c:GetChildren()for h=1,#g do if g[h].Name:find'Camera'~=nil
|
||||
then local i=d:clone()i.RobloxLocked=true i.Text='Camera View'if g[h].Name:find
|
||||
'Zoom'then i.Position=UDim2.new(-1,0,-1.5)else i.Position=UDim2.new(0,0,-1.5,0)
|
||||
end i.Size=UDim2.new(2,0,1.25,0)i.Parent=g[h]setUpListeners(i)end end
|
||||
print("[Mercury]: Loaded corescript 36868950")
|
||||
local controlFrame = script.Parent:FindFirstChild("ControlFrame")
|
||||
if not controlFrame then
|
||||
return
|
||||
end
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local bottomLeftControl = controlFrame:FindFirstChild("BottomLeftControl")
|
||||
local bottomRightControl = controlFrame:FindFirstChild("BottomRightControl")
|
||||
local frameTip = New("TextLabel", "ToolTip", {
|
||||
Text = "",
|
||||
Font = Enum.Font.ArialBold,
|
||||
FontSize = Enum.FontSize.Size12,
|
||||
TextColor3 = Color3.new(1, 1, 1),
|
||||
BorderSizePixel = 0,
|
||||
ZIndex = 10,
|
||||
Size = UDim2.new(2, 0, 1, 0),
|
||||
Position = UDim2.new(1, 0, 0, 0),
|
||||
BackgroundColor3 = Color3.new(0, 0, 0),
|
||||
BackgroundTransparency = 1,
|
||||
TextTransparency = 1,
|
||||
TextWrap = true,
|
||||
New("BoolValue", "inside", {
|
||||
Value = false
|
||||
})
|
||||
})
|
||||
local setUpListeners
|
||||
setUpListeners = function(frameToListen)
|
||||
local fadeSpeed = 0.1
|
||||
frameToListen.Parent.MouseEnter:connect(function()
|
||||
if frameToListen:FindFirstChild("inside") then
|
||||
frameToListen.inside.Value = true
|
||||
wait(1.2)
|
||||
if frameToListen.inside.Value then
|
||||
while frameToListen.inside.Value and frameToListen.BackgroundTransparency > 0 do
|
||||
frameToListen.BackgroundTransparency = frameToListen.BackgroundTransparency - fadeSpeed
|
||||
frameToListen.TextTransparency = frameToListen.TextTransparency - fadeSpeed
|
||||
wait()
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
local killTip
|
||||
killTip = function(killFrame)
|
||||
killFrame.inside.Value = false
|
||||
killFrame.BackgroundTransparency = 1
|
||||
killFrame.TextTransparency = 1
|
||||
end
|
||||
frameToListen.Parent.MouseLeave:connect(function()
|
||||
return killTip(frameToListen)
|
||||
end)
|
||||
return frameToListen.Parent.MouseButton1Click:connect(function()
|
||||
return killTip(frameToListen)
|
||||
end)
|
||||
end
|
||||
local createSettingsButtonTip
|
||||
createSettingsButtonTip = function(parent)
|
||||
if not (parent ~= nil) then
|
||||
parent = bottomLeftControl:FindFirstChild("SettingsButton")
|
||||
end
|
||||
local toolTip = frameTip:clone()
|
||||
toolTip.RobloxLocked = true
|
||||
toolTip.Text = "Settings/Leave Game"
|
||||
toolTip.Position = UDim2.new(0, 0, 0, -18)
|
||||
toolTip.Size = UDim2.new(0, 120, 0, 20)
|
||||
toolTip.Parent = parent
|
||||
setUpListeners(toolTip)
|
||||
return toolTip
|
||||
end
|
||||
wait(5)
|
||||
local bottomLeftChildren = bottomLeftControl:GetChildren()
|
||||
for i = 1, #bottomLeftChildren do
|
||||
if bottomLeftChildren[i].Name == "Exit" then
|
||||
do
|
||||
local exitTip = frameTip:clone()
|
||||
exitTip.RobloxLocked = true
|
||||
exitTip.Text = "Leave Place"
|
||||
exitTip.Position = UDim2.new(0, 0, -1, 0)
|
||||
exitTip.Size = UDim2.new(1, 0, 1, 0)
|
||||
exitTip.Parent = bottomLeftChildren[i]
|
||||
setUpListeners(exitTip)
|
||||
end
|
||||
elseif bottomLeftChildren[i].Name == "SettingsButton" then
|
||||
createSettingsButtonTip(bottomLeftChildren[i])
|
||||
end
|
||||
end
|
||||
local bottomRightChildren = bottomRightControl:GetChildren()
|
||||
for i = 1, #bottomRightChildren do
|
||||
if (bottomRightChildren[i].Name:find("Camera") ~= nil) then
|
||||
do
|
||||
local cameraTip = frameTip:clone()
|
||||
cameraTip.RobloxLocked = true
|
||||
cameraTip.Text = "Camera View"
|
||||
if bottomRightChildren[i].Name:find("Zoom") then
|
||||
cameraTip.Position = UDim2.new(-1, 0, -1.5)
|
||||
else
|
||||
cameraTip.Position = UDim2.new(0, 0, -1.5, 0)
|
||||
end
|
||||
cameraTip.Size = UDim2.new(2, 0, 1.25, 0)
|
||||
cameraTip.Parent = bottomRightChildren[i]
|
||||
setUpListeners(cameraTip)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,35 +1,69 @@
|
|||
local a,b=game:GetService'ScriptContext',false pcall(function()b=game:GetService
|
||||
'UserInputService'.TouchEnabled end)a:AddCoreScript(60595695,a,
|
||||
'/Libraries/LibraryRegistration/LibraryRegistration')local function waitForChild
|
||||
(c,d)while not c:FindFirstChild(d)do c.ChildAdded:wait()end end local c=game:
|
||||
GetService'ScriptContext'c:AddCoreScript(59002209,c,'CoreScripts/Sections')
|
||||
waitForChild(game:GetService'CoreGui','RobloxGui')local d=game:GetService
|
||||
'CoreGui':FindFirstChild'RobloxGui'if not b then c:AddCoreScript(36868950,d,
|
||||
'CoreScripts/ToolTip')c:AddCoreScript(46295863,d,'CoreScripts/Settings')else c:
|
||||
AddCoreScript(153556783,d,'CoreScripts/TouchControls')end c:AddCoreScript(
|
||||
39250920,d,'CoreScripts/MainBotChatScript')c:AddCoreScript(48488451,d,
|
||||
'CoreScripts/PopupScript')c:AddCoreScript(48488398,d,
|
||||
'CoreScripts/NotificationScript')c:AddCoreScript(97188756,d,
|
||||
'CoreScripts/ChatScript')c:AddCoreScript(107893730,d,
|
||||
'CoreScripts/PurchasePromptScript')if not b or d.AbsoluteSize.Y>600 then c:
|
||||
AddCoreScript(48488235,d,'CoreScripts/PlayerListScript')else delay(5,function()
|
||||
if d.AbsoluteSize.Y>=600 then c:AddCoreScript(48488235,d,
|
||||
'CoreScripts/PlayerListScript')end end)end if game.CoreGui.Version>=3 and game.
|
||||
PlaceId~=130815926 then c:AddCoreScript(53878047,d,
|
||||
'CoreScripts/BackpackScripts/BackpackBuilder')waitForChild(d,'CurrentLoadout')
|
||||
waitForChild(d,'Backpack')local e=d.Backpack if game.CoreGui.Version>=7 then c:
|
||||
AddCoreScript(89449093,e,'CoreScripts/BackpackScripts/BackpackManager')end game:
|
||||
GetService'ScriptContext':AddCoreScript(89449008,e,
|
||||
'CoreScripts/BackpackScripts/BackpackGear')c:AddCoreScript(53878057,d.
|
||||
CurrentLoadout,'CoreScripts/BackpackScripts/LoadoutScript')if game.CoreGui.
|
||||
Version>=8 then c:AddCoreScript(-1,e,
|
||||
'CoreScripts/BackpackScripts/BackpackWardrobe')end end local e=not not game.
|
||||
Workspace:FindFirstChild'PSVariable'if e then game:GetService'ScriptContext':
|
||||
AddCoreScript(64164692,game.Players.LocalPlayer,'BuildToolManager')end game.
|
||||
Workspace.ChildAdded:connect(function(f)if f.Name=='PSVariable'and f:IsA
|
||||
'BoolValue'then e=true game:GetService'ScriptContext':AddCoreScript(64164692,
|
||||
game.Players.LocalPlayer,'BuildToolManager')end end)if b then c:AddCoreScript(
|
||||
152908679,d,'CoreScripts/ContextActionTouch')waitForChild(d,'ControlFrame')
|
||||
waitForChild(d.ControlFrame,'BottomLeftControl')d.ControlFrame.BottomLeftControl
|
||||
.Visible=false waitForChild(d.ControlFrame,'TopLeftControl')d.ControlFrame.
|
||||
TopLeftControl.Visible=false end
|
||||
print("[Mercury]: Loaded corescript 37801172")
|
||||
local scriptContext = game:GetService("ScriptContext")
|
||||
local touchEnabled = false
|
||||
pcall(function()
|
||||
touchEnabled = game:GetService("UserInputService").TouchEnabled
|
||||
end)
|
||||
scriptContext:AddCoreScript(60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration")
|
||||
local waitForChild
|
||||
waitForChild = function(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
scriptContext = game:GetService("ScriptContext")
|
||||
scriptContext:AddCoreScript(59002209, scriptContext, "CoreScripts/Sections")
|
||||
waitForChild(game:GetService("CoreGui"), "RobloxGui")
|
||||
local screenGui = game:GetService("CoreGui"):FindFirstChild("RobloxGui")
|
||||
if not touchEnabled then
|
||||
scriptContext:AddCoreScript(36868950, screenGui, "CoreScripts/ToolTip")
|
||||
scriptContext:AddCoreScript(46295863, screenGui, "CoreScripts/Settings")
|
||||
else
|
||||
scriptContext:AddCoreScript(153556783, screenGui, "CoreScripts/TouchControls")
|
||||
end
|
||||
scriptContext:AddCoreScript(39250920, screenGui, "CoreScripts/MainBotChatScript")
|
||||
scriptContext:AddCoreScript(48488451, screenGui, "CoreScripts/PopupScript")
|
||||
scriptContext:AddCoreScript(48488398, screenGui, "CoreScripts/NotificationScript")
|
||||
scriptContext:AddCoreScript(97188756, screenGui, "CoreScripts/ChatScript")
|
||||
scriptContext:AddCoreScript(107893730, screenGui, "CoreScripts/PurchasePromptScript")
|
||||
if not touchEnabled or screenGui.AbsoluteSize.Y > 600 then
|
||||
scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
||||
else
|
||||
delay(5, function()
|
||||
if screenGui.AbsoluteSize.Y >= 600 then
|
||||
return scriptContext:AddCoreScript(48488235, screenGui, "CoreScripts/PlayerListScript")
|
||||
end
|
||||
end)
|
||||
end
|
||||
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 then
|
||||
scriptContext:AddCoreScript(53878047, screenGui, "CoreScripts/BackpackScripts/BackpackBuilder")
|
||||
waitForChild(screenGui, "CurrentLoadout")
|
||||
waitForChild(screenGui, "Backpack")
|
||||
local Backpack = screenGui.Backpack
|
||||
if game.CoreGui.Version >= 7 then
|
||||
scriptContext:AddCoreScript(89449093, Backpack, "CoreScripts/BackpackScripts/BackpackManager")
|
||||
end
|
||||
scriptContext:AddCoreScript(89449008, Backpack, "CoreScripts/BackpackScripts/BackpackGear")
|
||||
scriptContext:AddCoreScript(53878057, screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript")
|
||||
if game.CoreGui.Version >= 8 then
|
||||
scriptContext:AddCoreScript(-1, Backpack, "CoreScripts/BackpackScripts/BackpackWardrobe")
|
||||
end
|
||||
end
|
||||
local IsPersonalServer = not not game.Workspace:FindFirstChild("PSVariable")
|
||||
if IsPersonalServer then
|
||||
scriptContext:AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||
end
|
||||
game.Workspace.ChildAdded:connect(function(nchild)
|
||||
if nchild.Name == "PSVariable" and nchild:IsA("BoolValue") then
|
||||
IsPersonalServer = true
|
||||
return scriptContext:AddCoreScript(64164692, game.Players.LocalPlayer, "BuildToolManager")
|
||||
end
|
||||
end)
|
||||
if touchEnabled then
|
||||
scriptContext:AddCoreScript(152908679, screenGui, "CoreScripts/ContextActionTouch")
|
||||
waitForChild(screenGui, "ControlFrame")
|
||||
waitForChild(screenGui.ControlFrame, "BottomLeftControl")
|
||||
screenGui.ControlFrame.BottomLeftControl.Visible = false
|
||||
waitForChild(screenGui.ControlFrame, "TopLeftControl")
|
||||
screenGui.ControlFrame.TopLeftControl.Visible = false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,48 +1,231 @@
|
|||
local a,b=5,5 function waitForChild(c,d)local e=c:findFirstChild(d)if e then
|
||||
return e end while true do e=c.ChildAdded:wait()if e.Name==d then return e end
|
||||
end end local c=script.Parent local d,e,f,g=waitForChild(c,'Humanoid'),
|
||||
waitForChild(c,'Torso'),c:FindFirstChild'PlayerStats',Instance.new'BoolValue'g.
|
||||
Name='InCharTag'local h=Instance.new'BoolValue'h.Name='RobloxBuildTool'local i,j
|
||||
if f==nil then f=Instance.new'Configuration'f.Parent=c f.Name='PlayerStats'end
|
||||
local k=f:FindFirstChild'MaxHealth'if k==nil then k=Instance.new'NumberValue'k.
|
||||
Parent=f k.Value=100 k.Name='MaxHealth'end d.MaxHealth=k.Value d.Health=k.Value
|
||||
function onMaxHealthChange()d.MaxHealth=k.Value d.Health=k.Value end k.Changed:
|
||||
connect(onMaxHealthChange)local l=game.Players:GetPlayerFromCharacter(script.
|
||||
Parent)local m=l.PlayerGui:FindFirstChild'DamageOverTimeGui'if m==nil then m=
|
||||
Instance.new'BillboardGui'm.Name='DamageOverTimeGui'm.Parent=l.PlayerGui m.
|
||||
Adornee=script.Parent:FindFirstChild'Head'm.Active=true m.size=UDim2.new(a,0,b,0
|
||||
)m.StudsOffset=Vector3.new(0,2,0)end print'newHealth declarations finished'
|
||||
function billboardHealthChange(n)local o=Instance.new'TextLabel'if n>0 then o.
|
||||
Text=tostring(n)o.TextColor3=Color3.new(0,1,0)else o.Text=tostring(n)o.
|
||||
TextColor3=Color3.new(1,0,1)end o.size=UDim2.new(1,0,1,0)o.Active=true o.
|
||||
FontSize=6 o.BackgroundTransparency=1 o.Parent=m for p=1,10 do wait(0.1)o.
|
||||
TextTransparency=p/10 o.Position=UDim2.new(0,0,0,-p*5)o.FontSize=6-p*0.6 end o:
|
||||
remove()end function setMaxHealth()if k.Value>=0 then d.MaxHealth=k.Value print(
|
||||
d.MaxHealth)if d.Health>d.MaxHealth then d.Health=d.MaxHealth end end end k.
|
||||
Changed:connect(setMaxHealth)local n=Instance.new'Fire'n.Heat=0.1 n.Size=3 n.
|
||||
Name='FireEffect'n.Enabled=false while true do local o,p=wait(1),d.Health if p>0
|
||||
then local q=0 if f then local r,s,t,u,v=f:FindFirstChild'Regen',f:
|
||||
FindFirstChild'Poison',f:FindFirstChild'Ice',f:FindFirstChild'Fire',f:
|
||||
FindFirstChild'Stun'if r then q=q+r.Value.X if r.Value.Y>=0 then r.Value=Vector3
|
||||
.new(r.Value.X+r.Value.Z,r.Value.Y-o,r.Value.Z)elseif r.Value.Y==-1 then r.Value
|
||||
=Vector3.new(r.Value.X+r.Value.Z,-1,r.Value.Z)else r:remove()end end if s then q
|
||||
=q-s.Value.X if s.Value.Y>=0 then s.Value=Vector3.new(s.Value.X+s.Value.Z,s.
|
||||
Value.Y-o,s.Value.Z)elseif s.Value.Y==-1 then s.Value=Vector3.new(s.Value.X+s.
|
||||
Value.Z,-1,s.Value.Z)else s:remove()end end if t then q=q-t.Value.X if t.Value.Y
|
||||
>=0 then t.Value=Vector3.new(t.Value.X,t.Value.Y-o,t.Value.Z)else t:remove()end
|
||||
end if u then n.Enabled=true n.Parent=c.Torso q=q-u.Value.X if u.Value.Y>=0 then
|
||||
u.Value=Vector3.new(u.Value.X,u.Value.Y-o,u.Value.Z)else u:remove()n.Enabled=
|
||||
false n.Parent=nil end end if v then if v.Value>0 then e.Anchored=true i=script.
|
||||
Parent:GetChildren()j=game.Players:GetPlayerFromCharacter(script.Parent).
|
||||
Backpack:GetChildren()for w=1,#i do if i[w].className=='Tool'then g:Clone().
|
||||
Parent=i[w]print(j)table.insert(j,i[w])end end for w=1,#j do if j[w]:
|
||||
FindFirstChild'RobloxBuildTool'==nil then h:Clone().Parent=j[w]j[w].Parent=game.
|
||||
Lighting end end wait(0.2)for w=1,#j do j[w].Parent=game.Players:
|
||||
GetPlayerFromCharacter(script.Parent).Backpack end v.Value=v.Value-o else e.
|
||||
Anchored=false for w=1,#j do local x=j[w]:FindFirstChild'RobloxBuildTool'if x
|
||||
then x:Remove()end j[w].Parent=game.Lighting end wait(0.2)for w=1,#j do local x=
|
||||
j[w]:FindFirstChild'InCharTag'if x then x:Remove()j[w].Parent=script.Parent else
|
||||
j[w].Parent=game.Players:GetPlayerFromCharacter(script.Parent).Backpack end end
|
||||
v:Remove()end end if q~=0 then coroutine.resume(coroutine.create(
|
||||
billboardHealthChange),q)end end p=d.Health+q*o if p*1.01<d.MaxHealth then d.
|
||||
Health=p elseif q>0 then d.Health=d.MaxHealth end end end
|
||||
print("[Mercury]: Loaded corescript 38037565")
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local damageGuiWidth = 5.0
|
||||
local damageGuiHeight = 5.0
|
||||
local waitForChild
|
||||
waitForChild = function(parent, childName)
|
||||
local child = parent:findFirstChild(childName)
|
||||
if child then
|
||||
return child
|
||||
end
|
||||
while true do
|
||||
child = parent.ChildAdded:wait()
|
||||
if child.Name == childName then
|
||||
return child
|
||||
end
|
||||
end
|
||||
end
|
||||
local Figure = script.Parent
|
||||
local Humanoid = waitForChild(Figure, "Humanoid")
|
||||
local Torso = waitForChild(Figure, "Torso")
|
||||
local config = Figure:FindFirstChild("PlayerStats")
|
||||
local inCharTag = Instance.new("BoolValue")
|
||||
inCharTag.Name = "InCharTag"
|
||||
local hider = Instance.new("BoolValue")
|
||||
hider.Name = "RobloxBuildTool"
|
||||
if not (config ~= nil) then
|
||||
config = New("Configuration", "PlayerStats", {
|
||||
Parent = Figure
|
||||
})
|
||||
end
|
||||
local myHealth = config:FindFirstChild("MaxHealth")
|
||||
if not (myHealth ~= nil) then
|
||||
myHealth = New("NumberValue", "MaxHealth", {
|
||||
Value = 100,
|
||||
Parent = config
|
||||
})
|
||||
end
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
local onMaxHealthChange
|
||||
onMaxHealthChange = function()
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
Humanoid.Health = myHealth.Value
|
||||
end
|
||||
myHealth.Changed:connect(onMaxHealthChange)
|
||||
local vPlayer = game.Players:GetPlayerFromCharacter(script.Parent)
|
||||
local dotGui = vPlayer.PlayerGui:FindFirstChild("DamageOverTimeGui")
|
||||
if not (dotGui ~= nil) then
|
||||
dotGui = New("BillboardGui", "DamageOverTimeGui", {
|
||||
Parent = vPlayer.PlayerGui,
|
||||
Adornee = script.Parent:FindFirstChild("Head"),
|
||||
Active = true,
|
||||
size = UDim2.new(damageGuiWidth, 0, damageGuiHeight, 0.0),
|
||||
StudsOffset = Vector3.new(0, 2.0, 0.0)
|
||||
})
|
||||
end
|
||||
print("newHealth declarations finished")
|
||||
local billboardHealthChange
|
||||
billboardHealthChange = function(dmg)
|
||||
local textLabel = New("TextLabel", {
|
||||
Text = tostring(dmg),
|
||||
TextColor3 = (function()
|
||||
if dmg > 0 then
|
||||
return Color3.new(0, 1, 0)
|
||||
else
|
||||
return Color3.new(1, 0, 1)
|
||||
end
|
||||
end)(),
|
||||
size = UDim2.new(1, 0, 1, 0.0),
|
||||
Active = true,
|
||||
FontSize = 6,
|
||||
BackgroundTransparency = 1,
|
||||
Parent = dotGui
|
||||
})
|
||||
for t = 1, 10 do
|
||||
wait(0.1)
|
||||
textLabel.TextTransparency = t / 10
|
||||
textLabel.Position = UDim2.new(0, 0, 0, -t * 5)
|
||||
textLabel.FontSize = 6 - t * 0.6
|
||||
end
|
||||
return textLabel:remove()
|
||||
end
|
||||
local setMaxHealth
|
||||
setMaxHealth = function()
|
||||
if myHealth.Value >= 0 then
|
||||
Humanoid.MaxHealth = myHealth.Value
|
||||
print(Humanoid.MaxHealth)
|
||||
if Humanoid.Health > Humanoid.MaxHealth then
|
||||
Humanoid.Health = Humanoid.MaxHealth
|
||||
end
|
||||
end
|
||||
end
|
||||
myHealth.Changed:connect(setMaxHealth)
|
||||
local fireEffect = New("Fire", "FireEffect", {
|
||||
Heat = 0.1,
|
||||
Size = 3.0,
|
||||
Enabled = false
|
||||
})
|
||||
while true do
|
||||
local s = wait(1)
|
||||
local health = Humanoid.Health
|
||||
if health > 0 then
|
||||
local delta = 0
|
||||
if config then
|
||||
local regen = config:FindFirstChild("Regen")
|
||||
local poison = config:FindFirstChild("Poison")
|
||||
local ice = config:FindFirstChild("Ice")
|
||||
local fire = config:FindFirstChild("Fire")
|
||||
local stun = config:FindFirstChild("Stun")
|
||||
if regen then
|
||||
delta = delta + regen.Value.X
|
||||
if regen.Value.Y >= 0 then
|
||||
regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, regen.Value.Y - s, regen.Value.Z)
|
||||
elseif regen.Value.Y == -1 then
|
||||
regen.Value = Vector3.new(regen.Value.X + regen.Value.Z, -1, regen.Value.Z)
|
||||
else
|
||||
regen:remove()
|
||||
end
|
||||
end
|
||||
if poison then
|
||||
delta = delta - poison.Value.X
|
||||
if poison.Value.Y >= 0 then
|
||||
poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, poison.Value.Y - s, poison.Value.Z)
|
||||
elseif poison.Value.Y == -1 then
|
||||
poison.Value = Vector3.new(poison.Value.X + poison.Value.Z, -1, poison.Value.Z)
|
||||
else
|
||||
poison:remove()
|
||||
end
|
||||
end
|
||||
if ice then
|
||||
delta = delta - ice.Value.X
|
||||
if ice.Value.Y >= 0 then
|
||||
ice.Value = Vector3.new(ice.Value.X, ice.Value.Y - s, ice.Value.Z)
|
||||
else
|
||||
ice:remove()
|
||||
end
|
||||
end
|
||||
if fire then
|
||||
fireEffect.Enabled = true
|
||||
fireEffect.Parent = Figure.Torso
|
||||
delta = delta - fire.Value.X
|
||||
if fire.Value.Y >= 0 then
|
||||
fire.Value = Vector3.new(fire.Value.X, fire.Value.Y - s, fire.Value.Z)
|
||||
else
|
||||
fire:remove()
|
||||
fireEffect.Enabled = false
|
||||
fireEffect.Parent = nil
|
||||
end
|
||||
end
|
||||
if stun then
|
||||
local backpackTools
|
||||
if stun.Value > 0 then
|
||||
Torso.Anchored = true
|
||||
local currentChildren = script.Parent:GetChildren()
|
||||
backpackTools = game.Players:GetPlayerFromCharacter(script.Parent).Backpack:GetChildren()
|
||||
for i = 1, #currentChildren do
|
||||
if currentChildren[i].className == "Tool" then
|
||||
inCharTag:Clone().Parent = currentChildren[i]
|
||||
print(backpackTools)
|
||||
table.insert(backpackTools, currentChildren[i])
|
||||
end
|
||||
end
|
||||
for i = 1, #backpackTools do
|
||||
if not (backpackTools[i]:FindFirstChild("RobloxBuildTool") ~= nil) then
|
||||
hider:Clone().Parent = backpackTools[i]
|
||||
backpackTools[i].Parent = game.Lighting
|
||||
end
|
||||
end
|
||||
wait(0.2)
|
||||
for i = 1, #backpackTools do
|
||||
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
||||
end
|
||||
stun.Value = stun.Value - s
|
||||
else
|
||||
Torso.Anchored = false
|
||||
for i = 1, #backpackTools do
|
||||
local rbTool = backpackTools[i]:FindFirstChild("RobloxBuildTool")
|
||||
if rbTool then
|
||||
rbTool:Remove()
|
||||
end
|
||||
backpackTools[i].Parent = game.Lighting
|
||||
end
|
||||
wait(0.2)
|
||||
for i = 1, #backpackTools do
|
||||
local wasInChar = backpackTools[i]:FindFirstChild("InCharTag")
|
||||
if wasInChar then
|
||||
wasInChar:Remove()
|
||||
backpackTools[i].Parent = script.Parent
|
||||
else
|
||||
backpackTools[i].Parent = game.Players:GetPlayerFromCharacter(script.Parent).Backpack
|
||||
end
|
||||
end
|
||||
stun:Remove()
|
||||
end
|
||||
end
|
||||
if delta ~= 0 then
|
||||
coroutine.resume(coroutine.create(billboardHealthChange), delta)
|
||||
end
|
||||
end
|
||||
health = Humanoid.Health + delta * s
|
||||
if health * 1.01 < Humanoid.MaxHealth then
|
||||
Humanoid.Health = health
|
||||
elseif delta > 0 then
|
||||
Humanoid.Health = Humanoid.MaxHealth
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,142 +1,542 @@
|
|||
function waitForProperty(a,b)while not a[b]do a.Changed:wait()end end function
|
||||
waitForChild(a,b)while not a:FindFirstChild(b)do a.ChildAdded:wait()end end
|
||||
local a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=nil,{},nil,{},nil,nil,nil,
|
||||
'You are too far away to chat!',300,'Chat ended because you walked away',350,
|
||||
"Chat ended because you didn't reply",350,nil,nil,nil,nil,nil,{},{},nil
|
||||
waitForChild(game,'CoreGui')waitForChild(game.CoreGui,'RobloxGui')if game.
|
||||
CoreGui.RobloxGui:FindFirstChild'ControlFrame'then u=game.CoreGui.RobloxGui.
|
||||
ControlFrame else u=game.CoreGui.RobloxGui end function currentTone()if e then
|
||||
return e.Tone else return Enum.DialogTone.Neutral end end function
|
||||
createChatNotificationGui()o=Instance.new'BillboardGui'o.Name=
|
||||
'ChatNotificationGui'o.ExtentsOffset=Vector3.new(0,1,0)o.Size=UDim2.new(4,0,
|
||||
5.42857122,0)o.SizeOffset=Vector2.new(0,0)o.StudsOffset=Vector3.new(0.4,4.3,0)o.
|
||||
Enabled=true o.RobloxLocked=true o.Active=true local v=Instance.new'ImageLabel'v
|
||||
.Name='Image'v.Active=false v.BackgroundTransparency=1 v.Position=UDim2.new(0,0,
|
||||
0,0)v.Size=UDim2.new(1,0,1,0)v.Image=''v.RobloxLocked=true v.Parent=o local w=
|
||||
Instance.new'ImageButton'w.Name='Button'w.AutoButtonColor=false w.Position=UDim2
|
||||
.new(0.0879999995,0,0.0529999994,0)w.Size=UDim2.new(0.829999983,0,0.460000008,0)
|
||||
w.Image=''w.BackgroundTransparency=1 w.RobloxLocked=true w.Parent=v end function
|
||||
getChatColor(v)if v==Enum.DialogTone.Neutral then return Enum.ChatColor.Blue
|
||||
elseif v==Enum.DialogTone.Friendly then return Enum.ChatColor.Green elseif v==
|
||||
Enum.DialogTone.Enemy then return Enum.ChatColor.Red end end function
|
||||
styleChoices(v)for w,x in pairs(b)do resetColor(x,v)end resetColor(c,v)end
|
||||
function styleMainFrame(v)if v==Enum.DialogTone.Neutral then a.Style=Enum.
|
||||
FrameStyle.ChatBlue a.Tail.Image=
|
||||
'rbxasset://textures/chatBubble_botBlue_tailRight.png'elseif v==Enum.DialogTone.
|
||||
Friendly then a.Style=Enum.FrameStyle.ChatGreen a.Tail.Image=
|
||||
'rbxasset://textures/chatBubble_botGreen_tailRight.png'elseif v==Enum.DialogTone
|
||||
.Enemy then a.Style=Enum.FrameStyle.ChatRed a.Tail.Image=
|
||||
'rbxasset://textures/chatBubble_botRed_tailRight.png'end styleChoices(v)end
|
||||
function setChatNotificationTone(v,w,x)if x==Enum.DialogTone.Neutral then v.
|
||||
Image.Image='rbxasset://textures/chatBubble_botBlue_notify_bkg.png'elseif x==
|
||||
Enum.DialogTone.Friendly then v.Image.Image=
|
||||
'rbxasset://textures/chatBubble_botGreen_notify_bkg.png'elseif x==Enum.
|
||||
DialogTone.Enemy then v.Image.Image=
|
||||
'rbxasset://textures/chatBubble_botRed_notify_bkg.png'end if w==Enum.
|
||||
DialogPurpose.Quest then v.Image.Button.Image=
|
||||
'rbxasset://textures/chatBubble_bot_notify_bang.png'elseif w==Enum.DialogPurpose
|
||||
.Help then v.Image.Button.Image=
|
||||
'rbxasset://textures/chatBubble_bot_notify_question.png'elseif w==Enum.
|
||||
DialogPurpose.Shop then v.Image.Button.Image=
|
||||
'rbxasset://textures/chatBubble_bot_notify_money.png'end end function
|
||||
createMessageDialog()p=Instance.new'Frame'p.Name='DialogScriptMessage'p.Style=
|
||||
Enum.FrameStyle.RobloxRound p.Visible=false local v=Instance.new'TextLabel'v.
|
||||
Name='Text'v.Position=UDim2.new(0,0,0,-1)v.Size=UDim2.new(1,0,1,0)v.FontSize=
|
||||
Enum.FontSize.Size14 v.BackgroundTransparency=1 v.TextColor3=Color3.new(1,1,1)v.
|
||||
RobloxLocked=true v.Parent=p end function showMessage(v,w)p.Text.Text=v p.Size=
|
||||
UDim2.new(0,w,0,40)p.Position=UDim2.new(0.5,-w/2,0.5,-40)p.Visible=true wait(2)p
|
||||
.Visible=false end function variableDelay(v)local w=math.min(string.len(v),100)
|
||||
wait(0.75+((w/75)*1.5))end function resetColor(v,w)if w==Enum.DialogTone.Neutral
|
||||
then v.BackgroundColor3=Color3.new(0,0,0.7019607843137254)v.Number.TextColor3=
|
||||
Color3.new(0.17647058823529413,0.5568627450980392,0.9607843137254902)elseif w==
|
||||
Enum.DialogTone.Friendly then v.BackgroundColor3=Color3.new(0,
|
||||
0.30196078431372547,0)v.Number.TextColor3=Color3.new(0,0.7450980392156863,0)
|
||||
elseif w==Enum.DialogTone.Enemy then v.BackgroundColor3=Color3.new(
|
||||
0.5490196078431373,0,0)v.Number.TextColor3=Color3.new(1,0.34509803921568627,
|
||||
0.30980392156862746)end end function highlightColor(v,w)if w==Enum.DialogTone.
|
||||
Neutral then v.BackgroundColor3=Color3.new(7.8431372549019605E-3,
|
||||
0.4235294117647059,1)v.Number.TextColor3=Color3.new(1,1,1)elseif w==Enum.
|
||||
DialogTone.Friendly then v.BackgroundColor3=Color3.new(0,0.5019607843137255,0)v.
|
||||
Number.TextColor3=Color3.new(1,1,1)elseif w==Enum.DialogTone.Enemy then v.
|
||||
BackgroundColor3=Color3.new(0.8,0,0)v.Number.TextColor3=Color3.new(1,1,1)end end
|
||||
function endDialog()if g then g:Remove()g=nil end local v=e e=nil if v and v.
|
||||
InUse then local w=r:Clone()w.archivable=false w.Disabled=false w.Parent=v end
|
||||
for w,x in pairs(s)do if w and x then x.Enabled=not w.InUse end end f=nil end
|
||||
function wanderDialog()print'Wander'a.Visible=false endDialog()showMessage(j,k)
|
||||
end function timeoutDialog()print'Timeout'a.Visible=false endDialog()
|
||||
showMessage(l,m)end function normalEndDialog()print'Done'endDialog()end function
|
||||
sanitizeMessage(w)if string.len(w)==0 then return'...'else return w end end
|
||||
function selectChoice(w)renewKillswitch(e)a.Visible=false if w==c then game.Chat
|
||||
:Chat(game.Players.LocalPlayer.Character,'Goodbye!',getChatColor(currentTone()))
|
||||
normalEndDialog()else local x=d[w]game.Chat:Chat(game.Players.LocalPlayer.
|
||||
Character,sanitizeMessage(x.UserDialog),getChatColor(currentTone()))wait(1)e:
|
||||
SignalDialogChoiceSelected(n,x)game.Chat:Chat(f,sanitizeMessage(x.ResponseDialog
|
||||
),getChatColor(currentTone()))variableDelay(x.ResponseDialog)
|
||||
presentDialogChoices(f,x:GetChildren())end end function newChoice(w)local x=
|
||||
Instance.new'TextButton'x.BackgroundColor3=Color3.new(0,0,0.7019607843137254)x.
|
||||
AutoButtonColor=false x.BorderSizePixel=0 x.Text=''x.MouseEnter:connect(function
|
||||
()highlightColor(x,currentTone())end)x.MouseLeave:connect(function()resetColor(x
|
||||
,currentTone())end)x.MouseButton1Click:connect(function()selectChoice(x)end)x.
|
||||
RobloxLocked=true local y=Instance.new'TextLabel'y.Name='Number'y.TextColor3=
|
||||
Color3.new(0.4980392156862745,0.8313725490196079,1)y.Text=w y.FontSize=Enum.
|
||||
FontSize.Size14 y.BackgroundTransparency=1 y.Position=UDim2.new(0,4,0,2)y.Size=
|
||||
UDim2.new(0,20,0,24)y.TextXAlignment=Enum.TextXAlignment.Left y.TextYAlignment=
|
||||
Enum.TextYAlignment.Top y.RobloxLocked=true y.Parent=x local z=Instance.new
|
||||
'TextLabel'z.Name='UserPrompt'z.BackgroundTransparency=1 z.TextColor3=Color3.
|
||||
new(1,1,1)z.FontSize=Enum.FontSize.Size14 z.Position=UDim2.new(0,28,0,2)z.Size=
|
||||
UDim2.new(1,-32,1,-4)z.TextXAlignment=Enum.TextXAlignment.Left z.TextYAlignment=
|
||||
Enum.TextYAlignment.Top z.TextWrap=true z.RobloxLocked=true z.Parent=x return x
|
||||
end function initialize(w)b[1]=newChoice'1)'b[2]=newChoice'2)'b[3]=newChoice'3)'
|
||||
b[4]=newChoice'4)'c=newChoice'5)'c.UserPrompt.Text='Goodbye!'c.Size=UDim2.new(1,
|
||||
0,0,28)a=Instance.new'Frame'a.Name='UserDialogArea'a.Size=UDim2.new(0,350,0,200)
|
||||
a.Style=Enum.FrameStyle.ChatBlue a.Visible=false local x=Instance.new
|
||||
'ImageLabel'x.Name='Tail'x.Size=UDim2.new(0,62,0,53)x.Position=UDim2.new(1,8,
|
||||
0.25)x.Image='rbxasset://textures/chatBubble_botBlue_tailRight.png'x.
|
||||
BackgroundTransparency=1 x.RobloxLocked=true x.Parent=a for y,z in pairs(b)do z.
|
||||
RobloxLocked=true z.Parent=a end c.RobloxLocked=true c.Parent=a a.RobloxLocked=
|
||||
true a.Parent=w end function presentDialogChoices(w,x)if not e then return end f
|
||||
=w local y={}for z,A in pairs(x)do if A:IsA'DialogChoice'then table.insert(y,A)
|
||||
end end table.sort(y,function(B,C)return B.Name<C.Name end)if#y==0 then
|
||||
normalEndDialog()return end local B,C=1,0 d={}for D,E in pairs(b)do E.Visible=
|
||||
false end for F,G in pairs(y)do if B<=#b then b[B].Size=UDim2.new(1,0,0,72)b[B].
|
||||
UserPrompt.Text=G.UserDialog local H=math.ceil(b[B].UserPrompt.TextBounds.Y/24)*
|
||||
24 b[B].Position=UDim2.new(0,0,0,C)b[B].Size=UDim2.new(1,0,0,H)b[B].Visible=true
|
||||
d[b[B]]=G C=C+H B=B+1 end end c.Position=UDim2.new(0,0,0,C)c.Number.Text=B..')'a
|
||||
.Size=UDim2.new(0,350,0,C+24+32)a.Position=UDim2.new(0,20,0,-a.Size.Y.Offset-20)
|
||||
styleMainFrame(currentTone())a.Visible=true end function doDialog(w)while not
|
||||
Instance.Lock(w,n)do wait()end if w.InUse then Instance.Unlock(w)return else w.
|
||||
InUse=true Instance.Unlock(w)end e=w game.Chat:Chat(w.Parent,w.InitialPrompt,
|
||||
getChatColor(w.Tone))variableDelay(w.InitialPrompt)presentDialogChoices(w.Parent
|
||||
,w:GetChildren())end function renewKillswitch(w)if g then g:Remove()g=nil end g=
|
||||
q:Clone()g.archivable=false g.Disabled=false g.Parent=w end function
|
||||
checkForLeaveArea()while e do if e.Parent and(n:DistanceFromCharacter(e.Parent.
|
||||
Position)>=e.ConversationDistance)then wanderDialog()end wait(1)end end function
|
||||
startDialog(w)if w.Parent and w.Parent:IsA'BasePart'then if n:
|
||||
DistanceFromCharacter(w.Parent.Position)>=w.ConversationDistance then
|
||||
showMessage(h,i)return end for x,y in pairs(s)do if x and y then y.Enabled=false
|
||||
end end renewKillswitch(x)delay(1,checkForLeaveArea)doDialog(x)end end function
|
||||
removeDialog(w)if s[w]then s[w]:Remove()s[w]=nil end if t[w]then t[w]:
|
||||
disconnect()t[w]=nil end end function addDialog(w)if w.Parent then if w.Parent:
|
||||
IsA'BasePart'then local x=o:clone()x.Enabled=not w.InUse x.Adornee=w.Parent x.
|
||||
RobloxLocked=true x.Parent=game.CoreGui x.Image.Button.MouseButton1Click:
|
||||
connect(function()startDialog(w)end)setChatNotificationTone(x,w.Purpose,w.Tone)s
|
||||
[w]=x t[w]=w.Changed:connect(function(y)if y=='Parent'and w.Parent then
|
||||
removeDialog(w)addDialog(w)elseif y=='InUse'then x.Enabled=not e and not w.InUse
|
||||
if w==e then timeoutDialog()end elseif y=='Tone'or y=='Purpose'then
|
||||
setChatNotificationTone(x,w.Purpose,w.Tone)end end)else t[w]=w.Changed:connect(
|
||||
function(x)if x=='Parent'and w.Parent then removeDialog(w)addDialog(w)end end)
|
||||
end end end function fetchScripts()local w=game:GetService'InsertService':
|
||||
LoadAsset(39226062)if type(w)=='string'then wait(0.1)w=game:GetService
|
||||
'InsertService':LoadAsset(39226062)end if type(w)=='string'then return end
|
||||
waitForChild(w,'TimeoutScript')q=w.TimeoutScript waitForChild(w,
|
||||
'ReenableDialogScript')r=w.ReenableDialogScript end function onLoad()
|
||||
waitForProperty(game.Players,'LocalPlayer')n=game.Players.LocalPlayer
|
||||
waitForProperty(n,'Character')fetchScripts()createChatNotificationGui()
|
||||
createMessageDialog()p.RobloxLocked=true p.Parent=u waitForChild(u,
|
||||
'BottomLeftControl')local w=Instance.new'Frame'w.Name='DialogFrame'w.Position=
|
||||
UDim2.new(0,0,0,0)w.Size=UDim2.new(0,0,0,0)w.BackgroundTransparency=1 w.
|
||||
RobloxLocked=true w.Parent=u.BottomLeftControl initialize(w)game.
|
||||
CollectionService.ItemAdded:connect(function(x)if x:IsA'Dialog'then addDialog(x)
|
||||
end end)game.CollectionService.ItemRemoved:connect(function(x)if x:IsA'Dialog'
|
||||
then removeDialog(x)end end)for x,y in pairs(game.CollectionService:
|
||||
GetCollection'Dialog')do if y:IsA'Dialog'then addDialog(y)end end end onLoad()
|
||||
print("[Mercury]: Loaded corescript 39250920")
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local waitForProperty
|
||||
waitForProperty = function(instance, name)
|
||||
while not instance[name] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
local waitForChild
|
||||
waitForChild = function(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
local mainFrame
|
||||
local choices = { }
|
||||
local lastChoice
|
||||
local choiceMap = { }
|
||||
local currentConversationDialog
|
||||
local currentConversationPartner
|
||||
local currentAbortDialogScript
|
||||
local tooFarAwayMessage = "You are too far away to chat!"
|
||||
local tooFarAwaySize = 300
|
||||
local characterWanderedOffMessage = "Chat ended because you walked away"
|
||||
local characterWanderedOffSize = 350
|
||||
local conversationTimedOut = "Chat ended because you didn't reply"
|
||||
local conversationTimedOutSize = 350
|
||||
local player
|
||||
local chatNotificationGui
|
||||
local messageDialog
|
||||
local timeoutScript
|
||||
local reenableDialogScript
|
||||
local dialogMap = { }
|
||||
local dialogConnections = { }
|
||||
local gui
|
||||
waitForChild(game, "CoreGui")
|
||||
waitForChild(game.CoreGui, "RobloxGui")
|
||||
if game.CoreGui.RobloxGui:FindFirstChild("ControlFrame") then
|
||||
gui = game.CoreGui.RobloxGui.ControlFrame
|
||||
else
|
||||
gui = game.CoreGui.RobloxGui
|
||||
end
|
||||
local currentTone
|
||||
currentTone = function()
|
||||
if currentConversationDialog then
|
||||
return currentConversationDialog.Tone
|
||||
else
|
||||
return Enum.DialogTone.Neutral
|
||||
end
|
||||
end
|
||||
local createChatNotificationGui
|
||||
createChatNotificationGui = function()
|
||||
chatNotificationGui = New("BillboardGui", "ChatNotificationGui", {
|
||||
ExtentsOffset = Vector3.new(0, 1, 0),
|
||||
Size = UDim2.new(4, 0, 5.42857122, 0),
|
||||
SizeOffset = Vector2.new(0, 0),
|
||||
StudsOffset = Vector3.new(0.4, 4.3, 0),
|
||||
Enabled = true,
|
||||
RobloxLocked = true,
|
||||
Active = true,
|
||||
New("ImageLabel", "Image", {
|
||||
Active = false,
|
||||
BackgroundTransparency = 1,
|
||||
Position = UDim2.new(0, 0, 0, 0),
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Image = "",
|
||||
RobloxLocked = true,
|
||||
New("ImageButton", "Button", {
|
||||
AutoButtonColor = false,
|
||||
Position = UDim2.new(0.088, 0, 0.053, 0),
|
||||
Size = UDim2.new(0.83, 0, 0.46, 0),
|
||||
Image = "",
|
||||
BackgroundTransparency = 1,
|
||||
RobloxLocked = true
|
||||
})
|
||||
})
|
||||
})
|
||||
end
|
||||
local getChatColor
|
||||
getChatColor = function(tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
return Enum.ChatColor.Blue
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
return Enum.ChatColor.Green
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
return Enum.ChatColor.Red
|
||||
end
|
||||
end
|
||||
local resetColor
|
||||
resetColor = function(frame, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
frame.BackgroundColor3 = Color3.new(0, 0, 179 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(45 / 255, 142 / 255, 245 / 255)
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
frame.BackgroundColor3 = Color3.new(0, 77 / 255, 0)
|
||||
frame.Number.TextColor3 = Color3.new(0, 190 / 255, 0)
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
frame.BackgroundColor3 = Color3.new(140 / 255, 0, 0)
|
||||
frame.Number.TextColor3 = Color3.new(255 / 255, 88 / 255, 79 / 255)
|
||||
end
|
||||
end
|
||||
local styleChoices
|
||||
styleChoices = function(tone)
|
||||
for _, obj in pairs(choices) do
|
||||
resetColor(obj, tone)
|
||||
end
|
||||
return resetColor(lastChoice, tone)
|
||||
end
|
||||
local styleMainFrame
|
||||
styleMainFrame = function(tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatBlue
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatGreen
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
mainFrame.Style = Enum.FrameStyle.ChatRed
|
||||
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
|
||||
end
|
||||
return styleChoices(tone)
|
||||
end
|
||||
local setChatNotificationTone
|
||||
setChatNotificationTone = function(gui, purpose, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
|
||||
end
|
||||
if purpose == Enum.DialogPurpose.Quest then
|
||||
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
|
||||
elseif purpose == Enum.DialogPurpose.Help then
|
||||
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
|
||||
elseif purpose == Enum.DialogPurpose.Shop then
|
||||
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
|
||||
end
|
||||
end
|
||||
local createMessageDialog
|
||||
createMessageDialog = function()
|
||||
messageDialog = New("Frame", "DialogScriptMessage", {
|
||||
Style = Enum.FrameStyle.RobloxRound,
|
||||
Visible = false,
|
||||
New("TextLabel", "Text", {
|
||||
Position = UDim2.new(0, 0, 0, -1),
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
FontSize = Enum.FontSize.Size14,
|
||||
BackgroundTransparency = 1,
|
||||
TextColor3 = Color3.new(1, 1, 1),
|
||||
RobloxLocked = true
|
||||
})
|
||||
})
|
||||
end
|
||||
local showMessage
|
||||
showMessage = function(msg, size)
|
||||
messageDialog.Text.Text = msg
|
||||
messageDialog.Size = UDim2.new(0, size, 0, 40)
|
||||
messageDialog.Position = UDim2.new(0.5, -size / 2, 0.5, -40)
|
||||
messageDialog.Visible = true
|
||||
wait(2)
|
||||
messageDialog.Visible = false
|
||||
return messageDialog
|
||||
end
|
||||
local variableDelay
|
||||
variableDelay = function(str)
|
||||
local length = math.min(string.len(str), 100)
|
||||
return wait(0.75 + (length / 75) * 1.5)
|
||||
end
|
||||
local highlightColor
|
||||
highlightColor = function(frame, tone)
|
||||
if tone == Enum.DialogTone.Neutral then
|
||||
frame.BackgroundColor3 = Color3.new(2 / 255, 108 / 255, 255 / 255)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
elseif tone == Enum.DialogTone.Friendly then
|
||||
frame.BackgroundColor3 = Color3.new(0, 128 / 255, 0)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
elseif tone == Enum.DialogTone.Enemy then
|
||||
frame.BackgroundColor3 = Color3.new(204 / 255, 0, 0)
|
||||
frame.Number.TextColor3 = Color3.new(1, 1, 1)
|
||||
end
|
||||
end
|
||||
local endDialog
|
||||
endDialog = function()
|
||||
if currentAbortDialogScript then
|
||||
currentAbortDialogScript:Remove()
|
||||
currentAbortDialogScript = nil
|
||||
end
|
||||
local dialog = currentConversationDialog
|
||||
currentConversationDialog = nil
|
||||
if dialog and dialog.InUse then
|
||||
local reenableScript = reenableDialogScript:Clone()
|
||||
reenableScript.archivable = false
|
||||
reenableScript.Disabled = false
|
||||
reenableScript.Parent = dialog
|
||||
end
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = not dialog.InUse
|
||||
end
|
||||
end
|
||||
currentConversationPartner = nil
|
||||
end
|
||||
local wanderDialog
|
||||
wanderDialog = function()
|
||||
print("Wander")
|
||||
mainFrame.Visible = false
|
||||
endDialog()
|
||||
return showMessage(characterWanderedOffMessage, characterWanderedOffSize)
|
||||
end
|
||||
local timeoutDialog
|
||||
timeoutDialog = function()
|
||||
print("Timeout")
|
||||
mainFrame.Visible = false
|
||||
endDialog()
|
||||
return showMessage(conversationTimedOut, conversationTimedOutSize)
|
||||
end
|
||||
local normalEndDialog
|
||||
normalEndDialog = function()
|
||||
print("Done")
|
||||
return endDialog()
|
||||
end
|
||||
local sanitizeMessage
|
||||
sanitizeMessage = function(msg)
|
||||
if string.len(msg) == 0 then
|
||||
return "..."
|
||||
else
|
||||
return msg
|
||||
end
|
||||
end
|
||||
local renewKillswitch
|
||||
renewKillswitch = function(dialog)
|
||||
if currentAbortDialogScript then
|
||||
currentAbortDialogScript:Remove()
|
||||
currentAbortDialogScript = nil
|
||||
end
|
||||
currentAbortDialogScript = timeoutScript:Clone()
|
||||
currentAbortDialogScript.archivable = false
|
||||
currentAbortDialogScript.Disabled = false
|
||||
currentAbortDialogScript.Parent = dialog
|
||||
return currentAbortDialogScript
|
||||
end
|
||||
local presentDialogChoices
|
||||
presentDialogChoices = function(talkingPart, dialogChoices)
|
||||
if not currentConversationDialog then
|
||||
return
|
||||
end
|
||||
currentConversationPartner = talkingPart
|
||||
local sortedDialogChoices = { }
|
||||
for _, obj in pairs(dialogChoices) do
|
||||
if obj:IsA("DialogChoice") then
|
||||
table.insert(sortedDialogChoices, obj)
|
||||
end
|
||||
end
|
||||
table.sort(sortedDialogChoices, function(a, b)
|
||||
return a.Name < b.Name
|
||||
end)
|
||||
if #sortedDialogChoices == 0 then
|
||||
normalEndDialog()
|
||||
return
|
||||
end
|
||||
local pos = 1
|
||||
local yPosition = 0
|
||||
choiceMap = { }
|
||||
for _, obj in pairs(choices) do
|
||||
obj.Visible = false
|
||||
end
|
||||
for _, obj in pairs(sortedDialogChoices) do
|
||||
if pos <= #choices then
|
||||
choices[pos].Size = UDim2.new(1, 0, 0, 24 * 3)
|
||||
choices[pos].UserPrompt.Text = obj.UserDialog
|
||||
local height = math.ceil(choices[pos].UserPrompt.TextBounds.Y / 24) * 24
|
||||
choices[pos].Position = UDim2.new(0, 0, 0, yPosition)
|
||||
choices[pos].Size = UDim2.new(1, 0, 0, height)
|
||||
choices[pos].Visible = true
|
||||
choiceMap[choices[pos]] = obj
|
||||
yPosition = yPosition + height
|
||||
pos = pos + 1
|
||||
end
|
||||
end
|
||||
lastChoice.Position = UDim2.new(0, 0, 0, yPosition)
|
||||
lastChoice.Number.Text = pos .. ")"
|
||||
mainFrame.Size = UDim2.new(0, 350, 0, yPosition + 24 + 32)
|
||||
mainFrame.Position = UDim2.new(0, 20, 0, -mainFrame.Size.Y.Offset - 20)
|
||||
styleMainFrame(currentTone())
|
||||
mainFrame.Visible = true
|
||||
end
|
||||
local selectChoice
|
||||
selectChoice = function(choice)
|
||||
renewKillswitch(currentConversationDialog)
|
||||
mainFrame.Visible = false
|
||||
if choice == lastChoice then
|
||||
game.Chat:Chat(game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone()))
|
||||
return normalEndDialog()
|
||||
else
|
||||
local dialogChoice = choiceMap[choice]
|
||||
game.Chat:Chat(game.Players.LocalPlayer.Character, sanitizeMessage(dialogChoice.UserDialog), getChatColor(currentTone()))
|
||||
wait(1)
|
||||
currentConversationDialog:SignalDialogChoiceSelected(player, dialogChoice)
|
||||
game.Chat:Chat(currentConversationPartner, sanitizeMessage(dialogChoice.ResponseDialog), getChatColor(currentTone()))
|
||||
variableDelay(dialogChoice.ResponseDialog)
|
||||
return presentDialogChoices(currentConversationPartner, dialogChoice:GetChildren())
|
||||
end
|
||||
end
|
||||
local newChoice
|
||||
newChoice = function(numberText)
|
||||
local frame = New("TextButton", {
|
||||
BackgroundColor3 = Color3.new(0, 0, 179 / 255),
|
||||
AutoButtonColor = false,
|
||||
BorderSizePixel = 0,
|
||||
Text = "",
|
||||
RobloxLocked = true,
|
||||
New("TextLabel", "Number", {
|
||||
TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255),
|
||||
Text = numberText,
|
||||
FontSize = Enum.FontSize.Size14,
|
||||
BackgroundTransparency = 1,
|
||||
Position = UDim2.new(0, 4, 0, 2),
|
||||
Size = UDim2.new(0, 20, 0, 24),
|
||||
TextXAlignment = Enum.TextXAlignment.Left,
|
||||
TextYAlignment = Enum.TextYAlignment.Top,
|
||||
RobloxLocked = true
|
||||
}),
|
||||
New("TextLabel", "UserPrompt", {
|
||||
BackgroundTransparency = 1,
|
||||
TextColor3 = Color3.new(1, 1, 1),
|
||||
FontSize = Enum.FontSize.Size14,
|
||||
Position = UDim2.new(0, 28, 0, 2),
|
||||
Size = UDim2.new(1, -32, 1, -4),
|
||||
TextXAlignment = Enum.TextXAlignment.Left,
|
||||
TextYAlignment = Enum.TextYAlignment.Top,
|
||||
TextWrap = true,
|
||||
RobloxLocked = true
|
||||
})
|
||||
})
|
||||
frame.MouseEnter:connect(function()
|
||||
return highlightColor(frame, currentTone())
|
||||
end)
|
||||
frame.MouseLeave:connect(function()
|
||||
return resetColor(frame, currentTone())
|
||||
end)
|
||||
frame.MouseButton1Click:connect(function()
|
||||
return selectChoice(frame)
|
||||
end)
|
||||
return frame
|
||||
end
|
||||
local initialize
|
||||
initialize = function(parent)
|
||||
choices[1] = newChoice("1)")
|
||||
choices[2] = newChoice("2)")
|
||||
choices[3] = newChoice("3)")
|
||||
choices[4] = newChoice("4)")
|
||||
lastChoice = newChoice("5)")
|
||||
lastChoice.UserPrompt.Text = "Goodbye!"
|
||||
lastChoice.Size = UDim2.new(1, 0, 0, 28)
|
||||
mainFrame = New("Frame", "UserDialogArea", {
|
||||
Size = UDim2.new(0, 350, 0, 200),
|
||||
Style = Enum.FrameStyle.ChatBlue,
|
||||
Visible = false,
|
||||
New("ImageLabel", "Tail", {
|
||||
Size = UDim2.new(0, 62, 0, 53),
|
||||
Position = UDim2.new(1, 8, 0.25),
|
||||
Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png",
|
||||
BackgroundTransparency = 1,
|
||||
RobloxLocked = true
|
||||
})
|
||||
})
|
||||
for _, obj in pairs(choices) do
|
||||
obj.RobloxLocked = true
|
||||
obj.Parent = mainFrame
|
||||
lastChoice.RobloxLocked = true
|
||||
end
|
||||
lastChoice.Parent = mainFrame
|
||||
mainFrame.RobloxLocked = true
|
||||
mainFrame.Parent = parent
|
||||
end
|
||||
local doDialog
|
||||
doDialog = function(dialog)
|
||||
while not Instance.Lock(dialog, player) do
|
||||
wait()
|
||||
end
|
||||
if dialog.InUse then
|
||||
Instance.Unlock(dialog)
|
||||
return
|
||||
else
|
||||
dialog.InUse = true
|
||||
Instance.Unlock(dialog)
|
||||
end
|
||||
currentConversationDialog = dialog
|
||||
game.Chat:Chat(dialog.Parent, dialog.InitialPrompt, getChatColor(dialog.Tone))
|
||||
variableDelay(dialog.InitialPrompt)
|
||||
return presentDialogChoices(dialog.Parent, dialog:GetChildren())
|
||||
end
|
||||
local checkForLeaveArea
|
||||
checkForLeaveArea = function()
|
||||
while currentConversationDialog do
|
||||
if currentConversationDialog.Parent and (player:DistanceFromCharacter(currentConversationDialog.Parent.Position >= currentConversationDialog.ConversationDistance)) then
|
||||
wanderDialog()
|
||||
end
|
||||
wait(1)
|
||||
end
|
||||
end
|
||||
local startDialog
|
||||
startDialog = function(dialog)
|
||||
if dialog.Parent and dialog.Parent:IsA("BasePart") then
|
||||
if player:DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance then
|
||||
showMessage(tooFarAwayMessage, tooFarAwaySize)
|
||||
return
|
||||
end
|
||||
for dialog, gui in pairs(dialogMap) do
|
||||
if dialog and gui then
|
||||
gui.Enabled = false
|
||||
end
|
||||
end
|
||||
renewKillswitch(dialog)
|
||||
delay(1, checkForLeaveArea)
|
||||
return doDialog(dialog)
|
||||
end
|
||||
end
|
||||
local removeDialog
|
||||
removeDialog = function(dialog)
|
||||
if dialogMap[dialog] then
|
||||
dialogMap[dialog]:Remove()
|
||||
dialogMap[dialog] = nil
|
||||
end
|
||||
if dialogConnections[dialog] then
|
||||
dialogConnections[dialog]:disconnect()
|
||||
dialogConnections[dialog] = nil
|
||||
end
|
||||
end
|
||||
local addDialog
|
||||
addDialog = function(dialog)
|
||||
if dialog.Parent then
|
||||
if dialog.Parent:IsA("BasePart") then
|
||||
local chatGui = chatNotificationGui:clone()
|
||||
chatGui.Enabled = not dialog.InUse
|
||||
chatGui.Adornee = dialog.Parent
|
||||
chatGui.RobloxLocked = true
|
||||
chatGui.Parent = game.CoreGui
|
||||
chatGui.Image.Button.MouseButton1Click:connect(function()
|
||||
return startDialog(dialog)
|
||||
end)
|
||||
setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||
dialogMap[dialog] = chatGui
|
||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||
if prop == "Parent" and dialog.Parent then
|
||||
removeDialog(dialog)
|
||||
return addDialog(dialog)
|
||||
elseif prop == "InUse" then
|
||||
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
|
||||
if dialog == currentConversationDialog then
|
||||
return timeoutDialog()
|
||||
end
|
||||
elseif prop == "Tone" or prop == "Purpose" then
|
||||
return setChatNotificationTone(chatGui, dialog.Purpose, dialog.Tone)
|
||||
end
|
||||
end)
|
||||
else
|
||||
dialogConnections[dialog] = dialog.Changed:connect(function(prop)
|
||||
if prop == "Parent" and dialog.Parent then
|
||||
removeDialog(dialog)
|
||||
return addDialog(dialog)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
local fetchScripts
|
||||
fetchScripts = function()
|
||||
local model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||
if type(model) == "string" then
|
||||
wait(0.1)
|
||||
model = game:GetService("InsertService"):LoadAsset(39226062)
|
||||
end
|
||||
if type(model) == "string" then
|
||||
return
|
||||
end
|
||||
waitForChild(model, "TimeoutScript")
|
||||
timeoutScript = model.TimeoutScript
|
||||
waitForChild(model, "ReenableDialogScript")
|
||||
reenableDialogScript = model.ReenableDialogScript
|
||||
end
|
||||
local onLoad
|
||||
onLoad = function()
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
player = game.Players.LocalPlayer
|
||||
waitForProperty(player, "Character")
|
||||
fetchScripts()
|
||||
createChatNotificationGui()
|
||||
createMessageDialog()
|
||||
messageDialog.RobloxLocked = true
|
||||
messageDialog.Parent = gui
|
||||
waitForChild(gui, "BottomLeftControl")
|
||||
local frame = New("Frame", "DialogFrame", {
|
||||
Position = UDim2.new(0, 0, 0, 0),
|
||||
Size = UDim2.new(0, 0, 0, 0),
|
||||
BackgroundTransparency = 1,
|
||||
RobloxLocked = true,
|
||||
Parent = gui.BottomLeftControl
|
||||
})
|
||||
initialize(frame)
|
||||
game.CollectionService.ItemAdded:connect(function(obj)
|
||||
if obj:IsA("Dialog") then
|
||||
return addDialog(obj)
|
||||
end
|
||||
end)
|
||||
game.CollectionService.ItemRemoved:connect(function(obj)
|
||||
if obj:IsA("Dialog") then
|
||||
return removeDialog(obj)
|
||||
end
|
||||
end)
|
||||
for _, obj in pairs(game.CollectionService:GetCollection("Dialog")) do
|
||||
if obj:IsA("Dialog") then
|
||||
addDialog(obj)
|
||||
end
|
||||
end
|
||||
end
|
||||
return onLoad()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,16 @@
|
|||
local a={}a.Foo=function()print'foo'end a.Bar=function()print'bar'end a.Help=
|
||||
function(b)if b=='Foo'or b==a.Foo then return
|
||||
'Function Foo. Arguments: None. Side effect: prints foo'elseif b=='Bar'or b==a
|
||||
.Bar then return'Function Bar. Arguments: None. Side effect: prints bar'end
|
||||
end return a
|
||||
print("[Mercury]: Loaded corescript 45374389")
|
||||
local t = { }
|
||||
t.Foo = function()
|
||||
return print("foo")
|
||||
end
|
||||
t.Bar = function()
|
||||
return print("bar")
|
||||
end
|
||||
t.Help = function(funcNameOrFunc)
|
||||
if "Foo" == funcNameOrFunc or t.Foo == funcNameOrFunc then
|
||||
return "Function Foo. Arguments: None. Side effect: prints foo"
|
||||
elseif "Bar" == funcNameOrFunc or t.Bar == funcNameOrFunc then
|
||||
return "Function Bar. Arguments: None. Side effect: prints bar"
|
||||
end
|
||||
end
|
||||
return t
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,84 +1,235 @@
|
|||
function waitForProperty(a,b)while not a[b]do a.Changed:wait()end end function
|
||||
waitForChild(a,b)while not a:FindFirstChild(b)do a.ChildAdded:wait()end end
|
||||
waitForProperty(game.Players,'LocalPlayer')waitForChild(script.Parent,'Popup')
|
||||
waitForChild(script.Parent.Popup,'AcceptButton')script.Parent.Popup.AcceptButton
|
||||
.Modal=true local a,b,c,d,e=game.Players.LocalPlayer,nil,{},true,function()if
|
||||
script.Parent.Popup then script.Parent.Popup.Visible=false end end function
|
||||
makeFriend(f,g)local h=script.Parent:FindFirstChild'Popup'if h==nil then return
|
||||
end if h.Visible then return end if c[f]then return end h.PopupText.Text=
|
||||
'Accept Friend Request from '..tostring(f.Name)..'?'h.PopupImage.Image=
|
||||
'http://www.roblox.com/thumbs/avatar.ashx?userId='..tostring(f.userId)..
|
||||
'&x=352&y=352'showTwoButtons()h.Visible=true h.AcceptButton.Text='Accept'h.
|
||||
DeclineButton.Text='Decline'h:TweenSize(UDim2.new(0,330,0,350),Enum.
|
||||
EasingDirection.Out,Enum.EasingStyle.Quart,1,true)local i,j i=h.AcceptButton.
|
||||
MouseButton1Click:connect(function()h.Visible=false g:RequestFriendship(f)if i
|
||||
then i:disconnect()end if j then j:disconnect()end h:TweenSize(UDim2.new(0,0,0,0
|
||||
),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,e())end)j=h.
|
||||
DeclineButton.MouseButton1Click:connect(function()h.Visible=false g:
|
||||
RevokeFriendship(f)c[f]=true print'pop up blacklist'if i then i:disconnect()end
|
||||
if j then j:disconnect()end h:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.
|
||||
Out,Enum.EasingStyle.Quart,1,true,e())end)end game.Players.FriendRequestEvent:
|
||||
connect(function(f,g,h)if f~=a and g~=a then return end if f==a then if h==Enum.
|
||||
FriendRequestEvent.Accept then game:GetService'GuiService':SendNotification(
|
||||
'You are Friends','With '..g.Name..'!',
|
||||
'http://www.roblox.com/thumbs/avatar.ashx?userId='..tostring(g.userId)..
|
||||
'&x=48&y=48',5,function()end)end elseif g==a then if h==Enum.FriendRequestEvent.
|
||||
Issue then if c[f]then return end game:GetService'GuiService':SendNotification(
|
||||
'Friend Request','From '..f.Name,
|
||||
'http://www.roblox.com/thumbs/avatar.ashx?userId='..tostring(f.userId)..
|
||||
'&x=48&y=48',8,function()makeFriend(f,g)end)elseif h==Enum.FriendRequestEvent.
|
||||
Accept then game:GetService'GuiService':SendNotification('You are Friends',
|
||||
'With '..f.Name..'!','http://www.roblox.com/thumbs/avatar.ashx?userId='..
|
||||
tostring(f.userId)..'&x=48&y=48',5,function()end)end end end)function
|
||||
showOneButton()local f=script.Parent:FindFirstChild'Popup'if f then f.OKButton.
|
||||
Visible=true f.DeclineButton.Visible=false f.AcceptButton.Visible=false end end
|
||||
function showTwoButtons()local f=script.Parent:FindFirstChild'Popup'if f then f.
|
||||
OKButton.Visible=false f.DeclineButton.Visible=true f.AcceptButton.Visible=true
|
||||
end end function showTeleportUI(f,g)if b~=nil then b:Remove()end waitForChild(a,
|
||||
'PlayerGui')b=Instance.new'Message'b.Text=f b.Parent=a.PlayerGui if g>0 then
|
||||
wait(g)b:Remove()end end function onTeleport(f,g,h)if game:GetService
|
||||
'TeleportService'.CustomizedTeleportUI==false then if f==Enum.TeleportState.
|
||||
Started then showTeleportUI('Teleport started...',0)elseif f==Enum.TeleportState
|
||||
.WaitingForServer then showTeleportUI('Requesting server...',0)elseif f==Enum.
|
||||
TeleportState.InProgress then showTeleportUI('Teleporting...',0)elseif f==Enum.
|
||||
TeleportState.Failed then showTeleportUI(
|
||||
[[Teleport failed. Insufficient privileges or target place does not exist.]],3)
|
||||
end end end if d then a.OnTeleport:connect(onTeleport)game:GetService
|
||||
'TeleportService'.ErrorCallback=function(f)local h=script.Parent:FindFirstChild
|
||||
'Popup'showOneButton()h.PopupText.Text=f local i i=h.OKButton.MouseButton1Click:
|
||||
connect(function()game:GetService'TeleportService':TeleportCancel()if i then i:
|
||||
disconnect()end game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild
|
||||
'Popup')h:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle
|
||||
.Quart,1,true,e())end)game.GuiService:AddCenterDialog(script.Parent:
|
||||
FindFirstChild'Popup',Enum.CenterDialogType.QuitDialog,function()showOneButton()
|
||||
script.Parent:FindFirstChild'Popup'.Visible=true h:TweenSize(UDim2.new(0,330,0,
|
||||
350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)end,function()h:
|
||||
TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,
|
||||
true,e())end)end game:GetService'TeleportService'.ConfirmationCallback=function(
|
||||
f,h,i)local j=script.Parent:FindFirstChild'Popup'j.PopupText.Text=f j.PopupImage
|
||||
.Image=''local k,l local function killCons()if k then k:disconnect()end if l
|
||||
then l:disconnect()end game.GuiService:RemoveCenterDialog(script.Parent:
|
||||
FindFirstChild'Popup')j:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,
|
||||
Enum.EasingStyle.Quart,1,true,e())end k=j.AcceptButton.MouseButton1Click:
|
||||
connect(function()killCons()local m,n=pcall(function()game:GetService
|
||||
'TeleportService':TeleportImpl(h,i)end)if not m then showOneButton()j.PopupText.
|
||||
Text=n local o o=j.OKButton.MouseButton1Click:connect(function()if o then o:
|
||||
disconnect()end game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild
|
||||
'Popup')j:TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle
|
||||
.Quart,1,true,e())end)game.GuiService:AddCenterDialog(script.Parent:
|
||||
FindFirstChild'Popup',Enum.CenterDialogType.QuitDialog,function()showOneButton()
|
||||
script.Parent:FindFirstChild'Popup'.Visible=true j:TweenSize(UDim2.new(0,330,0,
|
||||
350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)end,function()j:
|
||||
TweenSize(UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,
|
||||
true,e())end)end end)l=j.DeclineButton.MouseButton1Click:connect(function()
|
||||
killCons()pcall(function()game:GetService'TeleportService':TeleportCancel()end)
|
||||
end)local m=pcall(function()game.GuiService:AddCenterDialog(script.Parent:
|
||||
FindFirstChild'Popup',Enum.CenterDialogType.QuitDialog,function()showTwoButtons(
|
||||
)j.AcceptButton.Text='Leave'j.DeclineButton.Text='Stay'script.Parent:
|
||||
FindFirstChild'Popup'.Visible=true j:TweenSize(UDim2.new(0,330,0,350),Enum.
|
||||
EasingDirection.Out,Enum.EasingStyle.Quart,1,true)end,function()j:TweenSize(
|
||||
UDim2.new(0,0,0,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true,e())
|
||||
end)end)if m==false then script.Parent:FindFirstChild'Popup'.Visible=true j.
|
||||
AcceptButton.Text='Leave'j.DeclineButton.Text='Stay'j:TweenSize(UDim2.new(0,330,
|
||||
0,350),Enum.EasingDirection.Out,Enum.EasingStyle.Quart,1,true)end return true
|
||||
end end
|
||||
print("[Mercury]: Loaded corescript 48488398")
|
||||
local waitForProperty
|
||||
waitForProperty = function(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
local waitForChild
|
||||
waitForChild = function(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
end
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
waitForChild(script.Parent, "Popup")
|
||||
waitForChild(script.Parent.Popup, "AcceptButton")
|
||||
script.Parent.Popup.AcceptButton.Modal = true
|
||||
local localPlayer = game.Players.LocalPlayer
|
||||
local teleportUI
|
||||
local friendRequestBlacklist = { }
|
||||
local teleportEnabled = true
|
||||
local showOneButton
|
||||
showOneButton = function()
|
||||
local popup = script.Parent:FindFirstChild("Popup")
|
||||
if popup then
|
||||
popup.OKButton.Visible = true
|
||||
popup.DeclineButton.Visible = false
|
||||
popup.AcceptButton.Visible = false
|
||||
end
|
||||
return popup
|
||||
end
|
||||
local showTwoButtons
|
||||
showTwoButtons = function()
|
||||
local popup = script.Parent:FindFirstChild("Popup")
|
||||
if popup then
|
||||
popup.OKButton.Visible = false
|
||||
popup.DeclineButton.Visible = true
|
||||
popup.AcceptButton.Visible = true
|
||||
end
|
||||
return popup
|
||||
end
|
||||
local makePopupInvisible
|
||||
makePopupInvisible = function()
|
||||
if script.Parent.Popup then
|
||||
script.Parent.Popup.Visible = false
|
||||
end
|
||||
end
|
||||
local makeFriend
|
||||
makeFriend = function(fromPlayer, toPlayer)
|
||||
local popup = script.Parent:FindFirstChild("Popup")
|
||||
if not (popup ~= nil) then
|
||||
return
|
||||
end
|
||||
if popup.Visible then
|
||||
return
|
||||
end
|
||||
if friendRequestBlacklist[fromPlayer] then
|
||||
return
|
||||
end
|
||||
popup.PopupText.Text = "Accept Friend Request from " .. tostring(fromPlayer.Name) .. "?"
|
||||
popup.PopupImage.Image = "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=352&y=352"
|
||||
showTwoButtons()
|
||||
popup.Visible = true
|
||||
popup.AcceptButton.Text = "Accept"
|
||||
popup.DeclineButton.Text = "Decline"
|
||||
popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
local yesCon, noCon
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RequestFriendship(fromPlayer)
|
||||
if yesCon ~= nil then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon ~= nil then
|
||||
noCon:disconnect()
|
||||
end
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
popup.Visible = false
|
||||
toPlayer:RevokeFriendship(fromPlayer)
|
||||
friendRequestBlacklist[fromPlayer] = true
|
||||
print("pop up blacklist")
|
||||
if yesCon ~= nil then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon ~= nil then
|
||||
noCon:disconnect()
|
||||
end
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
end
|
||||
game.Players.FriendRequestEvent:connect(function(fromPlayer, toPlayer, event)
|
||||
if fromPlayer ~= localPlayer and toPlayer ~= localPlayer then
|
||||
return
|
||||
end
|
||||
if fromPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Accept then
|
||||
return game:GetService("GuiService"):SendNotification("You are Friends", "With " .. tostring(toPlayer.Name) .. "!", "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(toPlayer.userId) .. "&x=48&y=48", 5, function() end)
|
||||
end
|
||||
elseif toPlayer == localPlayer then
|
||||
if event == Enum.FriendRequestEvent.Issue then
|
||||
if friendRequestBlacklist[fromPlayer] then
|
||||
return
|
||||
end
|
||||
return game:GetService("GuiService"):SendNotification("Friend Request", "From " .. tostring(fromPlayer.Name), "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48", 8, function()
|
||||
return makeFriend(fromPlayer, toPlayer)
|
||||
end)
|
||||
elseif event == Enum.FriendRequestEvent.Accept then
|
||||
return game:GetService("GuiService"):SendNotification("You are Friends", "With " .. tostring(fromPlayer.Name) .. "!", "http://www.roblox.com/thumbs/avatar.ashx?userId=" .. tostring(fromPlayer.userId) .. "&x=48&y=48", 5, function() end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
local showTeleportUI
|
||||
showTeleportUI = function(message, timer)
|
||||
if teleportUI ~= nil then
|
||||
teleportUI:Remove()
|
||||
end
|
||||
waitForChild(localPlayer, "PlayerGui")
|
||||
local _with_0 = Instance.new("Message")
|
||||
_with_0.Text = message
|
||||
_with_0.Parent = localPlayer.PlayerGui
|
||||
if timer > 0 then
|
||||
wait(timer)
|
||||
_with_0:Remove()
|
||||
end
|
||||
return _with_0
|
||||
end
|
||||
local onTeleport
|
||||
onTeleport = function(teleportState, _, _)
|
||||
if game:GetService("TeleportService").CustomizedTeleportUI == false then
|
||||
return showTeleportUI((function()
|
||||
if Enum.TeleportState.Started == teleportState then
|
||||
return "Teleport started...", 0
|
||||
elseif Enum.TeleportState.WaitingForServer == teleportState then
|
||||
return "Requesting server...", 0
|
||||
elseif Enum.TeleportState.InProgress == teleportState then
|
||||
return "Teleporting...", 0
|
||||
elseif Enum.TeleportState.Failed == teleportState then
|
||||
return "Teleport failed. Insufficient privileges or target place does not exist.", 3
|
||||
end
|
||||
end)())
|
||||
end
|
||||
end
|
||||
if teleportEnabled then
|
||||
localPlayer.OnTeleport:connect(onTeleport)
|
||||
game:GetService("TeleportService").ErrorCallback = function(message)
|
||||
local popup = script.Parent:FindFirstChild("Popup")
|
||||
showOneButton()
|
||||
popup.PopupText.Text = message
|
||||
local clickCon
|
||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||
game:GetService("TeleportService"):TeleportCancel()
|
||||
if clickCon then
|
||||
clickCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
return game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup", Enum.CenterDialogType.QuitDialog), function()
|
||||
showOneButton()
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
return popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
end, function()
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
end
|
||||
game:GetService("TeleportService").ConfirmationCallback = function(message, placeId, spawnName)
|
||||
local popup = script.Parent:FindFirstChild("Popup")
|
||||
popup.PopupText.Text = message
|
||||
popup.PopupImage.Image = ""
|
||||
local yesCon, noCon
|
||||
local killCons
|
||||
killCons = function()
|
||||
if yesCon ~= nil then
|
||||
yesCon:disconnect()
|
||||
end
|
||||
if noCon ~= nil then
|
||||
noCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end
|
||||
yesCon = popup.AcceptButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
local success, err
|
||||
success, err = pcall(function()
|
||||
return game:GetService("TeleportService"):TeleportImpl(placeId, spawnName)
|
||||
end)
|
||||
if not success then
|
||||
showOneButton()
|
||||
popup.PopupText.Text = err
|
||||
local clickCon
|
||||
clickCon = popup.OKButton.MouseButton1Click:connect(function()
|
||||
if clickCon ~= nil then
|
||||
clickCon:disconnect()
|
||||
end
|
||||
game.GuiService:RemoveCenterDialog(script.Parent:FindFirstChild("Popup"))
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
return game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup", Enum.CenterDialogType.QuitDialog), function()
|
||||
showOneButton()
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
return popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
end, function()
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
end
|
||||
end)
|
||||
noCon = popup.DeclineButton.MouseButton1Click:connect(function()
|
||||
killCons()
|
||||
return pcall(function()
|
||||
return game:GetService("TeleportService"):TeleportCancel()
|
||||
end)
|
||||
end)
|
||||
local centerDialogSuccess = pcall(function()
|
||||
return game.GuiService:AddCenterDialog(script.Parent:FindFirstChild("Popup", Enum.CenterDialogType.QuitDialog), function()
|
||||
showTwoButtons()
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
return popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
end, function()
|
||||
return popup:TweenSize(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true, makePopupInvisible())
|
||||
end)
|
||||
end)
|
||||
if centerDialogSuccess == false then
|
||||
script.Parent:FindFirstChild("Popup").Visible = true
|
||||
popup.AcceptButton.Text = "Leave"
|
||||
popup.DeclineButton.Text = "Stay"
|
||||
popup:TweenSize(UDim2.new(0, 330, 0, 350), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 1, true)
|
||||
end
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,20 +1,91 @@
|
|||
local a=Instance.new'Frame'a.Position=UDim2.new(0.5,-165,0.5,-175)a.Size=UDim2.
|
||||
new(0,330,0,350)a.Style=Enum.FrameStyle.RobloxRound a.ZIndex=4 a.Name='Popup'a.
|
||||
Visible=false a.Parent=script.Parent local b=a:clone()b.Size=UDim2.new(1,16,1,16
|
||||
)b.Position=UDim2.new(0,-8,0,-8)b.Name='Darken'b.ZIndex=1 b.Parent=a local c=
|
||||
Instance.new'TextButton'c.Position=UDim2.new(0,20,0,270)c.Size=UDim2.new(0,100,0
|
||||
,50)c.Font=Enum.Font.ArialBold c.FontSize=Enum.FontSize.Size24 c.Style=Enum.
|
||||
ButtonStyle.RobloxButton c.TextColor3=Color3.new(0.9725490196078431,
|
||||
0.9725490196078431,0.9725490196078431)c.Text='Yes'c.ZIndex=5 c.Name=
|
||||
'AcceptButton'c.Parent=a local d=c:clone()d.Position=UDim2.new(1,-120,0,270)d.
|
||||
Text='No'd.Name='DeclineButton'd.Parent=a local e=c:clone()e.Name='OKButton'e.
|
||||
Text='OK'e.Position=UDim2.new(0.5,-50,0,270)e.Visible=false e.Parent=a local f=
|
||||
Instance.new'ImageLabel'f.BackgroundTransparency=1 f.Position=UDim2.new(0.5,-140
|
||||
,0,0)f.Size=UDim2.new(0,280,0,280)f.ZIndex=3 f.Name='PopupImage'f.Parent=a local
|
||||
g=Instance.new'ImageLabel'g.BackgroundTransparency=1 g.Size=UDim2.new(1,0,1,0)g.
|
||||
Image='http://www.roblox.com/asset/?id=47574181'g.Name='Backing'g.ZIndex=2 g.
|
||||
Parent=f local h=Instance.new'TextLabel'h.Name='PopupText'h.Size=UDim2.new(1,0,
|
||||
0.8,0)h.Font=Enum.Font.ArialBold h.FontSize=Enum.FontSize.Size36 h.
|
||||
BackgroundTransparency=1 h.Text="Hello I'm a popup"h.TextColor3=Color3.new(
|
||||
0.9725490196078431,0.9725490196078431,0.9725490196078431)h.TextWrap=true h.
|
||||
ZIndex=5 h.Parent=a script:remove()
|
||||
print("[Mercury]: Loaded corescript 48488451")
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local popupFrame = New("Frame", "Popup", {
|
||||
Position = UDim2.new(0.5, -165, 0.5, -175),
|
||||
Size = UDim2.new(0, 330, 0, 350),
|
||||
Style = Enum.FrameStyle.RobloxRound,
|
||||
ZIndex = 4,
|
||||
Visible = false,
|
||||
Parent = script.Parent,
|
||||
New("TextLabel", "PopupText", {
|
||||
Size = UDim2.new(1, 0, 0.8, 0),
|
||||
Font = Enum.Font.ArialBold,
|
||||
FontSize = Enum.FontSize.Size36,
|
||||
BackgroundTransparency = 1,
|
||||
Text = "Hello I'm a popup",
|
||||
TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255),
|
||||
TextWrap = true,
|
||||
ZIndex = 5
|
||||
}),
|
||||
New("TextButton", "AcceptButton", {
|
||||
Position = UDim2.new(0, 20, 0, 270),
|
||||
Size = UDim2.new(0, 100, 0, 50),
|
||||
Font = Enum.Font.ArialBold,
|
||||
FontSize = Enum.FontSize.Size24,
|
||||
Style = Enum.ButtonStyle.RobloxButton,
|
||||
TextColor3 = Color3.new(248 / 255, 248 / 255, 248 / 255),
|
||||
Text = "Yes",
|
||||
ZIndex = 5
|
||||
}),
|
||||
New("ImageLabel", "PopupImage", {
|
||||
BackgroundTransparency = 1,
|
||||
Position = UDim2.new(0.5, -140, 0, 0),
|
||||
Size = UDim2.new(0, 280, 0, 280),
|
||||
ZIndex = 3,
|
||||
New("ImageLabel", "Backing", {
|
||||
BackgroundTransparency = 1,
|
||||
Size = UDim2.new(1, 0, 1, 0),
|
||||
Image = "http://www.roblox.com/asset/?id=47574181",
|
||||
ZIndex = 2
|
||||
})
|
||||
})
|
||||
})
|
||||
local AcceptButton = popupFrame.AcceptButton
|
||||
do
|
||||
local _with_0 = popupFrame:clone()
|
||||
_with_0.Name = "Darken"
|
||||
_with_0.Size = UDim2.new(1, 16, 1, 16)
|
||||
_with_0.Position = UDim2.new(0, -8, 0, -8)
|
||||
_with_0.ZIndex = 1
|
||||
_with_0.Parent = popupFrame
|
||||
end
|
||||
do
|
||||
local _with_0 = AcceptButton:clone()
|
||||
_with_0.Name = "DeclineButton"
|
||||
_with_0.Position = UDim2.new(1, -120, 0, 270)
|
||||
_with_0.Text = "No"
|
||||
_with_0.Parent = popupFrame
|
||||
end
|
||||
do
|
||||
local _with_0 = AcceptButton:clone()
|
||||
_with_0.Name = "OKButton"
|
||||
_with_0.Text = "OK"
|
||||
_with_0.Position = UDim2.new(0.5, -50, 0, 270)
|
||||
_with_0.Visible = false
|
||||
_with_0.Parent = popupFrame
|
||||
end
|
||||
return script:remove()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,163 +1,731 @@
|
|||
local a,b,c={},assert,{buffer={}}function c:New()local d={}setmetatable(d,self)
|
||||
self.__index=self d.buffer={}return d end function c:Append(d)self.buffer[#self.
|
||||
buffer+1]=d end function c:ToString()return table.concat(self.buffer)end local d
|
||||
={backslashes={['\b']='\\b',['\t']='\\t',['\n']='\\n',['\f']='\\f',['\r']='\\r',
|
||||
['"']='\\"',['\\']='\\\\',['/']='\\/'}}function d:New()local e={}e.writer=c:New(
|
||||
)setmetatable(e,self)self.__index=self return e end function d:Append(e)self.
|
||||
writer:Append(e)end function d:ToString()return self.writer:ToString()end
|
||||
function d:Write(e)local f=type(e)if f=='nil'then self:WriteNil()elseif f==
|
||||
'boolean'or f=='number'then self:WriteString(e)elseif f=='string'then self:
|
||||
ParseString(e)elseif f=='table'then self:WriteTable(e)elseif f=='function'then
|
||||
self:WriteFunction(e)elseif f=='thread'or f=='userdata'then self:WriteError(e)
|
||||
end end function d:WriteNil()self:Append'null'end function d:WriteString(e)self:
|
||||
Append(tostring(e))end function d:ParseString(e)self:Append'"'self:Append(string
|
||||
.gsub(e,'[%z%c\\"/]',function(f)local g=self.backslashes[f]if g then return g
|
||||
end return string.format('\\u%.4X',string.byte(f))end))self:Append'"'end
|
||||
function d:IsArray(e)local f,g=0,function(f)if type(f)=='number'and f>0 then if
|
||||
math.floor(f)==f then return true end end return false end for h,i in pairs(e)do
|
||||
if not g(h)then return false,'{','}'else f=math.max(f,h)end end return true,'[',
|
||||
']',f end function d:WriteTable(e)local f,g,h,i=self:IsArray(e)self:Append(g)if
|
||||
f then for j=1,i do self:Write(e[j])if j<i then self:Append','end end else local
|
||||
j=true for k,l in pairs(e)do if not j then self:Append','end j=false self:
|
||||
ParseString(k)self:Append':'self:Write(l)end end self:Append(h)end function d:
|
||||
WriteError(e)error(string.format('Encoding of %s unsupported',tostring(e)))end
|
||||
function d:WriteFunction(e)if e==Null then self:WriteNil()else self:WriteError(e
|
||||
)end end local e={s='',i=0}function e:New(f)local g={}setmetatable(g,self)self.
|
||||
__index=self g.s=f or g.s return g end function e:Peek()local f=self.i+1 if f<=#
|
||||
self.s then return string.sub(self.s,f,f)end return nil end function e:Next()
|
||||
self.i=self.i+1 if self.i<=#self.s then return string.sub(self.s,self.i,self.i)
|
||||
end return nil end function e:All()return self.s end local f={escapes={['t']=
|
||||
'\t',['n']='\n',['f']='\f',['r']='\r',['b']='\b'}}function f:New(g)local h={}h.
|
||||
reader=e:New(g)setmetatable(h,self)self.__index=self return h end function f:
|
||||
Read()self:SkipWhiteSpace()local g=self:Peek()if g==nil then error(string.
|
||||
format("Nil string: '%s'",self:All()))elseif g=='{'then return self:ReadObject()
|
||||
elseif g=='['then return self:ReadArray()elseif g=='"'then return self:
|
||||
ReadString()elseif string.find(g,'[%+%-%d]')then return self:ReadNumber()elseif
|
||||
g=='t'then return self:ReadTrue()elseif g=='f'then return self:ReadFalse()elseif
|
||||
g=='n'then return self:ReadNull()elseif g=='/'then self:ReadComment()return self
|
||||
:Read()else return nil end end function f:ReadTrue()self:TestReservedWord{'t',
|
||||
'r','u','e'}return true end function f:ReadFalse()self:TestReservedWord{'f','a',
|
||||
'l','s','e'}return false end function f:ReadNull()self:TestReservedWord{'n','u',
|
||||
'l','l'}return nil end function f:TestReservedWord(g)for h,i in ipairs(g)do if
|
||||
self:Next()~=i then error(string.format("Error reading '%s': %s",table.concat(g)
|
||||
,self:All()))end end end function f:ReadNumber()local g,h=self:Next(),self:Peek(
|
||||
)while h~=nil and string.find(h,'[%+%-%d%.eE]')do g=g..self:Next()h=self:Peek()
|
||||
end g=tonumber(g)if g==nil then error(string.format("Invalid number: '%s'",g))
|
||||
else return g end end function f:ReadString()local g=''b(self:Next()=='"')while
|
||||
self:Peek()~='"'do local h=self:Next()if h=='\\'then h=self:Next()if self.
|
||||
escapes[h]then h=self.escapes[h]end end g=g..h end b(self:Next()=='"')local h=
|
||||
function(h)return string.char(tonumber(h,16))end return string.gsub(g,
|
||||
'u%x%x(%x%x)',h)end function f:ReadComment()b(self:Next()=='/')local g=self:
|
||||
Next()if g=='/'then self:ReadSingleLineComment()elseif g=='*'then self:
|
||||
ReadBlockComment()else error(string.format('Invalid comment: %s',self:All()))end
|
||||
end function f:ReadBlockComment()local g=false while not g do local h=self:Next(
|
||||
)if h=='*'and self:Peek()=='/'then g=true end if not g and h=='/'and self:Peek()
|
||||
=='*'then error(string.format("Invalid comment: %s, '/*' illegal.",self:All()))
|
||||
end end self:Next()end function f:ReadSingleLineComment()local g=self:Next()
|
||||
while g~='\r'and g~='\n'do g=self:Next()end end function f:ReadArray()local g={}
|
||||
b(self:Next()=='[')local h=false if self:Peek()==']'then h=true end while not h
|
||||
do local i=self:Read()g[#g+1]=i self:SkipWhiteSpace()if self:Peek()==']'then h=
|
||||
true end if not h then local j=self:Next()if j~=','then error(string.format(
|
||||
"Invalid array: '%s' due to: '%s'",self:All(),j))end end end b(']'==self:Next())
|
||||
return g end function f:ReadObject()local g={}b(self:Next()=='{')local h=false
|
||||
if self:Peek()=='}'then h=true end while not h do local i=self:Read()if type(i)
|
||||
~='string'then error(string.format('Invalid non-string object key: %s',i))end
|
||||
self:SkipWhiteSpace()local j=self:Next()if j~=':'then error(string.format(
|
||||
"Invalid object: '%s' due to: '%s'",self:All(),j))end self:SkipWhiteSpace()local
|
||||
k=self:Read()g[i]=k self:SkipWhiteSpace()if self:Peek()=='}'then h=true end if
|
||||
not h then j=self:Next()if j~=','then error(string.format(
|
||||
"Invalid array: '%s' near: '%s'",self:All(),j))end end end b(self:Next()=='}')
|
||||
return g end function f:SkipWhiteSpace()local g=self:Peek()while g~=nil and
|
||||
string.find(g,'[%s/]')do if g=='/'then self:ReadComment()else self:Next()end g=
|
||||
self:Peek()end end function f:Peek()return self.reader:Peek()end function f:Next
|
||||
()return self.reader:Next()end function f:All()return self.reader:All()end
|
||||
function Encode(g)local h=d:New()h:Write(g)return h:ToString()end function
|
||||
Decode(g)local h=f:New(g)return h:Read()end function Null()return Null end a.
|
||||
DecodeJSON=function(g)pcall(function()warn
|
||||
[[RbxUtility.DecodeJSON is deprecated, please use Game:GetService('HttpService'):JSONDecode() instead.]]
|
||||
end)if type(g)=='string'then return Decode(g)end print
|
||||
'RbxUtil.DecodeJSON expects string argument!'return nil end a.EncodeJSON=
|
||||
function(g)pcall(function()warn
|
||||
[[RbxUtility.EncodeJSON is deprecated, please use Game:GetService('HttpService'):JSONEncode() instead.]]
|
||||
end)return Encode(g)end a.MakeWedge=function(g,h,i,j)return game:GetService
|
||||
'Terrain':AutoWedgeCell(g,h,i)end a.SelectTerrainRegion=function(g,h,i,j)local k
|
||||
=game.Workspace:FindFirstChild'Terrain'if not k then return end b(g)b(h)if not
|
||||
type(g)=='Region3'then error(
|
||||
[[regionToSelect (first arg), should be of type Region3, but is type]],type(g))
|
||||
end if not type(h)=='BrickColor'then error(
|
||||
[[color (second arg), should be of type BrickColor, but is type]],type(h))end
|
||||
local l,m,n,o,p=k.GetCell,k.WorldToCellPreferSolid,k.CellCenterToWorld,Enum.
|
||||
CellMaterial.Empty,Instance.new'Model'p.Name='SelectionContainer'p.Archivable=
|
||||
false if j then p.Parent=j else p.Parent=game.Workspace end local q,r,s,t,u,v,w=
|
||||
nil,nil,0,nil,{},{},Instance.new'Part'w.Name='SelectionPart'w.Transparency=1 w.
|
||||
Anchored=true w.Locked=true w.CanCollide=false w.Size=Vector3.new(4.2,4.2,4.2)
|
||||
local x=Instance.new'SelectionBox'function createAdornment(y)local z,A=nil,nil
|
||||
if#v>0 then z=v[1]['part']A=v[1]['box']table.remove(v,1)A.Visible=true else z=w:
|
||||
Clone()z.Archivable=false A=x:Clone()A.Archivable=false A.Adornee=z A.Parent=p A
|
||||
.Adornee=z A.Parent=p end if y then A.Color=y end return z,A end function
|
||||
cleanUpAdornments()for y,z in pairs(u)do if z.KeepAlive~=r then z.SelectionBox.
|
||||
Visible=false table.insert(v,{part=z.SelectionPart,box=z.SelectionBox})u[y]=nil
|
||||
end end end function incrementAliveCounter()s=s+1 if s>1000000 then s=0 end
|
||||
return s end function adornFullCellsInRegion(y,z)local A,B=y.CFrame.p-(y.Size/2)
|
||||
+Vector3.new(2,2,2),y.CFrame.p+(y.Size/2)-Vector3.new(2,2,2)local C,D=m(k,A),m(k
|
||||
,B)r=incrementAliveCounter()for E=C.y,D.y do for F=C.z,D.z do for G=C.x,D.x do
|
||||
local H=l(k,G,E,F)if H~=o then local I,J,K=n(k,G,E,F),Vector3int16.new(G,E,F),
|
||||
false for L,M in pairs(u)do if L==J then M.KeepAlive=r if z then M.SelectionBox.
|
||||
Color=z end K=true break end end if not K then local N,O=createAdornment(z)N.
|
||||
Size=Vector3.new(4,4,4)N.CFrame=CFrame.new(I)local P={SelectionPart=N,
|
||||
SelectionBox=O,KeepAlive=r}u[J]=P end end end end end cleanUpAdornments()end t=g
|
||||
if i then local y,z=createAdornment(h)y.Size=g.Size y.CFrame=g.CFrame u.
|
||||
SelectionPart=y u.SelectionBox=z q=function(A,B)if A and A~=t then t=A y.Size=A.
|
||||
Size y.CFrame=A.CFrame end if B then z.Color=B end end else
|
||||
adornFullCellsInRegion(g,h)q=function(y,z)if y and y~=t then t=y
|
||||
adornFullCellsInRegion(y,z)end end end local y=function()q=nil if p then p:
|
||||
Destroy()end u=nil end return q,y end function a.CreateSignal()local g,h,i={},
|
||||
Instance.new'BindableEvent',{}function g:connect(j)if self~=g then error(
|
||||
'connect must be called with `:`, not `.`',2)end if type(j)~='function'then
|
||||
error('Argument #1 of connect must be a function, got a '..type(j),2)end local k
|
||||
=h.Event:connect(j)i[k]=true local l={}function l:disconnect()k:disconnect()i[k]
|
||||
=nil end l.Disconnect=l.disconnect return l end function g:disconnect()if self~=
|
||||
g then error('disconnect must be called with `:`, not `.`',2)end for j,k in
|
||||
pairs(i)do j:disconnect()i[j]=nil end end function g:wait()if self~=g then
|
||||
error('wait must be called with `:`, not `.`',2)end return h.Event:wait()end
|
||||
function g:fire(...)if self~=g then error(
|
||||
'fire must be called with `:`, not `.`',2)end h:Fire(...)end g.Connect=g.connect
|
||||
g.Disconnect=g.disconnect g.Wait=g.wait g.Fire=g.fire return g end
|
||||
local function Create_PrivImpl(g)if type(g)~='string'then error(
|
||||
'Argument of Create must be a string',2)end return function(h)h=h or{}local i,j,
|
||||
k=Instance.new(g),nil,nil for l,m in pairs(h)do if type(l)=='string'then if l==
|
||||
'Parent'then j=m else i[l]=m end elseif type(l)=='number'then if type(m)~=
|
||||
'userdata'then error(
|
||||
[[Bad entry in Create body: Numeric keys must be paired with children, got a: ]]
|
||||
..type(m),2)end m.Parent=i elseif type(l)=='table'and l.__eventname then if
|
||||
type(m)~='function'then error("Bad entry in Create body: Key `[Create.E'"..l.
|
||||
__eventname.."']` must have a function value, got: "..tostring(m),2)end i[l.
|
||||
__eventname]:connect(m)elseif l==a.Create then if type(m)~='function'then error(
|
||||
[[Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: ]]
|
||||
..tostring(m),2)elseif k then error(
|
||||
[[Bad entry in Create body: Only one constructor function is allowed]],2)end k=m
|
||||
else error('Bad entry ('..tostring(l)..' => '..tostring(m)..') in Create body',2
|
||||
)end end if k then k(i)end if j then i.Parent=j end return i end end a.Create=
|
||||
setmetatable({},{__call=function(g,...)return Create_PrivImpl(...)end})a.Create.
|
||||
E=function(g)return{__eventname=g}end a.Help=function(g)if g=='DecodeJSON'or g==
|
||||
a.DecodeJSON then return
|
||||
[[Function DecodeJSON. Arguments: (string). Side effect: returns a table with all parsed JSON values]]
|
||||
end if g=='EncodeJSON'or g==a.EncodeJSON then return
|
||||
[[Function EncodeJSON. Arguments: (table). Side effect: returns a string composed of argument table in JSON data format]]
|
||||
end if g=='MakeWedge'or g==a.MakeWedge then return
|
||||
[[Function MakeWedge. Arguments: (x, y, z, [default material]). Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if parameter is provided, if not sets cell x, y, z to be whatever material it previously was. Returns true if made a wedge, false if the cell remains a block ]]
|
||||
end if g=='SelectTerrainRegion'or g==a.SelectTerrainRegion then return
|
||||
[[Function SelectTerrainRegion. Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). Description: Selects all terrain via a series of selection boxes within the regionToSelect (this should be a region3 value). The selection box color is detemined by the color argument (should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional).SelectEmptyCells is bool, when true will select all cells in the region, otherwise we only select non-empty cells. Returns a function that can update the selection,arguments to said function are a new region3 to select, and the adornment color (color arg is optional). Also returns a second function that takes no arguments and destroys the selection]]
|
||||
end if g=='CreateSignal'or g==a.CreateSignal then return
|
||||
[[Function CreateSignal. Arguments: None. Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class used for events in Objects, but is a Lua-side object so it can be used to create custom events inLua code. Methods of the Signal object: :connect, :wait, :fire, :disconnect. For more info you can pass the method name to the Help function, or view the wiki page for this library. EG: Help('Signal:connect').]]
|
||||
end if g=='Signal:connect'then return
|
||||
[[Method Signal:connect. Arguments: (function handler). Return: A connection object which can be used to disconnect the connection to this handler. Description: Connectes a handler function to this Signal, so that when |fire| is called the handler function will be called with the arguments passed to |fire|.]]
|
||||
end if g=='Signal:wait'then return
|
||||
[[Method Signal:wait. Arguments: None. Returns: The arguments passed to the next call to |fire|. Description: This call does not return until the next call to |fire| is made, at which point it will return the values which were passed as arguments to that |fire| call.]]
|
||||
end if g=='Signal:fire'then return
|
||||
[[Method Signal:fire. Arguments: Any number of arguments of any type. Returns: None. Description: This call will invoke any connected handler functions, and notify any waiting code attached to this Signal to continue, with the arguments passed to this function. Note: The calls to handlers are made asynchronously, so this call will return immediately regardless of how long it takes the connected handler functions to complete.]]
|
||||
end if g=='Signal:disconnect'then return
|
||||
[[Method Signal:disconnect. Arguments: None. Returns: None. Description: This call disconnects all handlers attacched to this function, note however, it does NOT make waiting code continue, as is the behavior of normal Roblox events. This method can also be called on the connection object which is returned from Signal:connect to only disconnect a single handler, as opposed to this method, which will disconnect all handlers.]]
|
||||
end if g=='Create'then return
|
||||
[[Function Create. Arguments: A table containing information about how to construct a collection of objects. Returns: The constructed objects. Descrition: Create is a very powerfull function, whose description is too long to fit here, and is best described via example, please see the wiki page for a description of how to use it.]]
|
||||
end end return a
|
||||
print("[Mercury]: Loaded corescript 60595411")
|
||||
local t = { }
|
||||
local New
|
||||
New = function(className, name, props)
|
||||
if not (props ~= nil) then
|
||||
props = name
|
||||
name = nil
|
||||
end
|
||||
local obj = Instance.new(className)
|
||||
if name then
|
||||
obj.Name = name
|
||||
end
|
||||
local parent
|
||||
for k, v in pairs(props) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" and type(v) == "userdata" then
|
||||
v.Parent = obj
|
||||
end
|
||||
end
|
||||
obj.Parent = parent
|
||||
return obj
|
||||
end
|
||||
local assert = assert
|
||||
local Null
|
||||
Null = function()
|
||||
return Null
|
||||
end
|
||||
local StringBuilder = {
|
||||
buffer = { }
|
||||
}
|
||||
StringBuilder.New = function(self)
|
||||
local o = setmetatable({ }, self)
|
||||
self.__index = self
|
||||
o.buffer = { }
|
||||
return o
|
||||
end
|
||||
StringBuilder.Append = function(self, s)
|
||||
do
|
||||
local _obj_0 = self.buffer
|
||||
_obj_0[#_obj_0 + 1] = s
|
||||
end
|
||||
end
|
||||
StringBuilder.ToString = function(self)
|
||||
return table.concat(self.buffer)
|
||||
end
|
||||
local JsonWriter = {
|
||||
backslashes = {
|
||||
["\b"] = "\\b",
|
||||
["\t"] = "\\t",
|
||||
["\n"] = "\\n",
|
||||
["\f"] = "\\f",
|
||||
["\r"] = "\\r",
|
||||
['"'] = '\\"',
|
||||
["\\"] = "\\\\",
|
||||
["/"] = "\\/"
|
||||
}
|
||||
}
|
||||
JsonWriter.New = function(self)
|
||||
local o = setmetatable({ }, self)
|
||||
o.writer = StringBuilder:New()
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
JsonWriter.Append = function(self, s)
|
||||
return self.writer:Append(s)
|
||||
end
|
||||
JsonWriter.ToString = function(self)
|
||||
return self.writer:ToString()
|
||||
end
|
||||
JsonWriter.Write = function(self, o)
|
||||
local _exp_0 = type(o)
|
||||
if "nil" == _exp_0 then
|
||||
return self:WriteNil()
|
||||
elseif "boolean" == _exp_0 or "number" == _exp_0 then
|
||||
return self:WriteString(o)
|
||||
elseif "string" == _exp_0 then
|
||||
return self:ParseString(o)
|
||||
elseif "table" == _exp_0 then
|
||||
return self:WriteTable(o)
|
||||
elseif "function" == _exp_0 then
|
||||
return self:WriteFunction(o)
|
||||
elseif "thread" == _exp_0 or "userdata" == _exp_0 then
|
||||
return self:WriteError(o)
|
||||
end
|
||||
end
|
||||
JsonWriter.WriteNil = function(self)
|
||||
return self:Append("null")
|
||||
end
|
||||
JsonWriter.WriteString = function(self, o)
|
||||
return self:Append(tostring(o))
|
||||
end
|
||||
JsonWriter.ParseString = function(self, s)
|
||||
self:Append('"')
|
||||
self:Append(string.gsub(s, '[%z%c\\"/]', function(n)
|
||||
local c = self.backslashes[n]
|
||||
if c then
|
||||
return c
|
||||
end
|
||||
return string.format("\\u%.4X", string.byte(n))
|
||||
end))
|
||||
return self:Append('"')
|
||||
end
|
||||
JsonWriter.IsArray = function(self, t)
|
||||
local count = 0
|
||||
local isindex
|
||||
isindex = function(k)
|
||||
if type(k) == "number" and k > 0 and math.floor(k) == k then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
for k, _ in pairs(t) do
|
||||
if not isindex(k) then
|
||||
return false, "{", "}"
|
||||
else
|
||||
count = math.max(count, k)
|
||||
end
|
||||
end
|
||||
return true, "[", "]", count
|
||||
end
|
||||
JsonWriter.WriteTable = function(self, t)
|
||||
local ba, st, et, n = self:IsArray(t)
|
||||
self:Append(st)
|
||||
if ba then
|
||||
for i = 1, n do
|
||||
self:Write(t[i])
|
||||
if i < n then
|
||||
self:Append(",")
|
||||
end
|
||||
end
|
||||
else
|
||||
local first = true
|
||||
for k, v in pairs(t) do
|
||||
if not first then
|
||||
self:Append(",")
|
||||
end
|
||||
first = false
|
||||
self:ParseString(k)
|
||||
self:Append(":")
|
||||
self:Write(v)
|
||||
end
|
||||
end
|
||||
return self:Append(et)
|
||||
end
|
||||
JsonWriter.WriteError = function(self, o)
|
||||
return error(string.format("Encoding of %s unsupported", tostring(o)))
|
||||
end
|
||||
JsonWriter.WriteFunction = function(self, o)
|
||||
if o == Null then
|
||||
return self:WriteNil()
|
||||
else
|
||||
return self:WriteError(o)
|
||||
end
|
||||
end
|
||||
local StringReader = {
|
||||
s = "",
|
||||
i = 0
|
||||
}
|
||||
StringReader.New = function(self, s)
|
||||
local o = setmetatable({ }, self)
|
||||
self.__index = self
|
||||
o.s = s or o.s
|
||||
return o
|
||||
end
|
||||
StringReader.Peek = function(self)
|
||||
local i = self.i + 1
|
||||
if i <= #self.s then
|
||||
return string.sub(self.s, i, i)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
StringReader.Next = function(self)
|
||||
self.i = self.i + 1
|
||||
if self.i <= #self.s then
|
||||
return string.sub(self.s, self.i, self.i)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
StringReader.All = function(self)
|
||||
return self.s
|
||||
end
|
||||
local JsonReader = {
|
||||
escapes = {
|
||||
["t"] = "\t",
|
||||
["n"] = "\n",
|
||||
["f"] = "\f",
|
||||
["r"] = "\r",
|
||||
["b"] = "\b"
|
||||
}
|
||||
}
|
||||
JsonReader.New = function(self, s)
|
||||
local o = setmetatable({ }, self)
|
||||
o.reader = StringReader:New(s)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
JsonReader.Read = function(self)
|
||||
self:SkipWhiteSpace()
|
||||
local peek = self:Peek()
|
||||
if not (peek ~= nil) then
|
||||
return error(string.format("Nil string: '%s'", self:All()))
|
||||
elseif peek == "{" then
|
||||
return self:ReadObject()
|
||||
elseif peek == "[" then
|
||||
return self:ReadArray()
|
||||
elseif peek == '"' then
|
||||
return self:ReadString()
|
||||
elseif string.find(peek, "[%+%-%d]") then
|
||||
return self:ReadNumber()
|
||||
elseif peek == "t" then
|
||||
return self:ReadTrue()
|
||||
elseif peek == "f" then
|
||||
return self:ReadFalse()
|
||||
elseif peek == "n" then
|
||||
return self:ReadNull()
|
||||
elseif peek == "/" then
|
||||
self:ReadComment()
|
||||
return self:Read()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
JsonReader.ReadTrue = function(self)
|
||||
self:TestReservedWord({
|
||||
't',
|
||||
'r',
|
||||
'u',
|
||||
'e'
|
||||
})
|
||||
return true
|
||||
end
|
||||
JsonReader.ReadFalse = function(self)
|
||||
self:TestReservedWord({
|
||||
'f',
|
||||
'a',
|
||||
'l',
|
||||
's',
|
||||
'e'
|
||||
})
|
||||
return false
|
||||
end
|
||||
JsonReader.ReadNull = function(self)
|
||||
self:TestReservedWord({
|
||||
'n',
|
||||
'u',
|
||||
'l',
|
||||
'l'
|
||||
})
|
||||
return nil
|
||||
end
|
||||
JsonReader.TestReservedWord = function(self, t)
|
||||
for _, v in ipairs(t) do
|
||||
if self:Next() ~= v then
|
||||
error(string.format("Error reading '%s': %s", table.concat(t), self:All()))
|
||||
end
|
||||
end
|
||||
end
|
||||
JsonReader.ReadNumber = function(self)
|
||||
local result = self:Next()
|
||||
local peek = self:Peek()
|
||||
while (peek ~= nil) and string.find(peek, "[%+%-%d%.eE]") do
|
||||
result = result .. self:Next()
|
||||
peek = self:Peek()
|
||||
end
|
||||
result = tonumber(result)
|
||||
if not (result ~= nil) then
|
||||
return error(string.format("Invalid number: '%s'", result))
|
||||
else
|
||||
return result
|
||||
end
|
||||
end
|
||||
JsonReader.ReadString = function(self)
|
||||
local result = ""
|
||||
assert(self:Next() == '"')
|
||||
while self:Peek() ~= '"' do
|
||||
local ch = self:Next()
|
||||
if ch == "\\" then
|
||||
ch = self:Next()
|
||||
if self.escapes[ch] then
|
||||
ch = self.escapes[ch]
|
||||
end
|
||||
end
|
||||
result = result .. ch
|
||||
end
|
||||
assert(self:Next() == '"')
|
||||
local fromunicode
|
||||
fromunicode = function(m)
|
||||
return string.char(tonumber(m, 16))
|
||||
end
|
||||
return string.gsub(result, "u%x%x(%x%x)", fromunicode)
|
||||
end
|
||||
JsonReader.ReadComment = function(self)
|
||||
assert(self:Next() == "/")
|
||||
local second = self:Next()
|
||||
if second == "/" then
|
||||
return self:ReadSingleLineComment()
|
||||
elseif second == "*" then
|
||||
return self:ReadBlockComment()
|
||||
else
|
||||
return error(string.format("Invalid comment: %s", self:All()))
|
||||
end
|
||||
end
|
||||
JsonReader.ReadBlockComment = function(self)
|
||||
local done = false
|
||||
while not done do
|
||||
local ch = self:Next()
|
||||
if ch == "*" and self:Peek() == "/" then
|
||||
done = true
|
||||
end
|
||||
if not done and ch == "/" and self:Peek() == "*" then
|
||||
error(string.format("Invalid comment: %s, '/*' illegal.", self:All()))
|
||||
end
|
||||
end
|
||||
return self:Next()
|
||||
end
|
||||
JsonReader.ReadSingleLineComment = function(self)
|
||||
local ch = self:Next()
|
||||
while ch ~= "\r" and ch ~= "\n" do
|
||||
ch = self:Next()
|
||||
end
|
||||
end
|
||||
JsonReader.ReadArray = function(self)
|
||||
local result = { }
|
||||
assert(self:Next() == "[")
|
||||
local done = false
|
||||
if self:Peek() == "]" then
|
||||
done = true
|
||||
end
|
||||
while not done do
|
||||
local item = self:Read()
|
||||
result[#result + 1] = item
|
||||
self:SkipWhiteSpace()
|
||||
if self:Peek() == "]" then
|
||||
done = true
|
||||
end
|
||||
if not done then
|
||||
local ch = self:Next()
|
||||
if ch ~= "," then
|
||||
error(string.format("Invalid array: '%s' due to: '%s'", self:All(), ch))
|
||||
end
|
||||
end
|
||||
end
|
||||
assert("]" == self:Next())
|
||||
return result
|
||||
end
|
||||
JsonReader.ReadObject = function(self)
|
||||
local result = { }
|
||||
assert(self:Next() == "{")
|
||||
local done = false
|
||||
if self:Peek() == "}" then
|
||||
done = true
|
||||
end
|
||||
while not done do
|
||||
local key = self:Read()
|
||||
if type(key) ~= "string" then
|
||||
error(string.format("Invalid non-string object key: %s", key))
|
||||
end
|
||||
self:SkipWhiteSpace()
|
||||
local ch = self:Next()
|
||||
if ch ~= ":" then
|
||||
error(string.format("Invalid object: '%s' due to: '%s'", self:All(), ch))
|
||||
end
|
||||
self:SkipWhiteSpace()
|
||||
local val = self:Read()
|
||||
result[key] = val
|
||||
self:SkipWhiteSpace()
|
||||
if self:Peek() == "}" then
|
||||
done = true
|
||||
end
|
||||
if not done then
|
||||
ch = self:Next()
|
||||
if ch ~= "," then
|
||||
error(string.format("Invalid array: '%s' near: '%s'", self:All(), ch))
|
||||
end
|
||||
end
|
||||
end
|
||||
assert(self:Next() == "}")
|
||||
return result
|
||||
end
|
||||
JsonReader.SkipWhiteSpace = function(self)
|
||||
local p = self:Peek()
|
||||
while (p ~= nil) and string.find(p, "[%s/]") do
|
||||
if p == "/" then
|
||||
self:ReadComment()
|
||||
else
|
||||
self:Next()
|
||||
end
|
||||
p = self:Peek()
|
||||
end
|
||||
end
|
||||
JsonReader.Peek = function(self)
|
||||
return self.reader:Peek()
|
||||
end
|
||||
JsonReader.Next = function(self)
|
||||
return self.reader:Next()
|
||||
end
|
||||
JsonReader.All = function(self)
|
||||
return self.reader:All()
|
||||
end
|
||||
local Encode
|
||||
Encode = function(o)
|
||||
local _with_0 = JsonWriter:New()
|
||||
_with_0:Write(o)
|
||||
_with_0:ToString()
|
||||
return _with_0
|
||||
end
|
||||
local Decode
|
||||
Decode = function(s)
|
||||
local _with_0 = JsonReader:New(s)
|
||||
_with_0:Read()
|
||||
return _with_0
|
||||
end
|
||||
t.DecodeJSON = function(jsonString)
|
||||
pcall(function()
|
||||
return warn('RbxUtility.DecodeJSON is deprecated, please use Game:GetService("HttpService"):JSONDecode() instead.')
|
||||
end)
|
||||
if type(jsonString) == "string" then
|
||||
return Decode(jsonString)
|
||||
end
|
||||
print("RbxUtil.DecodeJSON expects string argument!")
|
||||
return nil
|
||||
end
|
||||
t.EncodeJSON = function(jsonTable)
|
||||
pcall(function()
|
||||
return warn('RbxUtility.EncodeJSON is deprecated, please use Game:GetService("HttpService"):JSONEncode() instead.')
|
||||
end)
|
||||
return Encode(jsonTable)
|
||||
end
|
||||
t.MakeWedge = function(x, y, z, _)
|
||||
return game:GetService("Terrain"):AutoWedgeCell(x, y, z)
|
||||
end
|
||||
t.SelectTerrainRegion = function(regionToSelect, color, selectEmptyCells, selectionParent)
|
||||
local terrain = game.Workspace:FindFirstChild("Terrain")
|
||||
if not terrain then
|
||||
return
|
||||
end
|
||||
assert(regionToSelect)
|
||||
assert(color)
|
||||
if not type(regionToSelect) == "Region3" then
|
||||
error("regionToSelect (first arg), should be of type Region3, but is type", type(regionToSelect))
|
||||
end
|
||||
if not type(color) == "BrickColor" then
|
||||
error("color (second arg), should be of type BrickColor, but is type", type(color))
|
||||
end
|
||||
local GetCell = terrain.GetCell
|
||||
local WorldToCellPreferSolid = terrain.WorldToCellPreferSolid
|
||||
local CellCenterToWorld = terrain.CellCenterToWorld
|
||||
local emptyMaterial = Enum.CellMaterial.Empty
|
||||
local selectionContainer = New("Model", "SelectionContainer", {
|
||||
Archivable = false,
|
||||
Parent = (function()
|
||||
if selectionParent then
|
||||
return selectionParent
|
||||
else
|
||||
return game.Workspace
|
||||
end
|
||||
end)()
|
||||
})
|
||||
local updateSelection
|
||||
local currentKeepAliveTag
|
||||
local aliveCounter = 0
|
||||
local lastRegion
|
||||
local adornments = { }
|
||||
local reusableAdorns = { }
|
||||
local selectionPart = New("Part", "SelectionPart", {
|
||||
Transparency = 1,
|
||||
Anchored = true,
|
||||
Locked = true,
|
||||
CanCollide = false,
|
||||
Size = Vector3.new(4.2, 4.2, 4.2)
|
||||
})
|
||||
local selectionBox = Instance.new("SelectionBox")
|
||||
local createAdornment
|
||||
createAdornment = function(theColor)
|
||||
local selectionPartClone
|
||||
local selectionBoxClone
|
||||
if #reusableAdorns > 0 then
|
||||
selectionPartClone = reusableAdorns[1]["part"]
|
||||
selectionBoxClone = reusableAdorns[1]["box"]
|
||||
table.remove(reusableAdorns, 1)
|
||||
selectionBoxClone.Visible = true
|
||||
else
|
||||
selectionPartClone = selectionPart:Clone()
|
||||
selectionPartClone.Archivable = false
|
||||
selectionBoxClone = selectionBox:Clone()
|
||||
selectionBoxClone.Archivable = false
|
||||
selectionBoxClone.Adornee = selectionPartClone
|
||||
selectionBoxClone.Parent = selectionContainer
|
||||
selectionBoxClone.Adornee = selectionPartClone
|
||||
selectionBoxClone.Parent = selectionContainer
|
||||
end
|
||||
if theColor then
|
||||
selectionBoxClone.Color = theColor
|
||||
end
|
||||
return selectionPartClone, selectionBoxClone
|
||||
end
|
||||
local cleanUpAdornments
|
||||
cleanUpAdornments = function()
|
||||
for cellPos, adornTable in pairs(adornments) do
|
||||
if adornTable.KeepAlive ~= currentKeepAliveTag then
|
||||
adornTable.SelectionBox.Visible = false
|
||||
table.insert(reusableAdorns, {
|
||||
part = adornTable.SelectionPart,
|
||||
box = adornTable.SelectionBox
|
||||
})
|
||||
adornments[cellPos] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
local incrementAliveCounter
|
||||
incrementAliveCounter = function()
|
||||
aliveCounter = aliveCounter + 1
|
||||
if aliveCounter > 1000000 then
|
||||
aliveCounter = 0
|
||||
end
|
||||
return aliveCounter
|
||||
end
|
||||
local adornFullCellsInRegion
|
||||
adornFullCellsInRegion = function(region, color)
|
||||
local regionBegin = region.CFrame.p - region.Size / 2 + Vector3.new(2, 2, 2)
|
||||
local regionEnd = region.CFrame.p + region.Size / 2 - Vector3.new(2, 2, 2)
|
||||
local cellPosBegin = WorldToCellPreferSolid(terrain, regionBegin)
|
||||
local cellPosEnd = WorldToCellPreferSolid(terrain, regionEnd)
|
||||
currentKeepAliveTag = incrementAliveCounter()
|
||||
for y = cellPosBegin.y, cellPosEnd.y do
|
||||
for z = cellPosBegin.z, cellPosEnd.z do
|
||||
for x = cellPosBegin.x, cellPosEnd.x do
|
||||
local cellMaterial = GetCell(terrain, x, y, z)
|
||||
if cellMaterial ~= emptyMaterial then
|
||||
local cframePos = CellCenterToWorld(terrain, x, y, z)
|
||||
local cellPos = Vector3int16.new(x, y, z)
|
||||
local updated = false
|
||||
for cellPosAdorn, adornTable in pairs(adornments) do
|
||||
if cellPosAdorn == cellPos then
|
||||
adornTable.KeepAlive = currentKeepAliveTag
|
||||
if color then
|
||||
adornTable.SelectionBox.Color = color
|
||||
end
|
||||
updated = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if not updated then
|
||||
local selectionPart, selectionBox
|
||||
selectionPart, selectionBox = createAdornment(color)
|
||||
selectionPart.Size = Vector3.new(4, 4, 4)
|
||||
selectionPart.CFrame = CFrame.new(cframePos)
|
||||
local adornTable = {
|
||||
SelectionPart = selectionPart,
|
||||
SelectionBox = selectionBox,
|
||||
KeepAlive = currentKeepAliveTag
|
||||
}
|
||||
adornments[cellPos] = adornTable
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return cleanUpAdornments()
|
||||
end
|
||||
lastRegion = regionToSelect
|
||||
if selectEmptyCells then
|
||||
local selectionPart, selectionBox
|
||||
selectionPart, selectionBox = createAdornment(color)
|
||||
selectionPart.Size = regionToSelect.Size
|
||||
selectionPart.CFrame = regionToSelect.CFrame
|
||||
adornments.SelectionPart = selectionPart
|
||||
adornments.SelectionBox = selectionBox
|
||||
updateSelection = function(newRegion, color)
|
||||
if newRegion and newRegion ~= lastRegion then
|
||||
lastRegion = newRegion
|
||||
selectionPart.Size = newRegion.Size
|
||||
selectionPart.CFrame = newRegion.CFrame
|
||||
end
|
||||
if color then
|
||||
selectionBox.Color = color
|
||||
end
|
||||
end
|
||||
else
|
||||
adornFullCellsInRegion(regionToSelect, color)
|
||||
updateSelection = function(newRegion, color)
|
||||
if newRegion and newRegion ~= lastRegion then
|
||||
lastRegion = newRegion
|
||||
return adornFullCellsInRegion(newRegion, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
local destroyFunc
|
||||
destroyFunc = function()
|
||||
updateSelection = nil
|
||||
if selectionContainer ~= nil then
|
||||
selectionContainer:Destroy()
|
||||
end
|
||||
adornments = nil
|
||||
end
|
||||
return updateSelection, destroyFunc
|
||||
end
|
||||
t.CreateSignal = function()
|
||||
local this = { }
|
||||
local mBindableEvent = Instance.new("BindableEvent")
|
||||
local mAllCns = { }
|
||||
this.connect = function(self, func)
|
||||
if self ~= this then
|
||||
error("connect must be called with `:`, not `.`", 2)
|
||||
end
|
||||
if type(func) ~= "function" then
|
||||
error("Argument #1 of connect must be a function, got a " .. tostring(type(func)), 2)
|
||||
end
|
||||
local cn = mBindableEvent.Event:connect(func)
|
||||
mAllCns[cn] = true
|
||||
local pubCn = { }
|
||||
pubCn.disconnect = function(self)
|
||||
cn:disconnect()
|
||||
mAllCns[cn] = nil
|
||||
end
|
||||
pubCn.Disconnect = pubCn.disconnect
|
||||
return pubCn
|
||||
end
|
||||
this.disconnect = function(self)
|
||||
if self ~= this then
|
||||
error("disconnect must be called with `:`, not `.`", 2)
|
||||
end
|
||||
for cn, _ in pairs(mAllCns) do
|
||||
cn:disconnect()
|
||||
mAllCns[cn] = nil
|
||||
end
|
||||
end
|
||||
this.wait = function(self)
|
||||
if self ~= this then
|
||||
error("wait must be called with `:`, not `.`", 2)
|
||||
end
|
||||
return mBindableEvent.Event:wait()
|
||||
end
|
||||
this.fire = function(self, ...)
|
||||
if self ~= this then
|
||||
error("fire must be called with `:`, not `.`", 2)
|
||||
end
|
||||
return mBindableEvent:Fire(...)
|
||||
end
|
||||
this.Connect = this.connect
|
||||
this.Disconnect = this.disconnect
|
||||
this.Wait = this.wait
|
||||
this.Fire = this.fire
|
||||
return this
|
||||
end
|
||||
local Create_PrivImpl
|
||||
Create_PrivImpl = function(objectType)
|
||||
if type(objectType) ~= "string" then
|
||||
error("Argument of Create must be a string", 2)
|
||||
end
|
||||
return function(dat)
|
||||
dat = dat or { }
|
||||
local obj = Instance.new(objectType)
|
||||
local parent
|
||||
local ctor
|
||||
for k, v in pairs(dat) do
|
||||
if type(k) == "string" then
|
||||
if k == "Parent" then
|
||||
parent = v
|
||||
else
|
||||
obj[k] = v
|
||||
end
|
||||
elseif type(k) == "number" then
|
||||
if type(v) ~= "userdata" then
|
||||
error("Bad entry in Create body: Numeric keys must be paired with children, got a: " .. tostring(type(v)), 2)
|
||||
end
|
||||
v.Parent = obj
|
||||
elseif type(k) == "table" and k.__eventname then
|
||||
if type(v) ~= "function" then
|
||||
error("Bad entry in Create body: Key `[Create.E'" .. tostring(k.__eventname) .. "']` must have a function value, got: " .. tostring(v), 2)
|
||||
end
|
||||
obj[k.__eventname]:connect(v)
|
||||
elseif k == t.Create then
|
||||
if type(v) ~= "function" then
|
||||
error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, got: " .. tostring(v), 2)
|
||||
elseif ctor then
|
||||
error("Bad entry in Create body: Only one constructor function is allowed", 2)
|
||||
end
|
||||
ctor = v
|
||||
else
|
||||
error("Bad entry (" .. tostring(k) .. " => " .. tostring(v) .. ") in Create body", 2)
|
||||
end
|
||||
end
|
||||
if ctor ~= nil then
|
||||
ctor(obj)
|
||||
end
|
||||
if parent then
|
||||
obj.Parent = parent
|
||||
end
|
||||
return obj
|
||||
end
|
||||
end
|
||||
t.Create = setmetatable({ }, {
|
||||
["__call"] = function(_, ...)
|
||||
return Create_PrivImpl(...)
|
||||
end
|
||||
})
|
||||
t.Create.E = function(eventName)
|
||||
return {
|
||||
__eventname = eventName
|
||||
}
|
||||
end
|
||||
t.Help = function(funcNameOrFunc)
|
||||
if "DecodeJSON" == funcNameOrFunc or t.DecodeJSON == funcNameOrFunc then
|
||||
return "Function DecodeJSON. " .. "Arguments: (string). " .. "Side effect: returns a table with all parsed JSON values"
|
||||
elseif "EncodeJSON" == funcNameOrFunc or t.EncodeJSON == funcNameOrFunc then
|
||||
return "Function EncodeJSON. " .. "Arguments: (table). " .. "Side effect: returns a string composed of argument table in JSON data format"
|
||||
elseif "MakeWedge" == funcNameOrFunc or t.MakeWedge == funcNameOrFunc then
|
||||
return "Function MakeWedge. " .. "Arguments: (x, y, z, [default material]). " .. "Description: Makes a wedge at location x, y, z. Sets cell x, y, z to default material if " .. "parameter is provided, if not sets cell x, y, z to be whatever material it previously was. " .. "Returns true if made a wedge, false if the cell remains a block "
|
||||
elseif "SelectTerrainRegion" == funcNameOrFunc or t.SelectTerrainRegion == funcNameOrFunc then
|
||||
return "Function SelectTerrainRegion. " .. "Arguments: (regionToSelect, color, selectEmptyCells, selectionParent). " .. "Description: Selects all terrain via a series of selection boxes within the regionToSelect " .. "(this should be a region3 value). The selection box color is detemined by the color argument " .. "(should be a brickcolor value). SelectionParent is the parent that the selection model gets placed to (optional)." .. "SelectEmptyCells is bool, when true will select all cells in the " .. "region, otherwise we only select non-empty cells. Returns a function that can update the selection," .. "arguments to said function are a new region3 to select, and the adornment color (color arg is optional). " .. "Also returns a second function that takes no arguments and destroys the selection"
|
||||
elseif "CreateSignal" == funcNameOrFunc or t.CreateSignal == funcNameOrFunc then
|
||||
return "Function CreateSignal. " .. "Arguments: None. " .. "Returns: The newly created Signal object. This object is identical to the RBXScriptSignal class " .. "used for events in Objects, but is a Lua-side object so it can be used to create custom events in" .. "Lua code. " .. "Methods of the Signal object: :connect, :wait, :fire, :disconnect. " .. "For more info you can pass the method name to the Help function, or view the wiki page " .. "for this library. EG: Help('Signal:connect')."
|
||||
elseif "Signal:connect" == funcNameOrFunc then
|
||||
return "Method Signal:connect. " .. "Arguments: (function handler). " .. "Return: A connection object which can be used to disconnect the connection to this handler. " .. "Description: Connectes a handler function to this Signal, so that when |fire| is called the " .. "handler function will be called with the arguments passed to |fire|."
|
||||
elseif "Signal:wait" == funcNameOrFunc then
|
||||
return "Method Signal:wait. " .. "Arguments: None. " .. "Returns: The arguments passed to the next call to |fire|. " .. "Description: This call does not return until the next call to |fire| is made, at which point it " .. "will return the values which were passed as arguments to that |fire| call."
|
||||
elseif "Signal:fire" == funcNameOrFunc then
|
||||
return "Method Signal:fire. " .. "Arguments: Any number of arguments of any type. " .. "Returns: None. " .. "Description: This call will invoke any connected handler functions, and notify any waiting code " .. "attached to this Signal to continue, with the arguments passed to this function. Note: The calls " .. "to handlers are made asynchronously, so this call will return immediately regardless of how long " .. "it takes the connected handler functions to complete."
|
||||
elseif "Signal:disconnect" == funcNameOrFunc then
|
||||
return "Method Signal:disconnect. " .. "Arguments: None. " .. "Returns: None. " .. "Description: This call disconnects all handlers attacched to this function, note however, it " .. "does NOT make waiting code continue, as is the behavior of normal Roblox events. This method " .. "can also be called on the connection object which is returned from Signal:connect to only " .. "disconnect a single handler, as opposed to this method, which will disconnect all handlers."
|
||||
elseif "Create" == funcNameOrFunc then
|
||||
return "Function Create. " .. "Arguments: A table containing information about how to construct a collection of objects. " .. "Returns: The constructed objects. " .. "Descrition: Create is a very powerfull function, whose description is too long to fit here, and " .. "is best described via example, please see the wiki page for a description of how to use it."
|
||||
end
|
||||
end
|
||||
return t
|
||||
|
|
|
|||
|
|
@ -1,7 +1,22 @@
|
|||
local a,b,c=3569749,game:GetService'ScriptContext',0 while not b and c<3 do c=c+
|
||||
1 b=game:GetService'ScriptContext'wait(0.2)end if b then b:RegisterLibrary(
|
||||
'Libraries/RbxGui','45284430')b:RegisterLibrary('Libraries/RbxGear','45374389')
|
||||
if game.PlaceId==a then b:RegisterLibrary('Libraries/RbxStatus','52177566')end b
|
||||
:RegisterLibrary('Libraries/RbxUtility','60595411')b:RegisterLibrary(
|
||||
'Libraries/RbxStamper','73157242')b:LibraryRegistrationComplete()else print
|
||||
'failed to find script context, libraries did not load'end
|
||||
print("[Mercury]: Loaded corescript 60595695")
|
||||
local deepakTestingPlace = 3569749
|
||||
local sc = game:GetService("ScriptContext")
|
||||
local tries = 0
|
||||
while not (sc or tries > 2) do
|
||||
tries = tries + 1
|
||||
sc = game:GetService("ScriptContext")
|
||||
wait(0.2)
|
||||
end
|
||||
if sc then
|
||||
sc:RegisterLibrary("Libraries/RbxGui", "45284430")
|
||||
sc:RegisterLibrary("Libraries/RbxGear", "45374389")
|
||||
if game.PlaceId == deepakTestingPlace then
|
||||
sc:RegisterLibrary("Libraries/RbxStatus", "52177566")
|
||||
end
|
||||
sc:RegisterLibrary("Libraries/RbxUtility", "60595411")
|
||||
sc:RegisterLibrary("Libraries/RbxStamper", "73157242")
|
||||
sc:LibraryRegistrationComplete()
|
||||
else
|
||||
print("failed to find script context, libraries did not load")
|
||||
end
|
||||
return sc
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,97 +1,390 @@
|
|||
if game.CoreGui.Version<7 then return end local function waitForChild(a,b)while
|
||||
not a:FindFirstChild(b)do a.ChildAdded:wait()end return a:FindFirstChild(b)end
|
||||
local function waitForProperty(a,b)while not a[b]do a.Changed:wait()end end
|
||||
waitForChild(game,'Players')if#game.Players:GetChildren()<1 then game.Players.
|
||||
ChildAdded:wait()end waitForProperty(game.Players,'LocalPlayer')local a=script.
|
||||
Parent waitForChild(a,'Gear')local b=script.Parent.Parent assert(b:IsA
|
||||
'ScreenGui')waitForChild(a,'Tabs')waitForChild(a.Tabs,'CloseButton')local c=a.
|
||||
Tabs.CloseButton waitForChild(a.Tabs,'InventoryButton')local d,e=a.Tabs.
|
||||
InventoryButton,nil if game.CoreGui.Version>=8 then waitForChild(a.Tabs,
|
||||
'WardrobeButton')e=a.Tabs.WardrobeButton end waitForChild(a.Parent,
|
||||
'ControlFrame')local f,g,h=waitForChild(a.Parent.ControlFrame,'BackpackButton'),
|
||||
'gear',waitForChild(a,'SearchFrame')waitForChild(a.SearchFrame,'SearchBoxFrame')
|
||||
local i,j,k,l=waitForChild(a.SearchFrame.SearchBoxFrame,'SearchBox'),
|
||||
waitForChild(a.SearchFrame,'SearchButton'),waitForChild(a.SearchFrame,
|
||||
'ResetButton'),waitForChild(Game.CoreGui,'RobloxGui')local m=waitForChild(l,
|
||||
'CurrentLoadout')local n,o,p,q,r,s,t,u,v,w,x,y=waitForChild(m,'Background'),true
|
||||
,true,false,true,false,nil,0.25,'Search...','~','`',UDim2.new(0,600,0,400)if l.
|
||||
AbsoluteSize.Y<=320 then y=UDim2.new(0,200,0,140)end function createPublicEvent(
|
||||
z)assert(z,'eventName is nil')assert(tostring(z),'eventName is not a string')
|
||||
local A=Instance.new'BindableEvent'A.Name=tostring(z)A.Parent=script return A
|
||||
end function createPublicFunction(z,A)assert(z,'funcName is nil')assert(
|
||||
tostring(z),'funcName is not a string')assert(A,'invokeFunc is nil')assert(type(
|
||||
A)=='function',"invokeFunc should be of type 'function'")local B=Instance.new
|
||||
'BindableFunction'B.Name=tostring(z)B.OnInvoke=A B.Parent=script return B end
|
||||
local z,A,B,C,D=createPublicEvent'ResizeEvent',createPublicEvent
|
||||
'BackpackOpenEvent',createPublicEvent'BackpackCloseEvent',createPublicEvent
|
||||
'TabClickedEvent',createPublicEvent'SearchRequestedEvent'function
|
||||
deactivateBackpack()a.Visible=false r=false end function
|
||||
initHumanoidDiedConnections()if t then t:disconnect()end waitForProperty(game.
|
||||
Players.LocalPlayer,'Character')waitForChild(game.Players.LocalPlayer.Character,
|
||||
'Humanoid')t=game.Players.LocalPlayer.Character.Humanoid.Died:connect(
|
||||
deactivateBackpack)end function activateBackpack()initHumanoidDiedConnections()r
|
||||
=true a.Visible=q if q then toggleBackpack()end end local E=function()q=false p=
|
||||
false f.Selected=false resetSearch()B:Fire(g)a.Tabs.Visible=false h.Visible=
|
||||
false a:TweenSizeAndPosition(UDim2.new(0,y.X.Offset,0,0),UDim2.new(0.5,-y.X.
|
||||
Offset/2,1,-85),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,u,true,function()
|
||||
game.GuiService:RemoveCenterDialog(a)a.Visible=false f.Selected=false end)delay(
|
||||
u,function()game.GuiService:RemoveCenterDialog(a)a.Visible=false f.Selected=
|
||||
false p=true o=true end)end function showBackpack()game.GuiService:
|
||||
AddCenterDialog(a,Enum.CenterDialogType.PlayerInitiatedDialog,function()a.
|
||||
Visible=true f.Selected=true end,function()a.Visible=false f.Selected=false end)
|
||||
a.Visible=true f.Selected=true a:TweenSizeAndPosition(y,UDim2.new(0.5,-y.X.
|
||||
Offset/2,1,-y.Y.Offset-88),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,u,true
|
||||
)delay(u,function()a.Tabs.Visible=false h.Visible=true A:Fire(g)o=true p=true f.
|
||||
Image='http://www.roblox.com/asset/?id=97644093'f.Position=UDim2.new(0.5,-60,1,-
|
||||
y.Y.Offset-103)end)end function toggleBackpack()if not game.Players.LocalPlayer
|
||||
then return end if not game.Players.LocalPlayer['Character']then return end if
|
||||
not o then return end if not p then return end p=false o=false q=not q if q then
|
||||
n.Image='http://www.roblox.com/asset/?id=97623721'n.Position=UDim2.new(-3E-2,0,-
|
||||
0.17,0)n.Size=UDim2.new(1.05,0,1.25,0)n.ZIndex=2 n.Visible=true showBackpack()
|
||||
else f.Position=UDim2.new(0.5,-60,1,-44)n.Visible=false f.Selected=false f.Image
|
||||
='http://www.roblox.com/asset/?id=97617958'n.Image=
|
||||
'http://www.roblox.com/asset/?id=96536002'n.Position=UDim2.new(-0.1,0,-0.1,0)n.
|
||||
Size=UDim2.new(1.2,0,1.2,0)E()local F=m:GetChildren()for G=1,#F do if F[G]and F[
|
||||
G]:IsA'Frame'then local H=F[G]if#H:GetChildren()>0 then f.Position=UDim2.new(0.5
|
||||
,-60,1,-108)f.Visible=true n.Visible=true if H:GetChildren()[1]:IsA'ImageButton'
|
||||
then local I=H:GetChildren()[1]I.Active=true I.Draggable=false end end end end
|
||||
end end function closeBackpack()if q then toggleBackpack()end end function
|
||||
setSelected(F)assert(F)assert(F:IsA'TextButton')F.BackgroundColor3=Color3.new(1,
|
||||
1,1)F.TextColor3=Color3.new(0,0,0)F.Selected=true F.ZIndex=3 end function
|
||||
setUnselected(F)assert(F)assert(F:IsA'TextButton')F.BackgroundColor3=Color3.new(
|
||||
0,0,0)F.TextColor3=Color3.new(1,1,1)F.Selected=false F.ZIndex=1 end function
|
||||
updateTabGui(F)assert(F)if F=='gear'then setSelected(d)setUnselected(e)elseif F
|
||||
=='wardrobe'then setSelected(e)setUnselected(d)end end function mouseLeaveTab(F)
|
||||
assert(F)assert(F:IsA'TextButton')if F.Selected then return end F.
|
||||
BackgroundColor3=Color3.new(0,0,0)end function mouseOverTab(F)assert(F)assert(F:
|
||||
IsA'TextButton')if F.Selected then return end F.BackgroundColor3=Color3.new(
|
||||
0.15294117647058825,0.15294117647058825,0.15294117647058825)end function
|
||||
newTabClicked(F)assert(F)F=string.lower(F)g=F updateTabGui(F)C:Fire(F)
|
||||
resetSearch()end function trim(F)return(F:gsub('^%s*(.-)%s*$','%1'))end function
|
||||
resetSearchBoxGui()k.Visible=false i.Text=v end function doSearch()local F=i.
|
||||
Text if F==''then resetSearch()return end F=trim(F)k.Visible=true D:Fire(F)end
|
||||
function resetSearch()resetSearchBoxGui()D:Fire()end local F=function()p=true
|
||||
end function coreGuiChanged(G,H)if G==Enum.CoreGuiType.Backpack or G==Enum.
|
||||
CoreGuiType.All then r=H s=not H if s then pcall(function()game:GetService
|
||||
'GuiService':RemoveKey(w)game:GetService'GuiService':RemoveKey(x)end)else game:
|
||||
GetService'GuiService':AddKey(w)game:GetService'GuiService':AddKey(x)end
|
||||
resetSearch()h.Visible=H and q m.Visible=H a.Visible=H f.Visible=H end end
|
||||
createPublicFunction('CloseBackpack',E)createPublicFunction('BackpackReady',F)
|
||||
pcall(function()coreGuiChanged(Enum.CoreGuiType.Backpack,Game.StarterGui:
|
||||
GetCoreGuiEnabled(Enum.CoreGuiType.Backpack))Game.StarterGui.
|
||||
CoreGuiChangedSignal:connect(coreGuiChanged)end)d.MouseButton1Click:connect(
|
||||
function()newTabClicked'gear'end)d.MouseEnter:connect(function()mouseOverTab(d)
|
||||
end)d.MouseLeave:connect(function()mouseLeaveTab(d)end)if game.CoreGui.Version>=
|
||||
8 then e.MouseButton1Click:connect(function()newTabClicked'wardrobe'end)e.
|
||||
MouseEnter:connect(function()mouseOverTab(e)end)e.MouseLeave:connect(function()
|
||||
mouseLeaveTab(e)end)end c.MouseButton1Click:connect(closeBackpack)b.Changed:
|
||||
connect(function(G)if G=='AbsoluteSize'then z:Fire(b.AbsoluteSize)end end)game:
|
||||
GetService'GuiService':AddKey(w)game:GetService'GuiService':AddKey(x)game:
|
||||
GetService'GuiService'.KeyPressed:connect(function(G)if not r or s then return
|
||||
end if G==w or G==x then toggleBackpack()end end)f.MouseButton1Click:connect(
|
||||
function()if not r or s then return end toggleBackpack()end)if game.Players.
|
||||
LocalPlayer['Character']then activateBackpack()end game.Players.LocalPlayer.
|
||||
CharacterAdded:connect(activateBackpack)i.FocusLost:connect(function(G)if G or i
|
||||
.Text~=''then doSearch()elseif i.Text==''then resetSearch()end end)j.
|
||||
MouseButton1Click:connect(doSearch)k.MouseButton1Click:connect(resetSearch)if h
|
||||
and l.AbsoluteSize.Y<=320 then h.RobloxLocked=false h:Destroy()end
|
||||
print("[Mercury]: Loaded corescript 89449093")
|
||||
if game.CoreGui.Version < 7 then
|
||||
return
|
||||
end
|
||||
local waitForChild
|
||||
waitForChild = function(instance, name)
|
||||
while not instance:FindFirstChild(name) do
|
||||
instance.ChildAdded:wait()
|
||||
end
|
||||
return instance:FindFirstChild(name)
|
||||
end
|
||||
local waitForProperty
|
||||
waitForProperty = function(instance, property)
|
||||
while not instance[property] do
|
||||
instance.Changed:wait()
|
||||
end
|
||||
end
|
||||
waitForChild(game, "Players")
|
||||
if #game.Players:GetChildren() < 1 then
|
||||
game.Players.ChildAdded:wait()
|
||||
end
|
||||
waitForProperty(game.Players, "LocalPlayer")
|
||||
local backpack = script.Parent
|
||||
waitForChild(backpack, "Gear")
|
||||
local screen = script.Parent.Parent
|
||||
assert(screen:IsA("ScreenGui"))
|
||||
waitForChild(backpack, "Tabs")
|
||||
waitForChild(backpack.Tabs, "CloseButton")
|
||||
local closeButton = backpack.Tabs.CloseButton
|
||||
waitForChild(backpack.Tabs, "InventoryButton")
|
||||
local inventoryButton = backpack.Tabs.InventoryButton
|
||||
local wardrobeButton
|
||||
if game.CoreGui.Version >= 8 then
|
||||
waitForChild(backpack.Tabs, "WardrobeButton")
|
||||
wardrobeButton = backpack.Tabs.WardrobeButton
|
||||
end
|
||||
waitForChild(backpack.Parent, "ControlFrame")
|
||||
local backpackButton = waitForChild(backpack.Parent.ControlFrame, "BackpackButton")
|
||||
local currentTab = "gear"
|
||||
local searchFrame = waitForChild(backpack, "SearchFrame")
|
||||
waitForChild(backpack.SearchFrame, "SearchBoxFrame")
|
||||
local searchBox = waitForChild(backpack.SearchFrame.SearchBoxFrame, "SearchBox")
|
||||
local searchButton = waitForChild(backpack.SearchFrame, "SearchButton")
|
||||
local resetButton = waitForChild(backpack.SearchFrame, "ResetButton")
|
||||
local robloxGui = waitForChild(Game.CoreGui, "RobloxGui")
|
||||
local currentLoadout = waitForChild(robloxGui, "CurrentLoadout")
|
||||
local loadoutBackground = waitForChild(currentLoadout, "Background")
|
||||
local canToggle = true
|
||||
local readyForNextEvent = true
|
||||
local backpackIsOpen = false
|
||||
local active = true
|
||||
local disabledByDeveloper = false
|
||||
local humanoidDiedCon
|
||||
local guiTweenSpeed = 0.25
|
||||
local searchDefaultText = "Search..."
|
||||
local tilde = "~"
|
||||
local backquote = "`"
|
||||
local backpackSize = UDim2.new(0, 600, 0, 400)
|
||||
if robloxGui.AbsoluteSize.Y <= 320 then
|
||||
backpackSize = UDim2.new(0, 200, 0, 140)
|
||||
end
|
||||
local createPublicEvent
|
||||
createPublicEvent = function(eventName)
|
||||
assert(eventName, "eventName is nil")
|
||||
assert(tostring(eventName), "eventName is not a string")
|
||||
local _with_0 = Instance.new("BindableEvent")
|
||||
_with_0.Name = tostring(eventName)
|
||||
_with_0.Parent = script
|
||||
return _with_0
|
||||
end
|
||||
local createPublicFunction
|
||||
createPublicFunction = function(funcName, invokeFunc)
|
||||
assert(funcName, "funcName is nil")
|
||||
assert(tostring(funcName), "funcName is not a string")
|
||||
assert(invokeFunc, "invokeFunc is nil")
|
||||
assert(type(invokeFunc) == "function", "invokeFunc should be of type 'function'")
|
||||
local _with_0 = Instance.new("BindableFunction")
|
||||
_with_0.Name = tostring(funcName)
|
||||
_with_0.OnInvoke = invokeFunc
|
||||
_with_0.Parent = script
|
||||
return _with_0
|
||||
end
|
||||
local resizeEvent = createPublicEvent("ResizeEvent")
|
||||
local backpackOpenEvent = createPublicEvent("BackpackOpenEvent")
|
||||
local backpackCloseEvent = createPublicEvent("BackpackCloseEvent")
|
||||
local tabClickedEvent = createPublicEvent("TabClickedEvent")
|
||||
local searchRequestedEvent = createPublicEvent("SearchRequestedEvent")
|
||||
local resetSearchBoxGui
|
||||
resetSearchBoxGui = function()
|
||||
resetButton.Visible = false
|
||||
searchBox.Text = searchDefaultText
|
||||
end
|
||||
local resetSearch
|
||||
resetSearch = function()
|
||||
resetSearchBoxGui()
|
||||
return searchRequestedEvent:Fire()
|
||||
end
|
||||
local deactivateBackpack
|
||||
deactivateBackpack = function()
|
||||
backpack.Visible = false
|
||||
active = false
|
||||
end
|
||||
local initHumanoidDiedConnections
|
||||
initHumanoidDiedConnections = function()
|
||||
if humanoidDiedCon then
|
||||
humanoidDiedCon:disconnect()
|
||||
end
|
||||
waitForProperty(game.Players.LocalPlayer, "Character")
|
||||
waitForChild(game.Players.LocalPlayer.Character, "Humanoid")
|
||||
humanoidDiedCon = game.Players.LocalPlayer.Character.Humanoid.Died:connect(deactivateBackpack)
|
||||
end
|
||||
local hideBackpack
|
||||
hideBackpack = function()
|
||||
backpackIsOpen = false
|
||||
readyForNextEvent = false
|
||||
backpackButton.Selected = false
|
||||
resetSearch()
|
||||
backpackCloseEvent:Fire(currentTab)
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = false
|
||||
backpack:TweenSizeAndPosition(UDim2.new(0, backpackSize.X.Offset, 0, 0), UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -85), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true, function()
|
||||
game.GuiService:RemoveCenterDialog(backpack)
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
end)
|
||||
return delay(guiTweenSpeed, function()
|
||||
game.GuiService:RemoveCenterDialog(backpack)
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
readyForNextEvent = true
|
||||
canToggle = true
|
||||
end)
|
||||
end
|
||||
local showBackpack
|
||||
showBackpack = function()
|
||||
game.GuiService:AddCenterDialog(backpack, Enum.CenterDialogType.PlayerInitiatedDialog, function()
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
end, function()
|
||||
backpack.Visible = false
|
||||
backpackButton.Selected = false
|
||||
end)
|
||||
backpack.Visible = true
|
||||
backpackButton.Selected = true
|
||||
backpack:TweenSizeAndPosition(backpackSize, UDim2.new(0.5, -backpackSize.X.Offset / 2, 1, -backpackSize.Y.Offset - 88), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, guiTweenSpeed, true)
|
||||
return delay(guiTweenSpeed, function()
|
||||
backpack.Tabs.Visible = false
|
||||
searchFrame.Visible = true
|
||||
backpackOpenEvent:Fire(currentTab)
|
||||
canToggle = true
|
||||
readyForNextEvent = true
|
||||
backpackButton.Image = "http://www.roblox.com/asset/?id=97644093"
|
||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -backpackSize.Y.Offset - 103)
|
||||
end)
|
||||
end
|
||||
local toggleBackpack
|
||||
toggleBackpack = function()
|
||||
if not game.Players.LocalPlayer then
|
||||
return
|
||||
end
|
||||
if not game.Players.LocalPlayer["Character"] then
|
||||
return
|
||||
end
|
||||
if not canToggle then
|
||||
return
|
||||
end
|
||||
if not readyForNextEvent then
|
||||
return
|
||||
end
|
||||
readyForNextEvent = false
|
||||
canToggle = false
|
||||
backpackIsOpen = not backpackIsOpen
|
||||
if backpackIsOpen then
|
||||
loadoutBackground.Image = "http://www.roblox.com/asset/?id=97623721"
|
||||
loadoutBackground.Position = UDim2.new(-0.03, 0, -0.17, 0)
|
||||
loadoutBackground.Size = UDim2.new(1.05, 0, 1.25, 0)
|
||||
loadoutBackground.ZIndex = 2.0
|
||||
loadoutBackground.Visible = true
|
||||
return showBackpack()
|
||||
else
|
||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -44)
|
||||
loadoutBackground.Visible = false
|
||||
backpackButton.Selected = false
|
||||
backpackButton.Image = "http://www.roblox.com/asset/?id=97617958"
|
||||
loadoutBackground.Image = "http://www.roblox.com/asset/?id=96536002"
|
||||
loadoutBackground.Position = UDim2.new(-0.1, 0, -0.1, 0)
|
||||
loadoutBackground.Size = UDim2.new(1.2, 0, 1.2, 0)
|
||||
hideBackpack()
|
||||
local clChildren = currentLoadout:GetChildren()
|
||||
for i = 1, #clChildren do
|
||||
if clChildren[i] and clChildren[i]:IsA("Frame") then
|
||||
local frame = clChildren[i]
|
||||
if #frame:GetChildren() > 0 then
|
||||
backpackButton.Position = UDim2.new(0.5, -60, 1, -108)
|
||||
backpackButton.Visible = true
|
||||
loadoutBackground.Visible = true
|
||||
if frame:GetChildren()[1]:IsA("ImageButton") then
|
||||
local imgButton = frame:GetChildren()[1]
|
||||
imgButton.Active = true
|
||||
imgButton.Draggable = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local activateBackpack
|
||||
activateBackpack = function()
|
||||
initHumanoidDiedConnections()
|
||||
active = true
|
||||
backpack.Visible = backpackIsOpen
|
||||
if backpackIsOpen then
|
||||
return toggleBackpack()
|
||||
end
|
||||
end
|
||||
local closeBackpack
|
||||
closeBackpack = function()
|
||||
if backpackIsOpen then
|
||||
return toggleBackpack()
|
||||
end
|
||||
end
|
||||
local setSelected
|
||||
setSelected = function(tab)
|
||||
assert(tab)
|
||||
assert(tab:IsA("TextButton"))
|
||||
tab.BackgroundColor3 = Color3.new(1, 1, 1)
|
||||
tab.TextColor3 = Color3.new(0, 0, 0)
|
||||
tab.Selected = true
|
||||
tab.ZIndex = 3
|
||||
return tab
|
||||
end
|
||||
local setUnselected
|
||||
setUnselected = function(tab)
|
||||
assert(tab)
|
||||
assert(tab:IsA("TextButton"))
|
||||
tab.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||
tab.TextColor3 = Color3.new(1, 1, 1)
|
||||
tab.Selected = false
|
||||
tab.ZIndex = 1
|
||||
return tab
|
||||
end
|
||||
local updateTabGui
|
||||
updateTabGui = function(selectedTab)
|
||||
assert(selectedTab)
|
||||
if selectedTab == "gear" then
|
||||
setSelected(inventoryButton)
|
||||
return setUnselected(wardrobeButton)
|
||||
elseif selectedTab == "wardrobe" then
|
||||
setSelected(wardrobeButton)
|
||||
return setUnselected(inventoryButton)
|
||||
end
|
||||
end
|
||||
local mouseLeaveTab
|
||||
mouseLeaveTab = function(button)
|
||||
assert(button)
|
||||
assert(button:IsA("TextButton"))
|
||||
if button.Selected then
|
||||
return
|
||||
end
|
||||
button.BackgroundColor3 = Color3.new(0, 0, 0)
|
||||
end
|
||||
local mouseOverTab
|
||||
mouseOverTab = function(button)
|
||||
assert(button)
|
||||
assert(button:IsA("TextButton"))
|
||||
if button.Selected then
|
||||
return
|
||||
end
|
||||
button.BackgroundColor3 = Color3.new(39 / 255, 39 / 255, 39 / 255)
|
||||
end
|
||||
local newTabClicked
|
||||
newTabClicked = function(tabName)
|
||||
assert(tabName)
|
||||
tabName = string.lower(tabName)
|
||||
currentTab = tabName
|
||||
updateTabGui(tabName)
|
||||
tabClickedEvent:Fire(tabName)
|
||||
return resetSearch()
|
||||
end
|
||||
local trim
|
||||
trim = function(s)
|
||||
return s:gsub("^%s*(.-)%s*$", "%1")
|
||||
end
|
||||
local doSearch
|
||||
doSearch = function()
|
||||
local searchText = searchBox.Text
|
||||
if searchText == "" then
|
||||
resetSearch()
|
||||
return
|
||||
end
|
||||
searchText = trim(searchText)
|
||||
resetButton.Visible = true
|
||||
return searchRequestedEvent:Fire(searchText)
|
||||
end
|
||||
local backpackReady
|
||||
backpackReady = function()
|
||||
readyForNextEvent = true
|
||||
end
|
||||
local coreGuiChanged
|
||||
coreGuiChanged = function(coreGuiType, enabled)
|
||||
if coreGuiType == Enum.CoreGuiType.Backpack or coreGuiType == Enum.CoreGuiType.All then
|
||||
active = enabled
|
||||
disabledByDeveloper = not enabled
|
||||
do
|
||||
local _with_0 = game:GetService("GuiService")
|
||||
if disabledByDeveloper then
|
||||
pcall(function()
|
||||
_with_0:RemoveKey(tilde)
|
||||
return _with_0:RemoveKey(backquote)
|
||||
end)
|
||||
else
|
||||
_with_0:AddKey(tilde)
|
||||
_with_0:AddKey(backquote)
|
||||
end
|
||||
end
|
||||
resetSearch()
|
||||
searchFrame.Visible = enabled and backpackIsOpen
|
||||
currentLoadout.Visible = enabled
|
||||
backpack.Visible = enabled
|
||||
backpackButton.Visible = enabled
|
||||
end
|
||||
end
|
||||
createPublicFunction("CloseBackpack", hideBackpack)
|
||||
createPublicFunction("BackpackReady", backpackReady)
|
||||
pcall(function()
|
||||
coreGuiChanged(Enum.CoreGuiType.Backpack, Game.StarterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack))
|
||||
return Game.StarterGui.CoreGuiChangedSignal:connect(coreGuiChanged)
|
||||
end)
|
||||
inventoryButton.MouseButton1Click:connect(function()
|
||||
return newTabClicked("gear")
|
||||
end)
|
||||
inventoryButton.MouseEnter:connect(function()
|
||||
return mouseOverTab(inventoryButton)
|
||||
end)
|
||||
inventoryButton.MouseLeave:connect(function()
|
||||
return mouseLeaveTab(inventoryButton)
|
||||
end)
|
||||
if game.CoreGui.Version >= 8 then
|
||||
wardrobeButton.MouseButton1Click:connect(function()
|
||||
return newTabClicked("wardrobe")
|
||||
end)
|
||||
wardrobeButton.MouseEnter:connect(function()
|
||||
return mouseOverTab(wardrobeButton)
|
||||
end)
|
||||
wardrobeButton.MouseLeave:connect(function()
|
||||
return mouseLeaveTab(wardrobeButton)
|
||||
end)
|
||||
end
|
||||
closeButton.MouseButton1Click:connect(closeBackpack)
|
||||
screen.Changed:connect(function(prop)
|
||||
if prop == "AbsoluteSize" then
|
||||
return resizeEvent:Fire(screen.AbsoluteSize)
|
||||
end
|
||||
end)
|
||||
do
|
||||
local _with_0 = game:GetService("GuiService")
|
||||
_with_0:AddKey(tilde)
|
||||
_with_0:AddKey(backquote)
|
||||
_with_0.KeyPressed:connect(function(key)
|
||||
if not active or disabledByDeveloper then
|
||||
return
|
||||
end
|
||||
if key == tilde or key == backquote then
|
||||
return toggleBackpack()
|
||||
end
|
||||
end)
|
||||
end
|
||||
backpackButton.MouseButton1Click:connect(function()
|
||||
if not active or disabledByDeveloper then
|
||||
return
|
||||
end
|
||||
return toggleBackpack()
|
||||
end)
|
||||
if game.Players.LocalPlayer["Character"] then
|
||||
activateBackpack()
|
||||
end
|
||||
game.Players.LocalPlayer.CharacterAdded:connect(activateBackpack)
|
||||
searchBox.FocusLost:connect(function(enterPressed)
|
||||
if enterPressed or searchBox.Text ~= "" then
|
||||
return doSearch()
|
||||
elseif searchBox.Text == "" then
|
||||
return resetSearch()
|
||||
end
|
||||
end)
|
||||
searchButton.MouseButton1Click:connect(doSearch)
|
||||
resetButton.MouseButton1Click:connect(resetSearch)
|
||||
if searchFrame and robloxGui.AbsoluteSize.Y <= 320 then
|
||||
searchFrame.RobloxLocked = false
|
||||
return searchFrame:Destroy()
|
||||
end
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue