prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Ammo Settings |
Ammo = 17;
StoredAmmo = 17;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 0;
|
-- Class |
local CubicSpline = {}
CubicSpline.__index = CubicSpline
|
--------------------------------------------------------------------------------------
--------------------[ ANIMATIONS ]----------------------------------------------------
-------------------------------------------------------------------------------------- |
local AnimAng = {0, 0, 0, 0, 0}
local AnimCF = function(State, Ang)
if State ~= "Running" then
if (not Aimed) then
if State == "Idleing" then
return CF(
RAD(SIN(Ang)) / 2 * StanceSway,
1 + RAD(SIN(Ang * 5 / 2)) / 2 * StanceSway, 0
)
elseif State == "Walking" then
return CF(
RAD(SIN(Ang)) * 2 * StanceSway,
1 + RAD(ABS(SIN(Ang))) * 2 * StanceSway, 0
) * CFANG(0, RAD(SIN(Ang)) / 3, 0)
end
elseif Aimed then
if State == "Idleing" then
return CF(
RAD(SIN(Ang)) / 4 * StanceSway,
1 + RAD(SIN(Ang * 5 / 2)) / 4 * StanceSway, 0
)
elseif State == "Walking" then
return CF(
RAD(SIN(Ang)) / 3 * StanceSway,
1 + RAD(ABS(SIN(Ang))) / 3 * StanceSway, 0
)
end
end
elseif State == "Running" then
return CF(
SIN(Ang) / 6 * StanceSway,
0.9 + ABS(SIN(Ang)) / 5 * StanceSway, 0
) * CFANG(0, -RAD(SIN(Ang)) * 7, 0)
end
end
function Animate()
local IsIdleing = false
local IsWalking = false
local IsRunning = false
spawn(function()
while Selected do
IsIdleing = Idleing and (not Walking) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected
IsWalking = (not Idleing) and Walking and (not Running) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected
IsRunning = (not Idleing) and Walking and Running and (not Aiming) and (not Knifing) and (not ThrowingGrenade) and Selected
RS:wait()
end
IsIdleing = false
IsWalking = false
IsRunning = false
end)
spawn(function()
if S.PlayerAnimations then
TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
local PreviousArmTilt = ArmTilt
while Selected do
repeat RS:wait() until (ArmTilt ~= PreviousArmTilt) or (not Selected)
if (not IsRunning) and (not Aimed) and (not Reloading) and (not Knifing) and (not ThrowingGrenade) and Selected then
PreviousArmTilt = ArmTilt
TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, 0.15)
end
RS:wait()
end
end
end)
spawn(function()
while Selected do
if IsIdleing then
if (not Aimed) and (not Aiming) then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 70, 0, 70),
UDim2.new(0, -35, 0, -35),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.PlayerAnimations and 0.15 or 0,
true
)
if S.PlayerAnimations then
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.15)
TweenJoint(AnimWeld, AnimCF("Idleing", AnimAng[1]), CF(), Sine, 0.15)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.15)
else
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode")) then
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
AnimWeld.C0 = CF(0, 1, 0)
Grip.C1 = CFANG(0, RAD(20), 0)
end
end
elseif Aimed and (not Aiming) then
if S.PlayerAnimations then
TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, 0.15)
TweenJoint(AnimWeld, AnimCF("Idleing", AnimAng[2]), CF(), Sine, 0.15)
else
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode")) then
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
AnimWeld.C0 = CF(0, 1, 0)
Grip.C1 = Aimed_GripCF
end
end
end
if S.PlayerAnimations then
wait(0.15)
RunTween = false
while IsIdleing do
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode")) then
if (not Aimed) and (not Aiming) then
AnimWeld.C0 = AnimCF("Idleing", AnimAng[1])
AnimAng[1] = AnimAng[1] + 0.03 * StanceSway
elseif Aimed and (not Aiming) then
AnimWeld.C0 = AnimCF("Idleing", AnimAng[2])
AnimAng[2] = AnimAng[2] + 0.015 * StanceSway
end
end
RS:wait()
end
AnimAng[1], AnimAng[2] = 0, 0
end
end
if IsWalking then
if (not Aimed) and (not Aiming) then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 150, 0, 150),
UDim2.new(0, -75, 0, -75),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.PlayerAnimations and 0.15 or 0,
true
)
if S.PlayerAnimations then
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.15)
TweenJoint(AnimWeld, AnimCF("Walking", AnimAng[3]), CF(), Sine, 0.15)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.15)
else
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode")) then
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
AnimWeld.C0 = CF(0, 1, 0)
Grip.C1 = CFANG(0, RAD(20), 0)
end
end
elseif Aimed and (not Aiming) then
if S.PlayerAnimations then
TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, 0.15)
TweenJoint(AnimWeld, AnimCF("Walking", AnimAng[4]), CF(), Sine, 0.15)
else
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode")) then
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
AnimWeld.C0 = CF(0, 1, 0)
Grip.C1 = Aimed_GripCF
end
end
end
if S.PlayerAnimations then
wait(0.15)
RunTween = false
while IsWalking do
if (not LWeld:FindFirstChild("TweenCode"))
and (not RWeld:FindFirstChild("TweenCode"))
and (not ABWeld:FindFirstChild("TweenCode"))
and (not AnimWeld:FindFirstChild("TweenCode"))then
if (not Aimed) and (not Aiming) then
AnimWeld.C0 = AnimCF("Walking", AnimAng[3])
AnimAng[3] = AnimAng[3] + 0.15 * StanceSway
elseif Aimed and (not Aiming) then
AnimWeld.C0 = AnimCF("Walking", AnimAng[4])
AnimAng[4] = AnimAng[4] + 0.1 * StanceSway
end
end
RS:wait()
end
AnimAng[3], AnimAng[4] = 0, 0
end
end
if IsRunning then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 200, 0, 200),
UDim2.new(0, -100, 0, -100),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.PlayerAnimations and 0.15 or 0,
true
)
local LArmCF = CF(0, 0.7 - (SIN(AnimAng[5]) + 1)/15, 0)
local LArmAng = CFANG(RAD(ABS(COS(AnimAng[5]))) * 10 + RAD(35), RAD(-30), RAD((SIN(AnimAng[5]) + 1) * 15 - 40))
local RArmCF = CF(0, (SIN(AnimAng[5]) + 1)/2, 0)
local RArmAng = CFANG(RAD(ABS(COS(AnimAng[5]))) * 10 + RAD(20), 0, RAD(50 + (SIN(AnimAng[5]) + 1) * 5))
if S.PlayerAnimations then
TweenJoint(LWeld, ArmC0[1], LArmCF * LArmAng, Sine, 0.15)
TweenJoint(RWeld, ArmC0[2], RArmCF * RArmAng, Sine, 0.15)
TweenJoint(AnimWeld, AnimCF("Running", AnimAng[5]), CF(), Sine, 0.15)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(-5), 0), Sine, 0.15)
else
LWeld.C0, LWeld.C1 = ArmC0[1], LArmCF * LArmAng
RWeld.C0, RWeld.C1 = ArmC0[2], RArmCF * RArmAng
AnimWeld.C0 = CF(0, 0.9, 0)
Grip.C1 = CFANG(0, RAD(-5), 0)
end
if S.PlayerAnimations then
RunTween = true
wait(0.15)
while IsRunning do
if (not Aiming) then
AnimWeld.C0 = AnimCF("Running", AnimAng[5])
AnimAng[5] = AnimAng[5] + 0.18
end
RS:wait()
end
AnimAng[5] = 0
end
end
RS:wait()
end
end)
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 429 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--// Services |
local L_70_ = game:GetService('RunService').RenderStepped
local L_71_ = game:GetService('UserInputService')
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 135 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 500 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 1900 -- Use sliders to manipulate values
Tune.Redline = 2700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 2500
Tune.PeakSharpness = 2.5
Tune.CurveMult = 0.15
--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)
|
-- BrailleGen 3D BETA |
Align = true
This = script.Parent
Btn = This.Parent
Lift = Btn.Parent.Parent.Parent
Config = require(Lift.CustomLabel)
Characters = require(script.Characters)
CustomLabel = Config["CUSTOMFLOORLABEL"][tonumber(Btn.Name)]
function ChangeFloor(SF)
if Align == true then
if string.len(SF) == 1 then
SetLabel(1,SF,0.045)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0.03)
SetLabel(2,SF:sub(2,2),0.03)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0.015)
SetLabel(2,SF:sub(2,2),0.015)
SetLabel(3,SF:sub(3,3),0.015)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
else
if string.len(SF) == 1 then
SetLabel(1,SF,0)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
end
end
function SetLabel(ID,CHAR,OFFSET)
if This:FindFirstChild("BR"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
This["BR"..ID].Mesh.MeshId = "rbxassetid://"..l
end
if CHAR == "A" or CHAR == "1" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.014)
elseif CHAR == "B" or CHAR == "2" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.006)
elseif CHAR == "C" or CHAR == "3" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.014)
elseif CHAR == "D" or CHAR == "4" or CHAR == "E" or CHAR == "5" or CHAR == "F" or CHAR == "6" or CHAR == "G" or CHAR == "7" or CHAR == "H" or CHAR == "8" or CHAR == "I" or CHAR == "9" or CHAR == "J" or CHAR == "0" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.006)
elseif CHAR == "K" or CHAR == "L" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, 0)
elseif CHAR == "." or CHAR == "+" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "-" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.014)
elseif CHAR == ";" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "*" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET+0.006, 0, 0)
else
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0)
end
end
end
ChangeFloor("UP")
script:Destroy()
|
--All sounds are referenced by this ID |
local SFX = {
Died = 0;
Running = 1;
Swimming = 2;
Climbing = 3,
Jumping = 4;
GettingUp = 5;
FreeFalling = 6;
FallingDown = 7;
Landing = 8;
Splash = 9;
}
local Humanoid = nil
local Head = nil |
--------------------------CHARACTER CONTROL------------------------------- |
local function CreateController()
local this = {}
this.TorsoLookPoint = nil
function this:SetTorsoLookPoint(point)
local humanoid = findPlayerHumanoid(Player)
if humanoid then
humanoid.AutoRotate = false
end
this.TorsoLookPoint = point
self:UpdateTorso()
delay(2,
function()
-- this isnt technically correct for detecting if this is the last issue to the setTorso function
if this.TorsoLookPoint == point then
this.TorsoLookPoint = nil
if humanoid then
humanoid.AutoRotate = true
end
end
end)
end
function this:UpdateTorso(point)
if this.TorsoLookPoint then
point = this.TorsoLookPoint
else
return
end
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
if torso then
local lookVec = (point - torso.CFrame.p).unit
local squashedLookVec = Vector3.new(lookVec.X, 0, lookVec.Z).unit
torso.CFrame = CFrame.new(torso.CFrame.p, torso.CFrame.p + squashedLookVec)
end
end
return this
end
local CharacterControl = CreateController() |
--Visiblity |
uis = game:GetService("UserInputService")
ismobile = uis.TouchEnabled
button.Visible = ismobile
local states = {
OFF = "rbxasset://textures/ui/[email protected]",
ON = "rbxasset://textures/ui/[email protected]"
}
local MAX_LENGTH = 900000
local active = false
local ENABLED_OFFSET = CFrame.new(1.7, 0, 0)
local DISABLED_OFFSET = CFrame.new(-1.7, 0, 0)
local function UpdateImage(STATE)
button.Image = states[STATE]
end
local function UpdateAutoRotate(BOOL)
humanoid.AutoRotate = BOOL
end
local function GetUpdatedCameraCFrame(ROOT, CAMERA)
return CFrame.new(root.Position, Vector3.new(CAMERA.CFrame.LookVector.X * MAX_LENGTH, root.Position.Y, CAMERA.CFrame.LookVector.Z * MAX_LENGTH))
end
local function EnableShiftlock()
UpdateAutoRotate(false)
UpdateImage("ON")
root.CFrame = GetUpdatedCameraCFrame(root, camera)
camera.CFrame = camera.CFrame * ENABLED_OFFSET
end
local function DisableShiftlock()
UpdateAutoRotate(true)
UpdateImage("OFF")
camera.CFrame = camera.CFrame * DISABLED_OFFSET
pcall(function()
active:Disconnect()
active = nil
end)
end
UpdateImage("OFF")
active = false
function ShiftLock()
if not active then
active = runservice.RenderStepped:Connect(function()
EnableShiftlock()
end)
else
DisableShiftlock()
end
end
local ShiftLockButton = CAS:BindAction("ShiftLOCK", ShiftLock, false, "On")
CAS:SetPosition("ShiftLOCK", UDim2.new(0.8, 0, 0.8, 0))
button.MouseButton1Click:Connect(function()
if not active then
active = runservice.RenderStepped:Connect(function()
EnableShiftlock()
end)
else
DisableShiftlock()
end
end)
return MobileCameraFramework
|
-- Hola soy Google y este script va en el DoorMain |
local Can = true
local Open = false
script.Parent.Event.OnServerEvent:connect(function(Player)
local Mag = (script.Parent.Center.Position-Player.Character.HumanoidRootPart.Position).magnitude
if Mag <= script.Parent.Range.Value then
if Can then
Can = false
if Open == false then
local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
for i = 0,1,.1 do
local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
script.Parent:SetPrimaryPartCFrame(cfm)
wait()
end
Open = true
else
Open = false
local finish = script.Parent.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
for i = 0,1,.1 do
local cfm = script.Parent.PrimaryPart.CFrame:lerp(finish,i)
script.Parent:SetPrimaryPartCFrame(cfm)
wait()
end
end
Can = true
end
end
end)
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["RoactRodux"]["RoactRodux"])
return Package
|
----------------------------------------------------------------------------------------------- |
script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
local dm = script.Parent.Parent:WaitForChild("DriveMode")
|
--[[
to make more products just copy and past like this:
module.Products = {
{
ProductPrice = 0, --The price from the Developer Product.
ProductId = 0 -- The ID from the Developer Product.
},
{
ProductPrice = 0, --The price from the Developer Product.
ProductId = 0 -- The ID from the Developer Product.
},
{
ProductPrice = 0, --The price from the Developer Product.
ProductId = 0 -- The ID from the Developer Product.
},
}
For the more advanced scripters, READ THIS!
if you're already using the function ProcessReceipt then you must add custom code for this board to work,
as only one of these functions may be used in a game.
to disable the ProcessReceipt function from this board, unquote this above the 'return module' line:
module.AbortCustomPurchases = true
you can update the boards datastore with this line:
game:GetService("DataStoreService"):GetOrderedDataStore("TopDonators"):IncrementAsync(PlayerId, ProductPrice)
-PlayerId, the id from the player who bought the pruduct.
-ProductPrice, the developer products price (In Rs!)
--]] | |
--Basically checks if the toucher of the button is a player, then adds money to that player. Here ya go, gama. :D | |
--Tool.Spray.Transparency = 1
--Tool.Spray.Script.Disabled = false
--Tool.Nossle.Spray.Enabled = true |
event:FireServer("Button1Down")
end
function OB1U(mouse)
hold = false |
--// Aim|Zoom|Sensitivity Customization |
ZoomSpeed = 0.2; -- The lower the number the slower and smoother the tween
AimZoom = 15; -- Default zoom
AimSpeed = 0.2;
UnaimSpeed = 0.2;
CycleAimZoom = 50; -- Cycled zoom
MouseSensitivity = 0.25; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
-- Don't touch anything below this point unless you know what you're doing! |
local DefaultRig = Rigs[0]
local function Update(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid or Humanoid.Health <= 0 or Humanoid.RigType ~= Enum.HumanoidRigType.R15 then return end
Humanoid:UnequipTools()
local ConvertTo = Rigs[RigVersion]
if IgnoreBodyParts then
for _, Part in pairs(ConvertTo:GetDescendants()) do
if Character:FindFirstChild(Part.Name) and Part:IsA("BasePart") then
Humanoid:ReplaceBodyPartR15(Part.Name, Part:Clone())
end
end
else
for _, Part in pairs(Character:GetChildren()) do
if Part:IsA("MeshPart") then
local EquivalentDefault = DefaultRig:FindFirstChild(Part.Name)
local EquivalentSkinned = ConvertTo:FindFirstChild(Part.Name)
if EquivalentDefault and EquivalentSkinned and EquivalentDefault.MeshId == Part.MeshId then
Humanoid:ReplaceBodyPartR15(Part.Name, EquivalentSkinned:Clone())
end
end
end
end
end
local function PlayerJoined(Player)
Player.CharacterAppearanceLoaded:Connect(Update)
end
game:GetService("Players").PlayerAdded:Connect(PlayerJoined)
|
-- Script GUID: {A9313008-ED82-4E7E-86EA-83A84F627A60}
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
function ScreenShake()
return true;
end;
local u1 = require(game.ReplicatedStorage.Modules:WaitForChild("CameraShaker"));
local l__CurrentCamera__2 = workspace.CurrentCamera;
local l__LocalPlayer__3 = game.Players.LocalPlayer;
function v1.SmallBump(p1)
if ScreenShake() == true then
if typeof(p1) ~= "Vector3" then
p1 = p1.Position;
end;
local v2 = u1.new(Enum.RenderPriority.Camera.Value, function(p2)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p2;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p1).Magnitude <= 20 then
v2:Start();
v2:Shake(u1.Presets.Bump);
end;
end;
end;
function v1.TinyShake(p3)
if ScreenShake() == true then
if typeof(p3) ~= "Vector3" then
p3 = p3.Position;
end;
local v3 = u1.new(Enum.RenderPriority.Camera.Value, function(p4)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p4;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p3).Magnitude <= 20 then
v3:Start();
v3:Shake(u1.Presets.Bump);
end;
end;
end;
function v1.TinyShake3(p5)
if ScreenShake() == true then
if typeof(p5) ~= "Vector3" then
p5 = p5.Position;
end;
local v4 = u1.new(Enum.RenderPriority.Camera.Value, function(p6)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p6;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p5).Magnitude <= 100 then
v4:Start();
v4:Shake(u1.Presets.Bump2);
end;
end;
end;
function v1.TinyShake4(p7)
if ScreenShake() == true then
if typeof(p7) ~= "Vector3" then
p7 = p7.Position;
end;
local v5 = u1.new(Enum.RenderPriority.Camera.Value, function(p8)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p8;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p7).Magnitude <= 100 then
v5:Start();
v5:Shake(u1.Presets.Bump2);
end;
end;
end;
function v1.TinyShake5(p9)
if ScreenShake() == true then
if typeof(p9) ~= "Vector3" then
p9 = p9.Position;
end;
local v6 = u1.new(Enum.RenderPriority.Camera.Value, function(p10)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p10;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p9).Magnitude <= 100 then
v6:Start();
v6:Shake(u1.Presets.Bump4);
end;
end;
end;
function v1.Bump(p11)
if ScreenShake() == true then
if typeof(p11) ~= "Vector3" then
p11 = p11.Position;
end;
local v7 = u1.new(Enum.RenderPriority.Camera.Value, function(p12)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p12;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p11).Magnitude <= 40 then
v7:Start();
v7:Shake(u1.Presets.Bump2);
end;
end;
end;
function v1.Explosion(p13)
if ScreenShake() == true then
if typeof(p13) ~= "Vector3" then
p13 = p13.Position;
end;
local v8 = u1.new(Enum.RenderPriority.Camera.Value, function(p14)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p14;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p13).Magnitude <= 125 then
v8:Start();
v8:Shake(u1.Presets.Explosion);
end;
end;
end;
function v1.StrongExplosion(p15)
if ScreenShake() == true then
if typeof(p15) ~= "Vector3" then
p15 = p15.Position;
end;
local v9 = u1.new(Enum.RenderPriority.Camera.Value, function(p16)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p16;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p15).Magnitude <= 125 then
v9:Start();
v9:Shake(u1.Presets.StrongExplosion);
end;
end;
end;
function v1.SmallExplosion(p17)
if ScreenShake() == true then
if typeof(p17) ~= "Vector3" then
p17 = p17.Position;
end;
local v10 = u1.new(Enum.RenderPriority.Camera.Value, function(p18)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p18;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p17).Magnitude <= 125 then
v10:Start();
v10:Shake(u1.Presets.Explosion2);
end;
end;
end;
function v1.CamShakeBig(p19)
if ScreenShake() == true then
if typeof(p19) ~= "Vector3" then
p19 = p19.Position;
end;
local v11 = u1.new(Enum.RenderPriority.Camera.Value, function(p20)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p20;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p19).Magnitude <= 125 then
v11:Start();
v11:Shake(u1.Presets.Explosion);
end;
end;
end;
function v1.CamShakeBig2(p21, p22)
if ScreenShake() == true then
if typeof(p21) ~= "Vector3" then
p21 = p21.Position;
end;
local v12 = u1.new(Enum.RenderPriority.Camera.Value, function(p23)
l__CurrentCamera__2.CFrame = l__CurrentCamera__2.CFrame * p23;
end);
if (l__LocalPlayer__3.Character.HumanoidRootPart.Position - p21).Magnitude <= (p22 or 125) then
v12:Start();
v12:Shake(u1.Presets.Explosion2);
end;
end;
end;
return v1;
|
--Creates both buffer and non-buffer rockets. |
function RocketCreator:CreateRocket(IsBufferRocket)
--Create the base parts and mesh.
local Rocket = Instance.new("Part")
Rocket.Name = "Rocket"
Rocket.Size = Vector3.new(1,1,4)
Rocket.CanCollide = false
local Mesh = Instance.new("SpecialMesh")
Mesh.Name = "RocketMesh"
Mesh.MeshId = "http://www.roblox.com/asset/?id=94690081"
Mesh.TextureId = "http://www.roblox.com/asset/?id=94689966"
Mesh.Parent = Rocket
if IsBufferRocket then
--If it is a buffer rocket, add the effects, physics, and scripts.
Mesh.Scale = Vector3.new(2.5,2.5,2)
local Fire = Instance.new("Fire")
Fire.Heat = 5
Fire.Size = 2
Fire.Parent = Rocket
local Light = Instance.new("PointLight")
Light.Name = "Light"
Light.Color = Color3.new(1,170/255,0)
Light.Range = 10
Light.Shadows = true
Light.Parent = Rocket
local BodyGyro = Instance.new("BodyGyro")
BodyGyro.MaxTorque = Vector3.new(10^99,10^99,10^99)
BodyGyro.Parent = Rocket
local RocketPropulsion = Instance.new("BodyVelocity")
RocketPropulsion.MaxForce = Vector3.new(10^99,10^99,10^99)
RocketPropulsion.Parent = Rocket
local SwooshSound = Instance.new("Sound")
SwooshSound.Name = "SwooshSound"
SwooshSound.MaxDistance = 10000
SwooshSound.Looped = true
SwooshSound.SoundId = "rbxasset://sounds/Rocket whoosh 01.wav"
SwooshSound.Volume = 1
SwooshSound.Parent = Rocket
local ExplosionSound = Instance.new("Sound")
ExplosionSound.Name = "ExplosionSound"
ExplosionSound.MaxDistance = 10000
ExplosionSound.SoundId = "rbxasset://sounds/collide.wav"
ExplosionSound.Volume = 1
ExplosionSound.PlayOnRemove = true
ExplosionSound.Parent = Rocket
local NewRocketScript = RocketScript:Clone()
NewRocketScript.Disabled = false
NewRocketScript.Parent = Rocket
PlayerDamagerScript:Clone().Parent = NewRocketScript
ConfigurationScript:Clone().Parent = NewRocketScript
end
return Rocket
end
return RocketCreator
|
-- |
end
else
print("sh")
end
else
print("arms")
end
end
function Key(key)
if key then
key = string.lower(key)
if (key=="c") then
if on == 1 then
on = 0
Tool.Accuracy.Value = Tool.Accuracy.Value - 1
Tool.Pose.Value = 1
elseif on == 0 then
on = 1
Tool.Accuracy.Value = Tool.Accuracy.Value + 1
Tool.Pose.Value = 2
end
Crouch(on)
end
end
end
function Equip(mouse)
mouse.KeyDown:connect(Key)
end
script.Parent.Equipped:connect(Equip)
|
-- bezier class |
local Bezier = {}
Bezier.__index = Bezier
|
-- COLOR SETTINGS
--[[
COLOR PRESETS:
Headlights
- OEM White
- Xenon
- Pure White
- Brilliant Blue
- Light Green
- Golden Yellow
- Bubu's Purple
- Yellow
Indicators
- Light Orange
- Dark Orange
- Yellow
- Red
For custom color use Color3.fromRGB(R, G, B). You can get your RGB code from the "Color" property.
]] | --
local Low_Beam_Color = "OEM White"
local High_Beam_Color = "OEM White"
local Running_Light_Color = "OEM White"
local Interior_Light_Color = "OEM White"
local Front_Indicator_Color = "Dark Orange"
local Rear_Indicator_Color = "Dark Orange"
local Fog_Light_Color = "Golden Yellow"
local Plate_Light_Color = "OEM White"
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local gui = script.Parent.Parent
local bar = gui.TextLabel
local playergui = service.PlayerGui
--[[
local TopbarMatchAdmin = client.GetReturn("Setting","TopbarMatchAdmin")
local TopbarColor = client.GetReturn("Setting","TopbarColor")
local TopbarTransparency = client.GetReturn("Setting","TopbarTransparency")
local TopbarText = client.GetReturn("Setting","TopbarText")
if not TopbarMatchAdmin then
local text=TopbarText
if text=="%TIME" then
cPcall(function()
repeat
local t4=GetTime()
local nt4
local hour=t4:match("%d+")
if tonumber(hour)>12 or tonumber(hour)<1 then
nt4=`{math.abs(tonumber(hour)-12)}{t4:match(":%d+")} PM`
else
nt4=`{t4} AM`
end
bar.Text=`{t4} / {nt4}`
until not wait(1)
end)
else
bar.Text=TopbarText
end
bar.BackgroundColor3=TopbarColor
bar.BorderSizePixel=0
bar.BackgroundTransparency=TopbarTransparency
end
--]]
bar.Position=UDim2.new(0,0,0,-40)
gTable:Ready()
end
|
--!nonstrict |
local function strict(t, name)
name = name or tostring(t)
return setmetatable(t, {
__index = function(_self, key)
local message = ("%q (%s) is not a valid member of %s"):format(tostring(key), typeof(key), name)
error(message, 2)
end,
__newindex = function(_self, key, _value)
local message = ("%q (%s) is not a valid member of %s"):format(tostring(key), typeof(key), name)
error(message, 2)
end,
})
end
return strict
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
Camera = game:GetService("Workspace").CurrentCamera
Animations = {}
LocalObjects = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
Rate = (1 / 60)
SpeedMultiplier = 1.5
CameraSpeed = {
X = 40*SpeedMultiplier,
Z = 60*SpeedMultiplier
}
Controls = {
Forward = {
Mode = false,
Keys = {Key = "w", ByteKey = 17}
},
Backward = {
Mode = false,
Keys = {Key = "s", ByteKey = 18}
},
Left = {
Mode = false,
Keys = {Key = "a", ByteKey = 20}
},
Right = {
Mode = false,
Keys = {Key = "d", ByteKey = 19}
},
}
ToolEquipped = false
function HandleFlightControl()
if not CheckIfAlive() then
return
end
if FightMonitor then
FightMonitor:disconnect()
end
FightMonitor = Torso.ChildAdded:connect(function(Child)
if Flying then
return
end
if Child.Name == "FlightHold" then
local FlightSpin = Torso:FindFirstChild("FlightSpin")
local FlightPower = Torso:FindFirstChild("FlightPower")
local FlightHold = Torso:FindFirstChild("FlightHold")
if not FlightSpin or not FlightPower or not FlightHold then
return
end
Flying = true
Humanoid.WalkSpeed = 0
Humanoid.PlatformStand = true
Humanoid.AutoRotate = false
DisableJump(true)
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
local IsMoving = false
while Flying and FlightSpin.Parent and FlightPower.Parent and FlightHold.Parent and CheckIfAlive() do
local NewPush = Vector3.new(0, 0, 0)
local ForwardVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, -1))
local SideVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-1, 0, 0))
local CoordinateFrame = Camera.CoordinateFrame
local localControlVector = CFrame.new(Vector3.new(0,0,0),CoordinateFrame.lookVector*Vector3.new(1,0,1)):vectorToObjectSpace(Humanoid.MoveDirection)
NewPush = NewPush + ((ForwardVector * CameraSpeed.Z * -localControlVector.z) or NewPush)
NewPush = NewPush + ((SideVector * CameraSpeed.X * -localControlVector.x) or NewPush)
--NewPush = (NewPush + (((Controls.Forward.Mode and not Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z)) or ((not Controls.Forward.Mode and Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z * -1)) or NewPush))
--NewPush = (NewPush + (((Controls.Left.Mode and not Controls.Right.Mode) and (SideVector * CameraSpeed.X)) or ((not Controls.Left.Mode and Controls.Right.Mode) and (SideVector * CameraSpeed.X * -1)) or NewPush))
FlightSpin.cframe = CFrame.new(Vector3.new(0, 0, 0), ForwardVector)
if NewPush.magnitude < 1 then
FlightHold.maxForce = Vector3.new((FlightHold.P * 100), (FlightHold.P * 100), (FlightHold.P * 100))
FlightPower.maxForce = Vector3.new(0, 0, 0)
if IsMoving then
FlightHold.position = Torso.Position
end
IsMoving = false
else
IsMoving = true
FlightHold.maxForce = Vector3.new(0, 0, 0)
FlightPower.maxForce = Vector3.new((FlightPower.P * 100), (FlightPower.P * 100), (FlightPower.P * 100))
end
FlightPower.velocity = NewPush
wait(Rate)
end
Flying = false
if CheckIfAlive() then
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
Humanoid.WalkSpeed = 16
Humanoid.PlatformStand = false
Humanoid.AutoRotate = true
DisableJump(false)
Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
end
end
end)
end
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function DisableJump(Boolean)
if PreventJump then
PreventJump:disconnect()
end
if Boolean then
PreventJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
end
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function KeyPress(Key, Down)
local Key = string.lower(Key)
local ByteKey = string.byte(Key)
for i, v in pairs(Controls) do
if Key == v.Keys.Key or ByteKey == v.Keys.ByteKey then
Controls[i].Mode = Down
end
end
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
ToolEquipped = true
if not CheckIfAlive() then
return
end
Mouse.KeyDown:connect(function(Key)
KeyPress(Key, true)
end)
Mouse.KeyUp:connect(function(Key)
KeyPress(Key, false)
end)
Spawn(HandleFlightControl)
end
function Unequipped()
Flying = false
LocalObjects = {}
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs({PreventJump, FightMonitor}) do
if v then
v:disconnect()
end
end
for i, v in pairs(Controls) do
Controls[i].Mode = false
end
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
local ServerReturn
pcall(function()
ServerReturn = ServerControl:InvokeServer(mode, value)
end)
return ServerReturn
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- organises springs by speed and damping, for batch processing |
local springBuckets: {[number]: {[number]: Set<Spring>}} = {}
|
--NPC Script
--This script opens the door if an NPC touches it.
--Unless you know what you're doing, do not modify this script. |
local opening = false --This creates a bool to check if the door is opening.
script.Parent.Touched:Connect(function(hit) --This detects a touch on the door.
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") --This identifies the humanoid.
if humanoid ~= nil and script.Parent.CanCollide == true then --This checks if a character touched the door and the door is closed.
local humanoidwalkspeed --This creates a value to save the walk speed of the humanoid.
local player = game.Players:GetPlayerFromCharacter(hit.Parent) --This finds a player in the server.
if player == nil and opening == false then --This ensures that there is no connected player to the character and that the door isn't opening yet.
opening = true --This ensures that the script does not repeat the currently running code.
humanoidwalkspeed = humanoid.WalkSpeed --This saves the current walk speed of the humanoid.
wait(0.001) --This gives the script time to completely save the humanoid's current walk speed.
humanoid.WalkSpeed = 0 --This stops the humanoid from walking.
script.Parent.Unlock:Play() --This plays the "Door Knob" sound.
wait(1.1) --There is a delay for opening the door.
script.Parent.Open:Play() --This plays the door open sound.
script.Parent.Transparency = 0.25 --This causes the door to be slightly transparent.
script.Parent.CanCollide = false --This causes the door to stop colliding.
wait(1) --The NPC will delay before walking through the door.
humanoid.WalkSpeed = humanoidwalkspeed --This resets the humanoid walk speed to the original.
wait(1) --This gives the NPC time to stop touching the door.
opening = false --This allows the script to run the code again as long as the door is closed.
end
end
end)
|
-- Implements Javascript's `Array.prototype.map` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some |
return function<T, U>(t: Array<T>, callback: callbackFn<T> | callbackFnWithThisArg<T, U>, thisArg: U?)
if typeof(t) ~= "table" then
error(string.format("Array.some called on %s", typeof(t)))
end
if typeof(callback) ~= "function" then
error("callback is not a function")
end
for i, value in ipairs(t) do
if thisArg ~= nil then
if value ~= nil and (callback :: callbackFnWithThisArg<T, U>)(thisArg, value, i, t) then
return true
end
else
if value ~= nil and (callback :: callbackFn<T>)(value, i, t) then
return true
end
end
end
return false
end
|
--Tune |
local _Select = "AllSeason" --(AllSeason, Slicks, SemiSlicks, AllTerrain, DragRadials, Custom) Caps and space sensitive
local _Custom = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .2 , --How fast your tires will degrade (Front)
FTargetFriction = .58 , --Friction in optimal conditions (Front)
FMinFriction = 0.35 , --Friction in worst conditions (Front)
RWearSpeed = .2 , --How fast your tires will degrade (Rear)
RTargetFriction = .63 , --Friction in optimal conditions (Rear)
RMinFriction = 0.35 , --Friction in worst conditions (Rear)
--Tire Slip
TCSOffRatio = 1 , --How much optimal grip your car will lose with TCS off, set to 1 if you dont want any losses.
WheelLockRatio = 1/6 , --How much grip your car will lose when locking the wheels
WheelspinRatio = 1/1.2 , --How much grip your car will lose when spinning the wheels
--Wheel Properties
FFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front) (PGS)
RFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear) (PGS)
FLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front)
RLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear)
FElasticity = 0 , --How much your wheel will bounce (Front) (PGS)
RElasticity = 0 , --How much your wheel will bounce (Rear) (PGS)
FLgcyElasticity = 0 , --How much your wheel will bounce (Front)
RLgcyElasticity = 0 , --How much your wheel will bounce (Rear)
FElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front) (PGS)
RElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear) (PGS)
FLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front)
RLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear)
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _AllSeason = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .2 , --Don't change this
FTargetFriction = .6 , -- .58 to .63
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .2 , --Don't change this
RTargetFriction = .6 , -- .58 to .63
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 2 , --Don't change this
RFrictionWeight = 2 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _Slicks = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .6 , --Don't change this
FTargetFriction = .93 , -- .88 to .93
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .6 , --Don't change this
RTargetFriction = .93 , -- .88 to .93
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 0.6 , --Don't change this
RFrictionWeight = 0.6 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _SemiSlicks = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .5 , --Don't change this
FTargetFriction = .78 , -- .73 to .78
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .5 , --Don't change this
RTargetFriction = .78 , -- .73 to .78
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 0.6 , --Don't change this
RFrictionWeight = 0.6 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _AllTerrain = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .3 , --Don't change this
FTargetFriction = .5 , -- .48 to .53
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .3 , --Don't change this
RTargetFriction = .5 , -- .48 to .53
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 10 , --Don't change this
RFrictionWeight = 10 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _DragRadials = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = 30 , --Don't change this
FTargetFriction = 1.2 , -- 1.18 to 1.23
FMinFriction = 0.35 , --Don't change this
RWearSpeed = 30 , --Don't change this
RTargetFriction = 1.2 , -- 1.18 to 1.23
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 1 , --Don't change this
RFrictionWeight = 1 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 20 , --Don't change this
}
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local cValues = script.Parent.Parent:WaitForChild("Values")
local _WHEELTUNE = _AllSeason
if _Select == "DragRadials" then
_WHEELTUNE = _DragRadials
elseif _Select == "Custom" then
_WHEELTUNE = _Custom
elseif _Select == "AllTerrain" then
_WHEELTUNE = _AllTerrain
elseif _Select == "Slicks" then
_WHEELTUNE = _Slicks
elseif _Select == "SemiSlicks" then
_WHEELTUNE = _SemiSlicks
else
_WHEELTUNE = _AllSeason
end
car.DriveSeat.TireStats.Fwear.Value = _WHEELTUNE.FWearSpeed
car.DriveSeat.TireStats.Ffriction.Value = _WHEELTUNE.FTargetFriction
car.DriveSeat.TireStats.Fminfriction.Value = _WHEELTUNE.FMinFriction
car.DriveSeat.TireStats.Ffweight.Value = _WHEELTUNE.FFrictionWeight
car.DriveSeat.TireStats.Rwear.Value = _WHEELTUNE.RWearSpeed
car.DriveSeat.TireStats.Rfriction.Value = _WHEELTUNE.RTargetFriction
car.DriveSeat.TireStats.Rminfriction.Value = _WHEELTUNE.RMinFriction
car.DriveSeat.TireStats.Rfweight.Value = _WHEELTUNE.RFrictionWeight
car.DriveSeat.TireStats.TCS.Value = _WHEELTUNE.TCSOffRatio
car.DriveSeat.TireStats.Lock.Value = _WHEELTUNE.WheelLockRatio
car.DriveSeat.TireStats.Spin.Value = _WHEELTUNE.WheelspinRatio
car.DriveSeat.TireStats.Reg.Value = _WHEELTUNE.RegenSpeed
|
--[[
Returns a new promise that:
* is resolved when all input promises resolve
* is rejected if ANY input promises reject
]] |
function Promise._all(traceback, promises, amount)
if type(promises) ~= "table" then
error(string.format(ERROR_NON_LIST, "Promise.all"), 3)
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i, promise in pairs(promises) do
if not Promise.is(promise) then
error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.all", tostring(i)), 3)
end
end
-- If there are no values then return an already resolved promise.
if #promises == 0 or amount == 0 then
return Promise.resolve({})
end
return Promise._new(traceback, function(resolve, reject, onCancel)
-- An array to contain our resolved values from the given promises.
local resolvedValues = {}
local newPromises = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local resolvedCount = 0
local rejectedCount = 0
local done = false
local function cancel()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
if done then
return
end
resolvedCount = resolvedCount + 1
if amount == nil then
resolvedValues[i] = ...
else
resolvedValues[resolvedCount] = ...
end
if resolvedCount >= (amount or #promises) then
done = true
resolve(resolvedValues)
cancel()
end
end
onCancel(cancel)
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i, promise in ipairs(promises) do
newPromises[i] = promise:andThen(
function(...)
resolveOne(i, ...)
end,
function(...)
rejectedCount = rejectedCount + 1
if amount == nil or #promises - rejectedCount < amount then
cancel()
done = true
reject(...)
end
end
)
end
if done then
cancel()
end
end)
end
function Promise.all(promises)
return Promise._all(debug.traceback(nil, 2), promises)
end
function Promise.some(promises, amount)
assert(type(amount) == "number", "Bad argument #2 to Promise.some: must be a number")
return Promise._all(debug.traceback(nil, 2), promises, amount)
end
function Promise.any(promises)
return Promise._all(debug.traceback(nil, 2), promises, 1):andThen(function(values)
return values[1]
end)
end
function Promise.allSettled(promises)
if type(promises) ~= "table" then
error(string.format(ERROR_NON_LIST, "Promise.allSettled"), 2)
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i, promise in pairs(promises) do
if not Promise.is(promise) then
error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.allSettled", tostring(i)), 2)
end
end
-- If there are no values then return an already resolved promise.
if #promises == 0 then
return Promise.resolve({})
end
return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
-- An array to contain our resolved values from the given promises.
local fates = {}
local newPromises = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local finishedCount = 0
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
finishedCount = finishedCount + 1
fates[i] = ...
if finishedCount >= #promises then
resolve(fates)
end
end
onCancel(function()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end)
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i, promise in ipairs(promises) do
newPromises[i] = promise:finally(
function(...)
resolveOne(i, ...)
end
)
end
end)
end
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]] | --
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
local u2 = {};
return function(p1)
if u2[p1] then
return u2[p1];
end;
local u3 = nil;
pcall(function()
u3 = u1.MarketplaceService:GetProductInfo(p1, Enum.InfoType.GamePass);
end);
if u3 then
u2[p1] = u3;
end;
return u3;
end;
|
-- declarations |
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
Humanoid.Health=150 |
--I M P O R T A N T--
------------------------------------------------------------------------
--Don't change any of this unless you know what you are doing.
--This script is the blur affect but also the exit button script.
------------------------------------------------------------------------ |
local blur = game.Lighting.Blur
local frame = script.Parent
local close = script.Parent.CloseButton
local player = game.Players.LocalPlayer
if
frame.Visible == true
then
blur.Enabled = true
end
close.MouseButton1Click:Connect(function()
frame.Visible = false
end)
close.MouseButton1Click:Connect(function()
blur.Enabled = false
end)
|
--NinjaGiant--
--NinjaGiant--
--NinjaGiant--
--NinjaGiant--
--NinjaGiant-- |
function o(i)
local touch = i:findFirstChild("Touch")
if (touch == nil) then return end |
-- Create class |
local FreeDragging = {}
FreeDragging.__index = FreeDragging
function FreeDragging.new(Tool)
local self = {
Tool = Tool;
-- Dragging state
IsDragging = false;
StartScreenPoint = nil;
StartTarget = nil;
CrossthroughCorrection = nil;
LastSelection = nil;
LastBasePartOffset = nil;
Target = nil;
TargetPoint = nil;
TargetNormal = nil;
LastTargetNormal = nil;
CornerOffsets = nil;
-- Surface alignment state
TriggerAlignment = nil;
SurfaceAlignment = nil;
LastSurfaceAlignment = nil;
}
setmetatable(self, FreeDragging)
-- Listen for free dragging ending
self:InstallDragEndListener()
-- Return initialized module
return self
end
function FreeDragging:EnableDragging()
-- Enables part dragging
local function HandleDragStart(Action, State, Input)
if State.Name ~= 'Begin' then
return Enum.ContextActionResult.Pass
end
-- Get mouse target
local TargetPart = Core.Mouse.Target
if (not TargetPart) or Selection.Multiselecting then
return Enum.ContextActionResult.Pass
end
-- Make sure target is draggable, unless snapping
local IsSnapping = UserInputService:IsKeyDown(Enum.KeyCode.R) and #Selection.Items > 0
if not Core.IsSelectable({ TargetPart }) and not IsSnapping then
return Enum.ContextActionResult.Pass
end
-- Initialize dragging detection data
self.StartTarget = TargetPart
self.StartScreenPoint = Vector2.new(Core.Mouse.X, Core.Mouse.Y)
-- Select unselected target, if not snapping
local _, ScopeTarget = Core.Targeting:UpdateTarget()
if not Selection.IsSelected(ScopeTarget) and not IsSnapping then
Core.Targeting.SelectTarget(true)
Core.Targeting.CancelSelecting()
end
local function HandlePotentialDragStart(Action, State, Input)
if State.Name ~= 'Change' then
return Enum.ContextActionResult.Pass
end
-- Trigger dragging if the mouse is moved over 2 pixels
local DragScreenDistance = self.StartScreenPoint and
(Vector2.new(Core.Mouse.X, Core.Mouse.Y) - self.StartScreenPoint).Magnitude
if DragScreenDistance >= 2 then
-- Prepare for dragging
BoundingBox.ClearBoundingBox()
self:SetUpDragging(self.StartTarget, SnapTracking.Enabled and self.Tool.SnappedPoint or nil)
-- Stop watching for potential dragging
ContextActionService:UnbindAction 'BT: Watch for dragging'
end
-- Pass input if not a touch interaction
if Input.UserInputType.Name ~= 'Touch' then
return Enum.ContextActionResult.Pass
end
end
-- Watch for potential dragging
ContextActionService:BindAction('BT: Watch for dragging', HandlePotentialDragStart, false,
Enum.UserInputType.MouseMovement,
Enum.UserInputType.Touch
)
end
-- Pay attention to when the user intends to start dragging
ContextActionService:BindAction('BT: Start dragging', HandleDragStart, false,
Enum.UserInputType.MouseButton1,
Enum.UserInputType.Touch
)
end
function FreeDragging:SetUpDragging(BasePart, BasePoint)
-- Sets up and initiates dragging based on the given base part
-- Prevent selection while dragging
Core.Targeting.CancelSelecting()
-- Prepare parts, and start dragging
self.InitialPartStates, self.InitialModelStates = self.Tool:PrepareSelectionForDragging()
self:StartDragging(BasePart, self.InitialPartStates, self.InitialModelStates, BasePoint)
end
function FreeDragging:StartDragging(BasePart, InitialPartStates, InitialModelStates, BasePoint)
-- Begins dragging the selection
-- Ensure dragging is not already ongoing
if self.IsDragging then
return
end
-- Indicate that we're dragging
self.IsDragging = true
-- Track changes
self.Tool:TrackChange()
-- Disable bounding box calculation
BoundingBox.ClearBoundingBox()
-- Cache area permissions information
local AreaPermissions
if Core.Mode == 'Tool' then
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player)
end
-- Ensure a base part is provided
if not InitialPartStates[BasePart] then
BasePart = next(InitialPartStates)
if not BasePart then
return
end
end
-- Determine the base point for dragging
local BasePartOffset = -BasePart.CFrame:pointToObjectSpace(Core.Mouse.Hit.p)
-- Improve base point alignment for the given increment
BasePartOffset = Vector3.new(
math.clamp(MoveUtil.GetIncrementMultiple(BasePartOffset.X, self.Tool.Increment), -BasePart.Size.X / 2, BasePart.Size.X / 2),
math.clamp(MoveUtil.GetIncrementMultiple(BasePartOffset.Y, self.Tool.Increment), -BasePart.Size.Y / 2, BasePart.Size.Y / 2),
math.clamp(MoveUtil.GetIncrementMultiple(BasePartOffset.Z, self.Tool.Increment), -BasePart.Size.Z / 2, BasePart.Size.Z / 2)
)
-- Use the given base point instead if any
if BasePoint then
BasePartOffset = -BasePart.CFrame:pointToObjectSpace(BasePoint)
end
-- Prepare snapping in case it is enabled, and make sure to override its default target selection
SnapTracking.TargetBlacklist = Selection.Items
self.Tool.Maid.DragSnapping = self.Tool.PointSnapped:Connect(function (SnappedPoint)
-- Align the selection's base point to the snapped point
local Rotation = self.SurfaceAlignment or (InitialPartStates[BasePart].CFrame - InitialPartStates[BasePart].CFrame.p)
BasePart.CFrame = CFrame.new(SnappedPoint) * Rotation * CFrame.new(BasePartOffset)
MoveUtil.TranslatePartsRelativeToPart(BasePart, InitialPartStates, InitialModelStates)
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
BasePart.CFrame = InitialPartStates[BasePart].CFrame
MoveUtil.TranslatePartsRelativeToPart(BasePart, InitialPartStates, InitialModelStates)
end
end)
-- Update cache of corner offsets for later crossthrough calculations
self.CornerOffsets = GetCornerOffsets(InitialPartStates[BasePart].CFrame, InitialPartStates)
-- Provide a callback to trigger alignment
self.TriggerAlignment = function ()
-- Trigger drag recalculation
self:DragToMouse(BasePart, BasePartOffset, InitialPartStates, InitialModelStates, AreaPermissions)
-- Trigger snapping recalculation
if SnapTracking.Enabled then
self.Tool.PointSnapped:Fire(self.Tool.SnappedPoint)
end
end
local function HandleDragChange(Action, State, Input)
if State.Name == 'Change' then
self:DragToMouse(BasePart, BasePartOffset, InitialPartStates, InitialModelStates, AreaPermissions)
end
return Enum.ContextActionResult.Pass
end
-- Start up the dragging
ContextActionService:BindAction('BT: Dragging', HandleDragChange, false,
Enum.UserInputType.MouseMovement,
Enum.UserInputType.Touch
)
end
function FreeDragging:DragToMouse(BasePart, BasePartOffset, InitialPartStates, InitialModelStates, AreaPermissions)
-- Drags the selection by `BasePart`, judging area authorization from `AreaPermissions`
----------------------------------------------
-- Check what and where the mouse is aiming at
----------------------------------------------
-- Don't consider other selected parts possible targets
local IgnoreList = Support.CloneTable(Selection.Items)
table.insert(IgnoreList, Core.Player and Core.Player.Character)
-- Perform the mouse target search
local Target, TargetPoint, TargetNormal = Workspace:FindPartOnRayWithIgnoreList(
Ray.new(Core.Mouse.UnitRay.Origin, Core.Mouse.UnitRay.Direction * 5000),
IgnoreList
)
self.Target = Target
self.TargetPoint = TargetPoint
self.TargetNormal = TargetNormal
-- Reset any surface alignment and calculated crossthrough if target surface changes
if self.LastTargetNormal ~= self.TargetNormal then
self.SurfaceAlignment = nil
self.CrossthroughCorrection = nil
end
-- Reset any calculated crossthrough if selection, drag offset, or surface alignment change
if (self.LastSelection ~= Selection.Items) or
(self.LastBasePartOffset ~= BasePartOffset) or
(self.LastSurfaceAlignment ~= self.SurfaceAlignment) then
self.CrossthroughCorrection = nil
end
-- Save last dragging options for change detection
self.LastSelection = Selection.Items
self.LastBasePartOffset = BasePartOffset
self.LastSurfaceAlignment = self.SurfaceAlignment
self.LastTargetNormal = self.TargetNormal
------------------------------------------------
-- Move the selection towards any snapped points
------------------------------------------------
-- If snapping is enabled, skip regular dragging
if SnapTracking.Enabled then
return
end
------------------------------------------------------
-- Move the selection towards the right mouse location
------------------------------------------------------
-- Get the increment-aligned target point
self.TargetPoint = self:GetAlignedTargetPoint(
self.Target,
self.TargetPoint,
self.TargetNormal,
self.Tool.Increment
)
-- Move the parts towards their target destination
local Rotation = self.SurfaceAlignment or (InitialPartStates[BasePart].CFrame - InitialPartStates[BasePart].CFrame.p)
local TargetCFrame = CFrame.new(self.TargetPoint) * Rotation * CFrame.new(BasePartOffset)
-- Calculate crossthrough against target plane if necessary
if not self.CrossthroughCorrection then
self.CrossthroughCorrection = 0
-- Calculate each corner's tentative position
for _, CornerOffset in pairs(self.CornerOffsets) do
local Corner = TargetCFrame * CornerOffset
-- Calculate the corner's target plane crossthrough
local CornerCrossthrough = -(self.TargetPoint - Corner):Dot(self.TargetNormal)
-- Check if this corner crosses through the most
if CornerCrossthrough < self.CrossthroughCorrection then
self.CrossthroughCorrection = CornerCrossthrough
end
end
end
-- Move the selection, retracted by the max. crossthrough amount
BasePart.CFrame = TargetCFrame - (self.TargetNormal * self.CrossthroughCorrection)
MoveUtil.TranslatePartsRelativeToPart(BasePart, InitialPartStates, InitialModelStates)
----------------------------------------
-- Check for relevant area authorization
----------------------------------------
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
BasePart.CFrame = InitialPartStates[BasePart].CFrame
MoveUtil.TranslatePartsRelativeToPart(BasePart, InitialPartStates, InitialModelStates)
end
end
function FreeDragging:AlignSelectionToTarget()
-- Aligns the selection to the current target surface while dragging
-- Ensure dragging is ongoing
if not self.IsDragging or not self.TargetNormal then
return
end
-- Get target surface normal as arbitrarily oriented CFrame
local TargetNormalCF = CFrame.new(Vector3.new(), self.TargetNormal)
-- Use detected surface normal directly if not targeting a part
if not self.Target then
self.SurfaceAlignment = TargetNormalCF * CFrame.Angles(-math.pi / 2, 0, 0)
-- For parts, calculate orientation based on the target surface, and the target part's orientation
else
-- Set upward direction to match the target surface normal
local UpVector, LookVector, RightVector = self.TargetNormal
-- Use target's rightward orientation for calculating orientation (when targeting forward or backward directions)
local Target, TargetNormal = self.Target, self.TargetNormal
if TargetNormal:isClose(Target.CFrame.lookVector, 0.000001) or TargetNormal:isClose(-Target.CFrame.lookVector, 0.000001) then
LookVector = TargetNormal:Cross(Target.CFrame.rightVector).unit
RightVector = LookVector:Cross(TargetNormal).unit
-- Use target's forward orientation for calculating orientation (when targeting any other direction)
else
RightVector = Target.CFrame.lookVector:Cross(TargetNormal).unit
LookVector = TargetNormal:Cross(RightVector).unit
end
-- Generate rotation matrix based on direction vectors
self.SurfaceAlignment = CFrame.new(
0, 0, 0,
RightVector.X, UpVector.X, -LookVector.X,
RightVector.Y, UpVector.Y, -LookVector.Y,
RightVector.Z, UpVector.Z, -LookVector.Z
)
end
-- Trigger alignment
self:TriggerAlignment()
end
function FreeDragging:GetAlignedTargetPoint(Target, TargetPoint, TargetNormal, Increment)
-- Returns the target point aligned to the nearest increment multiple
-- By default, use the center of the universe for alignment on all axes
local ReferencePoint = CFrame.new()
local PlaneAxes = Vector3.new(1, 1, 1)
-----------------------------------------------------------------------------
-- Detect appropriate reference points and plane axes for recognized surfaces
-----------------------------------------------------------------------------
-- Make sure the target is a part
if Target and Target:IsA 'BasePart' and Target.ClassName ~= 'Terrain' then
local Size = Target.Size / 2
-- Calculate the direction of a wedge surface
local WedgeDirection = (Target.CFrame - Target.CFrame.p) *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), math.atan(Target.Size.Z / Target.Size.Y))
-- Calculate the direction of a corner part's Z-axis surface
local CornerDirectionZ = (Target.CFrame - Target.CFrame.p) *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), math.pi - math.atan(Target.Size.Z / Target.Size.Y))
-- Calculate the direction of a corner part's X-axis surface
local CornerDirectionX = (Target.CFrame - Target.CFrame.p) *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.Z), math.atan(Target.Size.Y / Target.Size.X)) *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), math.pi / 2) *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.Z), -math.pi / 2)
-- Get the right alignment reference point on a part's front surface
if TargetNormal:isClose(Target.CFrame.lookVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(Size.X, Size.Y, -Size.Z)
PlaneAxes = Vector3.new(1, 1, 0)
-- Get the right alignment reference point on a part's back surface
elseif TargetNormal:isClose(-Target.CFrame.lookVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(-Size.X, Size.Y, Size.Z)
PlaneAxes = Vector3.new(1, 1, 0)
-- Get the right alignment reference point on a part's left surface
elseif TargetNormal:isClose(-Target.CFrame.rightVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(-Size.X, Size.Y, -Size.Z)
PlaneAxes = Vector3.new(0, 1, 1)
-- Get the right alignment reference point on a part's right surface
elseif TargetNormal:isClose(Target.CFrame.rightVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(Size.X, Size.Y, Size.Z)
PlaneAxes = Vector3.new(0, 1, 1)
-- Get the right alignment reference point on a part's upper surface
elseif TargetNormal:isClose(Target.CFrame.upVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(Size.X, Size.Y, Size.Z)
PlaneAxes = Vector3.new(1, 0, 1)
-- Get the right alignment reference point on a part's bottom surface
elseif TargetNormal:isClose(-Target.CFrame.upVector, 0.000001) then
ReferencePoint = Target.CFrame * CFrame.new(Size.X, -Size.Y, -Size.Z)
PlaneAxes = Vector3.new(1, 0, 1)
-- Get the right alignment reference point on wedged part surfaces
elseif TargetNormal:isClose(WedgeDirection.lookVector, 0.000001) then
-- Get reference point oriented to wedge plane
ReferencePoint = WedgeDirection *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), -math.pi / 2) +
(Target.CFrame * Vector3.new(Size.X, Size.Y, Size.Z))
-- Set plane offset axes
PlaneAxes = Vector3.new(1, 0, 1)
-- Get the right alignment reference point on the Z-axis surface of a corner part
elseif TargetNormal:isClose(CornerDirectionZ.lookVector, 0.000001) then
-- Get reference point oriented to wedged plane
ReferencePoint = CornerDirectionZ *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), -math.pi / 2) +
(Target.CFrame * Vector3.new(-Size.X, Size.Y, -Size.Z))
-- Set plane offset axes
PlaneAxes = Vector3.new(1, 0, 1)
-- Get the right alignment reference point on the X-axis surface of a corner part
elseif TargetNormal:isClose(CornerDirectionX.lookVector, 0.000001) then
-- Get reference point oriented to wedged plane
ReferencePoint = CornerDirectionX *
CFrame.fromAxisAngle(Vector3.FromAxis(Enum.Axis.X), -math.pi / 2) +
(Target.CFrame * Vector3.new(Size.X, Size.Y, -Size.Z))
-- Set plane offset axes
PlaneAxes = Vector3.new(1, 0, 1)
-- Return an unaligned point for unrecognized surfaces
else
return TargetPoint
end
end
-------------------------------------
-- Calculate the aligned target point
-------------------------------------
-- Get target point offset from reference point
local ReferencePointOffset = ReferencePoint:inverse() * CFrame.new(TargetPoint)
-- Align target point on increment grid from reference point along the plane axes
local AlignedTargetPoint = ReferencePoint * (Vector3.new(
MoveUtil.GetIncrementMultiple(ReferencePointOffset.X, Increment),
MoveUtil.GetIncrementMultiple(ReferencePointOffset.Y, Increment),
MoveUtil.GetIncrementMultiple(ReferencePointOffset.Z, Increment)
) * PlaneAxes)
-- Return the aligned target point
return AlignedTargetPoint
end
function FreeDragging:FinishDragging()
-- Releases parts and registers position changes from dragging
-- Make sure dragging is active
if not self.IsDragging then
return
end
-- Indicate that we're no longer dragging
self.IsDragging = false
-- Clear any surface alignment
self.SurfaceAlignment = nil
-- Stop the dragging action
ContextActionService:UnbindAction 'BT: Dragging'
-- Stop, clean up snapping point tracking
SnapTracking.StopTracking()
self.Tool.Maid.DragSnapping = nil
-- Restore the original state of each part
for Part, State in pairs(self.InitialPartStates) do
Part:MakeJoints()
Core.RestoreJoints(State.Joints)
Part.CanCollide = State.CanCollide
Part.Anchored = State.Anchored
end
-- Register changes
self.Tool:RegisterChange()
end
|
-- setup emote chat hook |
game:GetService("Players").LocalPlayer.Chatted:Connect(function(msg)
local emote = ""
if (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
end
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
end
end)
|
-- A ModuleScript inside your hooks folder. |
return function (registry)
registry:RegisterHook("BeforeRun", function(context)
if context.Group == "DefaultAdmin" and context.Executor.UserId ~= game.CreatorId then
return "You don't have permission to run this command"
end
end)
end
|
--on |
script.Parent.Cover.Transparency = 0
else
on = false
|
--[[Engine]]
--Torque Curve |
Tune.Horsepower = 480 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 500 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 3900 -- Use sliders to manipulate values
Tune.Redline = 4500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 4500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
|
---Basic_Settings:--- |
local light = true -- Set to false if u dont have light added
local maxv = 114 -- Max Speed In REAL KT.. Check Online for the real Aviation speed for this plane
local minspeed = -30 -- min speed In real KT
local Spd_keep = true-- Set to false if U dont want the function to Speed up/down if u hold M/N down, and after release it stops |
--script.Parent.Keyhole.ClickDetector.MouseClick:connect(onClicked) | |
-- ROBLOX deviation START: exporting types without a namespace prefix |
export type MatcherState = JestMatcherState
export type Matcher<R> = MatcherInterface<R> |
--//SS6 PLUGIN; SPLASH//-- |
--//INSPARE 2017//--
local ai = script.Parent.Main_Frame.A.Frame.ImageLabel
local bi = script.Parent.Main_Frame.B.Frame.ImageLabel
local ci = script.Parent.Main_Frame.C.Frame.ImageLabel
local di = script.Parent.Main_Frame.D.Frame.ImageLabel
local ei = script.Parent.Main_Frame.E.Frame.ImageLabel
ai.Size = UDim2.new(15,0,9,0)
bi.Size = UDim2.new(15,0,9,0)
ci.Size = UDim2.new(15,0,9,0)
di.Size = UDim2.new(15,0,9,0)
ei.Size = UDim2.new(15,0,9,0)
wait(.2)
script.Parent.SplashFade.WI:Play()
while true do
for i=1,2 do
for i=1,4 do
ai.Position = ai.Position - UDim2.new(3,0,0,0)
bi.Position = bi.Position - UDim2.new(3,0,0,0)
ci.Position = ci.Position - UDim2.new(3,0,0,0)
di.Position = di.Position - UDim2.new(3,0,0,0)
ei.Position = ei.Position - UDim2.new(3,0,0,0)
wait(.045)
end
ai.Position = ai.Position + UDim2.new(12,0,-3,0)
bi.Position = bi.Position + UDim2.new(12,0,-3,0)
ci.Position = ci.Position + UDim2.new(12,0,-3,0)
di.Position = di.Position + UDim2.new(12,0,-3,0)
ei.Position = ei.Position + UDim2.new(12,0,-3,0)
wait(.045)
end
for i=1,2 do
ai.Position = ai.Position - UDim2.new(3,0,0,0)
bi.Position = bi.Position - UDim2.new(3,0,0,0)
ci.Position = ci.Position - UDim2.new(3,0,0,0)
di.Position = di.Position - UDim2.new(3,0,0,0)
ei.Position = ei.Position - UDim2.new(3,0,0,0)
wait(.045)
end
ai.Position = ai.Position + UDim2.new(6,0,6,0)
bi.Position = bi.Position + UDim2.new(6,0,6,0)
ci.Position = ci.Position + UDim2.new(6,0,6,0)
di.Position = di.Position + UDim2.new(6,0,6,0)
ei.Position = ei.Position + UDim2.new(6,0,6,0)
wait(.045)
end
|
--[=[
@interface ItemInfo
A table containing information about one of the items that has been
registered with the Merch Booth.
You can interface with these objects using the [MerchBooth.getItems]
function.
.assetId number -- Add ID of the item, as passed to [MerchBooth.addItemAsync]
.title string -- Name of the item as it appears in the catalog
.price number -- Price in Robux of the item
.description string -- Description of the item as it appears in the catalog
.assetType Enum.AssetType -- Type of asset that as it appears in the Marketplace
.viewportObject Accessory -- A 3D object to represent the item
.creatorName string -- Name of the user or group that created the asset
.creatorType Enum.CreatorType -- Type of the user/group that created the asset
@within MerchBooth
]=] |
export type ItemInfo = {
assetId: number,
title: string?,
price: number?,
description: string?,
assetType: Enum.AssetType?,
viewportObject: Accessory?,
creatorName: string?,
creatorType: Enum.CreatorType?,
hiddenFromCatalog: boolean,
isOwned: boolean?,
productType: Enum.InfoType?,
iconId: number?,
}
|
-- print("Loading anims " .. name) |
table.insert(animTable[name].connections, config.ChildAdded:Connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:Connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:Connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight |
--[[**
ensures value is a table and all keys pass keyCheck and all values pass valueCheck
@param keyCheck The function to use to check the keys
@param valueCheck The function to use to check the values
@returns A function that will return true iff the condition is passed
**--]] |
function t.map(keyCheck, valueCheck)
assert(t.callback(keyCheck), t.callback(valueCheck))
local keyChecker = t.keys(keyCheck)
local valueChecker = t.values(valueCheck)
return function(value)
local keySuccess, keyErr = keyChecker(value)
if not keySuccess then
return false, keyErr or ""
end
local valueSuccess, valueErr = valueChecker(value)
if not valueSuccess then
return false, valueErr or ""
end
return true
end
end
|
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
TeamKill = false --- Enable TeamKill?
,TeamDamageMultiplier = 1 --- Between 0-1 | This will make you cause less damage if you hit your teammate
,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces...
,AntiBunnyHop = true --- Enable anti bunny hop system?
,JumpCoolDown = 3 --- Seconds before you can jump again
,JumpPower = 50 --- Jump power, default is 50
,RealisticLaser = false --- True = Laser line is invisible
,ReplicatedLaser = true
,ReplicatedFlashlight = true
,EnableRagdoll = true --- Enable ragdoll death?
,TeamTags = true --- Aaaaaaa
,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD |
--- Sets whether the command is in a valid state or not.
-- Cannot submit if in invalid state. |
function Window:SetIsValidInput(isValid, errorText)
Entry.TextBox.TextColor3 = isValid and Color3.fromRGB(255, 255, 255) or Color3.fromRGB(255, 73, 73)
self.Valid = isValid
self._errorText = errorText
end
|
--XxMegamanxX |
function onTouch(hit)
if hit.Parent:findFirstChild("Humanoid") ~= nil and hit.Parent:findFirstChild("Sling") == nil then
local suit = script.Parent.Parent["Sling"]:clone()
suit.Parent = hit.Parent
local G = suit:getChildren()
for i=1, #G do
if G[i].className == "Part" or "UnionOperation" or "MeshPart" then
local suitW = Instance.new("Weld")
suitW.Part0 = suit.MainPart
suitW.Part1 = G[i]
local autoW = CFrame.new(suit.MainPart.Position)
suitW.C0 = suit.MainPart.CFrame:inverse()*autoW
suitW.C1 = G[i].CFrame:inverse()*autoW
suitW.Parent = suit.MainPart
end
local bpW = Instance.new("Weld")
bpW.Part0 = hit.Parent["Torso"]
bpW.Part1 = suit.MainPart
bpW.C0 = CFrame.new(0, 0, 0)
bpW.Parent = suit.MainPart
end
local c = suit:getChildren()
for i=1, #c do
c[i].Anchored = false
c[i].CanCollide = false
end
end
end
script.Parent.Touched:connect(onTouch)
|
-- Was called OnMoveTouchEnded in previous version |
function DynamicThumbstick:OnInputEnded()
self.moveTouchObject = nil
self.moveVector = ZERO_VECTOR3
self:FadeThumbstick(false)
end
function DynamicThumbstick:FadeThumbstick(visible)
if not visible and self.moveTouchObject then
return
end
if self.isFirstTouch then return end
if self.startImageFadeTween then
self.startImageFadeTween:Cancel()
end
if self.endImageFadeTween then
self.endImageFadeTween:Cancel()
end
for i = 1, #self.middleImages do
if self. middleImageFadeTweens[i] then
self.middleImageFadeTweens[i]:Cancel()
end
end
if visible then
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0.2 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = MIDDLE_TRANSPARENCIES[i] })
self.middleImageFadeTweens[i]:Play()
end
else
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.middleImageFadeTweens[i]:Play()
end
end
end
function DynamicThumbstick:FadeThumbstickFrame(fadeDuration, fadeRatio)
self.fadeInAndOutHalfDuration = fadeDuration * 0.5
self.fadeInAndOutBalance = fadeRatio
self.tweenInAlphaStart = tick()
end
function DynamicThumbstick:InputInFrame(inputObject)
local frameCornerTopLeft = self.thumbstickFrame.AbsolutePosition
local frameCornerBottomRight = frameCornerTopLeft + self.thumbstickFrame.AbsoluteSize
local inputPosition = inputObject.Position
if inputPosition.X >= frameCornerTopLeft.X and inputPosition.Y >= frameCornerTopLeft.Y then
if inputPosition.X <= frameCornerBottomRight.X and inputPosition.Y <= frameCornerBottomRight.Y then
return true
end
end
return false
end
function DynamicThumbstick:DoFadeInBackground()
local playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
local hasFadedBackgroundInOrientation = false
-- only fade in/out the background once per orientation
if playerGui then
if playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInLandscape
self.hasFadedBackgroundInLandscape = true
elseif playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInPortrait
self.hasFadedBackgroundInPortrait = true
end
end
if not hasFadedBackgroundInOrientation then
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.tweenInAlphaStart = tick()
end
end
function DynamicThumbstick:DoMove(direction)
local currentMoveVector = direction
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < self.radiusOfDeadZone then
currentMoveVector = Vector3.new()
else
currentMoveVector = currentMoveVector.unit*(
1 - math.max(0, (self.radiusOfMaxSpeed - currentMoveVector.magnitude)/self.radiusOfMaxSpeed)
)
currentMoveVector = Vector3.new(currentMoveVector.x, 0, currentMoveVector.y)
end
self.moveVector = currentMoveVector
end
function DynamicThumbstick:LayoutMiddleImages(startPos, endPos)
local startDist = (self.thumbstickSize / 2) + self.middleSize
local vector = endPos - startPos
local distAvailable = vector.magnitude - (self.thumbstickRingSize / 2) - self.middleSize
local direction = vector.unit
local distNeeded = self.middleSpacing * NUM_MIDDLE_IMAGES
local spacing = self.middleSpacing
if distNeeded < distAvailable then
spacing = distAvailable / NUM_MIDDLE_IMAGES
end
for i = 1, NUM_MIDDLE_IMAGES do
local image = self.middleImages[i]
local distWithout = startDist + (spacing * (i - 2))
local currentDist = startDist + (spacing * (i - 1))
if distWithout < distAvailable then
local pos = endPos - direction * currentDist
local exposedFraction = math.clamp(1 - ((currentDist - distAvailable) / spacing), 0, 1)
image.Visible = true
image.Position = UDim2.new(0, pos.X, 0, pos.Y)
image.Size = UDim2.new(0, self.middleSize * exposedFraction, 0, self.middleSize * exposedFraction)
else
image.Visible = false
end
end
end
function DynamicThumbstick:MoveStick(pos)
local vector2StartPosition = Vector2.new(self.moveTouchStartPosition.X, self.moveTouchStartPosition.Y)
local startPos = vector2StartPosition - self.thumbstickFrame.AbsolutePosition
local endPos = Vector2.new(pos.X, pos.Y) - self.thumbstickFrame.AbsolutePosition
self.endImage.Position = UDim2.new(0, endPos.X, 0, endPos.Y)
self:LayoutMiddleImages(startPos, endPos)
end
function DynamicThumbstick:BindContextActions()
local function inputBegan(inputObject)
if self.moveTouchObject then
return Enum.ContextActionResult.Pass
end
if not self:InputInFrame(inputObject) then
return Enum.ContextActionResult.Pass
end
if self.isFirstTouch then
self.isFirstTouch = false
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0)
TweenService:Create(self.startImage, tweenInfo, {Size = UDim2.new(0, 0, 0, 0)}):Play()
TweenService:Create(
self.endImage,
tweenInfo,
{Size = UDim2.new(0, self.thumbstickSize, 0, self.thumbstickSize), ImageColor3 = Color3.new(0,0,0)}
):Play()
end
self.moveTouchLockedIn = false
self.moveTouchObject = inputObject
self.moveTouchStartPosition = inputObject.Position
self.moveTouchFirstChanged = true
if FADE_IN_OUT_BACKGROUND then
self:DoFadeInBackground()
end
return Enum.ContextActionResult.Pass
end
local function inputChanged(inputObject)
if inputObject == self.moveTouchObject then
if self.moveTouchFirstChanged then
self.moveTouchFirstChanged = false
local startPosVec2 = Vector2.new(
inputObject.Position.X - self.thumbstickFrame.AbsolutePosition.X,
inputObject.Position.Y - self.thumbstickFrame.AbsolutePosition.Y
)
self.startImage.Visible = true
self.startImage.Position = UDim2.new(0, startPosVec2.X, 0, startPosVec2.Y)
self.endImage.Visible = true
self.endImage.Position = self.startImage.Position
self:FadeThumbstick(true)
self:MoveStick(inputObject.Position)
end
self.moveTouchLockedIn = true
local direction = Vector2.new(
inputObject.Position.x - self.moveTouchStartPosition.x,
inputObject.Position.y - self.moveTouchStartPosition.y
)
if math.abs(direction.x) > 0 or math.abs(direction.y) > 0 then
self:DoMove(direction)
self:MoveStick(inputObject.Position)
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
local function inputEnded(inputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
if self.moveTouchLockedIn then
return Enum.ContextActionResult.Sink
end
end
return Enum.ContextActionResult.Pass
end
local function handleInput(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
return inputBegan(inputObject)
elseif inputState == Enum.UserInputState.Change then
return inputChanged(inputObject)
elseif inputState == Enum.UserInputState.End then
return inputEnded(inputObject)
elseif inputState == Enum.UserInputState.Cancel then
self:OnInputEnded()
end
end
ContextActionService:BindActionAtPriority(
DYNAMIC_THUMBSTICK_ACTION_NAME,
handleInput,
false,
DYNAMIC_THUMBSTICK_ACTION_PRIORITY,
Enum.UserInputType.Touch)
end
function DynamicThumbstick:Create(parentFrame)
if self.thumbstickFrame then
self.thumbstickFrame:Destroy()
self.thumbstickFrame = nil
if self.onRenderSteppedConn then
self.onRenderSteppedConn:Disconnect()
self.onRenderSteppedConn = nil
end
end
self.thumbstickSize = 45
self.thumbstickRingSize = 20
self.middleSize = 10
self.middleSpacing = self.middleSize + 4
self.radiusOfDeadZone = 2
self.radiusOfMaxSpeed = 20
local screenSize = parentFrame.AbsoluteSize
local isBigScreen = math.min(screenSize.x, screenSize.y) > 500
if isBigScreen then
self.thumbstickSize = self.thumbstickSize * 2
self.thumbstickRingSize = self.thumbstickRingSize * 2
self.middleSize = self.middleSize * 2
self.middleSpacing = self.middleSpacing * 2
self.radiusOfDeadZone = self.radiusOfDeadZone * 2
self.radiusOfMaxSpeed = self.radiusOfMaxSpeed * 2
end
local function layoutThumbstickFrame(portraitMode)
if portraitMode then
self.thumbstickFrame.Size = UDim2.new(1, 0, 0.4, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 0.6, 0)
else
self.thumbstickFrame.Size = UDim2.new(0.4, 0, 2/3, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 1/3, 0)
end
end
self.thumbstickFrame = Instance.new("Frame")
self.thumbstickFrame.BorderSizePixel = 0
self.thumbstickFrame.Name = "DynamicThumbstickFrame"
self.thumbstickFrame.Visible = false
self.thumbstickFrame.BackgroundTransparency = 1.0
self.thumbstickFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
self.thumbstickFrame.Active = false
layoutThumbstickFrame(false)
self.startImage = Instance.new("ImageLabel")
self.startImage.Name = "ThumbstickStart"
self.startImage.Visible = true
self.startImage.BackgroundTransparency = 1
self.startImage.Image = TOUCH_CONTROLS_SHEET
self.startImage.ImageRectOffset = Vector2.new(1,1)
self.startImage.ImageRectSize = Vector2.new(144, 144)
self.startImage.ImageColor3 = Color3.new(0, 0, 0)
self.startImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.startImage.Position = UDim2.new(0, self.thumbstickRingSize * 3.3, 1, -self.thumbstickRingSize * 2.8)
self.startImage.Size = UDim2.new(0, self.thumbstickRingSize * 3.7, 0, self.thumbstickRingSize * 3.7)
self.startImage.ZIndex = 10
self.startImage.Parent = self.thumbstickFrame
self.endImage = Instance.new("ImageLabel")
self.endImage.Name = "ThumbstickEnd"
self.endImage.Visible = true
self.endImage.BackgroundTransparency = 1
self.endImage.Image = TOUCH_CONTROLS_SHEET
self.endImage.ImageRectOffset = Vector2.new(1,1)
self.endImage.ImageRectSize = Vector2.new(144, 144)
self.endImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.endImage.Position = self.startImage.Position
self.endImage.Size = UDim2.new(0, self.thumbstickSize * 0.8, 0, self.thumbstickSize * 0.8)
self.endImage.ZIndex = 10
self.endImage.Parent = self.thumbstickFrame
for i = 1, NUM_MIDDLE_IMAGES do
self.middleImages[i] = Instance.new("ImageLabel")
self.middleImages[i].Name = "ThumbstickMiddle"
self.middleImages[i].Visible = false
self.middleImages[i].BackgroundTransparency = 1
self.middleImages[i].Image = TOUCH_CONTROLS_SHEET
self.middleImages[i].ImageRectOffset = Vector2.new(1,1)
self.middleImages[i].ImageRectSize = Vector2.new(144, 144)
self.middleImages[i].ImageTransparency = MIDDLE_TRANSPARENCIES[i]
self.middleImages[i].AnchorPoint = Vector2.new(0.5, 0.5)
self.middleImages[i].ZIndex = 9
self.middleImages[i].Parent = self.thumbstickFrame
end
local CameraChangedConn = nil
local function onCurrentCameraChanged()
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local function onViewportSizeChanged()
local size = newCamera.ViewportSize
local portraitMode = size.X < size.Y
layoutThumbstickFrame(portraitMode)
end
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(onViewportSizeChanged)
onViewportSizeChanged()
end
end
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
self.moveTouchStartPosition = nil
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
self.onRenderSteppedConn = RunService.RenderStepped:Connect(function()
if self.tweenInAlphaStart ~= nil then
local delta = tick() - self.tweenInAlphaStart
local fadeInTime = (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeInTime, 1)
if delta > fadeInTime then
self.tweenOutAlphaStart = tick()
self.tweenInAlphaStart = nil
end
elseif self.tweenOutAlphaStart ~= nil then
local delta = tick() - self.tweenOutAlphaStart
local fadeOutTime = (self.fadeInAndOutHalfDuration * 2) - (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA + FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeOutTime, 1)
if delta > fadeOutTime then
self.tweenOutAlphaStart = nil
end
end
end)
self.onTouchEndedConn = UserInputService.TouchEnded:connect(function(inputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if self.moveTouchObject then
self:OnInputEnded()
end
end)
local playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
while not playerGui do
Players.LocalPlayer.ChildAdded:wait()
playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
end
local playerGuiChangedConn = nil
local originalScreenOrientationWasLandscape = playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight
local function longShowBackground()
self.fadeInAndOutHalfDuration = 2.5
self.fadeInAndOutBalance = 0.05
self.tweenInAlphaStart = tick()
end
playerGuiChangedConn = playerGui.Changed:connect(function(prop)
if prop == "CurrentScreenOrientation" then
if (originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait) or
(not originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation ~= Enum.ScreenOrientation.Portrait) then
playerGuiChangedConn:disconnect()
longShowBackground()
if originalScreenOrientationWasLandscape then
self.hasFadedBackgroundInPortrait = true
else
self.hasFadedBackgroundInLandscape = true
end
end
end
end)
self.thumbstickFrame.Parent = parentFrame
spawn(function()
if game:IsLoaded() then
longShowBackground()
else
game.Loaded:wait()
longShowBackground()
end
end)
end
return DynamicThumbstick
|
--RustyBomb |
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
if player.RustyBomb.Value == 2 then
player.RustyBomb.Value = 1
end
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
if player.RustyBomb.Value == 2 then
player.RustyBomb.Value = 1
end
end) |
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean |
return function(val: any): boolean
return not not val and val ~= 0 and val ~= "" and not Number.isNaN(val)
end
|
--script |
script.Parent.MouseButton1Click:Connect(function()
if play then
GoodSound.Volume = 1.2 --volume from the music when it's on
play = false
script.Parent.Text = "Mute music" else --you can change the text from the button here between ""
GoodSound.Volume = 0 --volume from the music when it's off
play = true
script.Parent.Text = "Play music" --you can change the text from the button here between ""
end
end)
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local gui = script.Parent.Parent
local playergui = service.PlayerGui
local str = data.Message
local time = data.Time or 15
local log = {
Type = "Hint";
Title = "Hint";
Message = str;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}
table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsCenter:Fire(log)
--client.UI.Make("HintHolder")
local container = client.UI.Get("HintHolder",nil,true)
if not container then
local holder = service.New("ScreenGui")
local hTable = client.UI.Register(holder)
local frame = service.New("ScrollingFrame", holder)
client.UI.Prepare(holder)
hTable.Name = "HintHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(1, 0, 0,150)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
container = hTable
hTable:Ready()
end
container = container.Object.Frame
--// First things first account for notif :)
local notif = client.UI.Get("Notif")
local topbar = client.UI.Get("TopBar")
container.Position = UDim2.new(0,0,0,((notif and 30) or 0) + ((topbar and 40) or 0) - 35)
local children = container:GetChildren()
gui.Position = UDim2.new(0,0,0,-100)
gui.Frame.msg.Text = str
local bounds = gui.Frame.msg.TextBounds.X
local function moveGuis(m,ignore)
m = m or 0
local max = #container:GetChildren()
for i,v in pairs(container:GetChildren()) do
if v~=ignore then
local y = (i+m)*28
v.Position = UDim2.new(0,0,0,y)
if i~=max then v.Size = UDim2.new(1,0,0,28) end
end
end
end
local lom = -1
moveGuis(-1)
gui.Parent = container
if #container:GetChildren()>5 then lom = -2 end
UDim2.new(0,0,0,(#container:GetChildren()+lom)*28)
moveGuis(-1)
--gui:TweenPosition(UDim2.new(0,0,0,(#container:GetChildren()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)
if #container:GetChildren()>5 then
local gui = container:GetChildren()[1]
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
wait(data.Time or 5)
if gui and gui.Parent then
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
end
|
--[[ Services ]] | --
local PlayersService = game:GetService('Players')
local VRService = game:GetService("VRService")
local Util = require(script.Parent:WaitForChild("CameraUtils"))
|
-- l__Humanoid__9.WalkSpeed = u2 + tonumber(u1); |
end;
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoost"):Connect(v3.updatespeed);
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoostExtra"):Connect(v3.updatespeed);
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoostBehind"):Connect(v3.updatespeed);
v3.updatespeed();
l__UserInputService__7.InputBegan:connect(function(p2, p3)
if p2.UserInputType == Enum.UserInputType.MouseButton2 then
end;
if p3 == true then
return;
end;
if p2.KeyCode == Enum.KeyCode.C or p2.KeyCode == Enum.KeyCode.ButtonB or p2.KeyCode == Enum.KeyCode.LeftControl or p2.KeyCode == Enum.KeyCode.LeftShift then
v3.crouch();
end;
end);
l__UserInputService__7.InputEnded:connect(function(p4)
if p4.KeyCode == Enum.KeyCode.Space then
v2.holdjump = false;
end;
if p4.UserInputType == Enum.UserInputType.MouseButton2 then
-- nil
end;
end);
function v3.titlelocation(p1)
coroutine.wrap(function()
local v6 = l__Parent__1.MainFrame.Intro:Clone();
if l__Parent__1.MainFrame:FindFirstChild("LiveIntro") then
l__Parent__1.MainFrame:FindFirstChild("LiveIntro"):Destroy();
end;
local v7 = game:GetService("ReplicatedStorage").Sounds:FindFirstChild("LA_" .. p1);
if v7 then
v7:Play();
end;
v6.Name = "LiveIntro";
v6.Visible = true;
v6.Text = p1;
v6.Parent = l__Parent__1.MainFrame;
l__TweenService__2:Create(v6, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 0,
TextStrokeTransparency = 1
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
Size = UDim2.new(0.5, 0, 0, 6)
}):Play();
wait(1);
l__TweenService__2:Create(v6, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
Size = UDim2.new(0.25, 0, 0, 6),
ImageTransparency = 1
}):Play();
game.Debris:AddItem(v6, 10);
end)();
end;
local u3 = {};
local u4 = 0;
function v3.remind(p2, p3)
coroutine.wrap(function()
if table.find(u3, p2) ~= nil then
return;
end;
table.insert(u3, p2);
if u4 >= 1 then
u4 = u4 + 1;
wait((u4 - 1) * 6);
end;
u4 = u4 + 1;
local v8 = l__Parent__1.MainFrame.Tip:Clone();
if p3 == true then
v8 = l__Parent__1.MainFrame.Warning:Clone();
end;
v8.Name = "LiveTip";
v8.Visible = true;
v8.Text = p2;
v8.Parent = l__Parent__1.MainFrame;
l__TweenService__2:Create(v8, TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.9, 0)
}):Play();
l__TweenService__2:Create(v8.Glow, TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true), {
Size = UDim2.new(2, 0, 10, 0),
ImageTransparency = 0
}):Play();
wait(6);
l__TweenService__2:Create(v8, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {
TextTransparency = 1,
TextStrokeTransparency = 1
}):Play();
game.Debris:AddItem(v8, 10);
u4 = u4 - 1;
end)();
end;
function v3.caption(p4, p5, p6)
local u5 = p6;
coroutine.wrap(function()
local v9 = l__Parent__1.MainFrame.Caption:Clone();
if l__Parent__1:FindFirstChild("LiveCaption") then
l__Parent__1:FindFirstChild("LiveCaption"):Destroy();
end;
if p5 == true then
v9 = l__Parent__1.MainFrame.Caption:Clone();
end;
v9.Name = "LiveCaption";
v9.Visible = true;
v9.Text = p4;
v9.Parent = l__Parent__1;
if not u5 then
u5 = 7;
end;
l__TweenService__2:Create(v9, TweenInfo.new(u5, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v9, TweenInfo.new(1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
BackgroundColor3 = Color3.new(0, 0, 0)
}):Play();
script.Caption:Play();
game.Debris:AddItem(v9, 10);
end)();
end;
return v3;
|
--if the path is followable/reachable |
if path.Status.Value<3 then
for _,v in ipairs(path:GetPointCoordinates()) do
humanoid:MoveTo(v);
local distance=0;
repeat
distance=TD and (Vector2.new(v.x,v.z)-Vector2.new(torso.Position.x,torso.Position.z)).magnitude or (v-torso.Position).magnitude;
Wait();
until distance<2
end
end
end
|
-- Variables |
local plr = playerService.LocalPlayer
script.Parent.MouseButton1Click:Connect(function ()
marketplaceService:PromptPurchase(plr, 400812710) -- Prompts the user to get Realism Mod on click
end)
|
-- Public Constructors |
function RotatedRegion3.new(cframe, size)
local self = setmetatable({}, RotatedRegion3)
local set = Vertices.Block(cframe, size/2)
self.CFrame = cframe
self.Size = size
self.Shape = "Block"
self.Set = set
self.Support = Supports.PointCloud
self.Centroid = cframe.p
self.AlignedRegion3 = Region3.new(worldBoundingBox(set))
return self
end
RotatedRegion3.Block = RotatedRegion3.new
function RotatedRegion3.Wedge(cframe, size)
local self = setmetatable({}, RotatedRegion3)
local set = Vertices.Block(cframe, size/2)
self.CFrame = cframe
self.Size = size
self.Shape = "Wedge"
self.Set = Vertices.Wedge(cframe, size/2)
self.Support = Supports.PointCloud
self.Centroid = Vertices.GetCentroid(self.Set)
self.AlignedRegion3 = Region3.new(worldBoundingBox(set))
return self
end
function RotatedRegion3.CornerWedge(cframe, size)
local self = setmetatable({}, RotatedRegion3)
local set = Vertices.Block(cframe, size/2)
self.CFrame = cframe
self.Size = size
self.Shape = "CornerWedge"
self.Set = Vertices.CornerWedge(cframe, size/2)
self.Support = Supports.PointCloud
self.Centroid = Vertices.GetCentroid(self.Set)
self.AlignedRegion3 = Region3.new(worldBoundingBox(set))
return self
end
function RotatedRegion3.Cylinder(cframe, size)
local self = setmetatable({}, RotatedRegion3)
local set = Vertices.Block(cframe, size/2)
self.CFrame = cframe
self.Size = size
self.Shape = "Cylinder"
self.Set = {cframe, size/2}
self.Support = Supports.Cylinder
self.Centroid = cframe.p
self.AlignedRegion3 = Region3.new(worldBoundingBox(set))
return self
end
function RotatedRegion3.Ball(cframe, size)
local self = setmetatable({}, RotatedRegion3)
local set = Vertices.Block(cframe, size/2)
self.CFrame = cframe
self.Size = size
self.Shape = "Ball"
self.Set = {cframe, size/2}
self.Support = Supports.Ellipsoid
self.Centroid = cframe.p
self.AlignedRegion3 = Region3.new(worldBoundingBox(set))
return self
end
function RotatedRegion3.FromPart(part)
return RotatedRegion3[Vertices.Classify(part)](part.CFrame, part.Size)
end
|
--[[if script.Parent.Parent.Values.Win.Value == true then
script.Parent.Parent.Sound.Win:Play()
script.Parent.Parent.Sound.Idle:Stop()
script.Parent.Parent.WINNER.Disabled = false
end]] |
script.Parent.Parent.Configuration.GameOn.Value = false
script.Parent.Parent.MainScript.Disabled = false
script.Disabled = true
end
script.Parent.Parent.Sensortwo.Touched:Connect(onTouched)
|
--// bolekinds |
local Time = game:GetService("Lighting")
local Bandit = game.ServerStorage.Bandit
local BanditSpawns = workspace.BanditSpawns
local con
local mailboxcon
game.Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if game.Lighting.ClockTime == 7 then
local randomNum = math.random(1, 10)
local banditRaid = false
if randomNum >= 5 then
banditRaid = true
end
game.ServerStorage.ServerData.Age.Value += 1
game.ServerStorage.ServerData.Day.Value += 1
if mailboxcon then
mailboxcon:Disconnect()
end
if game.ServerStorage.ServerData.Day.Value >= 5 then
if game.ServerStorage.ServerData.HasKeys.Value == false then
workspace.Door.Knock:Play()
workspace.Door.Sparkles.Enabled = true
workspace.Door.ProximityPrompt.Enabled = true
con = workspace.Door.ProximityPrompt.Triggered:Connect(function(plr)
game.ServerStorage.key:Clone().Parent = plr.PlayerGui
workspace.Door.Knock:Stop()
workspace.Door.Sparkles.Enabled = false
workspace.Door.ProximityPrompt.Enabled = false
con:Disconnect()
end)
end
end
if game.ServerStorage.ServerData.HasKeys.Value == true then
if banditRaid == true then
workspace.Sound3:Play()
game.ReplicatedStorage.Bandit:FireAllClients()
repeat
task.wait(2.5)
local bandit = game.ServerStorage.Bandit:Clone()
bandit.HumanoidRootPart.CFrame = BanditSpawns:GetChildren()[math.random(1, #BanditSpawns:GetChildren())].CFrame + Vector3.new(0,10,0)
bandit.Parent = workspace.AttackableNPCS
until workspace.Sound3.Playing == false
for i, v in ipairs(workspace.AttackableNPCS:GetChildren()) do
v:Destroy()
end
for i, v in ipairs(workspace.FloppaBlocker.bandits:GetChildren()) do
v:Destroy()
end
game.ReplicatedStorage.Bandit2:FireAllClients()
workspace.Sound3:Stop()
workspace.Sound:Play()
end
workspace.Mailbox.Main.Sparkles.Enabled = true
workspace.Mailbox.Main.ProximityPrompt.Enabled = true
mailboxcon = workspace.Mailbox.Main.ProximityPrompt.Triggered:Connect(function(plr)
workspace.Mailbox.Main.Sparkles.Enabled = false
workspace.Mailbox.Main.ProximityPrompt.Enabled = false
local c = game.ServerStorage.mailboxthings:GetChildren()[math.random(1,#game.ServerStorage.mailboxthings:GetChildren())]:Clone()
c.Parent = plr.PlayerGui
mailboxcon:Disconnect()
mailboxcon = nil
end)
end
game.ServerStorage.TempData.CanGiveRent.Value = true
workspace.Roommate.Head.Dialog["Gimme rent"].ResponseDialog = "Alright"
end
end)
while true do
task.wait(0.05)
Time:SetMinutesAfterMidnight(Time:GetMinutesAfterMidnight()+0.5)
end
|
-- Gather advanced timing metrics for Profiler subtrees. |
exports.enableProfilerTimer = _G.__PROFILE__
|
--Dia 1 reward |
DailyRewardEvents.Reward1.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed1 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
DailyRewardEvents.Reward2.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed2 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
DailyRewardEvents.Reward3.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed3 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
DailyRewardEvents.Reward4.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed4 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
DailyRewardEvents.Reward5.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed5 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
DailyRewardEvents.Reward6.OnServerEvent:Connect(function(player, Quantity)
--script
local Claimed = player.PlayerConfiguration.LoginState.Claimed6 --Cambiar claimed
Claimed.Value = true
local GamepassPointsMultiplier = player.PlayerConfiguration.PlayerMultipliers.PointsMultiplier
local PlayerMultiplier = player.DataFolder.Multiplier
player.DataFolder.Points.Value += (Quantity*GamepassPointsMultiplier.Value*PlayerMultiplier.Value)+(Quantity*GamepassPointsMultiplier.Value) --Reward
Message.RewardClaimed:FireClient(player)
end)
|
------------------------------------------------------------------------------------------------------------------------- |
model = script.Parent.Parent.Parent.Drop --This is the MODELNAME. you made a desk in the instructions SO name the part called MODELNAME to "Desk". Then change price to what you want.
Upgradecost = 0 -- Replace The Price You Want Where It Says 100 |
--To make the dummy stay in the same place, so the player can't push the npc around |
local HumanoidPosition = script.Parent.Parent.Position
script.Parent.Position = HumanoidPosition
|
-- |
function Raycast.FindPartOnRayWithCallbackWithIgnoreList(ray, list, terrainCellsAreCubes, ignoreWater, loopout, callbackFunc)
local maxDistance = ray.Direction.Magnitude
local direction = ray.Direction.Unit
loopout = loopout or 25
local loopCount = 0
local lastPosition = ray.Origin
local distance = 0
local hit, position, normal, material
repeat
local r = Ray.new(lastPosition, direction * (maxDistance - distance))
hit, position, normal, material = WORKSPACE:FindPartOnRayWithIgnoreList(ray, list, terrainCellsAreCubes, ignoreWater, true)
local result = callbackFunc(hit, position, normal, material)
if (result == CALLBACKRESULT.Continue) then
distance = (ray.Origin - position).Magnitude
lastPosition = position
elseif (result == CALLBACKRESULT.Finished) then
return hit, position, normal, material
elseif (result == CALLBACKRESULT.Fail or result == nil) then
break
end
loopCount = loopCount + 1
until (loopCount > loopout or distance >= maxDistance - 0.1)
return
end
function Raycast.FindPartOnRayWithCallbackWithWhiteList(ray, list, terrainCellsAreCubes, ignoreWater, callbackFunc)
local maxDistance = ray.Direction.Magnitude
local direction = ray.Direction.Unit
local lastPosition = ray.Origin
local distance = 0
local hit, position, normal, material
repeat
local r = Ray.new(lastPosition, direction * (maxDistance - distance))
hit, position, normal, material = WORKSPACE:FindPartOnRayWithWhiteList(ray, list, terrainCellsAreCubes, ignoreWater, true)
local result = callbackFunc(hit, position, normal, material)
if (result == CALLBACKRESULT.Continue) then
distance = (ray.Origin - position).Magnitude
lastPosition = position
elseif (result == CALLBACKRESULT.Finished) then
return hit, position, normal, material
elseif (result == CALLBACKRESULT.Fail or result == nil) then
break
end
until (distance >= maxDistance - 0.1)
return
end
function Raycast.FindPartOnRayWithCallback(ray, ignore, terrainCellsAreCubes, ignoreWater, callbackFunc)
return Raycast.FindPartOnRayWithCallbackWithIgnoreList(ray, {ignore}, terrainCellsAreCubes, ignoreWater, callbackFunc)
end
|
--[[
Sets the velocity of the internal springs, overwriting the existing velocity
of this Spring. This doesn't affect position.
If the type doesn't match the current type of the spring, an error will be
thrown.
]] |
function class:setVelocity(newValue: PubTypes.Animatable)
local newType = typeof(newValue)
if newType ~= self._currentType then
logError("springTypeMismatch", nil, newType, self._currentType)
end
self._springVelocities = unpackType(newValue, newType)
SpringScheduler.add(self)
end
|
--Update text |
text.Text = "HP: "..math.floor(char:WaitForChild("Humanoid").Health).."/"..char:WaitForChild("Humanoid").MaxHealth |
-- Public Functions |
function CubicSpline:AtTime(t)
local n = #self.Points
local ct = math.clamp(t, 0, n)
local floor = math.floor(ct)
local ft = ct - floor
local spline = (floor % (n - 1)) + 1
local a, b, c, d = unpack(self.Coefficients)
return a[spline] + b[spline]*ft + c[spline]*ft*ft + d[spline]*ft*ft*ft
end
function CubicSpline:AtPercentage(p)
local t = p * self.TotalLength
local lengths = self.Lengths
if (p >= 1) then
return self.Points[#self.Points]
end
local spline = 1
while (t > lengths[spline]) do
t = t - lengths[spline]
spline = spline + 1
end
local s = t / lengths[spline]
for i = 1, NEWTON_N do
s = s - (integrate(self, spline, s) - t) / arcLengthIntegrand(self, spline, s)
end
return self:AtTime((spline - 1) + s)
end
|
--[[ Use Example
local countdownTimersModule = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientCountdownModule"))
local localPlayer = game:GetService("Players").LocalPlayer
local countdownTimerGUI = localPlayer:WaitForChild("PlayerGui"):WaitForChild("CountdownTimerGUI")
local bubbleTimerUI = countdownTimerGUI:WaitForChild("TopFrameUI"):WaitForChild("TimerBubbleUI")
local boardTimerUI = workspace
:WaitForChild("CountdownBoardPart")
:WaitForChild("SurfaceGui")
:WaitForChild("TimerScreenUI")
function clientTimerReachedFunc()
print("Timer Reached!!")
end
local timer = countdownTimersModule:AddTimer({
Enabled = true,
UniversalEventDate = DateTime.fromUniversalTime(2022, 4, 28, 14, 30, 0, 0), -- UTC (year, month, day, hour, minute)
BubbleTimerUI = bubbleTimerUI,
BoardTimerUI = boardTimerUI,
AutomaticallyDisableAfter = 10, -- Seconds after the event date in which the timer will disable itself.
DisableBubbleWhenBoardVisible = true,
TimerReachedFunction = clientTimerReachedFunc,
ReadableBoardDistance = 100,
})
-- Just example code for controlling the Enabled state
timer.Enabled = false
wait(2)
timer.Enabled = true
]] |
local countdownTimersList = {}
local tweenService = game:GetService("TweenService")
local secondsPerMinute = 60
local secondsPerHour = secondsPerMinute * 60
local secondsPerDay = secondsPerHour * 24
function updateTimerUI(timerUI, timeUntil)
if timerUI and timerUI.Parent and timerUI.Visible then
-- Verify children exist
local fullTimerFrame = timerUI:FindFirstChild("FullTimerFrame")
local simpleTimerFrame = timerUI:FindFirstChild("SimpleTimerFrame")
if not fullTimerFrame or not simpleTimerFrame then
warn("Could not find FullTimerFrame or SimpleTimerFrame")
return
end
local simpleTimerTextLabel = simpleTimerFrame:FindFirstChild("SimpleTextLabel")
if not simpleTimerTextLabel then
warn("Could not find SimpleTimerFrame.TextLabel")
end
local firstPairTextLabel = fullTimerFrame:FindFirstChild("FirstPairTextLabel")
local secondPairTextLabel = fullTimerFrame:FindFirstChild("SecondPairTextLabel")
local thirdPairTextLabel = fullTimerFrame:FindFirstChild("ThirdPairTextLabel")
if not firstPairTextLabel or not secondPairTextLabel or not thirdPairTextLabel then
warn("Could not find FirstPairTextLabel or SecondPairTextLabel or ThirdPairTextLabel")
end
local firstSubTextLabel = firstPairTextLabel:FindFirstChild("SubText")
local secondSubTextLabel = secondPairTextLabel:FindFirstChild("SubText")
local thirdSubTextLabel = thirdPairTextLabel:FindFirstChild("SubText")
if not firstSubTextLabel or not secondSubTextLabel or not thirdSubTextLabel then
warn(
"Could not find a 'SubText' TextLabel for either FirstPairTextLabel, SecondPairTextLabel, or ThirdPairTextLabel"
)
end
local days = math.floor(timeUntil / secondsPerDay)
local remaining = timeUntil - (days * secondsPerDay)
local hours = math.floor(remaining / secondsPerHour)
remaining = remaining - (hours * secondsPerHour)
local minutes = math.floor(remaining / secondsPerMinute)
remaining = remaining - (minutes * secondsPerMinute)
local seconds = math.floor(remaining)
local shouldBeMini = false
if days > 0 then
-- Full counter with days
fullTimerFrame.Visible = true
simpleTimerFrame.Visible = false
firstPairTextLabel.Text = string.format("%02i", days)
firstSubTextLabel.Text = "DAY"
secondPairTextLabel.Text = string.format("%02i", hours)
secondSubTextLabel.Text = "HOUR"
thirdPairTextLabel.Text = string.format("%02i", minutes)
thirdSubTextLabel.Text = "MIN"
elseif timeUntil > 10 then
-- Full Counter with hours
fullTimerFrame.Visible = true
simpleTimerFrame.Visible = false
firstPairTextLabel.Text = string.format("%02i", hours)
firstSubTextLabel.Text = "HOUR"
secondPairTextLabel.Text = string.format("%02i", minutes)
secondSubTextLabel.Text = "MIN"
thirdPairTextLabel.Text = string.format("%02i", seconds)
thirdSubTextLabel.Text = "SEC"
elseif timeUntil > 0 then
-- Final Countdown from 10 seconds
fullTimerFrame.Visible = false
simpleTimerFrame.Visible = true
simpleTimerTextLabel.Text = string.format("%01i", seconds)
if timerUI.Name == "TimerBubbleUI" then
simpleTimerTextLabel.TextScaled = false
shouldBeMini = true
end
if timerUI:GetAttribute("LastSecond") ~= seconds then
timerUI:SetAttribute("LastSecond", seconds)
-- Pulse the countdown
local pulse = simpleTimerTextLabel:clone()
pulse.Name = pulse.Name .. "Pulse"
local pulseUIScale = Instance.new("UIScale")
pulseUIScale.Parent = pulse
pulse.Parent = simpleTimerFrame
tweenService:Create(
pulse,
TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{ TextTransparency = 1 }
):Play()
tweenService:Create(
pulseUIScale,
TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{ Scale = 3 }
):Play()
task.delay(1, function()
if pulse then
pulse:Destroy()
end
end)
end
else
-- Starting now or time has passed
fullTimerFrame.Visible = false
simpleTimerFrame.Visible = true
simpleTimerTextLabel.Text = "Starting Now..."
simpleTimerTextLabel.TextScaled = true
end
if timerUI.Name == "TimerBubbleUI" then
if shouldBeMini then
timerUI.Size = UDim2.new(0, 110, 1, 0)
else
timerUI.Size = UDim2.new(0, 200, 1, 0)
end
end
if timerUI.Name == "TimerScreenUI" then
local startingInTextLabel = timerUI:FindFirstChild("StartingInTextLabel")
if startingInTextLabel then
startingInTextLabel.Visible = timeUntil > 0
end
end
end
end
function findSurfaceGui(subject) -- Will go up the parent graph looking for a surface gui and the part it is attached to.
if subject and subject.Parent then
if subject:IsA("SurfaceGui") then
return subject
else
return findSurfaceGui(subject.Parent)
end
else
warn("Could not find an anscestor surfaceGui for BoardTimerUI.")
end
end
function updateTimerVisuals(timer)
local timeUntil = timer.UniversalEventDate.UnixTimestampMillis / 1000 - workspace:GetServerTimeNow()
-- Fire TimerReachedFunction if necessary
if timeUntil > 0 then
timer.PrimedTimerReached = true
elseif timer.PrimedTimerReached then
timer.PrimedTimerReached = false
if typeof(timer.TimerReachedFunction) == "function" then
timer.TimerReachedFunction()
end
end
if timer.AutomaticallyDisableAfter and timeUntil * -1 > timer.AutomaticallyDisableAfter then
timer.Enabled = false
end
if timer.BubbleTimerUI then
local shouldBeVisible = true
-- Check to see if we should hide the bubbleTimerUi because the board is reasonably visible
if timer.Enabled and timer.DisableBubbleWhenBoardVisible and timer.BoardTimerUI then
local surfaceGui = findSurfaceGui(timer.BoardTimerUI)
if surfaceGui then
local boardPart = surfaceGui.Adornee or surfaceGui.Parent
if boardPart and boardPart:IsA("BasePart") then
-- Check to make sure board is close enough to read
local camera = workspace.CurrentCamera
local boardCameraDistance = (boardPart.Position - camera.CFrame.Position).magnitude
if boardCameraDistance <= timer.ReadableBoardDistance then
-- Check if board is facing player
local surfaceVector = boardPart.CFrame:VectorToWorldSpace(Vector3.FromNormalId(surfaceGui.Face))
local cameraDirectionMatch = surfaceVector:Dot(camera.CFrame.LookVector)
if cameraDirectionMatch < -0.5 then
-- Check if the board is on screen
local worldPoint = boardPart.Position
local _, onScreen = camera:WorldToScreenPoint(worldPoint)
if onScreen then
shouldBeVisible = false
end
end
end
end
end
end
timer.BubbleTimerUI.Visible = timer.Enabled and shouldBeVisible
end
if timer.BoardTimerUI then
timer.BoardTimerUI.Visible = timer.Enabled
end
if timer.Enabled then
updateTimerUI(timer.BubbleTimerUI, timeUntil)
updateTimerUI(timer.BoardTimerUI, timeUntil)
end
end
function updateTimers()
for _, timer in pairs(countdownTimersList) do
updateTimerVisuals(timer)
end
end
local heartbeatConn = nil
local timerMetatable = {
Enabled = true,
UniversalEventDate = DateTime.fromUniversalTime(2025, 1, 1, 0, 0, 0, 0),
ReadableBoardDistance = 120,
}
timerMetatable.__index = timerMetatable
local countdownTimersModule = {}
function countdownTimersModule:AddTimer(timerPropertiesTable)
local timer = setmetatable(self, timerMetatable)
for property, value in pairs(timerPropertiesTable) do
timer[property] = value
end
table.insert(countdownTimersList, timer)
if not heartbeatConn then
heartbeatConn = game:GetService("RunService").Heartbeat:Connect(updateTimers)
end
return timer
end
function countdownTimersModule:RemoveTimer(timer)
local timerIndex = table.find(countdownTimersList, timer)
if timerIndex then
updateTimerVisuals(timer)
table.remove(countdownTimersList, timerIndex)
if #countdownTimersList <= 0 and heartbeatConn then
heartbeatConn:Disconnect()
heartbeatConn = nil
end
return true
else
warn("Unable to remove timer because it was not found.")
end
end
function countdownTimersModule:GetTimers()
local newList = {}
for i, v in ipairs(countdownTimersList) do
newList[i] = v
end
return newList
end
return countdownTimersModule
|
--[[ Initialization/Setup ]] | --
local function createTouchGuiContainer()
if TouchGui then TouchGui:Destroy() end
-- Container for all touch device guis
TouchGui = Instance.new('ScreenGui')
TouchGui.Name = "TouchGui"
TouchGui.Parent = PlayerGui
TouchControlFrame = Instance.new('Frame')
TouchControlFrame.Name = "TouchControlFrame"
TouchControlFrame.Size = UDim2.new(1, 0, 1, 0)
TouchControlFrame.BackgroundTransparency = 1
TouchControlFrame.Parent = TouchGui
end
|
-- Global Pet Float |
local maxFloat = .75
local floatInc = 0.035
local sw = false
local fl = 0
spawn(function()
while true do
wait()
if not sw then
fl = fl + floatInc
if fl >= maxFloat then
sw = true
end
else
fl = fl - floatInc
if fl <=-maxFloat then
sw = false
end
end
script.Parent.globalPetFloat.Value = fl
end
end) |
--Alarm Light--
-- Proximity Prompts in the Deposit Box-- |
local depositpr1 = script.Parent.DepositBoxDoor1.Attachment.ProximityPrompt |
--[[for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.ZIndex = 4
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(0.862745, 0.0784314, 0.235294)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.ZIndex = 2
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end]] |
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0.95, 0,1, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0.95, 0,1, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 43 + 215 * math.min(1,script.Parent.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Parent.Values.Gear.Value
if gearText >= 1 then script.Parent.GearImage.ImageColor3 = Color3.new(0, 1, 0.4)
elseif gearText == -1 then script.Parent.GearImage.ImageColor3 = Color3.new(1, 1, 1)
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Parent.Values.Gear.Value
if gearText >= 1 then script.Parent.Gear.TextColor3 = Color3.new(0, 1, 0.4)
elseif gearText == -1 then script.Parent.Gear.TextColor3 = Color3.new(1, 1, 1)
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Tach.Needle.Changed:Connect(function()
if script.Parent.Tach.Needle.Rotation >= 235 then
script.Parent.GearImage.ImageColor3 = Color3.new(1, 0.16, 0.16)
script.Parent.Gear.TextColor3 = Color3.new(1, 0.16, 0.16)
elseif script.Parent.Tach.Needle.Rotation < 220 then
script.Parent.GearImage.ImageColor3 = script.Parent.GearImage.ImageColor3
script.Parent.Gear.TextColor3 = script.Parent.Gear.TextColor3
end
end)
function Speed()
local SpeedVal = script.Parent.Parent.Parent.Values.Velocity.Value.Magnitude
local MPHScale = (10/12) * (60/88)
local KPHScale = (10/12) * 1.09728
if SpeedType == "MPH" then
if SpeedVal*MPHScale < 100 then
if SpeedVal*MPHScale < 10 then
script.Parent.Speed.Text = "00"..math.floor(SpeedVal*MPHScale)
else
script.Parent.Speed.Text = "0"..math.floor(SpeedVal*MPHScale)
end
else
script.Parent.Speed.Text = math.floor(SpeedVal*MPHScale)
end
end
end
script.Parent.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 215 * math.min(1,script.Parent.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Parent.Values.Velocity.Changed:connect(function()
Speed()
end)
wait(.1)
Speed()
|
-- A simple function to explode a specified part |
function Explode(part)
local explosion = Instance.new("Explosion", workspace)
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.Position = part.Position
explosion.BlastRadius = config.ExplosionRadius.Value
part:Destroy()
script.Parent:remove()
end
script.Parent.Throw.OnServerEvent:connect(function(player, mousePosition)
local handlePos = Vector3.new(tool.Handle.Position.X, 0, tool.Handle.Position.Z) -- remove Y from the equation, it's not needed
local mousePos = Vector3.new(mousePosition.X, 0, mousePosition.Z) -- ditto
local distance = (handlePos - mousePos).magnitude -- Get the distance between the handle and the mouse
local altitude = mousePosition.Y - tool.Handle.Position.Y
local angle = AngleOfReach(distance, altitude, config.GrenadeVelocity.Value) -- Calculate the angle
tool.Handle.Transparency = 1
local grenade = tool.Handle:Clone()
grenade.Parent = workspace
grenade.Transparency = 1
grenade.CanCollide = true
grenade.CFrame = tool.Handle.CFrame
grenade.Velocity = (CFrame.new(grenade.Position, Vector3.new(mousePosition.X, grenade.Position.Y, mousePosition.Z)) * CFrame.Angles(angle, 0, 0)).lookVector * config.GrenadeVelocity.Value -- Throwing 'n stuff, it probably didn't need to be this long
spawn(function()
if config.ExplodeOnTouch.Value then
grenade.Touched:connect(function(hit)
if hit.Parent ~= tool.Parent and hit.CanCollide then -- Make sure what we're hitting is collidable
Explode(grenade)
end
end)
else
wait(config.FuseTime.Value)
Explode(grenade)
end
end)
wait(config.Cooldown.Value)
tool.Handle.Transparency = 1
end)
|
-- Whether to allow building outside of private areas |
Security.AllowPublicBuilding = true;
|
--[[
Races a set of Promises and returns the first one that resolves,
cancelling the others.
]] |
function Promise.race(promises)
assert(type(promises) == "table", string.format(ERROR_NON_LIST, "Promise.race"))
for i, promise in pairs(promises) do
assert(Promise.is(promise), string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.race", tostring(i)))
end
return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
local newPromises = {}
local finished = false
local function cancel()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end
local function finalize(callback)
return function (...)
cancel()
finished = true
return callback(...)
end
end
if onCancel(finalize(reject)) then
return
end
for i, promise in ipairs(promises) do
newPromises[i] = promise:andThen(finalize(resolve), finalize(reject))
end
if finished then
cancel()
end
end)
end
|
--[[Front]] | --
Tune.FTireProfile = 2 -- Tire profile, aggressive or smooth
Tune.FProfileHeight = .4 -- Profile height, conforming to tire
Tune.FTireCompound = 1 -- The more compounds you have, the harder your tire will get towards the middle, sacrificing grip for wear
Tune.FTireFriction = 1 -- Your tire's friction in the best conditions.
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 350 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 9000 -- Use sliders to manipulate values
Tune.Redline = 11000
Tune.EqPoint = 5000
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)
|
--[[
OUTLINE:
Abilities Needed:
- Pathfinding
- Picking up Tools
- Straffing*
--]] | |
--[=[
@within TableUtil
@function Lock
@param tbl table
@return table
Locks the table using `table.freeze`, as well as any
nested tables within the given table. This will lock
the whole deep structure of the table, disallowing any
further modifications.
```lua
local tbl = {xyz = {abc = 32}}
tbl.xyz.abc = 28 -- Works fine
TableUtil.Lock(tbl)
tbl.xyz.abc = 64 -- Will throw an error (cannot modify readonly table)
```
]=] |
local function Lock<T>(tbl: T): T
local function Freeze(t: { [any]: any })
for k, v in pairs(t) do
if type(v) == "table" then
t[k] = Freeze(v)
end
end
return table.freeze(t)
end
return Freeze(tbl :: any)
end
|
--/Sight |
module.SightZoom = 0 -- Set to 0 if you want to use weapon's default zoom
module.SightZoom2 = 0 -- Set this to alternative zoom or Aimpart2 Zoom
|
-- ROBLOX deviation START: binding support |
type ReactBinding<T> = ReactTypes.ReactBinding<T>
type ReactBindingUpdater<T> = ReactTypes.ReactBindingUpdater<T> |
-- Local Functions |
local function awardBadge(player, badgeId)
-- Fetch badge information
local success, badgeInfo = pcall(function()
return BadgeService:GetBadgeInfoAsync(badgeId)
end)
if success then
-- Confirm that badge can be awarded
if badgeInfo.IsEnabled then
-- Award badge
local awarded, errorMessage = pcall(function()
BadgeService:AwardBadge(player.UserId, badgeId)
return true
end)
if not awarded then
warn("Error while awarding badge:", errorMessage)
return false
end
end
else
warn("Error while fetching badge info!")
return false
end
end
local function handleCodeRedemption(player, code)
-- Check if code is valid
local foundIndex = false
for codeIndex, badgeId in ipairs (GameSettings.codes) do
if codeIndex == code then
foundIndex = codeIndex
end
end
if not foundIndex then
RedeemCode:FireClient(player, "Invalid code!")
return
end
-- Player has redeemed code, can't redeem again
if DataStore:HasRedeemedCode(player, code) then
RedeemCode:FireClient(player, "Code already redeemed!")
return
end
local redeemed = DataStore:RedeemCode(player, GameSettings.codes[foundIndex])
if redeemed then
-- Give prize based on code
if awardBadge(player, GameSettings.codes[foundIndex]) then
-- Tell client that code has been redeemed
RedeemCode:FireClient(player, "Successfully redeemed!")
end
end
-- Tell client that code has been redeemed
RedeemCode:FireClient(player, "Error redeeming code!")
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
local toolAnimName = ""
local toolAnimTrack = nil
local toolAnimInstance = nil
local currentToolAnimKeyframeHandler = nil
function toolKeyFrameReachedFunc(frameName)
if (frameName == "End") then
playToolAnimation(toolAnimName, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid, priority)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
if (toolAnimInstance ~= anim) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
if priority then
toolAnimTrack.Priority = priority
end
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
toolAnimInstance = anim
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if (currentToolAnimKeyframeHandler ~= nil) then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
toolAnimInstance = nil
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
-------------------------------------------------------------------------------- |
local function queryPoint(origin, unitDir, dist, lastPos)
debug.profilebegin("queryPoint")
local originalSize = #blacklist
dist = dist + nearPlaneZ
local target = origin + unitDir*dist
local softLimit = inf
local hardLimit = inf
local movingOrigin = origin
repeat
local entryPart, entryPos = workspace:FindPartOnRayWithIgnoreList(ray(movingOrigin, target - movingOrigin), blacklist, false, true)
if entryPart then
if canOcclude(entryPart) then
local wl = {entryPart}
local exitPart = workspace:FindPartOnRayWithWhitelist(ray(target, entryPos - target), wl, true)
local lim = (entryPos - origin).Magnitude
if exitPart then
local promote = false
if lastPos then
promote =
workspace:FindPartOnRayWithWhitelist(ray(lastPos, target - lastPos), wl, true) or
workspace:FindPartOnRayWithWhitelist(ray(target, lastPos - target), wl, true)
end
if promote then
-- Ostensibly a soft limit, but the camera has passed through it in the last frame, so promote to a hard limit.
hardLimit = lim
elseif dist < softLimit then
-- Trivial soft limit
softLimit = lim
end
else
-- Trivial hard limit
hardLimit = lim
end
end
blacklist[#blacklist + 1] = entryPart
movingOrigin = entryPos - unitDir*1e-3
end
until hardLimit < inf or not entryPart
eraseFromEnd(blacklist, originalSize)
debug.profileend()
return softLimit - nearPlaneZ, hardLimit - nearPlaneZ
end
local function queryViewport(focus, dist)
debug.profilebegin("queryViewport")
local fP = focus.p
local fX = focus.rightVector
local fY = focus.upVector
local fZ = -focus.lookVector
local viewport = camera.ViewportSize
local hardBoxLimit = inf
local softBoxLimit = inf
-- Center the viewport on the PoI, sweep points on the edge towards the target, and take the minimum limits
for viewX = 0, 1 do
local worldX = fX*((viewX - 0.5)*projX)
for viewY = 0, 1 do
local worldY = fY*((viewY - 0.5)*projY)
local origin = fP + nearPlaneZ*(worldX + worldY)
local lastPos = camera:ViewportPointToRay(
viewport.x*viewX,
viewport.y*viewY
).Origin
local softPointLimit, hardPointLimit = queryPoint(origin, fZ, dist, lastPos)
if hardPointLimit < hardBoxLimit then
hardBoxLimit = hardPointLimit
end
if softPointLimit < softBoxLimit then
softBoxLimit = softPointLimit
end
end
end
debug.profileend()
return softBoxLimit, hardBoxLimit
end
local function testPromotion(focus, dist, focusExtrapolation)
debug.profilebegin("testPromotion")
local fP = focus.p
local fX = focus.rightVector
local fY = focus.upVector
local fZ = -focus.lookVector
do
-- Dead reckoning the camera rotation and focus
debug.profilebegin("extrapolate")
local SAMPLE_DT = 0.0625
local SAMPLE_MAX_T = 1.25
local maxDist = (getCollisionPoint(fP, focusExtrapolation.posVelocity*SAMPLE_MAX_T) - fP).Magnitude
-- Metric that decides how many samples to take
local combinedSpeed = focusExtrapolation.posVelocity.magnitude
for dt = 0, min(SAMPLE_MAX_T, focusExtrapolation.rotVelocity.magnitude + maxDist/combinedSpeed), SAMPLE_DT do
local cfDt = focusExtrapolation.extrapolate(dt) -- Extrapolated CFrame at time dt
if queryPoint(cfDt.p, -cfDt.lookVector, dist) >= dist then
return false
end
end
debug.profileend()
end
do
-- Test screen-space offsets from the focus for the presence of soft limits
debug.profilebegin("testOffsets")
for _, offset in ipairs(SCAN_SAMPLE_OFFSETS) do
local scaledOffset = offset
local pos = getCollisionPoint(fP, fX*scaledOffset.x + fY*scaledOffset.y)
if queryPoint(pos, (fP + fZ*dist - pos).Unit, dist) == inf then
return false
end
end
debug.profileend()
end
debug.profileend()
return true
end
local function Popper(focus, targetDist, focusExtrapolation)
debug.profilebegin("popper")
subjectRoot = subjectPart and subjectPart:GetRootPart() or subjectPart
local dist = targetDist
local soft, hard = queryViewport(focus, targetDist)
if hard < dist then
dist = hard
end
if soft < dist and testPromotion(focus, targetDist, focusExtrapolation) then
dist = soft
end
subjectRoot = nil
debug.profileend()
return dist
end
return Popper
|
-- Requests the mob to perform a jump if there's an obstacle in the way of it. |
function AI:RequestJump(Mob)
if not Mob.Instance then
return
end
local Root: BasePart = Mob.Root
local JumpHeight: number = (Mob.Enemy.JumpPower ^ 2) / (2 * workspace.Gravity) * .8
local HipPoint: CFrame = Root.CFrame + (Root.CFrame.LookVector*(Root.Size.Z/2-0.2)) + (Root.CFrame.UpVector/-Root.Size.Y/2)
local RaycastResult = workspace:Raycast(
HipPoint.Position,
HipPoint.LookVector * Mob.Enemy.WalkSpeed/4,
RaycastParams
)
if RaycastResult then
-- There is an obstacle, but they should be able to jump over it!
if RaycastResult.Instance ~= workspace.Terrain then
local PartHeight: number = (RaycastResult.Instance.Position + Vector3.new(0, RaycastResult.Instance.Size.Y/2, 0)).Y
if (HipPoint.Position.Y + JumpHeight) > PartHeight then
Mob.Enemy.Jump = true
end
else
Mob.Enemy.Jump = true
end
end
end
|
-- Discard any excess return values |
local function first(x)
return x
end
|
-- Place in StarterGui. |
local Players = game:GetService("Players")
function onPlayerAdded(player)
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = ("[SERVER]: ".. player.Name .. " has entered the game.");
Color = Color3.new(255,255,255);
Font = Enum.Font.SourceSansBold;
FontSize = Enum.FontSize.Size18;
})
end
Players.PlayerAdded:connect(onPlayerAdded)
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
|
--!strict
--[=[
@function flatten
@within Array
@param array {T} -- The array to flatten.
@param depth? number -- The depth to flatten the array to.
@return {T} -- The flattened array.
Flattens an array. If depth is not specified, it will flatten
the array as far as it can go.
```lua
local array = {
{ 1, 2, 3 },
{ 4, 5, 6 },
{ 7, { 8, 9 } },
}
local new = Flatten(array) -- { 1, 2, 3, 4, 5, 6, 7, 8, 9 }
local new = Flatten(array, 1) -- { 1, 2, 3, 4, 5, 6, 7, { 8, 9 } }
```
]=] |
local function flatten<T>(array: { T }, depth: number?): { T }
depth = if type(depth) == "number" then depth else math.huge
local result = {}
for _, value in ipairs(array) do
if type(value) == "table" and depth > 0 then
local nested = flatten(value, depth - 1)
for _, nestedValue in ipairs(nested) do
table.insert(result, nestedValue)
end
else
table.insert(result, value)
end
end
return result
end
return flatten
|
-- Do the things. |
for i, f in ipairs(autoEvents) do
f()
end
|
-- Local Functions |
local function OnPlayerAdded(player)
-- Setup leaderboard stats
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local KWA = Instance.new("StringValue", leaderstats)
if Configurations.GRANT_ASSISTS then
KWA.Name = "KO - WO - A"
KWA.Value = "0 - 0 - 0"
else
KWA.Name = "KO - WO"
KWA.Value = "0 - 0"
end
ScoreArray[player] = { 0, 0, 0 } -- KOs, WOs, Assists
TeamManager:AssignPlayerToTeam(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
PlayerManager:PlayerDied(player)
wait(Configurations.RESPAWN_TIME)
if GameRunning then
player:LoadCharacter()
end
end)
end)
if PlayersCanSpawn then
player:LoadCharacter()
else
DisplayManager:StartIntermission(player)
end
end
local function OnPlayerRemoving(player)
TeamManager:RemovePlayer(player)
end
local function UpdatePlayerScore(player)
local KOString = tostring(ScoreArray[player][1])
local WOString = tostring(ScoreArray[player][2])
local AssistString = tostring(ScoreArray[player][3])
if not Configurations.GRANT_ASSISTS then
if KOString:len() < WOString:len() then
while KOString:len() < WOString:len() do
KOString = " " .. KOString
end
else
while WOString:len() < WOString:len() do
WOString = WOString .. " "
end
end
player.leaderstats["KO - WO"].Value = KOString .. " - " .. WOString
else
player.leaderstats["KO - WO - A"].Value = KOString .. " - " .. WOString .. " - " .. AssistString
end
end
|
--[[
Sets the given emote as unlocked for the given Player.
]] |
local function unlockEmote(runService, emoteManager, changeEmoteLock)
if runService:IsServer() then
return function(player: Player, emoteName: string): nil
assert(t.string(emoteName))
emoteManager:setEmoteIsLockedForPlayer(player, emoteName, false)
end
else
-- Calling unlockEmote from the client is deprecated. To preserve
-- backwards compatibility, a remote event is fired to the new server
-- side unlockEmote function
return function(emoteName: string): nil
warn("Calling unlockEmote from the client is deprecated. Please call from a server Script instead.")
changeEmoteLock:FireServer(emoteName, false)
end
end
end
return unlockEmote
|
--[[
Sets up the EmoteManager for the given player.
]] |
local function setupEmoteManager(player)
local humanoid = player.Character:WaitForChild("Humanoid")
local humanoidDescription = humanoid:WaitForChild("HumanoidDescription")
emoteManager:setup(player, humanoidDescription)
local connection
connection = humanoid.Died:Connect(function()
stopEmote(player)
player.CharacterAdded:Wait()
setupEmoteManager(player)
connection:Disconnect()
end)
end
local function onPlayerAdded(player)
if not player.Character then
player.CharacterAdded:Wait()
end
setupEmoteManager(player)
end
local function onPlayerRemoving(player)
stopEmote(player)
emoteManager:cleanup(player.UserId)
end
local function onChangeEmoteLock(player, emoteName, isLocked)
assert(onChangeEmoteLockCheck(emoteName, isLocked))
emoteManager:setEmoteIsLockedForPlayer(player, emoteName, isLocked)
end
emotePlayed.OnServerEvent:Connect(startEmote)
emoteStopped.OnServerEvent:Connect(stopEmote)
changeEmoteLock.OnServerEvent:Connect(onChangeEmoteLock)
Players.PlayerAdded:Connect(onPlayerAdded)
Players.PlayerRemoving:Connect(onPlayerRemoving)
loadEmoteAssets()
|
-- Ensures that 'actual' & 'expected' are of type 'number' |
local function ensureNumbers(actual: any, expected: any, matcherName: string, options: MatcherHintOptions?): ()
ensureActualIsNumber(actual, matcherName, options)
ensureExpectedIsNumber(expected, matcherName, options)
end
local function ensureExpectedIsNonNegativeInteger(expected: any, matcherName: string, options: MatcherHintOptions?): ()
if typeof(expected) ~= "number" or not Number.isSafeInteger(expected) or expected < 0 then
local matcherString = matcherName
if not options then
matcherString = "[.never]" .. matcherString
end
error(
Error(
matcherErrorMessage(
matcherHint(matcherString, nil, nil, options),
EXPECTED_COLOR("expected") .. " value must be a non-negative integer",
printWithType("Expected", expected, printExpected)
)
)
)
end
end
|
--This script should work. Only 30 lines. Amazing! Feel free to add more buttons in tab to your liking. |
local tabs = script.Parent.TABS:GetChildren()
for i = 1, #tabs do
local buttons = tabs[i]:GetChildren()
for i = 1, #buttons do
function sell()
hint = Instance.new("Hint",script.Parent.Parent.Parent.Parent.PlayerGui)
Game:GetService("Debris"):AddItem(hint, 2)
local gp = script.Parent.Parent.Parent.Parent.leaderstats:FindFirstChild("Gold")
local bp = script.Parent.Parent.Parent.Parent.Backpack
local sg = script.Parent.Parent.Parent.Parent.StarterGear
local bptool = bp:FindFirstChild(buttons[i].Item.Value)
local sgtool = sg:FindFirstChild(buttons[i].Item.Value)
local sellvalue = buttons[i].SellPrice.Value
if bptool ~= nil and sgtool ~= nil then
bptool:Remove()
sgtool:Remove()
gp.Value = gp.Value + sellvalue
hint.Text = "You sold " ..buttons[i].Text.. " for " ..buttons[i].PriceDisplay.Text.. " Gold!"
elseif bptool == nil and sgtool ~= nil then
sgtool:Remove()
gp.Value = gp.Value + sellvalue
hint.Text = "You sold " ..buttons[i].Text.. " for " ..buttons[i].PriceDisplay.Text.. " Gold!"
else hint.Text = "You don't have " ..buttons[i].Text.. "!"
end
end
buttons[i].MouseButton1Click:connect(sell)
end
end
|
--Made by Luckymaxer |
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local CoilSound = Handle:WaitForChild("CoilSound")
local Character = game.Players.LocalPlayer.Character
local Head = Character.Humanoid.Head
EqualizingForce = (236 / 1.2) -- amount of force required to levitate a mass
Gravity = 0.85 -- things float at > 1
GhostEffect = nil
MassCon1 = nil
MassCon2 = nil
function GetTotalMass(root)
local force = 0
for _, obj in pairs(root:GetChildren()) do
if obj:IsA("BasePart") then
force = force + obj:GetMass() * EqualizingForce * Gravity
end
force = force + GetTotalMass(obj)
end
return force
end
function OnMassChanged(child, character)
if GhostEffect and GhostEffect.Parent then
GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0)
end
end
function UpdateGhostState(Unequipped)
if Unequipped then
GhostEffect:Destroy()
GhostEffect = nil
MassCon1:disconnect()
MassCon2:disconnect()
else
if not GhostEffect then
GhostEffect = Instance.new("BodyForce")
GhostEffect.Name = "GravityCoilEffect"
GhostEffect.force = Vector3.new(0, GetTotalMass(Character), 0)
GhostEffect.Parent = Head
MassCon1 = Character.ChildAdded:connect(function(Child)
OnMassChanged(Child, Character)
end)
MassCon2 = Character.ChildRemoved:connect(function(Child)
OnMassChanged(Child, Character)
end)
end
end
end
function OnEquipped()
Character = Tool.Parent
Head = Character:FindFirstChild("Head")
if not Head or not Head.Parent then
return
end
CoilSound:Play()
UpdateGhostState(false)
end
function OnUnequipped()
UpdateGhostState(true)
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
--Button size |
local ButtonSX = Button.Size.X.Scale
local ButtonSY = Button.Size.Y.Scale
Button.MouseEnter:Connect(function(x,y)
--HolaMousee
Button:TweenSize(
UDim2.new(ButtonSX + 0.006 , 0,ButtonSY + 0.006, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseLeave:Connect(function(x,y)
--AdiosMousee
Button:TweenSize(
UDim2.new(ButtonSX, 0,ButtonSY, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseButton1Down:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX - 0.006 , 0,ButtonSY - 0.006, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
Button.MouseButton1Up:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX + 0.006 ,0, ButtonSY + 0.006, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
|
-- jest --no-expand
--
-- Given array of aligned strings with inverse highlight formatting,
-- return joined lines with diff formatting (and patch marks, if needed). |
local function joinAlignedDiffsNoExpand(diffs: Array<Diff>, options: DiffOptionsNormalized): string
local iLength = #diffs
local nContextLines = options.contextLines
local nContextLines2 = nContextLines + nContextLines
-- First pass: count output lines and see if it has patches.
local jLength = iLength
local hasExcessAtStartOrEnd = false
local nExcessesBetweenChanges = 0
local i = 0
while i ~= iLength do
local iStart = i
while i ~= iLength and diffs[i + 1][1] == DIFF_EQUAL do
i += 1
end
if iStart ~= i then
if iStart == 0 then
-- at start
if i > nContextLines then
jLength -= i - nContextLines -- subtract excess common lines
hasExcessAtStartOrEnd = true
end
elseif i == iLength then
-- at end
local n = i - iStart
if n > nContextLines then
jLength -= n - nContextLines -- subtract excess common lines
hasExcessAtStartOrEnd = true
end
else
-- between changes
local n = i - iStart
if n > nContextLines2 then
jLength -= n - nContextLines2 -- subtract excess common lines
nExcessesBetweenChanges += 1
end
end
end
while i ~= iLength and diffs[i + 1][1] ~= DIFF_EQUAL do
i += 1
end
end
local hasPatch = nExcessesBetweenChanges ~= 0 or hasExcessAtStartOrEnd
if nExcessesBetweenChanges ~= 0 then
jLength += nExcessesBetweenChanges + 1 -- add patch lines
elseif hasExcessAtStartOrEnd then
jLength += 1 -- add patch line
end
local jLast = jLength - 1
local lines: { [number]: string } = {}
local jPatchMark = 0 -- index of placeholder line for current patch mark
if hasPatch then
table.insert(lines, "") -- placeholder line for first patch mark
end
-- Indexes of expected or received lines in current patch:
local aStart = 0
local bStart = 0
local aEnd = 0
local bEnd = 0
local pushCommonLine = function(line: string): ()
local j = #lines
table.insert(lines, printCommonLine(line, j == 0 or j == jLast, options))
aEnd += 1
bEnd += 1
end
local pushDeleteLine = function(line: string): ()
local j = #lines
table.insert(lines, printDeleteLine(line, j == 0 or j == jLast, options))
aEnd += 1
end
local pushInsertLine = function(line: string): ()
local j = #lines
table.insert(lines, printInsertLine(line, j == 0 or j == jLast, options))
bEnd += 1
end
-- Second pass: push lines with diff formatting (and patch marks, if needed).
i = 0
while i ~= iLength do
local iStart = i
while i ~= iLength and diffs[i + 1][1] == DIFF_EQUAL do
i += 1
end
if iStart ~= i then
if iStart == 0 then
-- at beginning
if i > nContextLines then
iStart = i - nContextLines
aStart = iStart
bStart = iStart
aEnd = aStart
bEnd = bStart
end
local iCommon = iStart
while iCommon ~= i do
pushCommonLine(diffs[iCommon + 1][2])
iCommon += 1
end
elseif i == iLength then
-- at end
local iEnd = i
if i - iStart > nContextLines then
iEnd = iStart + nContextLines
end
local iCommon = iStart
while iCommon ~= iEnd do
pushCommonLine(diffs[iCommon + 1][2])
iCommon += 1
end
else
-- between changes
local nCommon = i - iStart
if nCommon > nContextLines2 then
local iEnd = iStart + nContextLines
local iCommon = iStart
while iCommon ~= iEnd do
pushCommonLine(diffs[iCommon + 1][2])
iCommon += 1
end
lines[jPatchMark + 1] = createPatchMark(aStart, aEnd, bStart, bEnd, options)
jPatchMark = #lines
table.insert(lines, "") -- placeholder line for next patch mark
local nOmit = nCommon - nContextLines2
aStart = aEnd + nOmit
bStart = bEnd + nOmit
aEnd = aStart
bEnd = bStart
iCommon = i - nContextLines
while iCommon ~= i do
pushCommonLine(diffs[iCommon + 1][2])
iCommon += 1
end
else
local iCommon = iStart
while iCommon ~= i do
pushCommonLine(diffs[iCommon + 1][2])
iCommon += 1
end
end
end
end
while i ~= iLength and diffs[i + 1][1] == DIFF_DELETE do
pushDeleteLine(diffs[i + 1][2])
i += 1
end
while i ~= iLength and diffs[i + 1][1] == DIFF_INSERT do
pushInsertLine(diffs[i + 1][2])
i += 1
end
end
if hasPatch then
lines[jPatchMark + 1] = createPatchMark(aStart, aEnd, bStart, bEnd, options)
end
return table.concat(lines, "\n")
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.