prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Replacement for runWithPriority in React internals. |
exports.decoupleUpdatePriorityFromScheduler = true
exports.enableDiscreteEventFlushingChange = false
exports.enableEagerRootListeners = false
exports.enableDoubleInvokingEffects = false
return exports
|
--[[Controls]] |
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--Script Created by CarloMagnificient |
local songs = script.Parent
local tablee = {}
local lastsong = nil
for i,v in pairs(songs:GetChildren()) do
if v:IsA("Sound") then
table.insert(tablee,v)
end
end
while true do
for a,c in pairs(tablee) do
local chosensong = tablee[math.random(1,#tablee)]
repeat wait() chosensong = tablee[math.random(1,#tablee)] until chosensong ~= lastsong
lastsong = chosensong
chosensong:Play()
chosensong.Ended:Wait()
chosensong:Stop()
end
wait()
end
|
-- only merge property defined on target |
function mergeProps(source, target)
if not source or not target then return end
for prop, value in pairs(source) do
if target[prop] ~= nil then
target[prop] = value
end
end
end
function methods:CreateGuiObjects(targetParent)
local userDefinedChatWindowStyle
pcall(function()
userDefinedChatWindowStyle= Chat:InvokeChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, nil)
end)
-- merge the userdefined settings with the ChatSettings
mergeProps(userDefinedChatWindowStyle, ChatSettings)
local BaseFrame = Instance.new("Frame")
BaseFrame.BackgroundTransparency = 1
BaseFrame.Active = ChatSettings.WindowDraggable
BaseFrame.Parent = targetParent
BaseFrame.AutoLocalize = false
local ChatBarParentFrame = Instance.new("Frame")
ChatBarParentFrame.Selectable = false
ChatBarParentFrame.Name = "ChatBarParentFrame"
ChatBarParentFrame.BackgroundTransparency = 1
ChatBarParentFrame.Parent = BaseFrame
local ChannelsBarParentFrame = Instance.new("Frame")
ChannelsBarParentFrame.Selectable = false
ChannelsBarParentFrame.Name = "ChannelsBarParentFrame"
ChannelsBarParentFrame.BackgroundTransparency = 1
ChannelsBarParentFrame.Position = UDim2.new(0, 0, 0, 0)
ChannelsBarParentFrame.Parent = BaseFrame
local ChatChannelParentFrame = Instance.new("Frame")
ChatChannelParentFrame.Selectable = false
ChatChannelParentFrame.Name = "ChatChannelParentFrame"
ChatChannelParentFrame.BackgroundTransparency = 1
ChatChannelParentFrame.BackgroundColor3 = ChatSettings.BackGroundColor
ChatChannelParentFrame.BackgroundTransparency = 0.6
ChatChannelParentFrame.BorderSizePixel = 0
ChatChannelParentFrame.Parent = BaseFrame
local ChatResizerFrame = Instance.new("ImageButton")
ChatResizerFrame.Selectable = false
ChatResizerFrame.Image = ""
ChatResizerFrame.BackgroundTransparency = 0.6
ChatResizerFrame.BorderSizePixel = 0
ChatResizerFrame.Visible = false
ChatResizerFrame.BackgroundColor3 = ChatSettings.BackGroundColor
ChatResizerFrame.Active = true
if bubbleChatOnly() then
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 0, 0)
else
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 1, -ChatResizerFrame.AbsoluteSize.Y)
end
ChatResizerFrame.Parent = BaseFrame
local ResizeIcon = Instance.new("ImageLabel")
ResizeIcon.Selectable = false
ResizeIcon.Size = UDim2.new(0.8, 0, 0.8, 0)
ResizeIcon.Position = UDim2.new(0.2, 0, 0.2, 0)
ResizeIcon.BackgroundTransparency = 1
ResizeIcon.Image = "rbxassetid://261880743"
ResizeIcon.Parent = ChatResizerFrame
local function GetScreenGuiParent()
--// Travel up parent list until you find the ScreenGui that the chat window is parented to
local screenGuiParent = BaseFrame
while (screenGuiParent and not screenGuiParent:IsA("ScreenGui")) do
screenGuiParent = screenGuiParent.Parent
end
return screenGuiParent
end
local deviceType = DEVICE_DESKTOP
local screenGuiParent = GetScreenGuiParent()
if (screenGuiParent.AbsoluteSize.X <= PHONE_SCREEN_WIDTH) then
deviceType = DEVICE_PHONE
elseif (screenGuiParent.AbsoluteSize.X <= TABLET_SCREEN_WIDTH) then
deviceType = DEVICE_TABLET
end
local checkSizeLock = false
local function doCheckSizeBounds()
if (checkSizeLock) then return end
checkSizeLock = true
if (not BaseFrame:IsDescendantOf(PlayerGui)) then return end
local screenGuiParent = GetScreenGuiParent()
local minWinSize = ChatSettings.MinimumWindowSize
local maxWinSize = ChatSettings.MaximumWindowSize
local forceMinY = ChannelsBarParentFrame.AbsoluteSize.Y + ChatBarParentFrame.AbsoluteSize.Y
local minSizePixelX = (minWinSize.X.Scale * screenGuiParent.AbsoluteSize.X) + minWinSize.X.Offset
local minSizePixelY = math.max((minWinSize.Y.Scale * screenGuiParent.AbsoluteSize.Y) + minWinSize.Y.Offset, forceMinY)
local maxSizePixelX = (maxWinSize.X.Scale * screenGuiParent.AbsoluteSize.X) + maxWinSize.X.Offset
local maxSizePixelY = (maxWinSize.Y.Scale * screenGuiParent.AbsoluteSize.Y) + maxWinSize.Y.Offset
local absSizeX = BaseFrame.AbsoluteSize.X
local absSizeY = BaseFrame.AbsoluteSize.Y
if (absSizeX < minSizePixelX) then
local offset = UDim2.new(0, minSizePixelX - absSizeX, 0, 0)
BaseFrame.Size = BaseFrame.Size + offset
elseif (absSizeX > maxSizePixelX) then
local offset = UDim2.new(0, maxSizePixelX - absSizeX, 0, 0)
BaseFrame.Size = BaseFrame.Size + offset
end
if (absSizeY < minSizePixelY) then
local offset = UDim2.new(0, 0, 0, minSizePixelY - absSizeY)
BaseFrame.Size = BaseFrame.Size + offset
elseif (absSizeY > maxSizePixelY) then
local offset = UDim2.new(0, 0, 0, maxSizePixelY - absSizeY)
BaseFrame.Size = BaseFrame.Size + offset
end
local xScale = BaseFrame.AbsoluteSize.X / screenGuiParent.AbsoluteSize.X
local yScale = BaseFrame.AbsoluteSize.Y / screenGuiParent.AbsoluteSize.Y
-- cap chat window scale at a value smaller than 0.5 to prevent center of screen overlap
if FFlagFixMouseCapture then
xScale = math.min(xScale, 0.45)
yScale = math.min(xScale, 0.45)
end
BaseFrame.Size = UDim2.new(xScale, 0, yScale, 0)
checkSizeLock = false
end
BaseFrame.Changed:connect(function(prop)
if (prop == "AbsoluteSize") then
doCheckSizeBounds()
end
end)
ChatResizerFrame.DragBegin:connect(function(startUdim)
BaseFrame.Draggable = false
end)
local function UpdatePositionFromDrag(atPos)
if ChatSettings.WindowDraggable == false and ChatSettings.WindowResizable == false then
return
end
local newSize = atPos - BaseFrame.AbsolutePosition + ChatResizerFrame.AbsoluteSize
BaseFrame.Size = UDim2.new(0, newSize.X, 0, newSize.Y)
if bubbleChatOnly() then
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 0, 0)
else
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 1, -ChatResizerFrame.AbsoluteSize.Y)
end
end
ChatResizerFrame.DragStopped:connect(function(endX, endY)
BaseFrame.Draggable = ChatSettings.WindowDraggable
--UpdatePositionFromDrag(Vector2.new(endX, endY))
end)
local resizeLock = false
ChatResizerFrame.Changed:connect(function(prop)
if (prop == "AbsolutePosition" and not BaseFrame.Draggable) then
if (resizeLock) then return end
resizeLock = true
UpdatePositionFromDrag(ChatResizerFrame.AbsolutePosition)
resizeLock = false
end
end)
local function CalculateChannelsBarPixelSize(textSize)
if (deviceType == DEVICE_PHONE) then
textSize = textSize or ChatSettings.ChatChannelsTabTextSizePhone
else
textSize = textSize or ChatSettings.ChatChannelsTabTextSize
end
local channelsBarTextYSize = textSize
local chatChannelYSize = math.max(32, channelsBarTextYSize + 8) + 2
return chatChannelYSize
end
local function CalculateChatBarPixelSize(textSize)
if (deviceType == DEVICE_PHONE) then
textSize = textSize or ChatSettings.ChatBarTextSizePhone
else
textSize = textSize or ChatSettings.ChatBarTextSize
end
local chatBarTextSizeY = textSize
local chatBarYSize = chatBarTextSizeY + (7 * 2) + (5 * 2)
return chatBarYSize
end
if bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 0, 0)
ChannelsBarParentFrame.Visible = false
ChannelsBarParentFrame.Active = false
ChatChannelParentFrame.Visible = false
ChatChannelParentFrame.Active = false
local useXScale = 0
local useXOffset = 0
local screenGuiParent = GetScreenGuiParent()
if (deviceType == DEVICE_PHONE) then
useXScale = ChatSettings.DefaultWindowSizePhone.X.Scale
useXOffset = ChatSettings.DefaultWindowSizePhone.X.Offset
elseif (deviceType == DEVICE_TABLET) then
useXScale = ChatSettings.DefaultWindowSizeTablet.X.Scale
useXOffset = ChatSettings.DefaultWindowSizeTablet.X.Offset
else
useXScale = ChatSettings.DefaultWindowSizeDesktop.X.Scale
useXOffset = ChatSettings.DefaultWindowSizeDesktop.X.Offset
end
local chatBarYSize = CalculateChatBarPixelSize()
BaseFrame.Size = UDim2.new(useXScale, useXOffset, 0, chatBarYSize)
BaseFrame.Position = ChatSettings.DefaultWindowPosition
else
local screenGuiParent = GetScreenGuiParent()
if (deviceType == DEVICE_PHONE) then
BaseFrame.Size = ChatSettings.DefaultWindowSizePhone
elseif (deviceType == DEVICE_TABLET) then
BaseFrame.Size = ChatSettings.DefaultWindowSizeTablet
else
BaseFrame.Size = ChatSettings.DefaultWindowSizeDesktop
end
BaseFrame.Position = ChatSettings.DefaultWindowPosition
end
if (deviceType == DEVICE_PHONE) then
ChatSettings.ChatWindowTextSize = ChatSettings.ChatWindowTextSizePhone
ChatSettings.ChatChannelsTabTextSize = ChatSettings.ChatChannelsTabTextSizePhone
ChatSettings.ChatBarTextSize = ChatSettings.ChatBarTextSizePhone
end
local function UpdateDraggable(enabled)
BaseFrame.Active = enabled
BaseFrame.Draggable = enabled
end
local function UpdateResizable(enabled)
ChatResizerFrame.Visible = enabled
ChatResizerFrame.Draggable = enabled
local frameSizeY = ChatBarParentFrame.Size.Y.Offset
if (enabled) then
ChatBarParentFrame.Size = UDim2.new(1, -frameSizeY - 2, 0, frameSizeY)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -frameSizeY)
end
else
ChatBarParentFrame.Size = UDim2.new(1, 0, 0, frameSizeY)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -frameSizeY)
end
end
end
local function UpdateChatChannelParentFrameSize()
local channelsBarSize = CalculateChannelsBarPixelSize()
local chatBarSize = CalculateChatBarPixelSize()
if (ChatSettings.ShowChannelsBar) then
ChatChannelParentFrame.Size = UDim2.new(1, 0, 1, -(channelsBarSize + chatBarSize + 2 + 2))
ChatChannelParentFrame.Position = UDim2.new(0, 0, 0, channelsBarSize + 2)
else
ChatChannelParentFrame.Size = UDim2.new(1, 0, 1, -(chatBarSize + 2 + 2))
ChatChannelParentFrame.Position = UDim2.new(0, 0, 0, 2)
end
end
local function UpdateChatChannelsTabTextSize(size)
local channelsBarSize = CalculateChannelsBarPixelSize(size)
ChannelsBarParentFrame.Size = UDim2.new(1, 0, 0, channelsBarSize)
UpdateChatChannelParentFrameSize()
end
local function UpdateChatBarTextSize(size)
local chatBarSize = CalculateChatBarPixelSize(size)
ChatBarParentFrame.Size = UDim2.new(1, 0, 0, chatBarSize)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -chatBarSize)
end
ChatResizerFrame.Size = UDim2.new(0, chatBarSize, 0, chatBarSize)
ChatResizerFrame.Position = UDim2.new(1, -chatBarSize, 1, -chatBarSize)
UpdateChatChannelParentFrameSize()
UpdateResizable(ChatSettings.WindowResizable)
end
local function UpdateShowChannelsBar(enabled)
ChannelsBarParentFrame.Visible = enabled
UpdateChatChannelParentFrameSize()
end
UpdateChatChannelsTabTextSize(ChatSettings.ChatChannelsTabTextSize)
UpdateChatBarTextSize(ChatSettings.ChatBarTextSize)
UpdateDraggable(ChatSettings.WindowDraggable)
UpdateResizable(ChatSettings.WindowResizable)
UpdateShowChannelsBar(ChatSettings.ShowChannelsBar)
ChatSettings.SettingsChanged:connect(function(setting, value)
if (setting == "WindowDraggable") then
UpdateDraggable(value)
elseif (setting == "WindowResizable") then
UpdateResizable(value)
elseif (setting == "ChatChannelsTabTextSize") then
UpdateChatChannelsTabTextSize(value)
elseif (setting == "ChatBarTextSize") then
UpdateChatBarTextSize(value)
elseif (setting == "ShowChannelsBar") then
UpdateShowChannelsBar(value)
end
end)
self.GuiObject = BaseFrame
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.ChatBarParentFrame = ChatBarParentFrame
self.GuiObjects.ChannelsBarParentFrame = ChannelsBarParentFrame
self.GuiObjects.ChatChannelParentFrame = ChatChannelParentFrame
self.GuiObjects.ChatResizerFrame = ChatResizerFrame
self.GuiObjects.ResizeIcon = ResizeIcon
self:AnimGuiObjects()
end
function methods:GetChatBar()
return self.ChatBar
end
function methods:RegisterChatBar(ChatBar)
self.ChatBar = ChatBar
self.ChatBar:CreateGuiObjects(self.GuiObjects.ChatBarParentFrame)
end
function methods:RegisterChannelsBar(ChannelsBar)
self.ChannelsBar = ChannelsBar
self.ChannelsBar:CreateGuiObjects(self.GuiObjects.ChannelsBarParentFrame)
end
function methods:RegisterMessageLogDisplay(MessageLogDisplay)
self.MessageLogDisplay = MessageLogDisplay
self.MessageLogDisplay.GuiObject.Parent = self.GuiObjects.ChatChannelParentFrame
end
function methods:AddChannel(channelName)
if (self:GetChannel(channelName)) then
error("Channel '" .. channelName .. "' already exists!")
return
end
local channel = moduleChatChannel.new(channelName, self.MessageLogDisplay)
self.Channels[channelName:lower()] = channel
channel:SetActive(false)
local tab = self.ChannelsBar:AddChannelTab(channelName)
tab.NameTag.MouseButton1Click:connect(function()
self:SwitchCurrentChannel(channelName)
end)
channel:RegisterChannelTab(tab)
return channel
end
function methods:GetFirstChannel()
--// Channels are not indexed numerically, so this function is necessary.
--// Grabs and returns the first channel it happens to, or nil if none exist.
for i, v in pairs(self.Channels) do
return v
end
return nil
end
function methods:RemoveChannel(channelName)
if (not self:GetChannel(channelName)) then
error("Channel '" .. channelName .. "' does not exist!")
end
local indexName = channelName:lower()
local needsChannelSwitch = false
if (self.Channels[indexName] == self:GetCurrentChannel()) then
needsChannelSwitch = true
self:SwitchCurrentChannel(nil)
end
self.Channels[indexName]:Destroy()
self.Channels[indexName] = nil
self.ChannelsBar:RemoveChannelTab(channelName)
if (needsChannelSwitch) then
local generalChannelExists = (self:GetChannel(ChatSettings.GeneralChannelName) ~= nil)
local removingGeneralChannel = (indexName == ChatSettings.GeneralChannelName:lower())
local targetSwitchChannel = nil
if (generalChannelExists and not removingGeneralChannel) then
targetSwitchChannel = ChatSettings.GeneralChannelName
else
local firstChannel = self:GetFirstChannel()
targetSwitchChannel = (firstChannel and firstChannel.Name or nil)
end
self:SwitchCurrentChannel(targetSwitchChannel)
end
if not ChatSettings.ShowChannelsBar then
if self.ChatBar.TargetChannel == channelName then
self.ChatBar:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end
function methods:GetChannel(channelName)
return channelName and self.Channels[channelName:lower()] or nil
end
function methods:GetTargetMessageChannel()
if (not ChatSettings.ShowChannelsBar) then
return self.ChatBar.TargetChannel
else
local curChannel = self:GetCurrentChannel()
return curChannel and curChannel.Name
end
end
function methods:GetCurrentChannel()
return self.CurrentChannel
end
function methods:SwitchCurrentChannel(channelName)
if (not ChatSettings.ShowChannelsBar) then
local targ = self:GetChannel(channelName)
if (targ) then
self.ChatBar:SetChannelTarget(targ.Name)
end
channelName = ChatSettings.GeneralChannelName
end
local cur = self:GetCurrentChannel()
local new = self:GetChannel(channelName)
if new == nil then
error(string.format("Channel '%s' does not exist.", channelName))
end
if (new ~= cur) then
if (cur) then
cur:SetActive(false)
local tab = self.ChannelsBar:GetChannelTab(cur.Name)
tab:SetActive(false)
end
if (new) then
new:SetActive(true)
local tab = self.ChannelsBar:GetChannelTab(new.Name)
tab:SetActive(true)
end
self.CurrentChannel = new
end
end
function methods:UpdateFrameVisibility()
self.GuiObject.Visible = (self.Visible and self.CoreGuiEnabled)
end
function methods:GetVisible()
return self.Visible
end
function methods:SetVisible(visible)
self.Visible = visible
self:UpdateFrameVisibility()
end
function methods:GetCoreGuiEnabled()
return self.CoreGuiEnabled
end
function methods:SetCoreGuiEnabled(enabled)
self.CoreGuiEnabled = enabled
self:UpdateFrameVisibility()
end
function methods:EnableResizable()
self.GuiObjects.ChatResizerFrame.Active = true
end
function methods:DisableResizable()
self.GuiObjects.ChatResizerFrame.Active = false
end
function methods:FadeOutBackground(duration)
self.ChannelsBar:FadeOutBackground(duration)
self.MessageLogDisplay:FadeOutBackground(duration)
self.ChatBar:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInBackground(duration)
self.ChannelsBar:FadeInBackground(duration)
self.MessageLogDisplay:FadeInBackground(duration)
self.ChatBar:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeOutText(duration)
self.MessageLogDisplay:FadeOutText(duration)
self.ChannelsBar:FadeOutText(duration)
end
function methods:FadeInText(duration)
self.MessageLogDisplay:FadeInText(duration)
self.ChannelsBar:FadeInText(duration)
end
function methods:AnimGuiObjects()
self.GuiObjects.ChatChannelParentFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.ChatResizerFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.ResizeIcon.ImageTransparency = self.AnimParams.Background_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
end
function methods:Update(dtScale)
self.ChatBar:Update(dtScale)
self.ChannelsBar:Update(dtScale)
self.MessageLogDisplay:Update(dtScale)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
|
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local TouchThumbpad = setmetatable({}, BaseCharacterController)
TouchThumbpad.__index = TouchThumbpad
function TouchThumbpad.new()
local self = setmetatable(BaseCharacterController.new(), TouchThumbpad)
self.thumbpadFrame = nil
self.touchChangedConn = nil
self.touchEndedConn = nil
self.menuOpenedConn = nil
self.screenPos = nil
self.isRight, self.isLeft, self.isUp, self.isDown = false, false, false, false
self.smArrowSize = nil
self.lgArrowSize = nil
self.smImgOffset = nil
self.lgImgOffset = nil
return self
end
|
--[[
mouse.KeyDown:Connect(function(key)
if key == "l" then
car.Body.Lights.EventHeadlights:FireServer("On")
else
car.Body.Lights.EventHeadlights:FireServer("Off")
end
end)
script.Parent.Values.Brake.Changed:Connect(function()
local BrakeVal = script.Parent.Values.Brake.Value
local GearVal = script.Parent.Values.Gear.Value
if BrakeVal ~= 0 then
car.Body.Lights.EventBrake:FireServer("On")
else
car.Body.Lights.EventBrake:FireServer("Off")
end
end)
script.Parent.Values.Gear.Changed:Connect(function()
local GearVal = script.Parent.Values.Gear.Value
if GearVal == -1 then
car.Body.Lights.EventRev:FireServer("On")
elseif GearVal == 1 then
car.Body.Lights.EventRev:FireServer("Off")
end
end)
]] | --
|
--[[
LocalRotateSpine
Description: Replicates to the server a value which represents the look rotation of our player
the server will then interpolate our players Motor6D to make us look like we're looking up or down.
]] | |
--- Drops the bag full of money onto the ground.
---@param Player Player
---@param Amount number |
local function Handler(Player: Player, Amount : number)
local Character: Model = Player.Character
--// Sanity checks
if (Player.Data.Silver.Value <= Amount) then
return
end
--// Takes away the cash you just dropped from your data
Player.Data.Silver.Value -= Amount
--// I split a lot of the components of this up because it *sucks* looking at a huge wall of property changes, this makes it a bit easier.
local Dropped: BasePart = script.ItemTemplate:Clone()
Dropped.Name = Player.Name.."'s Dropped Silver"
Dropped.BillboardGui.Enabled = true
Dropped.BillboardGui.ToolName.Text = Amount
Dropped.CFrame = Character.HumanoidRootPart.CFrame * CFrame.new(0,-2,-3)
Dropped.Parent = workspace.DroppedBags
local HasHit = false
local Connection; --// Moved down here because I literally thought this was a global at first.
Connection = Dropped.Touched:Connect(function(Hit)
if (HasHit) then return end
if (IsCharacter(Hit.Parent)) then
HasHit = GiveSilver(Amount, Hit.Parent); --// We know GiveSilver returns a boolean, so we can just set 'HasHit' to it.
if (HasHit) then
Dropped:Destroy()
Connection:Disconnect()
end
end
end)
end
Event.OnServerEvent:Connect(Handler)
|
--!strict
--internal server
--Yuuwa0519
--2022-03-14 | |
--end) |
game.ReplicatedStorage.Events.TirarSave1.OnServerEvent:Connect(function(player)
player.Saves.Numerodesaves.Value = 0
end)
game.ReplicatedStorage.Events.TirarSave2.OnServerEvent:Connect(function(player)
player.Saves.Numerodesaves3.Value = 0
end)
|
--[[
Returns the value currently stored in this State object.
The state object will be registered as a dependency unless `asDependency` is
false.
]] |
function class:get(asDependency: boolean?): any
if asDependency ~= false then
useDependency(self)
end
return self._value
end
|
--only works for R6 |
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
player.Character.Animate.jump.JumpAnim.AnimationId = "http://www.roblox.com/asset/?id=6866114910" --Insert your animation's ID here or leave this one, I don't really care--
end)
end)
|
-- Validator for custom enums created by enumerate |
return function(enum)
return function(value)
return enum.isEnumValue(value)
end
end
|
--- Get signal instance |
Signal.Get = function(eventName)
--- Variables
eventName = string.lower(eventName)
--
return GetEvent(eventName)
end
|
-- This is auto installer :D |
local anti = script.Anti
local human = script.HumanoidSettings
local main = script["JyAntiCheat.lua [READ]"]
game.Players.PlayerAdded:connect(function(Player)
main.Name = "JyAntiCheat.lua"
anti.Parent = game.StarterPlayer.StarterCharacterScripts
main.Parent = game.StarterPlayer.StarterCharacterScripts
human.Parent = game.StarterPlayer.StarterCharacterScripts
anti:Clone()
main:Clone()
human:Clone()
wait(.1);
script:Destroy();
end)
|
--//VIPERGUTZ
--//TASER ANIMATIONS |
local Tool = script.Parent
local IdleAnimation
local IdleTrack = nil
script.Parent.Equipped:Connect(function(mouse)
local MyCharacter = Tool.Parent
local MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
local MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
IdleAnimation = Tool:WaitForChild("Idle")
if IdleAnimation then
IdleTrack = MyHumanoid:LoadAnimation(IdleAnimation)
IdleTrack.Priority = Enum.AnimationPriority.Movement
end
if IdleTrack then
IdleTrack:Play()
end
end)
script.Parent.Unequipped:Connect(function(mouse)
if IdleTrack then
IdleTrack:Stop()
end
end)
|
--For Omega Rainbow Katana thumbnail to display a lot of particles. |
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
--[[
if CheckIfAlive() then
local Force = Instance.new("BodyVelocity")
Force.velocity = Vector3.new(0, 10, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.4)
Force.Parent = Torso
end
]]
wait(0.3)
Tool.Grip = Grips.Out
wait(0.8)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.8)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
--|| VARIABLES ||-- |
local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild"Humanoid"
local HumanoidRootPart = Character.HumanoidRootPart
local Torso = Character.Torso
local RootJoint = HumanoidRootPart.RootJoint
local LeftHipJoint = Torso["Left Hip"]
local RightHipJoint = Torso["Right Hip"]
local function Lerp(a, b, c)
return a + (b - a) * c
end
local Force = nil
local Direction = nil
local Value1 = 0
local Value2 = 0
local RootJointC0 = RootJoint.C0
local LeftHipJointC0 = LeftHipJoint.C0
local RightHipJointC0 = RightHipJoint.C0
RunService.RenderStepped:Connect(function()
--> To get the force, we multiply the velocity by 1,0,1, we don't want the Y value so we set y to 0
Force = HumanoidRootPart.Velocity * Vector3.new(1,0,1)
if Force.Magnitude > 2 then
--> This represents the direction
Direction = Force.Unit
Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
else
Value1 = 0
Value2 = 0
end
--> the values being multiplied are how much you want to rotate by
RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 10), math.rad(-Value1 * 10), 0), 0.2)
LeftHipJoint.C0 = LeftHipJoint.C0:Lerp(LeftHipJointC0 * CFrame.Angles(math.rad(Value1 * 10), 0, 0), 0.2)
RightHipJoint.C0 = RightHipJoint.C0:Lerp(RightHipJointC0 * CFrame.Angles(math.rad(-Value1 * 10), 0, 0), 0.2)
end)
|
--Make sure players stay banned. |
local DataStore = game:GetService("DataStoreService"):GetDataStore("motfAdminPanel")
function checkBan(player)
local Reason = DataStore:GetAsync(string.lower(player.Name))
if Reason == nil or Reason == 0 then
return
end
wait(1)
if Reason == 1 then
player:Kick("You are banned from this game.")
else
player:Kick("You are banned from this game for the following reason: " .. Reason)
end
end
game.Players.PlayerAdded:connect(checkBan)
|
-- DESTROY/CLEANUP METHOD |
function Icon:destroy()
IconController.iconRemoved:Fire(self)
self:clearNotices()
self:setDropdown()
self:setMenu()
self._maid:clean()
end
Icon.Destroy = Icon.destroy -- an alias for you maid-using Pascal lovers
return Icon
|
------------------------------------------------------------ |
function ClickPlus()
if (oper == "") then
oper = "+"
disp = disp.."+"
script.Parent.Display.Text = disp
end
end
script.Parent.ClPlus.MouseButton1Down:connect(ClickPlus)
function ClickMinus()
if (oper == "") then
oper = "-"
disp = disp.."-"
script.Parent.Display.Text = disp
end
end
script.Parent.ClMin.MouseButton1Down:connect(ClickMinus)
function ClickMultiply()
if (oper == "") then
oper = "*"
disp = disp.."*"
script.Parent.Display.Text = disp
end
end
script.Parent.ClMult.MouseButton1Down:connect(ClickMultiply)
function ClickDivide()
if (oper == "") then
oper = "/"
disp = disp.."/"
script.Parent.Display.Text = disp
end
end
script.Parent.ClDiv.MouseButton1Down:connect(ClickDivide)
|
-----------------------------------------------------------------------------------------------------------
-- API: |
function API:GetDataStore(name, scope)
assert(type(name) == "string", "DataStore name must be a string; got" .. type(name))
assert(type(scope) == "string" or scope == nil, "DataStore scope must be a string; got" .. type(scope))
scope = (scope or "global")
if (allStores[scope] and allStores[scope][name]) then
return allStores[scope][name]
end
local data = {}
local d = {}
local updateListeners = {}
function d:SetAsync(k, v)
assert(v ~= nil, "Value cannot be nil")
data[k] = v
if (updateListeners[k]) then
for _,f in pairs(updateListeners[k]) do
spawn(function() f(v) end)
end
end
end
function d:UpdateAsync(k, func)
local v = func(data[k])
assert(v ~= nil, "Value cannot be nil")
data[k] = v
if (updateListeners[k]) then
for _,f in pairs(updateListeners[k]) do
spawn(function() f(v) end)
end
end
end
function d:GetAsync(k)
return data[k]
end
function d:RemoveAsync(k)
data[k] = nil
if (updateListeners[k]) then
for _,f in pairs(updateListeners[k]) do
spawn(function() f(nil) end)
end
end
end
function d:IncrementAsync(k, delta)
if (delta == nil) then delta = 1 end
assert(type(delta) == "number", "Can only increment numbers")
self:UpdateAsync(k, function(num)
if (num == nil) then
return num
end
assert(type(num) == "number", "Can only increment numbers")
return (num + delta)
end)
end
function d:OnUpdate(k, onUpdateFunc)
assert(type(onUpdateFunc) == "function", "Update function argument must be a function")
if (not updateListeners[k]) then
updateListeners[k] = {onUpdateFunc}
else
table.insert(updateListeners[k], onUpdateFunc)
end
end
if (not allStores[scope]) then
allStores[scope] = {}
end
allStores[scope][name] = d
return d
end
function API:GetGlobalDataStore()
return self:GetDataStore("global", "global")
end
function API:GetOrderedDataStore(name, scope)
local dataStore = self:GetDataStore(name, scope)
local allData = {}
local d = {}
function d:GetAsync(k)
return dataStore:GetAsync(k)
end
function d:SetAsync(k, v)
assert(type(v) == "number", "Value must be a number")
dataStore:SetAsync(k, v)
allData[k] = v
end
function d:UpdateAsync(k, func)
dataStore:UpdateAsync(k, function(oldValue)
local v = func(oldValue)
assert(type(v) == "number", "Value must be a number")
allData[k] = v
return v
end)
end
function d:IncrementAsync(k, delta)
dataStore:IncrementAsync(k, delta)
allData[k] = ((allData[k] or 0) + delta)
end
function d:RemoveAsync(k)
dataStore:RemoveAsync(k)
allData[k] = nil
end
function d:GetSortedAsync(isAscending, pageSize, minValue, maxValue)
assert(type(pageSize) == "number" and math.floor(pageSize) > 0, "PageSize must be an integer and greater than 0")
assert(minValue == nil or type(minValue) == "number", "MinValue must be a number")
assert(maxValue == nil or type(maxValue) == "number", "MaxValue must be a number")
if (minValue and maxValue) then
assert(minValue <= maxValue, "MinValue must be less or equal to MaxValue")
end
local data = {}
for k,v in pairs(allData) do
local pass = ((not minValue or v >= minValue) and (not maxValue or v <= maxValue))
if (pass) then
table.insert(data, {key = k, value = v})
end
end
table.sort(data,
(isAscending and
function(a, b) return (a.value < b.value) end
or
function(a, b) return (b.value < a.value) end
)
)
pageSize = math.floor(pageSize)
local pages = {IsFinished = false}
for i,v in pairs(data) do
local pageNum = math.ceil(i / pageSize)
local page = pages[pageNum]
if (not page) then
page = {}
pages[pageNum] = page
end
local index = (((i - 1) % pageSize) + 1)
page[index] = v
end
do
local currentPage = 1
function pages:GetCurrentPage()
return self[currentPage]
end
function pages:AdvanceToNextPageAsync()
local numPages = #pages
if (currentPage < numPages) then
currentPage = (currentPage + 1)
end
self.IsFinished = (currentPage >= numPages)
end
end
return pages
end
return d
end
function API:GetRequestBudgetForRequestType(requestType)
return realDataStoreService:GetRequestBudgetForRequestType(requestType)
end
|
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{46,47,48,49},t},
[16]={n,f},
[19]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{46,47,48,49,45,44,28,29,31,32,34},t},
[21]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{46,47,48},t},
[27]={{46,47,48,49,45,44,28,27},t},
[14]={n,f},
[31]={{46,47,48,49,45,44,28,29,31},t},
[56]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{46,47,48,49,45,44,28,29},t},
[13]={n,f},
[47]={{46,47},t},
[12]={n,f},
[45]={{46,47,48,49,45},t},
[57]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{46,47,48,49,45,44,28,29,31,32,33,36},t},
[25]={{46,47,48,49,45,44,28,27,26,25},t},
[71]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{46,47,48,49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{46,47,48,49,45,44,28,29,31,32,34,35},t},
[53]={{46,47,52,53},t},
[73]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{46,47,48,49,45,44,28,29,31,32,33},t},
[69]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{46,47,48,49,45,44,28,27,26},t},
[68]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{46,47,50},t},
[66]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{46,47,48,49,45,44,28,27,26,25,24},t},
[23]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{46,47,48,49,45,44},t},
[39]={{46,47,48,49,45,44,28,29,31,32,34,35,39},t},
[32]={{46,47,48,49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{46,47,50,51},t},
[18]={n,f},
[67]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{46,47,52,53,54,55},t},
[46]={{46},t},
[42]={{46,47,48,49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{46,47,48,49,45,44,28,29,31,32,34,35,40},t},
[52]={{46,47,52},t},
[54]={{46,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{46,47,48,49,45,44,28,29,31,32,34,35,38},t},
[28]={{46,47,48,49,45,44,28},t},
[5]={n,f},
[64]={{46,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[=[
@class EnumList
Defines a new Enum.
]=] |
local EnumList = {}
EnumList.__index = EnumList
|
--//services//-- |
local runService = game:GetService("RunService")
|
--[=[
Cleans up all objects in the trove. This is
similar to calling `Remove` on each object
within the trove.
]=] |
function Trove:Clean()
for _,obj in ipairs(self._objects) do
self:_cleanupObject(obj[1], obj[2])
end
table.clear(self._objects)
end
function Trove:_findAndRemoveFromObjects(object: any, cleanup: boolean): boolean
local objects = self._objects
for i,obj in ipairs(objects) do
if obj[1] == object then
local n = #objects
objects[i] = objects[n]
objects[n] = nil
if cleanup then
self:_cleanupObject(obj[1], obj[2])
end
return true
end
end
return false
end
function Trove:_cleanupObject(object, cleanupMethod)
if cleanupMethod == FN_MARKER then
object()
elseif cleanupMethod == THREAD_MARKER then
coroutine.close(object)
else
object[cleanupMethod](object)
end
end
|
-- Shake
-- Stephen Leitnick
-- December 09, 2021 | |
-- Remotes
--local Remotes = ReplicatedStorage:WaitForChild("OnlineStudio"):WaitForChild("Remotes")
--local GetApiJsonFunction = Remotes:WaitForChild("GetApiJson") | |
-- Roact |
local new = Roact.createElement
local Tooltip = require(script:WaitForChild 'Tooltip')
local ModeToggle = Roact.PureComponent:extend 'ModeToggle'
function ModeToggle:init()
self.Maid = Maid.new()
--- Processes input, listens for hover start
function self.OnInputBegin(rbx, Input, WasProcessed)
if WasProcessed then
return
end
-- Set hovering state
if Input.UserInputType.Name == 'MouseMovement' then
self:setState({
IsHovering = true;
})
end
end
--- Processes input, listens for hover end
function self.OnInputEnd(rbx, Input, WasProcessed)
if Input.UserInputType.Name == 'MouseMovement' then
self:setState({
IsHovering = false;
})
end
end
--- Processes input, and toggles between targeting modes.
function self.OnActivated()
self.props.Core.Targeting:ToggleTargetingMode()
end
-- Set initial targeting mode
self:setState({
TargetingMode = self.props.Core.Targeting.TargetingMode;
IsHovering = false;
})
end
function ModeToggle:didMount()
local Targeting = self.props.Core.Targeting
self.Maid.ModeListener = Targeting.TargetingModeChanged:Connect(function (NewTargetingMode)
self:setState({
TargetingMode = NewTargetingMode;
})
end)
end
function ModeToggle:willUnmount()
self.Maid:Destroy()
end
function ModeToggle:render()
local IconSpritesheetPosition = (self.state.TargetingMode == 'Scoped' and 0) or
(self.state.TargetingMode == 'Direct' and 14)
return Roact.createFragment({
ModeToggle = new('ImageButton', {
BackgroundTransparency = 1;
Image = 'rbxassetid://4445959523';
ImageTransparency = 1 - (self.state.IsHovering and 0.5 or 0.2);
ScaleType = Enum.ScaleType.Slice;
SliceCenter = Rect.new(4, 4, 12, 12);
ImageColor3 = Color3.fromRGB(131, 131, 131);
Size = UDim2.new(0, 36/2, 0, 36/2);
LayoutOrder = 0;
[Roact.Event.Activated] = self.OnActivated;
[Roact.Event.InputBegan] = self.OnInputBegin;
[Roact.Event.InputEnded] = self.OnInputEnd;
},
{
Icon = new('ImageLabel', {
BackgroundTransparency = 1;
Image = 'rbxassetid://4463020853';
ImageTransparency = 1 - (self.state.IsHovering and 1 or 0.5);
AnchorPoint = Vector2.new(0.5, 0.5);
Position = UDim2.new(0.5, 0, 0.5, 0);
Size = UDim2.new(0, 28/2, 0, 28/2);
ImageRectOffset = Vector2.new(IconSpritesheetPosition, 0);
ImageRectSize = Vector2.new(14, 14);
});
Tooltip = new(Tooltip, {
Visible = self.state.IsHovering;
IsToolModeEnabled = self.props.IsToolModeEnabled;
});
});
ModeToggleSpacer = new('Frame', {
BackgroundTransparency = 1;
Size = UDim2.new(0, 0, 1, 0);
LayoutOrder = 1;
});
})
end
return ModeToggle
|
--DevVince was here.:o (4/23/2019)
--Fixed some stuff and made ants go after diffrent targets. |
local hill = script.Parent
local itemData = require(game.ReplicatedStorage.Modules.GameData)
local activeAnts = {}
function GetDictionaryLength(tab)
local total = 0
for _,v in next, tab do
total = total + 1
end
return total
end
addAnt = coroutine.wrap(function()
while wait(5) do
if GetDictionaryLength(activeAnts) < 3 then
local newAnt = game.ServerStorage.Creatures['Scavenger Ant']:Clone()
newAnt:SetPrimaryPartCFrame(hill.PrimaryPart.CFrame*CFrame.new(0,5,0))
newAnt.Parent = hill
activeAnts[newAnt] = {
["carrying"] = nil,
["target"] = nil,
["destination"] = newAnt.PrimaryPart.Position,
["lastOrder"] = tick(),
["lastScan"] = tick(),
["anims"] = {},
}
for _,anim in next,game.ReplicatedStorage.NPCAnimations.Ant:GetChildren() do
activeAnts[newAnt].anims[anim.Name] = newAnt:WaitForChild("Hum"):LoadAnimation(anim)
end
newAnt:WaitForChild'Health'.Changed:connect(function()
newAnt.PrimaryPart.Hurt.Pitch = newAnt.PrimaryPart.Hurt.OriginalPitch.Value+(math.random(-100,100)/100)
newAnt.PrimaryPart.Hurt:Play()
end)
newAnt.AncestryChanged:connect(function()
activeAnts[newAnt] = nil
end)
end
wait(55)
end
end)
addAnt()
function Seeking(array, target)--Queen ant keeps track of her workers. ;)
for i,v in pairs(array) do
if v == target then
return true
end
end
return false
end
manageAnts = coroutine.wrap(function()
while wait(1) do
local seeking = {}
for ant, antData in next,activeAnts do
spawn(function()
if ant and ant.PrimaryPart and ant:FindFirstChild'Hum' and ant.Hum.Health > 0 and ant:IsDescendantOf(workspace) then
activeAnts[ant].lastScan = tick()
-- scan for nearest Shelly
if not activeAnts[ant].carrying then
local nearestShelly,closestDist = nil,math.huge
for _,creature in next, workspace.Critters:GetChildren() do
if not Seeking(seeking, creature) and creature:FindFirstChild'HitShell' and itemData[creature.Name].abductable then
local a, c = ant.PrimaryPart, creature.PrimaryPart
if not c then
c = creature:FindFirstChildOfClass'BasePart'
end
local dist = (c.Position-a.Position).magnitude
if dist < closestDist then
nearestShelly = creature
closestDist = dist
end
end
end
if ant and nearestShelly then
activeAnts[ant].destination = nearestShelly.PrimaryPart.Position
activeAnts[ant].target = nearestShelly
table.insert(seeking, nearestShelly)
activeAnts[ant].target.AncestryChanged:connect(function()
activeAnts[ant].target = nil
end)
end
else
activeAnts[ant].destination = hill.PrimaryPart.Position+Vector3.new(0,3,0)
end
if activeAnts[ant].destination then
ant.Hum:MoveTo(activeAnts[ant].destination)
if not activeAnts[ant].anims.AntWalk.IsPlaying then
activeAnts[ant].anims.AntWalk:Play()
end
if antData.target and not antData.carrying then
local dist = (ant.PrimaryPart.Position-activeAnts[ant].target.PrimaryPart.Position).magnitude
if dist < 5 then
-- let's get a new shelly
local abductedShelly = game.ServerStorage.Misc["Abducted Shelly"]:Clone()
antData.carrying = abductedShelly
abductedShelly.Shell.Material = antData.target.Shell.Material
abductedShelly.Shell.Color = antData.target.Shell.Color
abductedShelly.ActualName.Value = antData.target.Name
--game.ReplicatedStorage.Events.NPCAttack:Fire(antData.target,math.huge)
antData.target:Destroy()
abductedShelly.Parent = ant
activeAnts[ant].anims.AntWalk:Stop()
activeAnts[ant].anims.AntHold:Play()
ant.PrimaryPart.Chatter:Play()
ant.PrimaryPart.ShellyAbduct:Play()
-- weld the shelly to the torso
local weld = Instance.new("ManualWeld")
weld.Parent = ant.PrimaryPart
weld.Part0 = ant.PrimaryPart
weld.Part1 = abductedShelly.PrimaryPart
weld.C0 = CFrame.new(-.4,.4,-1.6)*CFrame.Angles(0,math.rad(90),0)
end
elseif antData.carrying then
local dist = (ant.PrimaryPart.Position-activeAnts[ant].destination).magnitude
if dist < 7 then
ant.Hum:MoveTo(ant.PrimaryPart.Position)
ant.PrimaryPart.Chatter:Play()
activeAnts[ant].anims.AntHold:Stop()
activeAnts[ant].anims.AntWalk:Stop()
activeAnts[ant].carrying:Destroy()
activeAnts[ant].carrying = nil
activeAnts[ant].destination = nil
activeAnts[ant].target = nil
end
end
end
end
end)--Help prevent breaking and faster responding times for ants.
end--Shouldn't error now though.
end
end)
manageAnts()
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = script:FindFirstAncestor("MainUI");
local u1 = 0;
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local l__TweenService__3 = game:GetService("TweenService");
return function(p1, p2, p3)
local v2 = game.ReplicatedStorage.Entities.Screech:Clone();
local v3 = math.random(-1, 1) * 2;
if p1.dead then
return;
end;
if v3 < 0 then
v3 = -1.1;
end;
u1 = u1 + 1;
local l__unit__4 = (p1.finalCamCFrame.LookVector * Vector3.new(-1, 0, -1) + Vector3.new(0, v3, 0)).unit;
local l__p__5 = p1.finalCamCFrame.p;
v2:SetPrimaryPartCFrame(CFrame.new(l__p__5 + l__unit__4 * 4, l__p__5) * CFrame.new(0, 0.5, 0));
v2.Parent = p1.cam;
local v6 = {};
for v7, v8 in pairs(v2.Animations:GetChildren()) do
if v8:IsA("Animation") then
v6[v8.Name] = v2.AnimationController:LoadAnimation(v8);
end;
end;
local v9 = tick();
v6.Idle:Play();
delay(math.random(1, 5) / 6, function()
if v2:FindFirstChild("Root") then
v2.Root.Sound:Play();
end;
end);
local v10 = tick();
local l__RunService__11 = game:GetService("RunService");
local u4 = false;
local u5 = v2.PrimaryPart.CFrame;
local u6 = true;
local l__PointLight__7 = v2.Base.Attachment.PointLight;
local u8 = 0;
local l__Humanoid__9 = l__LocalPlayer__2.Character.Humanoid;
local u10 = false;
local l__PrimaryPart__11 = l__LocalPlayer__2.Character.PrimaryPart;
local u12 = false;
local u13 = 6.5 + math.random(1, 10) / 5;
local v12 = l__RunService__11:BindToRenderStep("screechStuff" .. u1, 100, function(p4)
if not u4 then
v2.PrimaryPart.CFrame = u5;
else
game:GetService("RunService"):UnbindFromRenderStep("screechStuff" .. u1);
end;
if u6 then
local v13 = (p1.finalCamCFrame.LookVector.unit - l__unit__4).Magnitude * 100;
l__PointLight__7.Brightness = math.clamp(50 - v13, 0, 50) / 50;
if v13 < 35 then
u8 = u8 + p4;
end;
if u8 >= 0.1 or l__Humanoid__9.Parent:GetAttribute("Hiding") then
u10 = true;
end;
if not (not game.ReplicatedStorage.GameData.EntityDisableScreech.Value) or not (not l__PrimaryPart__11.Anchored) or l__Humanoid__9.Health < 1 then
u12 = true;
u10 = false;
u13 = 0;
end;
end;
end);
p1.camShaker:ShakeOnce(0.5, 12, 3, 1);
for v14 = 1, 1000000 do
task.wait();
local l__p__15 = p1.finalCamCFrame.p;
u5 = CFrame.new(l__p__15 + l__unit__4 * 3.5, l__p__15) * CFrame.new(0, 0.5, 0);
if v10 + u13 < tick() then
break;
end;
if u10 then
break;
end;
end;
local v16 = tick();
local l__CFrame__17 = v2.PrimaryPart.CFrame;
if u12 or (not (not p1.tool) and p1.tool.Name == "Crucifix" and u10 == false or l__Humanoid__9.Health < 1) then
local v18, v19, v20 = CFrame.new(Vector3.new(0, 0, 0), l__unit__4):ToOrientation();
p1.ax_t = math.deg(v19);
p1.ay_t = math.deg(v18);
wait(0.2);
game.ReplicatedStorage.EntityInfo.Screech:FireServer(false);
else
game.ReplicatedStorage.EntityInfo.Screech:FireServer(u10);
if u10 then
v6.Caught:Play();
script.Caught:Play();
p1.camShaker:ShakeOnce(6, 42, 0, 1);
else
v6.Attack:Play();
script.Attack:Play();
p1.camShaker:ShakeOnce(8, 42, 0, 1);
end;
v2.Root.Sound:Stop();
l__PointLight__7.Brightness = 1;
local v21, v22, v23 = CFrame.new(Vector3.new(0, 0, 0), l__unit__4):ToOrientation();
u6 = false;
for v24 = 1, 1000000 do
task.wait();
local l__p__25 = p1.finalCamCFrame.p;
u5 = l__CFrame__17:Lerp(CFrame.new(l__p__25 + l__unit__4 * 3.5, l__p__25) * CFrame.new(0, 0.5, 0), (l__TweenService__3:GetValue((tick() - v16) / 0.1, Enum.EasingStyle.Linear, Enum.EasingDirection.In)));
if v16 + 0.1 < tick() then
break;
end;
end;
local v26 = tick();
for v27 = 1, 1000000 do
task.wait();
u5 = CFrame.new(p1.finalCamCFrame.Position + p1.finalCamCFrame.LookVector * 3, p1.finalCamCFrame.Position) * CFrame.new(0, 0.5, 0);
if v26 + 2 < tick() then
break;
end;
end;
end;
u4 = true;
v2:Destroy();
game:GetService("RunService"):UnbindFromRenderStep("screechStuff" .. u1);
end;
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 15
plrData.Character.Injuries.DryBlood.Value = false
end
|
-- Call this from a function bound to Renderstep with Input Priority |
function VehicleController:Update(moveVector, usingGamepad)
if self.vehicleSeat then
moveVector = moveVector + Vector3.new(self.steer, 0, self.throttle)
if usingGamepad and onlyTriggersForThrottle and useTriggersForThrottle then
self.vehicleSeat.ThrottleFloat = -self.throttle
else
self.vehicleSeat.ThrottleFloat = -moveVector.Z
end
self.vehicleSeat.SteerFloat = moveVector.X
return moveVector, true
end
return moveVector, false
end
return VehicleController
|
-- Disables children for <textarea> elements |
exports.disableTextareaChildren = false
exports.disableModulePatternComponents = false
|
-- Version 3
-- Last updated: 31/07/2020 |
local Module = {}
DebugEnabled = false
Debris = game:GetService("Debris")
function Module.FracturePart(PartToFracture)
local BreakingPointAttachment = PartToFracture:FindFirstChild("BreakingPoint")
-- Settings
local Configuration = PartToFracture:FindFirstChild("Configuration")
local DebrisDespawn = false
local DebrisDespawnDelay = 0
local WeldDebris = false
local AnchorDebris = false
if DebugEnabled then
local DebugPart = Instance.new("Part")
DebugPart.Shape = "Ball"
DebugPart.CanCollide = false
DebugPart.Anchored = true
DebugPart.Size = Vector3.new(0.5, 0.5, 0.5)
DebugPart.Color = Color3.fromRGB(255, 0, 0)
DebugPart.Position = BreakingPointAttachment.WorldPosition
DebugPart.Parent = workspace
end
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
if BreakSound then
local SoundPart = Instance.new("Part")
SoundPart.Size = Vector3.new(0.2, 0.2, 0.2)
SoundPart.Position = PartToFracture.Position
SoundPart.Name = "TemporarySoundEmitter"
SoundPart.Anchored = true
SoundPart.CanCollide = false
SoundPart.Transparency = 1
local Sound = BreakSound:Clone()
Sound.Parent = SoundPart
SoundPart.Parent = workspace
Sound:Play()
Debris:AddItem(SoundPart, Sound.TimeLength)
end
if Configuration then
DebrisDespawn = Configuration.DebrisDespawn.Value
DebrisDespawnDelay = Configuration.DebrisDespawnDelay.Value
WeldDebris = Configuration.WeldDebris.Value
AnchorDebris = Configuration.AnchorDebris.Value
else
warn("The 'Configuration' is not a valid member of " .. PartToFracture.Name .. ". Please insert a 'Configuration' with the following values; 'DebrisDespawn' (bool), 'WeldDebris' (bool), 'DebrisDespawnDelay' (number/int)")
end
if not BreakingPointAttachment then
warn("The 'BreakingPoint' attachment is not a valid member of " .. PartToFracture.Name .. ". Please insert an attachment named 'BreakingPoint'")
end
local BreakingPointY = BreakingPointAttachment.Position.Y
local BreakingPointZ = BreakingPointAttachment.Position.Z
local ShardBottomLeft = Instance.new("WedgePart")
local ShardBottomRight = Instance.new("WedgePart")
local ShardTopLeft = Instance.new("WedgePart")
local ShardTopRight = Instance.new("WedgePart")
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
-- Bottom Left
ShardBottomLeft.Material = PartToFracture.Material
ShardBottomLeft.Color = PartToFracture.Color
ShardBottomLeft.Transparency = PartToFracture.Transparency
ShardBottomLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
local OldSizeY = ShardBottomLeft.Size.Y
local OldSizeZ = ShardBottomLeft.Size.Z
ShardBottomLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardBottomLeft.Size.Y / 2), BreakingPointZ + (ShardBottomLeft.Size.Z / 2))
ShardBottomLeft.CFrame = ShardBottomLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardBottomLeft.Size = Vector3.new(ShardBottomLeft.Size.X, OldSizeZ, OldSizeY)
local ShardBottomLeft2 = ShardBottomLeft:Clone()
ShardBottomLeft2.CFrame = ShardBottomLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Bottom Right
ShardBottomRight.Material = PartToFracture.Material
ShardBottomRight.Color = PartToFracture.Color
ShardBottomRight.Transparency = PartToFracture.Transparency
ShardBottomRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
ShardBottomRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardBottomRight.Size.Y / 2), BreakingPointZ + (ShardBottomRight.Size.Z / 2))
local ShardBottomRight2 = ShardBottomRight:Clone()
ShardBottomRight2.CFrame = ShardBottomRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Left
ShardTopLeft.Material = PartToFracture.Material
ShardTopLeft.Color = PartToFracture.Color
ShardTopLeft.Transparency = PartToFracture.Transparency
ShardTopLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
local OldSizeY = ShardTopLeft.Size.Y
local OldSizeZ = ShardTopLeft.Size.Z
ShardTopLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardTopLeft.Size.Y / 2), BreakingPointZ - (ShardTopLeft.Size.Z / 2))
ShardTopLeft.CFrame = ShardTopLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardTopLeft.Size = Vector3.new(ShardTopLeft.Size.X, OldSizeZ, OldSizeY)
local ShardTopLeft2 = ShardTopLeft:Clone()
ShardTopLeft2.CFrame = ShardTopLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Right
ShardTopRight.Material = PartToFracture.Material
ShardTopRight.Color = PartToFracture.Color
ShardTopRight.Transparency = PartToFracture.Transparency
ShardTopRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
ShardTopRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardTopRight.Size.Y / 2), BreakingPointZ - (ShardTopRight.Size.Z / 2))
local ShardTopRight2 = ShardTopRight:Clone()
ShardTopRight2.CFrame = ShardTopRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
local ShardDictionary = {ShardBottomLeft, ShardBottomLeft2, ShardBottomRight, ShardBottomRight2, ShardTopLeft, ShardTopLeft2, ShardTopRight, ShardTopRight2}
local shards = {}
local FirstShard = nil
for Index, Shard in ipairs(ShardDictionary) do
table.insert(shards,Shard)
if not FirstShard then
FirstShard = Shard
end
Shard.Anchored = AnchorDebris
if not AnchorDebris then
Shard.Velocity = PartToFracture.Velocity
Shard.RotVelocity = PartToFracture.RotVelocity
end
if WeldDebris and FirstShard then
local Weld = Instance.new("WeldConstraint")
Weld.Name = "ShardWeld"
Weld.Part0 = FirstShard
Weld.Part1 = Shard
Weld.Parent = Shard
end
Shard.Name = "Shard"
Shard.Parent = PartToFracture.Parent
if DebrisDespawn then
Debris:AddItem(Shard, DebrisDespawnDelay)
end
end
PartToFracture:Destroy()
return shards
end
return Module
|
-- Functions |
function MapManager:SaveMap()
for _, child in ipairs(workspace:GetChildren()) do
if not child:IsA('Camera') and not child:IsA('Terrain') and not child:IsA('Folder') then
local copy = child:Clone()
if copy then
copy.Parent = MapSave
end
end
end
end
function MapManager:ClearMap()
for _, child in ipairs(workspace:GetChildren()) do
if not child:IsA('Camera') and not child:IsA('Terrain') and not child:IsA('Folder') then
child:Destroy()
end
end
end
function MapManager:LoadMap()
spawn(function()
for _, child in ipairs(MapSave:GetChildren()) do
local copy = child:Clone()
copy.Parent = workspace
end
end)
end
return MapManager
|
----------------------------------------------------------------------------------------------- |
script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
local intach = car.Body.Dash.Tac.G.Needle |
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 2.66 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 1.78 ,
--[[ 3 ]] 1.30 ,
--[[ 4 ]] 1.0 ,
--[[ 5 ]] 0.74 ,
--[[ 6 ]] 0.50 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- To preserve the "Pause on caught exceptions" behavior of the debugger, we
-- replay the begin phase of a failed component inside invokeGuardedCallback. |
exports.replayFailedUnitOfWorkWithInvokeGuardedCallback = _G.__DEV__
|
--Shield.Touched:connect(function(Hit)
-- if Hit == nil then return end
-- if Hit.Parent == nil then return end
--
-- local Item = Hit.Parent
--
-- if Item:IsA("Tool") == true then return end
-- if Hit.Name == "Torso" then return end
-- if Hit.Name == "HumanoidRootPart" then return end
-- if Hit.Name == "Left Leg" then return end
-- if Hit.Name == "Right Leg" then return end
-- if Hit.Name == "Head" then return end
-- if Hit.Name == "Left Arm" then return end
-- if Hit.Name == "Right Arm" then return end
-- if Hit:FindFirstChild("Pierce") ~= nil then return end
--
-- if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
--
-- for _, x in ipairs(Hit:GetChildren()) do
-- if x:IsA("TouchTransmitter") == true then x:Destroy() break end
-- end
--end) |
function CreateRegion3FromLocAndSize(Position, Size)
local SizeOffset = Size / 2
local Point1 = Position - SizeOffset
local Point2 = Position + SizeOffset
return Region3.new(Point1, Point2)
end
function FindNear(part, radius)
local r = CreateRegion3FromLocAndSize(part.Position, Vector3.new(part.Size.X + radius, 50, part.Size.Z + radius))
return Game:GetService("Workspace"):FindPartsInRegion3(r, part, 100)
end
while true do
for _, item in ipairs(FindNear(Shield, 15)) do
if item:IsA("BasePart") == true then
local own, dmg = GetOwnerAndDamage(item)
if own ~= nil and dmg ~= nil and item:FindFirstChild("Pierce") == nil then
if (item.Position - Shield.Position).magnitude <= 15 and item ~= Shield then
item:Destroy()
end
end
end
end
Game:GetService("RunService").Stepped:wait()
end
|
--mouse.Button1Up:connect(no) |
spawn(function() -- this is for the server
while true do
gun.Seat.Script.aim:InvokeServer(mouse.Hit.p+Vector3.new(0,0,-0.52))
wait(0.1)
end
end)
while rs:wait() do -- render the turret client side anyways to keep turret feeling responsive
aimpos = mouse.Hit.p
--gun.gun.Seat.Script.aim:InvokeServer(mouse.Hit.p)
if (aimpos-gun.base.Position).magnitude>3 then
local c = aimpos
local x = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).x
local y = (SPAWN*CFrame.new(0, 0, -100000)).y
local z = (gun.gun:GetPrimaryPartCFrame()*CFrame.new(0, 0, -100000)).z
A = Vector3.new(x,
y,
z
)
if c then
gun.gun:SetPrimaryPartCFrame(
CFrame.new(gun.body:GetPrimaryPartCFrame().p,
c)
)
gun.body:SetPrimaryPartCFrame(
CFrame.new(
SPAWN.p,
A
)
)
else
gun:SetPrimaryPartCFrame(gun.body:GetPrimaryPartCFrame())
gun.body:SetPrimaryPartCFrame(
CFrame.new(
SPAWN.p,
A
)
)
end
end
end
|
-- Connect to the current and all future cameras |
workspace:GetPropertyChangedSignal("CurrentCamera"):connect(OnCurrentCameraChanged)
OnCurrentCameraChanged()
Player.CharacterAdded:connect(OnCharacterAdded)
if Player.Character then
OnCharacterAdded(Player.Character)
end
Behaviors[MODE.CUSTOM] = function() end -- (Does nothing until SetCustomBehavior)
Behaviors[MODE.LIMBS] = LimbBehavior
Behaviors[MODE.MOVEMENT] = MoveBehavior
Behaviors[MODE.CORNERS] = CornerBehavior
Behaviors[MODE.CIRCLE1] = CircleBehavior
Behaviors[MODE.CIRCLE2] = CircleBehavior
Behaviors[MODE.LIMBMOVE] = LimbMoveBehavior
Behaviors[MODE.SMART_CIRCLE] = SmartCircleBehavior
Behaviors[MODE.CHAR_OUTLINE] = CharacterOutlineBehavior
Invisicam:SetMode(STARTING_MODE)
return Invisicam
|
-- Function to change walkspeed |
local function setWalkspeed(speed)
if character and character:IsA("Model") then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
humanoid.WalkSpeed = speed
end
end
end
|
--[[
--local scale = hit.Parent.Hair.Handle.Belly.Mesh.Scale.Vector3.x
IN.Belly.Mesh.Scale = Vector3.new(0,0,0)
IN.Belly2.Mesh.Scale = Vector3.new(0,0,0)
IN.Front1.Mesh.Scale = Vector3.new(0,0,0)
IN.Back1.Mesh.Scale = Vector3.new(0,0,0)
IN.Front2.Mesh.Scale = Vector3.new(0,0,0)
IN.Back2.Mesh.Scale = Vector3.new(0,0,0)
wait (1)
]] | --
local Inf = 0.9
for i = 1, (Inf*0.9) do
--From front: Vector3(+,-(Right,Left)(Up,Down)(Forward,Back))
--Belly rate
local bel = .1
IN.Belly.Mesh.Scale = IN.Belly.Mesh.Scale + Vector3.new(bel,bel,bel)
IN.Belly2.Mesh.Scale = IN.Belly2.Mesh.Scale + Vector3.new(bel,bel,bel)
IN.Belly.Mesh.Offset = IN.Belly.Mesh.Offset + Vector3.new(0, 0,bel/2)
IN.Belly2.Mesh.Offset = IN.Belly2.Mesh.Offset + Vector3.new(0, 0,bel/2)
--Front rate
local boo = .1
IN.Front1.Mesh.Scale = IN.Front1.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front11.Mesh.Scale = IN.Front11.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front2.Mesh.Scale = IN.Front2.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front21.Mesh.Scale = IN.Front21.Mesh.Scale + Vector3.new(boo, boo, boo)
IN.Front1.Mesh.Offset = IN.Front1.Mesh.Offset + Vector3.new(-boo/5, 0, boo/2.5)
IN.Front11.Mesh.Offset = IN.Front11.Mesh.Offset + Vector3.new(-boo/5, 0, boo/2.5)
IN.Front2.Mesh.Offset = IN.Front2.Mesh.Offset + Vector3.new(boo/5, 0, boo/2.5)
IN.Front21.Mesh.Offset = IN.Front21.Mesh.Offset + Vector3.new(boo/5, 0, boo/2.5)
--Back rate
local back = .1
IN.Back1.Mesh.Scale = IN.Back1.Mesh.Scale + Vector3.new(back, back, back)
IN.Back2.Mesh.Scale = IN.Back2.Mesh.Scale + Vector3.new(back, back, back)
IN.Back1.Mesh.Offset = IN.Back1.Mesh.Offset + Vector3.new(-back/5, 0, -back/4)
IN.Back2.Mesh.Offset = IN.Back2.Mesh.Offset + Vector3.new(back/5, 0, -back/4)
--Speed
local spe = .004
hit.Parent.Humanoid.WalkSpeed = (hit.Parent.Humanoid.WalkSpeed - spe)
end
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Sounds = {
CoilSound = Handle:WaitForChild("CoilSound"),
}
Gravity = 196.20
JumpHeightPercentage = 0.25
ToolEquipped = false
function GetAllConnectedParts(Object)
local Parts = {}
local function GetConnectedParts(Object)
for i, v in pairs(Object:GetConnectedParts()) do
local Ignore = false
for ii, vv in pairs(Parts) do
if v == vv then
Ignore = true
end
end
if not Ignore then
table.insert(Parts, v)
GetConnectedParts(v)
end
end
end
GetConnectedParts(Object)
return Parts
end
function SetGravityEffect()
if not GravityEffect or not GravityEffect.Parent then
GravityEffect = Instance.new("BodyForce")
GravityEffect.Name = "GravityCoilEffect"
GravityEffect.Parent = Torso
end
local TotalMass = 0
local ConnectedParts = GetAllConnectedParts(Torso)
for i, v in pairs(ConnectedParts) do
if v:IsA("BasePart") then
TotalMass = (TotalMass + v:GetMass())
end
end
local TotalMass = (TotalMass * 196.20 * (1 - JumpHeightPercentage))
GravityEffect.force = Vector3.new(0, TotalMass, 0)
end
function HandleGravityEffect(Enabled)
if not CheckIfAlive() then
return
end
for i, v in pairs(Torso:GetChildren()) do
if v:IsA("BodyForce") then
v:Destroy()
end
end
for i, v in pairs({ToolUnequipped, DescendantAdded, DescendantRemoving}) do
if v then
v:disconnect()
end
end
if Enabled then
CurrentlyEquipped = true
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
SetGravityEffect()
DescendantAdded = Character.DescendantAdded:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
DescendantRemoving = Character.DescendantRemoving:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
if HumanoidDied then
HumanoidDied:disconnect()
end
HumanoidDied = Humanoid.Died:connect(function()
if GravityEffect and GravityEffect.Parent then
GravityEffect:Destroy()
end
end)
Sounds.CoilSound:Play()
HandleGravityEffect(true)
ToolEquipped = true
end
function Unequipped()
if HumanoidDied then
HumanoidDied:disconnect()
end
HandleGravityEffect(false)
ToolEquipped = false
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[=[
Reimplementation of Player:GetUserThumbnailAsync but as a promise with
retry logic.
@class PlayerThumbnailUtils
]=] |
local require = require(script.Parent.loader).load(script)
local Players = game:GetService("Players")
local Promise = require("Promise")
local MAX_TRIES = 5
local PlayerThumbnailUtils = {}
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
function Reset()
down = {}
state = {}
end -- Reset()
function GetState()
-- Map KeyCodes to corresponding InputObjects on the gamepad:
local inputObjects = UserInputService:GetGamepadState(GAMEPAD1)
for _,inputObject in pairs(inputObjects) do
state[inputObject.KeyCode] = inputObject
end
end -- GetState()
function InputBegan(input, processed)
if input.UserInputType == GAMEPAD1 then
down[input.KeyCode] = true
buttonDown:Fire(input.KeyCode)
end
end -- InputBegan()
function InputEnded(input, processed)
if input.UserInputType == GAMEPAD1 then
down[input.KeyCode] = false
buttonUp:Fire(input.KeyCode)
end
end -- InputEnded()
function InputChanged(input, processed)
if input.UserInputType == GAMEPAD1 then
changed:Fire(input.KeyCode)
end
end -- InputChanged()
function GamepadConnected(gamepad)
if gamepad == GAMEPAD1 then
Gamepad.IsConnected = true
GetState()
connected:Fire()
end
end -- GamepadConnected
function GamepadDisconnected(gamepad)
if gamepad == GAMEPAD1 then
Gamepad.IsConnected = false
Reset()
disconnected:Fire()
end
end -- GamepadDisconnected |
----------------------This is just an example----------------------------- |
local ammo = script.Parent.Values.Ammo
local ammo2 = script.Parent.Values.Ammo2 |
-- Use Handle.AlignPosition to float behind, up, and to the side of the player, like a minion |
AlignPosition.Attachment0 = Attachment0
AlignPosition.Attachment1 = Attachment1
AlignOrientation.Attachment0 = Attachment0
AlignOrientation.Attachment1 = Attachment1
|
-- This makes the loading bar fill up. Don't touch anything here! |
local prog = 0
while wait() do
prog = prog + 0.5
script.Parent.Size = UDim2.new(prog/100, 0, 0.1, 0)
script.Parent.Parent.LoadingLabel.Text = ("Loading... " ..math.floor(prog*2).. "%")
if prog == 50 then
wait(1)
script.Parent.Parent.Parent:Destroy()
end
end
|
--//Main Function |
ProximityPrompt.Triggered:Connect(function(Player)
local Character = Player.Character
local Head = Character:WaitForChild("Head")
ProximityPrompt.ActionText = ""
if Character:FindFirstChild(script.Parent.Parent.Parent.Name) then
Character[script.Parent.Parent.Parent.Name]:Destroy()
else
local NewArmor = Armor:Clone()
NewArmor:SetPrimaryPartCFrame(Head.CFrame)
NewArmor.PrimaryPart:Destroy()
ProximityPrompt.ActionText = ""
for _, part in pairs (NewArmor:GetChildren()) do
if part:IsA("BasePart") then
WeldParts(Head, part)
part.CanCollide = false
part.Anchored = false
end
end
NewArmor.Parent = Character
end
end)
|
--// # key, ManOff |
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Stop()
veh.Lightbar.middle.Wail.Volume = 8
veh.Lightbar.middle.Yelp.Volume = 8
veh.Lightbar.middle.Priority.Volume = 8
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.MAN.Transparency = 1
end
end)
|
--[[
Novena Constraint Type: Motorcycle
The Bike Chassis
SecondLogic | Inspare (thanks!)
Avxnturador | Novena
--]] |
local autoscaling = true --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 230 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 400 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
--------------------------------------------------------------# |
function Tween(instance,tweeninformation,goals)
TweenService:Create(instance,tweeninformation,goals):Play()
end
LightGroup = script.Parent.Lights:GetChildren()
while true do
wait(0)
if script.Parent.on.Value then
for i = 1,#LightGroup do
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 0})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 2})
end
else
for i = 1,#LightGroup do
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 1})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 0})
end
end
end
|
-- new shat |
RightHip.MaxVelocity = 0.1
LeftHip.MaxVelocity = 0.1
|
--[[Weight and CG]] |
Tune.Weight = 1100 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly |
local luaPatternCharacters = "([" .. ("$%^()-[].?"):gsub("(.)", "%%%1") .. "])"
local function includes(str: string, substring: string, position: (string | number)?): boolean
local strLen, invalidBytePosition = utf8.len(str)
assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
if strLen == 0 then
return false
end
if #substring == 0 then
return true
end
local startIndex = 1
if position ~= nil then
startIndex = tonumber(position) or 1
if startIndex > strLen then
return false
end
end
if startIndex < 1 then
startIndex = 1
end
local init = utf8.offset(str, startIndex)
local value = substring:gsub(luaPatternCharacters, "%%%1")
local iStart, _ = string.find(str, value, init)
return iStart ~= nil
end
return includes
|
-- Manages the cleaning of events and other things.
-- Useful for encapsulating state and make deconstructors easy
-- @classmod Maid
-- @see Signal |
local Maid = {}
Maid.ClassName = "Maid"
|
--// Core |
return function()
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Deps = server.Deps
Logs:AddLog("Script", "Core Module Initialized")
end;
server.Core = {
Init = Init;
DataQueue = {};
DataCache = {};
ExecuteScripts = {};
LastDataSave = 0;
PanicMode = false;
ScriptCache = {};
Connections = {};
Variables = {
TimeBans = {};
};
Panic = function(reason)
local hint = Instance.new("Hint", service.Workspace)
hint.Text = "-= Adonis PanicMode Enabled: "..tostring(reason).." =~"
Core.PanicMode = true;
warn("SOMETHING SEVERE HAPPENED; ENABLING PANIC MODE; REASON BELOW;")
warn(tostring(reason))
warn("ENABLING CHAT MODE AND DISABLING CLIENT CHECKS;")
warn("MODS NOW HAVE ACCESS TO PANIC COMMANDS SUCH AS :SHUTDOWN")
--[[
for i,v in pairs(service.Players:GetPlayers()) do
cPcall(function()
v.Chatted:connect(function(msg)
Process.Chat(v,msg)
end)
end)
end
--]]
Logs.AddLog(Logs.Script,{
Text = "ENABLED PANIC MODE";
Desc = tostring(reason);
})
end;
MakeEvent = function()
local ran,error = pcall(function()
if Anti.RLocked(service.JointsService) then
Core.Panic("JointsService RobloxLocked")
elseif server.Running then
if Core.RemoteEvent then
Core.RemoteEvent.Security:Disconnect()
Core.RemoteEvent.Event:Disconnect()
Core.RemoteEvent.DecoySecurity1:Disconnect()
Core.RemoteEvent.DecoySecurity2:Disconnect()
pcall(function() service.Delete(Core.RemoteEvent.Object) end)
pcall(function() service.Delete(Core.RemoteEvent.Decoy1) end)
pcall(function() service.Delete(Core.RemoteEvent.Decoy2) end)
end
Core.RemoteEvent = {}
local event = service.New("RemoteEvent")
local decoy1 = event:Clone()
local decoy2 = event:Clone()
event.Name = Core.Name--..Functions.GetRandom() -- Core.Name
decoy1.Name = Core.Name..Functions.GetRandom()
decoy2.Name = Core.Name..Functions.GetRandom()
event.Archivable = false
decoy1.Archivable = false
decoy2.Archivable = false
Core.RemoteEvent.Object = event
Core.RemoteEvent.Decoy1 = decoy1
Core.RemoteEvent.Decoy2 = decoy2
event.Parent = service.JointsService
--decoy1.Parent = service.JointsService
--decoy2.Parent = service.JointsService
local function secure(ev)
return service.RbxEvent(ev.Changed, function(p)
if p=="Name" then
event.Name = Core.Name--..Functions.GetRandom()--Core.Name
else
Core.MakeEvent()
end
end)
end
Core.RemoteEvent.Event = service.RbxEvent(event.OnServerEvent, Process.Remote)
service.RbxEvent(decoy1.OnServerEvent, function(p,modu,com,sub)
local keys = Remote.Clients[tostring(p.userId)]
if keys and com == "TrustCheck" and modu == keys.Module then
decoy1:FireClient(p,"TrustCheck",keys.Decoy1)
end
end)
service.RbxEvent(decoy2.OnServerEvent, function(p,modu,com,sub)
local keys = Remote.Clients[tostring(p.userId)]
if keys and com == "TrustCheck" and modu == keys.Module then
decoy1:FireClient(p,"TrustCheck",keys.Decoy2)
end
end)
Core.RemoteEvent.Security = secure(event)
Core.RemoteEvent.DecoySecurity1 = secure(decoy1)
Core.RemoteEvent.DecoySecurity2 = secure(decoy2)
Logs.AddLog(Logs.Script,{
Text = "Created RemoteEvent";
Desc = "RemoteEvent was successfully created";
})
end
end)
if error then
warn(error)
Core.Panic("Error while making RemoteEvent")
end
end;
CheckAllClients = function()
if Settings.CheckClients and not Core.PanicMode and server.Running then
Logs.AddLog(Logs.Script,{
Text = "Checking Clients";
Desc = "Making sure all clients are active";
})
local parent = service.NetworkServer or service.Players
local net = service.NetworkServer or false
for ind,p in next,parent:GetChildren() do
if net then p = p:GetPlayer() end
if p then
if Anti.ObjRLocked(p) then
Anti.Detected(p, "kick", "RobloxLocked")
else
local client = Remote.Clients[tostring(p.userId)]
if client and client.LoadingStatus == "READY" then
local lastTime = client.LastUpdate
if lastTime and tick()-lastTime > 60*5 then
Anti.Detected(p, "kick","Client Not Responding [Client hasn't checked in >5 minutes]")
end
end
end
end
end
end
end;
UpdateConnections = function()
if service.NetworkServer then
for i,cli in next,service.NetworkServer:GetChildren() do
Core.Connections[cli] = cli:GetPlayer()
end
end
end;
UpdateConnection = function(p)
if service.NetworkServer then
for i,cli in next,service.NetworkServer:GetChildren() do
if cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end
end;
GetNetworkClient = function(p)
if service.NetworkServer then
for i,v in pairs(service.NetworkServer:GetChildren()) do
if v:GetPlayer() == p then
return v
end
end
end
end;
SetupEvent = function(p)
local key = tostring(p.userId)
local keys = Remote.Clients[key]
if keys and keys.EventName and p and not Anti.ObjRLocked(p) then
local event = Instance.new("RemoteEvent")
event.Name = keys.EventName
event.Changed:connect(function()
if Anti.RLocked(event) or not event or event.Parent ~= p then
service.Delete(event)
Core.SetupEvent(p)
end
end)
event.OnServerEvent:connect(function(np,...)
if np == p then
Process.Remote(np,...)
end
end)
event.Parent = p
else
p:Kick("Locked")
end
end;
PrepareClient = function()
if service.NetworkServer and server.Running then
local ran,err = pcall(function()
if Core.ClientLoader then
pcall(function() Core.ClientLoaderEvent:Disconnect() service.Delete(Core.ClientLoader) end)
end
local loader = Deps.ClientLoader:Clone()
loader.Archivable = false
loader.Name = "\0"
loader.Parent = service.ReplicatedFirst
loader.Disabled = false
Core.ClientLoader = loader
Core.ClientLoaderEvent = loader.Changed:connect(function()
Core.PrepareClient()
end)
end)
if err or not ran then
Core.Panic("Cannot load ClientLoader "..tostring(err))
end
end
end;
HookClient = function(p)
local key = tostring(p.userId)
local keys = Remote.Clients[key]
if keys then
local depsName = Functions:GetRandom()
local eventName = Functions:GetRandom()
local folder = server.Client:Clone()
local client = folder.Client
folder.Name = "Adonis_Client" --Core.Name.."\\"..depsName
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
keys.Loader = Core.ClientLoader
keys.Special = depsName
keys.EventName = eventName
keys.Module = client
service.Events[p.userId.."_CLIENTLOADER"]:connectOnce(function()
if folder.Parent == p then
folder:Destroy()
end
end)
local ok,err = pcall(function()
folder.Parent = p
end)
if not Core.PanicMode and not ok then
p:Kick("Loading Error [HookClient Error: "..tostring(err).."]")
return false
else
return true
end
else
if p then p:Kick("Loading Error [HookClient: Keys Missing]") end
end
end;
LoadClientLoader = function(p)
local loader = Deps.ClientLoader:Clone()
loader.Name = math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)..math.random(0,9)
loader.Parent = p:WaitForChild("Backpack")
loader.Disabled = false
end;
LoadExistingPlayer = function(p)
Core.LoadClientLoader(p)
Process.PlayerAdded(p)
end;
MakeClient = function()
local ran,error = pcall(function()
if Anti.RLocked(service.StarterPlayer) then
Core.Panic("StarterPlayer RobloxLocked")
else
local starterScripts = service.StarterPlayer:FindFirstChild(Core.Name)
if not starterScripts then
starterScripts = service.New("StarterPlayerScripts",service.StarterPlayer)
starterScripts.Name = Core.Name
starterScripts.Changed:connect(function(p)
if p=="Parent" then
Core.MakeClient()
elseif p=="Name" then
starterScripts.Name = Core.Name
elseif p=="RobloxLocked" and Anti.RLocked(starterScripts) then
Core.Panic("PlayerScripts RobloxLocked")
end
end)
starterScripts.ChildAdded:connect(function(c)
if c.Name~=Core.Name then
wait(0.5)
c:Destroy()
end
end)
end
starterScripts:ClearAllChildren()
if Anti.RLocked(starterScripts) then
Core.Panic("StarterPlayerScripts RobloxLocked")
else
if Core.Client then
local cli = Core.Client
if Anti.ObjRLocked(cli.Object) then
Core.Panic("Client RobloxLocked")
else
Core.Client.Security:disconnect()
pcall(function() Core.Client.Object:Destroy() end)
end
end
Core.Client = {}
local client = Deps.Client:clone()
client.Name = Core.Name
server.ClientDeps:Clone().Parent = client
client.Parent = starterScripts
client.Disabled = false
Core.Client.Object = client
Core.Client.Security = client.Changed:connect(function(p)
if p == "Parent" or p == "RobloxLocked" then
Core.MakeClient()
end
end)
end
end
end)
if error then
print(error)
Core.Panic("Error while making client")
end
end;
ExecutePermission = function(scr, code, isLocal)
for i,val in next,Core.ExecuteScripts do
if not isLocal or (isLocal and val.Type == "LocalScript") then
if (service.UnWrap(val.Script) == service.UnWrap(scr) or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
val.Executions = val.Executions+1
return {
Source = val.Source;
noCache = val.noCache;
runLimit = val.runLimit;
Executions = val.Executions;
}
end
end
end
end;
GetScript = function(scr,code)
for i,val in next,Core.ExecuteScripts do
if val.Script == scr or code == val.Code then
return val,i
end
end
end;
UnRegisterScript = function(scr)
for i,dat in next,Core.ExecuteScripts do
if dat.Script == scr or dat == scr then
table.remove(Core.ExecuteScripts, i)
return dat
end
end
end;
RegisterScript = function(data)
data.Executions = 0
data.Time = os.time()
data.Type = data.Script.ClassName
data.Wrapped = service.Wrap(data.Script)
data.Wrapped:SetSpecial("Clone",function()
return Core.RegisterScript {
Script = service.UnWrap(data.Script):Clone();
Code = data.Code;
Source = data.Source;
noCache = data.noCache;
runLimit = data.runLimit;
}
end)
for ind,scr in next,Core.ExecuteScripts do
if scr.Script == data.Script then
return scr.Wrapped or scr.Script
end
end
if not data.Code then
data.Code = Functions.GetRandom()
end
table.insert(Core.ExecuteScripts,data)
return data.Wrapped
end;
Loadstring = function(str, env)
return require(Deps.Loadstring:Clone())(str, env)
end;
Bytecode = function(str)
local f,buff = Core.Loadstring(str)
return buff
end;
NewScript = function(type,source,allowCodes,noCache,runLimit)
local ScriptType
local execCode = Functions.GetRandom()
if type == 'Script' then
ScriptType = Deps.ScriptBase:Clone()
elseif type == 'LocalScript' then
ScriptType = Deps.LocalScriptBase:Clone()
end
if ScriptType then
ScriptType.Name = type
if allowCodes then
local exec = Instance.new("StringValue",ScriptType)
exec.Name = "Execute"
exec.Value = execCode
end
local wrapped = Core.RegisterScript {
Script = ScriptType;
Code = execCode;
Source = Core.Bytecode(source);
noCache = noCache;
runLimit = runLimit;
}
return wrapped or ScriptType, ScriptType, execCode
end
end;
DoSave = function(data)
local type = data.Type
if type == "ClearSettings" then
Core.SetData("SavedSettings",{})
Core.SetData("SavedTables",{})
elseif type == "SetSetting" then
local setting = data.Setting
local value = data.Value
Core.UpdateData("SavedSettings", function(settings)
settings[setting] = value
return settings
end)
elseif type == "TableRemove" then
local tab = data.Table
local value = data.Value
data.Time = os.time()
Core.UpdateData("SavedTables", function(sets)
sets = sets or {}
for i,v in next,sets do
if tab == v.Table then
if Functions.CheckMatch(v.Value,value) then
table.remove(sets,i)
end
end
end
data.Action = "Remove"
table.insert(sets,data)
return sets
end)
elseif type == "TableAdd" then
local tab = data.Table
local value = data.Value
data.Time = os.time()
Core.UpdateData("SavedTables", function(sets)
sets = sets or {}
for i,v in next,sets do
if tab == v.Table then
if Functions.CheckMatch(v.Value,value) then
table.remove(sets,i)
end
end
end
data.Action = "Add"
table.insert(sets,data)
return sets
end)
end
Logs.AddLog(Logs.Script,{
Text = "Saved setting change to datastore";
Desc = "A setting change was issued and saved";
})
end;
SavePlayer = function(p,data)
local key = tostring(p.userId)
Remote.PlayerData[key] = data
end;
DefaultData = function(p)
return {
Donor = {
Cape = {
Image = '0';
Color = 'White';
Material = 'Neon';
};
Enabled = false;
};
Banned = false;
TimeBan = false;
AdminNotes = {};
Keybinds = {};
Client = {};
Warnings = {};
AdminPoints = 0;
};
end;
GetPlayer = function(p)
local key = tostring(p.userId)
local PlayerData = Core.DefaultData(p)
if not Remote.PlayerData[key] then
Remote.PlayerData[key] = PlayerData
if Core.DataStore then
local data = Core.GetData(key)
if data and type(data) == "table" then
for i,v in next,data do
PlayerData[i] = v
end
end
end
else
PlayerData = Remote.PlayerData[key]
end
return PlayerData
end;
ClearPlayer = function(p)
Remote.PlayerData[tostring(p.userId)] = Core.DefaultData(p);
end;
SavePlayerData = function(p)
local key = tostring(p.userId)
local data = Remote.PlayerData[key]
if data and Core.DataStore then
data.LastChat = nil
data.AdminLevel = nil
data.LastLevelUpdate = nil
Core.SetData(key, data)
Remote.PlayerData[key] = nil
Logs.AddLog(Logs.Script,{
Text = "Saved data for "..tostring(p);
Desc = "Player data was saved to the datastore";
})
end
end;
GetDataStore = function()
local lastUpdate = 0
local keyCache = {}
local saveCache = {}
local updateCache = {}
local ran,store = pcall(function() return service.DataStoreService:GetDataStore(Settings.DataStore:sub(1,50),"Adonis") end)
--[[
--// Todo:
--// Implement reru's idea
--// AutoAssign a server to handle datastore updates
--// Cache all datastore updates
--// Update everything using one UpdateAsync per server every 30-60 seconds
--// Have main server handle check for new data and update datastore keys accordingly
if ran and store then
local original = store:GetObject()
local prepareTable; prepareTable = function(tab)
if true then return tab end
if type(tab) == "table" then
local tabUpdates = {}
for i,v in next,tab do
tab[i] = prepareTable(v)
end
return setmetatable(tab,{
__newindex = function(old, ind, val)
table.insert(tabUpdates,{
})
end
}), tabUpdates
else
return tab
end
end
store:SetSpecial("SetAsync", function(wrapped, key, value)
table.insert(updateCache, {
Key = key;
Time = os.time;
Value = value;
})
keyCache[key] = value
end)
store:SetSpecial("UpdateAsync", function(wrapped, key, func)
original:UpdateAsync(key, function(data)
local metaTab,tabUpdates = prepareTable(data)
local returns = func(metaTab)
if type(data) == "table" and tabUpdates then
end
end)
end)
store:SetSpecial("GetAsync", function(wrapped, key)
if not keyCache[key] then
keyCache[key] = original:GetAsync(key)
end
return keyCache[key]
end)
store:SetSpecial("Update", function(wrapped)
lastUpdate = os.time()
keyCache = {}
end)
service.StartLoop("DataUpdate",30,store.Update,true)
end--]]
return ran and store
end;
DataStoreEncode = function(key)
return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
end;
SaveData = function(...)
return Core.SetData(...)
end;
SetData = function(key, value)
if Core.DataStore then
local ran, ret = pcall(Core.DataStore.SetAsync, Core.DataStore, Core.DataStoreEncode(key), value)
if ran then
Core.DataCache[key] = value
return ret
else
logError("DataStore SetAsync Failed: ".. tostring(ret))
end
end
end;
UpdateData = function(key, func)
if Core.DataStore then
local ran, ret = pcall(Core.DataStore.UpdateAsync, Core.DataStore, Core.DataStoreEncode(key), func)
if ran then
return ret
else
logError("DataStore UpdateAsync Failed: ".. tostring(ret))
end
end
end;
GetData = function(key)
if Core.DataStore then
local ran, ret = pcall(Core.DataStore.GetAsync, Core.DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = ret
return ret
else
logError("DataStore GetAsync Failed: ".. tostring(ret))
return Core.DataCache[key]
end
end
end;
LoadData = function(key, data)
local SavedSettings
local SavedTables
local Blacklist = {DataStoreKey = true;}
if Core.DataStore and Settings.DataStoreEnabled then
if not key then
SavedSettings = Core.GetData("SavedSettings")
SavedTables = Core.GetData("SavedTables")
elseif key and not data then
if key == "SavedSettings" then
SavedSettings = Core.GetData("SavedSettings")
elseif key == "SavedTables" then
SavedTables = Core.GetData("SavedTables")
end
elseif key and data then
if key == "SavedSettings" then
SavedSettings = data
elseif key == "SavedTables" then
SavedTables = data
end
end
if not key and not data then
if not SavedSettings then
SavedSettings = {}
Core.SaveData("SavedSettings",{})
end
if not SavedTables then
SavedTables = {}
Core.SaveData("SavedTables",{})
end
end
if SavedSettings then
for setting,value in next,SavedSettings do
if not Blacklist[setting] then
if setting == 'Prefix' or setting == 'AnyPrefix' or setting == 'SpecialPrefix' then
local orig = Settings[setting]
for i,v in pairs(server.Commands) do
if v.Prefix == orig then
v.Prefix = value
end
end
end
Settings[setting] = value
end
end
end
if SavedTables then
for ind,tab in next,SavedTables do
local parentTab = (tab.Parent == "Variables" and Core.Variables) or Settings
if (not Blacklist[tab.Table]) and parentTab[tab.Table] ~= nil then
if tab.Action == "Add" then
local tabl = parentTab[tab.Table]
if tabl then
for i,v in next,tabl do
if Functions.CheckMatch(v,tab.Value) then
table.remove(parentTab[tab.Table],i)
end
end
end
Logs.AddLog("Script",{
Text = "Added to "..tostring(tab.Table);
Desc = "Added "..tostring(tab.Value).." to "..tostring(tab.Table).." from datastore";
})
table.insert(parentTab[tab.Table],tab.Value)
elseif tab.Action == "Remove" then
local tabl = parentTab[tab.Table]
if tabl then
for i,v in next,tabl do
if Functions.CheckMatch(v,tab.Value) then
Logs.AddLog("Script",{
Text = "Removed from "..tostring(tab.Table);
Desc = "Removed "..tostring(tab.Value).." from "..tostring(tab.Table).." from datastore";
})
table.remove(parentTab[tab.Table],i)
end
end
end
end
end
end
if Core.Variables.TimeBans then
for i,v in next, Core.Variables.TimeBans do
if v.EndTime-os.time() <= 0 then
table.remove(Core.Variables.TimeBans, i)
Core.DoSave({
Type = "TableRemove";
Table = "TimeBans";
Parent = "Variables";
Value = v;
})
end
end
end
end
Logs.AddLog(Logs.Script,{
Text = "Loaded saved data";
Desc = "Data was retrieved from the datastore and loaded successfully";
})
end
end;
StartAPI = function()
local _G = _G
local setmetatable = setmetatable
local rawset = rawset
local rawget = rawget
local type = type
local error = error
local print = print
local warn = warn
local pairs = pairs
local next = next
local table = table
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local server = server
local service = service
local Routine = Routine
local cPcall = cPcall
local API_Special = {
AddAdmin = Settings.Allowed_API_Calls.DataStore;
RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
RunCommand = Settings.Allowed_API_Calls.Core;
SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SetSetting = Settings.Allowed_API_Calls.Settings;
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Settings = Settings;
Service = service;
}
local API = {
Access = service.MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
if API_Specific[ind] then
targ = API_Specific[ind]
elseif server[ind] and Settings.Allowed_API_Calls[ind] then
targ = server[ind]
end
if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
Logs.AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was granted";
Desc = "A server script was granted access to "..tostring(inde);
})
elseif API_Special[inde] == false then
Logs.AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was denied";
Desc = "A server script attempted to access "..tostring(inde).." via _G.Adonis.Access";
})
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl,inde,valu)
if Settings.G_Access_Perms == "Read" then
error("Read-only")
elseif Settings.G_Access_Perms == "Write" then
tabl[inde] = valu
end
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
Scripts = service.ReadOnly({
ExecutePermission = function(code)
local exists;
if not Settings.CodeExecution then
return nil
end
for i,v in pairs(Core.ScriptCache) do
if v.Script == getfenv(2).script then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions = exists.Executions+1
return exists.Source, exists.Loadstring
end
local data = Core.ExecutePermission(getfenv(2).script,code)
if data and data.Source then
local module;
if not exists then
module = require(Deps.Loadstring.Rerubi:Clone())
table.insert(Core.ScriptCache,{
Script = getfenv(2).script;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end;
ReportLBI = function(scr, origin)
if origin == "Server" then
return true
end
end;
}, nil, nil, true);
CheckAdmin = service.MetaFunc(Admin.CheckAdmin);
CheckDonor = service.MetaFunc(Admin.CheckDonor);
GetLevel = service.MetaFunc(Admin.GetLevel);
CheckAgent = service.MetaFunc(HTTP.Trello.CheckAgent);
SetLighting = service.MetaFunc(Functions.SetLighting);
SetPlayerLighting = service.MetaFunc(Remote.SetLighting);
NewParticle = service.MetaFunc(Functions.NewParticle);
RemoveParticle = service.MetaFunc(Functions.RemoveParticle);
NewLocal = service.MetaFunc(Remote.NewLocal);
MakeLocal = service.MetaFunc(Remote.MakeLocal);
MoveLocal = service.MetaFunc(Remote.MoveLocal);
RemoveLocal = service.MetaFunc(Remote.RemoveLocal);
Hint = service.MetaFunc(Functions.Hint);
Message = service.MetaFunc(Functions.Message);
}
local AdonisGTable = service.NewProxy({
__index = function(tab,ind)
if Settings.G_API then
return API[ind]
elseif ind == "Scripts" then
return API.Scripts
else
error("_G API is disabled")
end
end;
__newindex = function(tabl,ind,new)
error("Read-only")
end;
__metatable = true;
})
if not _G.Adonis then
rawset(_G,"Adonis",AdonisGTable)
Routine(service.StartLoop,"APICheck",1,function()
rawset(_G,"Adonis",AdonisGTable)
end)
end
Logs.AddLog(Logs.Script,{
Text = "Started _G API";
Desc = "_G API was initialized and is ready to use";
})
end;
};
end
|
--print("Front"..autoF-1)
--print("Back"..autoR) |
if autoF - 2 > autoR then
shf = false
else
if math.abs(orderch - 50) < speed then
shf = true
else
if carSeat.Storage.Mode.Value ~= "Snow" then
shf = false
end
end
end
if autoF - 1 > autoR and script.Parent.Storage.TransmissionType.Value == "HPattern" and currentgear.Value <= 3 then
if speed < 20 then
if clutch.Clutch.Value > 0.3 and clutch.Clutch.Value < 0.6 and script.Parent.Storage.Throttle.Throttle.Value > 0.2 then
script.Parent.Functions.Clutch.Value = 0.0001
script.Parent.Functions.Clutch.Override.Value = true script.Parent.Functions.Clutch.Freeze.Value = true
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end |
--local Equip = Humanoid:LoadAnimation(AnimationsFolder.equip)
--local Hold = Humanoid:LoadAnimation(AnimationsFolder.idle)
--local Unlock1 = Humanoid:LoadAnimation(AnimationsFolder.use)
--local Unlock2 = Humanoid:LoadAnimation(AnimationsFolder.usefinish) |
script.Parent.Equipped:Connect(function() |
-- Decompiled with the Synapse X Luau decompiler. |
if game:GetService("ReplicatedStorage"):WaitForChild("GameData"):WaitForChild("InGame").Value == true then
require(script:WaitForChild("Main_Game"));
return;
end;
require(script:WaitForChild("Main_Lobby"));
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function statusChanged()
local raceStatus = RaceManager:GetRaceStatus()
-- Hide GUI when round is in session and player is a speeder
if raceStatus == RaceManager.Status.RoundInProgress then
CheckpointFrame.Visible = true
else
CheckpointFrame.Visible = false
end
end -- statusChanged() |
-- RemoteEvent |
local Events = ReplicatedStorage:FindFirstChild("Events")
local AddActivePlayer = Events:FindFirstChild("AddActivePlayer")
local RemoveActivePlayer = Events:FindFirstChild("RemoveActivePlayer")
local DisplayRoundResult = Events:FindFirstChild("DisplayRoundResult")
local CheckpointEvent = Events:FindFirstChild("CheckpointEvent")
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player |
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Occupied.Value = true
script.Parent.Parent.Misc.FL.Mirror.SS.Motor.DesiredAngle = 0
script.Parent.Parent.Misc.FR.Mirror.SS.Motor.DesiredAngle = 0
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = true
script.Parent.Parent.Body.Dash.DashSc2.G.Enabled = true
if script.Parent.L.Value == true then
if player.Name == script.Parent.Parent.Owner.Value then
script.Parent.L.Value = false
else
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Occupied.Value = false
script.Parent.Parent.Body.Dash.Screen.G.Enabled = false
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = false
script.Parent.Parent.Body.Dash.DashSc2.G.Enabled = false
end
end
end
end)
|
--now, get to playing the music |
local FadeoutTime = settings.MusicFadeoutTime
function PlaySound(sounddata)
if sounddata == nil then return end
local sound = Instance.new("Sound")
sound.Looped = true
sound.SoundId = sounddata.SoundId
sound.Volume = musicon and sounddata.Volume or 0
local v = Instance.new("NumberValue",sound)
v.Name = "OriginalVolume"
v.Value = sounddata.Volume
sound.Pitch = sounddata.Pitch
sound.Name = "BGM"
sound.Parent = script
sound:Play()
end
function FadeOutSound(sound)
local basevol = sound.Volume
local count = math.ceil(30*FadeoutTime)
if count < 1 then
count = 1
end
for i=1,count do
if sound then
sound.Volume = sound.Volume - (basevol / count)
wait(1/30)
end
end
if sound then
sound:Stop()
sound:Destroy()
end
end
if settings.UseGlobalBackgroundMusic == true and settings.UseMusicZones == false then
if #music[globali] == 1 then --global BGM with just 1 song? ez pz
PlaySound(music[1][1])
return
elseif #music[globali] == 0 then --there's no music to play...?
return
end
end
local recentindices = {} --keeps track of recently selected indicies, so as not to play repeat music tracks
math.randomseed(tick())
local currentzone
local zoneplayingmusic
function CheckIfRecent(i)
for _,v in pairs(recentindices) do
if v == i then
return true
end
end
return false
end
function SelectRandomMusic(musiclist) --select a random number, excluding ones that were already used recently
if musiclist == nil or #musiclist == 0 then return end
local possiblenumbers = {}
local selectedindex
for i=1,#musiclist do
if not CheckIfRecent(i) then
table.insert(possiblenumbers,i)
end
end
local selectedindex = possiblenumbers[math.random(1,#possiblenumbers)]
table.insert(recentindices,selectedindex)
if #recentindices > math.ceil(#musiclist / 2) then
table.remove(recentindices,1)
end
return musiclist[selectedindex]
end
function IsInZone(zonedata)
if torso and torso.Parent ~= nil then
local p = torso.Position
for _,data in pairs(zonedata["Parts"]) do
if data["Coordinates"] then
local t = data["Coordinates"]
if (p.x > t.lx and p.x < t.mx and p.y > t.ly and p.y < t.my and p.z > t.lz and p.z < t.mz) then --is the character within all the coordinates of the zone?
return true
end
elseif data["Part"] then --complex part? create a clone of the part and check if it's touching the character's torso
local part = data["Part"]:clone()
part.Anchored = true
part.Parent = workspace.CurrentCamera or workspace
part.CanCollide = true
local touching = part:GetTouchingParts()
part:Destroy()
for _,v in pairs(touching) do
if v == torso then
return true
end
end
end
end
return false
end
end
function CalculateCurrentZone()
local priority = -math.huge
local oldzone = currentzone
local selectedzone
if currentzone then
if IsInZone(currentzone) then
selectedzone = currentzone
priority = currentzone["Priority"]
end
end
for _,zone in pairs(zones) do
if zone["Priority"] > priority and IsInZone(zone) then
priority = zone["Priority"]
selectedzone = zone
end
end
currentzone = selectedzone
if currentzone ~= oldzone and (currentzone ~= nil or settings.UseGlobalBackgroundMusic == true) then
recentindices = {}
end
return currentzone,oldzone
end
function RunCycle() --the main cycle which will continuously run, checking which zones (if any) the character is in and playing new music when necessary
local bgm = script:FindFirstChild("BGM")
if settings.UseMusicZones == true then
local zone,oldzone = CalculateCurrentZone()
if zone ~= oldzone and zone ~= zoneplayingmusic and bgm then
if (zone == nil and (settings.UseGlobalBackgroundMusic == true or settings.MusicOnlyPlaysWithinZones == true)) or zone ~= nil then
FadeOutSound(bgm)
return
end
elseif zone and bgm == nil then
PlaySound(SelectRandomMusic(zone["Music"]))
zoneplayingmusic = zone
return
elseif zone == nil and oldzone and settings.MusicOnlyPlaysWithinZones == false and settings.UseGlobalBackgroundMusic == false and bgm == nil then
PlaySound(SelectRandomMusic(oldzone["Music"]))
zoneplayingmusic = oldzone
return
elseif zoneplayingmusic and settings.MusicOnlyPlaysWithinZones == false and settings.UseGlobalBackgroundMusic == false and bgm == nil then
PlaySound(SelectRandomMusic(zoneplayingmusic["Music"]))
return
elseif settings.UseGlobalBackgroundMusic == true and bgm == nil then
PlaySound(SelectRandomMusic(music[globali]))
zoneplayingmusic = nil
return
end
elseif bgm == nil and settings.UseGlobalBackgroundMusic == true then
PlaySound(SelectRandomMusic(music[globali]))
return
end
if bgm and (settings.UseGlobalBackgroundMusic == true and zoneplayingmusic == nil and #music[globali] > 1) or (zoneplayingmusic and #zoneplayingmusic["Music"] > 1) then
local length = bgm.TimeLength
local pos = bgm.TimePosition
if length ~= 0 and length - pos < FadeoutTime + .5 then
FadeOutSound(bgm)
end
end
end
while wait(.5) do
RunCycle()
end
|
-- Preload animations |
function playAnimation(animName, transitionTime, humanoid)
if (animName ~= currentAnim) then
if (oldAnimTrack ~= nil) then
oldAnimTrack:Stop()
oldAnimTrack:Destroy()
end
currentAnimSpeed = 1.0
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while roll > animTable[animName][idx].weight do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end |
--Door Open and Close Sound |
Door.Changed:connect(function()
if Door.Value == "Opening" then
Car.Platform.DO:Play()
return end
if Door.Value == "Closing" then
Car.Platform.DC:Play()
return end
end)
|
--DEBUG
--local function UnderObject(pos, l)
-- l = l or 120
-- -- raycast
-- local hit, position = Workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, UpVec * l), ignoreList)
-- if hit then
-- return (hit.Transparency ~= 1 and not string.find(hit.Name, "Droplet") and not string.find(hit.Name, "Extrusion")) and true or UnderObject(position + UpVec, l - (pos - position).Magnitude)
-- else
-- return false
-- end
--end | |
-- Implements Javascript's `Array.prototype.every` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every |
return function<T, U>(t: Array<T>, callback: callbackFn<T> | callbackFnWithThisArg<T, U>, thisArg: U?): boolean
if typeof(t) ~= "table" then
error(string.format("Array.every called on %s", typeof(t)))
end
if typeof(callback) ~= "function" then
error("callback is not a function")
end
local len = #t
local k = 1
while k <= len do
local kValue = t[k]
local testResult
if kValue ~= nil then
if thisArg ~= nil then
testResult = (callback :: callbackFnWithThisArg<T, U>)(thisArg, kValue, k, t)
else
testResult = (callback :: callbackFn<T>)(kValue, k, t)
end
if not testResult then
return false
end
end
k += 1
end
return true
end
|
--[=[
@interface EnumItem
.Name string
.Value number
.EnumType EnumList
@within EnumList
]=] |
type EnumItem = {
Name: string,
Value: number,
EnumType: any,
}
local LIST_KEY = newproxy()
local NAME_KEY = newproxy()
local function CreateEnumItem(name: string, value: number, enum: any): EnumItem
local enumItem = {
Name = name,
Value = value,
EnumType = enum,
}
table.freeze(enumItem)
return enumItem
end
|
--[=[
@within TableUtil
@function Copy
@param tbl table -- Table to copy
@param deep boolean? -- Whether or not to perform a deep copy
@return table
Creates a copy of the given table. By default, a shallow copy is
performed. For deep copies, a second boolean argument must be
passed to the function.
:::caution No cyclical references
Deep copies are _not_ protected against cyclical references. Passing
a table with cyclical references _and_ the `deep` parameter set to
`true` will result in a stack-overflow.
]=] |
local function Copy<T>(t: T, deep: boolean?): T
if not deep then
return (table.clone(t :: any) :: any) :: T
end
local function DeepCopy(tbl: { any })
local tCopy = table.clone(tbl)
for k, v in tCopy do
if type(v) == "table" then
tCopy[k] = DeepCopy(v)
end
end
return tCopy
end
return DeepCopy(t :: any) :: T
end
|
--[[
Notice:
All themes MUST include a StringValue named "Base_Theme" that tells the script where to pull GUIs and Configs from
if they aren't found in the selected theme. Generally this should have it's value set to "Default" unless
the theme is derived from another existing theme (such as if you made a new theme using the "Hydris" theme,
the Base_Theme value would be set to "Hydris" so you don't need to copy all the code modules and all that)
Alternatively, each individual GUI can include a StringValue in their Config folder named "BaseTheme" which
acts identical to Base_Theme, however is instead on a per-GUI basis instead of theme-wide. This allows you
to mix GUIs based on GUIs in different themes together into one theme.
It should be noted that this functionality has a capped depth of 10 themes deep.
Here's somewhat of a visual to help you better understand what I mean by depth:
ThemeToFind <- First GUI/Theme Checked (the one selected)
> BaseTheme1 <- Next theme checked (first theme's Base_Theme)
>> BaseTheme2 <- BaseTheme1's Base_Theme
>>> BaseTheme3 <- BaseTheme2's Base_Theme
>>>> BaseTheme4 <- BaseTheme3's Base_Theme
The above will go on until it either reaches a depth of 10 (BaseTheme10) or reaches
a theme with no Base_Theme set. Usually the last theme in the sequence will be
the "Default" theme as it's Base_Theme is empty because it should never need to pull
from any other themes.
Basic theming related information;
All Adonis GUIs have a code module that makes them run. If you are only changing minor things on an
existing GUI (such as colors) then you do not need to include a code module, instead it will use the
default's. If you need to change the code for the GUI then you MUST include a code module inside a Config
folder.
GUIs can avoid clearing the chat every time they appear by using client.UI.Prepare(gui)
To see an example of this refer to the Message GUI; In it the only line that needed to be
changed was local gui = script.Parent.Parent to local gui = client.UI.Prepare(script.Parent.Parent)
When PrepareGui is called on an already registered GUI the script will handle updating everything
accordingly.
The function for every GUI has a global named gTable. gTable contains all GUI related functions and information
used by the script. When a GUI is ready to appear use gTable:Ready() instead of gui.Parent = playergui.
For removing the GUI it is prefered that you use gTable:Destroy() as it will unregister the GUI when it
destroys it. It is not required and just ensures that the GUI is properly cleaned up, however it should
also clean itself up when it's destroyed normally.
GUI themes do NOT need to be folders containing GUIs! You can made a new module that alters or creates
GUIs (refer to Colorize theme.) These modules can also contain GUIs like a normal theme folder aswell.
If the theme module creates its own GUI on the fly, it must return something when it's done and handle all
of the GUI related code itself. Including registering the new GUi it created via
local gTable,gIndex = client.UI.Register(GUIObjectHere). The module must handle every aspect of the GUI's
creation process that normally client.UI.Make would. If it returns a ScreenGui, the default code for the
GUI will be used from the Hybrid theme, and it will be registered by the script like normal. If something
other than nil that isn't a ScreenGui is returned, the script will ignore the rest of the normal loading
process and return whatever the module returned.
Refer to the code and GUIs in the hybrid theme folder for examples.
NOTE:
The config folder will be parented to nil once gTable:Ready() is called, before the GUI is parented.
You should preference all GUI elements instead of using script.Parent.X, as otherwise there will be
an error about indexing a nil value (the parent). It will only become nil AFTER gTable:Ready() is called
so anything after the call cannot reference script.Parent directly. You must use gTable:Ready() when the
GUI is ready to be displayed, otherwise unintended behaviour may occur.
Client UI Functions;
client.UI.GetHolder()
- This will return the primary ScreenGui object that all GUIs will go into after becoming a TextLabel (not currently used)
client.UI.Prepare(gui)
- If gui is a ScreenGui; Transfers content to a new TextLabel and returns the new TextLabel; Else returns gui
client.UI.Make(guiName,guiData,themeData)
- Responsible for handling the creation and registering of new UI elements
- guiName is the name of the GUI to find/create
- guiData is the data table passed to the GUI's code module function
- themeData is a table containing information about what theme to use
- Returns whatever GUI's code module returns
client.UI.Get(Name,Ignore,returnOne)
- Finds and returns registered GUI gTables matching name
- Name is the name of the GUI to find
- Ignore is a GUI to ignore when trying to find the target
- if returnOne is true, return a single found gTable instead of a table containing all found ones
client.UI.Remove(Name,Ignore)
- Finds registered GUIs matching Name and removes them
- If Ignore is set to a GUI; don't remove it when/if found
client.UI.Register(gui)
- Handles the registration of new GUIs
- Returns gTable,gIndex
--]] |
return function() end
|
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{55,51,50,47,48,49},t},
[16]={n,f},
[19]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{55,51,50,47,48,49,45,44,28,29,31,32,34},t},
[21]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{55,51,50,47,48},t},
[27]={{55,51,50,47,48,49,45,44,28,27},t},
[14]={n,f},
[31]={{55,51,50,47,48,49,45,44,28,29,31},t},
[56]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{55,51,50,47,48,49,45,44,28,29},t},
[13]={n,f},
[47]={{55,51,50,47},t},
[12]={n,f},
[45]={{55,51,50,47,48,49,45},t},
[57]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{55,51,50,47,48,49,45,44,28,29,31,32,33,36},t},
[25]={{55,51,50,47,48,49,45,44,28,27,26,25},t},
[71]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{55,51,50,47,48,49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35},t},
[53]={{55,54,53},t},
[73]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{55,51,50,47,48,49,45,44,28,29,31,32,33},t},
[69]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{55,51,50,47,48,49,45,44,28,27,26},t},
[68]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{55,51,50},t},
[66]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{55,51,50,47,48,49,45,44,28,27,26,25,24},t},
[23]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{55,51,50,47,48,49,45,44},t},
[39]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39},t},
[32]={{55,51,50,47,48,49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{55,51},t},
[18]={n,f},
[67]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{55},t},
[46]={{55,51,50,47,46},t},
[42]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,40},t},
[52]={{55,54,53,52},t},
[54]={{55,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,38},t},
[28]={{55,51,50,47,48,49,45,44,28},t},
[5]={n,f},
[64]={{55,51,50,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
-- создаётся инструмент по перекрашиванию объектов |
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local backpack = localPlayer:WaitForChild("Backpack")
local tool = Instance.new("Tool")
tool.RequiresHandle = false
tool.CanBeDropped = false
tool.Parent = backpack
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if mouse.Target and mouse.Target.Parent then
mouse.Target.BrickColor = BrickColor.Random()
end
end)
end)
|
--// Declarables |
local L_15_ = false
local L_16_ = false
local L_17_ = L_1_:WaitForChild('Resource')
local L_18_ = L_17_:WaitForChild('FX')
local L_19_ = L_17_:WaitForChild('Events')
local L_20_ = L_17_:WaitForChild('HUD')
local L_21_ = L_17_:WaitForChild('Modules')
local L_22_ = L_17_:WaitForChild('SettingsModule')
local L_23_ = require(L_22_:WaitForChild("ClientConfig"))
local L_24_ = L_17_:WaitForChild('Vars')
local L_25_
local L_26_
local L_27_
local L_28_
local L_29_
local L_30_
local L_31_
local L_32_
local L_33_
local L_34_
local L_35_ = L_23_.AimZoom
local L_36_ = L_23_.MouseSensitivity
local L_37_ = L_12_.MouseDeltaSensitivity
|
--[=[
@within TableUtil
@function Reconcile
@param source table
@param template table
@return table
Performs a one-way sync on the `source` table against the
`template` table. Any keys found in `template` that are
not found in `source` will be added to `source`. This is
useful for syncing player data against data template tables
to ensure players have all the necessary keys, while
maintaining existing keys that may no longer be in the
template.
This is a deep operation, so nested tables will also be
properly reconciled.
```lua
local template = {kills = 0, deaths = 0, xp = 0}
local data = {kills = 10, abc = 20}
local correctedData = TableUtil.Reconcile(data, template)
print(correctedData) --> {kills = 10, deaths = 0, xp = 0, abc = 30}
```
]=] |
local function Reconcile(src: Table, template: Table): Table
assert(type(src) == "table", "First argument must be a table")
assert(type(template) == "table", "Second argument must be a table")
local tbl = table.clone(src)
for k,v in pairs(template) do
local sv = src[k]
if sv == nil then
if type(v) == "table" then
tbl[k] = Copy(v, true)
else
tbl[k] = v
end
elseif type(sv) == "table" then
if type(v) == "table" then
tbl[k] = Reconcile(sv, v)
else
tbl[k] = Copy(sv, true)
end
end
end
return tbl
end
|
--[[
@class Blend.story
]] |
local require = require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).load(script)
local RunService = game:GetService("RunService")
local Blend = require("Blend")
local Maid = require("Maid")
local ValueObject = require("ValueObject")
local Rx = require("Rx")
return function(target)
local maid = Maid.new()
local percentVisible = Blend.State(0)
local state = Blend.State("a")
maid:GiveTask(state)
local uiCornerValueObject = ValueObject.new()
uiCornerValueObject.Value = Blend.New "UICorner" {
CornerRadius = UDim.new(0, 5);
};
maid:GiveTask(uiCornerValueObject)
-- Reassign to a new value
task.delay(1, function()
if uiCornerValueObject.Destroy then
uiCornerValueObject.Value = Blend.New "UICorner" {
CornerRadius = UDim.new(0, 25);
};
end
end)
maid:GiveTask((Blend.New "TextLabel" {
Parent = target;
Size = Blend.Computed(percentVisible, function(visible)
return UDim2.new(0, visible*100, 0, 50);
end);
BackgroundTransparency = Blend.Computed(percentVisible, function(visible)
return 1 - visible
end);
Position = UDim2.new(0.5, 0, 0.5, 0);
AnchorPoint = Vector2.new(0.5, 0.5);
Text = state;
TextScaled = true;
[Blend.Children] = {
uiCornerValueObject;
Rx.NEVER;
Rx.EMPTY;
{
Blend.Single(Blend.Computed(percentVisible, function(visible)
if visible <= 0.5 then
return nil
else
return Blend.New "Frame" {
Size = UDim2.new(0, 100, 0, 100);
BackgroundTransparency = 0.5;
}
end
end));
};
{
Blend.Single(Blend.Computed(percentVisible, function(visible)
local results = {}
-- constructs a ton of children everytime this changes
for x=0, visible*100, 10 do
table.insert(results, Blend.New "Frame" {
Size = UDim2.new(0, 8, 0, 8);
Position = UDim2.new(0, x, 0.9, 0);
AnchorPoint = Vector2.new(0.5, 0.5);
BorderSizePixel = 0;
BackgroundColor3 = Color3.new(x/100, 0.5, 0.5);
[Blend.Children] = {
Blend.New "UICorner" {
CornerRadius = UDim.new(0.5, 5);
};
};
})
end
return results
end));
};
};
}):Subscribe())
local PERIOD = 5
maid:GiveTask(RunService.RenderStepped:Connect(function()
state.Value = tostring(os.clock())
percentVisible.Value = (math.sin(os.clock()*math.pi*2/PERIOD) + 1)/2
end))
return function()
maid:DoCleaning()
end
end
|
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{74,73,76,72,71,61,59,41,30,56,58},t},
[49]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{74,73,76,72,71,61,59,41,30,56,58,20,19},t},
[59]={{74,73,76,72,71,61,59},t},
[63]={{74,73,76,72,71,61,59,41,30,56,58,23,62,63},t},
[34]={{74,73,76,72,71,61,59,41,39,35,34},t},
[21]={{74,73,76,72,71,61,59,41,30,56,58,20,21},t},
[48]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{74,73,76,72,71,61,59,41,39,35,34,32,31},t},
[56]={{74,73,76,72,71,61,59,41,30,56},t},
[29]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45},t},
[57]={{74,73,76,72,71,61,59,41,30,56,57},t},
[36]={{74,73,76,72,71,61,59,41,39,35,37,36},t},
[25]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{74,73,76,72,71},t},
[20]={{74,73,76,72,71,61,59,41,30,56,58,20},t},
[60]={{74,73,76,72,71,61,60},t},
[8]={n,f},
[4]={n,f},
[75]={{74,73,75},t},
[22]={{74,73,76,72,71,61,59,41,30,56,58,20,21,22},t},
[74]={{74},t},
[62]={{74,73,76,72,71,61,59,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{74,73,76,72,71,61,59,41,39,35,37},t},
[2]={n,f},
[35]={{74,73,76,72,71,61,59,41,39,35},t},
[53]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{74,73},t},
[72]={{74,73,76,72},t},
[33]={{74,73,76,72,71,61,59,41,39,35,37,36,33},t},
[69]={{74,73,76,72,71,61,69},t},
[65]={{74,73,76,72,71,61,59,41,30,56,58,20,19,66,64,65},t},
[26]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26},t},
[68]={{74,73,76,72,71,61,59,41,30,56,58,20,19,66,64,67,68},t},
[76]={{74,73,76},t},
[50]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{74,73,76,72,71,61,59,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{74,73,76,72,71,61,59,41,30,56,58,23},t},
[44]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44},t},
[39]={{74,73,76,72,71,61,59,41,39},t},
[32]={{74,73,76,72,71,61,59,41,39,35,34,32},t},
[3]={n,f},
[30]={{74,73,76,72,71,61,59,41,30},t},
[51]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{74,73,76,72,71,61,59,41,30,56,58,20,19,66,64,67},t},
[61]={{74,73,76,72,71,61},t},
[55]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{74,73,76,72,71,61,59,41,39,40,38,42},t},
[40]={{74,73,76,72,71,61,59,41,39,40},t},
[52]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{74,73,76,72,71,61,59,41},t},
[17]={n,f},
[38]={{74,73,76,72,71,61,59,41,39,40,38},t},
[28]={{74,73,76,72,71,61,59,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{74,73,76,72,71,61,59,41,30,56,58,20,19,66,64},t},
}
return r
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 800 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Uber l33t maths to calcluate the angle needed to throw a projectile a distance, given the altitude of the end point and the projectile's velocity |
function AngleOfReach(distance, altitude, velocity)
local theta = math.atan((velocity^2 + math.sqrt(velocity^4 -196.2*(196.2*distance^2 + 2*altitude*velocity^2)))/(196.2*distance))
if theta ~= theta then
theta = math.pi/4
end
return(theta)
end
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 400 -- Spring Dampening
Tune.FSusStiffness = 17000 -- Spring Force
Tune.FSusLength = .8 -- Resting Suspension length (in studs)
Tune.FSusMaxExt = .15 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .05 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 6 -- Wishbone Length
Tune.FWsBoneAngle = 3 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 400 -- Spring Dampening
Tune.RSusStiffness = 17000 -- Spring Force
Tune.RSusLength = .8 -- Resting Suspension length (in studs)
Tune.RSusMaxExt = .15 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .05 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = l__ReplicatedStorage__1.KillFX[p1].Stomp:Clone();
v7.Parent = p2.Parent.UpperTorso and p2;
v7:Play();
game.Debris:AddItem(v7, 2);
local v8 = l__ReplicatedStorage__1.KillFX[p1].Effect:Clone();
v8.Parent = workspace.Ignored.Animations;
v8.Main.Effect:Play();
v8.Main.CFrame = CFrame.new(p2.Position.X, p2.Position.Y - 1, p2.Position.Z);
game.Debris:AddItem(v8, 4);
game:GetService("TweenService"):Create(v8.Main, TweenInfo.new(4), {
CFrame = CFrame.new(p2.Position.X, p2.Position.Y - 1, p2.Position.Z) * CFrame.fromEulerAnglesXYZ(0, 1800, 0)
}):Play();
return nil;
end;
return v1;
|
-- |
end
else
print("sh")
end
else
print("arms")
end
end
function Key(key)
if key then
key = string.lower(key)
if (key=="x") then
if on == 1 then
on = 0
elseif on == 0 then
on = 1
end
Crouch(on)
end
end
end
function Equip(mouse)
mouse.KeyDown:connect(Key)
end
script.Parent.Equipped:connect(Equip)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Rev")
script:WaitForChild("Supercharger")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
car.DriveSeat.Rev:Play()
car.DriveSeat.Supercharger:Play()
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
car.DriveSeat.Supercharger.Pitch = (car.DriveSeat.Supercharger.SetPitch.Value + car.DriveSeat.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
end
else
local handler = car.AC6_FE_Sounds
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Supercharger.SetPitch.Value + script.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
pitch = (script.Supercharger.SetPitch.Value + script.Supercharger.SetRev.Value*_RPM/_Tune.Redline)*on^2
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume)
end
end
|
-- the isOpen value is used to tell if the shop is open or not. |
local isOpen = shopBtn.isOpen
|
--s.Pitch = 0.7 |
while s.Pitch<1 do
s.Pitch=s.Pitch+0.01315
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.001)
end
|
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:StopSustained([fadeOutTime])
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
-- Sustained shake:
camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
-- Stop all sustained shakes:
camShake:StopSustained(1) -- Argument is the fadeout time (defaults to the same as fadein time if not supplied)
-- Stop only one sustained shake:
shakeInstance = camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
wait(2)
shakeInstance:StartFadeOut(1) -- Argument is the fadeout time
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
GitHub repository: https://github.com/Sleitnick/RbxCameraShaker
--]] |
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance |
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]] | --
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
local function u2(p1, p2)
p2 = p2 or {};
if type(p1) ~= "table" then
return p1;
end;
if p2[p1] then
return p2[p1];
end;
local v1 = {};
p2[p1] = v1;
for v2, v3 in next, p1 do
v1[u2(v2, p2)] = u2(v3, p2);
end;
setmetatable(v1, u2(getmetatable(p1), p2));
return v1;
end;
return function(p3, p4)
if p4 then
return u2(p3);
end;
return u1.HttpService:JSONDecode(u1.HttpService:JSONEncode(p3));
end;
|
---Camera |
game:GetService("RunService").RenderStepped:connect(function()
if _MSteer then
cam.CameraType = "Follow"
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-(car.DriveSeat.CFrame.lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
elseif cam.CameraType ~= "Follow" then
cam.CameraType = "Follow"
end
end)
|
-- Helper function to lazily instantiate a controller if it does not yet exist,
-- disable the active controller if it is different from the on being switched to,
-- and then enable the requested controller. The argument to this function must be
-- a reference to one of the control modules, i.e. Keyboard, Gamepad, etc. |
function ControlModule:SwitchToController(controlModule)
if not controlModule then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = nil
self.activeControlModule = nil
else
if not self.controllers[controlModule] then
self.controllers[controlModule] = controlModule.new(CONTROL_ACTION_PRIORITY)
end
if self.activeController ~= self.controllers[controlModule] then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = self.controllers[controlModule]
self.activeControlModule = controlModule -- Only used to check if controller switch is necessary
if self.touchControlFrame and (self.activeControlModule == ClickToMove
or self.activeControlModule == TouchThumbstick
or self.activeControlModule == DynamicThumbstick) then
if not self.controllers[TouchJump] then
self.controllers[TouchJump] = TouchJump.new()
end
self.touchJumpController = self.controllers[TouchJump]
self.touchJumpController:Enable(true, self.touchControlFrame)
else
if self.touchJumpController then
self.touchJumpController:Enable(false)
end
end
self:EnableActiveControlModule()
end
end
end
function ControlModule:OnLastInputTypeChanged(newLastInputType)
if lastInputType == newLastInputType then
warn("LastInputType Change listener called with current type.")
end
lastInputType = newLastInputType
if lastInputType == Enum.UserInputType.Touch then
-- TODO: Check if touch module already active
local touchModule, success = self:SelectTouchModule()
if success then
while not self.touchControlFrame do
wait()
end
self:SwitchToController(touchModule)
end
elseif computerInputTypeToModuleMap[lastInputType] ~= nil then
local computerModule = self:SelectComputerMovementModule()
if computerModule then
self:SwitchToController(computerModule)
end
end
end
|
-- Initial settings for ScreenshotHud |
if ScreenshotHud then
ScreenshotHud.OverlayFont = Enum.Font.GothamMedium
ScreenshotHud.ExperienceNameOverlayEnabled = true
ScreenshotHud.UsernameOverlayEnabled = false
ScreenshotHud.CloseWhenScreenshotTaken = false
-- Placing the close button off-screen since we don't use it
ScreenshotHud.CloseButtonPosition = UDim2.fromScale(-1, -1)
end
local initialSpawn = true
local mountedTree
local connections = {}
local disconnectActions: (() -> ())?
local function handleActionActivation()
local cleanupMap: { [any]: () -> () } = {}
local conns: { [string]: RBXScriptConnection } = {}
local function cleanupAction(action: UserActions.Action)
local cleanup = cleanupMap[action]
if cleanup then
cleanup()
cleanupMap[action] = nil
end
end
conns.activated = events.actionActivated:Connect(function(action: UserActions.Action)
if action.parent then
local state: store.State = store:getState()
-- Each parent action can only have one sub-action active at a time, so
-- this will deactivate any other active sub-actions for the current
-- parent
local subAction = UserActions.getActiveSubAction(state.actions, action.parent)
if subAction then
cleanupAction(subAction)
end
end
if action.onActivated then
local cleanup = action.onActivated(action, store)
if cleanup then
cleanupMap[action] = cleanup
end
end
end)
conns.deactivated = events.actionDeactivated:Connect(function(action: UserActions.Action)
cleanupAction(action)
end)
conns.closed = events.selfieModeClosed:Connect(function()
for _, cleanup in pairs(cleanupMap) do
cleanup()
end
cleanupMap = {}
end)
local function disconnect()
for _, conn in pairs(conns) do
conn:Disconnect()
end
end
return disconnect
end
local function mount(playerGui: BasePlayerGui)
local ref = Roact.createRef()
local guiController = ExperienceComponents.GuiController.new({ ref })
local function onSelfieModeToggled(inSelfieMode: boolean)
if inSelfieMode then
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
if player and camera then
focusCharacter(player, camera)
end
guiController:disable()
guiController:setMobileTouchGuiEnabled(true)
else
guiController:enable()
end
if ScreenshotHud then
ScreenshotHud.Visible = inSelfieMode
end
end
local root = Roact.createElement("ScreenGui", {
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
ResetOnSpawn = false,
[Roact.Ref] = ref,
}, {
App = Roact.createElement(RoactRodux.StoreProvider, {
store = store,
}, {
Roact.createElement(App, {
onSelfieModeToggled = onSelfieModeToggled,
screenshotHud = ScreenshotHud,
}),
}),
})
local element = Roact.mount(root, playerGui, "SelfieMode")
return element
end
return function(playerGui: BasePlayerGui)
playerGui = if playerGui then playerGui else Players.LocalPlayer:WaitForChild("PlayerGui")
local function setEnabled(isEnabled: boolean)
assert(RunService:IsClient(), "SelfieMode.setEnabled must be called on the client")
assert(t.boolean(isEnabled), "Bad argument #1 to SelfieMode.setEnabled: expected a boolean")
if isEnabled then
-- Mount SelfieModeUI to PlayerGui
mountedTree = mount(playerGui)
disconnectActions = handleActionActivation()
-- Setting up connections
connections.characterAddedConnection = Players.LocalPlayer.CharacterAdded:Connect(function()
if not initialSpawn then
store:dispatch(selfieModeClosed())
setEnabled(false)
task.wait()
setEnabled(true)
end
initialSpawn = false
end)
else
-- Unmount SelfieModeUI from PlayerGui
if mountedTree then
Roact.unmount(mountedTree)
mountedTree = nil
end
-- Disconnecting connections
for _, connection in pairs(connections) do
connection:Disconnect()
end
if disconnectActions then
disconnectActions()
end
end
end
return setEnabled
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
script.Parent:WaitForChild("RPM")
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
script.Parent.Parent.Adornee=car.Body.DGauges.RPM
script.Parent.Parent.CanvasSize=Vector2.new(660,330)
local _Tune = require(car["A-Chassis Tune"])
local Values = script.Parent.Parent.Parent.Values
local IsOn = script.Parent.Parent.Parent.IsOn
local _lRPM = _Tune.Redline
local revEnd = math.ceil(_lRPM/1000)
Values.RPM.Changed:connect(function()
local r = math.min(1,Values.RPM.Value / (revEnd*1000))
local rev = -3+(r*4)
script.Parent.RPM.BackgroundColor3 = Color3.fromRGB(255*rev,0,0)
end)
|
-- Fator de torque aplicado para mudar a direção da roda
-- Número maior geralmente significa frenagem mais rápida |
local BRAKING_TORQUE = 1000
|
-- |
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
local Drive=car.Wheels:GetChildren()
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
for _,v in pairs(Drive) do
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.FToe))
end
elseif v.Name=="RL" or v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.RToe))
end
end
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.FCaster),0)
elseif v.Name=="FR" or v.Name=="F" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.FCaster),0)
elseif v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.RCaster),0)
elseif v.Name=="RR" or v.Name=="R" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.RCaster),0)
end
local arm=Instance.new("Part",v)
arm.Name="Arm"
arm.Anchored=true
arm.CanCollide=false
arm.FormFactor=Enum.FormFactor.Custom
arm.Size=Vector3.new(1,1,1)
arm.CFrame=(v.CFrame*CFrame.new(0,_Tune.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
local base=arm:Clone()
base.Parent=v
base.Name="Base"
base.CFrame=base.CFrame*CFrame.new(0,1,0)
base.BottomSurface=Enum.SurfaceType.Hinge
local axle=arm:Clone()
axle.Parent=v
axle.Name="Axle"
axle.CFrame=CFrame.new(v.Position-((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle.BackSurface=Enum.SurfaceType.Hinge
if v.Name=="F" or v.Name=="R" then
local axle2=arm:Clone()
axle2.Parent=v
axle2.Name="Axle"
axle2.CFrame=CFrame.new(v.Position+((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle2.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle2.BackSurface=Enum.SurfaceType.Hinge
MakeWeld(arm,axle2)
end
MakeWeld(car.DriveSeat,base)
if v.Parent.Name == "RL" or v.Parent.Name == "RR" or v.Name=="R" then
MakeWeld(car.DriveSeat,arm)
end
MakeWeld(arm,axle)
arm:MakeJoints()
axle:MakeJoints()
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,axle)
end
if v:FindFirstChild("Parts")~=nil then
ModelWeld(v.Parts,v)
end
if v:FindFirstChild("Steer") then
v:FindFirstChild("Steer"):Destroy()
end
local gyro=Instance.new("BodyGyro",v)
gyro.Name="Stabilizer"
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
gyro.D=_Tune.FGyroD
gyro.MaxTorque=_Tune.FGyroMaxTorque
gyro.P=_Tune.FGyroP
else
gyro.D=_Tune.RGyroD
gyro.MaxTorque=_Tune.RGyroMaxTorque
gyro.P=_Tune.RGyroP
end
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
steer.cframe=base.CFrame
else
MakeWeld(base,axle,"Weld")
end
local AV=Instance.new("BodyAngularVelocity",v)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(_Tune.PBrakeForce,0,_Tune.PBrakeForce)
AV.P=1e9
end
for i,v in pairs(script:GetChildren()) do
if v:IsA("ModuleScript") then
require(v)
end
end
wait()
ModelWeld(car.Body,car.AirSetup)
local flipG = Instance.new("BodyGyro",car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
wait()
UnAnchor(car)
script.Parent["A-Chassis Interface"].Car.Value=car
for i,v in pairs(script.Parent.Plugins:GetChildren()) do
for _,a in pairs(v:GetChildren()) do
if a:IsA("RemoteEvent") or a:IsA("RemoteFunction") then
a.Parent=car
for _,b in pairs(a:GetChildren()) do
if b:IsA("Script") then b.Disabled=false end
end
end
end
v.Parent = script.Parent["A-Chassis Interface"]
end
script.Parent.Plugins:Destroy()
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(car.DriveSeat:GetChildren()) do
if v:IsA("Sound") then v:Stop() end
end
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
end
end
end
end)
ver = require(script.Parent.README)
|
--[Constants]: |
local Cam = game.Workspace.CurrentCamera
local Plr = game.Players.LocalPlayer
local Mouse = Plr:GetMouse()
local Body
local Head
local Hum
local Core
local IsR6
local Trso
local Neck
local Waist
|
--[=[
@return any
Gets the value of the property object.
:::caution
This value might not be ready right away. Use `OnReady()` or `IsReady()`
before calling `Get()`.
:::
]=] |
function ClientRemoteProperty:Get()
return self._value
end
|
-- weaponTemplate : inherits weaponBase
-- Description : This template is used to easily create new weapons. |
setmetatable(weaponTemplate, weaponBase)
function weaponTemplate.new(weaponModel, projectileModel, isAutomatic, fireRate)
local newWeapon = weaponBase.new(weaponModel, projectileModel, isAutomatic, fireRate)
setmetatable(newWeapon, weaponTemplate)
--spawn(function() newZone:_CaptureRuntime() end)
return newWeapon
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 700 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 100 -- Spring Dampening
Tune.FSusStiffness = 5000 -- Spring Force
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .5 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 100 -- Spring Dampening
Tune.RSusStiffness = 5000 -- Spring Force
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .5 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|