prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- ключ значений у игрока в DataStore2 |
local DS2key = script.Parent.Parent.Name -- "MaxHeight1"
local clickDetector = script.Parent.ClickDetector
function onMouseClick(plr)
-- для игрока plr, для ключа, изменить на -1
module.Update(plr,DS2key,-1)
end
clickDetector.MouseClick:Connect(onMouseClick)
|
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/jest-diff/src/types.ts
--[[*
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]] | |
-- 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
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
|
--[[Status Vars]] |
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then car.DriveSeat.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GThrotShift=1
local _GBrake=0
local _CBrake=0
local _CThrot=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0
local _Boost = 0
local _TCount = 0
local _TPsi = 0
local _BH = 0
local _BT = 0
local _NH = 0
local _NT = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
-- CmdrInitaliser.lua |
local CmdrRegistry = require(script.Cmdr).Registry
CmdrRegistry:RegisterDefaultCommands({ 'Utility' })
CmdrRegistry:RegisterTypesIn(script.Types)
CmdrRegistry:RegisterCommandsIn(script.Commands)
|
-- 100 == 1 0 == 0 1/0.5 |
function JamCalculation()
local L_179_
if (math.random(1, 100) <= L_24_.JamChance) then
L_179_ = true
L_72_ = true
else
L_179_ = false
end
return L_179_
end
function TracerCalculation()
local L_180_
if (math.random(1, 100) <= L_24_.TracerChance) then
L_180_ = true
else
L_180_ = false
end
return L_180_
end
function ScreamCalculation()
local L_181_
if (math.random(1, 100) <= L_24_.SuppressCalloutChance) then
L_181_ = true
else
L_181_ = false
end
return L_181_
end
function SearchResupply(L_182_arg1)
local L_183_ = false
local L_184_ = nil
if L_182_arg1:FindFirstChild('ResupplyVal') or L_182_arg1.Parent:FindFirstChild('ResupplyVal') then
L_183_ = true
if L_182_arg1:FindFirstChild('ResupplyVal') then
L_184_ = L_182_arg1.ResupplyVal
elseif L_182_arg1.Parent:FindFirstChild('ResupplyVal') then
L_184_ = L_182_arg1.Parent.ResupplyVal
end
end
return L_183_, L_184_
end
function CheckReverb()
local L_185_, L_186_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_6_.CFrame.p, (L_6_.CFrame.upVector).unit * 30), IgnoreList);
if L_185_ then
local L_187_ = L_56_:WaitForChild('Fire'):FindFirstChild('ReverbSoundEffect') or Instance.new("ReverbSoundEffect", L_56_:WaitForChild('Fire'))
elseif not L_185_ then
if L_56_:WaitForChild('Fire'):FindFirstChild('ReverbSoundEffect') then
L_56_.Fire.ReverbSoundEffect:Destroy()
end
end
end
function UpdateAmmo()
L_29_.Text = L_100_
L_30_.Text = L_29_.Text
L_31_.Text = '| ' .. math.ceil(L_101_ / L_24_.StoredAmmo)
L_32_.Text = L_31_.Text
if L_90_ == 0 then
L_40_.Image = 'rbxassetid://' .. 1868007495
elseif L_90_ == 1 then
L_40_.Image = 'rbxassetid://' .. 1868007947
elseif L_90_ == 2 then
L_40_.Image = 'rbxassetid://' .. 1868008584
end
if L_89_ == 1 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0.7
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_89_ == 2 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0
elseif L_89_ == 3 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_89_ == 4 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0.7
elseif L_89_ == 5 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0.7
L_39_.BackgroundTransparency = 0.7
elseif L_89_ == 6 then
L_35_.BackgroundTransparency = 0
L_36_.BackgroundTransparency = 0.7
L_37_.BackgroundTransparency = 0
L_38_.BackgroundTransparency = 0
L_39_.BackgroundTransparency = 0.7
end
end
|
-- load it to the humanoid; get AnimationTrack |
currentAnimTrack = humanoid:LoadAnimation(anim) |
--[[function ClickB(mouse)
reverse:Play()
end
function UnclickB(mouse)
reverse:Stop()
end--]] |
script.Parent.MouseButton1Down:connect(Click)
script.Parent.MouseButton1Up:connect(Unclick)
script.Parent.MouseButton2Click:connect(ClickA) |
--Right Legs |
local RUL = character.LowerTorso:FindFirstChild("RightHipRigAttachment")
local RULRig = character.RightUpperLeg:FindFirstChild("RightHipRigAttachment")
local RLL = character.RightUpperLeg:FindFirstChild("RightKneeRigAttachment")
local RLLRig = character.RightLowerLeg:FindFirstChild("RightKneeRigAttachment")
local RF = character.RightLowerLeg:FindFirstChild("RightAnkleRigAttachment")
local RFRig = character.RightFoot:FindFirstChild("RightAnkleRigAttachment") |
-- Use the character attribute (updated by the server) as the source of truth for body orientation
-- Intended to be used for replicated characters |
function OrientableBody:useAttributeAsSource()
self:orientFromAttribute()
self.attributeConnection = self.character:GetAttributeChangedSignal(ATTRIBUTE):Connect(function()
self:orientFromAttribute()
end)
end
function OrientableBody:destroy()
if self.attributeConnection then
self.attributeConnection:Disconnect()
self.attributeConnection = nil
end
if self.renderStepConnection then
self.renderStepConnection:Disconnect()
self.renderStepConnection = nil
end
self.motor:setGoal({
horizontalAngle = Otter.spring(0),
verticalAngle = Otter.spring(0),
})
self.motor:onComplete(function()
if self.motor then
self.motor:destroy()
self.motor = nil
end
end)
end
return OrientableBody
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1)
p1 = p1 * 100;
local v1 = math.max(1, 10 ^ (math.ceil(-math.log10(math.abs(p1))) + 1));
if v1 == math.huge then
v1 = 1;
end;
p1 = math.round(p1 * v1) / v1;
return u1.Functions.FormatAbbreviated(p1) .. "%";
end;
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
while wait() do
local nrstt = GetTorso(hroot.Position)
if nrstt ~= nil and human.Health > 0 then -- if player detected
vars.Wandering.Value = false
vars.Chasing.Value = true
local function checkw(t)
local ci = 3
if ci > #t then
ci = 3
end
if t[ci] == nil and ci < #t then
repeat ci = ci + 1 wait() until t[ci] ~= nil
return Vector3.new(1,0,0) + t[ci]
else
ci = 3
return t[ci]
end
end
path = pfs:FindPathAsync(hroot.Position, nrstt.Position)
waypoint = path:GetWaypoints()
local connection;
local direct = Vector3.FromNormalId(Enum.NormalId.Front)
local ncf = hroot.CFrame * CFrame.new(direct)
direct = ncf.p.unit
local rootr = Ray.new(hroot.Position, direct)
local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
if path and waypoint or checkw(waypoint) then
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
human:MoveTo( checkw(waypoint).Position )
human.Jump = false
end
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
connection = human.Changed:connect(function()
human.Jump = true
end)
human:MoveTo( waypoint[4].Position )
else
human.Jump = false
end
if connection then
connection:Disconnect()
end
else
for i = 3, #waypoint do
human:MoveTo( waypoint[i].Position )
end
end
path = nil
waypoint = nil
elseif nrstt == nil then
vars.Wandering.Value = true
vars.Chasing.Value = false
CchaseName = nil
path = nil
waypoint = nil
human.MoveToFinished:Wait()
end
end
|
--[[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))) then
if 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)
if _CGear < 1 then
car.Misc.GL.SS.Motor.DesiredAngle = -0.3
end
elseif input.UserInputState == Enum.UserInputState.End then
car.Misc.GL.SS.Motor.DesiredAngle = 0
end
--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))) then
if 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)
if _CGear < 2 then
car.Misc.GL.SS.Motor.DesiredAngle = 0.3
end
elseif input.UserInputState == Enum.UserInputState.End then
car.Misc.GL.SS.Motor.DesiredAngle = 0
end
--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)
|
-- ROBLOX deviation: extracted getState to jestMatchersObject_extracted to avoid circular dependency |
local getState = jestMatchersObject_extracted.getState
|
--[[Steering]] |
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 38 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .07 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--local TEAM = Character:WaitForChild("TEAM") |
local Module = require(Tool:WaitForChild("Setting"))
local GunScript_Server = Tool:WaitForChild("GunScript_Server")
local ChangeMagAndAmmo = GunScript_Server:WaitForChild("ChangeMagAndAmmo")
local VisualizeBullet = game.ReplicatedStorage:WaitForChild("VisualizeBullet")
local VisualizeMuzzle = game.ReplicatedStorage:WaitForChild("VisualizeMuzzle")
local MarkerEvent = script:WaitForChild("MarkerEvent")
local MagValue = GunScript_Server:WaitForChild("Mag")
local AmmoValue = GunScript_Server:WaitForChild("Ammo")
local GUI = script:WaitForChild("GunGUI")
local CrosshairModule = require(GUI:WaitForChild("CrosshairModule"))
local CameraModule = require(GUI:WaitForChild("CameraModule"))
local IdleAnim
local FireAnim
local ReloadAnim
local ShotgunClipinAnim
local HoldDownAnim
local EquippedAnim
local Grip2
local Handle2
local HandleToFire = Handle
|
-- DESTROY/CLEANUP METHOD |
function Icon:destroy()
if self._destroyed then return end
IconController.iconRemoved:Fire(self)
self:clearNotices()
if self._parentIcon then
self:leave()
end
self:setDropdown()
self:setMenu()
self._destroyed = true
self._maid:clean()
end
Icon.Destroy = Icon.destroy -- an alias for you maid-using Pascal lovers
return Icon
|
-- NETWORK |
export type NetworkType = {
Key: number,
Ping: number,
Events: {},
Queue: {},
--Watchers: { [string]: {[number]: (...any) -> (...any) }},
Remotes: {
Fetch: RemoteFunction,
Send: RemoteEvent
},
IgnoredEvents: Map<string, boolean>,
GetKey: (self: NetworkType) -> number,
GetPing: (self: NetworkType) -> number,
--Watch: (Network, name: string, callback: (...any) -> (...any)) -> (),
--Unwatch: (Network, name: string, callback: (...any) -> (...any)) -> (),
Add: (self: NetworkType, name: string, callback: (...any) -> (...any)) -> (),
Remove: (self: NetworkType, name: string) -> (),
Modify: (self: NetworkType, name: string, callback: (...any) -> (...any)) -> (),
Send: (self: NetworkType, name: string, ...any) -> (),
Fetch: (self: NetworkType, name: string, ...any) -> (...any)
}
|
--[[Weight and CG]] | --
Tune.Weight = 284 + 130 -- Bike weight in LBS
Tune.WeightBrickSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 3 ,
--[[Height]] 3 ,
--[[Length]] 8 }
Tune.WeightDistribution = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 0.8 -- Center of gravity height (studs relative to median of the wheels)
Tune.WBVisible = false -- Makes the weight brick visible (Debug)
Tune.BalVisible = false -- Makes the balance brick visible (Debug)
|
--\\Variables//-- |
local PlayerService = game:GetService("Players") |
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone. |
settings.DisplayMuteButton = false -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
settings.MusicFadeoutTime = 2 -- How long music takes to fade out, in seconds.
settings.MusicOnlyPlaysWithinZones = false -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.
return settings
|
-- Variables for Module Scripts |
local screenSpace = require(Tool:WaitForChild("ScreenSpace"))
local connection
local neck, shoulder, oldNeckC0, oldShoulderC0
local mobileShouldTrack = true
|
--Enter the name of the model you want to go to here.
------------------------------------ |
modelname="teleporter1d" |
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi",} --[[
[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 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Re-export all top-level public types |
export type ReactEmpty = ReactTypes.ReactEmpty
export type ReactFragment = ReactTypes.ReactFragment
export type ReactNodeList = ReactTypes.ReactNodeList
export type ReactProviderType<T> = ReactTypes.ReactProviderType<T>
export type ReactConsumer<T> = ReactTypes.ReactConsumer<T>
export type ReactProvider<T> = ReactTypes.ReactProvider<T>
export type ReactContext<T> = ReactTypes.ReactContext<T>
export type ReactPortal = ReactTypes.ReactPortal
export type RefObject = ReactTypes.RefObject
export type EventPriority = ReactTypes.EventPriority
export type ReactFundamentalComponentInstance<C, H> =
ReactTypes.ReactFundamentalComponentInstance<C, H>
export type ReactFundamentalImpl<C, H> = ReactTypes.ReactFundamentalImpl<C, H>
export type ReactFundamentalComponent<C, H> = ReactTypes.ReactFundamentalComponent<C, H>
export type ReactScope = ReactTypes.ReactScope
export type ReactScopeQuery = ReactTypes.ReactScopeQuery
export type ReactScopeInstance = ReactTypes.ReactScopeInstance |
-- Hello all. Thank you for using the script. With this script you can remove the "new Roblox OOF sound".
-- You need it if you want to have the old Oof sound again.
-- Without this script you will hear both sounds. (NEW & OLD together). Have fun fixing Roblox mistakes. | |
-- Selected game mode value |
local InteractionGui = SelectionFrame.Parent
local InteractionManager = InteractionGui:FindFirstChild("InteractionManager")
local SelectedMode = InteractionManager:FindFirstChild("SelectedMode")
|
--[[
Event functions
]] |
local function onHeartbeat()
if target then
-- Point towards the enemy
maid.alignOrientation.Enabled = true
maid.worldAttachment.CFrame = CFrame.new(maid.humanoidRootPart.Position, target.Position)
else
maid.alignOrientation.Enabled = false
end
-- Check if the current target no longer exists or is not attackable
if not target or not isInstaceAttackable(target) then
findTargets()
end
end
local function died()
target = nil
attacking = false
newTarget = nil
searchParts = nil
searchingForTargets = false
maid.heartbeatConnection:Disconnect()
if RAGDOLL_ENABLED then
Ragdoll(maid.instance, maid.humanoid)
end
if DESTROY_ON_DEATH then
delay(DEATH_DESTROY_DELAY, function()
destroy()
end)
end
end
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Linen",Paint)
end)
|
--[[Run]] |
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("Novena: AC6T Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--Power
Engine()
--Update External Values
_IsOn = car.DriveSeat.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = (_Boost/2)*_TPsi
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpBoosted.Value = _BH*(_Boost/2)
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TqNatural.Value = _NT
script.Parent.Values.TqBoosted.Value = _BT*(_Boost/2)
script.Parent.Values.Throttle.Value = _GThrot*_GThrotShift
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
if car.DriveSeat.CC.Value == true then
if (car.DriveSeat.Velocity.Magnitude*((10/12) * (60/88))) - 2 > car.DriveSeat.CCS.Value+0.5 then
_CBrake = 0.15
else
_CThrot = 1
end
else _CBrake = 0
_CThrot = 0
end
if car.DriveSeat.SST.Value then
if (_RPM - 10) <= _Tune.IdleRPM then
if (_GBrake > 0.05) or (_PBrake.Value == true) then
car.DriveSeat.Tic.Value = true
else car.DriveSeat.Tic.Value = false
end
end
else car.DriveSeat.Tic.Value = false
end
if _GBrake > 0 then
car.DriveSeat.CC.Value = false
end
end)
_CGear.Changed:Connect(function()
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end)
script.Parent.Values.Brake.Changed:Connect(function()
if math.ceil(_GBrake) == 1 then
car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', true)
else
car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', false)
end
end)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_SoundsMisc")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
script:WaitForChild("Rel")
script:WaitForChild("Start")
script.Parent.Values.Gear.Changed:connect(function() mult=1 end)
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
handler:FireServer("newSound","Rel",car.DriveSeat,script.Rel.SoundId,0,script.Rel.Volume,true)
handler:FireServer("newSound","Start",car.DriveSeat,script.Start.SoundId,1,script.Start.Volume,false)
handler:FireServer("playSound","Rel")
car.DriveSeat:WaitForChild("Rel")
car.DriveSeat:WaitForChild("Start")
while wait() do
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.PreOn.Value then
handler:FireServer("playSound","Start")
wait(1)
else
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
RelVolume = 2*(1 - math.min(((script.Parent.Values.RPM.Value*2)/_Tune.Redline),1))
RelPitch = (math.max((((script.Rel.SetPitch.Value + script.Rel.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rel.SetPitch.Value)) * on
end
if FE then
handler:FireServer("updateSound","Rel",script.Rel.SoundId,RelPitch,RelVolume)
else
car.DriveSeat.Rel.Volume = RelVolume
car.DriveSeat.Rel.Pitch = RelPitch
end
end
|
--[[
Returns all cached player character appearances, as a table with the index being userIds
]] |
function CharacterAppearanceCache.getAllAppearances()
return appearanceCache
end
|
-- Properties |
local OptimalEffects = false -- Adjust details of effects by client quality level
local RenderDistance = 400 -- Maximum camera distance to render visual effects
local ScreenCullingEnabled = true -- Show visual effects when their positions are on screen
local MaxDebrisCounts = 100 -- Maximum number of debris objects (mostly decayed projectiles) to exist
local RayExit = true -- Only for Wall Penetration
FastCast.DebugLogging = false
FastCast.VisualizeCasts = false
local Beam = Instance.new("Beam")
Beam.TextureSpeed = 0
Beam.LightEmission = 0
Beam.LightInfluence = 1
Beam.Transparency = NumberSequence.new(0)
local BlockSegContainer = Instance.new("Folder")
BlockSegContainer.Name = "BlockSegContainer"
BlockSegContainer.Parent = Camera
local CylinderSegContainer = Instance.new("Folder")
CylinderSegContainer.Name = "CylinderSegContainer"
CylinderSegContainer.Parent = Camera
local ConeSegContainer = Instance.new("Folder")
ConeSegContainer.Name = "ConeSegContainer"
ConeSegContainer.Parent = Camera
local Caster = FastCast.new()
local BlockSegCache = PartCache.new(Miscs.BlockSegment, 500)
BlockSegCache:SetCacheParent(BlockSegContainer)
local CylinderSegCache = PartCache.new(Miscs.CylinderSegment, 500)
CylinderSegCache:SetCacheParent(CylinderSegContainer)
local ConeSegCache = PartCache.new(Miscs.ConeSegment, 500)
ConeSegCache:SetCacheParent(ConeSegContainer)
local ShootId = 0
local DebrisCounts = 0
local PartCacheStorage = {}
local function CastWithBlacklist(Cast, Origin, Direction, Blacklist, IgnoreWater)
local CastRay = Ray.new(Origin, Direction)
local HitPart, HitPoint, HitNormal, HitMaterial = nil, Origin + Direction, Vector3.new(0, 1, 0), Enum.Material.Air
local Success = false
repeat
HitPart, HitPoint, HitNormal, HitMaterial = Workspace:FindPartOnRayWithIgnoreList(CastRay, Blacklist, false, IgnoreWater)
if HitPart then
--if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[HitPart.Name] then
-- table.insert(Blacklist, HitPart)
-- Success = false
--else
local Target = HitPart:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTool = HitPart:FindFirstAncestorOfClass("Tool")
if (HitPart.Transparency > 0.75
or HitPart.Name == "Missile"
or HitPart.Name == "Handle"
or HitPart.Name == "Effect"
or HitPart.Name == "Bullet"
or HitPart.Name == "Laser"
or string.lower(HitPart.Name) == "water"
or HitPart.Name == "Rail"
or HitPart.Name == "Arrow"
or (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
or TargetTool) then
table.insert(Blacklist, HitPart)
Success = false
else
Success = true
end
--end
else
Success = true
end
until Success
return HitPart, HitPoint, HitNormal, HitMaterial
end
local function AddressTableValue(Enabled, Level, V1, V2)
if V1 ~= nil and Enabled and Level then
return ((Level == 1 and V1.Level1) or (Level == 2 and V1.Level2) or (Level == 3 and V1.Level3) or V2)
else
return V2
end
end
local function CanShowEffects(Position)
if ScreenCullingEnabled then
local _, OnScreen = Camera:WorldToScreenPoint(Position)
return OnScreen and (Position - Camera.CFrame.p).Magnitude <= RenderDistance
end
return (Position - Camera.CFrame.p).Magnitude <= RenderDistance
end
local function PopulateHumanoids(Cast, Model)
if Model.ClassName == "Humanoid" then
if DamageModule.CanDamage(Model.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
table.insert(Humanoids, Model)
end
end
for i, mdl in ipairs(Model:GetChildren()) do
PopulateHumanoids(Cast, mdl)
end
end
local function FindNearestEntity(Cast, Position)
Humanoids = {}
PopulateHumanoids(Cast, Workspace)
local Dist = Cast.UserData.HomeData.HomingDistance
local TargetModel = nil
local TargetHumanoid = nil
local TargetTorso = nil
for i, v in ipairs(Humanoids) do
local torso = v.Parent:FindFirstChild("HumanoidRootPart") or v.Parent:FindFirstChild("Torso") or v.Parent:FindFirstChild("UpperTorso")
if v and torso then
if (torso.Position - Position).Magnitude < (Dist + (torso.Size.Magnitude / 2.5)) and v.Health > 0 then
if not Cast.UserData.HomeData.HomeThroughWall then
local hit, pos, normal, material = CastWithBlacklist(Cast, Position, (torso.CFrame.p - Position).Unit * 999, Cast.UserData.IgnoreList, true)
if hit then
if hit:IsDescendantOf(v.Parent) then
if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
TargetModel = v.Parent
TargetHumanoid = v
TargetTorso = torso
Dist = (Position - torso.Position).Magnitude
end
end
end
else
if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
TargetModel = v.Parent
TargetHumanoid = v
TargetTorso = torso
Dist = (Position - torso.Position).Magnitude
end
end
end
end
end
return TargetModel, TargetHumanoid, TargetTorso
end
local function EmitParticle(Particle, Count)
if OptimalEffects then
local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
if QualityLevel == Enum.SavedQualitySetting.Automatic then
local Compressor = 1 / 2
Particle:Emit(Count * Compressor)
else
local Compressor = QualityLevel.Value / 21
Particle:Emit(Count * Compressor)
end
else
Particle:Emit(Count)
end
end
local function FadeBeam(A0, A1, Beam, Hole, FadeTime, Replicate)
if FadeTime > 0 then
if OptimalEffects then
if Replicate then
local t0 = os.clock()
while Hole ~= nil do
local Alpha = math.min((os.clock() - t0) / FadeTime, 1)
if Beam then Beam.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
if Alpha == 1 then break end
Thread:Wait()
end
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
else
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
else
local t0 = os.clock()
while Hole ~= nil do
local Alpha = math.min((os.clock() - t0) / FadeTime, 1)
if Beam then Beam.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
if Alpha == 1 then break end
Thread:Wait()
end
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
else
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
end
local function MakeImpactFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
local SurfaceCF = CFrame.new(Position, Position + Normal)
local HitEffectEnabled = ClientModule.HitEffectEnabled
local HitSoundIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundIDs, ClientModule.HitSoundIDs)
local HitSoundPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMin, ClientModule.HitSoundPitchMin)
local HitSoundPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMax, ClientModule.HitSoundPitchMax)
local HitSoundVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundVolume, ClientModule.HitSoundVolume)
local CustomHitEffect = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CustomHitEffect, ClientModule.CustomHitEffect)
local BulletHoleEnabled = ClientModule.BulletHoleEnabled
local BulletHoleSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleSize, ClientModule.BulletHoleSize)
local BulletHoleTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleTexture, ClientModule.BulletHoleTexture)
local PartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PartColor, ClientModule.PartColor)
local BulletHoleVisibleTime = ClientModule.BulletHoleVisibleTime
local BulletHoleFadeTime = ClientModule.BulletHoleFadeTime
if IsMelee then
HitEffectEnabled = ClientModule.MeleeHitEffectEnabled
HitSoundIDs = ClientModule.MeleeHitSoundIDs
HitSoundPitchMin = ClientModule.MeleeHitSoundPitchMin
HitSoundPitchMax = ClientModule.MeleeHitSoundPitchMax
HitSoundVolume = ClientModule.MeleeHitSoundVolume
CustomHitEffect = ClientModule.CustomMeleeHitEffect
BulletHoleEnabled = ClientModule.MarkerEffectEnabled
BulletHoleSize = ClientModule.MarkerEffectSize
BulletHoleTexture = ClientModule.MarkerEffectTexture
BulletHoleVisibleTime = ClientModule.MarkerEffectVisibleTime
BulletHoleFadeTime = ClientModule.MarkerEffectFadeTime
PartColor = ClientModule.MarkerPartColor
end
if HitEffectEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
local Sound
local function Spawner(material)
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialSounds") then
local tracks = Misc.HitEffectFolder[material.Name].MaterialSounds:GetChildren()
local rn = math.random(1, #tracks)
local track = tracks[rn]
if track ~= nil then
Sound = track:Clone()
if track:FindFirstChild("Pitch") then
Sound.PlaybackSpeed = Random.new():NextNumber(track.Pitch.Min.Value, track.Pitch.Max.Value)
else
Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
end
if track:FindFirstChild("Volume") then
Sound.Volume = Random.new():NextNumber(track.Volume.Min.Value, track.Volume.Max.Value)
else
Sound.Volume = HitSoundVolume
end
Sound.Parent = Attachment
end
else
Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..HitSoundIDs[math.random(1, #HitSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
Sound.Volume = HitSoundVolume
Sound.Parent = Attachment
end
for i, v in pairs(Misc.HitEffectFolder[material.Name]:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
if Particle.PartColor.Value then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
Particle.Color = ColorSequence.new(HitPartColor, HitPartColor)
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Sound:Play()
if BulletHoleEnabled then
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and Hit or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local Scale = BulletHoleSize
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialHoleSize") then
Scale = Misc.HitEffectFolder[material.Name].MaterialHoleSize.Value
end
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = Scale
BeamClone.Width1 = Scale
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialDecals") then
local Decals = Misc.HitEffectFolder[material.Name].MaterialDecals:GetChildren()
local Chosen = math.random(1, #Decals)
local Decal = Decals[Chosen]
if Decal ~= nil then
BeamClone.Texture = "rbxassetid://"..Decal.Value
if Decal.PartColor.Value then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
end
else
BeamClone.Texture = "rbxassetid://"..BulletHoleTexture[math.random(1, #BulletHoleTexture)]
if PartColor then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = Hit
A1.Parent = Hit
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
Thread:Delay(BulletHoleVisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, BulletHoleFadeTime, Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
if not CustomHitEffect then
if Misc.HitEffectFolder:FindFirstChild(Hit.Material) then
Spawner(Hit.Material)
else
Spawner(Misc.HitEffectFolder.Custom)
end
else
Spawner(Misc.HitEffectFolder.Custom)
end
Debris:AddItem(Attachment, 10)
end
end
local function MakeBloodFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
local SurfaceCF = CFrame.new(Position, Position + Normal)
local BloodEnabled = ClientModule.BloodEnabled
local HitCharSndIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndIDs, ClientModule.HitCharSndIDs)
local HitCharSndPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMin, ClientModule.HitCharSndPitchMin)
local HitCharSndPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMax, ClientModule.HitCharSndPitchMax)
local HitCharSndVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndVolume, ClientModule.HitCharSndVolume)
local BloodWoundEnabled = ClientModule.BloodWoundEnabled
local BloodWoundTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTexture, ClientModule.BloodWoundTexture)
local BloodWoundSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundSize, ClientModule.BloodWoundSize)
local BloodWoundTextureColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTextureColor, ClientModule.BloodWoundTextureColor)
local BloodWoundPartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundPartColor, ClientModule.BloodWoundPartColor)
local BloodWoundVisibleTime = ClientModule.BloodWoundVisibleTime
local BloodWoundFadeTime = ClientModule.BloodWoundFadeTime
if IsMelee then
BloodEnabled = ClientModule.MeleeBloodEnabled
HitCharSndIDs = ClientModule.MeleeHitCharSndIDs
HitCharSndPitchMin = ClientModule.MeleeHitCharSndPitchMin
HitCharSndPitchMax = ClientModule.MeleeHitCharSndPitchMax
HitCharSndVolume = ClientModule.MeleeHitCharSndVolume
BloodWoundEnabled = ClientModule.MeleeBloodWoundEnabled
BloodWoundTexture = ClientModule.MeleeBloodWoundTexture
BloodWoundSize = ClientModule.MeleeBloodWoundSize
BloodWoundTextureColor = ClientModule.MeleeBloodWoundTextureColor
BloodWoundPartColor = ClientModule.MeleeBloodWoundVisibleTime
BloodWoundVisibleTime = ClientModule.MeleeBloodWoundFadeTime
BloodWoundFadeTime = ClientModule.MeleeBloodWoundPartColor
end
if BloodEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..HitCharSndIDs[math.random(1, #HitCharSndIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(HitCharSndPitchMin, HitCharSndPitchMax)
Sound.Volume = HitCharSndVolume
Sound.Parent = Attachment
for i, v in pairs(Misc.BloodEffectFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Sound:Play()
Debris:AddItem(Attachment, 10)
if BloodWoundEnabled then
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and Hit or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = BloodWoundSize
BeamClone.Width1 = BloodWoundSize
BeamClone.Texture = "rbxassetid://"..BloodWoundTexture[math.random(1, #BloodWoundTexture)]
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, BloodWoundTextureColor), ColorSequenceKeypoint.new(1, BloodWoundTextureColor)})
if BloodWoundPartColor then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = Hit
A1.Parent = Hit
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
Thread:Delay(BloodWoundVisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, BloodWoundFadeTime, Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
end
local function OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local EndPos = RaycastResult and RaycastResult.Position or Cast.UserData.SegmentOrigin
local ShowEffects = CanShowEffects(EndPos)
if not AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosiveEnabled, Cast.UserData.ClientModule.ExplosiveEnabled) then
if not RaycastResult then
return
end
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, Direction)
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Distance = (RaycastResult.Position - Origin).Magnitude
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
end
else
if Cast.UserData.ClientModule.ExplosionSoundEnabled then
local SoundTable = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundIDs, Cast.UserData.ClientModule.ExplosionSoundIDs)
local Attachment = Instance.new("Attachment")
Attachment.CFrame = CFrame.new(EndPos)
Attachment.Parent = Workspace.Terrain
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..SoundTable[math.random(1, #SoundTable)]
Sound.PlaybackSpeed = Random.new():NextNumber(AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMin, Cast.UserData.ClientModule.ExplosionSoundPitchMin), AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMax, Cast.UserData.ClientModule.ExplosionSoundPitchMax))
Sound.Volume = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundVolume, Cast.UserData.ClientModule.ExplosionSoundVolume)
Sound.Parent = Attachment
Sound:Play()
Debris:AddItem(Attachment, 10)
end
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionRadius, Cast.UserData.ClientModule.ExplosionRadius)
Explosion.BlastPressure = 0
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.Position = EndPos
Explosion.Parent = Camera
local SurfaceCF = RaycastResult and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or CFrame.new(Cast.UserData.SegmentOrigin, Cast.UserData.SegmentOrigin + Cast.UserData.SegmentDirection)
if ShowEffects and RaycastResult then
if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterEnabled, Cast.UserData.ClientModule.ExplosionCraterEnabled) then
if RaycastResult.Instance and RaycastResult.Instance.Parent then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
if not TargetHumanoid then
local ParentToPart = true
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and RaycastResult.Instance or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local Scale = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterSize, Cast.UserData.ClientModule.ExplosionCraterSize)
local Texture = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterTexture, Cast.UserData.ClientModule.ExplosionCraterTexture)
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = Scale
BeamClone.Width1 = Scale
BeamClone.Texture = "rbxassetid://"..Texture[math.random(1,#Texture)]
if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterPartColor, Cast.UserData.ClientModule.ExplosionCraterPartColor) then
local HitPartColor = RaycastResult.Instance and RaycastResult.Instance.Color or Color3.fromRGB(255, 255, 255)
if RaycastResult.Instance and RaycastResult.Instance:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(RaycastResult.Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = RaycastResult.Instance
A1.Parent = RaycastResult.Instance
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
local VisibleTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterVisibleTime, Cast.UserData.ClientModule.ExplosionCraterVisibleTime)
local FadeTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterFadeTime, Cast.UserData.ClientModule.ExplosionCraterFadeTime)
Thread:Delay(VisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, FadeTime, Cast.UserData.Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
end
end
if Cast.UserData.ClientModule.CustomExplosion then
Explosion.Visible = false
if ShowEffects then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
for i, v in pairs(Cast.UserData.Misc.ExplosionEffectFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Debris:AddItem(Attachment, 10)
end
end
local HitHumanoids = {}
Explosion.Hit:Connect(function(HitPart, HitDist)
if HitPart and Cast.UserData.Replicate then
if HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
local Target = HitPart:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetTorso then
if TargetHumanoid.Health > 0 then
if not HitHumanoids[TargetHumanoid] then
if Cast.UserData.ClientModule.ExplosionKnockback then
local Multipler = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget, Cast.UserData.ClientModule.ExplosionKnockbackMultiplierOnTarget)
local DistanceFactor = HitDist / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionRadius, Cast.UserData.ClientModule.ExplosionRadius)
DistanceFactor = 1 - DistanceFactor
local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackPower, Cast.UserData.ClientModule.ExplosionKnockbackPower) --* DistanceFactor
local AirVelocity = TargetTorso.Velocity - Vector3.new(0, TargetTorso.Velocity.y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z)
if DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
local TorsoFly = Instance.new("BodyVelocity")
TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
TorsoFly.Velocity = AirVelocity
TorsoFly.Parent = TargetTorso
TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
Debris:AddItem(TorsoFly, 0.25)
else
if TargetHumanoid.Parent.Name == Player.Name then
Multipler = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer, Cast.UserData.ClientModule.ExplosionKnockbackMultiplierOnPlayer)
local TorsoFly = Instance.new("BodyVelocity")
TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
TorsoFly.Velocity = AirVelocity
TorsoFly.Parent = TargetTorso
TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
Debris:AddItem(TorsoFly, 0.25)
end
end
end
local Part = RaycastResult and RaycastResult.Instance or HitPart
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, Part, Part.Size, Cast.UserData.Misc, HitDist)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, Part.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
HitHumanoids[TargetHumanoid] = true
end
end
end
elseif HitPart.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
ShatterGlass:FireServer(HitPart, HitPart.Position, Direction)
end
end
end)
end
end
local function OnRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local CanBounce = Cast.UserData.CastBehavior.Hitscan and true or false
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
local Acceleration = Cast.UserData.CastBehavior.Acceleration
if not Cast.UserData.CastBehavior.Hitscan then
Cast.UserData.SpinData.InitalTick = os.clock()
Cast.UserData.SpinData.InitalAngularVelocity = RaycastResult.Normal:Cross(CurrentVelocity) / 0.2
Cast.UserData.SpinData.InitalRotation = (Cast.RayInfo.CurrentCFrame - Cast.RayInfo.CurrentCFrame.p)
Cast.UserData.SpinData.ProjectileOffset = 0.2 * RaycastResult.Normal
if CurrentVelocity.Magnitude > 0 then
local NormalizeBounce = false
local Position = Cast.RayInfo.RaycastHitbox and CurrentPosition or RaycastResult.Position
if Cast.UserData.BounceData.BounceBetweenHumanoids then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
end
end
local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, Position)
if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
local DesiredVector = (TrackedTorso.Position - Position).Unit
if Cast.UserData.BounceData.PredictDirection then
local Pos, Vel = DirectionPredictor(Position, TrackedTorso.Position, Vector3.new(), TrackedTorso.Velocity, Acceleration, (2 * TrackedTorso.Velocity) / 3, SegmentVelocity.Magnitude)
if Pos and Vel then
DesiredVector = Vel.Unit
end
end
Cast:SetVelocity(DesiredVector * SegmentVelocity.Magnitude)
Cast:SetPosition(Position)
else
NormalizeBounce = true
end
else
NormalizeBounce = true
end
if NormalizeBounce then
local Delta = Position - CurrentPosition
local Fix = 1 - 0.001 / Delta.Magnitude
Fix = Fix < 0 and 0 or Fix
Cast:AddPosition(Fix * Delta + 0.05 * RaycastResult.Normal)
local NewNormal = RaycastResult.Normal
local NewVelocity = CurrentVelocity
if Cast.UserData.BounceData.IgnoreSlope and (Acceleration ~= Vector3.new(0, 0, 0) and Acceleration.Y < 0) then
local NewPosition = Cast:GetPosition()
NewVelocity = Vector3.new(CurrentVelocity.X, -Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
local Instance2, Position2, Normal2, Material2 = CastWithBlacklist(Cast, NewPosition, Vector3.new(0, 1, 0), Cast.UserData.IgnoreList, true)
if Instance2 then
NewVelocity = Vector3.new(CurrentVelocity.X, Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
end
local X = math.deg(math.asin(RaycastResult.Normal.X))
local Z = math.deg(math.asin(RaycastResult.Normal.Z))
local FloorAngle = math.floor(math.max(X == 0 and Z or X, X == 0 and -Z or -X))
NewNormal = FloorAngle > 0 and (FloorAngle >= Cast.UserData.BounceData.SlopeAngle and RaycastResult.Normal or Vector3.new(0, RaycastResult.Normal.Y, 0)) or RaycastResult.Normal
end
local NormalVelocity = Vector3.new().Dot(NewNormal, NewVelocity) * NewNormal
local TanVelocity = NewVelocity - NormalVelocity
local GeometricDeceleration
local D1 = -Vector3.new().Dot(NewNormal, Acceleration)
local D2 = -(1 + Cast.UserData.BounceData.BounceElasticity) * Vector3.new().Dot(NewNormal, NewVelocity)
GeometricDeceleration = 1 - Cast.UserData.BounceData.FrictionConstant * (10 * (D1 < 0 and 0 or D1) * Cast.StateInfo.Delta + (D2 < 0 and 0 or D2)) / TanVelocity.Magnitude
Cast:SetVelocity((GeometricDeceleration < 0 and 0 or GeometricDeceleration) * TanVelocity - Cast.UserData.BounceData.BounceElasticity * NormalVelocity)
end
CanBounce = true
end
else
local NormalizeBounce = false
if Cast.UserData.BounceData.BounceBetweenHumanoids then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
end
end
local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, RaycastResult.Position)
if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
local DesiredVector = (TrackedTorso.Position - RaycastResult.Position).Unit
Cast.RayInfo.ModifiedDirection = DesiredVector
else
NormalizeBounce = true
end
else
NormalizeBounce = true
end
if NormalizeBounce then
local CurrentDirection = Cast.RayInfo.ModifiedDirection
local NewDirection = CurrentDirection - (2 * CurrentDirection:Dot(RaycastResult.Normal) * RaycastResult.Normal)
Cast.RayInfo.ModifiedDirection = NewDirection
end
end
if CanBounce then
if Cast.UserData.BounceData.CurrentBounces > 0 then
Cast.UserData.BounceData.CurrentBounces -= 1
local ShowEffects = CanShowEffects(RaycastResult.Position)
if Cast.UserData.BounceData.NoExplosionWhileBouncing then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local Distance = (RaycastResult.Position - Origin).Magnitude
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
else
OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
end
end
end
end
local function CanRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if Cast.UserData.BounceData.StopBouncingOn == "Object" then
return false
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if Cast.UserData.BounceData.StopBouncingOn == "Humanoid" then
return false
end
else
if Cast.UserData.BounceData.StopBouncingOn == "Object" then
return false
end
end
end
if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.BounceData.SuperRicochet then
return true
else
if Cast.UserData.BounceData.CurrentBounces > 0 then
return true
end
end
return false
end
local function OnRayExited(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
if not RayExit then
return
end
if Cast.UserData.PenetrationData then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ShowEffects = CanShowEffects(RaycastResult.Position)
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
return
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
end
end
end
if RaycastResult.Instance and RaycastResult.Instance.Parent then
local vis = Cast:DbgVisualizeHit(CFrame.new(RaycastResult.Position), true)
if (vis ~= nil) then vis.Color3 = Color3.fromRGB(13, 105, 172) end
end
end
local function CanRayPenetrate(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local ShowEffects = CanShowEffects(RaycastResult.Position)
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
return true
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTool = RaycastResult.Instance:FindFirstAncestorOfClass("Tool")
if (RaycastResult.Instance.Transparency > 0.75
or RaycastResult.Instance.Name == "Missile"
or RaycastResult.Instance.Name == "Handle"
or RaycastResult.Instance.Name == "Effect"
or RaycastResult.Instance.Name == "Bullet"
or RaycastResult.Instance.Name == "Laser"
or string.lower(RaycastResult.Instance.Name) == "water"
or RaycastResult.Instance.Name == "Rail"
or RaycastResult.Instance.Name == "Arrow"
or (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.PenetrationData and table.find(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
or TargetTool) then
return true
else
if Cast.UserData.PenetrationData then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if Cast.UserData.PenetrationData.PenetrationDepth <= 0 then
return false
end
elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
if Cast.UserData.PenetrationData.PenetrationAmount <= 0 then
return false
end
end
local MaxExtent = RaycastResult.Instance.Size.Magnitude * Direction
local ExitHit, ExitPoint, ExitNormal, ExitMaterial = Workspace:FindPartOnRayWithWhitelist(Ray.new(RaycastResult.Position + MaxExtent, -MaxExtent), {RaycastResult.Instance}, Cast.RayInfo.Parameters.IgnoreWater)
local Dist = (ExitPoint - RaycastResult.Position).Magnitude
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
end
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
return true
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
return true
end
else
local Distance = (RaycastResult.Position - Origin).Magnitude
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
Cast.UserData.PenetrationData.PenetrationAmount -= 1
end
if Cast.UserData.PenetrationData.PenetrationIgnoreDelay ~= math.huge then
Thread:Delay(Cast.UserData.PenetrationData.PenetrationIgnoreDelay, function()
local Index = table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
if Index then
table.remove(Cast.UserData.PenetrationData.HitHumanoids, Index)
end
end)
end
return true
end
else
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
return true
end
end
end
end
end
end
end
end
return false
end
local function UpdateParticle(Cast, Position, LastPosition, W2)
if Cast.UserData.BulletParticleData.MotionBlur then
local T2 = os.clock()
local P2 = CFrame.new().pointToObjectSpace(Camera.CFrame, W2)
local V2
if Cast.UserData.BulletParticleData.T0 then
V2 = 2 / (T2 - Cast.UserData.BulletParticleData.T1) * (P2 - Cast.UserData.BulletParticleData.P1) - (P2 - Cast.UserData.BulletParticleData.P0) / (T2 - Cast.UserData.BulletParticleData.T0)
else
V2 = (P2 - Cast.UserData.BulletParticleData.P1) / (T2 - Cast.UserData.BulletParticleData.T1)
Cast.UserData.BulletParticleData.V1 = V2
end
Cast.UserData.BulletParticleData.T0, Cast.UserData.BulletParticleData.V0, Cast.UserData.BulletParticleData.P0 = Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1
Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1 = T2, V2, P2
local Dt = Cast.UserData.BulletParticleData.T1 - Cast.UserData.BulletParticleData.T0
local M0 = Cast.UserData.BulletParticleData.V0.Magnitude
local M1 = Cast.UserData.BulletParticleData.V1.Magnitude
Cast.UserData.BulletParticleData.Attachment0.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P0
Cast.UserData.BulletParticleData.Attachment1.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P1
if M0 > 1.0E-8 then
Cast.UserData.BulletParticleData.Attachment0.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V0 / M0)
end
if M1 > 1.0E-8 then
Cast.UserData.BulletParticleData.Attachment1.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V1 / M1)
end
local Dist0 = -Cast.UserData.BulletParticleData.P0.Z
local Dist1 = -Cast.UserData.BulletParticleData.P1.Z
if Dist0 < 0 then
Dist0 = 0
end
if Dist1 < 0 then
Dist1 = 0
end
local W0 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist0
local W1 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist1
local L = ((Cast.UserData.BulletParticleData.P1 - Cast.UserData.BulletParticleData.P0) * Vector3.new(1, 1, 0)).Magnitude
local Tr = 1 - 4 * Cast.UserData.BulletParticleData.BulletSize * Cast.UserData.BulletParticleData.BulletSize / ((W0 + W1) * (2 * L + W0 + W1)) * Cast.UserData.BulletParticleData.BulletBrightness
for _, effect in next, Cast.UserData.BulletParticleData.Effects do
effect.CurveSize0 = Dt / 3 * M0
effect.CurveSize1 = Dt / 3 * M1
effect.Width0 = W0
effect.Width1 = W1
effect.Transparency = NumberSequence.new(Tr)
end
else
if (Position - LastPosition).Magnitude > 0 then
local Rotation = CFrame.new(LastPosition, Position) - LastPosition
local Offset = CFrame.Angles(0, math.pi / 2, 0)
Cast.UserData.BulletParticleData.Attachment0.CFrame = CFrame.new(Position) * Rotation * Offset
Cast.UserData.BulletParticleData.Attachment1.CFrame = CFrame.new(LastPosition, Position) * Offset
end
end
end
local function OnRayUpdated(Cast, LastSegmentOrigin, SegmentOrigin, SegmentDirection, Length, SegmentVelocity, CosmeticBulletObject)
Cast.UserData.LastSegmentOrigin = LastSegmentOrigin
Cast.UserData.SegmentOrigin = SegmentOrigin
Cast.UserData.SegmentDirection = SegmentDirection
Cast.UserData.SegmentVelocity = SegmentVelocity
local Tick = os.clock() - Cast.UserData.SpinData.InitalTick
if Cast.UserData.UpdateData.UpdateRayInExtra then
if Cast.UserData.UpdateData.ExtraRayUpdater then
Cast.UserData.UpdateData.ExtraRayUpdater(Cast, Cast.StateInfo.Delta)
end
end
if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.HomeData.Homing then
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
if Cast.UserData.HomeData.LockOnOnHovering then
if Cast.UserData.HomeData.LockedEntity then
local TargetHumanoid = Cast.UserData.HomeData.LockedEntity:FindFirstChildOfClass("Humanoid")
if TargetHumanoid and TargetHumanoid.Health > 0 then
local TargetTorso = Cast.UserData.HomeData.LockedEntity:FindFirstChild("HumanoidRootPart") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("Torso") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("UpperTorso")
local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
local CurrentVector = CurrentVelocity.Unit
local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
if AngularDifference > 0 then
local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
end
end
end
else
local TargetEntity, TargetHumanoid, TargetTorso = FindNearestEntity(Cast, CurrentPosition)
if TargetEntity and TargetHumanoid and TargetTorso and TargetHumanoid.Health > 0 then
local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
local CurrentVector = CurrentVelocity.Unit
local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
if AngularDifference > 0 then
local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
end
end
end
end
local TravelCFrame
if Cast.UserData.SpinData.CanSpinPart then
if not Cast.UserData.CastBehavior.Hitscan then
local Position = (SegmentOrigin + Cast.UserData.SpinData.ProjectileOffset)
if Cast.UserData.BounceData.SuperRicochet then
TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
else
if Cast.UserData.BounceData.CurrentBounces > 0 then
TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
end
end
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
end
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity)
end
Cast.RayInfo.CurrentCFrame = TravelCFrame
if Cast.UserData.BulletParticleData then
UpdateParticle(Cast, SegmentOrigin, Cast.UserData.LastPosition, SegmentOrigin)
end
if Cast.UserData.LaserData.LaserTrailEnabled then
if Cast.StateInfo.Delta > 0 then
local Width = Cast.UserData.LaserData.LaserTrailWidth
local Height = Cast.UserData.LaserData.LaserTrailHeight
local TrailSegment = Miscs[Cast.UserData.LaserData.LaserTrailShape.."Segment"]:Clone()
if Cast.UserData.LaserData.RandomizeLaserColorIn ~= "None" then
if Cast.UserData.LaserData.RandomizeLaserColorIn == "Whole" then
TrailSegment.Color = Cast.UserData.LaserData.RandomLaserColor
elseif Cast.UserData.LaserData.RandomizeLaserColorIn == "Segment" then
TrailSegment.Color = Color3.new(math.random(), math.random(), math.random())
end
else
TrailSegment.Color = Cast.UserData.LaserData.LaserTrailColor
end
TrailSegment.Material = Cast.UserData.LaserData.LaserTrailMaterial
TrailSegment.Reflectance = Cast.UserData.LaserData.LaserTrailReflectance
TrailSegment.Transparency = Cast.UserData.LaserData.LaserTrailTransparency
TrailSegment.Size = Cast.UserData.LaserData.LaserTrailShape == "Cone" and Vector3.new(Width, (SegmentOrigin - LastSegmentOrigin).Magnitude, Height) or Vector3.new((SegmentOrigin - LastSegmentOrigin).Magnitude, Height, Width)
TrailSegment.CFrame = CFrame.new((LastSegmentOrigin + SegmentOrigin) * 0.5, SegmentOrigin) * (Cast.UserData.LaserData.LaserTrailShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
TrailSegment.Parent = Camera
table.insert(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
Thread:Delay(Cast.UserData.LaserData.LaserTrailVisibleTime, function()
if Cast.UserData.LaserData.LaserTrailFadeTime > 0 then
local DesiredSize = TrailSegment.Size * (Cast.UserData.LaserData.ScaleLaserTrail and Vector3.new(1, Cast.UserData.LaserData.LaserTrailScaleMultiplier, Cast.UserData.LaserData.LaserTrailScaleMultiplier) or Vector3.new(1, 1, 1))
local Tween = TweenService:Create(TrailSegment, TweenInfo.new(Cast.UserData.LaserData.LaserTrailFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
Tween:Play()
Tween.Completed:Wait()
if TrailSegment then
local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Index then
table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
end
TrailSegment:Destroy()
end
else
if TrailSegment then
local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Index then
table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
end
TrailSegment:Destroy()
end
end
end)
end
end
if Cast.UserData.LightningData.LightningBoltEnabled then
if Cast.StateInfo.Delta > 0 then
local Wideness = Cast.UserData.LightningData.BoltWideness
local Width = Cast.UserData.LightningData.BoltWidth
local Height = Cast.UserData.LightningData.BoltHeight
for _, v in ipairs(Cast.UserData.LightningData.BoltCFrameTable) do
local Cache
if Cast.UserData.LightningData.BoltShape == "Block" then
Cache = BlockSegCache
elseif Cast.UserData.LightningData.BoltShape == "Cylinder" then
Cache = CylinderSegCache
elseif Cast.UserData.LightningData.BoltShape == "Cone" then
Cache = ConeSegCache
end
if Cache then
local Start = (CFrame.new(SegmentOrigin, SegmentOrigin + SegmentDirection) * v).p
local End = (CFrame.new(LastSegmentOrigin, LastSegmentOrigin + SegmentDirection) * v).p
local Distance = (End - Start).Magnitude
local Pos = Start
for i = 0, Distance, 10 do
local FakeDistance = CFrame.new(Start, End) * CFrame.new(0, 0, -i - 10) * CFrame.new(-2 + (math.random() * Wideness), -2 + (math.random() * Wideness), -2 + (math.random() * Wideness))
local BoltSegment = Cache:GetPart()
if Cast.UserData.LightningData.RandomizeBoltColorIn ~= "None" then
if Cast.UserData.LightningData.RandomizeBoltColorIn == "Whole" then
BoltSegment.Color = Cast.UserData.LightningData.RandomBoltColor
elseif Cast.UserData.LightningData.RandomizeBoltColorIn == "Segment" then
BoltSegment.Color = Color3.new(math.random(), math.random(), math.random())
end
else
BoltSegment.Color = Cast.UserData.LightningData.BoltColor
end
BoltSegment.Material = Cast.UserData.LightningData.BoltMaterial
BoltSegment.Reflectance = Cast.UserData.LightningData.BoltReflectance
BoltSegment.Transparency = Cast.UserData.LightningData.BoltTransparency
if i + 10 > Distance then
BoltSegment.CFrame = CFrame.new(Pos, End) * CFrame.new(0, 0, -(Pos - End).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
else
BoltSegment.CFrame = CFrame.new(Pos, FakeDistance.p) * CFrame.new(0, 0, -(Pos - FakeDistance.p).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
end
if i + 10 > Distance then
BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - End).Magnitude, Height) or Vector3.new((Pos - End).Magnitude, Height, Width)
else
BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - FakeDistance.p).Magnitude, Height) or Vector3.new((Pos - FakeDistance.p).Magnitude, Height, Width)
end
Thread:Delay(Cast.UserData.LightningData.BoltVisibleTime, function()
if Cast.UserData.LightningData.BoltFadeTime > 0 then
local DesiredSize = BoltSegment.Size * (Cast.UserData.LightningData.ScaleBolt and Vector3.new(1, Cast.UserData.LightningData.BoltScaleMultiplier, Cast.UserData.LightningData.BoltScaleMultiplier) or Vector3.new(1, 1, 1))
local Tween = TweenService:Create(BoltSegment, TweenInfo.new(Cast.UserData.LightningData.BoltFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
Tween:Play()
Tween.Completed:Wait()
if BoltSegment ~= nil then
Cache:ReturnPart(BoltSegment)
end
else
if BoltSegment ~= nil then
Cache:ReturnPart(BoltSegment)
end
end
end)
Pos = FakeDistance.p
end
end
end
end
end
if not Cast.UserData.Replicate and Cast.UserData.ClientModule.WhizSoundEnabled then
if not Cast.UserData.Whizzed then
local Mag = (Camera.CFrame.p - SegmentOrigin).Magnitude --(Camera.CFrame.p - CosmeticBulletObject.Position).Magnitude
if Mag < Cast.UserData.ClientModule.WhizDistance then
local WhizSound = Instance.new("Sound")
WhizSound.SoundId = "rbxassetid://"..Cast.UserData.ClientModule.WhizSoundIDs[math.random(1, #Cast.UserData.ClientModule.WhizSoundIDs)]
WhizSound.Volume = Cast.UserData.ClientModule.WhizSoundVolume
WhizSound.PlaybackSpeed = Random.new():NextNumber(Cast.UserData.ClientModule.WhizSoundPitchMin, Cast.UserData.ClientModule.WhizSoundPitchMax)
WhizSound.Name = "WhizSound"
WhizSound.Parent = SoundService
WhizSound:Play()
Debris:AddItem(WhizSound, WhizSound.TimeLength / WhizSound.PlaybackSpeed)
Cast.UserData.Whizzed = true
end
end
end
Cast.UserData.LastPosition = SegmentOrigin
if CosmeticBulletObject == nil then
return
end
CosmeticBulletObject.CFrame = TravelCFrame
end
local function OnRayTerminated(Cast, RaycastResult, IsDecayed)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer, true)
end
if Cast.UserData.BulletParticleData then
Cast.UserData.BulletParticleData.Attachment0:Destroy()
Cast.UserData.BulletParticleData.Attachment1:Destroy()
for _, effect in next, Cast.UserData.BulletParticleData.Effects do
effect:Destroy()
end
end
local CosmeticBulletObject = Cast.RayInfo.CosmeticBulletObject
if CosmeticBulletObject ~= nil then
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
if IsDecayed then
if Cast.UserData.DebrisData.DecayProjectile then
if DebrisCounts <= MaxDebrisCounts then
DebrisCounts += 1
local DecayProjectile = CosmeticBulletObject:Clone()
DecayProjectile.Name = "DecayProjectile"
DecayProjectile.CFrame = CosmeticBulletObject.CFrame
DecayProjectile.Anchored = Cast.UserData.DebrisData.AnchorDecay
DecayProjectile.CanCollide = Cast.UserData.DebrisData.CollideDecay
if not DecayProjectile.Anchored then
if Cast.UserData.DebrisData.VelocityInfluence then
DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * CurrentVelocity.Magnitude
else
DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * Cast.UserData.DebrisData.DecayVelocity
end
end
for _, v in pairs(DecayProjectile:GetDescendants()) do
if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
v.Enabled = false
elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
v.Enabled = false
elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
v.Enabled = false
elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
v.Enabled = false
elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
v:Stop()
end
end
DecayProjectile.Parent = Camera
Thread:Delay(5, function() --10
if DecayProjectile then
DecayProjectile:Destroy()
end
DebrisCounts -= 1
end)
end
end
else
if RaycastResult then
local HitPointObjectSpace = RaycastResult.Instance.CFrame:pointToObjectSpace(RaycastResult.Position)
if Cast.UserData.DebrisData.DebrisProjectile then
if DebrisCounts <= MaxDebrisCounts then
DebrisCounts += 1
local DebrisProjectile = CosmeticBulletObject:Clone()
DebrisProjectile.Name = "DebrisProjectile"
DebrisProjectile.CFrame = Cast.UserData.DebrisData.NormalizeDebris and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or (RaycastResult.Instance.CFrame * CFrame.new(HitPointObjectSpace, HitPointObjectSpace + RaycastResult.Instance.CFrame:vectorToObjectSpace(Cast.UserData.SegmentVelocity.Unit))) --CosmeticBulletObject.CFrame
DebrisProjectile.Anchored = Cast.UserData.DebrisData.AnchorDebris
DebrisProjectile.CanCollide = Cast.UserData.DebrisData.CollideDebris
if not DebrisProjectile.Anchored and Cast.UserData.DebrisData.BounceDebris then
local Direction = DebrisProjectile.CFrame.LookVector
local Reflect = Direction - (2 * Direction:Dot(RaycastResult.Normal) * RaycastResult.Normal)
DebrisProjectile.Velocity = Reflect * (Cast.UserData.DebrisData.BounceVelocity * (CurrentVelocity.Magnitude / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.BulletSpeed, Cast.UserData.ClientModule.BulletSpeed)))
DebrisProjectile.CFrame = CFrame.new(DebrisProjectile.Position, DebrisProjectile.Position + DebrisProjectile.Velocity)
end
for _, v in pairs(DebrisProjectile:GetDescendants()) do
if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
v.Enabled = false
elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
v.Enabled = false
elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
v.Enabled = false
elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
v.Enabled = false
elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
v:Stop()
end
end
DebrisProjectile.Parent = Camera
Thread:Delay(5, function() --10
if DebrisProjectile then
DebrisProjectile:Destroy()
end
DebrisCounts -= 1
end)
end
end
end
end
CosmeticBulletObject.Transparency = 1
for _, v in pairs(CosmeticBulletObject:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("BillboardGui") or v:IsA("SurfaceGui") then
v.Enabled = false
elseif v:IsA("Sound") then
v:Stop()
elseif v:IsA("Decal") or v:IsA("Texture") or v:IsA("BasePart") then
v.Transparency = 1
end
end
if Cast.UserData.CastBehavior.CosmeticBulletProvider ~= nil then
--Thread:Delay(5, function() -- 10
if CosmeticBulletObject ~= nil then
Cast.UserData.CastBehavior.CosmeticBulletProvider:ReturnPart(CosmeticBulletObject)
end
--end)
else
Debris:AddItem(CosmeticBulletObject, 5) -- 10
end
end
end
function ProjectileHandler:VisualizeHitEffect(Type, Hit, Position, Normal, Material, ClientModule, Misc, Replicate)
if Replicate then
VisualizeHitEffect:FireServer(Type, Hit, Position, Normal, Material, ClientModule, Misc)
end
local ShowEffects = CanShowEffects(Position)
if ShowEffects then
if Type == "Normal" then
MakeImpactFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate, true)
elseif Type == "Blood" then
MakeBloodFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate, true)
end
end
end
function ProjectileHandler:SimulateProjectile(Tool, Handle, VMHandle, ClientModule, CLDirections, SVDirections, FirePointObject, MuzzlePointObject, Misc, Replicate)
if ClientModule and Tool and Handle then
if FirePointObject then
if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
return
end
else
return
end
if Replicate then
VisualizeBullet:FireServer(Tool, Handle, VMHandle, ClientModule, CLDirections, SVDirections, FirePointObject, MuzzlePointObject, Misc)
end
local MuzzleObject = MuzzlePointObject
local Directions = SVDirections
if VMHandle ~= nil then
MuzzleObject = VMHandle:FindFirstChild("GunMuzzlePoint"..ClientModule.ModuleName)
Directions = CLDirections
end
if MuzzleObject then
if ClientModule.MuzzleFlashEnabled then
for i, v in pairs(Misc.MuzzleFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = MuzzleObject
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
Particle:Emit(Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
end
if ClientModule.MuzzleLightEnabled then
local Light = Instance.new("PointLight")
Light.Brightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightBrightness, ClientModule.LightBrightness)
Light.Color = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightColor, ClientModule.LightColor)
Light.Range = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightRange, ClientModule.LightRange)
Light.Shadows = ClientModule.LightShadows
Light.Enabled = true
Light.Parent = MuzzleObject
Debris:AddItem(Light, ClientModule.VisibleTime)
end
end
local Character = Tool.Parent
local IgnoreList = {Camera, Tool, Character}
local CastParams = RaycastParams.new()
CastParams.IgnoreWater = true
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.FilterDescendantsInstances = IgnoreList
local RegionParams = OverlapParams.new()
RegionParams.FilterType = Enum.RaycastFilterType.Blacklist
RegionParams.FilterDescendantsInstances = IgnoreList
RegionParams.MaxParts = 0
RegionParams.CollisionGroup = "Default"
ShootId += 1
local LaserTrails = {}
local UpdateLaserTrail
local LaserTrailEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailEnabled, ClientModule.LaserTrailEnabled)
local DamageableLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DamageableLaserTrail, ClientModule.DamageableLaserTrail)
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
UpdateLaserTrail = Instance.new("BindableEvent")
UpdateLaserTrail.Name = "UpdateLaserTrail_"..HttpService:GenerateGUID()
end
end
for _, Direction in pairs(Directions) do
if FirePointObject then
if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
return
end
else
return
end
local CFrm = FirePointObject.WorldCFrame
local Origin, Dir = FirePointObject.WorldPosition, Direction
if VMHandle ~= nil then
CFrm = VMHandle:FindFirstChild("GunFirePoint"..ClientModule.ModuleName).WorldCFrame
Origin = VMHandle:FindFirstChild("GunFirePoint"..ClientModule.ModuleName).WorldPosition
end
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart", 1)
local TipCFrame = CFrm
local TipPos = TipCFrame.Position
local TipDir = TipCFrame.LookVector
local AmountToCheatBack = math.abs((HumanoidRootPart.Position - TipPos):Dot(TipDir)) + 1
local GunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(GunRay, IgnoreList, false, true)
if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
Origin = HitPoint - TipDir.Unit * 0.1
--Dir = TipDir.Unit
end
local MyMovementSpeed = HumanoidRootPart.Velocity
local ModifiedBulletSpeed = (Dir * AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSpeed, ClientModule.BulletSpeed)) -- + MyMovementSpeed
local CosmeticPartProvider
local ProjectileContainer
local ProjectileType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ProjectileType, ClientModule.ProjectileType)
if ProjectileType ~= "None" then
local Projectile = Projectiles:FindFirstChild(ProjectileType)
if Projectile then
local Exist2 = false
for _, v in pairs(PartCacheStorage) do
if v.ProjectileName == Projectile.Name then
Exist2 = true
ProjectileContainer = Camera:FindFirstChild("ProjectileContainer_("..Projectile.Name..")")
CosmeticPartProvider = v.CosmeticPartProvider
break
end
end
if not Exist2 then
ProjectileContainer = Instance.new("Folder")
ProjectileContainer.Name = "ProjectileContainer_("..Projectile.Name..")"
ProjectileContainer.Parent = Camera
CosmeticPartProvider = PartCache.new(Projectile, 100, ProjectileContainer)
table.insert(PartCacheStorage, {
ProjectileName = Projectile.Name,
CosmeticPartProvider = CosmeticPartProvider
})
end
end
end
local PenetrationDepth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationDepth, ClientModule.PenetrationDepth)
local PenetrationAmount = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationAmount, ClientModule.PenetrationAmount)
local PenetrationData
if (PenetrationDepth > 0 or PenetrationAmount > 0) then
PenetrationData = {
PenetrationDepth = PenetrationDepth,
PenetrationAmount = PenetrationAmount,
PenetrationIgnoreDelay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationIgnoreDelay, ClientModule.PenetrationIgnoreDelay),
HitHumanoids = {},
}
end
local SpinX = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinX, ClientModule.SpinX)
local SpinY = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinY, ClientModule.SpinY)
local SpinZ = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinZ, ClientModule.SpinZ)
local BulletParticleData
if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletParticle, ClientModule.BulletParticle) then
local BulletType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletType, ClientModule.BulletType)
if BulletType ~= "None" then
local Attachment0 = Bullets[BulletType].Attachment0:Clone()
local Attachment1 = Bullets[BulletType].Attachment1:Clone()
local Effects = {}
Attachment0.Parent = Workspace.Terrain
Attachment1.Parent = Workspace.Terrain
for _, effect in next, Bullets[BulletType]:GetChildren() do
if effect:IsA("Beam") or effect:IsA("Trail") then
local eff = effect:Clone()
eff.Attachment0 = Attachment0 --Attachment1
eff.Attachment1 = Attachment1 --Attachment0
eff.Parent = Workspace.Terrain
table.insert(Effects, eff)
end
end
BulletParticleData = {
T0 = nil,
P0 = nil,
V0 = nil,
T1 = os.clock(),
P1 = CFrame.new().pointToObjectSpace(Camera.CFrame, Origin),
V1 = nil,
Attachment0 = Attachment0,
Attachment1 = Attachment1,
Effects = Effects,
MotionBlur = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.MotionBlur, ClientModule.MotionBlur),
BulletSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSize, ClientModule.BulletSize),
BulletBloom = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBloom, ClientModule.BulletBloom),
BulletBrightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBrightness, ClientModule.BulletBrightness),
}
end
end
local CastBehavior = FastCast.newBehavior()
CastBehavior.RaycastParams = CastParams
CastBehavior.TravelType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TravelType, ClientModule.TravelType)
CastBehavior.MaxDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Range, ClientModule.Range)
CastBehavior.Lifetime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Lifetime, ClientModule.Lifetime)
CastBehavior.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default
--CastBehavior.CosmeticBulletTemplate = CosmeticBullet -- Uncomment if you just want a simple template part and aren't using PartCache
CastBehavior.CosmeticBulletProvider = CosmeticPartProvider -- Comment out if you aren't using PartCache
CastBehavior.CosmeticBulletContainer = ProjectileContainer
CastBehavior.Acceleration = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Acceleration, ClientModule.Acceleration)
CastBehavior.AutoIgnoreContainer = false
CastBehavior.HitEventOnTermination = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitEventOnTermination, ClientModule.HitEventOnTermination)
CastBehavior.CanPenetrateFunction = CanRayPenetrate
CastBehavior.CanHitFunction = CanRayHit
local RaycastHitbox = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitbox, ClientModule.RaycastHitbox)
local RaycastHitboxData = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitboxData, ClientModule.RaycastHitboxData)
CastBehavior.RaycastHitbox = (RaycastHitbox and #RaycastHitboxData > 0) and RaycastHitboxData or nil
CastBehavior.CurrentCFrame = CFrame.new(Origin, Origin + Dir)
CastBehavior.ModifiedDirection = CFrame.new(Origin, Origin + Dir).LookVector
CastBehavior.Hitscan = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitscanMode, ClientModule.HitscanMode)
local LaserTrailId = HttpService:GenerateGUID()
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
table.insert(LaserTrails, {
Id = LaserTrailId,
LaserContainer = {},
HitHumanoids = {},
Terminate = false,
})
end
end
local BoltCFrameTable = {}
local LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled)
if LightningBoltEnabled then
local BoltRadius = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltRadius, ClientModule.BoltRadius)
for i = 1, AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltCount, ClientModule.BoltCount) do
if i == 1 then
table.insert(BoltCFrameTable, CFrame.new(0, 0, 0))
else
table.insert(BoltCFrameTable, CFrame.new(math.random(-BoltRadius, BoltRadius), math.random(-BoltRadius, BoltRadius), 0))
end
end
end
CastBehavior.UserData = {
ShootId = ShootId,
Tool = Tool,
Character = Character,
ClientModule = ClientModule,
Misc = Misc,
Replicate = Replicate,
PenetrationData = PenetrationData,
BulletParticleData = BulletParticleData,
LaserData = {
LaserTrailEnabled = LaserTrailEnabled,
LaserTrailWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailWidth, ClientModule.LaserTrailWidth),
LaserTrailHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailHeight, ClientModule.LaserTrailHeight),
LaserTrailColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailColor, ClientModule.LaserTrailColor),
RandomizeLaserColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeLaserColorIn, ClientModule.RandomizeLaserColorIn),
LaserTrailMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailMaterial, ClientModule.LaserTrailMaterial),
LaserTrailShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailShape, ClientModule.LaserTrailShape),
LaserTrailReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailReflectance, ClientModule.LaserTrailReflectance),
LaserTrailTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailTransparency, ClientModule.LaserTrailTransparency),
LaserTrailVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailVisibleTime, ClientModule.LaserTrailVisibleTime),
LaserTrailFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailFadeTime, ClientModule.LaserTrailFadeTime),
ScaleLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleLaserTrail, ClientModule.ScaleLaserTrail),
LaserTrailScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailScaleMultiplier, ClientModule.LaserTrailScaleMultiplier),
RandomLaserColor = Color3.new(math.random(), math.random(), math.random()),
LaserTrailId = LaserTrailId,
UpdateLaserTrail = UpdateLaserTrail,
LaserTrailContainer = {},
},
LightningData = {
LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled),
BoltWideness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWideness, ClientModule.BoltWideness),
BoltWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWidth, ClientModule.BoltWidth),
BoltHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltHeight, ClientModule.BoltHeight),
BoltColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltColor, ClientModule.BoltColor),
RandomizeBoltColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeBoltColorIn, ClientModule.RandomizeBoltColorIn),
BoltMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltMaterial, ClientModule.BoltMaterial),
BoltShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltShape, ClientModule.BoltShape),
BoltReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltReflectance, ClientModule.BoltReflectance),
BoltTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltTransparency, ClientModule.BoltTransparency),
BoltVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltVisibleTime, ClientModule.BoltVisibleTime),
BoltFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltFadeTime, ClientModule.BoltFadeTime),
ScaleBolt = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleBolt, ClientModule.ScaleBolt),
BoltScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltScaleMultiplier, ClientModule.BoltScaleMultiplier),
RandomBoltColor = Color3.new(math.random(), math.random(), math.random()),
BoltCFrameTable = BoltCFrameTable,
},
SpinData = {
CanSpinPart = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CanSpinPart, ClientModule.CanSpinPart),
SpinX = SpinX,
SpinY = SpinY,
SpinZ = SpinZ,
InitalTick = os.clock(),
InitalAngularVelocity = Vector3.new(SpinX, SpinY, SpinZ),
InitalRotation = (CastBehavior.CurrentCFrame - CastBehavior.CurrentCFrame.p),
ProjectileOffset = Vector3.new(),
},
DebrisData = {
DebrisProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DebrisProjectile, ClientModule.DebrisProjectile),
AnchorDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDebris, ClientModule.AnchorDebris),
CollideDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDebris, ClientModule.CollideDebris),
NormalizeDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NormalizeDebris, ClientModule.NormalizeDebris),
BounceDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceDebris, ClientModule.BounceDebris),
BounceVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceVelocity, ClientModule.BounceVelocity),
DecayProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayProjectile, ClientModule.DecayProjectile),
AnchorDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDecay, ClientModule.AnchorDecay),
CollideDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDecay, ClientModule.CollideDecay),
DecayVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayVelocity, ClientModule.DecayVelocity),
VelocityInfluence = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.VelocityInfluence, ClientModule.VelocityInfluence),
DisableDebrisContents = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DisableDebrisContents, ClientModule.DisableDebrisContents),
},
BounceData = {
CurrentBounces = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RicochetAmount, ClientModule.RicochetAmount),
BounceElasticity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceElasticity, ClientModule.BounceElasticity),
FrictionConstant = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.FrictionConstant, ClientModule.FrictionConstant),
IgnoreSlope = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.IgnoreSlope, ClientModule.IgnoreSlope),
SlopeAngle = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SlopeAngle, ClientModule.SlopeAngle),
BounceHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceHeight, ClientModule.BounceHeight),
NoExplosionWhileBouncing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NoExplosionWhileBouncing, ClientModule.NoExplosionWhileBouncing),
StopBouncingOn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.StopBouncingOn, ClientModule.StopBouncingOn),
SuperRicochet = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SuperRicochet, ClientModule.SuperRicochet),
BounceBetweenHumanoids = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceBetweenHumanoids, ClientModule.BounceBetweenHumanoids),
PredictDirection = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PredictDirection, ClientModule.PredictDirection),
BouncedHumanoids = {},
},
HomeData = {
Homing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Homing, ClientModule.Homing),
HomingDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomingDistance, ClientModule.HomingDistance),
TurnRatePerSecond = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TurnRatePerSecond, ClientModule.TurnRatePerSecond),
HomeThroughWall = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomeThroughWall, ClientModule.HomeThroughWall),
LockOnOnHovering = ClientModule.LockOnOnHovering,
LockedEntity = Misc.LockedEntity,
},
UpdateData = {
UpdateRayInExtra = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.UpdateRayInExtra, ClientModule.UpdateRayInExtra),
ExtraRayUpdater = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExtraRayUpdater, ClientModule.ExtraRayUpdater),
},
IgnoreList = IgnoreList,
LastSegmentOrigin = Vector3.new(),
SegmentOrigin = Vector3.new(),
SegmentDirection = Vector3.new(),
SegmentVelocity = Vector3.new(),
LastPosition = Origin,
CastBehavior = CastBehavior,
Whizzed = false,
}
local Simulate = Caster:Fire(Origin, Dir, ModifiedBulletSpeed, CastBehavior)
end
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
if UpdateLaserTrail then
UpdateLaserTrail.Event:Connect(function(Id, LaserContainer, Terminate)
for _, v in pairs(LaserTrails) do
if v.Id == Id then
v.LaserContainer = LaserContainer
if Terminate then
v.Terminate = true
end
break
end
end
end)
end
local Connection
Connection = RunService.Heartbeat:Connect(function(dt)
if #LaserTrails <= 0 then
if UpdateLaserTrail then
UpdateLaserTrail:Destroy()
end
if Connection then
Connection:Disconnect()
Connection = nil
end
else
for i, v in next, LaserTrails, nil do
local Terminated = false
if v.Terminate then
if #v.LaserContainer <= 0 then
Terminated = true
table.remove(LaserTrails, i)
end
end
if not Terminated then
for _, vv in pairs(v.LaserContainer) do
if vv then
local TouchingParts = Workspace:GetPartsInPart(vv, RegionParams)
for _, part in pairs(TouchingParts) do
if part and part.Parent then
local Target = part:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or part.Parent:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Parent ~= Character and TargetTorso then
if TargetHumanoid.Health > 0 then
if not table.find(v.HitHumanoids, TargetHumanoid) then
table.insert(v.HitHumanoids, TargetHumanoid)
Thread:Spawn(function()
InflictTarget:InvokeServer("GunLaser", Tool, ClientModule, TargetHumanoid, TargetTorso, part, part.Size, Misc)
end)
if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
Tool.GunClient.MarkerEvent:Fire(ClientModule, false)
end
if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailConstantDamage, ClientModule.LaserTrailConstantDamage) then
Thread:Delay(AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailDamageRate, ClientModule.LaserTrailDamageRate), function()
local Index = table.find(v.HitHumanoids, TargetHumanoid)
if Index then
table.remove(v.HitHumanoids, Index)
end
end)
end
end
end
end
end
end
end
end
end
end
end
end)
end
end
end
end
Caster.RayFinalHit:Connect(OnRayFinalHit)
Caster.RayHit:Connect(OnRayHit)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)
return ProjectileHandler
|
-- Customization |
AntiTK = false; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
MouseSense = 0.5;
CanAim = true; -- Allows player to aim
CanBolt = true; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
LaserAttached = true;
LightAttached = true;
TracerEnabled = true;
SprintSpeed = 22.5;
CanCallout = false;
SuppressCalloutChance = 0;
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 411 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 8000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 4500
Tune.PeakSharpness = 2.8
Tune.CurveMult = 0.2
--Incline Compensation
Tune.InclineComp = 2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 100 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = .01 -- Percent throttle at idle
Tune.ClutchTol = 300 -- Clutch engagement threshold (higher = faster response)
|
--[[script.Parent.Activated:Connect(function()
-- the anim plays
anim:Play()
end)]] | -- this is your choice
script.Parent.Unequipped:Connect(function() -- do this function
anim:Stop() -- the anim stop playing
end)
|
--------------------------------------------------- |
This = script.Parent
Elevator = This.Parent.Parent.Parent.Parent.Parent
Characters = require(script.Characters)
CustomLabel = require(Elevator.CustomLabel)
CustomText = CustomLabel["CUSTOMFLOORLABEL"]
This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Floor").Changed:connect(function(floor)
--custom indicator code--
ChangeFloor(tostring(floor))
end)
function ChangeFloor(SF)
if CustomText[tonumber(SF)] then
SF = CustomText[tonumber(SF)]
end
SetDisplay(2,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))
SetDisplay(3,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end
function SetDisplay(ID,CHAR)
if This.Display:FindFirstChild("Matrix"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
for r=1,5 do
This.Display["Matrix"..ID]["Row"..i]["D"..r].Visible = (l:sub(r,r) == "1" and true or false)
end
end
end
end
for M = 1, Displays do
for R = 1, 7 do
for D = 1, 5 do
This.Display["Matrix"..M]["Row"..R]["D"..D].BackgroundColor3 = DisplayColor
end
end
end
|
------------------------------------------------------------
--\Doors Update
------------------------------------------------------------ |
local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local CAS = game:GetService("ContextActionService")
local mDistance = 5
local Key = nil
function getNearest()
local nearest = nil
local minDistance = mDistance
local Character = Player.Character or Player.CharacterAdded:Wait()
for I,Door in pairs (DoorsFolder:GetChildren()) do
if Door.Door:FindFirstChild("Knob") ~= nil then
local distance = (Door.Door.Knob.Position - Character.Torso.Position).magnitude
if distance < minDistance then
nearest = Door
minDistance = distance
end
end
end
--print(nearest)
return nearest
end
function Interact(actionName, inputState, inputObj)
if inputState ~= Enum.UserInputState.Begin then return end
local nearestDoor = getNearest()
local Character = Player.Character or Player.CharacterAdded:Wait()
if nearestDoor == nil then return end
if (nearestDoor.Door.Knob.Position - Character.Torso.Position).magnitude <= mDistance then
if nearestDoor ~= nil then
if nearestDoor:FindFirstChild("RequiresKey") then
Key = nearestDoor.RequiresKey.Value
else
Key = nil
end
Evt.DoorEvent:FireServer(nearestDoor,1,Key)
end
end
end
function GetNearest(parts, maxDistance,Part)
local closestPart
local minDistance = maxDistance
for _, partToFace in ipairs(parts) do
local distance = (Part.Position - partToFace.Position).magnitude
if distance < minDistance then
closestPart = partToFace
minDistance = distance
end
end
return closestPart
end
CAS:BindAction("Interact", Interact, false, Enum.KeyCode.G)
Evt.Rappel.PlaceEvent.OnClientEvent:Connect(function(Parte)
local Alinhar = Instance.new('AlignOrientation')
Alinhar.Parent = Parte
Alinhar.PrimaryAxisOnly = true
Alinhar.RigidityEnabled = true
Alinhar.Attachment0 = Character.HumanoidRootPart.RootAttachment
Alinhar.Attachment1 = Camera.BasePart.Attachment
end)
print("ACS 1.7.5 R15 Loaded!")
|
--[=[
Yields until the promise is complete, and errors if an error
exists, otherwise returns the fulfilled results.
@yields
@return T
]=] |
function Promise:Wait()
if self._fulfilled then
return unpack(self._fulfilled, 1, self._valuesLength)
elseif self._rejected then
return error(tostring(self._rejected[1]), 2)
else
local bindable = Instance.new("BindableEvent")
self:Then(function()
bindable:Fire()
end, function()
bindable:Fire()
end)
bindable.Event:Wait()
bindable:Destroy()
if self._rejected then
return error(tostring(self._rejected[1]), 2)
else
return unpack(self._fulfilled, 1, self._valuesLength)
end
end
end
|
--Combat loop |
core.spawn(function()
while myHuman.Health > 0 do
if target and target.Parent and target.Parent.Humanoid.Health>0 and core.checkSight(target) and engineRunning and core.checkDist(myRoot,target) < 300 then
--Keeps track of our last attack so we don't update the target within 5 seconds of attacking
lastAttack = tick()
--Prioritizes weapon based on enemy type--
if target.Parent:GetExtentsSize().Magnitude > 10 then
munition = combat.engageVehicle(munition,target)
else
munition = combat.engageLight(munition,target)
end
else
--Aims M230 and Hydra to a neutral position when not in combat
combat.resetM230()
combat.resetHydra()
end
wait(0.1)
end
end)
|
------------------------- |
function onClicked()
R.Function1.Disabled = true
R.Function2.Disabled = false
R.BrickColor = BrickColor.new("CGA brown")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Variable to store the previous search text |
local previousSearchText = ""
|
-- Current UI layout |
local CurrentLayout;
function ChangeLayout(Layout)
-- Sets the UI to the given layout
-- Make sure the new layout isn't already set
if CurrentLayout == Layout then
return;
end;
-- Set this as the current layout
CurrentLayout = Layout;
-- Reset the UI
for _, ElementName in pairs(UIElements) do
local Element = UI[ElementName];
Element.Visible = false;
end;
-- Keep track of the total vertical extents of all items
local Sum = 0;
-- Go through each layout element
for ItemIndex, ItemName in ipairs(Layout) do
local Item = UI[ItemName];
-- Make the item visible
Item.Visible = true;
-- Position this item underneath the past items
Item.Position = UDim2.new(0, 0, 0, 20) + UDim2.new(
Item.Position.X.Scale,
Item.Position.X.Offset,
0,
Sum + 10
);
-- Update the sum of item heights
Sum = Sum + 10 + Item.AbsoluteSize.Y;
end;
-- Resize the container to fit the new layout
UI.Size = UDim2.new(0, 200, 0, 30 + Sum);
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not UI then
return;
end;
-- Get the textures in the selection
local Textures = GetTextures(TextureTool.Type, TextureTool.Face);
-- References to UI elements
local ImageIdInput = UI.ImageIDOption.TextBox;
local TransparencyInput = UI.TransparencyOption.Input.TextBox;
-----------------------
-- Update the UI layout
-----------------------
-- Get the plural version of the current texture type
local PluralTextureType = TextureTool.Type .. 's';
-- Figure out the necessary UI layout
if #Selection.Parts == 0 then
ChangeLayout(Layouts.EmptySelection);
return;
-- When the selection has no textures
elseif #Textures == 0 then
ChangeLayout(Layouts.NoTextures);
return;
-- When only some selected items have textures
elseif #Selection.Parts ~= #Textures then
ChangeLayout(Layouts['Some' .. PluralTextureType]);
-- When all selected items have textures
elseif #Selection.Parts == #Textures then
ChangeLayout(Layouts['All' .. PluralTextureType]);
end;
------------------------
-- Update UI information
------------------------
-- Get the common properties
local ImageId = Support.IdentifyCommonProperty(Textures, 'Texture');
local Transparency = Support.IdentifyCommonProperty(Textures, 'Transparency');
-- Update the common inputs
UpdateDataInputs {
[ImageIdInput] = ImageId and ParseAssetId(ImageId) or ImageId or '*';
[TransparencyInput] = Transparency and Support.Round(Transparency, 3) or '*';
};
-- Update texture-specific information on UI
if TextureTool.Type == 'Texture' then
-- Get texture-specific UI elements
local RepeatXInput = UI.RepeatOption.XInput.TextBox;
local RepeatYInput = UI.RepeatOption.YInput.TextBox;
-- Get texture-specific common properties
local RepeatX = Support.IdentifyCommonProperty(Textures, 'StudsPerTileU');
local RepeatY = Support.IdentifyCommonProperty(Textures, 'StudsPerTileV');
-- Update inputs
UpdateDataInputs {
[RepeatXInput] = RepeatX and Support.Round(RepeatX, 3) or '*';
[RepeatYInput] = RepeatY and Support.Round(RepeatY, 3) or '*';
};
end;
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
function ParseAssetId(Input)
-- Returns the intended asset ID for the given input
-- Get the ID number from the input
local Id = tonumber(Input)
or tonumber(Input:lower():match('%?id=([0-9]+)'))
or tonumber(Input:match('/([0-9]+)/'))
or tonumber(Input:lower():match('rbxassetid://([0-9]+)'));
-- Return the ID
return Id;
end;
function SetFace(Face)
-- Update the tool option
TextureTool.Face = Face;
-- Update the UI
FaceDropdown.SetOption(Face and Face.Name or '*');
end;
function SetTextureType(TextureType)
-- Update the tool option
TextureTool.Type = TextureType;
-- Update the UI
Core.ToggleSwitch(TextureType, UI.ModeOption);
UI.AddButton.Button.Text = 'ADD ' .. TextureType:upper();
UI.RemoveButton.Button.Text = 'REMOVE ' .. TextureType:upper();
end;
function SetProperty(TextureType, Face, Property, Value)
-- Make sure the given value is valid
if not Value then
return;
end;
-- Start a history record
TrackChange();
-- Go through each texture
for _, Texture in pairs(GetTextures(TextureType, Face)) do
-- Store the state of the texture before modification
table.insert(HistoryRecord.Before, { Part = Texture.Parent, TextureType = TextureType, Face = Face, [Property] = Texture[Property] });
-- Create the change request for this texture
table.insert(HistoryRecord.After, { Part = Texture.Parent, TextureType = TextureType, Face = Face, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function SetTextureId(TextureType, Face, AssetId)
-- Sets the textures in the selection to the intended, given image asset
-- Make sure the given asset ID is valid
if not AssetId then
return;
end;
-- Prepare the change request
local Changes = {
Texture = 'rbxassetid://' .. AssetId;
};
-- Attempt an image extraction on the given asset
Core.Try(Core.SyncAPI.Invoke, Core.SyncAPI, 'ExtractImageFromDecal', AssetId)
:Then(function (ExtractedImage)
Changes.Texture = 'rbxassetid://' .. ExtractedImage;
end);
-- Start a history record
TrackChange();
-- Go through each texture
for _, Texture in pairs(GetTextures(TextureType, Face)) do
-- Create the history change requests for this texture
local Before, After = { Part = Texture.Parent, TextureType = TextureType, Face = Face }, { Part = Texture.Parent, TextureType = TextureType, Face = Face };
-- Gather change information to finish up the history change requests
for Property, Value in pairs(Changes) do
Before[Property] = Texture[Property];
After[Property] = Value;
end;
-- Store the state of the texture before modification
table.insert(HistoryRecord.Before, Before);
-- Create the change request for this texture
table.insert(HistoryRecord.After, After);
end;
-- Register the changes
RegisterChange();
end;
function AddTextures(TextureType, Face)
-- Prepare the change request for the server
local Changes = {};
-- Go through the selection
for _, Part in pairs(Selection.Parts) do
-- Make sure this part doesn't already have a texture of the same type
local HasTextures;
for _, Child in pairs(Part:GetChildren()) do
if Child.ClassName == TextureType and Child.Face == Face then
HasTextures = true;
end;
end;
-- Queue a texture to be created for this part, if not already existent
if not HasTextures then
table.insert(Changes, { Part = Part, TextureType = TextureType, Face = Face });
end;
end;
-- Send the change request to the server
local Textures = Core.SyncAPI:Invoke('CreateTextures', Changes);
-- Put together the history record
local HistoryRecord = {
Textures = Textures;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the textures
Core.SyncAPI:Invoke('Remove', Record.Textures);
end;
Apply = function (Record)
-- Reapplies this change
-- Restore the textures
Core.SyncAPI:Invoke('UndoRemove', Record.Textures);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function RemoveTextures(TextureType, Face)
-- Get all the textures in the selection
local Textures = GetTextures(TextureType, Face);
-- Create the history record
local HistoryRecord = {
Textures = Textures;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Restore the textures
Core.SyncAPI:Invoke('UndoRemove', Record.Textures);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
Apply = function (Record)
-- Reapplies this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the textures
Core.SyncAPI:Invoke('Remove', Record.Textures);
end;
};
-- Send the removal request
Core.SyncAPI:Invoke('Remove', Textures);
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncTexture', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncTexture', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncTexture', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
--[[**
ensures value is an array and all values of the array match check
@param check The check to compare all values with
@returns A function that will return true iff the condition is passed
**--]] |
function t.array(check)
assert(t.callback(check))
local valuesCheck = t.values(check)
return function(value)
local keySuccess, keyErrMsg = arrayKeysCheck(value)
if keySuccess == false then
return false, string.format("[array] %s", keyErrMsg or "")
end
-- # is unreliable for sparse arrays
-- Count upwards using ipairs to avoid false positives from the behavior of #
local arraySize = 0
for _ in ipairs(value) do
arraySize = arraySize + 1
end
for key in pairs(value) do
if key < 1 or key > arraySize then
return false, string.format("[array] key %s must be sequential", tostring(key))
end
end
local valueSuccess, valueErrMsg = valuesCheck(value)
if not valueSuccess then
return false, string.format("[array] %s", valueErrMsg or "")
end
return true
end
end
|
--[[
TODO: Slash, three swing string. Swing 1 is 0.00 to 0.27, swing 2 is 0.27 to 0.5, swing 3 is 0.5 to 1.0
]] | |
--Load Nexus VR Character Model. |
NexusVRCharacterModelModule:SetConfiguration(Configuration)
NexusVRCharacterModelModule:Load()
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
local l__CurrentTarget__2 = script.Parent.CurrentTarget;
local l__PetsFrame__1 = script.Parent.PetsFrame;
function resetFrame()
for v6, v7 in pairs(l__PetsFrame__1.Frame:GetChildren())do
if v7.Name ~= "UICorner" then
for v11, v12 in pairs(v7.PetView:GetChildren()) do
v12:Destroy();
end;
v7.Percentage.Text = "";
v7.Rarity.Text = "";
v7.ImageColor3 = Color3.fromRGB(25, 25, 25);
end;
end;
end;
local u2 = require(l__ReplicatedStorage__1.Pets.Eggs);
local l__CostLabel__3 = script.Parent.CostLabel;
local l__Models__4 = l__ReplicatedStorage__1.Pets.Models;
l__CurrentTarget__2:GetPropertyChangedSignal("Value"):Connect(function()
if l__CurrentTarget__2.Value == "None" then
resetFrame();
return;
end;
local v13 = u2[l__CurrentTarget__2.Value];
local l__Currency__14 = v13.Currency;
local v15 = 0;
local v16 = {};
for v17, v18 in pairs(v13.Pets) do
v16[#v16 + 1] = {
Name = v18.Name,
Type = v18.Type,
Rarity = v18.Rarity,
Secret = v18.Secret
};
v15 = v15 + v18.Rarity;
end;
l__CostLabel__3.CurrencyImage.Image = l__ReplicatedStorage__1.Pets.Settings:FindFirstChild(l__Currency__14 .. "Image").Value;
l__CostLabel__3.TextLabel.Text = v13.Cost;
table.sort(v16, function(p1, p2)
return p2.Rarity < p1.Rarity;
end);
if l__Currency__14 ~= "R$" then
script.Parent.BuyButtonR.Visible = true;
script.Parent.BuyButtonT.Visible = true;
script.Parent.BuyButtonE.Size = script.Parent.BuyButtonR.Size;
else
script.Parent.BuyButtonR.Visible = false;
script.Parent.BuyButtonT.Visible = false;
script.Parent.BuyButtonE.Size = script.Parent.CostLabel.Size;
end;
resetFrame();
for v19, v20 in pairs(v16) do
if v20.Secret == false then
local l__Name__21 = v20.Name;
local v22 = l__Models__4:FindFirstChild(l__Name__21):FindFirstChild(v20.Type):Clone();
local v23 = l__PetsFrame__1.Frame:FindFirstChild("Slot" .. v19);
local l__PetView__24 = v23.PetView;
local v25 = math.floor(v20.Rarity / v15 * 10000) / 100;
local l__Value__26 = l__Models__4:FindFirstChild(l__Name__21).Settings.Rarity.Value;
local l__Value__27 = l__ReplicatedStorage__1.Pets.Rarities:FindFirstChild(l__Value__26).Color.Value;
local v28 = Instance.new("Camera", l__PetView__24);
local v29 = Vector3.new(0, 0, 0);
l__PetView__24.CurrentCamera = v28;
v22:SetPrimaryPartCFrame(CFrame.new(v29));
v22.Parent = l__PetView__24;
v23.Percentage.Text = v25 .. "%";
v23.Rarity.Text = l__Value__26;
v23.Rarity.TextColor3 = l__Value__27;
v23.ImageColor3 = Color3.fromRGB(55, 55, 55);
spawn(function()
local v30 = 180;
while wait() and v22.Parent ~= nil do
v28.CFrame = CFrame.Angles(0, math.rad(v30), 0) * CFrame.new(v29 + Vector3.new(0, 0, 3), v29 + Vector3.new(0, 0, 0));
v30 = v30 + 1;
end;
end);
end;
end;
end);
|
-- Setup a list of audio ID's and properties to use. (These values can be changed as needed) | |
-- DefaultValue for spare ammo |
local SpareAmmo = 1000 |
--- Gives `Character` the 'Amount' of silver in the bag, returns true if it was successful.
---@param Amount number
---@param Character Model
---@return boolean |
local function GiveSilver(Amount: number, Character: Model): boolean
--// One thing I noticed about this function is that the names of variables were.. Odd.
--// The target is to make anyone be able to see the function and the algorithm just clicks.
--// So you know, define the prefab, make sure your names are pretty self-explantory but not 'ToolToGive', etc etc.
local Player = game.Players:GetPlayerFromCharacter(Character)
if (not Player) then
return false
end
Player.Data.Silver.Value += Amount
return true
end
|
----------------------------------
------------FUNCTIONS-------------
---------------------------------- |
ContentProvider:PreloadAsync(workspace.Scripts.MainModule:GetDescendants())
function SetSounds(sounds)
ContentProvider:PreloadAsync(workspace.Scripts.MainModule:GetDescendants())
LocalSounds = sounds
end
function PlayNoteSound(note, source, range, sounds, vol, SpecialPiano)
local pitch = 1
if note > 61 then
pitch = 1.059463 ^ (note - 61)
elseif note < 1 then
pitch = 1.059463 ^ (-(1 - note))
end
note = note > 61 and 61 or note < 1 and 1 or note
local note2 = (note - 1)%12 + 1 -- Which note? (1-12)
local octave = math.ceil(note/12) -- Which octave?
local offset = (16 * (octave - 1) + 8 * (1 - note2%2))
local sound = math.ceil(note2/2) -- Which audio?
local audio = Instance.new("Sound", SoundFolder) -- Create the audio
audio.SoundId = "https://roblox.com/asset/?id="..((sounds and sounds[sound]) or LocalSounds[sound]) -- Give its sound
if source then
local a = 1/range^2
local distance = (game.Workspace.CurrentCamera.CoordinateFrame.p - source).magnitude
local volume = -a*distance^2 + 1
if volume < 0.01 then
audio:remove()
return
end
audio.Volume = volume * vol
else
audio.Volume = Volume;
end
if fade then
delay(0.75, function()
for i = 1, 5 do
audio.Volume = audio.Volume * 0.75
wait(0.1)
end
audio:Stop()
audio:Destroy()
end)
end
audio.TimePosition = offset + ((SpecialPiano or specialPiano) and 0.04 or (octave - .9)/15) -- set the time position
audio.Pitch = pitch
audio:Play() -- Play the audio
table.insert(ExistingSounds, 1, audio)
if #ExistingSounds >= 15 then
ExistingSounds[15]:Stop() -- limit the number of playing sounds!
ExistingSounds[15] = nil
end
delay(5, function() audio:Stop() audio:remove() end ) -- remove the audio in 4 seconds, enough time for it to play
end
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]] | --
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(15);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=13;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.013;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end; |
--////////////////////////////// Include
--////////////////////////////////////// |
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
local commandModules = clientChatModules:WaitForChild("CommandModules")
local WhisperModule = require(commandModules:WaitForChild("Whisper"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
local ChatLocalization = nil
pcall(function() ChatLocalization = require(game:GetService("Chat").ClientChatModules.ChatLocalization) end)
if ChatLocalization == nil then ChatLocalization = {} function ChatLocalization:Get(key,default) return default end end
local FFlagUserChatNewMessageLengthCheck2 do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserChatNewMessageLengthCheck2")
end)
FFlagUserChatNewMessageLengthCheck2 = success and result
end
|
--//Value Info//-- |
script.Assets.Screen.StockUI.VehicleName.Text = VehicleName
vholder = Instance.new("Folder")
vholder.Name = "Storage"
vholder.Parent = script.Assets.Screen
vexternal = Instance.new("Folder")
vexternal.Name = "Storage"
vexternal.Parent = script.Parent
vname = Instance.new("StringValue")
vname.Parent = vholder
vname.Name = "CarName"
vname.Value = VehicleName
vhorsepower = Instance.new("NumberValue")
vhorsepower.Parent = vholder
vhorsepower.Name = "EngineHorsepower"
vhorsepower.Value = Horsepower
vdisplacement = Instance.new("NumberValue")
vdisplacement.Parent = vholder
vdisplacement.Name = "EngineDisplacement"
vdisplacement.Value = EngineDisplacement
vtirefl = Instance.new("NumberValue", vexternal)
vtirefl.Value = 0.59999999999999998
vtirefl.Name = "HeatFL"
vtirefr = Instance.new("NumberValue", vexternal)
vtirefr.Value = 0.59999999999999998
vtirefr.Name = "HeatFR"
vtirerl = Instance.new("NumberValue", vexternal)
vtirerl.Value = 0.59999999999999998
vtirerl.Name = "HeatRL"
vtirerr = Instance.new("NumberValue", vexternal)
vtirerr.Value = 0.59999999999999998
vtirerr.Name = "HeatRR"
venginetype = Instance.new("StringValue")
venginetype.Parent = vholder
venginetype.Name = "EngineType"
venginetype.Value = EngineType
vforcedinduction = Instance.new("StringValue")
vforcedinduction.Parent = vholder
vforcedinduction.Name = "InductionType"
vforcedinduction.Value = ForcedInduction
vinduction = Instance.new("NumberValue")
vinduction.Parent = vholder
vinduction.Name = "TurboSize"
if ForcedInduction == "Natural" then
vinduction = 0
else
vinduction.Value = InductionPartSize
end
vdrivetrain = Instance.new("StringValue")
vdrivetrain.Parent = vholder
vdrivetrain.Name = "Drivetrain"
vdrivetrain.Value = Drivetrain
vtorquesplit = Instance.new("NumberValue")
vtorquesplit.Parent = vexternal
vtorquesplit.Name = "TorqueSplit"
vtorquesplit.Value = TorqueSplit
vdff = Instance.new("NumberValue")
vdff.Parent = vexternal
vdff.Name = "DownforceF"
vdff.Value = DownforceF
vdfr = Instance.new("NumberValue")
vdfr.Parent = vexternal
vdfr.Name = "DownforceR"
vdfr.Value = DownforceR
vFdifferential = Instance.new("NumberValue")
vFdifferential.Parent = vholder
vFdifferential.Name = "FDifferential"
vFdifferential.Value = DifferentialF
vRdifferential = Instance.new("NumberValue")
vRdifferential.Parent = vholder
vRdifferential.Name = "RDifferential"
vRdifferential.Value = DifferentialR
vgears = Instance.new("NumberValue")
vgears.Parent = vholder
vgears.Name = "AmountOfGears"
if EngineType == "Electric" or TransmissionType == "CVT" then
vgears.Value = 1
else
vgears.Value = AmountOfGears
end
vautoflip = Instance.new("BoolValue")
vautoflip.Parent = vholder
vautoflip.Name = "Autoflip"
vautoflip.Value = AUTO_FLIP
vdecay = Instance.new("NumberValue")
vdecay.Parent = vholder
vdecay.Name = "RPMDecay"
vdecay.Value = RevDecay
vtrans = Instance.new("StringValue")
vtrans.Parent = vholder
vtrans.Name = "TransmissionType"
vtrans.Value = TransmissionType
vmanual = Instance.new("BoolValue")
vmanual.Parent = vholder
vmanual.Name = "ManualOnly"
vmanual.Value = ManualOnly
vautoclutch = Instance.new("BoolValue")
vautoclutch.Parent = vholder
vautoclutch.Name = "AutoClutch"
vmode = Instance.new("StringValue")
vmode.Parent = vexternal
vmode.Value = Mode
vmode.Name = "Mode"
if TransmissionType == "HPattern" then
vautoclutch.Value = false
else
vautoclutch.Value = true
end
vclutch = Instance.new("BoolValue")
vclutch.Parent = vholder
vclutch.Name = "Clutch"
vclutch.Value = true
vclutch2 = Instance.new("NumberValue")
vclutch2.Parent = vclutch
vclutch2.Name = "Clutch"
vclutch2.Value = 1
vbrakebias = Instance.new("NumberValue")
vbrakebias.Parent = vexternal
vbrakebias.Name = "BrakeBias"
vbrakebias.Value = BrakeBias
vbrakepower = Instance.new("NumberValue")
vbrakepower.Parent = vexternal
vbrakepower.Name = "BrakePower"
vbrakepower.Value = BrakePower
vabs = Instance.new("BoolValue")
vabs.Parent = vexternal
vabs.Name = "ABS"
vabs.Value = ABS
vtc = Instance.new("BoolValue")
vtc.Parent = vexternal
vtc.Name = "TC"
vtc.Value = TC
vasc = Instance.new("BoolValue")
vasc.Parent = vexternal
vasc.Name = "ASC"
vasc.Value = ActiveStabilityControl
vhb = Instance.new("BoolValue")
vhb.Parent = vexternal
vhb.Name = "Handbrake"
vhb.Value = false
vChb = Instance.new("BoolValue")
vChb.Parent = vhb
vChb.Name = "Computer"
vChb.Value = false
vUhb = Instance.new("BoolValue")
vUhb.Parent = vhb
vUhb.Name = "User"
vUhb.Value = false
vsteeringlock = Instance.new("NumberValue")
vsteeringlock.Parent = vexternal
vsteeringlock.Name = "SteeringAngle"
vsteeringlock.Value = SteeringAngle+5
vtirefront = Instance.new("NumberValue")
vtirefront.Parent = vholder
vtirefront.Name = "TireCompoundFront"
vtirefront.Value = TiresFront
vtirerear = Instance.new("NumberValue")
vtirerear.Parent = vholder
vtirerear.Name = "TireCompoundRear"
vtirerear.Value = TiresRear
vgear1 = Instance.new("NumberValue")
vgear1.Parent = vholder
vgear1.Name = "Gear1"
if EngineType == "Electric" then
vgear1.Value = 4
else
vgear1.Value = Gear1
end
vgear2 = Instance.new("NumberValue")
vgear2.Parent = vholder
vgear2.Name = "Gear2"
vgear2.Value = Gear2
vgear3 = Instance.new("NumberValue")
vgear3.Parent = vholder
vgear3.Name = "Gear3"
vgear3.Value = Gear3
vgear4 = Instance.new("NumberValue")
vgear4.Parent = vholder
vgear4.Name = "Gear4"
vgear4.Value = Gear4
vgear5 = Instance.new("NumberValue")
vgear5.Parent = vholder
vgear5.Name = "Gear5"
vgear5.Value = Gear5
vgear6 = Instance.new("NumberValue")
vgear6.Parent = vholder
vgear6.Name = "Gear6"
vgear6.Value = Gear6
vgear7 = Instance.new("NumberValue")
vgear7.Parent = vholder
vgear7.Name = "Gear7"
vgear7.Value = Gear7
vgear8 = Instance.new("NumberValue")
vgear8.Parent = vholder
vgear8.Name = "Gear8"
vgear8.Value = Gear8
vfinal = Instance.new("NumberValue")
vfinal.Parent = vexternal
vfinal.Name = "FinalDrive"
vfinal.Value = 6.08 - FinalDrive
vidle = Instance.new("NumberValue")
vidle.Parent = vholder
vidle.Name = "EngineIdle"
vidle.Value = EngineIdle+RevDecay
vdyno = Instance.new("BoolValue")
vdyno.Parent = script.Parent
vdyno.Name = "Dyno"
vdyno.Value = false
vboost = Instance.new("NumberValue")
vboost.Parent = vholder
vboost.Name = "Boost"
vboost.Value = 0
vepitch = Instance.new("NumberValue")
vepitch.Parent = script.Assets.Screen
vepitch.Name = "ePitch"
vepitch.Value = enginePitchAdjust
vsteerspeed = Instance.new("NumberValue")
vsteerspeed.Parent = vholder
vsteerspeed.Name = "SteerSpeed"
vsteerspeed.Value = SteerSpeed
vipitch = Instance.new("NumberValue")
vipitch.Parent = script.Assets.Screen
vipitch.Name = "iPitch"
vipitch.Value = idlePitchAdjust
vredline = Instance.new("NumberValue")
vredline.Parent = vholder
vredline.Name = "EngineRedline"
vredline.Value = EngineRedline
vmaxl = Instance.new("NumberValue")
vmaxl.Parent = vholder
vmaxl.Name = "MaxLength"
vmaxl.Value = minL
vminl = Instance.new("NumberValue")
vminl.Parent = vholder
vminl.Name = "MinLength"
vminl.Value = maxL
sturbo = Instance.new("Sound")
sturbo.Parent = engine
sturbo.Name = "Turbo"
sturbo.MaxDistance = 12000
sturbo.EmitterSize = InductionPartSize
sturbo.Volume = turbovolume
if InductionPartSize ~= 0 then
sturbo.SoundId = TurboSound
else
sturbo.SoundId = 0
end
sturbo = Instance.new("NumberValue")
sturbo.Parent = engine
sturbo.Name = "TurboSV"
sturbo.Value = turbovolume
ssupercharger = Instance.new("Sound")
ssupercharger.Parent = engine
ssupercharger.Name = "Supercharger"
ssupercharger.MaxDistance = 12000
ssupercharger.EmitterSize = InductionPartSize
ssupercharger.Volume = superchargervolume
ssupercharger.SoundId = SuperchargerSound
sidle = Instance.new("Sound")
sidle.Parent = diff
sidle.Name = "Idle"
sidle.MaxDistance = 12000
sidle.EmitterSize = 3
sidle.Volume = 0
sidle:Play()
sidle.Looped = true
sengine = Instance.new("Sound")
sengine.Parent = diff
sengine.Name = "Engine"
sengine.MaxDistance = 12000
sengine.EmitterSize = 6
sengine.Volume = 1
sengine:Play()
sengine.Looped = true
sengine.Volume = 0
sefengine = Instance.new("ReverbSoundEffect")
sefengine.DecayTime = 0.3
sefengine.Density = 1
sefengine.Diffusion = 1
sefengine.DryLevel = 3
sefengine.WetLevel = -6
sintake = Instance.new("Sound")
sintake.Parent = engine
sintake.Name = "Intake"
sintake.MaxDistance = 4000
sintake.EmitterSize = 2
sintake:Play()
sintake.Looped = true
sintake.Volume = 1
sintake.Pitch = 0
if EngineType == "Electric" then
sengine.SoundId = "http://www.roblox.com/asset/?id=359277436"
IdleSound = "http://www.roblox.com/asset/?id=359277436"
sidle.SoundId = "http://www.roblox.com/asset/?id=359277436"
else
sengine.SoundId = EngineSound
sintake.SoundId = "http://www.roblox.com/asset/?id=255444016"
sidle.SoundId = IdleSound
end
shorn = Instance.new("Sound")
shorn.Parent = script.Parent
shorn.Name = "Horn"
shorn.MaxDistance = 12000
shorn.EmitterSize = 8
shorn.Volume = hornvolume
shorn.SoundId = HornSound
swind = Instance.new("Sound")
swind.Parent = script.Parent
swind.Name = "Wind"
swind.MaxDistance = 12000
swind.EmitterSize = 4
swind.Volume = 0
swind.Pitch = 1
swind.Looped = true
swind.SoundId = "http://www.roblox.com/asset/?id=188608071"
sbsqueal = Instance.new("Sound")
sbsqueal.Parent = diff
sbsqueal.Name = "Brakes"
sbsqueal.MaxDistance = 12000
sbsqueal.EmitterSize = 2
sbsqueal.Volume = 0
sbsqueal.Pitch = 0
sbsqueal.Looped = true
sbsqueal.SoundId = "http://www.roblox.com/asset/?id=185857550"
sblow = Instance.new("Sound")
sblow.Parent = engine
sblow.Name = "Blowoff"
sblow.MaxDistance = 12000
sblow.EmitterSize = 5
sblow.Volume = 0
sblow.Pitch = 0.8
sblow.Looped = false
sblow.SoundId = "http://www.roblox.com/asset/?id=208085141"
sstartup = Instance.new("Sound")
sstartup.Parent = engine
sstartup.Name = "Startup"
sstartup.MaxDistance = 1000
sstartup.EmitterSize = 13
sstartup.Volume = startupvolume
if EngineType == "Electric" then
sstartup.SoundId = "http://www.roblox.com/asset/?id=402899121"
sstartup.Pitch = 2
else
sstartup.SoundId = StartupSound
sstartup.Pitch = 1.1
efstartup = Instance.new("FlangeSoundEffect")
efstartup.Parent = sstartup
ef2startup = Instance.new("DistortionSoundEffect")
efstartup.Parent = sstartup
ef2startup.Level = 0.25
end
sradio = Instance.new("Sound")
sradio.Parent = script.Parent
sradio.Name = "Radio"
sradio.MaxDistance = 400
sradio.EmitterSize = 1
sradio.Volume = 0.4
sspool = Instance.new("Sound")
sspool.Parent = engine
sspool.Name = "Spool"
sspool.Pitch = 0
if ForcedInduction == "Supercharger" then
sspool.SoundId = SuperchargerSound
else
sspool.SoundId = "rbxassetid://234458445"
end
sspool.MaxDistance = 12000
sspool.EmitterSize = 2
sspool.Looped = true
sreverse = Instance.new("Sound")
sreverse.Parent = trans
sreverse.Name = "Reverse"
sreverse.SoundId = SuperchargerSound
sreverse.MaxDistance = 12000
sreverse.EmitterSize = 1
sreverse.Pitch = 0
sreverse.Looped = true
veaj = Instance.new("NumberValue")
veaj.Parent = diff
veaj.Name = "adjuster"
veaj.Value = enginevolume
vstartuplength = Instance.new("NumberValue")
vstartuplength.Parent = vholder
vstartuplength.Name = "startuplength"
vstartuplength.Value = startuplength
vrideheightf = Instance.new("NumberValue")
vrideheightf.Parent = vexternal
vrideheightf.Name = "FrontRideHeight"
vrideheightf.Value = RideHeightFront
vrideheightr = Instance.new("NumberValue")
vrideheightr.Parent = vexternal
vrideheightr.Name = "RearRideHeight"
vrideheightr.Value = RideHeightRear
vstifff = Instance.new("NumberValue")
vstifff.Parent = vexternal
vstifff.Name = "FrontStiffness"
vstifff.Value = StiffnessFront
vmode = Instance.new("BoolValue")
vmode.Parent = vexternal
vmode.Name = "Automatic"
if TransmissionType ~= "HPattern" and TransmissionType ~= "CVT" then
vmode.Value = true
else
vmode.Value = false
end
vstiffr = Instance.new("NumberValue")
vstiffr.Parent = vexternal
vstiffr.Name = "RearStiffness"
vstiffr.Value = StiffnessRear
vrollf = Instance.new("NumberValue")
vrollf.Parent = vexternal
vrollf.Name = "AntirollFront"
vrollf.Value = AntiRollFront
vrollr = Instance.new("NumberValue")
vrollr.Parent = vexternal
vrollr.Name = "AntirollRear"
vrollr.Value = AntiRollRear
vcamberf = Instance.new("NumberValue")
vcamberf.Parent = vexternal
vcamberf.Name = "CamberFront"
vcamberf.Value = CamberFront
vcamberr = Instance.new("NumberValue")
vcamberr.Parent = vexternal
vcamberr.Name = "CamberRear"
vcamberr.Value = CamberRear
venginerpm = Instance.new("NumberValue")
venginerpm.Parent = vholder
venginerpm.Name = "EngineRPM"
vgearboxrpm = Instance.new("NumberValue")
vgearboxrpm.Parent = vholder
vgearboxrpm.Name = "GearboxRPM"
vlimiter = Instance.new("NumberValue")
vlimiter.Parent = vholder
vlimiter.Name = "Limiter"
if ElectronicallyLimited == true then
vlimiter.Value = LimitSpeedValue
else
vlimiter.Value = 1000000
end
vrpm = Instance.new("NumberValue")
vrpm.Parent = vholder
vrpm.Name = "RPM"
vthrottle = Instance.new("NumberValue")
vthrottle.Parent = vholder
vthrottle.Name = "Throttle"
vthrottleV = Instance.new("NumberValue")
vthrottleV.Parent = vthrottle
vthrottleV.Name = "Throttle"
currentgear = Instance.new("NumberValue")
currentgear.Parent = vholder
currentgear.Name = "CurrentGear"
if TransmissionType == "HPattern" then
currentgear.Value = 3
else
currentgear.Value = 1
end
vcontrol = Instance.new("StringValue")
vcontrol.Parent = vholder
vcontrol.Name = "Control"
vcontrol.Value = "Keyboard"
vsteer = Instance.new("NumberValue")
vsteer.Parent = vholder
vsteer.Name = "Steer"
vbrake = Instance.new("NumberValue")
vbrake.Parent = vholder
vbrake.Name = "Brake"
|
-- Simulate a raycast by one tick. |
local function SimulateCast(cast: ActiveCast, delta: number, expectingShortCall: boolean)
assert(cast.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
PrintDebug("Casting for frame.")
local latestTrajectory = cast.StateInfo.Trajectories[#cast.StateInfo.Trajectories]
local origin = latestTrajectory.Origin
local totalDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
local initialVelocity = latestTrajectory.InitialVelocity
local acceleration = latestTrajectory.Acceleration
local lastPoint = GetPositionAtTime(totalDelta, origin, initialVelocity, acceleration)
local lastVelocity = GetVelocityAtTime(totalDelta, initialVelocity, acceleration)
local lastDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
cast.StateInfo.TotalRuntime += delta
-- Recalculate this.
totalDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
local currentTarget = GetPositionAtTime(totalDelta, origin, initialVelocity, acceleration)
local segmentVelocity = GetVelocityAtTime(totalDelta, initialVelocity, acceleration)
local totalDisplacement = currentTarget - lastPoint -- This is the displacement from where the ray was on the last from to where the ray is now.
local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta
local targetWorldRoot = cast.RayInfo.WorldRoot
local resultOfCast = targetWorldRoot:Raycast(lastPoint, rayDir, cast.RayInfo.Parameters)
local point = currentTarget
local part: Instance? = nil
local material = Enum.Material.Air
local normal = Vector3.new()
if (resultOfCast ~= nil) then
point = resultOfCast.Position
part = resultOfCast.Instance
material = resultOfCast.Material
normal = resultOfCast.Normal
end
local rayDisplacement = (point - lastPoint).Magnitude
-- For clarity -- totalDisplacement is how far the ray would have traveled if it hit nothing,
-- and rayDisplacement is how far the ray really traveled (which will be identical to totalDisplacement if it did indeed hit nothing)
SendLengthChanged(cast, lastPoint, rayDir.Unit, rayDisplacement, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast.StateInfo.DistanceCovered += rayDisplacement
local rayVisualization: ConeHandleAdornment? = nil
if (delta > 0) then
rayVisualization = DbgVisualizeSegment(CFrame.new(lastPoint, lastPoint + rayDir), rayDisplacement)
end
-- HIT DETECTED. Handle all that garbage, and also handle behaviors 1 and 2 (default behavior, go high res when hit) if applicable.
-- CAST BEHAVIOR 2 IS HANDLED IN THE CODE THAT CALLS THIS FUNCTION.
if part and part ~= cast.RayInfo.CosmeticBulletObject then
local start = tick()
PrintDebug("Hit something, testing now.")
-- SANITY CHECK: Don't allow the user to yield or run otherwise extensive code that takes longer than one frame/heartbeat to execute.
if (cast.RayInfo.CanPierceCallback ~= nil) then
if expectingShortCall == false then
if (cast.StateInfo.IsActivelySimulatingPierce) then
cast:Terminate()
error("ERROR: The latest call to CanPierceCallback took too long to complete! This cast is going to suffer desyncs which WILL cause unexpected behavior and errors. Please fix your performance problems, or remove statements that yield (e.g. wait() calls)")
-- Use error. This should absolutely abort the cast.
end
end
-- expectingShortCall is used to determine if we are doing a forced resolution increase, in which case this will be called several times in a single frame, which throws this error.
cast.StateInfo.IsActivelySimulatingPierce = true
end
------------------------------
if cast.RayInfo.CanPierceCallback == nil or (cast.RayInfo.CanPierceCallback ~= nil and cast.RayInfo.CanPierceCallback(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject) == false) then
PrintDebug("Piercing function is nil or it returned FALSE to not pierce this hit.")
cast.StateInfo.IsActivelySimulatingPierce = false
if (cast.StateInfo.HighFidelityBehavior == 2 and latestTrajectory.Acceleration ~= Vector3.new() and cast.StateInfo.HighFidelitySegmentSize ~= 0) then
cast.StateInfo.CancelHighResCast = false -- Reset this here.
if cast.StateInfo.IsActivelyResimulating then
cast:Terminate()
error("Cascading cast lag encountered! The caster attempted to perform a high fidelity cast before the previous one completed, resulting in exponential cast lag. Consider increasing HighFidelitySegmentSize.")
end
cast.StateInfo.IsActivelyResimulating = true
-- This is a physics based cast and it needs to be recalculated.
PrintDebug("Hit was registered, but recalculation is on for physics based casts. Recalculating to verify a real hit...")
-- Split this ray segment into smaller segments of a given size.
-- In 99% of cases, it won't divide evently (e.g. I have a distance of 1.25 and I want to divide into 0.1 -- that won't work)
-- To fix this, the segments need to be stretched slightly to fill the space (rather than having a single shorter segment at the end)
local numSegmentsDecimal = rayDisplacement / cast.StateInfo.HighFidelitySegmentSize -- say rayDisplacement is 5.1, segment size is 0.5 -- 10.2 segments
local numSegmentsReal = math.floor(numSegmentsDecimal) -- 10 segments + 0.2 extra segments
local realSegmentLength = rayDisplacement / numSegmentsReal -- this spits out 0.51, which isn't exact to the defined 0.5, but it's close
local timeIncrement = delta / numSegmentsReal
for segmentIndex = 1, numSegmentsReal do
if cast.StateInfo.CancelHighResCast then
cast.StateInfo.CancelHighResCast = false
break
end
local subPosition = GetPositionAtTime(lastDelta + (timeIncrement * segmentIndex), origin, initialVelocity, acceleration)
local subVelocity = GetVelocityAtTime(lastDelta + (timeIncrement * segmentIndex), initialVelocity, acceleration)
local subRayDir = subVelocity * delta
local subResult = targetWorldRoot:Raycast(subPosition, subRayDir, cast.RayInfo.Parameters)
local subDisplacement = (subPosition - (subPosition + subVelocity)).Magnitude
if (subResult ~= nil) then
local subDisplacement = (subPosition - subResult.Position).Magnitude
local dbgSeg = DbgVisualizeSegment(CFrame.new(subPosition, subPosition + subVelocity), subDisplacement)
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.286275, 0.329412, 0.247059) end
if cast.RayInfo.CanPierceCallback == nil or (cast.RayInfo.CanPierceCallback ~= nil and cast.RayInfo.CanPierceCallback(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject) == false) then
cast.StateInfo.IsActivelyResimulating = false
SendRayHit(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
local vis = DbgVisualizeHit(CFrame.new(point), false)
if (vis ~= nil) then vis.Color3 = Color3.new(0.0588235, 0.87451, 1) end
return
else
SendRayPierced(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject)
local vis = DbgVisualizeHit(CFrame.new(point), true)
if (vis ~= nil) then vis.Color3 = Color3.new(1, 0.113725, 0.588235) end
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.305882, 0.243137, 0.329412) end
end
else
local dbgSeg = DbgVisualizeSegment(CFrame.new(subPosition, subPosition + subVelocity), subDisplacement)
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.286275, 0.329412, 0.247059) end
end
end
cast.StateInfo.IsActivelyResimulating = false
elseif (cast.StateInfo.HighFidelityBehavior ~= 1 and cast.StateInfo.HighFidelityBehavior ~= 3) then
cast:Terminate()
error("Invalid value " .. (cast.StateInfo.HighFidelityBehavior) .. " for HighFidelityBehavior.")
else
PrintDebug("Hit was successful. Terminating.")
SendRayHit(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
DbgVisualizeHit(CFrame.new(point), false)
return
end
else
PrintDebug("Piercing function returned TRUE to pierce this part.")
if rayVisualization ~= nil then
rayVisualization.Color3 = Color3.new(0.4, 0.05, 0.05)
end
DbgVisualizeHit(CFrame.new(point), true)
local params = cast.RayInfo.Parameters
local alteredParts = {}
local currentPierceTestCount = 0
local originalFilter = params.FilterDescendantsInstances
local brokeFromSolidObject = false
while true do
if resultOfCast.Instance:IsA("Terrain") then
if material == Enum.Material.Water then
cast:Terminate()
error("Do not add Water as a piercable material. If you need to pierce water, set cast.RayInfo.Parameters.IgnoreWater = true instead", 0)
end
warn("WARNING: The pierce callback for this cast returned TRUE on Terrain! This can cause severely adverse effects.")
end
if params.FilterType == Enum.RaycastFilterType.Exclude then
local filter = params.FilterDescendantsInstances
table.insert(filter, resultOfCast.Instance)
table.insert(alteredParts, resultOfCast.Instance)
params.FilterDescendantsInstances = filter
else
local filter = params.FilterDescendantsInstances
table.removeObject(filter, resultOfCast.Instance)
table.insert(alteredParts, resultOfCast.Instance)
params.FilterDescendantsInstances = filter
end
SendRayPierced(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
resultOfCast = targetWorldRoot:Raycast(lastPoint, rayDir, params)
if resultOfCast == nil then
break
end
if currentPierceTestCount >= MAX_PIERCE_TEST_COUNT then
warn("WARNING: Exceeded maximum pierce test budget for a single ray segment (attempted to test the same segment " .. MAX_PIERCE_TEST_COUNT .. " times!)")
break
end
currentPierceTestCount = currentPierceTestCount + 1;
if cast.RayInfo.CanPierceCallback(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject) == false then
brokeFromSolidObject = true
break
end
end
cast.RayInfo.Parameters.FilterDescendantsInstances = originalFilter
cast.StateInfo.IsActivelySimulatingPierce = false
if brokeFromSolidObject then
PrintDebug("Broke because the ray hit something solid (" .. tostring(resultOfCast.Instance) .. ") while testing for a pierce. Terminating the cast.")
SendRayHit(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
DbgVisualizeHit(CFrame.new(resultOfCast.Position), false)
return
end
end
end
if (cast.StateInfo.DistanceCovered >= cast.RayInfo.MaxDistance) then
cast:Terminate()
DbgVisualizeHit(CFrame.new(currentTarget), false)
end
end
|
-- Connections |
game.Players.PlayerAdded:Connect(function(player)
DataStore:Load(player)
end)
game.Players.PlayerRemoving:Connect(saveOnExit)
game:BindToClose(function()
for _, player in ipairs(game.Players:GetPlayers()) do
saveOnExit(player)
end
end)
return DataStore
|
--[=[
Destroys the timer.
]=] |
function Timer:Destroy()
self.Tick:Destroy()
self:Stop()
end
return Timer
|
--// Firemode Shot Customization |
BurstNum = 3; -- How many bullets per burst
ShotNum = 5; -- How many bullets per shot
|
--[[Transmission]] |
Tune.TransModes = {"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 = "RPM" --[[
[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)
Tune.ShiftTime = 0 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 3.21 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 5.000 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.519 ,
--[[ 2 ]] 2.320 ,
--[[ 3 ]] 1.700 ,
--[[ 4 ]] 1.400 ,
--[[ 5 ]] 0.907 ,
}
Tune.FDMult = 1.3 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--Load the Nexus VR Character Model module. |
local NexusVRCharacterModelModule
local MainModule = script:FindFirstChild("MainModule")
if MainModule then
NexusVRCharacterModelModule = require(MainModule)
else
NexusVRCharacterModelModule = require(6052374981)
end
|
-- Remove back accessories since they frequently block the camera |
local function isBackAccessory(instance)
if instance and instance:IsA("Accessory") then
local handle = instance:WaitForChild("Handle", 5)
if handle and handle:IsA("Part") then
local bodyBackAttachment = handle:WaitForChild("BodyBackAttachment", 5)
if bodyBackAttachment and bodyBackAttachment:IsA("Attachment") then
return true
end
local waistBackAttachment = handle:WaitForChild("WaistBackAttachment", 5)
if waistBackAttachment and waistBackAttachment:IsA("Attachment") then
return true
end
end
end
return false
end
local function removeBackAccessoriesFromCharacter(character)
for _, child in ipairs(character:GetChildren()) do
coroutine.wrap(function()
if isBackAccessory(child) then
child:Destroy()
end
end)()
end
end
local descendantAddedConnection = nil
local function onCharacterAdded(character)
removeBackAccessoriesFromCharacter(character)
descendantAddedConnection = character.DescendantAdded:Connect(function(descendant)
coroutine.wrap(function()
if isBackAccessory(descendant) then
descendant:Destroy()
end
end)()
end)
end
local function onCharacterRemoving(character)
if descendantAddedConnection then
descendantAddedConnection:Disconnect()
descendantAddedConnection = nil
end
end
|
--[=[
This allows the storage of subscriptions for keys, such that something
can subscribe onto a key, and events can be invoked onto keys.
@class ObservableSubscriptionTable
]=] |
local require = require(script.Parent.loader).load(script)
local Observable = require("Observable")
local ObservableSubscriptionTable = {}
ObservableSubscriptionTable.ClassName = "ObservableSubscriptionTable"
ObservableSubscriptionTable.__index = ObservableSubscriptionTable
function ObservableSubscriptionTable.new()
local self = setmetatable({}, ObservableSubscriptionTable)
self._subMap = {} -- { TKey: Subscription<TEmit> }
return self
end
|
-- Overrides Keyboard:UpdateJump() because jump is handled in OnRenderStepped |
function ClickToMove:UpdateJump()
-- Nothing to do (handled in OnRenderStepped)
end
|
--- Toggles Cmdr window |
function Cmdr:Toggle ()
if not self.Enabled then
return self:Hide()
end
Interface.Window:SetVisible(not Interface.Window:IsVisible())
end
|
-- << RETRIEVE FRAMEWORK >> |
local main = _G.HDAdminMain
local settings = main.settings
|
------------------------------------------- |
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-0.5,1,-1) * CFrame.fromEulerAnglesXYZ(math.rad(-90),0,0) --Right leg
arms[2].Name = "RDave"
arms[2].CanCollide = true
welds[2] = weld2 |
--Main Control------------------------------------------------------------------------ |
SideLight1 = script.Parent.SideLight1
SideLight1A = script.Parent.SideLight1A
SideLight2 = script.Parent.SideLight2
SideLight2A = script.Parent.SideLight2A
Red1 = script.Parent.Red1.Lamp.Light
Red1A = script.Parent.Red1A.Lamp.Light
Red2 = script.Parent.Red2.Lamp.Light
Red2A = script.Parent.Red2A.Lamp.Light
DRed1 = script.Parent.Red1.DynamicLight
DRed1A = script.Parent.Red1A.DynamicLight
DRed2 = script.Parent.Red2.DynamicLight
Ded2A = script.Parent.Red2A.DynamicLight
while true do
wait()
if Signal.Value == false then
SideLight1.Material = "SmoothPlastic"
SideLight1A.Material = "SmoothPlastic"
SideLight2.Material = "SmoothPlastic"
SideLight2A.Material = "SmoothPlastic"
SideLight1.BrickColor = BrickColor.new(1003)
SideLight1A.BrickColor = BrickColor.new(1003)
SideLight2.BrickColor = BrickColor.new(1003)
SideLight2A.BrickColor = BrickColor.new(1003)
Red1.Visible = false
Red1A.Visible = false
Red2.Visible = false
Red2A.Visible = false
DRed1.Enabled = false
DRed1A.Enabled = false
DRed2.Enabled = false
Ded2A.Enabled = false
else
if Flash.Value == true then
SideLight1.Material = "Neon"
SideLight1A.Material = "SmoothPlastic"
SideLight2.Material = "Neon"
SideLight2A.Material = "SmoothPlastic"
SideLight1.BrickColor = BrickColor.new(1004)
SideLight1A.BrickColor = BrickColor.new(1003)
SideLight2.BrickColor = BrickColor.new(1004)
SideLight2A.BrickColor = BrickColor.new(1003)
Red1.Visible = true
Red1A.Visible = false
Red2.Visible = true
Red2A.Visible = false
DRed1.Enabled = true
DRed1A.Enabled = false
DRed2.Enabled = true
Ded2A.Enabled = false
else
SideLight1.Material = "SmoothPlastic"
SideLight1A.Material = "Neon"
SideLight2.Material = "SmoothPlastic"
SideLight2A.Material = "Neon"
SideLight1.BrickColor = BrickColor.new(1003)
SideLight1A.BrickColor = BrickColor.new(1004)
SideLight2.BrickColor = BrickColor.new(1003)
SideLight2A.BrickColor = BrickColor.new(1004)
Red1.Visible = false
Red1A.Visible = true
Red2.Visible = false
Red2A.Visible = true
DRed1.Enabled = false
DRed1A.Enabled = true
DRed2.Enabled = false
Ded2A.Enabled = true
end
end
end
|
-- Create sound variables |
local id
local volume
local playbackSpeed
|
--//Script |
Plaka()
CarColor()
Stats.Locked.Changed:Connect(function()
ToogleLock(Stats.Locked.Value)
end)
Stats.Color.Changed:Connect(function()
CarColor()
end)
Fuel = script.Parent.Parent.Stats.Fuel
MainPart = script.Parent.Parent.Body.Main
while wait(.5) do
if oldpos == nil then
oldpos = MainPart.Position
else
newpos = MainPart.Position
Fuel.Value = Fuel.Value - (oldpos - newpos).Magnitude/150
oldpos = newpos
end
end
|
--Don't touch anything in this script unless you know what you're doing |
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Parent.Open.Visible=true
script.Parent.Parent.Visible=false
end)
|
--//Player//-- |
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
|
-- Function to update the text label with the Core's size |
local function UpdateLabel()
local coreSize = core.Size
textLabel.Text = "Core Size: " .. tostring(coreSize)
end
|
--// Ammo Settings |
Ammo = 1;
StoredAmmo = 1;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 0;
|
-- Camera Shake Presets
-- Stephen Leitnick
-- February 26, 2018 | |
--[=[
Gets whatever object is stored with the given index, if it exists. This was added since Maid allows getting the task using `__index`.
```lua
local Obliterator = Janitor.new()
Obliterator:Add(workspace.Baseplate, "Destroy", "Baseplate")
print(Obliterator:Get("Baseplate")) -- Returns Baseplate.
```
```ts
import { Workspace } from "@rbxts/services";
import { Janitor } from "@rbxts/janitor";
const Obliterator = new Janitor<{ Baseplate: Part }>();
Obliterator.Add(Workspace.FindFirstChild("Baseplate") as Part, "Destroy", "Baseplate");
print(Obliterator.Get("Baseplate")); // Returns Baseplate.
```
@param Index any -- The index that the object is stored under.
@return any? -- This will return the object if it is found, but it won't return anything if it doesn't exist.
]=] |
function Janitor:Get(Index: any): any?
local This = self[IndicesReference]
if This then
return This[Index]
else
return nil
end
end
|
--ClickFunctions |
local Size0 = Vector3.new(0.175, 1, 1)
local Size1 = Vector3.new(0.1, 1, 1)
local Material0 = "Metal"
local Material1 = "Neon"
local Min = 0
local Max = 9 |
--Engine-- |
script.Parent.Parent.Values.RPM.Changed:connect(function()
local HP = StockHP
local Horsepower = _Tune.Horsepower
local Boost = (((totalPSI/2)*WasteGatePressure)*(CompressionRatio/10)*TurboCount)
local B2 = (Boost)/7.5
local B3 = HP*B2
local B4 = B3/2
_Tune.Horsepower = (HP) + (B4)
end)
|
--//Character//-- |
local Character = script.Parent
|
-- See if the game is Team or FFA |
IsTeams = FetchConfiguration:FireServer("TEAMS")
|
-- Implements Javascript's `Array.prototype.reduce` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce |
local function reduce(array: Array, callback: Function, initialValue: any?): any
if typeof(array) ~= "table" then
error(string.format("Array.reduce called on %s", typeof(array)))
end
if typeof(callback) ~= "function" then
error("callback is not a function")
end
local length = #array
local value
local initial = 1
if initialValue ~= nil then
value = initialValue
else
initial = 2
if length == 0 then
error("reduce of empty array with no initial value")
end
value = array[1]
end
for i = initial, length do
value = callback(value, array[i], i, array)
end
return value
end
return reduce
|
-- ====================
-- BULLET VISUALIZER
-- Enabled the gun to display a fake travelling bullet
-- ==================== |
VisualizerEnabled = true;
BulletSpeed = 25;
BulletSize = Vector3.new(0.25,0.25,100);
BulletColor = BrickColor.new("White");
BulletTransparency = 0.25;
BulletMaterial = Enum.Material.Neon;
FadeTime = 0.25; --Only work when bullet travel instantly. For this, you have to set BulletSpeed to "math.huge"
|
--- An expensive way to spawn a function. However, unlike spawn(), it executes on the same frame, and
-- unlike coroutines, does not obscure errors
-- @module fastSpawn |
return function(func, ...)
local args = {...}
local count = select("#", ...)
local bindable = Instance.new("BindableEvent")
bindable.Event:Connect(function()
func(unpack(args, 1, count))
end)
bindable:Fire()
bindable:Destroy()
end
|
--[[ The Module ]] | --
local BaseCharacterController = {}
BaseCharacterController.__index = BaseCharacterController
function BaseCharacterController.new()
local self = setmetatable({}, BaseCharacterController)
self.enabled = false
self.moveVector = ZERO_VECTOR3
self.moveVectorIsCameraRelative = true
self.isJumping = false
return self
end
function BaseCharacterController:OnRenderStepped(dt)
-- By default, nothing to do
end
function BaseCharacterController:GetMoveVector()
return self.moveVector
end
function BaseCharacterController:IsMoveVectorCameraRelative()
return self.moveVectorIsCameraRelative
end
function BaseCharacterController:GetIsJumping()
return self.isJumping
end
|
--[[Standardized Values: Don't touch unless needed]] |
--[WEIGHT // Cubic stud : pounds ratio]
Tune.WeightScaling = 1/50 --Default = 1/50 (1 cubic stud = 50 lbs)
Tune.LegacyScaling = 1/10 --Default = 1/10 (1 cubic stud = 10 lbs) [PGS OFF]
--[ENGINE // Caching]
Tune.CurveCache = true --Default = true (Caches the engine and boost curves)
Tune.CacheInc = 100 --Default = 100 (How many points the curve will have.)
--[[Examples: 1 = every RPM increment [will freeze your computer at low settings like this],
100 = default and recommended,
1000 or more = death ]]
return Tune
|
--SoundPurge |
function SoundPurge()
local Sound = script.Parent.Parent.BeltSet.SoundMain
wait(2)
Sound.PlaybackSpeed = 0.2
wait(0.4)
Sound.PlaybackSpeed = 0
end
SoundPurge()
RCMAddress.Contactors.Blower:GetPropertyChangedSignal("Value"):Connect(function()
script.Parent.BlowerOn.Value = RCMAddress.Contactors.Blower.Value
end)
RunCycle = false
CompleteStop = true
script.Parent.BlowerOn.Changed:Connect(function()
if CompleteStop == true and script.Parent.BlowerOn.Value == true then
CompleteStop = false
--script.Parent.Parent.BeltSet.MotorStart:Play()
repeat wait()
if SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.On.Value == true then
if script.Parent.BlowerOn.Value == true and script.Parent.Parent.BeltSet.Sound.PlaybackSpeed > 0 then
local pitch = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed
local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.7)/250,0.0004,0.07)
--local formula = math.clamp(math.log(pitch+0.0001,0.7)/250,0.0004,0.07)
script.Parent.Parent.BeltSet.Sound.PlaybackSpeed = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed - formula
elseif script.Parent.BlowerOn.Value == false and script.Parent.Parent.BeltSet.Sound.PlaybackSpeed < 1 then
local pitch = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed
local formula = math.clamp(math.log(pitch+0.0001,0.7)/250,0.0004,0.07)
--local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.7)/250,0.0004,0.07)
--print(math.abs(pitch-1))
script.Parent.Parent.BeltSet.Sound.PlaybackSpeed = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed + formula
end
else
if script.Parent.BlowerOn.Value == true and script.Parent.Parent.BeltSet.Sound.PlaybackSpeed > 0 then
local pitch = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed
local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.7)/250,0.0004,0.07)
--local formula = math.clamp(math.log(pitch+0.0001,0.7)/250,0.0004,0.07)
script.Parent.Parent.BeltSet.Sound.PlaybackSpeed = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed - formula
elseif script.Parent.BlowerOn.Value == false and script.Parent.Parent.BeltSet.Sound.PlaybackSpeed > 0 then
local pitch = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed
local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.7)/250,0.0004,0.07)
--local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.7)/250,0.0004,0.07)
--print(math.abs(pitch-1))
script.Parent.Parent.BeltSet.Sound.PlaybackSpeed = script.Parent.Parent.BeltSet.Sound.PlaybackSpeed - formula
end
end
until CompleteStop == true
end
end)
LobeSet1 = script.Parent.Parent.Sutorbilt4MBlower.MovingParts.Set1Motor.HingeConstraint
LobeSet2 = script.Parent.Parent.Sutorbilt4MBlower.MovingParts.Set2Motor.HingeConstraint
BlowerMotor = script.Parent.Parent.BlowerMotor.Motor.HingeConstraint
function Rotate()
LobeSet1.AngularVelocity = -script.Parent.CurrentBlowerSpeed.Value/.01
LobeSet2.AngularVelocity = script.Parent.CurrentBlowerSpeed.Value/.01
BlowerMotor.AngularVelocity = -script.Parent.CurrentBlowerSpeed.Value/.01
end
PlayAudio = false
function playAudio()
if PlayAudio == false then
PlayAudio = true
script.Parent.Parent.BeltSet.SoundMain:Play()
script.Parent.Parent.BeltSet.MotorStart.Volume = 0.5
wait(0.1)
if SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.On.Value == false then
SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.RollOffMaxDistance = 0
SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.RollOffMinDistance = 0
end
end
end
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == true then
playAudio()
RunCycle = true
repeat game:GetService("RunService").Heartbeat:wait()
script.Parent.CurrentBlowerSpeed.Value = script.Parent.CurrentBlowerSpeed.Value + 0.06
script.Parent.Parent.BeltSet.SoundMain.PlaybackSpeed = script.Parent.CurrentBlowerSpeed.Value
Rotate()
until script.Parent.CurrentBlowerSpeed.Value >= 1 or script.Parent.BlowerOn.Value == false
script.Parent.CurrentBlowerSpeed.Value = 1
script.Parent.Parent.BeltSet.SoundMain.PlaybackSpeed = script.Parent.CurrentBlowerSpeed.Value
Rotate()
else
RunCycle = false
repeat game:GetService("RunService").Heartbeat:wait()
script.Parent.CurrentBlowerSpeed.Value = script.Parent.CurrentBlowerSpeed.Value - 0.0032
script.Parent.Parent.BeltSet.SoundMain.PlaybackSpeed = script.Parent.CurrentBlowerSpeed.Value
Rotate()
until script.Parent.CurrentBlowerSpeed.Value <= 0 or RunCycle == true
if script.Parent.CurrentBlowerSpeed.Value <= 0 then
script.Parent.CurrentBlowerSpeed.Value = 0
script.Parent.Parent.BeltSet.SoundMain:Stop()
PlayAudio = false
CompleteStop = true
script.Parent.Parent.BeltSet.SoundMain.Volume = 0
script.Parent.Parent.BeltSet.SoundMain.PlaybackSpeed = script.Parent.CurrentBlowerSpeed.Value
Rotate()
end
end
end)
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == true then
script.Parent.Parent.BeltSet.SoundMain.Volume = 0.5
script.Parent.Parent.BeltSet.MotorStart:Play()
else
script.Parent.Parent.BeltSet.MotorStart:Stop()
end
end)
script.Parent.Parent.BeltSet.Sound.Changed:Connect(function()
script.Parent.SpeedInvert.Value = script.Parent.Parent.BeltSet.SoundMain.PlaybackSpeed * -1
script.Parent.Parent.BeltSet.MotorStart.Volume = script.Parent.SpeedInvert.Value + 1
end)
SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.On.Changed:Connect(function()
if SirenAddress.SirenHeadMovingPartsMain.Sound.SoundMain.On.Value == true and script.Parent.BlowerOn.Value == false then
script.Parent.Parent.BeltSet.Sound.PlaybackSpeed = 0.68
end
end)
|
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi"} --[[
[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 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.13 ,
--[[ 5 ]] 0.63 ,
--[[ 6 ]] 0.47 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Testing AC FE support |
local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0
event.OnServerEvent:connect(function(player,data)
if data['ToggleLight'] then
if car.Body.Light.on.Value==true then
car.Body.Light.on.Value=false
else
car.Body.Light.on.Value=true
end
elseif data['EnableBrakes'] then
car.Body.Brakes.on.Value=true
elseif data['DisableBrakes'] then
car.Body.Brakes.on.Value=false
elseif data['ToggleLeftBlink'] then
if car.Body.Left.on.Value==true then
car.Body.Left.on.Value=false
else
car.Body.Left.on.Value=true
end
elseif data['ToggleRightBlink'] then
if car.Body.Right.on.Value==true then
car.Body.Right.on.Value=false
else
car.Body.Right.on.Value=true
end
elseif data['ReverseOn'] then
car.Body.Reverse.on.Value=true
elseif data['ReverseOff'] then
car.Body.Reverse.on.Value=false
elseif data['ToggleStandlicht'] then
if LichtNum == 0 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 1 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 2 then
LichtNum = 3
car.Body.Highlight.on.Value = true
elseif LichtNum == 3 then
LichtNum = 1
car.Body.Highlight.on.Value = false
car.Body.Headlight.on.Value = false
end
elseif data["ToggleHazards"] then
if car.Body.Hazards.on.Value == false then
car.Body.Hazards.on.Value = true
elseif car.Body.Hazards.on.Value == true then
car.Body.Hazards.on.Value = false
end
end
end)
|
--------| Variables |-------- |
local b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function weld(folder, main, parent)
for _,child in pairs(parent:GetChildren()) do
if ((child:IsA("BasePart")) and (child ~= main) and (child.Name ~= "Head")
and (child.Name ~= "UpperTorso")) then
local weld = Instance.new("WeldConstraint")
weld.Parent = folder
weld.Name = "Weld"
weld.Part0, weld.Part1 = child, main
end
weld(folder, main, child)
end
end -- weld() |
-- Update loop; on every loop, checks if an object should be made and, if so, creates that object |
local last = tick()
while wait() do
local now = tick()
local delta = now - last
for _, object in ipairs(fallingStuffTable) do
if checkIfShouldDrop(object, delta) then
local obj = object.MODEL:Clone()
positionFallingObject(obj)
setupFallingObjectCollisions(obj, object.DAMAGE)
objectCleanup(obj, object.CLEANUP_DELAY_IN_SECONDS)
end
end
last = now
end
|
-- setup based on rig type (r15 or r6) |
if humanoid.RigType == Enum.HumanoidRigType.R15 then
rigtype = "R15"
torso = character:WaitForChild("UpperTorso")
lowertorso = character:WaitForChild("LowerTorso")
larm = character:WaitForChild("LeftUpperArm")
rarm = character:WaitForChild("RightUpperArm")
-- setup variables
waist = torso:WaitForChild("Waist")
oldc0 = waist.C0
leftshoulder = character:WaitForChild("LeftUpperArm"):WaitForChild("LeftShoulder")
rightshoulder = character:WaitForChild("RightUpperArm"):WaitForChild("RightShoulder")
-- make fake lower torso
fakelowertorso = Instance.new("Part")
fakelowertorso.Name = "LowerTorso"
fakelowertorso.CanCollide = false
fakelowertorso.Anchored = false
fakelowertorso.CanTouch = false
fakelowertorso.Transparency = 1
--fakelowertorso.Massless = true
fakelowertorso.Parent = viewmodel
--
faketorso.Size = torso.Size
fakeroot.Size = rootpart.Size
fakelowertorso.Size = lowertorso.Size
faketorso.CFrame = fakeroot.CFrame
roothipclone = lowertorso:WaitForChild("Root"):Clone()
roothipclone.Parent = fakelowertorso
roothipclone.Part0 = fakeroot
roothipclone.Part1 = fakelowertorso
--
if firstperson_waist_movements_enabled then
waistclone = torso:WaitForChild("Waist"):Clone()
waistclone.Parent = faketorso
waistclone.Part0 = fakelowertorso
waistclone.Part1 = faketorso
else
-- waist movements not enabled, replace waist joint with a weld
waistclone = Instance.new("Weld")
waistclone.Parent = faketorso
waistclone.Part0 = fakelowertorso
waistclone.Part1 = faketorso
waistclone.C0 = waist.C0
waistclone.C1 = waist.C1
end
--
leftshoulderclone = leftshoulder:Clone()
leftshoulderclone.Name = "LeftShoulderClone"
leftshoulderclone.Parent = faketorso
leftshoulderclone.Part0 = larm
--
rightshoulderclone = rightshoulder:Clone()
rightshoulderclone.Name = "RightShoulderClone"
rightshoulderclone.Parent = faketorso
rightshoulderclone.Part0 = rarm
-- add the arms
table.insert(armparts, character:WaitForChild("RightLowerArm"))
table.insert(armparts, character:WaitForChild("LeftUpperArm"))
table.insert(armparts, character:WaitForChild("RightUpperArm"))
table.insert(armparts, character:WaitForChild("LeftLowerArm"))
table.insert(armparts, character:WaitForChild("RightLowerArm"))
table.insert(armparts,character:WaitForChild("LeftHand"))
table.insert(armparts,character:WaitForChild("RightHand"))
else
rigtype = "R6"
torso = character:WaitForChild("Torso")
-- add the arms
table.insert(armparts, character:WaitForChild("Right Arm"))
table.insert(armparts, character:WaitForChild("Left Arm"))
-- setup variables
roothip = rootpart:FindFirstChildOfClass("Motor6D")
oldc0 = roothip.C0
leftshoulder = torso:WaitForChild("Left Shoulder")
rightshoulder = torso:WaitForChild("Right Shoulder")
--
faketorso.Size = torso.Size
fakeroot.Size = rootpart.Size
faketorso.CFrame = fakeroot.CFrame
roothipclone = roothip:Clone()
roothipclone.Parent = fakeroot
roothipclone.Part0 = fakeroot
roothipclone.Part1 = faketorso
--
leftshoulderclone = leftshoulder:Clone()
leftshoulderclone.Name = "LeftShoulderClone"
leftshoulderclone.Parent = torso
leftshoulderclone.Part0 = torso
--
rightshoulderclone = rightshoulder:Clone()
rightshoulderclone.Name = "RightShoulderClone"
rightshoulderclone.Parent = torso
rightshoulderclone.Part0 = torso
--
larm = character:WaitForChild("Left Arm")
rarm = character:WaitForChild("Right Arm")
end
if firstperson_arm_transparency >= 1 then
armsvisible = false
end
|
--Kyles45678 |
if not game:IsLoaded() then
game.Loaded:Wait()
end
local ply = game.Players.LocalPlayer
local inGame = ply:WaitForChild("InGame")
local repStoreService = game:GetService("ReplicatedStorage")
local userInputService = game:GetService("UserInputService")
local gui = script.Parent
local defaultView = gui.Default
local mobileView = gui.Mobile
local gameFolder = repStoreService:WaitForChild("Game")
local IM = require(gameFolder.Modules:WaitForChild("IsMobile"))
local function toggleGameUI()
local ism = IM.isMobile()
defaultView.Visible = not ism
mobileView.Visible = ism
end
toggleGameUI()
userInputService.InputBegan:Connect(function(inputObj, GPE)
--if GPE then return end
if inputObj.UserInputType == Enum.UserInputType.MouseMovement and userInputService.MouseEnabled and mobileView.Visible then
toggleGameUI()
elseif inputObj.UserInputType == Enum.UserInputType.Touch and not userInputService.MouseEnabled and defaultView.Visible then
toggleGameUI()
end
end)
local function onInGameChange()
gui.Enabled = inGame.Value
end
inGame.Changed:Connect(onInGameChange)
onInGameChange()
|
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end
function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then |
-- Set up the event handler for the GClippsly button |
Minimalise.MouseButton1Click:Connect(toggleWindow)
|
-- declarations |
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
local regening = false
|
-- Keyboard controller is really keyboard and mouse controller |
local computerInputTypeToModuleMap = {
[Enum.UserInputType.Keyboard] = Keyboard,
[Enum.UserInputType.MouseButton1] = Keyboard,
[Enum.UserInputType.MouseButton2] = Keyboard,
[Enum.UserInputType.MouseButton3] = Keyboard,
[Enum.UserInputType.MouseWheel] = Keyboard,
[Enum.UserInputType.MouseMovement] = Keyboard,
[Enum.UserInputType.Gamepad1] = Gamepad,
[Enum.UserInputType.Gamepad2] = Gamepad,
[Enum.UserInputType.Gamepad3] = Gamepad,
[Enum.UserInputType.Gamepad4] = Gamepad,
}
local lastInputType
function ControlModule.new()
local self = setmetatable({},ControlModule)
-- The Modules above are used to construct controller instances as-needed, and this
-- table is a map from Module to the instance created from it
self.controllers = {}
self.activeControlModule = nil -- Used to prevent unnecessarily expensive checks on each input event
self.activeController = nil
self.touchJumpController = nil
self.moveFunction = Players.LocalPlayer.Move
self.humanoid = nil
self.lastInputType = Enum.UserInputType.None
-- For Roblox self.vehicleController
self.humanoidSeatedConn = nil
self.vehicleController = nil
self.touchControlFrame = nil
self.vehicleController = VehicleController.new(CONTROL_ACTION_PRIORITY)
Players.LocalPlayer.CharacterAdded:Connect(function(char) self:OnCharacterAdded(char) end)
Players.LocalPlayer.CharacterRemoving:Connect(function(char) self:OnCharacterRemoving(char) end)
if Players.LocalPlayer.Character then
self:OnCharacterAdded(Players.LocalPlayer.Character)
end
RunService:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.Input.Value, function(dt)
self:OnRenderStepped(dt)
end)
UserInputService.LastInputTypeChanged:Connect(function(newLastInputType)
self:OnLastInputTypeChanged(newLastInputType)
end)
UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
self:OnTouchMovementModeChange()
end)
Players.LocalPlayer:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
self:OnTouchMovementModeChange()
end)
UserGameSettings:GetPropertyChangedSignal("ComputerMovementMode"):Connect(function()
self:OnComputerMovementModeChange()
end)
Players.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
self:OnComputerMovementModeChange()
end)
--[[ Touch Device UI ]]--
self.playerGui = nil
self.touchGui = nil
self.playerGuiAddedConn = nil
UserInputService:GetPropertyChangedSignal("ModalEnabled"):Connect(function()
self:UpdateTouchGuiVisibility()
end)
if UserInputService.TouchEnabled then
self.playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
if self.playerGui then
self:CreateTouchGuiContainer()
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
else
self.playerGuiAddedConn = Players.LocalPlayer.ChildAdded:Connect(function(child)
if child:IsA("PlayerGui") then
self.playerGui = child
self:CreateTouchGuiContainer()
self.playerGuiAddedConn:Disconnect()
self.playerGuiAddedConn = nil
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
end
end)
end
else
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
end
return self
end
|
-- Function to bind to Unequip event |
local function unequip()
if connection then connection:disconnect() end
mouse.Icon = oldIcon
neck.C0 = oldNeckC0
shoulder.C0 = oldShoulderC0
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0.5 -- cooldown for use of the tool again
ZoneModelName = "Random homing bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
----------//Render Functions\\---------- |
Run.RenderStepped:Connect(function(step)
HeadMovement()
renderGunRecoil()
renderCam()
if ViewModel and LArm and RArm and WeaponInHand then --Check if the weapon and arms are loaded
local mouseDelta = User:GetMouseDelta()
SwaySpring:accelerate(Vector3.new(mouseDelta.x/60, mouseDelta.y/60, 0))
local swayVec = SwaySpring.p
local TSWAY = swayVec.z
local XSSWY = swayVec.X
local YSSWY = swayVec.Y
local Sway = CFrame.Angles(YSSWY,XSSWY,XSSWY)
if BipodAtt then
local BipodRay = Ray.new(UnderBarrelAtt.Main.Position, Vector3.new(0,-1.75,0))
local BipodHit, BipodPos, BipodNorm = workspace:FindPartOnRayWithIgnoreList(BipodRay, Ignore_Model, false, true)
if BipodHit then
CanBipod = true
if CanBipod and BipodActive and not runKeyDown and (GunStance == 0 or GunStance == 2) then
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play()
if not aimming then
BipodCF = BipodCF:Lerp(CFrame.new(0,(((UnderBarrelAtt.Main.Position - BipodPos).magnitude)-1) * (-1.5), 0),.2)
else
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
end
else
BipodActive = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,0), ImageTransparency = .5}):Play()
end
else
BipodActive = false
CanBipod = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play()
end
end
AnimPart.CFrame = cam.CFrame * NearZ * BipodCF * maincf * gunbobcf * aimcf
if not AnimData.GunModelFixed then
WeaponInHand:SetPrimaryPartCFrame(
ViewModel.PrimaryPart.CFrame
* guncf
)
end
if running then
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.025 * (charspeed/10) * math.sin(tick() * 8),
0.025 * (charspeed/10) * math.cos(tick() * 16),
0
) * CFrame.Angles(
math.rad( 1 * (charspeed/10) * math.sin(tick() * 16) ),
math.rad( 1 * (charspeed/10) * math.cos(tick() * 8) ),
math.rad(0)
), 0.1)
else
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.005 * math.sin(tick() * 1.5),
0.005 * math.cos(tick() * 2.5),
0
), 1)
end
local AimTiming = 0
if WeaponData.adsTime then
AimTiming += step / (WeaponData.adsTime * 0.1)
else
AimTiming = 0.2
end
if CurAimpart and aimming and AnimDebounce and not CheckingMag then
if not NVG or WeaponInHand.AimPart:FindFirstChild("NVAim") == nil then
if AimPartMode == 1 then
TS:Create(cam,AimTween,{FieldOfView = ModTable.ZoomValue}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), AimTiming)
else
TS:Create(cam,AimTween,{FieldOfView = ModTable.Zoom2Value}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), AimTiming)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * (WeaponInHand.AimPart.CFrame * WeaponInHand.AimPart.NVAim.CFrame):toObjectSpace(cam.CFrame), AimTiming)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(AnimData.MainCFrame * recoilcf * Sway:inverse(), AimTiming)
end
for index, Part in pairs(WeaponInHand:GetDescendants()) do
if Part:IsA("BasePart") and Part.Name == "SightMark" then
local dist_scale = Part.CFrame:pointToObjectSpace(cam.CFrame.Position)/Part.Size
local reticle = Part.SurfaceGui.Border.Scope
reticle.Position=UDim2.new(.5+dist_scale.x,0,.5-dist_scale.y,0)
if Part.SurfaceGui.Border:FindFirstChild("Vignette") then
--Part.SurfaceGui.Border.Vignette.Position = reticle.Position
end
end
end
recoilcf = recoilcf:Lerp(CFrame.new() * CFrame.Angles( math.rad(RecoilSpring.p.X), math.rad(RecoilSpring.p.Y), math.rad(RecoilSpring.p.z)), AimTiming)
if WeaponData.CrossHair then
if aimming then
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
else
local Normalized = ((WeaponData.CrosshairOffset + BSpread + (charspeed * WeaponData.WalkMult * ModTable.WalkMult) ) / 50)/10
CHup = CHup:Lerp(UDim2.new(0.5, 0, 0.5 - Normalized,0),0.5)
CHdown = CHdown:Lerp(UDim2.new(.5, 0, 0.5 + Normalized,0),0.5)
CHleft = CHleft:Lerp(UDim2.new(.5 - Normalized, 0, 0.5, 0),0.5)
CHright = CHright:Lerp(UDim2.new(.5 + Normalized, 0, 0.5, 0),0.5)
end
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
else
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),AimTiming)
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
end
if BSpread then
local currTime = time()
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 2 and not shooting and BSpread > WeaponData.MinSpread * ModTable.MinSpread then
BSpread = math.max(WeaponData.MinSpread * ModTable.MinSpread, BSpread - WeaponData.AimInaccuracyDecrease * ModTable.AimInaccuracyDecrease)
end
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 1.5 and not shooting and RecoilPower > WeaponData.MinRecoilPower * ModTable.MinRecoilPower then
RecoilPower = math.max(WeaponData.MinRecoilPower * ModTable.MinRecoilPower, RecoilPower - WeaponData.RecoilPowerStepAmount * ModTable.RecoilPowerStepAmount)
end
end
if LaserActive and Pointer ~= nil then
if NVG then
Pointer.Transparency = 0
Pointer.Beam.Enabled = true
else
if not gameRules.RealisticLaser then
Pointer.Beam.Enabled = true
else
Pointer.Beam.Enabled = false
end
if IRmode then
Pointer.Transparency = 1
else
Pointer.Transparency = 0
end
end
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if Key:IsA("BasePart") and Key.Name == "LaserPoint" then
local L_361_ = Ray.new(Key.CFrame.Position, Key.CFrame.LookVector * 1000)
local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(L_361_, Ignore_Model, false, true)
if Hit then
Pointer.CFrame = CFrame.new(Pos, Pos + Normal)
else
Pointer.CFrame = CFrame.new(cam.CFrame.Position + Key.CFrame.LookVector * 2000, Key.CFrame.LookVector)
end
if HalfStep and gameRules.ReplicatedLaser then
Evt.SVLaser:FireServer(Pos,1,Pointer.Color,IRmode,WeaponTool)
end
break
end
end
end
end
if ACS_Client:GetAttribute("Surrender") then
char.Humanoid.WalkSpeed = 0
elseif script.Parent:GetAttribute("Injured") then
SetWalkSpeed(gameRules.InjuredCrouchWalkSpeed)
elseif runKeyDown then
SetWalkSpeed(gameRules.RunWalkSpeed)
Crouched = false
Proned = false
elseif Crouched then
SetWalkSpeed(gameRules.CrouchWalkSpeed)
elseif Proned then
SetWalkSpeed(gameRules.ProneWalksSpeed)
elseif Steady then
SetWalkSpeed(gameRules.SlowPaceWalkSpeed)
else
SetWalkSpeed(gameRules.NormalWalkSpeed)
end
end) |
-- functions |
function onDied()
sDied:Play()
end
function onState(state, sound)
if state then
sound:Play()
else
sound:Pause()
end
end
function onRunning(speed)
if speed>0 then
sRunning:Play()
else
sRunning:Pause()
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.