prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- ROBLOX deviation END
|
local chalk = require(Packages.ChalkLua)
local JestUtil = require(Packages.JestUtil)
local ErrorWithStack = JestUtil.ErrorWithStack
local formatTime = JestUtil.formatTime
local typesModule = require(CurrentModule.types)
type ConsoleBuffer = typesModule.ConsoleBuffer
type LogCounters = typesModule.LogCounters
type LogMessage = typesModule.LogMessage
type LogTimers = typesModule.LogTimers
type LogType = typesModule.LogType
type InspectOptions = typesModule.InspectOptions
local RobloxShared = require(Packages.RobloxShared)
type Writeable = RobloxShared.Writeable
export type BufferedConsole = {
Console: Console,
assert: (self: BufferedConsole, value: unknown, message: (string | Error)?) -> (),
count: (self: BufferedConsole, label: string?) -> (),
countReset: (self: BufferedConsole, label: string?) -> (),
debug: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
dir: (self: BufferedConsole, firstArg: unknown, options: InspectOptions?) -> (),
dirxml: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
error: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
group: (self: BufferedConsole, title: string?, ...any) -> (),
groupCollapsed: (self: BufferedConsole, title: string?, ...any) -> (),
groupEnd: (self: BufferedConsole) -> (),
info: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
log: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
time: (self: BufferedConsole, label: string?) -> (),
timeEnd: (self: BufferedConsole, label: string?) -> (),
timeLog: (self: BufferedConsole, label: string?, ...any) -> (),
warn: (self: BufferedConsole, firstArg: unknown, ...any) -> (),
getBuffer: (self: BufferedConsole) -> ConsoleBuffer?,
write: (buffer: ConsoleBuffer, type: LogType, message: LogMessage, level: (number | nil)?) -> ConsoleBuffer,
}
type BufferedConsolePrivate = BufferedConsole & {
_log: (self: BufferedConsolePrivate, type: LogType, message: LogMessage) -> (),
_buffer: ConsoleBuffer,
_counters: LogCounters,
_timers: LogTimers,
_groupDepth: number,
}
|
--[[
Knit.CreateController(controller): Controller
Knit.AddControllers(folder): Controller[]
Knit.AddControllersDeep(folder): Controller[]
Knit.GetService(serviceName): Service
Knit.GetController(controllerName): Controller
Knit.Start(): Promise<void>
Knit.OnStart(): Promise<void>
--]]
|
local KnitClient = {}
KnitClient.Version = script.Parent.Version.Value
KnitClient.Player = game:GetService("Players").LocalPlayer
KnitClient.Controllers = {}
KnitClient.Util = script.Parent.Util
local Promise = require(KnitClient.Util.Promise)
local Thread = require(KnitClient.Util.Thread)
local Loader = require(KnitClient.Util.Loader)
local Ser = require(KnitClient.Util.Ser)
local ClientRemoteSignal = require(KnitClient.Util.Remote.ClientRemoteSignal)
local ClientRemoteProperty = require(KnitClient.Util.Remote.ClientRemoteProperty)
local TableUtil = require(KnitClient.Util.TableUtil)
local services = {}
local servicesFolder = script.Parent:WaitForChild("Services")
local started = false
local startedComplete = false
local onStartedComplete = Instance.new("BindableEvent")
local function BuildService(serviceName, folder)
local service = {}
if (folder:FindFirstChild("RF")) then
for _,rf in ipairs(folder.RF:GetChildren()) do
if (rf:IsA("RemoteFunction")) then
service[rf.Name] = function(self, ...)
return Ser.DeserializeArgsAndUnpack(rf:InvokeServer(Ser.SerializeArgsAndUnpack(...)))
end
service[rf.Name .. "Promise"] = function(self, ...)
local args = Ser.SerializeArgs(...)
return Promise.new(function(resolve)
resolve(Ser.DeserializeArgsAndUnpack(rf:InvokeServer(table.unpack(args, 1, args.n))))
end)
end
end
end
end
if (folder:FindFirstChild("RE")) then
for _,re in ipairs(folder.RE:GetChildren()) do
if (re:IsA("RemoteEvent")) then
service[re.Name] = ClientRemoteSignal.new(re)
end
end
end
if (folder:FindFirstChild("RP")) then
for _,rp in ipairs(folder.RP:GetChildren()) do
if (rp:IsA("ValueBase") or rp:IsA("RemoteEvent")) then
service[rp.Name] = ClientRemoteProperty.new(rp)
end
end
end
services[serviceName] = service
return service
end
function KnitClient.CreateController(controller)
assert(type(controller) == "table", "Controller must be a table; got " .. type(controller))
assert(type(controller.Name) == "string", "Controller.Name must be a string; got " .. type(controller.Name))
assert(#controller.Name > 0, "Controller.Name must be a non-empty string")
assert(KnitClient.Controllers[controller.Name] == nil, "Service \"" .. controller.Name .. "\" already exists")
TableUtil.Extend(controller, {
_knit_is_controller = true;
})
KnitClient.Controllers[controller.Name] = controller
return controller
end
function KnitClient.AddControllers(folder)
return Loader.LoadChildren(folder)
end
function KnitClient.AddControllersDeep(folder)
return Loader.LoadDescendants(folder)
end
function KnitClient.GetService(serviceName)
assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName))
local folder = servicesFolder:FindFirstChild(serviceName)
assert(folder ~= nil, "Could not find service \"" .. serviceName .. "\"")
return services[serviceName] or BuildService(serviceName, folder)
end
function KnitClient.GetController(controllerName)
return KnitClient.Controllers[controllerName]
end
function KnitClient.Start()
if (started) then
return Promise.Reject("Knit already started")
end
started = true
local controllers = KnitClient.Controllers
return Promise.new(function(resolve)
-- Init:
local promisesStartControllers = {}
for _,controller in pairs(controllers) do
if (type(controller.KnitInit) == "function") then
table.insert(promisesStartControllers, Promise.new(function(r)
controller:KnitInit()
r()
end))
end
end
resolve(Promise.All(promisesStartControllers))
end):Then(function()
-- Start:
for _,controller in pairs(controllers) do
if (type(controller.KnitStart) == "function") then
Thread.SpawnNow(controller.KnitStart, controller)
end
end
startedComplete = true
onStartedComplete:Fire()
Thread.Spawn(function()
onStartedComplete:Destroy()
end)
end)
end
function KnitClient.OnStart()
if (startedComplete) then
return Promise.Resolve()
else
return Promise.new(function(resolve)
if (startedComplete) then
resolve()
return
end
onStartedComplete.Event:Wait()
resolve()
end)
end
end
return KnitClient
|
--Turbo Gauge GUI--
|
local fix = 0
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.BAnalog.Visible = BoostGaugeVisible
script.Parent.Background.Visible = BoostGaugeVisible
script.Parent.DontTouch.Visible = BoostGaugeVisible
script.Parent.Num.Visible = BoostGaugeVisible
local turbo = ((totalPSI/2)*WasteGatePressure)
local turbo2 = WasteGatePressure
fix = -turbo2 + turbo*2
script.Parent.BAnalog.Rotation= 110 + (totalPSI/2)*220
script.Parent.Num.N1.TextLabel.Text = (math.floor(WasteGatePressure*(4/4)))*TurboCount
script.Parent.Num.N2.TextLabel.Text = (math.floor(WasteGatePressure*(3/4)))*TurboCount
script.Parent.Num.N3.TextLabel.Text = (math.floor(WasteGatePressure*(2/4)))*TurboCount
script.Parent.Num.N4.TextLabel.Text = (math.floor(WasteGatePressure*(1/4)))*TurboCount
script.Parent.Num.N5.TextLabel.Text = 0
script.Parent.Num.N6.TextLabel.Text = -5
end)
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Flint",Paint)
end)
|
--Front Suspension
|
Tune.FSusDamping = 300 -- Spring Dampening
Tune.FSusStiffness = 8000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .25 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--!strict
|
local function GetAllParts(instance: Instance, includeParent: boolean?): {BasePart}
local parts = {}
if type(includeParent) ~= "boolean" then
includeParent = true
end
if instance:IsA("BasePart") and includeParent == true then
table.insert(parts, instance::BasePart)
end
for _, child: BasePart in ipairs(instance:GetDescendants()) do
if child:IsA("BasePart") then
table.insert(parts, child)
end
end
return parts
end
return GetAllParts
|
--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)
|
--fakeroot.Massless = true
|
fakeroot.Transparency = 1
fakeroot.Parent = viewmodel
local faketorso = Instance.new("Part")
faketorso.Name = "Torso"
faketorso.CanCollide = false
faketorso.CanTouch = false
faketorso.Transparency = 1
|
-- Events to listen to selection changes
|
Selection.ItemsAdded = RbxUtility.CreateSignal();
Selection.ItemsRemoved = RbxUtility.CreateSignal();
Selection.FocusChanged = RbxUtility.CreateSignal();
Selection.Cleared = RbxUtility.CreateSignal();
Selection.Changed = RbxUtility.CreateSignal();
|
-- ROBLOX deviation: need to execute the module explicitly
|
exports.installCommonGlobals = require(script.installCommonGlobals)().default
|
--[[ Local Helper Functions ]]
|
--
local function doTween(guiObject, endSize, endPosition)
guiObject:TweenSizeAndPosition(endSize, endPosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15, true)
end
local function CreateArrowLabel(name, position, size, rectOffset, rectSize, parent)
local image = Instance.new("ImageLabel")
image.Name = name
image.Image = DPAD_SHEET
image.ImageRectOffset = rectOffset
image.ImageRectSize = rectSize
image.BackgroundTransparency = 1
image.ImageColor3 = Color3.fromRGB(190, 190, 190)
image.Size = size
image.Position = position
image.Parent = parent
return image
end
function TouchThumbpad:Enable(enable, uiParentFrame)
if enable == nil then return false end -- If nil, return false (invalid argument)
enable = enable and true or false -- Force anything non-nil to boolean before comparison
if self.enabled == enable then return true end -- If no state change, return true indicating already in requested state
self.moveVector = ZERO_VECTOR3
self.isJumping = false
if enable then
-- Enable
if not self.thumbpadFrame then
self:Create(uiParentFrame)
end
self.thumbpadFrame.Visible = true
else
-- Disable
self.thumbpadFrame.Visible = false
self:OnInputEnded()
end
self.enabled = enable
end
function TouchThumbpad:OnInputEnded()
self.moveVector = ZERO_VECTOR3
self.isJumping = false
self.thumbpadFrame.Position = self.screenPos
self.touchObject = nil
self.isUp, self.isDown, self.isLeft, self.isRight = false, false, false, false
doTween(self.dArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 1, self.lgImgOffset))
doTween(self.uArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 0, self.smImgOffset))
doTween(self.lArrow, self.smArrowSize, UDim2.new(0, self.smImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
doTween(self.rArrow, self.smArrowSize, UDim2.new(1, self.lgImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
end
function TouchThumbpad:Create(parentFrame)
if self.thumbpadFrame then
self.thumbpadFrame:Destroy()
self.thumbpadFrame = nil
end
if self.touchChangedConn then
self.touchChangedConn:Disconnect()
self.touchChangedConn = nil
end
if self.touchEndedConn then
self.touchEndedConn:Disconnect()
self.touchEndedConn = nil
end
if self.menuOpenedConn then
self.menuOpenedConn:Disconnect()
self.menuOpenedConn = nil
end
local minAxis = math.min(parentFrame.AbsoluteSize.x, parentFrame.AbsoluteSize.y)
local isSmallScreen = minAxis <= 500
local thumbpadSize = isSmallScreen and 70 or 120
self.screenPos = isSmallScreen and UDim2.new(0, thumbpadSize * 1.25, 1, -thumbpadSize - 20) or
UDim2.new(0, thumbpadSize * 0.5 - 10, 1, -thumbpadSize * 1.75 - 10)
self.thumbpadFrame = Instance.new("Frame")
self.thumbpadFrame.Name = "ThumbpadFrame"
self.thumbpadFrame.Visible = false
self.thumbpadFrame.Active = true
self.thumbpadFrame.Size = UDim2.new(0, thumbpadSize + 20, 0, thumbpadSize + 20)
self.thumbpadFrame.Position = self.screenPos
self.thumbpadFrame.BackgroundTransparency = 1
local outerImage = Instance.new("ImageLabel")
outerImage.Name = "OuterImage"
outerImage.Image = TOUCH_CONTROL_SHEET
outerImage.ImageRectOffset = Vector2.new(0, 0)
outerImage.ImageRectSize = Vector2.new(220, 220)
outerImage.BackgroundTransparency = 1
outerImage.Size = UDim2.new(0, thumbpadSize, 0, thumbpadSize)
outerImage.Position = UDim2.new(0, 10, 0, 10)
outerImage.Parent = self.thumbpadFrame
self.smArrowSize = isSmallScreen and UDim2.new(0, 32, 0, 32) or UDim2.new(0, 64, 0, 64)
self.lgArrowSize = UDim2.new(0, self.smArrowSize.X.Offset * 2, 0, self.smArrowSize.Y.Offset * 2)
local imgRectSize = Vector2.new(110, 110)
self.smImgOffset = isSmallScreen and -4 or -9
self.lgImgOffset = isSmallScreen and -28 or -55
self.dArrow = CreateArrowLabel("DownArrow", UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 1, self.lgImgOffset), self.smArrowSize, Vector2.new(8, 8), imgRectSize, outerImage)
self.uArrow = CreateArrowLabel("UpArrow", UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 0, self.smImgOffset), self.smArrowSize, Vector2.new(8, 266), imgRectSize, outerImage)
self.lArrow = CreateArrowLabel("LeftArrow", UDim2.new(0, self.smImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset), self.smArrowSize, Vector2.new(137, 137), imgRectSize, outerImage)
self.rArrow = CreateArrowLabel("RightArrow", UDim2.new(1, self.lgImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset), self.smArrowSize, Vector2.new(8, 137), imgRectSize, outerImage)
local function doTween(guiObject, endSize, endPosition)
guiObject:TweenSizeAndPosition(endSize, endPosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15, true)
end
local padOrigin = nil
local deadZone = 0.1
self.isRight, self.isLeft, self.isUp, self.isDown = false, false, false, false
local function doMove(pos)
local moveDelta = pos - padOrigin
local moveVector2 = 2 * moveDelta / thumbpadSize
-- Scaled Radial Dead Zone
if moveVector2.Magnitude < deadZone then
self.moveVector = ZERO_VECTOR3
else
moveVector2 = moveVector2.unit * ((moveVector2.Magnitude - deadZone) / (1 - deadZone))
-- prevent NAN Vector from trying to do zerovector.Unit
if moveVector2.Magnitude == 0 then
self.moveVector = ZERO_VECTOR3
else
self.moveVector = Vector3.new(moveVector2.x, 0, moveVector2.y).Unit
end
end
local forwardDot = self.moveVector:Dot(-UNIT_Z)
local rightDot = self.moveVector:Dot(UNIT_X)
if forwardDot > 0.5 then -- UP
if not self.isUp then
self.isUp, self.isDown = true, false
doTween(self.uArrow, self.lgArrowSize, UDim2.new(0.5, -self.smArrowSize.X.Offset, 0, self.smImgOffset - 1.5*self.smArrowSize.Y.Offset))
doTween(self.dArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 1, self.lgImgOffset))
end
elseif forwardDot < -0.5 then -- DOWN
if not self.isDown then
self.isDown, self.isUp = true, false
doTween(self.dArrow, self.lgArrowSize, UDim2.new(0.5, -self.smArrowSize.X.Offset, 1, self.lgImgOffset + 0.5*self.smArrowSize.Y.Offset))
doTween(self.uArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 0, self.smImgOffset))
end
else
self.isUp, self.isDown = false, false
doTween(self.dArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 1, self.lgImgOffset))
doTween(self.uArrow, self.smArrowSize, UDim2.new(0.5, -0.5*self.smArrowSize.X.Offset, 0, self.smImgOffset))
end
if rightDot > 0.5 then
if not self.isRight then
self.isRight, self.isLeft = true, false
doTween(self.rArrow, self.lgArrowSize, UDim2.new(1, self.lgImgOffset + 0.5*self.smArrowSize.X.Offset, 0.5, -self.smArrowSize.Y.Offset))
doTween(self.lArrow, self.smArrowSize, UDim2.new(0, self.smImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
end
elseif rightDot < -0.5 then
if not self.isLeft then
self.isLeft, self.isRight = true, false
doTween(self.lArrow, self.lgArrowSize, UDim2.new(0, self.smImgOffset - 1.5*self.smArrowSize.X.Offset, 0.5, -self.smArrowSize.Y.Offset))
doTween(self.rArrow, self.smArrowSize, UDim2.new(1, self.lgImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
end
else
self.isRight, self.isLeft = false, false
doTween(self.lArrow, self.smArrowSize, UDim2.new(0, self.smImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
doTween(self.rArrow, self.smArrowSize, UDim2.new(1, self.lgImgOffset, 0.5, -0.5*self.smArrowSize.Y.Offset))
end
end
--input connections
self.thumbpadFrame.InputBegan:connect(function(inputObject)
--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
if self.touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch
or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
self.thumbpadFrame.Position = UDim2.new(0, inputObject.Position.x - 0.5*self.thumbpadFrame.AbsoluteSize.x, 0, inputObject.Position.y - 0.5*self.thumbpadFrame.Size.Y.Offset)
padOrigin = Vector3.new(self.thumbpadFrame.AbsolutePosition.x +0.5* self.thumbpadFrame.AbsoluteSize.x,
self.thumbpadFrame.AbsolutePosition.y + 0.5*self.thumbpadFrame.AbsoluteSize.y, 0)
doMove(inputObject.Position)
self.touchObject = inputObject
end)
self.touchChangedConn = UserInputService.TouchMoved:connect(function(inputObject, isProcessed)
if inputObject == self.touchObject then
doMove(self.touchObject.Position)
end
end)
self.touchEndedConn = UserInputService.TouchEnded:Connect(function(inputObject)
if inputObject == self.touchObject then
self:OnInputEnded()
end
end)
self.menuOpenedConn = GuiService.MenuOpened:Connect(function()
if self.touchObject then
self:OnInputEnded()
end
end)
self.thumbpadFrame.Parent = parentFrame
end
return TouchThumbpad
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
DamageValues = {
BaseDamage = 11,
SlashDamage = 18,
LungeDamage = 22,
}
Multiplier = {
Kills = {Current = 0, Max = 3},
Damage = 1.25,
}
FireParticle = script:WaitForChild("Fire")
DeathEffect = script:WaitForChild("DeathEffect")
Damage = DamageValues.BaseDamage
BaseUrl = "http://www.roblox.com/asset/?id="
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
Animations = {
Equip = {Animation = Tool:WaitForChild("Equip"), FadeTime = nil, Weight = nil, Speed = 0.7, Duration = 1},
LeftSlash = {Animation = Tool:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
RightSlash = {Animation = Tool:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.75},
SideSwipe = {Animation = Tool:WaitForChild("SideSwipe"), FadeTime = nil, Weight = nil, Speed = 0.8, Duration = 0.75},
}
Sounds = {
Unsheath = Handle:WaitForChild("Unsheath"),
Slash = Handle:WaitForChild("Slash"),
Lunge = Handle:WaitForChild("Lunge"),
}
Grips = {
Up = CFrame.new(0, -1.25, 0, 1, 0, -0, 0, 1, 0, 0, 0, 1),
Out = CFrame.new(0, -1.25, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0),
}
LastAttack = 0
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Tool,
})
ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Tool,
})
Handle.Transparency = 0
Tool.Grip = Grips.Up
Tool.Enabled = true
function Clamp(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end
function GetPercentage(Start, End, Number)
return (((Number - Start) / (End - Start)) * 100)
end
function Round(Number, RoundDecimal)
local WholeNumber, Decimal = math.modf(Number)
return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function ApplyDeathEffect(character, Direction, Force)
local Direction = (Direction or Vector3.new(0, 0, 0))
local Force = (Force or Vector3.new(0, 0, 0))
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid then
return
end
local DeathEffectCopy = character:FindFirstChild(DeathEffect.Name)
if DeathEffectCopy then
return
end
DeathEffectCopy = DeathEffect:Clone()
DeathEffectCopy.WindDirection.Value = Direction
DeathEffectCopy.Force.Value = Force
DeathEffectCopy.Disabled = false
DeathEffectCopy.Parent = character
end
function DealDamage(character, damage)
if not CheckIfAlive() or not character then
return
end
local damage = (damage or 0)
local humanoid = character:FindFirstChild("Humanoid")
local torso = character:FindFirstChild("Torso")
if not humanoid or humanoid.Health == 0 or not torso then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(damage)
if humanoid.Health <= 0 then
if Multiplier.Kills.Current < Multiplier.Kills.Max then
Multiplier.Kills.Current = (Multiplier.Kills.Current + 1)
Delay(15, (function()
Multiplier.Kills.Current = (Multiplier.Kills.Current - 1)
end))
end
local WindDir = (CFrame.new(Torso.Position, Vector3.new(torso.Position.X, Torso.Position.Y, torso.Position.Z)) * CFrame.Angles(0, math.pi, 0)).lookVector
ApplyDeathEffect(character, Vector3.new(WindDir.X, 1, WindDir.Z), ((WindDir * 6.5) + Vector3.new(0, 15, 0)))
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Blow(Part)
local PartTouched
local HitDelay = false
PartTouched = Part.Touched:connect(function(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped or HitDelay then
return
end
local RightArm = Character:FindFirstChild("Right Arm")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChild("Humanoid")
local torso = character:FindFirstChild("Torso")
if not humanoid or humanoid.Health == 0 or not torso then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
HitDelay = true
local ChargePercent = (Clamp(GetPercentage(0, Multiplier.Kills.Max, Multiplier.Kills.Current), 0, 100) * 0.01)
local BonusDamage = (Damage * (Multiplier.Damage * ChargePercent))
local TotalDamage = (Damage + BonusDamage)
print(BonusDamage)
DealDamage(character, TotalDamage)
wait(0.05)
HitDelay = false
end)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
--[[local Anim = Create("StringValue"){
Name = "toolanim",
Value = "Slash",
}
Debris:AddItem(Anim, 2)
Anim.Parent = Tool]]
local SwingAnimations = {Animations.LeftSlash, Animations.RightSlash, Animations.SideSwipe, Animations.Swing}
local Animation = SwingAnimations[math.random(1, #SwingAnimations)]
Spawn(function()
InvokeClient("PlayAnimation", Animation)
end)
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
for i, v in pairs(Animations) do
Spawn(function()
InvokeClient("StopAnimation", v)
end)
end
local Anim = Create("StringValue"){
Name = "toolanim",
Value = "Lunge",
}
Debris:AddItem(Anim, 2)
Anim.Parent = Tool
wait(0.2)
Tool.Grip = Grips.Out
wait(0.75)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
Tool.Enabled = true
end
function CreateParticlePart(MakeNew)
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
if not MakeNew then
return
end
ParticlePart = BasePart:Clone()
ParticlePart.Name = "Effect"
ParticlePart.Transparency = 1
ParticlePart.Size = Vector3.new(0.2, 2.5, 0.5)
ParticlePart.CanCollide = false
FireParticleCopy = FireParticle:Clone()
FireParticleCopy.Enabled = true
FireParticleCopy.Parent = ParticlePart
Create("Weld"){
Name = "Weld",
Part0 = Handle,
Part1 = ParticlePart,
C0 = CFrame.new(0, 0.625, 0),
C1 = CFrame.new(0, 0, 0),
Parent = ParticlePart,
}
ParticlePart.Parent = Tool
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso")
if not CheckIfAlive() then
return
end
Sounds.Unsheath:Play()
Spawn(function()
if ToolUnequipped then
ToolUnequipped:disconnect()
end
local CurrentlyEquipped = true
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
local Animation = Animations.Equip
Spawn(function()
InvokeClient("PlayAnimation", Animation)
end)
wait(Animation.Duration)
if ToolUnequipped then
ToolUnequipped:disconnect()
end
if not CurrentlyEquipped then
return
end
ToolEquipped = true
Humanoid.WalkSpeed = (16 * 1.25)
CreateParticlePart(true)
end)
end
function Unequipped()
Humanoid.WalkSpeed = 16
Spawn(function()
CreateParticlePart(false)
end)
ToolEquipped = false
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = OnServerInvoke
Delay(0, (function()
if not ToolEquipped then
CreateParticlePart(false)
end
end))
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
Blow(Handle)
|
-- Public Methods
|
function CheckboxLabelClass:GetValue()
return self.Button.Checkmark.Visible
end
function CheckboxLabelClass:SetValue(bool)
bool = not not bool
local container = self.Frame.CheckContainer
local colorA = container.BackgroundColor3
local colorB = container.BorderColor3
local colorC = container.Outline.BackgroundColor3
local outlineColor = bool and colorB or colorC
if (bool and container.CheckButton.BackgroundTransparency == 1) then
outlineColor = colorC
end
for _, child in next, container.Outline:GetChildren() do
child.BackgroundColor3 = outlineColor
end
container.CheckButton.BackgroundColor3 = bool and colorB or colorA
container.CheckButton.Checkmark.Visible = bool
self._ChangedBind:Fire(bool)
end
function CheckboxLabelClass:Destroy()
self._Maid:Sweep()
--self.Frame:Destroy()
self.Changed = nil
end
|
-- This function casts a ray with a blacklist.
|
local function CastWithBlacklist(origin, direction, blacklist, ignoreWater)
if not blacklist or typeof(blacklist) ~= "table" then
-- This array is faulty
error("Call in CastBlacklist failed! Blacklist table is either nil, or is not actually a table.", 0)
end
local castRay = Ray.new(origin, direction)
return Workspace:FindPartOnRayWithIgnoreList(castRay, blacklist, false, ignoreWater)
end
|
-- Replica object:
|
Replica = {}
Replica.__index = Replica
|
-- This Script moves the ragdoll Folder to StarterGui
|
script.Parent:FindFirstChild("ragdoll").Parent = game.StarterGui
wait()
script.Parent:Destroy()
|
--[[**
asserts a given check
@param check The function to wrap with an assert
@returns A function that simply wraps the given check in an assert
**--]]
|
function t.strict(check)
return function(...)
assert(check(...))
end
end
do
local checkChildren = t.map(t.string, t.callback)
--[[**
Takes a table where keys are child names and values are functions to check the children against.
Pass an instance tree into the function.
If at least one child passes each check, the overall check passes.
Warning! If you pass in a tree with more than one child of the same name, this function will always return false
@param checkTable The table to check against
@returns A function that checks an instance tree
**--]]
function t.children(checkTable)
assert(checkChildren(checkTable))
return function(value)
local instanceSuccess, instanceErrMsg = t.Instance(value)
if not instanceSuccess then
return false, instanceErrMsg or ""
end
local childrenByName = {}
for _, child in ipairs(value:GetChildren()) do
local name = child.Name
if checkTable[name] then
if childrenByName[name] then
return false, string.format("Cannot process multiple children with the same name %q", name)
end
childrenByName[name] = child
end
end
for name, check in pairs(checkTable) do
local success, errMsg = check(childrenByName[name])
if not success then
return false, string.format("[%s.%s] %s", value:GetFullName(), name, errMsg or "")
end
end
return true
end
end
end
return t
|
--Made by Stickmasterluke
|
sp=script.Parent
midhight=16
radius=4.5 --hight
wavetime=10 --seconds
a=0
while true do
wait()
a=a+1
sp.CFrame=CFrame.new(0,midhight+math.sin((a/(wavetime*30))*math.pi)*radius,0)
end
|
-- a modified version of nocollider's gore system
|
local RenderDistance = 400
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Debris = game:GetService("Debris")
local Miscs = ReplicatedStorage:WaitForChild("Miscs")
local Remotes = ReplicatedStorage:WaitForChild("Remotes")
local Events = ReplicatedStorage:WaitForChild("Events")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Utilities = require(Modules.Utilities)
local Thread = Utilities.Thread
local Gibs = Miscs.Gibs
local GibsR15 = Miscs.GibsR15
local Skeleton = Miscs.Skeleton
local SkeletonR15 = Miscs.SkeletonR15
local Camera = Workspace.CurrentCamera
local Gib = Events.gib
local VisualizeGore = Remotes.VisualizeGore
local Joints = {}
local DamagedHeadParts = {"damaged.head.1", "damaged.head.2", "damaged.head.3"}
local Gore = {
["Head"] = {"damaged.head.bone.1", "damaged.head.bone.2"},
["Right Arm"] = {"damaged.right.arm.1", "damaged.right.arm.2", "damaged.right.arm.flesh.1", "damaged.right.arm.flesh.2"},
["Left Arm"] = {"damaged.left.arm.1", "damaged.left.arm.2", "damaged.left.arm.flesh.1", "damaged.left.arm.flesh.2"},
["Right Leg"] = {"damaged.right.leg.1", "damaged.right.leg.2", "damaged.right.leg.flesh.1", "damaged.right.leg.flesh.2"},
["Left Leg"] = {"damaged.left.leg.1", "damaged.left.leg.2", "damaged.left.leg.flesh.1", "damaged.left.leg.flesh.2"},
["Torso"] = {"damaged.torso", "damaged.torso.flesh", "damaged.torso.bone"},
}
local GoreR15 = {
["Head"] = {"damaged.head.bone.1", "damaged.head.bone.2"},
["RightUpperArm"] = {"damaged.right.upper.arm", "damaged.right.upper.arm.bone"},
["RightLowerArm"] = {"damaged.right.lower.arm", "damaged.right.lower.arm.flesh"},
["RightHand"] = {"damaged.right.hand"},
["LeftUpperArm"] = {"damaged.left.upper.arm", "damaged.left.upper.arm.bone"},
["LeftLowerArm"] = {"damaged.left.lower.arm", "damaged.left.lower.arm.flesh"},
["LeftHand"] = {"damaged.left.hand"},
["RightUpperLeg"] = {"damaged.right.upper.leg", "damaged.right.upper.leg.flesh"},
["RightLowerLeg"] = {"damaged.right.lower.leg", "damaged.right.lower.leg.flesh"},
["RightFoot"] = {"damaged.right.foot"},
["LeftUpperLeg"] = {"damaged.left.upper.leg", "damaged.left.upper.leg.flesh"},
["LeftLowerLeg"] = {"damaged.left.lower.leg", "damaged.left.lower.leg.flesh"},
["LeftFoot"] = {"damaged.left.foot"},
["UpperTorso"] = {"damaged.upper.torso", "damaged.upper.torso.bone"},
["LowerTorso"] = {"damaged.lower.torso", "damaged.lower.torso.flesh"},
}
local Bones = {
["Head"] = {"head"},
["Right Arm"] = {"right.arm"},
["Left Arm"] = {"left.arm"},
["Right Leg"] = {"right.leg"},
["Left Leg"] = {"left.leg"},
["Torso"] = {"torso"},
}
local BonesR15 = {
["Head"] = {"head"},
["RightUpperArm"] = {"right.upper.arm"},
["RightLowerArm"] = {"right.lower.arm"},
["RightHand"] = {"right.hand"},
["LeftUpperArm"] = {"left.upper.arm"},
["LeftLowerArm"] = {"left.lower.arm"},
["LeftHand"] = {"left.hand"},
["RightUpperLeg"] = {"right.upper.leg"},
["RightLowerLeg"] = {"right.lower.leg"},
["RightFoot"] = {"right.foot"},
["LeftUpperLeg"] = {"left.upper.leg"},
["LeftLowerLeg"] = {"left.lower.leg"},
["LeftFoot"] = {"left.foot"},
["UpperTorso"] = {"upper.torso"},
["LowerTorso"] = {"lower.torso"},
}
function DoOdds(Chances)
if Random.new():NextInteger(0, 100) <= Chances then
return true
end
return false
end
local function FullR6Gib(Joint, Ragdoll, ClientModule, GoreEffect)
if Ragdoll:FindFirstChild("Torso") and Joint.Transparency ~= 1 and not Ragdoll:FindFirstChild("gibbed") and (Joint.Position - Camera.CFrame.p).Magnitude <= RenderDistance then
Joint.Transparency = 1
local Tag = Instance.new("StringValue", Ragdoll)
Tag.Name = "gibbed"
local Decal = Joint:FindFirstChildOfClass("Decal")
if Decal then
Decal:Destroy()
end
if Joint.Name == "Head" then
local parts = Ragdoll:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("Hat") or parts[i]:IsA("Accessory") then
local handle = parts[i].Handle:Clone()
local children = handle:GetChildren()
for i = 1, #children do
if children[i]:IsA("Weld") then
children[i]:Destroy()
end
end
handle.CFrame = parts[i].Handle.CFrame
handle.CanCollide = true
handle.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
handle.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(25, 50),
(math.random() - 0.5) * 25
)
handle.Parent = Ragdoll
parts[i].Handle.Transparency = 1
end
end
end
for _, Limb in pairs(Bones[Joint.Name]) do
local limb = Skeleton[Limb]:Clone()
limb.Anchored = true
limb.CanCollide = false
limb.Parent = Ragdoll
local offset = Skeleton.rig[Joint.Name].CFrame:ToObjectSpace(limb.CFrame)
Joints[limb] = function() return Joint.CFrame * offset end
end
local Attachment = Instance.new("Attachment")
Attachment.CFrame = Joint.CFrame
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..ClientModule.GoreSoundIDs[math.random(1, #ClientModule.GoreSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(ClientModule.GoreSoundPitchMin, ClientModule.GoreSoundPitchMax)
Sound.Volume = ClientModule.GoreSoundVolume
local function spawner()
local C = GoreEffect:GetChildren()
for i = 1, #C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
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
Sound:Play()
end
Thread:Spawn(spawner)
Debris:AddItem(Attachment, 10)
end
end
local function R6Gib(Joint, Ragdoll, ClientModule, GoreEffect)
if Ragdoll:FindFirstChild("Torso") and Joint.Transparency ~= 1 and not Ragdoll:FindFirstChild("gibbed") and (Joint.Position - Camera.CFrame.p).Magnitude <= RenderDistance then
Joint.Transparency = 1
local Tag = Instance.new("StringValue", Ragdoll)
Tag.Name = "gibbed"
local Decal = Joint:FindFirstChildOfClass("Decal")
if Decal then
Decal:Destroy()
end
if Joint.Name == "Head" then
local parts = Ragdoll:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("Hat") or parts[i]:IsA("Accessory") then
local handle = parts[i].Handle:Clone()
local children = handle:GetChildren()
for i = 1, #children do
if children[i]:IsA("Weld") then
children[i]:Destroy()
end
end
handle.CFrame = parts[i].Handle.CFrame
handle.CanCollide = true
handle.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
handle.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(25, 50),
(math.random() - 0.5) * 25
)
handle.Parent = Ragdoll
parts[i].Handle.Transparency = 1
end
end
for _, headPart in pairs(DamagedHeadParts) do
local part = Gibs[headPart]:Clone()
part.Color = Joint.Color
part.CFrame = Joint.CFrame
part.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
part.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(50, 100),
(math.random() - 0.5) * 25
)
part.Parent = Ragdoll
end
end
for _, Limb in pairs(Gore[Joint.Name]) do
local limb = Gibs[Limb]:Clone()
limb.Anchored = true
limb.CanCollide = false
if not (limb.Name:match("flesh") or limb.Name:match("bone")) then
limb.Color = Joint.Color
if not limb.Name:match("head") then
if limb.Name:match("leg") or limb.Name:match("foot") then
if Ragdoll:FindFirstChildOfClass("Pants") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Pants").PantsTemplate
end
else
if limb.Name:match("torso") then
if Ragdoll:FindFirstChildOfClass("Shirt") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Shirt").ShirtTemplate
else
if Ragdoll:FindFirstChildOfClass("Pants") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Pants").PantsTemplate
end
end
else
if Ragdoll:FindFirstChildOfClass("Shirt") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Shirt").ShirtTemplate
end
end
end
end
end
limb.Parent = Ragdoll
local offset = Gibs.rig[Joint.Name].CFrame:ToObjectSpace(limb.CFrame)
Joints[limb] = function() return Joint.CFrame * offset end
end
local Attachment = Instance.new("Attachment")
Attachment.CFrame = Joint.CFrame
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..ClientModule.GoreSoundIDs[math.random(1, #ClientModule.GoreSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(ClientModule.GoreSoundPitchMin, ClientModule.GoreSoundPitchMax)
Sound.Volume = ClientModule.GoreSoundVolume
local function spawner()
local C = GoreEffect:GetChildren()
for i = 1, #C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
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
Sound:Play()
end
Thread:Spawn(spawner)
Debris:AddItem(Attachment, 10)
end
end
local function FullR15Gib(Joint, Ragdoll, ClientModule, GoreEffect)
if Ragdoll:FindFirstChild("UpperTorso") and Joint.Transparency ~= 1 and not Ragdoll:FindFirstChild("gibbed") and (Joint.Position - Camera.CFrame.p).Magnitude <= RenderDistance then
Joint.Transparency = 1
local Tag = Instance.new("StringValue", Ragdoll)
Tag.Name = "gibbed"
local Decal = Joint:FindFirstChildOfClass("Decal")
if Decal then
Decal:Destroy()
end
if Joint.Name == "Head" then
local parts = Ragdoll:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("Hat") or parts[i]:IsA("Accessory") then
local handle = parts[i].Handle:Clone()
local children = handle:GetChildren()
for i = 1, #children do
if children[i]:IsA("Weld") then
children[i]:Destroy()
end
end
handle.CFrame = parts[i].Handle.CFrame
handle.CanCollide = true
handle.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
handle.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(25, 50),
(math.random() - 0.5) * 25
)
handle.Parent = Ragdoll
parts[i].Handle.Transparency = 1
end
end
end
for _, Limb in pairs(BonesR15[Joint.Name]) do
local limb = SkeletonR15[Limb]:Clone()
limb.Anchored = true
limb.CanCollide = false
limb.Parent = Ragdoll
local offset = SkeletonR15.rig[Joint.Name].CFrame:ToObjectSpace(limb.CFrame)
Joints[limb] = function() return Joint.CFrame * offset end
end
local Attachment = Instance.new("Attachment")
Attachment.CFrame = Joint.CFrame
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..ClientModule.GoreSoundIDs[math.random(1, #ClientModule.GoreSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(ClientModule.GoreSoundPitchMin, ClientModule.GoreSoundPitchMax)
Sound.Volume = ClientModule.GoreSoundVolume
local function spawner()
local C = GoreEffect:GetChildren()
for i = 1, #C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
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
Sound:Play()
end
Thread:Spawn(spawner)
Debris:AddItem(Attachment, 10)
end
end
local function R15Gib(Joint, Ragdoll, ClientModule, GoreEffect)
if Ragdoll:FindFirstChild("UpperTorso") and Joint.Transparency ~= 1 and not Ragdoll:FindFirstChild("gibbed") and (Joint.Position - Camera.CFrame.p).Magnitude <= RenderDistance then
Joint.Transparency = 1
local Tag = Instance.new("StringValue", Ragdoll)
Tag.Name = "gibbed"
local Decal = Joint:FindFirstChildOfClass("Decal")
if Decal then
Decal:Destroy()
end
if Joint.Name == "Head" then
local parts = Ragdoll:GetChildren()
for i = 1, #parts do
if parts[i]:IsA("Hat") or parts[i]:IsA("Accessory") then
local handle = parts[i].Handle:Clone()
local children = handle:GetChildren()
for i = 1, #children do
if children[i]:IsA("Weld") then
children[i]:Destroy()
end
end
handle.CFrame = parts[i].Handle.CFrame
handle.CanCollide = true
handle.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
handle.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(25, 50),
(math.random() - 0.5) * 25
)
handle.Parent = Ragdoll
parts[i].Handle.Transparency = 1
end
end
for _, headPart in pairs(DamagedHeadParts) do
local part = Gibs[headPart]:Clone()
part.Color = Joint.Color
part.CFrame = Joint.CFrame
part.RotVelocity = Vector3.new((math.random() - 0.5) * 25, (math.random() - 0.5) * 25, (math.random() - 0.5) * 25)
part.Velocity = Vector3.new(
(math.random() - 0.5) * 25,
math.random(50, 100),
(math.random() - 0.5) * 25
)
part.Parent = Ragdoll
end
end
for _, Limb in pairs(GoreR15[Joint.Name]) do
local limb = GibsR15[Limb]:Clone()
limb.Anchored = true
limb.CanCollide = false
if not (limb.Name:match("flesh") or limb.Name:match("bone")) then
limb.Color = Joint.Color
if not limb.Name:match("head") then
if limb.Name:match("leg") or limb.Name:match("foot") then
if Ragdoll:FindFirstChildOfClass("Pants") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Pants").PantsTemplate
end
else
if limb.Name:match("torso") then
if Ragdoll:FindFirstChildOfClass("Shirt") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Shirt").ShirtTemplate
else
if Ragdoll:FindFirstChildOfClass("Pants") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Pants").PantsTemplate
end
end
else
if Ragdoll:FindFirstChildOfClass("Shirt") then
limb.TextureID = Ragdoll:FindFirstChildOfClass("Shirt").ShirtTemplate
end
end
end
end
end
limb.Parent = Ragdoll
local offset = GibsR15.rig[Joint.Name].CFrame:ToObjectSpace(limb.CFrame)
Joints[limb] = function() return Joint.CFrame * offset end
end
local Attachment = Instance.new("Attachment")
Attachment.CFrame = Joint.CFrame
Attachment.Parent = workspace.Terrain
local Sound = Instance.new("Sound",Attachment)
Sound.SoundId = "rbxassetid://"..ClientModule.GoreSoundIDs[math.random(1, #ClientModule.GoreSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(ClientModule.GoreSoundPitchMin, ClientModule.GoreSoundPitchMax)
Sound.Volume = ClientModule.GoreSoundVolume
local function spawner()
local C = GoreEffect:GetChildren()
for i = 1, #C do
if C[i].className == "ParticleEmitter" then
local count = 1
local Particle = C[i]:Clone()
Particle.Parent = Attachment
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
Sound:Play()
end
Thread:Spawn(spawner)
Debris:AddItem(Attachment, 10)
end
end
local function GibJoint(Joint, Ragdoll, ClientModule, GoreEffect)
if ClientModule.GoreEffectEnabled then
if Ragdoll:FindFirstChildOfClass("Humanoid") then
if Ragdoll:FindFirstChildOfClass("Humanoid").RigType == Enum.HumanoidRigType.R6 then
if DoOdds(ClientModule.FullyGibbedLimbChance) then
FullR6Gib(Joint, Ragdoll, ClientModule, GoreEffect)
else
R6Gib(Joint, Ragdoll, ClientModule, GoreEffect)
end
else
if DoOdds(ClientModule.FullyGibbedLimbChance) then
FullR15Gib(Joint, Ragdoll, ClientModule, GoreEffect)
else
R15Gib(Joint, Ragdoll, ClientModule, GoreEffect)
end
end
end
end
end
Gib.Event:Connect(GibJoint)
VisualizeGore.OnClientEvent:Connect(GibJoint)
RunService.RenderStepped:Connect(function(dt)
for part, cframe in next, Joints do
part.CFrame = cframe()
end
end)
|
-- Deal Damage
|
takeDamage.OnServerEvent:Connect(function(fired, hit, damage)
local humanoid = hit
humanoid:TakeDamage(damage)
end)
|
--[[
Manages batch updating of tween objects.
]]
|
local RunService = game:GetService("RunService")
local lerpType = require(script.lerpType)
local getTweenRatio = require(script.getTweenRatio)
local updateAll = require(script.Parent.Parent.Parent.Dependencies).updateAll
local TweenScheduler = {}
type Set<T> = {[T]: any}
local WEAK_KEYS_METATABLE = {__mode = "k"}
|
-- Indicator class
|
local Indicator = {}
Indicator.all = {}
function Indicator:new(position)
local newIndicator = newIndicator or {}
-- Properties
newIndicator.time = (3.2*math.max(0.24,(damagedone/100))) or 1
newIndicator.position = humanoid:FindFirstChild("creator").Value.Character:FindFirstChild("Torso").Position or Vector3.new()
print(newIndicator.position)
newIndicator.timeCreated = tick()
newIndicator.timeExpire = tick() + newIndicator.time
newIndicator.alive = true
newIndicator.frame = frTemplate:clone()
newIndicator.frame.Parent = gui
newIndicator.frame.Archivable = false
setmetatable(newIndicator, Indicator)
self.__index = self
table.insert(Indicator.all, newIndicator)
newIndicator:update()
return newIndicator
end
function Indicator:expire()
self.alive = false
-- Cleanup resources
self.frame:Destroy()
-- Remove from all
for i = 1, #Indicator.all do
if self == Indicator.all[i] then
table.remove(Indicator.all, i)
break
end
end
end
function Indicator:setAngle(angleRadians)
if not self.alive then return end
local angleDegrees = angleRadians * (180 / math.pi)
self.frame.Position = UDim2.new(
.5,
math.cos(angleRadians) * radius + self.frame.AbsoluteSize.X / -2,
.5,
math.sin(angleRadians) * radius + self.frame.AbsoluteSize.Y / -2
)
self.frame.Rotation = angleDegrees + 90
end
function Indicator:update()
if tick() >= self.timeExpire then
self:expire()
else
local perc = (tick() - self.timeCreated) / self.time
self:setAngle(getCameraAngle(camera) - angleBetweenPoints(camera.Focus.p, self.position) - math.pi / 2)
self.frame.ImageLabel.ImageTransparency = perc
self.frame.ImageLabel.Size = UDim2.new(0, 350, 0, 350 * (1 - perc))
end
end
function Indicator:updateAll()
local i = 1
while i <= #Indicator.all do
local indicator = Indicator.all[i]
indicator:update()
if indicator.alive then
i = i + 1
end
end
end
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
return function(position, text, speed, distanceMult)
--- Fix arguments
speed = speed or 1
text = text or ""
distanceMult = distanceMult or 1
--- Variables
local holder = _L.GUIFX.GetHolder()
local resolution = game.Workspace.CurrentCamera.ViewportSize
local newPosition = position + UDim2.new(0, 0, 0, -(resolution.Y / 5) * distanceMult)
--- Create
local label = Instance.new("TextLabel")
label.AnchorPoint = Vector2.new(0.5, 0.5)
label.Position = position
label.Size = UDim2.new(0, 250, 0, 250)
label.BackgroundTransparency = 1
label.BorderSizePixel = 0
label.TextColor3 = Color3.new(1, 1, 1)
label.TextStrokeTransparency = 0.5
label.Text = text
label.Name = "Floating Text"
label.Font = Enum.Font.GothamBold
label.TextSize = 20
label.Parent = holder
--- Tweem
local tween = _L.Functions.FastTween(label, {TextTransparency = 1, TextStrokeTransparency = 1, Position = newPosition}, {speed})
--- Cleanup
_L.Functions.AddDebris(label, 5)
tween.Completed:Connect(function()
label:Destroy()
end)
--
return label
end
|
-- /**
-- * Returns a presentation string of your `val` object
-- * @param val any potential JavaScript object
-- * @param options Custom settings
-- */
|
local function format(val: any, options: OptionsReceived?): string
if options then
validateOptions(options)
if options.plugins then
local plugin_ = findPlugin((options.plugins :: Plugins), val)
if plugin_ ~= nil then
return printPlugin(plugin_, val, getConfig(options), "", 0, {})
end
end
end
local basicResult = printBasicValue(
val,
getOption(options, "printFunctionName"),
getOption(options, "escapeRegex"),
getOption(options, "escapeString")
)
if basicResult ~= nil then
return basicResult
end
-- ROBLOX deviation: luau doesn't handle optional arguments, explicitly pass nil
return printComplexValue(val, getConfig(options), "", 0, {}, nil)
end
local plugins = {
AsymmetricMatcher = AsymmetricMatcher,
ConvertAnsi = ConvertAnsi,
ReactElement = ReactElement,
ReactTestComponent = ReactTestComponent,
-- ROBLOX deviation: Roblox Instance matchers
RobloxInstance = RobloxInstance,
}
return {
format = format,
default = format,
plugins = plugins,
DEFAULT_OPTIONS = DEFAULT_OPTIONS,
}
|
--[[feature ideas:
- setting to auto-focus screen when character is close to a screen
]]
|
function setHumanoidControl(hasControl)
local character = localPlayer.Character
if character and character.Parent then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not hasControl then
humanoid.WalkSpeed = 0
if humanoid.UseJumpPower then
humanoid.JumpPower = 0
else
humanoid.JumpHeight = 0
end
humanoid.AutoRotate = false
else
humanoid.WalkSpeed = StarterPlayer.CharacterWalkSpeed
if humanoid.UseJumpPower then
humanoid.JumpPower = StarterPlayer.CharacterJumpPower
else
humanoid.JumpHeight = StarterPlayer.CharacterJumpHeight
end
humanoid.AutoRotate = true
end
end
-- Find the jump button and adjust it's visibility
if UserInputService.TouchEnabled then
local playerGui = localPlayer:FindFirstChild("PlayerGui")
if playerGui then
local touchGui = playerGui:FindFirstChild("TouchGui")
if touchGui then
local controlFrame = touchGui:FindFirstChild("TouchControlFrame")
if controlFrame then
local jumpButton = controlFrame:FindFirstChild("JumpButton")
if jumpButton then
TweenService:Create(
touchGui.TouchControlFrame.JumpButton,
TweenInfo.new(0.5),
{ ImageTransparency = hasControl and 0 or 1 }
):Play()
end
end
end
end
end
end
function setCameraCF(screenPart)
local halfFOV = math.rad(camera.FieldOfView / 2)
local halfScreenHeight = screenPart.Size.Y / 2
local distanceOffset = halfScreenHeight / math.tan(halfFOV)
local cameraAspectRatio = (camera.ViewportSize.X / camera.ViewportSize.Y)
local screenAspectRatio = screenPart.Size.X / screenPart.Size.Y
if cameraAspectRatio < screenAspectRatio then
distanceOffset = distanceOffset / (cameraAspectRatio / screenAspectRatio)
end
local targetCF = screenPart.CFrame * CFrame.new(0, 0, -(distanceOffset + screenPart.Size.Z / 2))
return CFrame.new(targetCF.Position, screenPart.Position)
end
function getCharacterPart()
local character = localPlayer.Character
if character and character.Parent and character:IsA("Model") then
return character.PrimaryPart
end
end
function updateButtonVisuals()
if button and button.Parent then
if fullscreenModule.FocusedScreen == buttonTargetScreen then
button.Image = ZOOM_OUT_ICON
button.GamepadPrompt.Image = BACKOUT_GAMEPAD_BUTTON_ICON
else
button.Image = ZOOM_IN_ICON
button.GamepadPrompt.Image = FULLSCREEN_GAMEPAD_BUTTON_ICON
end
end
end
function fullscreenModule.FocusScreen(screenPart, manageLockingCharacterControl)
-- If screenPart is nil or the character, the camera will return to the character
if screenPart and screenPart == localPlayer.Character then
screenPart = nil
end
if fullscreenModule.FocusedScreen == screenPart then
return
end
fullscreenModule.FocusedScreen = screenPart
transitionCount += 1
local thisTransitionCount = transitionCount
updateButtonVisuals()
-- Tween camera into position
local targetCF = nil
local camTweenRelativeTargetPart = nil
if screenPart then
if manageLockingCharacterControl then
setHumanoidControl(false)
end
-- If focusing a screen, and no currently saved relative info for the character, then capture relative character info.
if not characterCamCF then
local cameraSubjectPart = getCharacterPart()
if cameraSubjectPart then
characterCamCF = CFrame.new(cameraSubjectPart.Position):ToObjectSpace(camera.CFrame)
characterCamCFIsRelative = true
else
characterCamCF = camera.CFrame
characterCamCFIsRelative = false
end
end
camera.CameraType = Enum.CameraType.Scriptable
targetCF = setCameraCF(screenPart)
else
targetCF = characterCamCF
if characterCamCFIsRelative then
camTweenRelativeTargetPart = getCharacterPart()
end
end
if targetCF then
-- Tweening an object so that we can apply the tweened cframe overtop a camera subject
local cfObject = Instance.new("CFrameValue")
if camTweenRelativeTargetPart and camTweenRelativeTargetPart.Parent then
cfObject.Value = CFrame.new(camTweenRelativeTargetPart.Position * -1) * camera.CFrame
else
cfObject.Value = camera.CFrame
end
local cameraTween = TweenService:Create(
cfObject,
TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{ Value = targetCF }
)
local cfChangedConn = cfObject.Changed:connect(function()
if transitionCount == thisTransitionCount then
camera.CameraType = Enum.CameraType.Scriptable
if camTweenRelativeTargetPart and camTweenRelativeTargetPart.Parent then
camera.CFrame = CFrame.new(camTweenRelativeTargetPart.Position) * cfObject.Value
else
camera.CFrame = cfObject.Value
end
end
end)
cameraTween:Play()
cameraTween.Completed:Wait()
cfChangedConn:Disconnect()
cfChangedConn = nil
cfObject = nil
end
-- Camera finished tweening
if transitionCount == thisTransitionCount then
if screenPart then
-- Lock camera to screen
if lockCameraConnection then
lockCameraConnection:Disconnect()
lockCameraConnection = nil
end
lockCameraConnection = RunService.RenderStepped:Connect(function()
if transitionCount == thisTransitionCount then
camera.CFrame = setCameraCF(screenPart)
end
end)
else
-- Return camera to character
camera.CameraType = Enum.CameraType.Custom
characterCamCF = nil
characterCamCFIsRelative = false
local character = localPlayer.Character
if character and character.Parent then
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
camera.CameraSubject = humanoid
end
end
if manageLockingCharacterControl then
setHumanoidControl(true)
end
end
end
end
function toggleFullscreen()
if button then -- Only toggle if button exists, as a user control
if fullscreenModule.FocusedScreen ~= buttonTargetScreen then
fullscreenModule.FocusScreen(buttonTargetScreen)
else
fullscreenModule.FocusScreen()
end
end
end
function backoutFullscreen()
if button and fullscreenModule.FocusedScreen == buttonTargetScreen then
-- Only backout if there is a button for usercontrol and it is hooked up to the current screen
fullscreenModule.FocusScreen()
end
end
function updateGamepadPromptVisibility()
if button and button.Parent then
local gamepadPrompt = button:FindFirstChild("GamepadPrompt")
if gamepadPrompt then
if UserInputService.GamepadEnabled then
button.GamepadPrompt.Visible = false
button.Active = false
else
button.GamepadPrompt.Visible = true
button.Active = true
end
end
end
end
UserInputService.GamepadConnected:connect(updateGamepadPromptVisibility)
UserInputService.GamepadDisconnected:connect(updateGamepadPromptVisibility)
function fullscreenModule.RemoveButton()
if buttonConnection then
buttonConnection:Disconnect()
buttonConnection = nil
end
if gamepadButtonConnection then
gamepadButtonConnection:Disconnect()
gamepadButtonConnection = nil
end
if button and button.Parent then
button:Destroy()
end
if buttonGui and buttonGui.Parent then
buttonGui:Destroy()
end
button = nil
buttonGui = nil
buttonTargetScreen = nil
end
function fullscreenModule.CreateButtonToFocusScreen(screenPart)
local playerGui = localPlayer:FindFirstChild("PlayerGui")
if playerGui then
if button or buttonGui then
fullscreenModule.RemoveButton()
end
buttonTargetScreen = screenPart
buttonGui = buttonGuiTemplate:clone()
button = buttonGui.Button
buttonConnection = button.Activated:connect(toggleFullscreen)
gamepadButtonConnection = UserInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Gamepad1 then
if input.KeyCode == FULLSCREEN_GAMEPAD_BUTTON then
toggleFullscreen()
elseif input.KeyCode == BACKOUT_GAMEPAD_BUTTON then
backoutFullscreen()
end
end
end)
updateButtonVisuals()
buttonGui.Parent = playerGui
end
end
return fullscreenModule
|
--Eventos Touched para hacer daño al jugador
|
filoEspada.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and confirmador == true then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
humanoid:TakeDamage(10)
confirmador = false
end
end)
|
-- Implements equivalent functionality to JavaScript's `array.splice`, including
-- the interface and behaviors defined at:
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice
|
return function<T>(array: Array<T>, start: number, deleteCount: number?, ...: T): Array<T>
-- Append varargs without removing anything
if start > #array then
local varargCount = select("#", ...)
for i = 1, varargCount do
local toInsert = select(i, ...)
table.insert(array, toInsert)
end
return {}
else
local length = #array
-- In the JS impl, a negative fromIndex means we should use length -
-- index; with Lua, of course, this means that 0 is still valid, but
-- refers to the end of the array the way that '-1' would in JS
if start < 1 then
start = math.max(length - math.abs(start), 1)
end
local deletedItems = {} :: Array<T>
-- If no deleteCount was provided, we want to delete the rest of the
-- array starting with `start`
local deleteCount_: number = deleteCount or length
if deleteCount_ > 0 then
local lastIndex = math.min(length, start + math.max(0, deleteCount_ - 1))
for i = start, lastIndex do
local deleted = table.remove(array, start) :: T
table.insert(deletedItems, deleted)
end
end
local varargCount = select("#", ...)
-- Do this in reverse order so we can always insert in the same spot
for i = varargCount, 1, -1 do
local toInsert = select(i, ...)
table.insert(array, start, toInsert)
end
return deletedItems
end
end
|
-- Just drop this inside of the tool
|
local CS = game:GetService('CollectionService')
local Character
script.Parent.Equipped:Connect(function()
Character = script:FindFirstAncestorOfClass('Model')
if not CS:HasTag(Character,'Mic') then
CS:AddTag(Character,'Mic')
else
CS:RemoveTag(Character,'Mic')
end
end)
script.Parent.Unequipped:Connect(function()
CS:RemoveTag(Character,'Mic')
end)
script.Parent.AncestryChanged:Connect(function()
CS:RemoveTag(Character,'Mic')
end)
|
-- перебираем
|
for a,b in pairs(tmp) do
wait(1)
local param = b.Name -- сохраняем имя
local anchor = b.Parent -- сохраняем привязку
local orient = b.Orientation-- сохраняем оринтацию
local temp = orig:Clone() -- создаём клон
-- размещаём клон в пространстве вместо нашего кирпича
temp:SetPrimaryPartCFrame(CFrame.new(b.Position)
* CFrame.Angles(0, math.rad(orient.Y),0)
)
temp.Name = param -- меняем имя
temp.Parent = anchor -- вынимаем из ОЗУ
temp.scrStatueAllDay.Enabled=true
b.Parent = nil -- удаляем кирпич
end
|
--By Luckymaxer
|
r = game:service("RunService")
local damage = 1
local slash_damage = 5
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = sword:WaitForChild("SlashSound")
function blow(hit)
if not hit or not hit.Parent then
return
end
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid.Health > 0 and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
if humanoid.Health == 0 then
for i, v in pairs(humanoid.Parent:GetChildren()) do
if v:IsA("BasePart") then
for ii = 1, 2 do
local Wood = Instance.new("Part")
Wood.Name = "Wood"
Wood.Locked = true
Wood.CanCollide = true
Wood.Anchored = false
Wood.FormFactor = Enum.FormFactor.Custom
Wood.TopSurface = Enum.SurfaceType.Smooth
Wood.BottomSurface = Enum.SurfaceType.Smooth
Wood.Size = Vector3.new(1, 0.8, 1)
Wood.Material = Enum.Material.Wood
Wood.BrickColor = BrickColor.new("Dark orange")
game:GetService("Debris"):AddItem(Wood, 5)
Wood.Parent = game:GetService("Workspace")
Wood.CFrame = v.CFrame + Vector3.new(0, (ii * Wood.Size.y), 0)
v:Destroy()
end
end
end
end
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
game.Debris:AddItem(creator_tag, 1)
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
attack()
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--[[
CameraShakePresets.Bump
CameraShakePresets.Explosion
CameraShakePresets.Earthquake
CameraShakePresets.BadTrip
CameraShakePresets.HandheldCamera
CameraShakePresets.Vibration
CameraShakePresets.RoughDriving
--]]
|
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakePresets = {
-- A high-magnitude, short, yet smooth shake.
-- Should happen once.
Bump = function()
local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
-- An intense and rough shake.
-- Should happen once.
Explosion = function()
local c = CameraShakeInstance.new(5, 10, 0, 1.5)
c.PositionInfluence = Vector3.new(0.75, 0.75, 0.75)
c.RotationInfluence = Vector3.new(6, 3, 3)
return c
end;
-- A continuous, rough shake
-- Sustained.
Earthquake = function()
local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(1, 1, 4)
return c
end;
-- A bizarre shake with a very high magnitude and low roughness.
-- Sustained.
BadTrip = function()
local c = CameraShakeInstance.new(10, 0.15, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 4)
return c
end;
-- A subtle, slow shake.
-- Sustained.
HandheldCamera = function()
local c = CameraShakeInstance.new(1, 0.25, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
return c
end;
-- A very rough, yet low magnitude shake.
-- Sustained.
Vibration = function()
local c = CameraShakeInstance.new(0.4, 20, 2, 2)
c.PositionInfluence = Vector3.new(0, 0.15, 0)
c.RotationInfluence = Vector3.new(1.25, 0, 4)
return c
end;
-- A slightly rough, medium magnitude shake.
-- Sustained.
RoughDriving = function()
local c = CameraShakeInstance.new(1, 2, 1, 1)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
}
return setmetatable({}, {
__index = function(t, i)
local f = CameraShakePresets[i]
if (type(f) == "function") then
return f()
end
error("No preset found with index \"" .. i .. "\"")
end;
})
|
-- Preload animations
|
function playAnimation(animName, transitionTime, humanoid)
if (animName ~= currentAnim) then
if (oldAnimTrack ~= nil) then
oldAnimTrack:Stop()
oldAnimTrack:Destroy()
end
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
|
--
|
local function rayPlane(p, v, s, n)
local r = p - s;
local t = -r:Dot(n) / v:Dot(n)
return p + t * v, t
end;
|
-- Get reference to the Dock frame
|
local dock = script.Parent.Parent.DockShelf
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Gravity = 196.20
JumpHeightPercentage = 0.25
ToolEquipped = false
local ToolUnequipped, DescendantAdded, DescendantRemoving;
function GetAllConnectedParts(Object)
local Parts = {}
local function GetConnectedParts(Object)
for i, v in pairs(Object:GetConnectedParts()) do
local Ignore = false
for ii, vv in pairs(Parts) do
if v == vv then
Ignore = true
end
end
if not Ignore then
table.insert(Parts, v)
GetConnectedParts(v)
end
end
end
GetConnectedParts(Object)
return Parts
end
function SetGravityEffect()
if not GravityEffect or not GravityEffect.Parent then
GravityEffect = Instance.new("BodyForce")
GravityEffect.Name = "GravityCoilEffect"
GravityEffect.Parent = Torso
end
local TotalMass = 0
local ConnectedParts = GetAllConnectedParts(Torso)
for i, v in pairs(ConnectedParts) do
if v:IsA("BasePart") then
TotalMass = (TotalMass + v:GetMass())
end
end
local TotalMass = (TotalMass * 196.20 * (1 - JumpHeightPercentage))
GravityEffect.force = Vector3.new(0, TotalMass, 0)
end
function HandleGravityEffect(Enabled)
if not CheckIfAlive() then
return
end
for i, v in pairs(Torso:GetChildren()) do
if v:IsA("BodyForce") then
v:Destroy()
end
end
for i, v in pairs({ToolUnequipped, DescendantAdded, DescendantRemoving}) do
if v then
v:disconnect()
end
end
if Enabled then
CurrentlyEquipped = true
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
SetGravityEffect()
DescendantAdded = Character.DescendantAdded:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
DescendantRemoving = Character.DescendantRemoving:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
if HumanoidDied then
HumanoidDied:disconnect()
end
HumanoidDied = Humanoid.Died:connect(function()
if GravityEffect and GravityEffect.Parent then
GravityEffect:Destroy()
end
end)
HandleGravityEffect(true)
ToolEquipped = true
end
function Unequipped()
if HumanoidDied then
HumanoidDied:disconnect()
end
HandleGravityEffect(false)
ToolEquipped = false
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- setup emote chat hook
--[[Game.Players.LocalPlayer.Chatted:connect(function(msg)
local emote = ""
if (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
end
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, 0.1, Humanoid)
end
-- print("===> " .. string.sub(msg, 1, 3) .. "(" .. emote .. ")")
end)
]]
| |
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:StopSustained([fadeOutTime])
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
-- Sustained shake:
camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
-- Stop all sustained shakes:
camShake:StopSustained(1) -- Argument is the fadeout time (defaults to the same as fadein time if not supplied)
-- Stop only one sustained shake:
shakeInstance = camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
wait(2)
shakeInstance:StartFadeOut(1) -- Argument is the fadeout time
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
GitHub repository: https://github.com/Sleitnick/RbxCameraShaker
--]]
|
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.CameraShakePresets)
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:StopSustained(duration)
for _,c in pairs(self._camShakeInstances) do
if (c.fadeOutDuration == 0) then
c:StartFadeOut(duration or c.fadeInDuration)
end
end
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
local shake = c:UpdateShake(dt)
posAddShake = posAddShake + (shake * c.PositionInfluence)
rotAddShake = rotAddShake + (shake * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
--wait(2)
--camera:Interpolate(game.Workspace.Part2.CFrame, game.Workspace.Part1.CFrame, 2)
--wait(2)
--camera.CameraType = "Custom"
| |
-- Decompiled with the Synapse X Luau decompiler.
|
if not game:IsLoaded() then
game.Loaded:Wait()
end
local v1 = script:FindFirstAncestor("MainUI");
local v2 = require(script.Parent);
local v3 = require(v1.Modules.Spring);
local l__UserInputService__4 = game:GetService("UserInputService");
local l__TweenService__5 = game:GetService("TweenService");
local l__LocalPlayer__6 = game.Players.LocalPlayer;
local l__Humanoid__7 = v2.char:WaitForChild("Humanoid");
local l__HumanoidRootPart__8 = v2.char:WaitForChild("HumanoidRootPart");
local v9 = CFrame.new(0, 0, 0);
local v10 = Vector3.new(0, 0, 0);
local v11 = Vector3.new(0, 0, 0);
local v12 = v3.new(Vector3.new(0, -2.7, -0.25));
v12:__newindex("Damper", 1);
v12:__newindex("Speed", 20);
v2.cam.CameraType = Enum.CameraType.Scriptable;
local v13 = {
Acog = 25,
HoloSight = 15,
[""] = 0
};
local v14 = Instance.new("PointLight");
v14.Color = Color3.fromRGB(120, 122, 138);
v14.Range = 10;
v14.Brightness = 0.55;
if v2.platform == "console" then
v14.Brightness = 0.7;
pcall(function()
game.Lighting.XBoxColor.Enabled = true;
end);
end;
v14.Shadows = false;
v14.Parent = v2.char:WaitForChild("Head");
delay(5, function()
v14.Parent = v2.char:WaitForChild("Head");
end);
local v15 = RaycastParams.new();
v15.CollisionGroup = "NoPlayer";
v15.FilterDescendantsInstances = { v2.viewmodel, v2.char };
l__UserInputService__4.MouseIconEnabled = false;
local v16 = Vector2.new(0, 0);
v2.update();
local u1 = 0.016666666666666666;
local u2 = v9;
local u3 = v16;
local function u4(p1)
if p1 ~= p1 then
return;
end;
local v17 = p1.Magnitude / u1;
if v17 >= 1000 then
p1 = p1 * (1000 / v17);
end;
v2.ay_t = math.clamp(v2.ay_t - p1.y, -65, 65);
v2.ax_t = (v2.ax_t - p1.x) % 360;
if v2.camlock ~= nil then
v2.camlockedoffset[2] = math.clamp(v2.camlockedoffset[2] - p1.y / 2, -25, 25);
v2.camlockedoffset[1] = math.clamp(v2.camlockedoffset[1] - p1.x / 2, -65, 65);
else
v2.camlockedoffset = { 0, 0 };
end;
u2 = u2 * (CFrame.Angles(0, math.rad(-p1.x), 0) * CFrame.Angles(math.rad(-p1.y), 0, 0));
v2.bobspring:Impulse(Vector3.new(-p1.x / 1, -p1.y / 1, 0));
end;
l__UserInputService__4.InputChanged:connect(function(p2, p3)
if (p2.UserInputType == Enum.UserInputType.MouseMovement or p2.UserInputType == Enum.UserInputType.Touch or p2.KeyCode == Enum.KeyCode.Thumbstick2) and (p3 == false and v2.dead == false or (v2.hrc == true or p2.KeyCode == Enum.KeyCode.Thumbstick2) and v2.dead == true) then
local v18 = v2.cam.FieldOfView / 90;
local v19 = Vector2.new(p2.Delta.x * 0.5, p2.Delta.y * 0.5) * 0.8 * v18;
if p2.UserInputType == Enum.UserInputType.Touch then
v19 = Vector2.new(p2.Delta.x * 0.5, p2.Delta.y * 0.5) * 1.6 * v18;
v2.hrc = true;
end;
if p2.KeyCode == Enum.KeyCode.Thumbstick2 then
local v20 = Vector2.new(p2.Position.x * 0.5, p2.Position.y * -1 * 0.5) * 12 * v18;
if p2.Position.Magnitude < 0.3 then
v20 = Vector2.new(0, 0);
end;
u3 = v20.Unit * math.max(v20.Magnitude - 0.3, 0) * 1.5;
return;
else
u4(v19);
end;
end;
end);
v1.Event_RepositionViewmodel.Event:Connect(function()
v12:__newindex("Position", Vector3.new(0, -3, -0.35));
end);
local u5 = nil;
local u6 = v10;
local u7 = v11;
v2.cam.CameraType = Enum.CameraType.Scriptable;
game["Run Service"]:BindToRenderStep("caminit", 95, function(p4)
if workspace.CurrentCamera.CameraType ~= Enum.CameraType.Attach or script.Parent.Parent.Parent.Parent.lol.Initiator.Main_Game.stopscriptablecam.Value == false then
v2.cam.CameraType = Enum.CameraType.Scriptable;
end
if v2.freemouse == true or v2.dead == true and v2.hrc == false then
l__UserInputService__4.MouseBehavior = Enum.MouseBehavior.Default;
l__UserInputService__4.MouseIconEnabled = true;
else
l__UserInputService__4.MouseBehavior = Enum.MouseBehavior.LockCenter;
l__UserInputService__4.MouseIconEnabled = false;
end;
if u5 ~= nil then
local v21 = Vector2.new(u5.Position.x * 0.5, u5.Position.y * -1 * 0.5) * 12 * (v2.cam.FieldOfView / 90);
u4(v21.Unit * math.max(v21.Magnitude - 0.25, 0) * 1.1 * p4 * 60);
end;
if v2.camlock ~= nil and ((tick() <= v2.camlock.last or l__Humanoid__7.MoveDirection.Magnitude < 0.75) and v2.camlockHead == false) then
v2.ax_t = v2.camlock.x;
v2.ay_t = v2.camlock.y;
v2.ax = v2.camlock.x;
v2.ay = v2.camlock.y;
elseif v2.camlock == nil or not v2.camlockHead then
if v2.camlock ~= nil then
game:GetService("ReplicatedStorage").Bricks.CamLock:FireServer();
end;
local v22 = v2.ax_t - v2.ax;
v2.ax = (v2.ax + (math.abs(v22) > 180 and v22 - v22 / math.abs(v22) * 360 or v22) * math.clamp(p4 * 25, 0.01, 1)) % 360;
v2.ay = v2.ay + (v2.ay_t - v2.ay) * math.clamp(p4 * 25, 0.01, 1);
end;
local v23 = Vector3.new(0, 0.2, 0);
local v24 = Vector3.new(0, 0, -0.25);
if v2.crouching == true then
v23 = Vector3.new(0, -0.2, 0);
end;
u1 = p4;
u6 = u6 + (v23 - u6) * math.clamp(p4 * 10, 0.01, 1);
u7 = u7 + (v24 - u7) * math.clamp(p4 * 10, 0.01, 1);
v2.fovspring = v2.fovspring + (v2.fovtarget - v2.fovspring) * math.clamp(p4 * 5, 0.01, 1);
v2.az = v2.az + (v2.az_t - v2.az) * math.clamp(p4 * 12, 0.01, 1);
local v25 = Vector3.new(0, 0, 0);
if v2.dead == true then
local v26 = workspace.CurrentRooms:FindFirstChild(game:GetService("ReplicatedStorage").GameData.LatestRoom.Value);
if v26 and v2.spectarget == nil then
v2.basecamcf = v26.RoomStart.CFrame * CFrame.new(0, 5, -9) * CFrame.Angles(0, math.rad((tick() - v2.deathtick) * 15), 0);
elseif v2.spectarget and (v2.spectarget:IsA("Player") and v2.spectarget.Character) and v2.spectarget.Character:FindFirstChild("HumanoidRootPart") and v2.spectarget.Character:FindFirstChild("Humanoid") and v2.spectarget.Character:FindFirstChild("Humanoid").Health > 0.01 then
v2.basecamcf = CFrame.new(v2.spectarget.Character:FindFirstChild("HumanoidRootPart").Position) * CFrame.new(0, 1, 0) * CFrame.Angles(0, math.rad(v2.ax), 0) * CFrame.Angles(-0.2617993877991494, 0, 0) * CFrame.new(0, 0, 6);
end;
elseif v2.stunned == true then
local l__p__27 = (l__HumanoidRootPart__8.CFrame * CFrame.new(0, 1.45, 0)).p;
local v28 = RaycastParams.new();
v28.CollisionGroup = "NoPlayer";
v28.FilterDescendantsInstances = { v2.viewmodel, v2.char };
local v29 = workspace:Raycast(l__p__27, l__HumanoidRootPart__8.CFrame.LookVector * 0.75, v28);
if v29 and v29.Position then
local l__Position__30 = v29.Position;
local l__Instance__31 = v29.Instance;
if l__Position__30 then
v2.basecamcf = l__HumanoidRootPart__8.CFrame * CFrame.new(0, 1.45, -(l__p__27 - l__Position__30)) * CFrame.Angles(math.rad(math.clamp(v2.bobspring.p.Y, -80, 80)), math.rad(math.clamp(v2.bobspring.p.X, -80, 80)), math.rad(math.clamp(v2.bobspring.p.Z, -40, 40)));
end;
else
v2.basecamcf = l__HumanoidRootPart__8.CFrame * CFrame.new(0, 1.45, -0.75) * CFrame.Angles(math.rad(math.clamp(v2.bobspring.p.Y, -80, 80)), math.rad(math.clamp(v2.bobspring.p.X, -80, 80)), math.rad(math.clamp(v2.bobspring.p.Z, -40, 40)));
end;
v2.bobspring:__newindex("Speed", 3);
elseif v2.camlock ~= nil then
v2.basecamcf = (v2.char.Head.CFrame + Vector3.new(0, 0.5, 0)) * CFrame.new(0, 0.15, -0.25) * CFrame.Angles(math.rad(math.clamp(v2.bobspring.p.Y, -80, 80)), math.rad(math.clamp(v2.bobspring.p.X, -80, 80)), math.rad(math.clamp(v2.bobspring.p.Z, -40, 40))) * CFrame.Angles(0, math.rad(v2.camlockedoffset[1]), 0) * CFrame.Angles(math.rad(v2.camlockedoffset[2]), 0, 0);
v2.bobspring:__newindex("Speed", 5);
else
v2.bobspring:__newindex("Speed", 12);
local v32 = (v2.char.Head.Position - v2.char.LowerTorso.Position) * Vector3.new(1, 0, 1);
v2.basecamcf = CFrame.new(v2.char.Head.Position + v2.char.Head.CFrame.UpVector * 0.2) * CFrame.new(u6) * CFrame.Angles(0, math.rad(v2.ax), 0) * CFrame.new(-v2.az / 40, 0, -0.2) * CFrame.Angles(math.rad(math.clamp(v2.ay + v2.bobspring.Position.Y + v2.spring.p.Y + v2.recoil_spring.Position.Y, -88, 88)), 0, 0) * CFrame.new(u7) * CFrame.Angles(0, 0, math.rad(v2.az / 2)) * CFrame.Angles(0, math.rad(math.clamp(-v2.bobspring.p.X, -20, 20)), math.rad(math.clamp(-v2.bobspring.Position.X, -20, 20)));
end;
if v2.stopcam == false then
v2.finalCamCFrame = v2.basecamcf * v2.csgo + v25;
v2.cam.FieldOfView = v2.fovspring;
end;
end);
local function v33()
local v34 = {};
for v35, v36 in pairs((l__UserInputService__4:GetGamepadState(Enum.UserInputType.Gamepad1))) do
v34[v36.KeyCode] = v36;
end;
u5 = v34[Enum.KeyCode.Thumbstick2];
print(u5);
end;
l__UserInputService__4.GamepadConnected:Connect(v33);
if l__UserInputService__4.GamepadEnabled then
v33();
end;
|
--[[
REALISM_CONFIG.Sounds = {}
REALISM_CONFIG.MaterialMap = {}
for i,v in pairs(script:GetChildren()) do
if v.ClassName == "Sound" then
REALISM_CONFIG.Sounds[v.Name] = tostring(v.SoundId):match("%d+")
end
end
-]]
|
return REALISM_CONFIG
|
-- Returns whether part is a child of Roads folder
|
local function isRoad(part)
local mapAncestor = part:FindFirstAncestor("Roads")
return mapAncestor and mapAncestor:IsA("Folder")
end
|
--
|
wait(1)
powerlmp.Value = true
function Alert()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end
function Fire()
script.Parent.Assembly.Sound.Click:Play()
script.Parent.Parent.On.Value = true
script.Parent.Values.Fire.Value = true
end
function Test()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Parent.On.Value = true
end
function Attack()
script.AttackScript.Disabled = false
end
function Cancel()
script.Parent.Assembly.Sound.Click:Play()
script.AttackScript.Disabled = true
script.Parent.Values.Fire.Value = false
script.Parent.Values.Mode.Value = 4
script.Parent.Parent.On.Value = false
script.Parent.Values.TimerOn.Value = false
end
function Timer()
script.Timer.Disabled = false
signallmp.Value = true
end
script.Parent.Values.TimerOn.Changed:connect(function()
if script.Parent.Values.TimerOn.Value == true then
if script.Parent.Values.Mode.Value == 2 then
Alert()
Timer()
elseif script.Parent.Values.Mode.Value == 3 then
Attack()
Timer()
elseif script.Parent.Values.Mode.Value == 5 then
Fire()
Timer()
elseif script.Parent.Values.Mode.Value == 1 then
Test()
elseif script.Parent.Values.Mode.Value == 4 then
script.AttackScript.Disabled = true
Cancel()
end
end
end)
script.Parent.Values.Mode.Changed:connect(function()
if script.Parent.Values.Mode.Value == 4 then
Cancel()
end
end)
script.Parent.Values.Fire.Changed:connect(function()
if script.Parent.Values.Fire.Value == true then
script.Parent.Parent.Parent.FederalSignalRCM3.Modulate.Value = true
else
script.Parent.Parent.Parent.FederalSignalRCM3.Modulate.Value = false
end
end)
|
--There's a reason why this hasn't been done before by ROBLOX users (as far as I know)
--It's really mathy, really long, and really confusing.
--0.000033 seconds is the worst, 0.000018 looks like the average case.
--Also I ran out of local variables so I had to redo everything so that I could reuse the names lol.
--So don't even try to read it.
|
local BoxCollision do
local components=CFrame.new().components
function BoxCollision(CFrame0,Size0,CFrame1,Size1,AssumeTrue)
local m00,m01,m02,
m03,m04,m05,
m06,m07,m08,
m09,m10,m11 =components(CFrame0)
local m12,m13,m14,
m15,m16,m17,
m18,m19,m20,
m21,m22,m23 =components(CFrame1)
local m24,m25,m26 =Size0.x/2,Size0.y/2,Size0.z/2
local m27,m28,m29 =Size1.x/2,Size1.y/2,Size1.z/2
local m30,m31,m32 =m12-m00,m13-m01,m14-m02
local m00 =m03*m30+m06*m31+m09*m32
local m01 =m04*m30+m07*m31+m10*m32
local m02 =m05*m30+m08*m31+m11*m32
local m12 =m15*m30+m18*m31+m21*m32
local m13 =m16*m30+m19*m31+m22*m32
local m14 =m17*m30+m20*m31+m23*m32
local m30 =m12>m27 and m12-m27
or m12<-m27 and m12+m27
or 0
local m31 =m13>m28 and m13-m28
or m13<-m28 and m13+m28
or 0
local m32 =m14>m29 and m14-m29
or m14<-m29 and m14+m29
or 0
local m33 =m00>m24 and m00-m24
or m00<-m24 and m00+m24
or 0
local m34 =m01>m25 and m01-m25
or m01<-m25 and m01+m25
or 0
local m35 =m02>m26 and m02-m26
or m02<-m26 and m02+m26
or 0
local m36 =m30*m30+m31*m31+m32*m32
local m30 =m33*m33+m34*m34+m35*m35
local m31 =m24<m25 and (m24<m26 and m24 or m26)
or (m25<m26 and m25 or m26)
local m32 =m27<m28 and (m27<m29 and m27 or m29)
or (m28<m29 and m28 or m29)
if m36<m31*m31 or m30<m32*m32 then
return true
elseif m36>m24*m24+m25*m25+m26*m26 or m30>m27*m27+m28*m28+m29*m29 then
return false
elseif AssumeTrue==nil then
local m30=m03*m15+m06*m18+m09*m21
local m31=m03*m16+m06*m19+m09*m22
local m32=m03*m17+m06*m20+m09*m23
local m03=m04*m15+m07*m18+m10*m21
local m06=m04*m16+m07*m19+m10*m22
local m09=m04*m17+m07*m20+m10*m23
local m04=m05*m15+m08*m18+m11*m21
local m07=m05*m16+m08*m19+m11*m22
local m10=m05*m17+m08*m20+m11*m23
local m05=m29*m29
local m08=m27*m27
local m11=m28*m28
local m15=m24*m30
local m16=m25*m03
local m17=m26*m04
local m18=m24*m31
local m19=m25*m06
local m20=m26*m07
local m21=m24*m32
local m22=m25*m09
local m23=m26*m10
local m33=m15+m16+m17-m12;if m33*m33<m08 then local m34=m18+m19+m20-m13;if m34*m34<m11 then local m35=m21+m22+m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=-m15+m16+m17-m12;if m33*m33<m08 then local m34=-m18+m19+m20-m13;if m34*m34<m11 then local m35=-m21+m22+m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=m15-m16+m17-m12;if m33*m33<m08 then local m34=m18-m19+m20-m13;if m34*m34<m11 then local m35=m21-m22+m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=-m15-m16+m17-m12;if m33*m33<m08 then local m34=-m18-m19+m20-m13;if m34*m34<m11 then local m35=-m21-m22+m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=m15+m16-m17-m12;if m33*m33<m08 then local m34=m18+m19-m20-m13;if m34*m34<m11 then local m35=m21+m22-m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=-m15+m16-m17-m12;if m33*m33<m08 then local m34=-m18+m19-m20-m13;if m34*m34<m11 then local m35=-m21+m22-m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=m15-m16-m17-m12;if m33*m33<m08 then local m34=m18-m19-m20-m13;if m34*m34<m11 then local m35=m21-m22-m23-m14;if m35*m35<m05 then return true;end;end;end;
local m33=-m15-m16-m17-m12;if m33*m33<m08 then local m34=-m18-m19-m20-m13;if m34*m34<m11 then local m35=-m21-m22-m23-m14;if m35*m35<m05 then return true;end;end;end;
local m12=m24*m24
local m13=m25*m25
local m14=m26*m26
local m15=m27*m04
local m16=m28*m07
local m17=m27*m30
local m18=m28*m31
local m19=m27*m03
local m20=m28*m06
local m21=m29*m10
local m22=m29*m32
local m23=m29*m09
local m35=(m02-m26+m15+m16)/m10;if m35*m35<m05 then local m33=m00+m17+m18-m35*m32;if m33*m33<m12 then local m34=m01+m19+m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26+m15+m16)/m10;if m35*m35<m05 then local m33=m00+m17+m18-m35*m32;if m33*m33<m12 then local m34=m01+m19+m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26-m15+m16)/m10;if m35*m35<m05 then local m33=m00-m17+m18-m35*m32;if m33*m33<m12 then local m34=m01-m19+m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26-m15+m16)/m10;if m35*m35<m05 then local m33=m00-m17+m18-m35*m32;if m33*m33<m12 then local m34=m01-m19+m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26+m15-m16)/m10;if m35*m35<m05 then local m33=m00+m17-m18-m35*m32;if m33*m33<m12 then local m34=m01+m19-m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26+m15-m16)/m10;if m35*m35<m05 then local m33=m00+m17-m18-m35*m32;if m33*m33<m12 then local m34=m01+m19-m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26-m15-m16)/m10;if m35*m35<m05 then local m33=m00-m17-m18-m35*m32;if m33*m33<m12 then local m34=m01-m19-m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26-m15-m16)/m10;if m35*m35<m05 then local m33=m00-m17-m18-m35*m32;if m33*m33<m12 then local m34=m01-m19-m20-m35*m09;if m34*m34<m13 then return true;end;end;end;
local m35=(m00-m24+m17+m18)/m32;if m35*m35<m05 then local m33=m01+m19+m20-m35*m09;if m33*m33<m13 then local m34=m02+m15+m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m17+m18)/m32;if m35*m35<m05 then local m33=m01+m19+m20-m35*m09;if m33*m33<m13 then local m34=m02+m15+m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m17+m18)/m32;if m35*m35<m05 then local m33=m01-m19+m20-m35*m09;if m33*m33<m13 then local m34=m02-m15+m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m17+m18)/m32;if m35*m35<m05 then local m33=m01-m19+m20-m35*m09;if m33*m33<m13 then local m34=m02-m15+m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24+m17-m18)/m32;if m35*m35<m05 then local m33=m01+m19-m20-m35*m09;if m33*m33<m13 then local m34=m02+m15-m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m17-m18)/m32;if m35*m35<m05 then local m33=m01+m19-m20-m35*m09;if m33*m33<m13 then local m34=m02+m15-m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m17-m18)/m32;if m35*m35<m05 then local m33=m01-m19-m20-m35*m09;if m33*m33<m13 then local m34=m02-m15-m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m17-m18)/m32;if m35*m35<m05 then local m33=m01-m19-m20-m35*m09;if m33*m33<m13 then local m34=m02-m15-m16-m35*m10;if m34*m34<m14 then return true;end;end;end;
local m35=(m01-m25+m19+m20)/m09;if m35*m35<m05 then local m33=m02+m15+m16-m35*m10;if m33*m33<m14 then local m34=m00+m17+m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m19+m20)/m09;if m35*m35<m05 then local m33=m02+m15+m16-m35*m10;if m33*m33<m14 then local m34=m00+m17+m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m19+m20)/m09;if m35*m35<m05 then local m33=m02-m15+m16-m35*m10;if m33*m33<m14 then local m34=m00-m17+m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m19+m20)/m09;if m35*m35<m05 then local m33=m02-m15+m16-m35*m10;if m33*m33<m14 then local m34=m00-m17+m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25+m19-m20)/m09;if m35*m35<m05 then local m33=m02+m15-m16-m35*m10;if m33*m33<m14 then local m34=m00+m17-m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m19-m20)/m09;if m35*m35<m05 then local m33=m02+m15-m16-m35*m10;if m33*m33<m14 then local m34=m00+m17-m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m19-m20)/m09;if m35*m35<m05 then local m33=m02-m15-m16-m35*m10;if m33*m33<m14 then local m34=m00-m17-m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m19-m20)/m09;if m35*m35<m05 then local m33=m02-m15-m16-m35*m10;if m33*m33<m14 then local m34=m00-m17-m18-m35*m32;if m34*m34<m12 then return true;end;end;end;
local m35=(m02-m26+m16+m21)/m04;if m35*m35<m08 then local m33=m00+m18+m22-m35*m30;if m33*m33<m12 then local m34=m01+m20+m23-m35*m03;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26+m16+m21)/m04;if m35*m35<m08 then local m33=m00+m18+m22-m35*m30;if m33*m33<m12 then local m34=m01+m20+m23-m35*m03;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26-m16+m21)/m04;if m35*m35<m08 then local m33=m00-m18+m22-m35*m30;if m33*m33<m12 then local m34=m01-m20+m23-m35*m03;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26-m16+m21)/m04;if m35*m35<m08 then local m33=m00-m18+m22-m35*m30;if m33*m33<m12 then local m34=m01-m20+m23-m35*m03;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26+m16-m21)/m04;if m35*m35<m08 then local m33=m00+m18-m22-m35*m30;if m33*m33<m12 then local Axi=m01+m20-m23-m35*m03;if Axi*Axi<m13 then return true;end;end;end;
local m35=(m02+m26+m16-m21)/m04;if m35*m35<m08 then local m33=m00+m18-m22-m35*m30;if m33*m33<m12 then local sAn=m01+m20-m23-m35*m03;if sAn*sAn<m13 then return true;end;end;end;
local m35=(m02-m26-m16-m21)/m04;if m35*m35<m08 then local m33=m00-m18-m22-m35*m30;if m33*m33<m12 then local gle=m01-m20-m23-m35*m03;if gle*gle<m13 then return true;end;end;end;
local m35=(m02+m26-m16-m21)/m04;if m35*m35<m08 then local m33=m00-m18-m22-m35*m30;if m33*m33<m12 then local m34=m01-m20-m23-m35*m03;if m34*m34<m13 then return true;end;end;end;
local m35=(m00-m24+m18+m22)/m30;if m35*m35<m08 then local m33=m01+m20+m23-m35*m03;if m33*m33<m13 then local m34=m02+m16+m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m18+m22)/m30;if m35*m35<m08 then local m33=m01+m20+m23-m35*m03;if m33*m33<m13 then local m34=m02+m16+m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m18+m22)/m30;if m35*m35<m08 then local m33=m01-m20+m23-m35*m03;if m33*m33<m13 then local m34=m02-m16+m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m18+m22)/m30;if m35*m35<m08 then local m33=m01-m20+m23-m35*m03;if m33*m33<m13 then local m34=m02-m16+m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24+m18-m22)/m30;if m35*m35<m08 then local m33=m01+m20-m23-m35*m03;if m33*m33<m13 then local m34=m02+m16-m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m18-m22)/m30;if m35*m35<m08 then local m33=m01+m20-m23-m35*m03;if m33*m33<m13 then local m34=m02+m16-m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m18-m22)/m30;if m35*m35<m08 then local m33=m01-m20-m23-m35*m03;if m33*m33<m13 then local m34=m02-m16-m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m18-m22)/m30;if m35*m35<m08 then local m33=m01-m20-m23-m35*m03;if m33*m33<m13 then local m34=m02-m16-m21-m35*m04;if m34*m34<m14 then return true;end;end;end;
local m35=(m01-m25+m20+m23)/m03;if m35*m35<m08 then local m33=m02+m16+m21-m35*m04;if m33*m33<m14 then local m34=m00+m18+m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m20+m23)/m03;if m35*m35<m08 then local m33=m02+m16+m21-m35*m04;if m33*m33<m14 then local m34=m00+m18+m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m20+m23)/m03;if m35*m35<m08 then local m33=m02-m16+m21-m35*m04;if m33*m33<m14 then local m34=m00-m18+m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m20+m23)/m03;if m35*m35<m08 then local m33=m02-m16+m21-m35*m04;if m33*m33<m14 then local m34=m00-m18+m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25+m20-m23)/m03;if m35*m35<m08 then local m33=m02+m16-m21-m35*m04;if m33*m33<m14 then local m34=m00+m18-m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m20-m23)/m03;if m35*m35<m08 then local m33=m02+m16-m21-m35*m04;if m33*m33<m14 then local m34=m00+m18-m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m20-m23)/m03;if m35*m35<m08 then local m33=m02-m16-m21-m35*m04;if m33*m33<m14 then local m34=m00-m18-m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m20-m23)/m03;if m35*m35<m08 then local m33=m02-m16-m21-m35*m04;if m33*m33<m14 then local m34=m00-m18-m22-m35*m30;if m34*m34<m12 then return true;end;end;end;
local m35=(m02-m26+m21+m15)/m07;if m35*m35<m11 then local m33=m00+m22+m17-m35*m31;if m33*m33<m12 then local m34=m01+m23+m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26+m21+m15)/m07;if m35*m35<m11 then local m33=m00+m22+m17-m35*m31;if m33*m33<m12 then local m34=m01+m23+m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26-m21+m15)/m07;if m35*m35<m11 then local m33=m00-m22+m17-m35*m31;if m33*m33<m12 then local m34=m01-m23+m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26-m21+m15)/m07;if m35*m35<m11 then local m33=m00-m22+m17-m35*m31;if m33*m33<m12 then local m34=m01-m23+m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26+m21-m15)/m07;if m35*m35<m11 then local m33=m00+m22-m17-m35*m31;if m33*m33<m12 then local m34=m01+m23-m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26+m21-m15)/m07;if m35*m35<m11 then local m33=m00+m22-m17-m35*m31;if m33*m33<m12 then local m34=m01+m23-m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02-m26-m21-m15)/m07;if m35*m35<m11 then local m33=m00-m22-m17-m35*m31;if m33*m33<m12 then local m34=m01-m23-m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m02+m26-m21-m15)/m07;if m35*m35<m11 then local m33=m00-m22-m17-m35*m31;if m33*m33<m12 then local m34=m01-m23-m19-m35*m06;if m34*m34<m13 then return true;end;end;end;
local m35=(m00-m24+m22+m17)/m31;if m35*m35<m11 then local m33=m01+m23+m19-m35*m06;if m33*m33<m13 then local m34=m02+m21+m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m22+m17)/m31;if m35*m35<m11 then local m33=m01+m23+m19-m35*m06;if m33*m33<m13 then local m34=m02+m21+m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m22+m17)/m31;if m35*m35<m11 then local m33=m01-m23+m19-m35*m06;if m33*m33<m13 then local m34=m02-m21+m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m22+m17)/m31;if m35*m35<m11 then local m33=m01-m23+m19-m35*m06;if m33*m33<m13 then local m34=m02-m21+m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24+m22-m17)/m31;if m35*m35<m11 then local m33=m01+m23-m19-m35*m06;if m33*m33<m13 then local m34=m02+m21-m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24+m22-m17)/m31;if m35*m35<m11 then local m33=m01+m23-m19-m35*m06;if m33*m33<m13 then local m34=m02+m21-m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00-m24-m22-m17)/m31;if m35*m35<m11 then local m33=m01-m23-m19-m35*m06;if m33*m33<m13 then local m34=m02-m21-m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m00+m24-m22-m17)/m31;if m35*m35<m11 then local m33=m01-m23-m19-m35*m06;if m33*m33<m13 then local m34=m02-m21-m15-m35*m07;if m34*m34<m14 then return true;end;end;end;
local m35=(m01-m25+m23+m19)/m06;if m35*m35<m11 then local m33=m02+m21+m15-m35*m07;if m33*m33<m14 then local m34=m00+m22+m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m23+m19)/m06;if m35*m35<m11 then local m33=m02+m21+m15-m35*m07;if m33*m33<m14 then local m34=m00+m22+m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m23+m19)/m06;if m35*m35<m11 then local m33=m02-m21+m15-m35*m07;if m33*m33<m14 then local m34=m00-m22+m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m23+m19)/m06;if m35*m35<m11 then local m33=m02-m21+m15-m35*m07;if m33*m33<m14 then local m34=m00-m22+m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25+m23-m19)/m06;if m35*m35<m11 then local m33=m02+m21-m15-m35*m07;if m33*m33<m14 then local m34=m00+m22-m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25+m23-m19)/m06;if m35*m35<m11 then local m33=m02+m21-m15-m35*m07;if m33*m33<m14 then local m34=m00+m22-m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01-m25-m23-m19)/m06;if m35*m35<m11 then local m33=m02-m21-m15-m35*m07;if m33*m33<m14 then local m34=m00-m22-m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
local m35=(m01+m25-m23-m19)/m06;if m35*m35<m11 then local m33=m02-m21-m15-m35*m07;if m33*m33<m14 then local m34=m00-m22-m17-m35*m31;if m34*m34<m12 then return true;end;end;end;
return false
else
return AssumeTrue
end
end
end
local setmetatable =setmetatable
local components =CFrame.new().components
local workspace =workspace
local BoxCast =workspace.FindPartsInRegion3WithIgnoreList
local unpack =unpack
local type =type
local IsA =game.IsA
local r3 =Region3.new
local v3 =Vector3.new
local function Region3BoundingBox(CFrame,Size)
local x,y,z,
xx,yx,zx,
xy,yy,zy,
xz,yz,zz=components(CFrame)
local sx,sy,sz=Size.x/2,Size.y/2,Size.z/2
local px =sx*(xx<0 and -xx or xx)
+sy*(yx<0 and -yx or yx)
+sz*(zx<0 and -zx or zx)
local py =sx*(xy<0 and -xy or xy)
+sy*(yy<0 and -yy or yy)
+sz*(zy<0 and -zy or zy)
local pz =sx*(xz<0 and -xz or xz)
+sy*(yz<0 and -yz or yz)
+sz*(zz<0 and -zz or zz)
return r3(v3(x-px,y-py,z-pz),v3(x+px,y+py,z+pz))
end
local function FindAllPartsInRegion3(Region3,Ignore)
local Ignore=type(Ignore)=="table" and Ignore or {Ignore}
local Last=#Ignore
repeat
local Parts=BoxCast(workspace,Region3,Ignore,100)
local Start=#Ignore
for i=1,#Parts do
Ignore[Start+i]=Parts[i]
end
until #Parts<100;
return {unpack(Ignore,Last+1,#Ignore)}
end
local function CastPoint(Region,Point)
return BoxPointCollision(Region.CFrame,Region.Size,Point)
end
local function CastSphere(Region,Center,Radius)
return BoxSphereCollision(Region.CFrame,Region.Size,Center,Radius)
end
local function CastBox(Region,CFrame,Size)
return BoxCollision(Region.CFrame,Region.Size,CFrame,Size)
end
local function CastPart(Region,Part)
return (not IsA(Part,"Part") or Part.Shape=="Block") and
BoxCollision(Region.CFrame,Region.Size,Part.CFrame,Part.Size)
or BoxSphereCollision(Region.CFrame,Region.Size,Part.Position,Part.Size.x)
end
local function CastParts(Region,Parts)
local Inside={}
for i=1,#Parts do
if CastPart(Region,Parts[i]) then
Inside[#Inside+1]=Parts[i]
end
end
return Inside
end
local function Cast(Region,Ignore)
local Inside={}
local Parts=FindAllPartsInRegion3(Region.Region3,Ignore)
for i=1,#Parts do
if CastPart(Region,Parts[i]) then
Inside[#Inside+1]=Parts[i]
end
end
return Inside
end
local function NewRegion(CFrame,Size)
local Object ={
CFrame =CFrame;
Size =Size;
Region3 =Region3BoundingBox(CFrame,Size);
Cast =Cast;
CastPart =CastPart;
CastParts =CastParts;
CastPoint =CastPoint;
CastSphere =CastSphere;
CastBox =CastBox;
}
return setmetatable({},{
__index=Object;
__newindex=function(_,Index,Value)
Object[Index]=Value
Object.Region3=Region3BoundingBox(Object.CFrame,Object.Size)
end;
})
end
Region.Region3BoundingBox =Region3BoundingBox
Region.FindAllPartsInRegion3=FindAllPartsInRegion3
Region.BoxPointCollision =BoxPointCollision
Region.BoxSphereCollision =BoxSphereCollision
Region.BoxCollision =BoxCollision
Region.new =NewRegion
function Region.FromPart(Part)
return NewRegion(Part.CFrame,Part.Size)
end
return Region
|
----- Script -----
|
Button.Activated:Connect(function()
Events.HammerEvent:FireServer()
Frame.Visible = false
end)
|
--[=[
@type ServerMiddleware {ServerMiddlewareFn}
@within KnitServer
An array of server middleware functions.
]=]
|
type ServerMiddleware = { ServerMiddlewareFn }
|
--[=[
@prop Stopped Signal
@within Component
Fired when an instance of a component is stopped.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
MyComponent.Stopped:Connect(function(component) end)
```
]=]
|
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Signal = require(script.Parent.Signal)
local Trove = require(script.Parent.Trove)
local IS_SERVER = RunService:IsServer()
local DEFAULT_ANCESTORS = {workspace, game:GetService("Players")}
local renderId = 0
local function NextRenderName(): string
renderId += 1
return "ComponentRender" .. tostring(renderId)
end
local function InvokeExtensionFn(component, fnName: string)
for _,extension in ipairs(component._activeExtensions) do
local fn = extension[fnName]
if type(fn) == "function" then
fn(component)
end
end
end
local function ShouldConstruct(component): boolean
for _,extension in ipairs(component._activeExtensions) do
local fn = extension.ShouldConstruct
if type(fn) == "function" then
local shouldConstruct = fn(component)
if not shouldConstruct then
return false
end
end
end
return true
end
local function GetActiveExtensions(component, extensionList)
local activeExtensions = table.create(#extensionList)
local allActive = true
for _,extension in ipairs(extensionList) do
local fn = extension.ShouldExtend
local shouldExtend = type(fn) ~= "function" or not not fn(component)
if shouldExtend then
table.insert(activeExtensions, extension)
else
allActive = false
end
end
return if allActive then extensionList else activeExtensions
end
|
-- << RETRIEVE FRAMEWORK >>
|
local main = require(game:GetService("ReplicatedStorage").HDAdminContainer.SharedModules.MainFramework)
local modules = main.modules
local settings = main.settings
|
--//Shifting//-
|
if key == "u" then
if script.Parent.IsOn.Value == true then
script.Parent.IsOn.Value = false
for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
child.Enabled = false
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
child.Enabled = false
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do
child.Enabled = false
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do
child.Enabled = false
end
carSeat.DriveSeat.Start1:Stop()
carSeat.DriveSeat.Start2:Stop()
carSeat.DriveSeat.Rev:Stop()
carSeat.DriveSeat.Rev2:Stop()
carSeat.DriveSeat.Idle:Stop()
carSeat.DriveSeat.Idle2:Stop()
else
script.Parent.IsOn.Value = true
for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
child.Enabled = true
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
child.Enabled = true
carSeat.DriveSeat.Start1:Play()
carSeat.DriveSeat.Start2:Play()
end
wait(2.5)
carSeat.DriveSeat.Idle:Play()
carSeat.DriveSeat.Idle2:Play()
carSeat.DriveSeat.Idle3:Play()
carSeat.DriveSeat.Idle4:Play()
for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
child.Enabled = true
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
child.Enabled = true
end
wait(0.5)
carSeat.DriveSeat.Rev:Play()
carSeat.DriveSeat.Rev2:Play()
for index, child in pairs(carSeat.Body.ExhaustSmoke.E1:GetChildren()) do
child.Enabled = false
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E2:GetChildren()) do
child.Enabled = false
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E3:GetChildren()) do
child.Enabled = true
end
for index, child in pairs(carSeat.Body.ExhaustSmoke.E4:GetChildren()) do
child.Enabled = true
end
wait(.03)
end
end
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{49},t},
[16]={n,f},
[19]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{49,45,44,28,29,31,32,34},t},
[21]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{49,48},t},
[27]={{49,45,44,28,27},t},
[14]={n,f},
[31]={{49,45,44,28,29,31},t},
[56]={{49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{49,45,44,28,29},t},
[13]={n,f},
[47]={{49,48,47},t},
[12]={n,f},
[45]={{49,45},t},
[57]={{49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{49,45,44,28,29,31,32,33,36},t},
[25]={{49,45,44,28,27,26,25},t},
[71]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{49,45,44,28,29,31,32,34,35},t},
[53]={{49,48,47,52,53},t},
[73]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{49,45,44,28,29,31,32,33},t},
[69]={{49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{49,45,44,28,27,26},t},
[68]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{49,48,47,50},t},
[66]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{49,45,44,28,27,26,25,24},t},
[23]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{49,45,44},t},
[39]={{49,45,44,28,29,31,32,34,35,39},t},
[32]={{49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{49,48,47,50,51},t},
[18]={n,f},
[67]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{49,48,47,52,53,54,55},t},
[46]={{49,48,47,46},t},
[42]={{49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{49,45,44,28,29,31,32,34,35,40},t},
[52]={{49,48,47,52},t},
[54]={{49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{49,45,44,28,29,31,32,34,35,38},t},
[28]={{49,45,44,28},t},
[5]={n,f},
[64]={{49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
GetEnv = nil;
origEnv = nil;
logError = nil;
return function()
local u1 = nil;
local l__client__2 = client;
local u3 = nil;
local u4 = nil;
local u5 = nil;
local u6 = nil;
local u7 = nil;
local u8 = nil;
getfenv().client = nil;
getfenv().service = nil;
getfenv().script = nil;
l__client__2.GUIs = {};
l__client__2.GUIHolder = service.New("Folder");
l__client__2.Variables = {
Init = function()
u1 = l__client__2.UI;
u3 = l__client__2.Anti;
u4 = l__client__2.Core;
u5 = l__client__2.Variables;
u6 = l__client__2.Functions;
u7 = l__client__2.Process;
u8 = l__client__2.Remote;
end,
CodeName = "",
UIKeepAlive = true,
KeybindsEnabled = true,
ParticlesEnabled = true,
CapesEnabled = true,
Particles = {},
KeyBinds = {},
Capes = {},
savedUI = {},
localSounds = {},
LightingSettings = {
Ambient = service.Lighting.Ambient,
Brightness = service.Lighting.Brightness,
ColorShift_Bottom = service.Lighting.ColorShift_Bottom,
ColorShift_Top = service.Lighting.ColorShift_Top,
GlobalShadows = service.Lighting.GlobalShadows,
OutdoorAmbient = service.Lighting.OutdoorAmbient,
Outlines = service.Lighting.Outlines,
ShadowColor = service.Lighting.ShadowColor,
GeographicLatitude = service.Lighting.GeographicLatitude,
Name = service.Lighting.Name,
TimeOfDay = service.Lighting.TimeOfDay,
FogColor = service.Lighting.FogColor,
FogEnd = service.Lighting.FogEnd,
FogStart = service.Lighting.FogStart
}
};
end;
|
-- local EndToCurrent_Distance = (At - Point).Magnitude
-- local Change = (LastToCurrent_Distance - EndToCurrent_Distance)
|
LengthChanged:Fire(Origin, LastPoint, RayDir.Unit, LastToCurrent_Distance, CosmeticBulletObject)
LastPoint = At
if Hit then
--V5: WAIT! Test if the cosmetic bullet was hit!
if Hit ~= CosmeticBulletObject then
--Hit something, stop the function and fire the hit event.
RayHit:Fire(Hit, Point, Normal, Material, CosmeticBulletObject)
return
end
--If we make it here, then the bullet isn't nil, and it was the hit.(The above code exits the function)
--This will ignore the bullet. For this function, no changes need to be made.
end
DistanceTravelled = DistanceTravelled + LastToCurrent_Distance
end
--If we make it here, then we have exceeded the maximum distance.
--As part of Ver. 4, the hit function will fire here.
--V5: Changed below to return all nil values aside from the point
RayHit:Fire(nil, LastPoint, nil, nil, CosmeticBulletObject)
end
--Fire without physics
local function MainCastFireNoPhys(Origin, Direction, Velocity, Function, CosmeticBulletObject, List)
if type(Velocity) == "number" then
Velocity = Direction.Unit * Velocity
end
local Distance = Direction.Magnitude
local NormalizedDir = Direction / Distance
local LastPoint = Origin
local DistanceTravelled = 0
while DistanceTravelled <= Distance do
local Delta = RunService.Heartbeat:Wait()
local UpgradedDir = (NormalizedDir + Velocity).Unit
local Start = Origin + (UpgradedDir.Unit * DistanceTravelled)
local RayDir = UpgradedDir * Velocity.Magnitude * Delta
local Hit, Point, Normal, Material = Function(Start, RayDir, List)
local ExtraDistance = (Start - Point).Magnitude
local ModifiedDistance = DistanceTravelled + ExtraDistance
--Note to self: ExtraDistance will be identical to RayDir.Magnitude unless something is hit.
LengthChanged:Fire(Origin, LastPoint, RayDir.Unit, ExtraDistance, CosmeticBulletObject)
LastPoint = Point
if Hit then
--V5: WAIT! Test if the cosmetic bullet was hit!
if Hit ~= CosmeticBulletObject then
--Hit something, stop the function and fire the hit event.
RayHit:Fire(Hit, Point, Normal, Material, CosmeticBulletObject)
return
end
--If we make it here, then the bullet isn't nil, and it was the cosmetic bullet that got hit. (The above code exits the function)
--In this case, we will kindly ignore the bullet.
--We will also set ExtraDistance to RayDir.Magnitude (See above - These two values are identical if nothing is hit, so we need to force that behavior)
ExtraDistance = RayDir.Magnitude
end
DistanceTravelled = DistanceTravelled + ExtraDistance
end
--V5: Changed below to return all nil values aside from the point
RayHit:Fire(nil, LastPoint, nil, nil, CosmeticBulletObject)
end
--Fire a ray from origin -> direction at the specified velocity.
function Caster:Fire(Origin, Direction, Velocity, CosmeticBulletObject, BulletAcceleration)
--Note to scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster)
assert(Caster == self, "Expected ':' not '.' calling member function Fire")
spawn(function ()
if UsingPhysics() or BulletAcceleration then
MainCastFire(Origin, Direction, Velocity, Cast, CosmeticBulletObject, nil, BulletAcceleration)
else
MainCastFireNoPhys(Origin, Direction, Velocity, Cast, CosmeticBulletObject)
end
end)
end
--Identical to above, but with a whitelist.
function Caster:FireWithWhitelist(Origin, Direction, Velocity, Whitelist, CosmeticBulletObject, BulletAcceleration)
--Note to scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster)
assert(Caster == self, "Expected ':' not '.' calling member function FireWithWhitelist")
spawn(function ()
if UsingPhysics() or BulletAcceleration then
MainCastFire(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist, BulletAcceleration)
else
MainCastFireNoPhys(Origin, Direction, Velocity, CastWhitelist, CosmeticBulletObject, Whitelist)
end
end)
end
--Identical to above, but with a blacklist.
function Caster:FireWithBlacklist(Origin, Direction, Velocity, Blacklist, CosmeticBulletObject, BulletAcceleration)
--Note to unaware scripters: 'self' is a variable lua creates when a method like ^ is run. It's an alias to the table that the function is part of (in this case, Caster)
assert(Caster == self, "Expected ':' not '.' calling member function FireWithBlacklist")
spawn(function ()
if UsingPhysics() or BulletAcceleration then
MainCastFire(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist, BulletAcceleration)
else
MainCastFireNoPhys(Origin, Direction, Velocity, CastBlacklist, CosmeticBulletObject, Blacklist)
end
end)
end
--Indexing stuff here.
--For those scripters new to Metatables, they allow you to fake information in tables by controlling how it works.
--This function will be run when you try to index anything of the fastcaster.
--If I were to do Caster["CoolIndex"], this function would fire, table being Caster, and Index being "CoolIndex".
--This means that I can return my own value, even if "CoolIndex" isn't valid.
--Neat, huh?
CMeta.__index = function (Table, Index)
if Table == Caster then
if Index == "IgnoreDescendantsInstance" then
return IgnoreDescendantsInstance
elseif Index == "RayHit" then
return RayHit
elseif Index == "LengthChanged" then
return LengthChanged
elseif Index == "Gravity" then
return Gravity
elseif Index == "ExtraForce" then
return ExtraForce
elseif Index == "HasPhysics" then
return UsingPhysics()
end
end
end
local IgnoreMode = false -- This is used so I can do some tricks below
--Same thing as above, just that this fires writing to the table (e.g. Caster["CoolIndex"] = "CoolValue")
CMeta.__newindex = function (Table, Index, Value)
if IgnoreMode then return end
if Table == Caster then
if Index == "IgnoreDescendantsInstance" then
assert(Value == nil or typeof(Value) == "Instance", "Bad argument \"" .. Index .. "\" (Instance expected, got " .. typeof(Value) .. ")")
IgnoreDescendantsInstance = Value
elseif Index == "Gravity" then
assert(typeof(Value) == "number", "Bad argument \"" .. Index .. "\" (number expected, got " .. typeof(Value) .. ")")
Gravity = Value
elseif Index == "ExtraForce" then
assert(typeof(Value) == "Vector3", "Bad argument \"" .. Index .. "\" (Vector3 expected, got " .. typeof(Value) .. ")")
ExtraForce = Value
elseif Index == "RayHit" or Index == "LengthChanged" or Index == "HasPhysics" then
error("Can't set value", 0)
end
end
end
--TRICK: I'm going to make dummy values for the properties and events.
--Roblox will show these in intellesence (the thing that suggests what to type in as you go)
IgnoreMode = true
Caster.RayHit = RayHit
Caster.LengthChanged = LengthChanged
Caster.IgnoreDescendantsInstance = IgnoreDescendantsInstance
Caster.Gravity = Gravity
Caster.ExtraForce = ExtraForce
Caster.HasPhysics = UsingPhysics()
IgnoreMode = false
--Better yet, while these values are just in the open, they will still be managed by the metatables.
CMeta.__metatable = "FastCaster"
return Caster
end
return FastCast
|
-- Minor input to buffer.
|
function ChangeBuffer:pushDiff(diff: Diff): ()
table.insert(self.line, diff)
end
|
--[=[
This function merges two dictionaries.
Keys *will* overwrite- if there are duplicate keys, dictionary2 will take priority.
```lua
local Dictionary = {
A = 1,
B = 2,
}
local SecondDictionary = {
C = 3,
D = 4,
}
print(TableKit.MergeDictionary(Dictionary, SecondDictionary)) -- prints { ["A"] = 1, ["B"] = 2, ["C"] = 3, ["D"] = 4 }
```
:::caution Potential overwrite
Keys are overwritten when using .MergeDictionary()
@within TableKit
@param dictionary1 table
@param dictionary2 table
@return table
]=]
|
function TableKit.MergeDictionary<dictionary1, dictionary2>(
dictionary1: { [unknown]: unknown },
dictionary2: { [unknown]: unknown }
): dictionary1 & dictionary2
local newTable = table.clone(dictionary1)
for key, value in dictionary2 do
newTable[key] = value
end
return newTable
end
|
--[[Weight and CG]]
|
Tune.Weight = 2810 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .75 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- Waits for the child of the specified parent
|
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local Tool = script.Parent
local Animations = {}
local MyHumanoid
local MyCharacter
local function PlayAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Play()
end
end
local function StopAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Stop()
end
end
function OnEquipped(mouse)
MyCharacter = Tool.Parent
MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
if MyHumanoid then
Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5'))
Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3'))
Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2'))
Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2'))
Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2'))
Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2'))
end
mouse.KeyDown:connect(function(key)
function Taunt()
--gather all of the humanoids in a 30stud radius
local torsos = {}
for _, p in pairs(game.Players:GetChildren()) do
if p ~= game.Players:GetPlayerFromCharacter(Tool.Parent) then
if p.Character and p.Character:FindFirstChild('Torso') then
torsos[#torsos+1] = p.Character.Torso
end
end
end
--now pull them in towards us
local mpos = Tool.Parent.Torso.Position
for _, torso in pairs(torsos) do
if (mpos-torso.Position).magnitude < 40 then
local dir = (mpos-torso.Position).unit
------------ stolen from dagger of time to make a character "fly" in some direction
local force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,1,0)
force.Parent = torso
torso.Velocity = dir*250
game.Debris:AddItem(force, 0.5)
------------
end
end
end
function rTaunt()
--gather all of the humanoids in a 30stud radius
local torsos = {}
for _, p in pairs(game.Players:GetChildren()) do
if p ~= game.Players:GetPlayerFromCharacter(Tool.Parent) then
if p.Character and p.Character:FindFirstChild('Torso') then
torsos[#torsos+1] = p.Character.Torso
end
end
end
--now pull them in towards us
local mpos = Tool.Parent.Torso.Position
for _, torso in pairs(torsos) do
if (mpos-torso.Position).magnitude < 40 then
local dir = (mpos-torso.Position).unit
------------ stolen from dagger of time to make a character "fly" in some direction
local force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,1,0)
force.Parent = torso
torso.Velocity = -dir*250
game.Debris:AddItem(force, 0.5)
------------
end
end
end
if key == 'q' then
if debounce==nil then
debounce=true
Animations['EquipAnim']:Play(.1,.8,2)
Taunt()
wait(5)
debounce=nil
end
elseif key == 'e' then
if debounce2==nil then
debounce2=true
Animations['EquipAnim']:Play(.1,.8,2)
rTaunt()
wait(5)
debounce2=nil
end
end
end)
Animations['EquipAnim']:Play(.1,.8,1)
PlayAnimation('IdleAnim')
end
function OnUnequipped()
Tool.Handle.deactivate:Play()
for animName, _ in pairs(Animations) do
StopAnimation(animName)
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
WaitForChild(Tool, 'PlaySlash').Changed:connect(
function (value)
--if value then
PlayAnimation('SlashAnim')
--else
-- StopAnimation('SlashAnim')
--end
end)
WaitForChild(Tool, 'PlayThrust').Changed:connect(
function (value)
--if value then
PlayAnimation('ThrustAnim')
--else
-- StopAnimation('ThrustAnim')
--end
end)
WaitForChild(Tool, 'PlayOverhead').Changed:connect(
function (value)
--if value then
Animations['OverheadAnim']:Play()
--else
-- StopAnimation('OverheadAnim')
--end
end)
|
-- SERVICES --
|
local CS = game:GetService("CollectionService")
local SSS = game:GetService("ServerScriptService")
|
-- RCM Settings V
|
self.WeaponWeight = 4 -- Weapon weight must be enabled in the Config module
self.ShellEjectionMod = true
self.Holster = true
self.HolsterPoint = "Torso"
self.HolsterCFrame = CFrame.new(0.65,0.1,-0.8) * CFrame.Angles(math.rad(-90),math.rad(15),math.rad(75))
self.FlashChance = 4 -- 0 = no muzzle flash, 10 = Always muzzle flash
self.ADSEnabled = { -- Ignore this setting if not using an ADS Mesh
true, -- Enabled for primary sight
true} -- Enabled for secondary sight (T)
self.ExplosiveAmmo = false -- Enables explosive ammo
self.ExplosionRadius = 70 -- Radius of explosion damage in studs
self.ExplosionType = "Default" -- Which explosion effect is used from the HITFX Explosion folder
self.IsLauncher = true -- For RPG style rocket launchers
self.EjectionOverride = nil -- Don't touch unless you know what you're doing with Vector3s
return self
|
--/Recoil Modification
|
module.camRecoil = {
RecoilUp = 1
,RecoilTilt = 1
,RecoilLeft = 1
,RecoilRight = 1
}
module.gunRecoil = {
RecoilUp = 1
,RecoilTilt = 1
,RecoilLeft = 1
,RecoilRight = 1
}
module.AimRecoilReduction = 1
module.AimSpreadReduction = 1
module.MinRecoilPower = 1
module.MaxRecoilPower = 1
module.RecoilPowerStepAmount = 1
module.MinSpread = 1
module.MaxSpread = 0.1
module.AimInaccuracyStepAmount = 1
module.AimInaccuracyDecrease = 1
module.WalkMult = 1
module.MuzzleVelocityMod = 1
return module
|
--//Setup//--
|
local WindLines = require(script.WindLines)
local WindShake = require(script.WindShake)
local WindSpeed = 20
local WindDirection = Vector3.new(-1, 1, 0)
local WindShakeSettings = {
WindPower = 0.75,
WindSpeed = WindSpeed,
WindDirection = WindDirection
}
local WindLinesSettings = {
WindDirection = WindDirection,
WindSpeed = WindSpeed,
LifeTime = 2,
SpawnRate = 20
}
local ShakableObjects = {
"Leaf",
"Leaves",
"Bush",
}
|
--[[
have all the edits only on the client until the client is done
then send fire the remote event once with all the changes
instead of per accessory.
too lazy to change. adopt me does it 1 by 1 soo...
]]
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
--[=[
@prop None Option<None>
@within Option
Represents no value.
]=]
|
Option.None = Option._new()
return Option
|
-- Function that other scripts can call to change a player's stats
|
function PlayerStatManager:ChangeStat(player, statName, value)
local playerUserId = "Player_" .. player.UserId
sessionData[playerUserId][statName] = value
end
function PlayerStatManager:ChangeStatInTycoonPurchases(player, statName, value)
local playerUserId = "Player_" .. player.UserId
sessionData[playerUserId]["TycoonPurchases"][statName] = value
print("Saving------------------> ",statName)
end
function PlayerStatManager:IncrementStat(player, statName, value)
local playerUserId = "Player_" .. player.UserId
if typeof(sessionData[playerUserId][statName]) == "number" then
sessionData[playerUserId][statName] = sessionData[playerUserId][statName] + value
end
end
local function setupPlayerData(player)
local playerMoney = serverStorage:WaitForChild("PlayerMoney")
local playerStats = playerMoney:FindFirstChild(player.Name)
--Sometimes people have duplicate tycoon add e.g in core handler script
--adds PlayerMoney to storage and number value with player name that holds the
--money value
if playerStats == nil then
playerStats = Instance.new("NumberValue",playerMoney)
playerStats.Name = player.Name
local isOwner = Instance.new("ObjectValue",playerStats)
isOwner.Name = "OwnsTycoon"
end
local playerUserId = "Player_" .. player.UserId
local success,data = pcall(function()
return playerData:GetAsync(playerUserId)
end)
if success then
if data then
print("----------Money: ---------> "..data["Money"])
print("Show tycoon purchases---------------------")
sessionData[playerUserId] = data
for key,value in pairs(sessionData[playerUserId]["TycoonPurchases"]) do
print(key,value)
end
print("End printing tycoon purchases-------------")
local playerMoneyChild = playerMoney:FindFirstChild(player.Name)
if playerMoneyChild then
playerMoneyChild.Value = playerMoneyChild.Value + data["Money"]
else print("------------playerMoneyChild is nil") end
else
print("setupPlayerData no data found for player ",player.Name)
wait()
local money = 0
local success,err = pcall(function()
if player:IsInGroup(SaveSettings.giveCashToPlayersInGroup.groupId) then
local plrCash = playerMoney:FindFirstChild(player.Name)
if plrCash then
plrCash.Value = plrCash.Value + SaveSettings.giveCashToPlayersInGroup.cashAmount
money = plrCash.Value
end
end
end)
if success == false then
print(err)
end
sessionData[playerUserId] = {}
sessionData[playerUserId]["Money"] = money
sessionData[playerUserId]["RebirthCount"] = 0
sessionData[playerUserId]["TycoonPurchases"] = {}
end
playerStats.Changed:Connect(function(newValue)
print("playerStats.Changed ",newValue)
sessionData[playerUserId]["Money"] = newValue
end)
else
warn("Couldn't get data")
print(data)
end
end
|
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.
|
function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment?
--if ClientSettings.Debug.Value == false then return nil end
if true then
return
end
local adornment = Instance.new("SphereHandleAdornment")
adornment.Adornee = workspace.Terrain
adornment.CFrame = atCF
adornment.Radius = 0.1
adornment.Transparency = 0.25
adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
adornment.Parent = GetFastCastVisualizationContainer()
Debris:AddItem(adornment, 3)
return adornment
end
|
--[[for i=1, #Sounds, 1 do
if Sounds[i] then
Sounds[i]:Play()
end
end]]
|
for i=1, #Deletables,1 do
if Deletables[i] then
if not IsA(Deletables[i], "ParticleEmitter") and not IsA(Deletables[i], "Attachment") and not IsA(Deletables[i], "BasePart") then
Destroy(Deletables[i])
elseif IsA(Deletables[i], "ParticleEmitter") then
--[[pcall(function()
Deletables[i].Enabled = false
Deletables[i].Speed = NumberRange.new(10, 20)
Deletables[i]:Emit(75)
end)]]
Debris:AddItem(Deletables[i], Deletables[i].Lifetime.Max + 1)
else
Debris:AddItem(Deletables[i], 3)
end
end
end
Destroy(script)
|
---------END RIGHT DOOR
|
game.Workspace.doorleft.p1.CFrame = game.Workspace.doorleft.p1.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p2.CFrame = game.Workspace.doorleft.p2.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p3.CFrame = game.Workspace.doorleft.p3.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p4.CFrame = game.Workspace.doorleft.p4.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p5.CFrame = game.Workspace.doorleft.p5.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p6.CFrame = game.Workspace.doorleft.p6.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p7.CFrame = game.Workspace.doorleft.p7.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p8.CFrame = game.Workspace.doorleft.p8.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p9.CFrame = game.Workspace.doorleft.p9.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p10.CFrame = game.Workspace.doorleft.p10.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p11.CFrame = game.Workspace.doorleft.p11.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p12.CFrame = game.Workspace.doorleft.p12.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p13.CFrame = game.Workspace.doorleft.p13.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p14.CFrame = game.Workspace.doorleft.p14.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p15.CFrame = game.Workspace.doorleft.p15.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p16.CFrame = game.Workspace.doorleft.p16.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p17.CFrame = game.Workspace.doorleft.p17.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p18.CFrame = game.Workspace.doorleft.p18.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.p19.CFrame = game.Workspace.doorleft.p19.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.pillar.CFrame = game.Workspace.doorleft.pillar.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l11.CFrame = game.Workspace.doorleft.l11.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l12.CFrame = game.Workspace.doorleft.l12.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l13.CFrame = game.Workspace.doorleft.l13.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l21.CFrame = game.Workspace.doorleft.l21.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l22.CFrame = game.Workspace.doorleft.l22.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l23.CFrame = game.Workspace.doorleft.l23.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l31.CFrame = game.Workspace.doorleft.l31.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l32.CFrame = game.Workspace.doorleft.l32.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l33.CFrame = game.Workspace.doorleft.l33.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l41.CFrame = game.Workspace.doorleft.l41.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l42.CFrame = game.Workspace.doorleft.l42.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l43.CFrame = game.Workspace.doorleft.l43.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l51.CFrame = game.Workspace.doorleft.l51.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l52.CFrame = game.Workspace.doorleft.l52.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l53.CFrame = game.Workspace.doorleft.l53.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l61.CFrame = game.Workspace.doorleft.l61.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l62.CFrame = game.Workspace.doorleft.l62.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l63.CFrame = game.Workspace.doorleft.l63.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l71.CFrame = game.Workspace.doorleft.l71.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l72.CFrame = game.Workspace.doorleft.l72.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorleft.l73.CFrame = game.Workspace.doorleft.l73.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
|
--!strict
|
local rshift = bit32.rshift
local log = math.log
local floor = math.floor
local LN2 = math.log(2)
return function(x: number): number
-- convert to 32 bit integer
local as32bit = rshift(x, 0)
if as32bit == 0 then
return 32
end
return 31 - floor(log(as32bit) / LN2)
end
|
-- services
|
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Debris = game:GetService("Debris")
|
--WARNING!------------------------------------------------------------------------------------------------------------------------------------------
--DO NOT MODIFY THE CODE BELOW! (Unless you know what you're doing, in that case: go nuts!(Unless you're allergic to nuts of course. Then don't.))--
----------------------------------------------------------------------------------------------------------------------------------------------------
|
wait()
local motors = script.Parent._Motors:GetChildren()
local uiLabel = script.Parent.Status.SurfaceGui.TextLabel
for i=1,#motors do
motors[i].Value.HingeConstraint.MotorMaxAcceleration = maxAcceleration
end
function Increase()
if tonumber(uiLabel.Text) < maxValue then
for i=1, #motors do
motors[i].Value.HingeConstraint.AngularVelocity = motors[i].Value.HingeConstraint.AngularVelocity + increment
end
uiLabel.Text = uiLabel.Text + 1
end
end
function Decrease()
if tonumber(script.Parent.Status.SurfaceGui.TextLabel.Text) > minValue then
for i=1, #motors do
motors[i].Value.HingeConstraint.AngularVelocity = motors[i].Value.HingeConstraint.AngularVelocity - increment
end
uiLabel.Text = uiLabel.Text - 1
end
end
script.Parent.Increase.ClickDetector.MouseClick:Connect(Increase)
script.Parent.Decrease.ClickDetector.MouseClick:Connect(Decrease)
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -8
Tune.RCamber = -8
Tune.FCaster = 7
Tune.FToe = 1
Tune.RToe = 0
|
-- CODE [if you're not experienced, do not mess with this code!]
|
Transition.OnClientEvent:Connect(function()
Frame.Visible = true
Frame:TweenPosition(UDim2.new(0,0,-0.1,0), "In", "Quad", 0.5)
wait(TRANSITION_TIME)
Frame:TweenPosition(UDim2.new(0,0,1,0), "In", "Quad", 0.5)
wait(1)
Frame.Visible = false
Frame.Position = UDim2.new(0,0,-1.1,0)
end)
|
-- Other useful variables
|
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local tool = script.Parent
local mobileShouldTrack = true
local oldIcon = mouse.Icon
local connection
|
----------------------------------------------
|
local RS = char.RightUpperArm["RightShoulder"]
local LS = char.LeftUpperArm["LeftShoulder"]
local RH = char["RightUpperLeg"]:WaitForChild("RightHip")
local LH = char["LeftUpperLeg"]:WaitForChild("LeftHip")
local LeftLeg = char["LeftUpperLeg"]
local RightLeg = char["RightUpperLeg"]--[[
ttt = Instance.new("Weld",Character.Head)
ttt.Part0 = Character.Head
ttt.Part1 = Character.UpperTorso
--]]
function Stand()
Humanoid.CameraOffset = Vector3.new(0, .7, 0)
Humanoid.WalkSpeed = 16
IsStanced = false
for i, s in pairs(Torso:GetChildren()) do
if (s.Name == "LegWeld") and (s.ClassName == "Weld") then
s:Destroy()
end
end
LH.Part1 = LeftLeg
RH.Part1 = RightLeg
Proned2 = Vector3.new(0,0,0)
tweenJoint(RootJoint, CFrame.new()* CFrame.Angles(math.rad(-0),0,math.rad(0)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RH, CFrame.new(.4,0,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0)
tweenJoint(LH, CFrame.new(-.4,0,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0)
tweenJoint(RS, CFrame.new(.85,0.5,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-.85,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
end
function LeanRight()
Humanoid.CameraOffset = Vector3.new(0.5, -0.35, 0)
Humanoid.WalkSpeed = 9
IsStanced = true
Proned2 = Vector3.new(0,0,0)
RH.Part1 = nil
CreateWeld(RightLeg, CFrame.new(-0.2,1.85,0.3)* CFrame.Angles(math.rad(-0),0,math.rad(-20)))
tweenJoint(RootJoint, CFrame.new(0.1,-0.25,0)* CFrame.Angles(math.rad(-0),0,math.rad(-20)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
end
function LeanLeft()
Humanoid.CameraOffset = Vector3.new(-0.5, -0.35, 0)
Humanoid.WalkSpeed = 9
IsStanced = true
Proned2 = Vector3.new(0,0,0)
LH.Part1 = nil
CreateWeld(LeftLeg, CFrame.new(0.2,1.85,0.3)* CFrame.Angles(math.rad(-0),0,math.rad(20)))
tweenJoint(RootJoint, CFrame.new(-0.1,-0.25,0)* CFrame.Angles(math.rad(-0),0,math.rad(20)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
end
function Crouch()
Humanoid.CameraOffset = Vector3.new(0, -1, 0)
Humanoid.WalkSpeed = 9
for i, s in pairs(Torso:GetChildren()) do
if (s.Name == "LegWeld") and (s.ClassName == "Weld") then
s:Destroy()
end
end
IsStanced = true
RH.Part1 = RightLeg
LH.Part1 = LeftLeg
Proned2 = Vector3.new(0,0,0)
tweenJoint(RootJoint, CFrame.new(0,-1,0)* CFrame.Angles(math.rad(-0),0,math.rad(0)), CFrame.new(0,0,0), function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RH, CFrame.new(1,-0.15,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LH, CFrame.new(-1,-0.675,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-45),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(45),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
end
function Prone()
Humanoid.CameraOffset = Vector3.new(0, -3.5, 0)
Humanoid.WalkSpeed = 4
IsStanced = true
RH.Part1 = nil
LH.Part1 = nil
Proned2 = Vector3.new(0,0.5,0.5)
tweenJoint(RootJoint, CFrame.new(0,-2.5,1)* CFrame.Angles(math.rad(-90),0,math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(RS, CFrame.new(0,0,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0.25)
tweenJoint(LS, CFrame.new(0,0,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), nil, function(X) return math.sin(math.rad(X)) end, 0)
CreateWeld(RightLeg, CFrame.new(-0.2,1.85,0)* CFrame.Angles(math.rad(-0),0,math.rad(-20)))
CreateWeld(LeftLeg, CFrame.new(0.2,1.85,0)* CFrame.Angles(math.rad(-0),0,math.rad(20)))
end
local AlreadyProned = false
mouse.KeyDown:connect(function(Key)
if Key == "c" and Stances == 0 and not _G.Sprinting and not _G.Lean then
Stances = 1
Crouch()
_G.Crouched = true
elseif Key == "c" and Stances == 1 and not _G.Sprinting and not _G.Lean then
Stances = 2
Prone()
_G.Crouched = false
_G.Proned = true
AlreadyProned = true
elseif Key == "x" and Stances == 2 and not _G.Sprinting and not _G.Lean then
AlreadyProned = false
_G.Crouched = true
_G.Proned = false
Stances = 1
Crouch()
elseif Key == "x" and Stances == 1 and not _G.Sprinting and not _G.Lean then
_G.Crouched = false
Stances = 0
Stand()
end
if Key == "e" and not _G.Lean and Stances == 0 and not _G.Sprinting then
LeanRight()
_G.Lean = true
end
if Key == "q" and not _G.Lean and Stances == 0 and not _G.Sprinting then
LeanLeft()
_G.Lean = true
end
end)
mouse.KeyUp:connect(function(Key)
if Key == "e" and _G.Lean and Stances == 0 and not _G.Sprinting then
Stand()
_G.Lean = false
end
if Key == "q" and _G.Lean and Stances == 0 and not _G.Sprinting then
Stand()
_G.Lean = false
end
end)
Stand()
|
--!nonstrict
--[[
VRVehicleCamera - Roblox VR vehicle camera control module
2021 Roblox VR
--]]
|
local EPSILON = 1e-3
local PITCH_LIMIT = math.rad(80)
local YAW_DEFAULT = math.rad(0)
local ZOOM_MINIMUM = 0.5
local ZOOM_SENSITIVITY_CURVATURE = 0.5
local DEFAULT_CAMERA_DIST = 16
local TP_FOLLOW_DIST = 200
local TP_FOLLOW_ANGLE_DOT = 0.56
local VRBaseCamera = require(script.Parent:WaitForChild("VRBaseCamera"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local VehicleCamera = require(script.Parent:WaitForChild("VehicleCamera"))
local VehicleCameraCore = require(script.Parent.VehicleCamera:FindFirstChild("VehicleCameraCore")) :: any
local VehicleCameraConfig = require(script.Parent.VehicleCamera:FindFirstChild("VehicleCameraConfig")) :: any
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local VRService = game:GetService("VRService")
local localPlayer = Players.LocalPlayer
local Spring = CameraUtils.Spring
local mapClamp = CameraUtils.mapClamp
local sanitizeAngle = CameraUtils.sanitizeAngle
local ZERO_VECTOR3 = Vector3.new(0,0,0)
|
--
|
h = script.Parent.Parent:WaitForChild("Humanoid")
pathService = game:GetService("PathfindingService")
targetV = script.Parent:WaitForChild("Target")
function closestTargetAndPath()
local humanoids = {}
if targetNPCs then
local function recurse(o)
for _,obj in pairs(o:GetChildren()) do
if obj:IsA("Model") then
if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then
table.insert(humanoids,obj.Humanoid)
end
end
recurse(obj)
end
end
recurse(workspace)
else
for _,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then
table.insert(humanoids,v.Character.Humanoid)
end
end
end
local closest,path,dist
for _,humanoid in pairs(humanoids) do
local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500)
if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then
-- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point.
local myDist = 0
local previous = h.Torso.Position
for _,point in pairs(myPath:GetPointCoordinates()) do
myDist = myDist + (point-previous).magnitude
previous = point
end
if not dist or myDist < dist then -- if true, this is the closest path so far.
closest = humanoid
path = myPath
dist = myDist
end
end
end
return closest,path
end
function goToPos(loc)
h:MoveTo(loc)
local distance = (loc-h.Torso.Position).magnitude
local start = tick()
while distance > 4 do
if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break.
break
end
distance = (loc-h.Torso.Position).magnitude
wait()
end
end
while wait() do
local target,path = closestTargetAndPath()
local didBreak = false
local targetStart
if target and h.Torso then
targetV.Value = target
targetStart = target.Torso.Position
roaming = false
local previous = h.Torso.Position
local points = path:GetPointCoordinates()
local s = #points > 1 and 2 or 1
for i = s,#points do
local point = points[i]
if didBreak then
break
end
if target and target.Torso and target.Health > 0 then
if (target.Torso.Position-targetStart).magnitude < 1.5 then
local pos = previous:lerp(point,.5)
local moveDir = ((pos - h.Torso.Position).unit * 2)
goToPos(previous:lerp(point,.5))
previous = point
end
else
didBreak = true
break
end
end
else
targetV.Value = nil
end
if not didBreak and targetStart then
goToPos(targetStart)
end
end
|
-- transforms Roblox types into intermediate types, converting
-- between spaces as necessary to preserve perceptual linearity
|
local typeMetadata = {
number = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value}
end,
fromIntermediate = function(value)
return value[1]
end,
},
NumberRange = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.Min, value.Max}
end,
fromIntermediate = function(value)
return NumberRange.new(value[1], value[2])
end,
},
UDim = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.Scale, value.Offset}
end,
fromIntermediate = function(value)
return UDim.new(value[1], value[2])
end,
},
UDim2 = {
springType = LinearSpring.new,
toIntermediate = function(value)
local x = value.X
local y = value.Y
return {x.Scale, x.Offset, y.Scale, y.Offset}
end,
fromIntermediate = function(value)
return UDim2.new(value[1], value[2], value[3], value[4])
end,
},
Vector2 = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.X, value.Y}
end,
fromIntermediate = function(value)
return Vector2.new(value[1], value[2])
end,
},
Vector3 = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.X, value.Y, value.Z}
end,
fromIntermediate = function(value)
return Vector3.new(value[1], value[2], value[3])
end,
},
Color3 = {
springType = LinearSpring.new,
toIntermediate = function(value)
-- convert RGB to a variant of cieluv space
local r, g, b = value.R, value.G, value.B
-- D65 sRGB inverse gamma correction
r = r < 0.0404482362771076 and r/12.92 or 0.87941546140213*(r + 0.055)^2.4
g = g < 0.0404482362771076 and g/12.92 or 0.87941546140213*(g + 0.055)^2.4
b = b < 0.0404482362771076 and b/12.92 or 0.87941546140213*(b + 0.055)^2.4
-- sRGB -> xyz
local x = 0.9257063972951867*r - 0.8333736323779866*g - 0.09209820666085898*b
local y = 0.2125862307855956*r + 0.71517030370341085*g + 0.0722004986433362*b
local z = 3.6590806972265883*r + 11.4426895800574232*g + 4.1149915024264843*b
-- xyz -> modified cieluv
local l = y > 0.008856451679035631 and 116*y^(1/3) - 16 or 903.296296296296*y
local u, v
if z > 1e-14 then
u = l*x/z
v = l*(9*y/z - 0.46832)
else
u = -0.19783*l
v = -0.46832*l
end
return {l, u, v}
end,
fromIntermediate = function(value)
-- convert back from modified cieluv to rgb space
local l = value[1]
if l < 0.0197955 then
return Color3.new(0, 0, 0)
end
local u = value[2]/l + 0.19783
local v = value[3]/l + 0.46832
-- cieluv -> xyz
local y = (l + 16)/116
y = y > 0.206896551724137931 and y*y*y or 0.12841854934601665*y - 0.01771290335807126
local x = y*u/v
local z = y*((3 - 0.75*u)/v - 5)
-- xyz -> D65 sRGB
local r = 7.2914074*x - 1.5372080*y - 0.4986286*z
local g = -2.1800940*x + 1.8757561*y + 0.0415175*z
local b = 0.1253477*x - 0.2040211*y + 1.0569959*z
-- clamp minimum sRGB component
if r < 0 and r < g and r < b then
r, g, b = 0, g - r, b - r
elseif g < 0 and g < b then
r, g, b = r - g, 0, b - g
elseif b < 0 then
r, g, b = r - b, g - b, 0
end
-- gamma correction from D65
-- clamp to avoid undesirable overflow wrapping behavior on certain properties (e.g. BasePart.Color)
return Color3.new(
min(r < 3.1306684425e-3 and 12.92*r or 1.055*r^(1/2.4) - 0.055, 1),
min(g < 3.1306684425e-3 and 12.92*g or 1.055*g^(1/2.4) - 0.055, 1),
min(b < 3.1306684425e-3 and 12.92*b or 1.055*b^(1/2.4) - 0.055, 1)
)
end,
},
}
local springStates = {} -- {[instance] = {[property] = spring}
RunService.Stepped:Connect(function(_, dt)
for instance, state in pairs(springStates) do
for propName, spring in pairs(state) do
if spring:canSleep() then
state[propName] = nil
instance[propName] = spring.rawTarget
else
instance[propName] = spring:step(dt)
end
end
if not next(state) then
springStates[instance] = nil
end
end
end)
local function assertType(argNum, fnName, expectedType, value)
if not STRICT_TYPES then
return
end
if not expectedType:find(typeof(value)) then
error(
("bad argument #%d to %s (%s expected, got %s)"):format(
argNum,
fnName,
expectedType,
typeof(value)
),
3
)
end
end
local spr = {}
function spr.target(instance, dampingRatio, frequency, properties)
assertType(1, "spr.target", "Instance", instance)
assertType(2, "spr.target", "number", dampingRatio)
assertType(3, "spr.target", "number", frequency)
assertType(4, "spr.target", "table", properties)
if dampingRatio ~= dampingRatio or dampingRatio < 0 then
error(("expected damping ratio >= 0; got %.2f"):format(dampingRatio), 2)
end
if frequency ~= frequency or frequency < 0 then
error(("expected undamped frequency >= 0; got %.2f"):format(frequency), 2)
end
local state = springStates[instance]
if not state then
state = {}
springStates[instance] = state
end
for propName, propTarget in pairs(properties) do
local propValue = instance[propName]
if STRICT_TYPES and typeof(propTarget) ~= typeof(propValue) then
error(
("bad property %s to spr.target (%s expected, got %s)"):format(
propName,
typeof(propValue),
typeof(propTarget)
),
2
)
end
local spring = state[propName]
if not spring then
local md = typeMetadata[typeof(propTarget)]
if not md then
error("unsupported type: " .. typeof(propTarget), 2)
end
spring = md.springType(dampingRatio, frequency, propValue, md, propTarget)
state[propName] = spring
end
spring.d = dampingRatio
spring.f = frequency
spring:setGoal(propTarget)
end
end
function spr.stop(instance, property)
assertType(1, "spr.stop", "Instance", instance)
assertType(2, "spr.stop", "string|nil", property)
if property then
local state = springStates[instance]
if state then
state[property] = nil
end
else
springStates[instance] = nil
end
end
if STRICT_API_ACCESS then
return tableLock(spr)
else
return spr
end
|
-- private functions
|
local function typeof(x)
return x.__type or _typeof(x);
end
|
--[[*
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
]]
|
exports.rethrowCaughtError = function()
if hasRethrowError then
local err = rethrowError
hasRethrowError = false
rethrowError = nil
error(err)
end
end
exports.hasCaughtError = function()
return hasError
end
clearCaughtError = function()
if hasError then
local err = caughtError
hasError = false
caughtError = nil
return err
else
invariant(
false,
"clearCaughtError was called but no error was captured. This error "
.. "is likely caused by a bug in React. Please file an issue."
)
-- deviation: luau doesn't know that invariant throws, so we return nil
return nil
end
end
exports.clearCaughtError = clearCaughtError
return exports
|
-- Make triggers transparent
|
local menuTriggers = workspace:WaitForChild("MenuTriggers", 10) -- Menu triggers for GUI
if menuTriggers then
for _,trigger in pairs(menuTriggers:GetChildren()) do
trigger.Transparency = 1
trigger.Touched:Connect(function(part)
if players.LocalPlayer.Character and part:IsDescendantOf(players.LocalPlayer.Character) then
require(switchMenu)(trigger.Name)
end
end)
end
end
|
--Made by Stickmasterluke
|
sp=script.Parent
damage=100 -- +/- 10%
damagewindow=1 --after clicking, how long does the player have to hit the opponent wioth their weapon to deal damage
swingrate=.75
clashsounds={91154405,91154446,91154471,91154503,91154521}
swooshsounds={91154708,91155889}
hitsounds={91154909,91154932,91154954}
anims={"Stab1","Stab2","RightSlash","LeftSlash"}
bloodeffects=false
ready=false
equipped=false
rate=1/30
lastswing=0
local reloading=sp:WaitForChild("Reloading")
local down=sp:WaitForChild("MouseDown")
local runanim=sp:WaitForChild("RunAnim")
local sparkles=sp.Handle:WaitForChild("Sparkles")
local debris=game:getService("Debris")
local weaponhud=sp:WaitForChild("WeaponHud")
local weaponnametag=weaponhud:WaitForChild("WeaponName")
local guibar=weaponhud:WaitForChild("Bar")
local guibarfill=guibar:WaitForChild("Fill")
weaponnametag.Text=sp.Name
function runsound(id,volume)
local volume=volume or 1
local sound=Instance.new("Sound")
sound.Looped=false
sound.Pitch=1
sound.SoundId="http://www.roblox.com/asset/?id="..tostring(id)
sound.PlayOnRemove=false
sound.Volume=volume
debris:AddItem(sound,3)
sound.Parent=sp.Handle
wait()
sound:Play()
end
function billboard(pos,text,time,color)
local pos=pos or Vector3.new(0,0,0)
local text=text or "Hello World!"
local time=time or 2
local color=color or Color3.new(1,0,0)
local pos=pos+Vector3.new(0,5,0)
local ep=Instance.new("Part")
ep.Name="Effect"
ep.formFactor="Custom"
ep.Size=Vector3.new(0,0,0)
ep.TopSurface="Smooth"
ep.BottomSurface="Smooth"
ep.CFrame=CFrame.new(pos)
ep.Anchored=true
ep.CanCollide=false
ep.Transparency=1
local bb=Instance.new("BillboardGui")
bb.Size=UDim2.new(3,0,3,0)
bb.Adornee=ep
local tl=Instance.new("TextLabel")
tl.BackgroundTransparency=1
tl.Size=UDim2.new(1,0,1,0)
tl.Text=text
tl.TextColor3=color
tl.TextScaled=true
tl.Font="ArialBold"
tl.Parent=bb
bb.Parent=ep
debris:AddItem(ep,time+.1)
ep.Parent=game.Workspace
delay(0,function()
local frames=time/rate
for frame=1,frames do
wait(rate)
local percent=frame/frames
ep.CFrame=CFrame.new(pos)+Vector3.new(0,5*percent,0)
tl.TextTransparency=percent
end
ep:remove()
end)
end
function makeblood(part)
if part then
local b=Instance.new("Part")
b.BrickColor=BrickColor.new("Bright red")
b.formFactor="Custom"
b.Transparency=math.random(0,1)*.5
if math.random()<.5 then
b.CanCollide=false
else
b.CanCollide=true
end
b.TopSurface="Smooth"
b.BottomSurface="Smooth"
b.Size=Vector3.new(.2*math.random(1,5),.2*math.random(1,5),.2*math.random(1,5))
b.Velocity=part.Velocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*30)
b.RotVelocity=part.RotVelocity+(Vector3.new((math.random()-.5),(math.random()-.5),(math.random()-.5))*20)
b.CFrame=part.CFrame*CFrame.new((math.random()-.5)*3,(math.random()-.5)*3,(math.random()-.5)*3)*CFrame.Angles(math.pi*2*math.random(),math.pi*2*math.random(),math.pi*2*math.random())
debris:AddItem(b,math.random()*4)
b.Parent=game.Workspace
end
end
sp.Handle.Touched:connect(function(hit)
if ready and equipped and hit and hit.Parent~=nil and hit:IsDescendantOf(sp.Parent)==false and string.lower(string.sub(hit.Name,1,6))~="effect" and (tick()-lastswing)<=damagewindow then
if hit:FindFirstChild("CanBlock") and sp.Handle:FindFirstChild("Blockable") then
ready=false
runsound(clashsounds[math.random(1,#clashsounds)])
sparkles.Enabled=true
delay(.2,function()
sparkles.Enabled=false
end)
billboard(sp.Handle.Position,"Block",2,Color3.new(1,1,0))
end
local mh=sp.Parent:FindFirstChild("Humanoid")
local eh=hit.Parent:FindFirstChild("Humanoid")
local ra=sp.Parent:FindFirstChild("Right Arm")
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if mh and eh and eh~=mh and mh.Health>0 and eh.Health>0 and ra and plr~=nil then
local eplr=game.Players:GetPlayerFromCharacter(eh.Parent)
if eplr~=nil and not eplr.Neutral and not plr.Neutral and eplr.TeamColor==plr.TeamColor then
return --No team killing
end
ready=false
for i,v in ipairs(eh:GetChildren()) do
if v.Name=="creator" then
v:remove()
end
end
local creator=Instance.new("ObjectValue")
creator.Name="creator"
creator.Value=plr
creator.Parent=eh
debris:AddItem(creator,1)
local localdamage=math.floor(damage*(.9+(math.random()*.2))+.5)
eh:TakeDamage(localdamage)
billboard(hit.Position,"-"..tostring(localdamage))
runsound(hitsounds[math.random(1,#hitsounds)])
if bloodeffects then
local numbloodeffects=math.ceil(localdamage/10)
for i=1,math.random(numbloodeffects-1,numbloodeffects+1) do
--[[if math.random()<.5 then
makeblood(sp.Handle)
else]]
makeblood(hit)
--end
end
end
end
end
end)
function Activate()
if equipped and (tick()-lastswing)>=swingrate then
ready=true
reloading.Value=true
runsound(swooshsounds[math.random(1,#swooshsounds)],.5)
newanim=anims[math.random(1,#anims)]
while newanim==runanim.Value do
newanim=anims[math.random(1,#anims)]
end
runanim.Value=newanim
lastswing=tick()
wait(swingrate)
reloading.Value=false
if down.Value then
Activate()
end
end
end
down.Changed:connect(function()
if down.Value then
Activate()
end
end)
sp.Equipped:connect(function(mouse)
lastswing=tick()
reloading.Value=true
ready=false
equipped=true
local plr=game.Players:GetPlayerFromCharacter(sp.Parent)
if plr~=nil then
local plrgui=plr:FindFirstChild("PlayerGui")
if plrgui~=nil then
weaponhud.Parent=plrgui
end
end
wait(swingrate)
reloading.Value=false
if down.Value then
Activate()
end
end)
sp.Unequipped:connect(function()
ready=false
equipped=false
weaponhud.Parent=sp
end)
function updategui()
local swingpercent=math.min((tick()-lastswing)/swingrate,1)
if swingpercent<.5 then --fade from red to yellow then to green
guibarfill.BackgroundColor3=Color3.new(1,swingpercent*2,0)
else
guibarfill.BackgroundColor3=Color3.new(1-((swingpercent-.5)/.5),1,0)
end
guibarfill.Size=UDim2.new(swingpercent,0,1,0)
end
while true do
updategui()
wait(rate)
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
local Players = game:GetService("Players")
local Debris = game:GetService("Debris")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
Speed = 100
Duration = 1
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color = BrickColor.new("Really red")
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
elseif v:IsA("LocalScript") or v:IsA("Script") then
v:Destroy()
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0.05)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
Dematerialize(character, humanoid, Hit)
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Really red")
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 318 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[
Manager for a single player's spots.
]]
|
local Cryo = require(script.Parent.Parent.Packages.Cryo)
local constants = require(script.Parent.Parent.Constants)
local PlayerSpots = {}
PlayerSpots.__index = PlayerSpots
function PlayerSpots.new(quota)
if not quota then
warn("Invalid player quota passed:", quota)
end
local self = {
-- Table of { canvas, spot, createdAt } that a player has placed surface art in
placedSpots = {},
-- Maximum number of artwork that we can place for a player
quota = quota,
-- Index of spot to remove if player exceeds quota - this is set during spot assignment
toRemove = nil,
}
setmetatable(self, PlayerSpots)
return self
end
|
--CONFIG VARIABLES
|
local uptime = 12
local downtime = 12 --the amount of time it takes for the door to open
local waitTime = 0.29 --the amount of time to wait after the door has finished moving that you can use the button again
|
-----------------------------------PATHER--------------------------------------
|
local function Pather(endPoint, surfaceNormal, overrideUseDirectPath: boolean?)
local this = {}
local directPathForHumanoid
local directPathForVehicle
if overrideUseDirectPath ~= nil then
directPathForHumanoid = overrideUseDirectPath
directPathForVehicle = overrideUseDirectPath
else
directPathForHumanoid = UseDirectPath
directPathForVehicle = UseDirectPathForVehicle
end
this.Cancelled = false
this.Started = false
this.Finished = Instance.new("BindableEvent")
this.PathFailed = Instance.new("BindableEvent")
this.PathComputing = false
this.PathComputed = false
this.OriginalTargetPoint = endPoint
this.TargetPoint = endPoint
this.TargetSurfaceNormal = surfaceNormal
this.DiedConn = nil
this.SeatedConn = nil
this.BlockedConn = nil
this.TeleportedConn = nil
this.CurrentPoint = 0
this.HumanoidOffsetFromPath = ZERO_VECTOR3
this.CurrentWaypointPosition = nil
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
this.CurrentWaypointNeedsJump = false;
this.CurrentHumanoidPosition = ZERO_VECTOR3
this.CurrentHumanoidVelocity = 0 :: Vector3 | number
this.NextActionMoveDirection = ZERO_VECTOR3
this.NextActionJump = false
this.Timeout = 0
this.Humanoid = findPlayerHumanoid(Player)
this.OriginPoint = nil
this.AgentCanFollowPath = false
this.DirectPath = false
this.DirectPathRiseFirst = false
local rootPart: BasePart = this.Humanoid and this.Humanoid.RootPart
if rootPart then
-- Setup origin
this.OriginPoint = rootPart.CFrame.Position
-- Setup agent
local agentRadius = 2
local agentHeight = 5
local agentCanJump = true
local seat = this.Humanoid.SeatPart
if seat and seat:IsA("VehicleSeat") then
-- Humanoid is seated on a vehicle
local vehicle = seat:FindFirstAncestorOfClass("Model")
if vehicle then
-- Make sure the PrimaryPart is set to the vehicle seat while we compute the extends.
local tempPrimaryPart = vehicle.PrimaryPart
vehicle.PrimaryPart = seat
-- For now, only direct path
if directPathForVehicle then
local extents: Vector3 = vehicle:GetExtentsSize()
agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z)
agentHeight = AgentSizeIncreaseFactor * extents.Y
agentCanJump = false
this.AgentCanFollowPath = true
this.DirectPath = directPathForVehicle
end
-- Reset PrimaryPart
vehicle.PrimaryPart = tempPrimaryPart
end
else
local extents: Vector3?
if FFlagUserExcludeNonCollidableForPathfinding then
local character: Model? = GetCharacter()
if character ~= nil then
extents = getCollidableExtentsSize(character)
end
end
if extents == nil then
extents = GetCharacter():GetExtentsSize()
end
agentRadius = AgentSizeIncreaseFactor * 0.5 * math.sqrt(extents.X * extents.X + extents.Z * extents.Z)
agentHeight = AgentSizeIncreaseFactor * extents.Y
agentCanJump = (this.Humanoid.JumpPower > 0)
this.AgentCanFollowPath = true
this.DirectPath = directPathForHumanoid :: boolean
this.DirectPathRiseFirst = this.Humanoid.Sit
end
-- Build path object
this.pathResult = PathfindingService:CreatePath({AgentRadius = agentRadius, AgentHeight = agentHeight, AgentCanJump = agentCanJump})
end
function this:Cleanup()
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
if this.MoveToConn then
this.MoveToConn:Disconnect()
this.MoveToConn = nil
end
if this.BlockedConn then
this.BlockedConn:Disconnect()
this.BlockedConn = nil
end
if this.DiedConn then
this.DiedConn:Disconnect()
this.DiedConn = nil
end
if this.SeatedConn then
this.SeatedConn:Disconnect()
this.SeatedConn = nil
end
if this.TeleportedConn then
this.TeleportedConn:Disconnect()
this.TeleportedConn = nil
end
this.Started = false
end
function this:Cancel()
this.Cancelled = true
this:Cleanup()
end
function this:IsActive()
return this.AgentCanFollowPath and this.Started and not this.Cancelled
end
function this:OnPathInterrupted()
-- Stop moving
this.Cancelled = true
this:OnPointReached(false)
end
function this:ComputePath()
if this.OriginPoint then
if this.PathComputed or this.PathComputing then return end
this.PathComputing = true
if this.AgentCanFollowPath then
if this.DirectPath then
this.pointList = {
PathWaypoint.new(this.OriginPoint, Enum.PathWaypointAction.Walk),
PathWaypoint.new(this.TargetPoint, this.DirectPathRiseFirst and Enum.PathWaypointAction.Jump or Enum.PathWaypointAction.Walk)
}
this.PathComputed = true
else
this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint)
this.pointList = this.pathResult:GetWaypoints()
this.BlockedConn = this.pathResult.Blocked:Connect(function(blockedIdx) this:OnPathBlocked(blockedIdx) end)
this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success
end
end
this.PathComputing = false
end
end
function this:IsValidPath()
this:ComputePath()
return this.PathComputed and this.AgentCanFollowPath
end
this.Recomputing = false
function this:OnPathBlocked(blockedWaypointIdx)
local pathBlocked = blockedWaypointIdx >= this.CurrentPoint
if not pathBlocked or this.Recomputing then
return
end
this.Recomputing = true
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
this.OriginPoint = this.Humanoid.RootPart.CFrame.p
this.pathResult:ComputeAsync(this.OriginPoint, this.TargetPoint)
this.pointList = this.pathResult:GetWaypoints()
if #this.pointList > 0 then
this.HumanoidOffsetFromPath = this.pointList[1].Position - this.OriginPoint
end
this.PathComputed = this.pathResult.Status == Enum.PathStatus.Success
if ShowPath then
this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList)
end
if this.PathComputed then
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
this:Cleanup()
end
this.Recomputing = false
end
function this:OnRenderStepped(dt: number)
if this.Started and not this.Cancelled then
-- Check for Timeout (if a waypoint is not reached within the delay, we fail)
this.Timeout = this.Timeout + dt
if this.Timeout > UnreachableWaypointTimeout then
this:OnPointReached(false)
return
end
-- Get Humanoid position and velocity
this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath
this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity
-- Check if it has reached some waypoints
while this.Started and this:IsCurrentWaypointReached() do
this:OnPointReached(true)
end
-- If still started, update actions
if this.Started then
-- Move action
this.NextActionMoveDirection = this.CurrentWaypointPosition - this.CurrentHumanoidPosition
if this.NextActionMoveDirection.Magnitude > ALMOST_ZERO then
this.NextActionMoveDirection = this.NextActionMoveDirection.Unit
else
this.NextActionMoveDirection = ZERO_VECTOR3
end
-- Jump action
if this.CurrentWaypointNeedsJump then
this.NextActionJump = true
this.CurrentWaypointNeedsJump = false -- Request jump only once
else
this.NextActionJump = false
end
end
end
end
function this:IsCurrentWaypointReached()
local reached = false
-- Check we do have a plane, if not, we consider the waypoint reached
if this.CurrentWaypointPlaneNormal ~= ZERO_VECTOR3 then
-- Compute distance of Humanoid from destination plane
local dist = this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidPosition) - this.CurrentWaypointPlaneDistance
-- Compute the component of the Humanoid velocity that is towards the plane
local velocity = -this.CurrentWaypointPlaneNormal:Dot(this.CurrentHumanoidVelocity)
-- Compute the threshold from the destination plane based on Humanoid velocity
local threshold = math.max(1.0, 0.0625 * velocity)
-- If we are less then threshold in front of the plane (between 0 and threshold) or if we are behing the plane (less then 0), we consider we reached it
reached = dist < threshold
else
reached = true
end
if reached then
this.CurrentWaypointPosition = nil
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
end
return reached
end
function this:OnPointReached(reached)
if reached and not this.Cancelled then
-- First, destroyed the current displayed waypoint
if this.setPointFunc then
this.setPointFunc(this.CurrentPoint)
end
local nextWaypointIdx = this.CurrentPoint + 1
if nextWaypointIdx > #this.pointList then
-- End of path reached
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
this.Finished:Fire()
this:Cleanup()
else
local currentWaypoint = this.pointList[this.CurrentPoint]
local nextWaypoint = this.pointList[nextWaypointIdx]
-- If airborne, only allow to keep moving
-- if nextWaypoint.Action ~= Jump, or path mantains a direction
-- Otherwise, wait until the humanoid gets to the ground
local currentState = this.Humanoid:GetState()
local isInAir = currentState == Enum.HumanoidStateType.FallingDown
or currentState == Enum.HumanoidStateType.Freefall
or currentState == Enum.HumanoidStateType.Jumping
if isInAir then
local shouldWaitForGround = nextWaypoint.Action == Enum.PathWaypointAction.Jump
if not shouldWaitForGround and this.CurrentPoint > 1 then
local prevWaypoint = this.pointList[this.CurrentPoint - 1]
local prevDir = currentWaypoint.Position - prevWaypoint.Position
local currDir = nextWaypoint.Position - currentWaypoint.Position
local prevDirXZ = Vector2.new(prevDir.x, prevDir.z).Unit
local currDirXZ = Vector2.new(currDir.x, currDir.z).Unit
local THRESHOLD_COS = 0.996 -- ~cos(5 degrees)
shouldWaitForGround = prevDirXZ:Dot(currDirXZ) < THRESHOLD_COS
end
if shouldWaitForGround then
this.Humanoid.FreeFalling:Wait()
-- Give time to the humanoid's state to change
-- Otherwise, the jump flag in Humanoid
-- will be reset by the state change
wait(0.1)
end
end
-- Move to the next point
this:MoveToNextWayPoint(currentWaypoint, nextWaypoint, nextWaypointIdx)
end
else
this.PathFailed:Fire()
this:Cleanup()
end
end
function this:MoveToNextWayPoint(currentWaypoint: PathWaypoint, nextWaypoint: PathWaypoint, nextWaypointIdx: number)
-- Build next destination plane
-- (plane normal is perpendicular to the y plane and is from next waypoint towards current one (provided the two waypoints are not at the same location))
-- (plane location is at next waypoint)
this.CurrentWaypointPlaneNormal = currentWaypoint.Position - nextWaypoint.Position
this.CurrentWaypointPlaneNormal = Vector3.new(this.CurrentWaypointPlaneNormal.X, 0, this.CurrentWaypointPlaneNormal.Z)
if this.CurrentWaypointPlaneNormal.Magnitude > ALMOST_ZERO then
this.CurrentWaypointPlaneNormal = this.CurrentWaypointPlaneNormal.Unit
this.CurrentWaypointPlaneDistance = this.CurrentWaypointPlaneNormal:Dot(nextWaypoint.Position)
else
-- Next waypoint is the same as current waypoint so no plane
this.CurrentWaypointPlaneNormal = ZERO_VECTOR3
this.CurrentWaypointPlaneDistance = 0
end
-- Should we jump
this.CurrentWaypointNeedsJump = nextWaypoint.Action == Enum.PathWaypointAction.Jump;
-- Remember next waypoint position
this.CurrentWaypointPosition = nextWaypoint.Position
-- Move to next point
this.CurrentPoint = nextWaypointIdx
-- Finally reset Timeout
this.Timeout = 0
end
function this:Start(overrideShowPath)
if not this.AgentCanFollowPath then
this.PathFailed:Fire()
return
end
if this.Started then return end
this.Started = true
ClickToMoveDisplay.CancelFailureAnimation()
if ShowPath then
if overrideShowPath == nil or overrideShowPath then
this.stopTraverseFunc, this.setPointFunc = ClickToMoveDisplay.CreatePathDisplay(this.pointList, this.OriginalTargetPoint)
end
end
if #this.pointList > 0 then
-- Determine the humanoid offset from the path's first point
-- Offset of the first waypoint from the path's origin point
this.HumanoidOffsetFromPath = Vector3.new(0, this.pointList[1].Position.Y - this.OriginPoint.Y, 0)
-- As well as its current position and velocity
this.CurrentHumanoidPosition = this.Humanoid.RootPart.Position + this.HumanoidOffsetFromPath
this.CurrentHumanoidVelocity = this.Humanoid.RootPart.Velocity
-- Connect to events
this.SeatedConn = this.Humanoid.Seated:Connect(function(isSeated, seat) this:OnPathInterrupted() end)
this.DiedConn = this.Humanoid.Died:Connect(function() this:OnPathInterrupted() end)
this.TeleportedConn = this.Humanoid.RootPart:GetPropertyChangedSignal("CFrame"):Connect(function() this:OnPathInterrupted() end)
-- Actually start
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
end
end
--We always raycast to the ground in the case that the user clicked a wall.
local offsetPoint = this.TargetPoint + this.TargetSurfaceNormal*1.5
local ray = Ray.new(offsetPoint, Vector3.new(0,-1,0)*50)
local newHitPart, newHitPos = Workspace:FindPartOnRayWithIgnoreList(ray, getIgnoreList())
if newHitPart then
this.TargetPoint = newHitPos
end
this:ComputePath()
return this
end
|
--[[
Splits a string into parts based on a delimiter and returns a table of the
parts. The delimiter is a Lua string pattern, so special characters need
escaping. See https://www.lua.org/manual/5.1/manual.html#5.4.1 for details
on patterns.
]]
|
function StringUtils.split(str, delimiter) --: (string, string) => string
local result = {}
local from = 1
if (not delimiter) then
for i = 1, #str do
table.insert(result, string.sub(str, i, i))
end
return result
end
local delim_from, delim_to = string.find(str, delimiter, from)
while delim_from do
table.insert(result, string.sub(str, from, delim_from - 1))
from = delim_to + 1
delim_from, delim_to = string.find(str, delimiter, from)
end
table.insert(result, string.sub(str, from))
return result
end
function StringUtils.trim(s) --: (string) => string
return s:match "^%s*(.-)%s*$"
end
function StringUtils.startsWith(str, start) --: (string, string) => boolean
return string.sub(str, 1, string.len(start)) == start
end
function StringUtils.endsWith(str, ending) --: (string, string) => boolean
return string.sub(str, -string.len(ending)) == ending
end
function StringUtils.leftPad(string, length, character) --: (string, number, string) => string
return string.rep(character or " ", length - #string) .. string
end
function StringUtils.rightPad(string, length, character) --: (string, number, string) => string
return string .. string.rep(character or " ", length - #string)
end
return StringUtils
|
--CurrentCamera.CFrame = camPart.CFrame -- This attaches the Camera's CFrame to the camPart
| |
-- Implement Signal:Wait() in terms of a temporary connection using
-- a Signal:Connect() which disconnects itself.
|
function Signal:Wait()
local waitingCoroutine = coroutine.running()
local cn
cn = self:Connect(function(...)
cn:Disconnect()
task.spawn(waitingCoroutine, ...)
end)
return coroutine.yield()
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 1000 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 400 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 4500 -- Use sliders to manipulate values
Tune.Redline = 5500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 3000
Tune.PeakSharpness = 1.5
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 = 75 -- RPM decay when clutch is off
Tune.RevBounce = 1000 -- RPM kickback from redline
Tune.IdleThrottle = 2 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[=[
Mounts the instance to the props. This handles mounting children, and events.
The contract is that the props table is turned into observables. Note the following.
* Keys of strings are turned into properties
* If this can be turned into an observable, it will be used to subscribe to this event
* Otherwise, we assign directly
* Keys of functions are invoked on the instance in question
* `(instance, value) -> Observable
* If this returns an observable (or can be turned into one), we subscribe the event immediately
* If the key is [Blend.Children] then we invoke mountChildren on it
@param instance Instance
@param props table
@return Maid
]=]
|
function Blend.mount(instance, props)
local maid = Maid.new()
local parent = nil
local dependentObservables = {}
for key, value in pairs(props) do
if type(key) == "string" then
if key == "Parent" then
parent = value
else
local observable = Blend.toPropertyObservable(value)
if observable then
maid:GiveTask(observable:Subscribe(function(result)
task.spawn(function()
instance[key] = result
end)
end))
else
task.spawn(function()
instance[key] = value
end)
end
end
elseif type(key) == "function" then
local observable = Blend.toEventObservable(key(instance, value))
if Observable.isObservable(observable) then
table.insert(dependentObservables, {observable, value})
else
warn(("Unable to apply event listener %q"):format(tostring(key)))
end
else
warn(("Unable to apply property %q"):format(tostring(key)))
end
end
-- Subscribe dependentObservables (which includes adding children)
for _, event in pairs(dependentObservables) do
maid:GiveTask(event[1]:Subscribe(Blend.toEventHandler(event[2])))
end
if parent then
local observable = Blend.toPropertyObservable(parent)
if observable then
maid:GiveTask(observable:Subscribe(function(result)
instance.Parent = result
end))
else
instance.Parent = parent
end
end
return maid
end
return Blend
|
--|| Setting Script Parent! ||--
|
script.Parent = game:GetService("ServerScriptService")
|
--This module is for any client FX related to the lab debris
|
local DoorFX = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local InitialModelCFrames = {}
function DoorFX.OPEN(door)
if not door then return end
local EffectsBrick = door:WaitForChild("Effects")
local Effects = EffectsBrick:GetChildren()
for _, Item in pairs (Effects) do
if Item.Name == "Unlock" then Item:Play() continue end
if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
Item.Enabled = true
end
end
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if not Component:IsA("Model") then continue end
InitialModelCFrames[Component] = Component.PrimaryPart.CFrame
local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-1,1),3,math.random(-1,1)))
* CFrame.Angles(math.rad(math.random(1,360)), math.rad(math.random(1,360)), math.rad(math.random(1,360)))
local TweenInf = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.In)
tweenService:Create(Component.PrimaryPart, TweenInf, {CFrame = CFrameGoal}):Play()
end
wait(1)
for _, Component in pairs (Components) do
if not Component:IsA("Model") then continue end
local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-20,20),50,math.random(-20,20)))
* CFrame.Angles(math.rad(math.random(1,360)), math.rad(math.random(1,360)), math.rad(math.random(1,360)))
local TweenInf = TweenInfo.new(2, Enum.EasingStyle.Linear)
local Tween = tweenService:Create(Component.PrimaryPart, TweenInf, {CFrame = CFrameGoal})
Tween:Play()
local Event = nil
Event = Tween.Completed:Connect(function()
Event:Disconnect()
Component.PrimaryPart.CFrame = Component.PrimaryPart.CFrame - Vector3.new(0, 300, 0)
end)
end
wait(.5)
for _, Item in pairs (Effects) do
if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
Item.Enabled = false
end
end
end
function DoorFX.CLOSE(door)
if not door then return end
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if Component:IsA("Model") then
Component.PrimaryPart.CFrame = InitialModelCFrames[Component] or Component.PrimaryPart.CFrame
--this errors when the module is called for some reason so thats why its like that
end
end
end
return DoorFX
|
-- << CREDITS >>
|
local template2 = creditsFrame.Template
template2.Visible = false
|
--// All global vars will be wiped/replaced except script
|
return function(data, env)
if env then
setfenv(1, env)
end
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local frame = script.Parent.Parent
local close = frame.Frame.Close
local main = frame.Frame.Main
local title = frame.Frame.Title
local timer = frame.Frame.Timer
local gTable = data.gTable
local clickfunc = data.OnClick
local closefunc = data.OnClose
local ignorefunc = data.OnIgnore
local name = data.Title
local text = data.Message or data.Text or ""
local time = data.Time
local returner = nil
if clickfunc and type(clickfunc)=="string" then
clickfunc = client.Core.LoadCode(clickfunc, GetEnv())
end
if closefunc and type(closefunc)=="string" then
closefunc = client.Core.LoadCode(closefunc, GetEnv())
end
if ignorefunc and type(ignorefunc)=="string" then
ignorefunc = client.Core.LoadCode(ignorefunc, GetEnv())
end
--client.UI.Make("NotificationHolder")
local holder = client.UI.Get("NotificationHolder",nil,true)
if not holder then
local hold = service.New("ScreenGui")
local hTable = client.UI.Register(hold)
local frame = service.New("ScrollingFrame", hold)
client.UI.Prepare(hold)
hTable.Name = "NotificationHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(0, 200, 0.5, 0)
frame.Position = UDim2.new(1, -210, 0.5, -10)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
holder = hTable
hTable:Ready()
end
local function moveGuis(holder,mod)
local holdstuff = {}
for i,v in pairs(holder:GetChildren()) do
table.insert(holdstuff,1,v)
end
for i,v in pairs(holdstuff) do
v.Position = UDim2.new(0,0,1,-75*(i+mod))
end
holder.CanvasSize=UDim2.new(0,0,0,(#holder:GetChildren()*75))
local pos = (((#holder:GetChildren())*75) - holder.AbsoluteWindowSize.Y)
if pos<0 then pos = 0 end
holder.CanvasPosition = Vector2.new(0,pos)
end
holder = holder.Object.Frame
title.Text = name
frame.Name = name
main.Text = text
main.MouseButton1Click:Connect(function()
if frame and frame.Parent then
if clickfunc then
returner = clickfunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
close.MouseButton1Click:Connect(function()
if frame and frame.Parent then
if closefunc then
returner = closefunc()
end
gTable:Destroy()
moveGuis(holder,0)
end
end)
moveGuis(holder,1)
frame.Parent = holder
frame:TweenPosition(UDim2.new(0,0,1,-75),'Out','Linear',0.2)
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
if text == "Click here for commands." then
sound.SoundId = "rbxassetid://987728667"
elseif name == "Warning!" then
sound.SoundId = "rbxassetid://428495297"
else
sound.SoundId = "rbxassetid://2275705078"
end
wait(0.1)
sound:Play()
wait(1)
sound:Destroy()
end)
if time then
timer.Visible = true
spawn(function()
repeat
timer.Text = time
--timer.Size=UDim2.new(0,timer.TextBounds.X,0,10)
wait(1)
time = time-1
until time<=0 or not frame or not frame.Parent
if frame and frame.Parent then
if ignorefunc then
returner = ignorefunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
end
repeat wait() until returner ~= nil or not frame or not frame.Parent
return returner
end
|
-- Player Movement
-- Threshold for the minimum rate to move the accelerometer (Lower numbers (0.3) = more sensitive).
|
local sensitivity = 0.35
|
--local busy = false
--Shield.Touched:connect(function(Hit)
-- if Hit == nil then return end
-- if Hit.Parent == nil then return end
-- if busy == true then return end
--
-- busy = true
--
-- local Item = Hit.Parent
--
-- if Item:IsA("Tool") == true then return end
-- if Hit.Name == "Torso" then return end
-- if Hit.Name == "HumanoidRootPart" then return end
-- if Hit.Name == "Left Leg" then return end
-- if Hit.Name == "Right Leg" then return end
-- if Hit.Name == "Head" then return end
-- if Hit.Name == "Left Arm" then return end
-- if Hit.Name == "Right Arm" then return end
--
-- if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
--
-- local touch = false
-- for _, x in ipairs(Hit:GetChildren()) do
-- if x:IsA("TouchTransmitter") == true then touch = true x:Destroy() break end
-- end
--
-- local owner, dmg = GetOwnerAndDamage(Hit)
-- if owner ~= nil and dmg ~= nil then
-- if Health > 0 then
-- if Health >= dmg then
-- Health = Health - dmg
--
-- if Health < 0 then Health = 0 end
--
-- HealthBar.Shield.Bar:TweenSize(UDim2.new((Health / MaxHealth), 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5, true)
--
-- if Health > 0 then
-- -- yay, still alive.
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
--
-- Hit:Destroy()
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
-- else
-- if touch == true then
-- --Hit:Destroy()
-- end
-- end
--
-- busy = false
--end)
|
function Check(p)
for _, x in ipairs(p:GetChildren()) do
if x:IsA("IntValue") == true then
if x.Value == id then
return false
end
end
end
return true
end
Shield.Touched:connect(function(Hit)
if Hit == nil then return end
if Hit.Parent == nil then return end
local Item = Hit.Parent
if Item:IsA("Tool") == true then return end
if Hit.Name == "Torso" then return end
if Hit.Name == "HumanoidRootPart" then return end
if Hit.Name == "Left Leg" then return end
if Hit.Name == "Right Leg" then return end
if Hit.Name == "Head" then return end
if Hit.Name == "Left Arm" then return end
if Hit.Name == "Right Arm" then return end
if Hit:FindFirstChild("Pierce") ~= nil then return end
if Check(Hit) == false then return end
if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
for _, x in ipairs(Hit:GetChildren()) do
if x:IsA("TouchTransmitter") == true then x:Destroy() break end
end
Shield:Destroy()
end)
function CreateRegion3FromLocAndSize(Position, Size)
local SizeOffset = Size / 2
local Point1 = Position - SizeOffset
local Point2 = Position + SizeOffset
return Region3.new(Point1, Point2)
end
function FindNear(part, radius)
local r = CreateRegion3FromLocAndSize(part.Position, Vector3.new(part.Size.X + radius, 50, part.Size.Z + radius))
return Game:GetService("Workspace"):FindPartsInRegion3(r, part, 100)
end
while Shield and Shield.Parent do
for _, item in ipairs(FindNear(Shield, 15)) do
if item:IsA("BasePart") == true then
local own, dmg = GetOwnerAndDamage(item)
if own ~= nil and dmg ~= nil and item:FindFirstChild("Pierce") == nil and Check(item) == true then
if (item.Position - Shield.Position).magnitude <= 15 and item ~= Shield then
item:Destroy()
Shield:Destroy()
end
end
end
end
Game:GetService("RunService").Stepped:wait()
end
|
--[[
Constructs special keys for property tables which connect property change
listeners to an instance.
]]
|
local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local logError = require(Package.Logging.logError)
local function OnChange(propertyName: string): PubTypes.SpecialKey
local changeKey = {}
changeKey.type = "SpecialKey"
changeKey.kind = "OnChange"
changeKey.stage = "observer"
function changeKey:apply(callback: any, applyTo: Instance, cleanupTasks: {PubTypes.Task})
local ok, event = pcall(applyTo.GetPropertyChangedSignal, applyTo, propertyName)
if not ok then
logError("cannotConnectChange", nil, applyTo.ClassName, propertyName)
elseif typeof(callback) ~= "function" then
logError("invalidChangeHandler", nil, propertyName)
else
table.insert(cleanupTasks, event:Connect(function()
callback((applyTo :: any)[propertyName])
end))
end
end
return changeKey
end
return OnChange
|
-- Dont touch
|
while wait() do
script.Parent.Text = "Loading Game."
wait(.5)
script.Parent.Text = "Loading Game.."
wait(.5)
script.Parent.Text = "Loading Game..."
wait(.5)
script.Parent.Text = "Loading Game."
end
|
--[[Drivetrain Initialize]]
|
local Front = bike.FrontSection
local Rear = bike.RearSection
|
-- Decompiled with the Synapse X Luau decompiler.
|
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
return function(p1, p2, ...)
local v1 = ...;
local v2 = u1.Shared.UpgradeDifficultyColors[v1];
p1.label.Text = v1;
if v2 then
p1.label.TextColor3 = v2;
return;
end;
u1.GFX.Rainbow(p1.label, "TextColor3", 0.5);
end;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.