Port some corescripts to yuescript 4 the lolz

This commit is contained in:
Lewin Kelly 2023-04-14 03:13:20 +01:00
parent 5a6acac25c
commit 1642c4c716
30 changed files with 8373 additions and 2 deletions

View File

@ -1243,7 +1243,7 @@ t.CreateTrueScrollingFrame = function()
end
end
scrollbar.MouseButton1Down:connect(function(x, y)
scrollbar.MouseButton1Down:connect(function(_, y)
if scrollbar.Active then
local scrollStamp = tick()
local mouseOffset = y - scrollbar.AbsolutePosition.y
@ -1604,7 +1604,7 @@ t.CreateScrollingFrame = function(orderList, scrollStyle)
else
local children = frame:GetChildren()
if children then
for i, child in ipairs(children) do
for _, child in ipairs(children) do
if child:IsA "GuiObject" then
table.insert(guiObjects, child)
end

0
yue/107893730.yue Normal file
View File

0
yue/152908679.yue Normal file
View File

0
yue/153556783.yue Normal file
View File

0
yue/157877000.yue Normal file
View File

126
yue/36868950.lua Normal file
View File

@ -0,0 +1,126 @@
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

122
yue/36868950.yue Normal file
View File

@ -0,0 +1,122 @@
controlFrame = script.Parent\FindFirstChild "ControlFrame"
return if not controlFrame
-- Heliodex's basic New function (basically a simplified version of melt)
New = (className, name, props) ->
if not props? -- no name was provided
props = name
name = nil
obj = Instance.new className
obj.Name = name if name
local parent
for k, v in pairs props
if type(k) == "string" then
if k == "Parent"
parent = v
else
obj[k] = v
elseif type(k) == "number" and type(v) == "userdata"
v.Parent = obj
obj.Parent = parent
obj
--
bottomLeftControl = controlFrame\FindFirstChild "BottomLeftControl"
bottomRightControl = controlFrame\FindFirstChild "BottomRightControl"
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
setUpListeners = (frameToListen) ->
fadeSpeed = 0.1
frameToListen.Parent.MouseEnter\connect ->
if frameToListen\FindFirstChild "inside"
frameToListen.inside.Value = true
wait 1.2
if frameToListen.inside.Value
while frameToListen.inside.Value and frameToListen.BackgroundTransparency > 0
frameToListen.BackgroundTransparency -= fadeSpeed
frameToListen.TextTransparency -= fadeSpeed
wait!
killTip = (killFrame) ->
killFrame.inside.Value = false
killFrame.BackgroundTransparency = 1
killFrame.TextTransparency = 1
frameToListen.Parent.MouseLeave\connect ->
killTip frameToListen
frameToListen.Parent.MouseButton1Click\connect ->
killTip frameToListen
createSettingsButtonTip = (parent) ->
if not parent?
parent = bottomLeftControl\FindFirstChild "SettingsButton"
with toolTip = frameTip\clone!
.RobloxLocked = true
.Text = "Settings/Leave Game"
.Position = UDim2.new 0, 0, 0, -18
.Size = UDim2.new 0, 120, 0, 20
.Parent = parent
setUpListeners toolTip
wait 5 -- make sure we are loaded in, won't need tool tips for first 5 seconds anyway
---------------- set up Bottom Left Tool Tips -------------------------
bottomLeftChildren = bottomLeftControl\GetChildren!
for i = 1, #bottomLeftChildren
if bottomLeftChildren[i].Name == "Exit"
with exitTip = frameTip\clone!
.RobloxLocked = true
.Text = "Leave Place"
.Position = UDim2.new 0, 0, -1, 0
.Size = UDim2.new 1, 0, 1, 0
.Parent = bottomLeftChildren[i]
setUpListeners exitTip
elseif bottomLeftChildren[i].Name == "SettingsButton"
createSettingsButtonTip bottomLeftChildren[i]
---------------- set up Bottom Right Tool Tips -------------------------
bottomRightChildren = bottomRightControl\GetChildren!
for i = 1, #bottomRightChildren
if bottomRightChildren[i].Name\find("Camera")?
with cameraTip = frameTip\clone!
.RobloxLocked = true
.Text = "Camera View"
.Position = if bottomRightChildren[i].Name\find "Zoom"
UDim2.new -1, 0, -1.5
else
UDim2.new 0, 0, -1.5, 0
.Size = UDim2.new 2, 0, 1.25, 0
.Parent = bottomRightChildren[i]
setUpListeners cameraTip

68
yue/37801172.lua Normal file
View File

@ -0,0 +1,68 @@
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

98
yue/37801172.yue Normal file
View File

@ -0,0 +1,98 @@
-- Creates all neccessary scripts for the gui on initial load, everything except build tools
-- Created by Ben T. 10/29/10
-- Please note that these are loaded in a specific order to diminish errors/perceived load time by user
scriptContext = game\GetService "ScriptContext"
touchEnabled = false
try
touchEnabled = game\GetService("UserInputService").TouchEnabled
-- library registration
scriptContext\AddCoreScript 60595695, scriptContext, "/Libraries/LibraryRegistration/LibraryRegistration"
waitForChild = (instance, name) ->
while not instance\FindFirstChild name
instance.ChildAdded\wait!
-- waitForProperty = (instance, property) ->
-- while not instance[property]
-- instance.Changed\wait!
-- Responsible for tracking logging items
scriptContext = game\GetService "ScriptContext"
scriptContext\AddCoreScript 59002209, scriptContext, "CoreScripts/Sections"
waitForChild game\GetService("CoreGui"), "RobloxGui"
screenGui = game\GetService("CoreGui")\FindFirstChild "RobloxGui"
if not touchEnabled
-- ToolTipper (creates tool tips for gui)
scriptContext\AddCoreScript 36868950, screenGui, "CoreScripts/ToolTip"
-- SettingsScript
scriptContext\AddCoreScript 46295863, screenGui, "CoreScripts/Settings"
else
scriptContext\AddCoreScript 153556783, screenGui, "CoreScripts/TouchControls"
-- MainBotChatScript
scriptContext\AddCoreScript 39250920, screenGui, "CoreScripts/MainBotChatScript"
-- Popup Script
scriptContext\AddCoreScript 48488451, screenGui, "CoreScripts/PopupScript"
-- Friend Notification Script (probably can use this script to expand out to other notifications)
scriptContext\AddCoreScript 48488398, screenGui, "CoreScripts/NotificationScript"
-- Chat script
scriptContext\AddCoreScript 97188756, screenGui, "CoreScripts/ChatScript"
-- Purchase Prompt Script
scriptContext\AddCoreScript 107893730, screenGui, "CoreScripts/PurchasePromptScript"
if not touchEnabled or screenGui.AbsoluteSize.Y > 600
-- New Player List
scriptContext\AddCoreScript 48488235, screenGui, "CoreScripts/PlayerListScript"
else
delay 5, ->
if screenGui.AbsoluteSize.Y >= 600
-- New Player List
scriptContext\AddCoreScript 48488235, screenGui, "CoreScripts/PlayerListScript"
if game.CoreGui.Version >= 3 and game.PlaceId ~= 130815926 --todo: remove placeid hack for halloween
-- Backpack Builder, creates most of the backpack gui
scriptContext\AddCoreScript 53878047, screenGui, "CoreScripts/BackpackScripts/BackpackBuilder"
waitForChild screenGui, "CurrentLoadout"
waitForChild screenGui, "Backpack"
Backpack = screenGui.Backpack
-- Manager handles all big backpack state changes, other scripts subscribe to this and do things accordingly
if game.CoreGui.Version >= 7
scriptContext\AddCoreScript 89449093, Backpack, "CoreScripts/BackpackScripts/BackpackManager"
-- Backpack Gear (handles all backpack gear tab stuff)
scriptContext\AddCoreScript 89449008, Backpack, "CoreScripts/BackpackScripts/BackpackGear"
-- Loadout Script, used for gear hotkeys
scriptContext\AddCoreScript 53878057, screenGui.CurrentLoadout, "CoreScripts/BackpackScripts/LoadoutScript"
if game.CoreGui.Version >= 8
-- Wardrobe script handles all character dressing operations
scriptContext\AddCoreScript -1, Backpack, "CoreScripts/BackpackScripts/BackpackWardrobe"
IsPersonalServer = not not game.Workspace\FindFirstChild "PSVariable"
if IsPersonalServer
scriptContext\AddCoreScript 64164692, game.Players.LocalPlayer, "BuildToolManager"
game.Workspace.ChildAdded\connect (nchild) ->
if nchild.Name == "PSVariable" and nchild\IsA "BoolValue"
IsPersonalServer = true
scriptContext\AddCoreScript 64164692, game.Players.LocalPlayer, "BuildToolManager"
if touchEnabled -- touch devices don't use same control frame
-- only used for touch device button generation
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

230
yue/38037565.lua Normal file
View File

@ -0,0 +1,230 @@
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 = Instance.new("Configuration")
config.Parent = Figure
config.Name = "PlayerStats"
end
local myHealth = config:FindFirstChild("MaxHealth")
if not (myHealth ~= nil) then
myHealth = Instance.new("NumberValue")
myHealth.Parent = config
myHealth.Value = 100
myHealth.Name = "MaxHealth"
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

231
yue/38037565.yue Normal file
View File

@ -0,0 +1,231 @@
-- Heliodex's basic New function (basically a simplified version of melt)
New = (className, name, props) ->
if not props? -- no name was provided
props = name
name = nil
obj = Instance.new className
obj.Name = name if name
local parent
for k, v in pairs props
if type(k) == "string" then
if k == "Parent"
parent = v
else
obj[k] = v
elseif type(k) == "number" and type(v) == "userdata"
v.Parent = obj
obj.Parent = parent
obj
--
damageGuiWidth = 5.0
damageGuiHeight = 5.0
waitForChild = (parent, childName) ->
child = parent\findFirstChild childName
if child
return child
while true
child = parent.ChildAdded\wait!
if child.Name == childName
return child
-- declarations
Figure = script.Parent
Humanoid = waitForChild Figure, "Humanoid"
Torso = waitForChild Figure, "Torso"
config = Figure\FindFirstChild "PlayerStats"
inCharTag = Instance.new "BoolValue"
inCharTag.Name = "InCharTag"
hider = Instance.new "BoolValue"
hider.Name = "RobloxBuildTool"
if not config?
config = Instance.new "Configuration"
config.Parent = Figure
config.Name = "PlayerStats"
myHealth = config\FindFirstChild "MaxHealth"
if not myHealth?
myHealth = Instance.new "NumberValue"
myHealth.Parent = config
myHealth.Value = 100
myHealth.Name = "MaxHealth"
Humanoid.MaxHealth = myHealth.Value
Humanoid.Health = myHealth.Value
onMaxHealthChange = ->
Humanoid.MaxHealth = myHealth.Value
Humanoid.Health = myHealth.Value
myHealth.Changed\connect onMaxHealthChange
--Humanoid.MaxHealth = myHealth.Value
--Humanoid.Health = Humanoid.MaxHealth
vPlayer = game.Players\GetPlayerFromCharacter script.Parent
dotGui = vPlayer.PlayerGui\FindFirstChild "DamageOverTimeGui"
if not dotGui?
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
print "newHealth declarations finished"
billboardHealthChange = (dmg) ->
textLabel = New "TextLabel"
Text: tostring dmg
TextColor3: if dmg > 0
Color3.new 0, 1, 0
else
Color3.new 1, 0, 1
size: UDim2.new 1, 0, 1, 0.0
Active: true
FontSize: 6
BackgroundTransparency: 1
Parent: dotGui
for t = 1, 10
wait 0.1
textLabel.TextTransparency = t / 10
textLabel.Position = UDim2.new 0, 0, 0, -t * 5
textLabel.FontSize = 6 - t * 0.6
textLabel\remove!
setMaxHealth = ->
--print Humanoid.Health
if myHealth.Value >= 0
Humanoid.MaxHealth = myHealth.Value
print Humanoid.MaxHealth
if Humanoid.Health > Humanoid.MaxHealth
Humanoid.Health = Humanoid.MaxHealth
myHealth.Changed\connect setMaxHealth
-- Visual Effects --
fireEffect = New "Fire", "FireEffect"
Heat: 0.1
Size: 3.0
Enabled: false
--
-- regeneration
while true
s = wait 1
health = Humanoid.Health
if health > 0 -- and health < Humanoid.MaxHealth
delta = 0
if config
regen = config\FindFirstChild "Regen"
poison = config\FindFirstChild "Poison"
ice = config\FindFirstChild "Ice"
fire = config\FindFirstChild "Fire"
stun = config\FindFirstChild "Stun"
if regen
delta = delta + regen.Value.X
if regen.Value.Y >= 0
regen.Value = Vector3.new regen.Value.X + regen.Value.Z, regen.Value.Y - s, regen.Value.Z -- maybe have 3rd parameter be an increaser/decreaser?
elseif regen.Value.Y == -1
regen.Value = Vector3.new regen.Value.X + regen.Value.Z, -1, regen.Value.Z
else
regen\remove!
-- infinity is -1
if poison
delta = delta - poison.Value.X
if poison.Value.Y >= 0
poison.Value = Vector3.new poison.Value.X + poison.Value.Z, poison.Value.Y - s, poison.Value.Z
elseif poison.Value.Y == -1
poison.Value = Vector3.new poison.Value.X + poison.Value.Z, -1, poison.Value.Z
else
poison\remove!
-- infinity is -1
if ice
--print "IN ICE"
delta = delta - ice.Value.X
if ice.Value.Y >= 0
ice.Value = Vector3.new ice.Value.X, ice.Value.Y - s, ice.Value.Z
else
ice\remove!
if fire
fireEffect.Enabled = true
fireEffect.Parent = Figure.Torso
delta = delta - fire.Value.X
if fire.Value.Y >= 0
fire.Value = Vector3.new fire.Value.X, fire.Value.Y - s, fire.Value.Z
else
fire\remove!
fireEffect.Enabled = false
fireEffect.Parent = nil
if stun
local backpackTools
if stun.Value > 0
Torso.Anchored = true
currentChildren = script.Parent\GetChildren!
backpackTools = game.Players\GetPlayerFromCharacter(script.Parent).Backpack\GetChildren!
for i = 1, #currentChildren
if currentChildren[i].className == "Tool"
inCharTag\Clone!.Parent = currentChildren[i]
print(backpackTools)
table.insert(backpackTools, currentChildren[i])
for i = 1, #backpackTools
if not backpackTools[i]\FindFirstChild("RobloxBuildTool")?
hider\Clone!.Parent = backpackTools[i]
backpackTools[i].Parent = game.Lighting
wait 0.2
for i = 1, #backpackTools
backpackTools[i].Parent = game.Players\GetPlayerFromCharacter(script.Parent).Backpack
stun.Value = stun.Value - s
else
Torso.Anchored = false
for i = 1, #backpackTools
rbTool = backpackTools[i]\FindFirstChild "RobloxBuildTool"
if rbTool
rbTool\Remove!
backpackTools[i].Parent = game.Lighting
wait 0.2
for i = 1, #backpackTools
wasInChar = backpackTools[i]\FindFirstChild "InCharTag"
if wasInChar
wasInChar\Remove!
backpackTools[i].Parent = script.Parent
else
backpackTools[i].Parent = game.Players\GetPlayerFromCharacter(script.Parent).Backpack
stun\Remove!
if delta ~= 0
coroutine.resume(coroutine.create(billboardHealthChange), delta)
--delta *= .01
--health += delta * s * Humanoid.MaxHealth
health = Humanoid.Health + delta * s
if health * 1.01 < Humanoid.MaxHealth
Humanoid.Health = health
--myHealth.Value = math.floor Humanoid.Health
elseif delta > 0
Humanoid.Health = Humanoid.MaxHealth
--myHealth.Value = Humanoid.Health

542
yue/39250920.lua Normal file
View File

@ -0,0 +1,542 @@
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 = Instance.new("Frame")
messageDialog.Name = "DialogScriptMessage"
messageDialog.Style = Enum.FrameStyle.RobloxRound
messageDialog.Visible = false
local text = Instance.new("TextLabel")
text.Name = "Text"
text.Position = UDim2.new(0, 0, 0, -1)
text.Size = UDim2.new(1, 0, 1, 0)
text.FontSize = Enum.FontSize.Size14
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new(1, 1, 1)
text.RobloxLocked = true
text.Parent = messageDialog
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
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
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 = Instance.new("TextButton")
frame.BackgroundColor3 = Color3.new(0, 0, 179 / 255)
frame.AutoButtonColor = false
frame.BorderSizePixel = 0
frame.Text = ""
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)
frame.RobloxLocked = true
local number = Instance.new("TextLabel")
number.Name = "Number"
number.TextColor3 = Color3.new(127 / 255, 212 / 255, 255 / 255)
number.Text = numberText
number.FontSize = Enum.FontSize.Size14
number.BackgroundTransparency = 1
number.Position = UDim2.new(0, 4, 0, 2)
number.Size = UDim2.new(0, 20, 0, 24)
number.TextXAlignment = Enum.TextXAlignment.Left
number.TextYAlignment = Enum.TextYAlignment.Top
number.RobloxLocked = true
number.Parent = frame
local prompt = Instance.new("TextLabel")
prompt.Name = "UserPrompt"
prompt.BackgroundTransparency = 1
prompt.TextColor3 = Color3.new(1, 1, 1)
prompt.FontSize = Enum.FontSize.Size14
prompt.Position = UDim2.new(0, 28, 0, 2)
prompt.Size = UDim2.new(1, -32, 1, -4)
prompt.TextXAlignment = Enum.TextXAlignment.Left
prompt.TextYAlignment = Enum.TextYAlignment.Top
prompt.TextWrap = true
prompt.RobloxLocked = true
prompt.Parent = frame
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 = Instance.new("Frame")
mainFrame.Name = "UserDialogArea"
mainFrame.Size = UDim2.new(0, 350, 0, 200)
mainFrame.Style = Enum.FrameStyle.ChatBlue
mainFrame.Visible = false
local imageLabel = Instance.new("ImageLabel")
imageLabel.Name = "Tail"
imageLabel.Size = UDim2.new(0, 62, 0, 53)
imageLabel.Position = UDim2.new(1, 8, 0.25)
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
imageLabel.BackgroundTransparency = 1
imageLabel.RobloxLocked = true
imageLabel.Parent = mainFrame
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 = Instance.new("Frame")
frame.Name = "DialogFrame"
frame.Position = UDim2.new(0, 0, 0, 0)
frame.Size = UDim2.new(0, 0, 0, 0)
frame.BackgroundTransparency = 1
frame.RobloxLocked = true
frame.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()

526
yue/39250920.yue Normal file
View File

@ -0,0 +1,526 @@
-- Heliodex's basic New function (basically a simplified version of melt)
New = (className, name, props) ->
if not props? -- no name was provided
props = name
name = nil
obj = Instance.new className
obj.Name = name if name
local parent
for k, v in pairs props
if type(k) == "string" then
if k == "Parent"
parent = v
else
obj[k] = v
elseif type(k) == "number" and type(v) == "userdata"
v.Parent = obj
obj.Parent = parent
obj
--
waitForProperty = (instance, name) ->
while not instance[name]
instance.Changed\wait!
waitForChild = (instance, name) ->
while not instance\FindFirstChild name
instance.ChildAdded\wait!
local mainFrame
choices = {}
local lastChoice
choiceMap = {}
local currentConversationDialog
local currentConversationPartner
local currentAbortDialogScript
tooFarAwayMessage = "You are too far away to chat!"
tooFarAwaySize = 300
characterWanderedOffMessage = "Chat ended because you walked away"
characterWanderedOffSize = 350
conversationTimedOut = "Chat ended because you didn't reply"
conversationTimedOutSize = 350
local player
local chatNotificationGui
local messageDialog
local timeoutScript
local reenableDialogScript
dialogMap = {}
dialogConnections = {}
local gui
waitForChild game, "CoreGui"
waitForChild game.CoreGui, "RobloxGui"
if game.CoreGui.RobloxGui\FindFirstChild "ControlFrame"
gui = game.CoreGui.RobloxGui.ControlFrame
else
gui = game.CoreGui.RobloxGui
currentTone = ->
if currentConversationDialog
currentConversationDialog.Tone
else
Enum.DialogTone.Neutral
createChatNotificationGui = ->
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
getChatColor = (tone) ->
if tone == Enum.DialogTone.Neutral
Enum.ChatColor.Blue
elseif tone == Enum.DialogTone.Friendly
Enum.ChatColor.Green
elseif tone == Enum.DialogTone.Enemy
Enum.ChatColor.Red
resetColor = (frame, tone) ->
if tone == Enum.DialogTone.Neutral
frame.BackgroundColor3 = Color3.new 0, 0, 179 / 255
frame.Number.TextColor3 = Color3.new 45 / 255, 142 / 255, 245 / 255
elseif tone == Enum.DialogTone.Friendly
frame.BackgroundColor3 = Color3.new 0, 77 / 255, 0
frame.Number.TextColor3 = Color3.new 0, 190 / 255, 0
elseif tone == Enum.DialogTone.Enemy
frame.BackgroundColor3 = Color3.new 140 / 255, 0, 0
frame.Number.TextColor3 = Color3.new 255 / 255, 88 / 255, 79 / 255
styleChoices = (tone) ->
for _, obj in pairs choices
resetColor obj, tone
resetColor lastChoice, tone
styleMainFrame = (tone) ->
if tone == Enum.DialogTone.Neutral
mainFrame.Style = Enum.FrameStyle.ChatBlue
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
elseif tone == Enum.DialogTone.Friendly
mainFrame.Style = Enum.FrameStyle.ChatGreen
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botGreen_tailRight.png"
elseif tone == Enum.DialogTone.Enemy
mainFrame.Style = Enum.FrameStyle.ChatRed
mainFrame.Tail.Image = "rbxasset://textures/chatBubble_botRed_tailRight.png"
styleChoices tone
setChatNotificationTone = (gui, purpose, tone) ->
if tone == Enum.DialogTone.Neutral
gui.Image.Image = "rbxasset://textures/chatBubble_botBlue_notify_bkg.png"
elseif tone == Enum.DialogTone.Friendly
gui.Image.Image = "rbxasset://textures/chatBubble_botGreen_notify_bkg.png"
elseif tone == Enum.DialogTone.Enemy
gui.Image.Image = "rbxasset://textures/chatBubble_botRed_notify_bkg.png"
if purpose == Enum.DialogPurpose.Quest
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_bang.png"
elseif purpose == Enum.DialogPurpose.Help
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_question.png"
elseif purpose == Enum.DialogPurpose.Shop
gui.Image.Button.Image = "rbxasset://textures/chatBubble_bot_notify_money.png"
createMessageDialog = ->
messageDialog = Instance.new "Frame"
messageDialog.Name = "DialogScriptMessage"
messageDialog.Style = Enum.FrameStyle.RobloxRound
messageDialog.Visible = false
text = Instance.new "TextLabel"
text.Name = "Text"
text.Position = UDim2.new 0, 0, 0, -1
text.Size = UDim2.new 1, 0, 1, 0
text.FontSize = Enum.FontSize.Size14
text.BackgroundTransparency = 1
text.TextColor3 = Color3.new 1, 1, 1
text.RobloxLocked = true
text.Parent = messageDialog
showMessage = (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
variableDelay = (str) ->
length = math.min string.len(str), 100
wait 0.75 + (length / 75) * 1.5
highlightColor = (frame, tone) ->
if tone == Enum.DialogTone.Neutral
frame.BackgroundColor3 = Color3.new 2 / 255, 108 / 255, 255 / 255
frame.Number.TextColor3 = Color3.new 1, 1, 1
elseif tone == Enum.DialogTone.Friendly
frame.BackgroundColor3 = Color3.new 0, 128 / 255, 0
frame.Number.TextColor3 = Color3.new 1, 1, 1
elseif tone == Enum.DialogTone.Enemy
frame.BackgroundColor3 = Color3.new 204 / 255, 0, 0
frame.Number.TextColor3 = Color3.new 1, 1, 1
endDialog = ->
if currentAbortDialogScript
currentAbortDialogScript\Remove!
currentAbortDialogScript = nil
dialog = currentConversationDialog
currentConversationDialog = nil
if dialog and dialog.InUse
reenableScript = reenableDialogScript\Clone!
reenableScript.archivable = false
reenableScript.Disabled = false
reenableScript.Parent = dialog
for dialog, gui in pairs dialogMap
if dialog and gui
gui.Enabled = not dialog.InUse
currentConversationPartner = nil
wanderDialog = ->
print "Wander"
mainFrame.Visible = false
endDialog!
showMessage characterWanderedOffMessage, characterWanderedOffSize
timeoutDialog = ->
print "Timeout"
mainFrame.Visible = false
endDialog!
showMessage conversationTimedOut, conversationTimedOutSize
normalEndDialog = ->
print "Done"
endDialog!
sanitizeMessage = (msg) ->
if string.len(msg) == 0
"..."
else
msg
renewKillswitch = (dialog) ->
if currentAbortDialogScript
currentAbortDialogScript\Remove!
currentAbortDialogScript = nil
currentAbortDialogScript = timeoutScript\Clone!
currentAbortDialogScript.archivable = false
currentAbortDialogScript.Disabled = false
currentAbortDialogScript.Parent = dialog
presentDialogChoices = (talkingPart, dialogChoices) ->
return if not currentConversationDialog
currentConversationPartner = talkingPart
sortedDialogChoices = {}
for _, obj in pairs dialogChoices
if obj\IsA "DialogChoice"
table.insert sortedDialogChoices, obj
table.sort sortedDialogChoices, (a, b) -> a.Name < b.Name
if #sortedDialogChoices == 0
normalEndDialog!
return
pos = 1
yPosition = 0
choiceMap = {}
for _, obj in pairs choices
obj.Visible = false
for _, obj in pairs sortedDialogChoices
if pos <= #choices
--3 lines is the maximum, set it to that temporarily
choices[pos].Size = UDim2.new 1, 0, 0, 24 * 3
choices[pos].UserPrompt.Text = obj.UserDialog
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
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
selectChoice = (choice) ->
renewKillswitch currentConversationDialog
--First hide the Gui
mainFrame.Visible = false
if choice == lastChoice
game.Chat\Chat game.Players.LocalPlayer.Character, "Goodbye!", getChatColor(currentTone!)
normalEndDialog!
else
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
presentDialogChoices currentConversationPartner, dialogChoice\GetChildren!
newChoice = (numberText) ->
frame = Instance.new "TextButton"
frame.BackgroundColor3 = Color3.new 0, 0, 179 / 255
frame.AutoButtonColor = false
frame.BorderSizePixel = 0
frame.Text = ""
frame.MouseEnter\connect ->
highlightColor frame, currentTone!
frame.MouseLeave\connect ->
resetColor frame, currentTone!
frame.MouseButton1Click\connect ->
selectChoice frame
frame.RobloxLocked = true
number = Instance.new "TextLabel"
number.Name = "Number"
number.TextColor3 = Color3.new 127 / 255, 212 / 255, 255 / 255
number.Text = numberText
number.FontSize = Enum.FontSize.Size14
number.BackgroundTransparency = 1
number.Position = UDim2.new 0, 4, 0, 2
number.Size = UDim2.new 0, 20, 0, 24
number.TextXAlignment = Enum.TextXAlignment.Left
number.TextYAlignment = Enum.TextYAlignment.Top
number.RobloxLocked = true
number.Parent = frame
prompt = Instance.new "TextLabel"
prompt.Name = "UserPrompt"
prompt.BackgroundTransparency = 1
prompt.TextColor3 = Color3.new 1, 1, 1
prompt.FontSize = Enum.FontSize.Size14
prompt.Position = UDim2.new 0, 28, 0, 2
prompt.Size = UDim2.new 1, -32, 1, -4
prompt.TextXAlignment = Enum.TextXAlignment.Left
prompt.TextYAlignment = Enum.TextYAlignment.Top
prompt.TextWrap = true
prompt.RobloxLocked = true
prompt.Parent = frame
frame
initialize = (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 = Instance.new "Frame"
mainFrame.Name = "UserDialogArea"
mainFrame.Size = UDim2.new 0, 350, 0, 200
mainFrame.Style = Enum.FrameStyle.ChatBlue
mainFrame.Visible = false
imageLabel = Instance.new "ImageLabel"
imageLabel.Name = "Tail"
imageLabel.Size = UDim2.new 0, 62, 0, 53
imageLabel.Position = UDim2.new 1, 8, 0.25
imageLabel.Image = "rbxasset://textures/chatBubble_botBlue_tailRight.png"
imageLabel.BackgroundTransparency = 1
imageLabel.RobloxLocked = true
imageLabel.Parent = mainFrame
for _, obj in pairs choices
obj.RobloxLocked = true
obj.Parent = mainFrame
lastChoice.RobloxLocked = true
lastChoice.Parent = mainFrame
mainFrame.RobloxLocked = true
mainFrame.Parent = parent
doDialog = (dialog) ->
while not Instance.Lock dialog, player
wait!
if dialog.InUse
Instance.Unlock dialog
return
else
dialog.InUse = true
Instance.Unlock dialog
currentConversationDialog = dialog
game.Chat\Chat dialog.Parent, dialog.InitialPrompt, getChatColor dialog.Tone
variableDelay dialog.InitialPrompt
presentDialogChoices dialog.Parent, dialog\GetChildren!
checkForLeaveArea = ->
while currentConversationDialog
if currentConversationDialog.Parent and (
player\DistanceFromCharacter currentConversationDialog.Parent.Position >= currentConversationDialog.ConversationDistance
)
wanderDialog!
wait 1
startDialog = (dialog) ->
if dialog.Parent and dialog.Parent\IsA "BasePart"
if player\DistanceFromCharacter(dialog.Parent.Position) >= dialog.ConversationDistance
showMessage tooFarAwayMessage, tooFarAwaySize
return
for dialog, gui in pairs dialogMap
if dialog and gui
gui.Enabled = false
renewKillswitch dialog
delay 1, checkForLeaveArea
doDialog dialog
removeDialog = (dialog) ->
if dialogMap[dialog]
dialogMap[dialog]\Remove!
dialogMap[dialog] = nil
if dialogConnections[dialog]
dialogConnections[dialog]\disconnect!
dialogConnections[dialog] = nil
addDialog = (dialog) ->
if dialog.Parent
if dialog.Parent\IsA "BasePart"
chatGui = chatNotificationGui\clone!
chatGui.Enabled = not dialog.InUse
chatGui.Adornee = dialog.Parent
chatGui.RobloxLocked = true
chatGui.Parent = game.CoreGui
chatGui.Image.Button.MouseButton1Click\connect ->
startDialog dialog
setChatNotificationTone chatGui, dialog.Purpose, dialog.Tone
dialogMap[dialog] = chatGui
dialogConnections[dialog] = dialog.Changed\connect (prop) ->
if prop == "Parent" and dialog.Parent
--This handles the reparenting case, seperate from removal case
removeDialog dialog
addDialog dialog
elseif prop == "InUse"
chatGui.Enabled = not currentConversationDialog and not dialog.InUse
if dialog == currentConversationDialog
timeoutDialog!
elseif prop == "Tone" or prop == "Purpose"
setChatNotificationTone chatGui, dialog.Purpose, dialog.Tone
else -- still need to listen to parent changes even if current parent is not a BasePart
dialogConnections[dialog] = dialog.Changed\connect (prop) ->
if prop == "Parent" and dialog.Parent
--This handles the reparenting case, seperate from removal case
removeDialog dialog
addDialog dialog
fetchScripts = ->
model = game\GetService("InsertService")\LoadAsset 39226062
if type(model) == "string" -- load failed, lets try again
wait 0.1
model = game\GetService("InsertService")\LoadAsset 39226062
return if type(model) == "string" -- not going to work, lets bail
waitForChild model, "TimeoutScript"
timeoutScript = model.TimeoutScript
waitForChild model, "ReenableDialogScript"
reenableDialogScript = model.ReenableDialogScript
onLoad = ->
waitForProperty game.Players, "LocalPlayer"
player = game.Players.LocalPlayer
waitForProperty player, "Character"
--print "Fetching Scripts"
fetchScripts!
--print "Creating Guis"
createChatNotificationGui!
--print "Creating MessageDialog"
createMessageDialog!
messageDialog.RobloxLocked = true
messageDialog.Parent = gui
--print "Waiting for BottomLeftControl"
waitForChild gui, "BottomLeftControl"
--print "Initializing Frame"
frame = Instance.new "Frame"
frame.Name = "DialogFrame"
frame.Position = UDim2.new 0, 0, 0, 0
frame.Size = UDim2.new 0, 0, 0, 0
frame.BackgroundTransparency = 1
frame.RobloxLocked = true
frame.Parent = gui.BottomLeftControl
initialize frame
--print "Adding Dialogs"
game.CollectionService.ItemAdded\connect (obj) ->
if obj\IsA "Dialog"
addDialog obj
game.CollectionService.ItemRemoved\connect (obj) ->
if obj\IsA "Dialog"
removeDialog obj
for _, obj in pairs game.CollectionService\GetCollection "Dialog"
if obj\IsA "Dialog"
addDialog obj
onLoad!

1192
yue/45284430.lua Normal file

File diff suppressed because it is too large Load Diff

5190
yue/45284430.yue Normal file

File diff suppressed because it is too large Load Diff

0
yue/45374389.yue Normal file
View File

0
yue/46295863.yue Normal file
View File

0
yue/48488235.yue Normal file
View File

0
yue/48488398.yue Normal file
View File

0
yue/48488451.yue Normal file
View File

0
yue/53878047.yue Normal file
View File

0
yue/53878057.yue Normal file
View File

0
yue/59002209.yue Normal file
View File

0
yue/60595411.yue Normal file
View File

20
yue/60595695.lua Normal file
View File

@ -0,0 +1,20 @@
local deepakTestingPlace = 3569749
local sc = game:GetService("ScriptContext")
local tries = 0
while not sc and tries < 3 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")
return sc:LibraryRegistrationComplete()
else
return print("failed to find script context, libraries did not load")
end

26
yue/60595695.yue Normal file
View File

@ -0,0 +1,26 @@
-- Library Registration Script
-- This script is used to register RbxLua libraries on game servers, so game scripts have
-- access to all of the libraries (otherwise only local scripts do)
deepakTestingPlace = 3569749
sc = game\GetService "ScriptContext"
tries = 0
while not sc and tries < 3
tries += 1
sc = game\GetService "ScriptContext"
wait 0.2
if sc
sc\RegisterLibrary "Libraries/RbxGui", "45284430"
sc\RegisterLibrary "Libraries/RbxGear", "45374389"
if game.PlaceId == deepakTestingPlace
sc\RegisterLibrary "Libraries/RbxStatus", "52177566"
sc\RegisterLibrary "Libraries/RbxUtility", "60595411"
sc\RegisterLibrary "Libraries/RbxStamper", "73157242"
sc\LibraryRegistrationComplete!
else
print "failed to find script context, libraries did not load"

0
yue/73157242.yue Normal file
View File

0
yue/89449008.yue Normal file
View File

0
yue/89449093.yue Normal file
View File

0
yue/97188756.yue Normal file
View File