prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Want to turn off Invisicam? Be sure to call this after. |
function Invisicam:Cleanup()
for hit, originalFade in pairs(self.savedHits) do
hit.LocalTransparencyModifier = originalFade
end
end
function Invisicam:Update(dt: number, desiredCameraCFrame: CFrame, desiredCameraFocus: CFrame): (CFrame, CFrame)
-- Bail if there is no Character
if not self.enabled or not self.char then
return desiredCameraCFrame, desiredCameraFocus
end
self.camera = game.Workspace.CurrentCamera
-- TODO: Move this to a GetHumanoidRootPart helper, probably combine with CheckTorsoReference
-- Make sure we still have a HumanoidRootPart
if not self.humanoidRootPart then
local humanoid = self.char:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.RootPart then
self.humanoidRootPart = humanoid.RootPart
else
-- Not set up with Humanoid? Try and see if there's one in the Character at all:
self.humanoidRootPart = self.char:FindFirstChild("HumanoidRootPart")
if not self.humanoidRootPart then
-- Bail out, since we're relying on HumanoidRootPart existing
return desiredCameraCFrame, desiredCameraFocus
end
end
-- TODO: Replace this with something more sensible
local ancestryChangedConn
ancestryChangedConn = self.humanoidRootPart.AncestryChanged:Connect(function(child, parent)
if child == self.humanoidRootPart and not parent then
self.humanoidRootPart = nil
if ancestryChangedConn and ancestryChangedConn.Connected then
ancestryChangedConn:Disconnect()
ancestryChangedConn = nil
end
end
end)
end
if not self.torsoPart then
self:CheckTorsoReference()
if not self.torsoPart then
-- Bail out, since we're relying on Torso existing, should never happen since we fall back to using HumanoidRootPart as torso
return desiredCameraCFrame, desiredCameraFocus
end
end
-- Make a list of world points to raycast to
local castPoints = {}
self.behaviorFunction(self, castPoints)
-- Cast to get a list of objects between the camera and the cast points
local currentHits = {}
local ignoreList = {self.char}
local function add(hit)
currentHits[hit] = true
if not self.savedHits[hit] then
self.savedHits[hit] = hit.LocalTransparencyModifier
end
end
local hitParts
local hitPartCount = 0
-- Hash table to treat head-ray-hit parts differently than the rest of the hit parts hit by other rays
-- head/torso ray hit parts will be more transparent than peripheral parts when USE_STACKING_TRANSPARENCY is enabled
local headTorsoRayHitParts = {}
local perPartTransparencyHeadTorsoHits = TARGET_TRANSPARENCY
local perPartTransparencyOtherHits = TARGET_TRANSPARENCY
if USE_STACKING_TRANSPARENCY then
-- This first call uses head and torso rays to find out how many parts are stacked up
-- for the purpose of calculating required per-part transparency
local headPoint = self.headPart and self.headPart.CFrame.p or castPoints[1]
local torsoPoint = self.torsoPart and self.torsoPart.CFrame.p or castPoints[2]
hitParts = self.camera:GetPartsObscuringTarget({headPoint, torsoPoint}, ignoreList)
-- Count how many things the sample rays passed through, including decals. This should only
-- count decals facing the camera, but GetPartsObscuringTarget does not return surface normals,
-- so my compromise for now is to just let any decal increase the part count by 1. Only one
-- decal per part will be considered.
for i = 1, #hitParts do
local hitPart = hitParts[i]
hitPartCount = hitPartCount + 1 -- count the part itself
headTorsoRayHitParts[hitPart] = true
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
hitPartCount = hitPartCount + 1 -- count first decal hit, then break
break
end
end
end
if (hitPartCount > 0) then
perPartTransparencyHeadTorsoHits = math.pow( ((0.5 * TARGET_TRANSPARENCY) + (0.5 * TARGET_TRANSPARENCY / hitPartCount)), 1 / hitPartCount )
perPartTransparencyOtherHits = math.pow( ((0.5 * TARGET_TRANSPARENCY_PERIPHERAL) + (0.5 * TARGET_TRANSPARENCY_PERIPHERAL / hitPartCount)), 1 / hitPartCount )
end
end
-- Now get all the parts hit by all the rays
hitParts = self.camera:GetPartsObscuringTarget(castPoints, ignoreList)
local partTargetTransparency = {}
-- Include decals and textures
for i = 1, #hitParts do
local hitPart = hitParts[i]
partTargetTransparency[hitPart] =headTorsoRayHitParts[hitPart] and perPartTransparencyHeadTorsoHits or perPartTransparencyOtherHits
-- If the part is not already as transparent or more transparent than what invisicam requires, add it to the list of
-- parts to be modified by invisicam
if hitPart.Transparency < partTargetTransparency[hitPart] then
add(hitPart)
end
-- Check all decals and textures on the part
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
if (child.Transparency < partTargetTransparency[hitPart]) then
partTargetTransparency[child] = partTargetTransparency[hitPart]
add(child)
end
end
end
end
-- Invisibilize objects that are in the way, restore those that aren't anymore
for hitPart, originalLTM in pairs(self.savedHits) do
if currentHits[hitPart] then
-- LocalTransparencyModifier gets whatever value is required to print the part's total transparency to equal perPartTransparency
hitPart.LocalTransparencyModifier = (hitPart.Transparency < 1) and ((partTargetTransparency[hitPart] - hitPart.Transparency) / (1.0 - hitPart.Transparency)) or 0
else -- Restore original pre-invisicam value of LTM
hitPart.LocalTransparencyModifier = originalLTM
self.savedHits[hitPart] = nil
end
end
-- Invisicam does not change the camera values
return desiredCameraCFrame, desiredCameraFocus
end
return Invisicam
|
--[=[
@within TableUtil
@function Zip
@param ... table
@return (iter: (t: table, k: any) -> (key: any?, values: table?), tbl: table, startIndex: any?)
Returns an iterator that can scan through multiple tables at the same time side-by-side, matching
against shared keys/indices.
```lua
local t1 = {10, 20, 30, 40, 50}
local t2 = {60, 70, 80, 90, 100}
for key,values in TableUtil.Zip(t1, t2) do
print(key, values)
end
--[[
Outputs:
1 {10, 60}
2 {20, 70}
3 {30, 80}
4 {40, 90}
5 {50, 100}
--]]
```
]=] |
local function Zip(...: { [any]: any }): ((t: { any }, k: any) -> (any, any), { any }, any)
assert(select("#", ...) > 0, "Must supply at least 1 table")
local function ZipIteratorArray(all: {any}, k: number): (number?, {any}?)
k += 1
local values = {}
for i, t in all do
local v = t[k]
if not v then
return nil, nil
end
values[i] = v
end
return k, values
end
local function ZipIteratorMap(all: { [any]: any }, k: any): (number?, { any }?)
local values = {}
for i, t in all do
local v = next(t, k)
if not v then
return nil, nil
end
values[i] = v
end
return k, values
end
local all = {...}
if #all[1] > 0 then
return ZipIteratorArray, all, 0
else
return ZipIteratorMap, all, nil
end
end
|
-- Loop forever |
while true do
if isOnVar.Value then
local minsAfterMidnight = (USE_CUSTOM_TIME) and minsAfterMidnightVar.Value or math.floor(lightingService:GetMinutesAfterMidnight())
minsAfterMidnightVar.Value = minsAfterMidnight
TryUpdate(minsAfterMidnight)
if not prevIsOn then
prevIsOn = true
screen.Visible = true
end
else if prevIsOn then
prevIsOn = false
screen.Visible = false
end
end
wait(msPerUpdateVar.Value/1000)
end
|
--[[
Do not erase these words!
This clickable door was made by Wirodeu
Profile page: http://www.roblox.com/User.aspx?ID=145417
Blog: www.robloxjuice.wordpress.com
--]] | |
-- FUNCTIONS -- |
local function checkHolding()
end
Tool.Equipped:Connect(function()
Equipped = true
Char = Tool.Parent
HumRP = Char:WaitForChild("HumanoidRootPart")
Humanoid = Char:WaitForChild("Humanoid")
Animations = {
["Z"] = Humanoid:LoadAnimation(script.Animations.Z),
["X"] = Humanoid:LoadAnimation(script.Animations.X),
}
if not loopConnection then
loopConnection = game:GetService("RunService").RenderStepped:Connect(function()
if UIS:IsKeyDown(Enum.KeyCode.Z) then
if Char:FindFirstChild("Disabled") then return end
if not Z then
if Equipped and not CS:HasTag(Char, "Z") and not CS:HasTag(Char, "Busy") then
SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "Z")
end
end
Z = true
else
if Z then
isHolding = false
SkillsHandler:FireServer("Skill", Tool.Name, "Release", "Z", Mouse:GetHit().Position, Char.HumanoidRootPart.CFrame)
Animations.Z:AdjustSpeed(1)
end
Z = false
end
if UIS:IsKeyDown(Enum.KeyCode.X) then
if Char:FindFirstChild("Disabled") then return end
if not X then
if Equipped and not CS:HasTag(Char, "X") and not CS:HasTag(Char, "Busy") then
SkillsHandler:FireServer("Skill", Tool.Name, "Hold", "X")
end
end
X = true
else
if X then
isHolding = false
SkillsHandler:FireServer("Skill", Tool.Name, "Release", "X", Mouse:GetHit().Position)
Animations.X:AdjustSpeed(1)
end
X = false
end
end)
end
if not holdingConnection then
holdingConnection = Holding.Changed:Connect(function()
coroutine.wrap(function()
if Holding.Value ~= "None" then
HumRP.Anchored = true
isHolding = true
if Holding.Value == "Z" then
Animations.Z:Play()
Animations.Z:GetMarkerReachedSignal("Idle"):Connect(function()
if isHolding == true then
Animations.Z:AdjustSpeed(0)
end
end)
repeat
HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse:GetHit().Position)
task.wait()
until Holding.Value ~= "Z"
elseif Holding.Value == "X" then
Animations.X:Play()
Animations.X:GetMarkerReachedSignal("Idle"):Connect(function()
if isHolding == true then
Animations.X:AdjustSpeed(0)
end
end)
repeat
HumRP.CFrame = CFrame.lookAt(HumRP.Position, Vector3.new(Mouse:GetHit().Position.X, HumRP.Position.Y, Mouse:GetHit().Position.Z))
task.wait()
until Holding.Value ~= "X"
end
else
HumRP.Anchored = false
end
end)()
end)
end
end)
Tool.Unequipped:Connect(function()
Equipped = false
if loopConnection ~= nil then
loopConnection:Disconnect()
loopConnection = nil
end
if holdingConnection ~= nil then
holdingConnection:Disconnect()
holdingConnection = nil
end
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = require(script.Parent:WaitForChild("CameraUtils"));
local l__Players__2 = game:GetService("Players");
local l__RunService__3 = game:GetService("RunService");
local u1 = Vector3.new(0, 0, 0);
local v4 = require(script.Parent:WaitForChild("BaseOcclusion"));
local v5 = setmetatable({}, v4);
v5.__index = v5;
local u2 = {
LIMBS = 2,
MOVEMENT = 3,
CORNERS = 4,
CIRCLE1 = 5,
CIRCLE2 = 6,
LIMBMOVE = 7,
SMART_CIRCLE = 8,
CHAR_OUTLINE = 9
};
function v5.new()
local v6 = setmetatable(v4.new(), v5);
v6.char = nil;
v6.humanoidRootPart = nil;
v6.torsoPart = nil;
v6.headPart = nil;
v6.childAddedConn = nil;
v6.childRemovedConn = nil;
v6.behaviors = {};
v6.behaviors[u2.LIMBS] = v6.LimbBehavior;
v6.behaviors[u2.MOVEMENT] = v6.MoveBehavior;
v6.behaviors[u2.CORNERS] = v6.CornerBehavior;
v6.behaviors[u2.CIRCLE1] = v6.CircleBehavior;
v6.behaviors[u2.CIRCLE2] = v6.CircleBehavior;
v6.behaviors[u2.LIMBMOVE] = v6.LimbMoveBehavior;
v6.behaviors[u2.SMART_CIRCLE] = v6.SmartCircleBehavior;
v6.behaviors[u2.CHAR_OUTLINE] = v6.CharacterOutlineBehavior;
v6.mode = u2.SMART_CIRCLE;
v6.behaviorFunction = v6.SmartCircleBehavior;
v6.savedHits = {};
v6.trackedLimbs = {};
v6.camera = game.Workspace.CurrentCamera;
v6.enabled = false;
return v6;
end;
function v5.Enable(p1, p2)
p1.enabled = p2;
if not p2 then
p1:Cleanup();
end;
end;
function v5.GetOcclusionMode(p3)
return Enum.DevCameraOcclusionMode.Invisicam;
end;
function v5.LimbBehavior(p4, p5)
for v7, v8 in pairs(p4.trackedLimbs) do
p5[#p5 + 1] = v7.Position;
end;
end;
function v5.MoveBehavior(p6, p7)
for v9 = 1, 3 do
local l__Velocity__10 = p6.humanoidRootPart.Velocity;
p7[#p7 + 1] = p6.humanoidRootPart.Position + (v9 - 1) * p6.humanoidRootPart.CFrame.lookVector * (Vector3.new(l__Velocity__10.X, 0, l__Velocity__10.Z).Magnitude / 2);
end;
end;
local u3 = { Vector3.new(1, 1, -1), Vector3.new(1, -1, -1), Vector3.new(-1, -1, -1), Vector3.new(-1, 1, -1) };
function v5.CornerBehavior(p8, p9)
local l__CFrame__11 = p8.humanoidRootPart.CFrame;
local l__p__12 = l__CFrame__11.p;
local v13 = l__CFrame__11 - l__p__12;
local v14 = p8.char:GetExtentsSize() / 2;
p9[#p9 + 1] = l__p__12;
for v15 = 1, #u3 do
p9[#p9 + 1] = l__p__12 + v13 * (v14 * u3[v15]);
end;
end;
function v5.CircleBehavior(p10, p11)
if p10.mode == u2.CIRCLE1 then
local v16 = p10.humanoidRootPart.CFrame;
else
local l__CoordinateFrame__17 = p10.camera.CoordinateFrame;
v16 = l__CoordinateFrame__17 - l__CoordinateFrame__17.p + p10.humanoidRootPart.Position;
end;
p11[#p11 + 1] = v16.p;
for v18 = 0, 9 do
local v19 = 2 * math.pi / 10 * v18;
p11[#p11 + 1] = v16 * (3 * Vector3.new(math.cos(v19), math.sin(v19), 0));
end;
end;
function v5.LimbMoveBehavior(p12, p13)
p12:LimbBehavior(p13);
p12:MoveBehavior(p13);
end;
function v5.CharacterOutlineBehavior(p14, p15)
local l__unit__20 = p14.torsoPart.CFrame.upVector.unit;
local l__unit__21 = p14.torsoPart.CFrame.rightVector.unit;
p15[#p15 + 1] = p14.torsoPart.CFrame.p;
p15[#p15 + 1] = p14.torsoPart.CFrame.p + l__unit__20;
p15[#p15 + 1] = p14.torsoPart.CFrame.p - l__unit__20;
p15[#p15 + 1] = p14.torsoPart.CFrame.p + l__unit__21;
p15[#p15 + 1] = p14.torsoPart.CFrame.p - l__unit__21;
if p14.headPart then
p15[#p15 + 1] = p14.headPart.CFrame.p;
end;
local v22 = CFrame.new(u1, Vector3.new(p14.camera.CoordinateFrame.lookVector.X, 0, p14.camera.CoordinateFrame.lookVector.Z));
local v23 = p14.torsoPart and p14.torsoPart.Position or p14.humanoidRootPart.Position;
local v24 = { p14.torsoPart };
if p14.headPart then
v24[#v24 + 1] = p14.headPart;
end;
for v25 = 1, 24 do
local v26 = 2 * math.pi * v25 / 24;
local v27 = v22 * (3 * Vector3.new(math.cos(v26), math.sin(v26), 0));
local v28 = Vector3.new(v27.X, math.max(v27.Y, -2.25), v27.Z);
local v29, v30 = game.Workspace:FindPartOnRayWithWhitelist(Ray.new(v23 + v28, -3 * v28), v24, false, false);
if v29 then
p15[#p15 + 1] = v30 + 0.2 * (v23 - v30).unit;
end;
end;
end;
local u4 = 2 * math.pi / 24;
local function u5(p16, p17, p18, p19)
local v31 = p17:Cross(p19);
local v32 = p18.x - p16.x;
local v33 = p18.y - p16.y;
local v34 = p18.z - p16.z;
local l__y__35 = p17.y;
local v36 = -p19.y;
local l__y__37 = v31.y;
local l__z__38 = p17.z;
local v39 = -p19.z;
local l__z__40 = v31.z;
local v41 = p17.x * (v36 * l__z__40 - l__y__37 * v39) - -p19.x * (l__y__35 * l__z__40 - l__y__37 * l__z__38) + v31.x * (l__y__35 * v39 - v36 * l__z__38);
if v41 == 0 then
return u1;
end;
local v42 = -p19.y;
local l__y__43 = v31.y;
local v44 = -p19.z;
local l__z__45 = v31.z;
local l__y__46 = p17.y;
local l__y__47 = v31.y;
local l__z__48 = p17.z;
local l__z__49 = v31.z;
local v50 = p16 + (v32 * (v42 * l__z__45 - l__y__43 * v44) - -p19.x * (v33 * l__z__45 - l__y__43 * v34) + v31.x * (v33 * v44 - v42 * v34)) / v41 * p17;
local v51 = p18 + (p17.x * (v33 * l__z__49 - l__y__47 * v34) - v32 * (l__y__46 * l__z__49 - l__y__47 * l__z__48) + v31.x * (l__y__46 * v34 - v33 * l__z__48)) / v41 * p19;
if (v51 - v50).Magnitude < 0.25 then
return v50 + 0.5 * (v51 - v50);
end;
return u1;
end;
function v5.SmartCircleBehavior(p20, p21)
local l__unit__52 = p20.torsoPart.CFrame.upVector.unit;
local l__unit__53 = p20.torsoPart.CFrame.rightVector.unit;
p21[#p21 + 1] = p20.torsoPart.CFrame.p;
p21[#p21 + 1] = p20.torsoPart.CFrame.p + l__unit__52;
p21[#p21 + 1] = p20.torsoPart.CFrame.p - l__unit__52;
p21[#p21 + 1] = p20.torsoPart.CFrame.p + l__unit__53;
p21[#p21 + 1] = p20.torsoPart.CFrame.p - l__unit__53;
if p20.headPart then
p21[#p21 + 1] = p20.headPart.CFrame.p;
end;
local v54 = p20.camera.CFrame - p20.camera.CFrame.p;
local v55 = Vector3.new(0, 0.5, 0) + (p20.torsoPart and p20.torsoPart.Position or p20.humanoidRootPart.Position);
for v56 = 1, 24 do
local v57 = u4 * v56 - 0.5 * math.pi;
local v58 = v55 + v54 * (2.5 * Vector3.new(math.cos(v57), math.sin(v57), 0));
local v59 = v58 - p20.camera.CFrame.p;
local v60, v61, v62 = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(v55, v58 - v55), { p20.char }, false, false);
local v63 = v58;
if v60 then
local v64 = v61 + 0.1 * v62.unit;
local v65 = v64 - v55;
local l__magnitude__66 = v65.magnitude;
local l__unit__67 = v65:Cross(v59).unit:Cross(v62).unit;
if v65.unit:Dot(-l__unit__67) < v65.unit:Dot((v64 - p20.camera.CFrame.p).unit) then
v63 = u5(v64, l__unit__67, v58, v59);
if v63.Magnitude > 0 then
local v68, v69, v70 = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(v64, v63 - v64), { p20.char }, false, false);
if v68 then
v63 = v69 + 0.1 * v70.unit;
end;
else
v63 = v64;
end;
else
v63 = v64;
end;
local v71, v72, v73 = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(v55, v63 - v55), { p20.char }, false, false);
if v71 then
v63 = v72 - 0.1 * (v63 - v55).unit;
end;
end;
p21[#p21 + 1] = v63;
end;
end;
function v5.CheckTorsoReference(p22)
if p22.char then
p22.torsoPart = p22.char:FindFirstChild("Torso");
if not p22.torsoPart then
p22.torsoPart = p22.char:FindFirstChild("UpperTorso");
if not p22.torsoPart then
p22.torsoPart = p22.char:FindFirstChild("HumanoidRootPart");
end;
end;
p22.headPart = p22.char:FindFirstChild("Head");
end;
end;
local u6 = {
Head = true,
["Left Arm"] = true,
["Right Arm"] = true,
["Left Leg"] = true,
["Right Leg"] = true,
LeftLowerArm = true,
RightLowerArm = true,
LeftUpperLeg = true,
RightUpperLeg = true
};
function v5.CharacterAdded(p23, p24, p25)
if p25 ~= l__Players__2.LocalPlayer then
return;
end;
if p23.childAddedConn then
p23.childAddedConn:Disconnect();
p23.childAddedConn = nil;
end;
if p23.childRemovedConn then
p23.childRemovedConn:Disconnect();
p23.childRemovedConn = nil;
end;
p23.char = p24;
p23.trackedLimbs = {};
p23.childAddedConn = p24.ChildAdded:Connect(function(p26)
if p26:IsA("BasePart") then
if u6[p26.Name] then
p23.trackedLimbs[p26] = true;
end;
if p26.Name == "Torso" or p26.Name == "UpperTorso" then
p23.torsoPart = p26;
end;
if p26.Name == "Head" then
p23.headPart = p26;
end;
end;
end);
p23.childRemovedConn = p24.ChildRemoved:Connect(function(p27)
p23.trackedLimbs[p27] = nil;
p23:CheckTorsoReference();
end);
for v74, v75 in pairs(p23.char:GetChildren()) do
if v75:IsA("BasePart") then
if u6[v75.Name] then
p23.trackedLimbs[v75] = true;
end;
if v75.Name == "Torso" or v75.Name == "UpperTorso" then
p23.torsoPart = v75;
end;
if v75.Name == "Head" then
p23.headPart = v75;
end;
end;
end;
end;
local function u7(p28, ...)
local v76 = {};
local v77 = "";
for v78, v79 in pairs({ ... }) do
v76[v79] = true;
if v77 == "" then
local v80 = "";
else
v80 = " or ";
end;
v77 = v77 .. v80 .. v79;
end;
local v81 = type(p28);
assert(v76[v81], v77 .. " type expected, got: " .. v81);
end;
function v5.SetMode(p29, p30)
u7(p30, "number");
for v82, v83 in pairs(u2) do
if v83 == p30 then
p29.mode = p30;
p29.behaviorFunction = p29.behaviors[p29.mode];
return;
end;
end;
error("Invalid mode number");
end;
function v5.GetObscuredParts(p31)
return p31.savedHits;
end;
function v5.Cleanup(p32)
for v84, v85 in pairs(p32.savedHits) do
v84.LocalTransparencyModifier = v85;
end;
end;
function v5.Update(p33, p34, p35, p36)
local v86 = nil;
if not p33.enabled or not p33.char then
return p35, p36;
end;
p33.camera = game.Workspace.CurrentCamera;
if not p33.humanoidRootPart then
local v87 = p33.char:FindFirstChildOfClass("Humanoid");
if v87 and v87.RootPart then
p33.humanoidRootPart = v87.RootPart;
else
p33.humanoidRootPart = p33.char:FindFirstChild("HumanoidRootPart");
if not p33.humanoidRootPart then
return p35, p36;
end;
end;
local u8 = nil;
u8 = p33.humanoidRootPart.AncestryChanged:Connect(function(p37, p38)
if p37 == p33.humanoidRootPart and not p38 then
p33.humanoidRootPart = nil;
if u8 and u8.Connected then
u8:Disconnect();
u8 = nil;
end;
end;
end);
end;
if not p33.torsoPart then
p33:CheckTorsoReference();
if not p33.torsoPart then
return p35, p36;
end;
end;
local v88 = {};
p33:behaviorFunction(v88);
local v89 = { p33.char };
local u9 = {};
local v90 = 0;
local v91 = {};
local v92 = {};
local v93 = 0.75;
local v94 = 0.75;
local v95 = p33.camera:GetPartsObscuringTarget({ p33.headPart and p33.headPart.CFrame.p or v88[1], p33.torsoPart and p33.torsoPart.CFrame.p or v88[2] }, v89);
for v96 = 1, #v95 do
local v97 = v95[v96];
v86 = v90 + 1;
v91[v97] = true;
for v98, v99 in pairs(v97:GetChildren()) do
if v99:IsA("Decal") then
v86 = v86 + 1;
break;
end;
if v99:IsA("Texture") then
v86 = v86 + 1;
break;
end;
end;
end;
if v86 > 0 then
v93 = math.pow(0.375 + 0.375 / v86, 1 / v86);
v94 = math.pow(0.25 + 0.25 / v86, 1 / v86);
end;
local v100 = p33.camera:GetPartsObscuringTarget(v88, v89);
local v101 = {};
for v102 = 1, #v100 do
local v103 = v100[v102];
v101[v103] = v91[v103] and v93 or v94;
if v103.Transparency < v101[v103] then
u9[v103] = true;
if not p33.savedHits[v103] then
p33.savedHits[v103] = v103.LocalTransparencyModifier;
end;
end;
for v104, v105 in pairs(v103:GetChildren()) do
if (v105:IsA("Decal") or v105:IsA("Texture")) and v105.Transparency < v101[v103] then
v101[v105] = v101[v103];
u9[v105] = true;
if not p33.savedHits[v105] then
p33.savedHits[v105] = v105.LocalTransparencyModifier;
end;
end;
end;
end;
for v106, v107 in pairs(p33.savedHits) do
if u9[v106] then
v106.LocalTransparencyModifier = v106.Transparency < 1 and (v101[v106] - v106.Transparency) / (1 - v106.Transparency) or 0;
else
v106.LocalTransparencyModifier = v107;
p33.savedHits[v106] = nil;
end;
end;
return p35, p36;
end;
return v5;
|
--[[
Utility function to log a Fusion-specific error, without halting execution.
]] |
local Package = script.Parent.Parent
local Types = require(Package.Types)
local messages = require(Package.Logging.messages)
local function logErrorNonFatal(messageID: string, errObj: Types.Error?, ...)
local formatString: string
if messages[messageID] ~= nil then
formatString = messages[messageID]
else
messageID = "unknownMessage"
formatString = messages[messageID]
end
local errorString
if errObj == nil then
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")", ...)
else
formatString = formatString:gsub("ERROR_MESSAGE", errObj.message)
errorString = string.format("[Fusion] " .. formatString .. "\n(ID: " .. messageID .. ")\n---- Stack trace ----\n" .. errObj.trace, ...)
end
task.spawn(function(...)
error(errorString:gsub("\n", "\n "), 0)
end, ...)
end
return logErrorNonFatal
|
-- Create superfolder for all part folders |
local MainPartFolder = workspace:FindFirstChild(Constants.ARCS_MAIN_FOLDER)
if not MainPartFolder then
MainPartFolder = Instance.new("Folder")
MainPartFolder.Name = Constants.ARCS_MAIN_FOLDER
MainPartFolder.Parent = workspace
end
|
--CONFIG |
local Peak = 0 -- Set this to your desired starting RPM or leave it set to 0 to choose the default peakRPM
|
--[[
This is a test file to demonstrate how ragdolls work. If you don't use
this file, you need to manually apply the Ragdoll tag to humanoids that
you want to ragdoll
--]] |
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPack = game:GetService("StarterPack")
local StarterPlayer = game:GetService("StarterPlayer")
script.ClassicSword.Parent = StarterPack
script.RocketLauncher.Parent = StarterPack
script.KillScript.Parent = StarterPlayer.StarterCharacterScripts
script.RagdollMe.Parent = StarterPlayer.StarterCharacterScripts
|
--- Creates a listable type from a singlular type |
function Util.MakeListableType(type)
local listableType = {
Listable = true,
Transform = type.Transform,
Validate = type.Validate,
Autocomplete = type.Autocomplete,
Parse = function(...)
return {type.Parse(...)}
end
}
return listableType
end
local function encodeCommandEscape(text)
return first(text:gsub("\\%$", string.char(20)))
end
local function decodeCommandEscape(text)
return first(text:gsub(string.char(20), "$"))
end
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB. |
wait(1)
while true do
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.Volume = (script.Parent.Volume*2)*11
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.EmitterSize = script.Parent.EmitterSize*10
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.Playing = script.Parent.Playing
script.Parent.Parent.Parent.Scripts.SoundBlock.Value.Sound2.DistortionSoundEffect.Level = (script.Parent.Volume*1.3)*3
wait()
end
|
-- собираем все наши размещения |
local tmp = script.Parent.WorldPosition:GetChildren()
|
-----------------------
--| Local Functions |--
----------------------- |
local function LimbBehavior(castPoints)
for _, limb in pairs(TrackedLimbs) do
if limb.Parent then
table.insert(castPoints, limb.Position)
end
end
end
local function MoveBehavior(castPoints)
for i = 1, MOVE_CASTS do
local position, velocity = Torso.Position, Torso.Velocity
local horizontalSpeed = Vector3.new(velocity.X, 0, velocity.Z).Magnitude / 2
local offsetVector = (i - 1) * Torso.CFrame.lookVector * horizontalSpeed
table.insert(castPoints, position + offsetVector)
end
end
local function CornerBehavior(castPoints)
local cframe = Torso.CFrame
local centerPoint = cframe.p
local rotation = cframe - centerPoint
local halfSize = Character:GetExtentsSize() / 2 --NOTE: Doesn't update w/ limb animations
table.insert(castPoints, centerPoint)
for _, factor in pairs(CORNER_FACTORS) do
table.insert(castPoints, centerPoint + (rotation * (halfSize * factor)))
end
end
local function CircleBehavior(castPoints)
local cframe = nil
if Mode == MODE.CIRCLE1 then
cframe = Torso.CFrame
else
local camCFrame = Camera.CoordinateFrame
cframe = camCFrame - camCFrame.p + Torso.Position
end
table.insert(castPoints, cframe.p)
for i = 0, CIRCLE_CASTS - 1 do
local angle = (2 * math.pi / CIRCLE_CASTS) * i
local offset = 3 * Vector3.new(math.cos(angle), math.sin(angle), 0)
table.insert(castPoints, cframe * offset)
end
end
local function LimbMoveBehavior(castPoints)
LimbBehavior(castPoints)
MoveBehavior(castPoints)
end
local function OnCharacterAdded(character)
Character = character
Torso = Character:WaitForChild('Torso')
TrackedLimbs = {}
for _, child in pairs(Character:GetChildren()) do
if child:IsA('BasePart') and LIMB_TRACKING_SET[child.Name] then
table.insert(TrackedLimbs, child)
end
end
end
local function OnWorkspaceChanged(property)
if property == 'CurrentCamera' then
local newCamera = workspace.CurrentCamera
if newCamera then
Camera = newCamera
end
end
end
|
-- An object which can listen for updates on another state object. |
export type Observer = PubTypes.Observer & {
_changeListeners: Set<() -> ()>,
_numChangeListeners: number
}
return nil
|
--[[
The reconciler is the mechanism in Roact that constructs the virtual tree
that later gets turned into concrete objects by the renderer.
Roact's reconciler is constructed with the renderer as an argument, which
enables switching to different renderers for different platforms or
scenarios.
When testing the reconciler itself, it's common to use `NoopRenderer` with
spies replacing some methods. The default (and only) reconciler interface
exposed by Roact right now uses `RobloxRenderer`.
]] |
local function createReconciler(renderer)
local reconciler
local mountVirtualNode
local updateVirtualNode
local unmountVirtualNode
--[[
Unmount the given virtualNode, replacing it with a new node described by
the given element.
Preserves host properties, depth, and legacyContext from parent.
]]
local function replaceVirtualNode(virtualNode, newElement)
local hostParent = virtualNode.hostParent
local hostKey = virtualNode.hostKey
local depth = virtualNode.depth
-- If the node that is being replaced has modified context, we need to
-- use the original *unmodified* context for the new node
-- The `originalContext` field will be nil if the context was unchanged
local context = virtualNode.originalContext or virtualNode.context
local parentLegacyContext = virtualNode.parentLegacyContext
unmountVirtualNode(virtualNode)
local newNode = mountVirtualNode(newElement, hostParent, hostKey, context, parentLegacyContext)
-- mountVirtualNode can return nil if the element is a boolean
if newNode ~= nil then
newNode.depth = depth
end
return newNode
end
--[[
Utility to update the children of a virtual node based on zero or more
updated children given as elements.
]]
local function updateChildren(virtualNode, hostParent, newChildElements)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
local removeKeys = {}
-- Changed or removed children
for childKey, childNode in pairs(virtualNode.children) do
local newElement = ElementUtils.getElementByKey(newChildElements, childKey)
local newNode = updateVirtualNode(childNode, newElement)
if newNode ~= nil then
virtualNode.children[childKey] = newNode
else
removeKeys[childKey] = true
end
end
for childKey in pairs(removeKeys) do
virtualNode.children[childKey] = nil
end
-- Added children
for childKey, newElement in ElementUtils.iterateElements(newChildElements) do
local concreteKey = childKey
if childKey == ElementUtils.UseParentKey then
concreteKey = virtualNode.hostKey
end
if virtualNode.children[childKey] == nil then
local childNode = mountVirtualNode(
newElement,
hostParent,
concreteKey,
virtualNode.context,
virtualNode.legacyContext
)
-- mountVirtualNode can return nil if the element is a boolean
if childNode ~= nil then
childNode.depth = virtualNode.depth + 1
virtualNode.children[childKey] = childNode
end
end
end
end
local function updateVirtualNodeWithChildren(virtualNode, hostParent, newChildElements)
updateChildren(virtualNode, hostParent, newChildElements)
end
local function updateVirtualNodeWithRenderResult(virtualNode, hostParent, renderResult)
if Type.of(renderResult) == Type.Element
or renderResult == nil
or typeof(renderResult) == "boolean"
then
updateChildren(virtualNode, hostParent, renderResult)
else
error(("%s\n%s"):format(
"Component returned invalid children:",
virtualNode.currentElement.source or "<enable element tracebacks>"
), 0)
end
end
--[[
Unmounts the given virtual node and releases any held resources.
]]
function unmountVirtualNode(virtualNode)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
local kind = ElementKind.of(virtualNode.currentElement)
if kind == ElementKind.Host then
renderer.unmountHostNode(reconciler, virtualNode)
elseif kind == ElementKind.Function then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
elseif kind == ElementKind.Stateful then
virtualNode.instance:__unmount()
elseif kind == ElementKind.Portal then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
elseif kind == ElementKind.Fragment then
for _, childNode in pairs(virtualNode.children) do
unmountVirtualNode(childNode)
end
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
end
local function updateFunctionVirtualNode(virtualNode, newElement)
local children = newElement.component(newElement.props)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)
return virtualNode
end
local function updatePortalVirtualNode(virtualNode, newElement)
local oldElement = virtualNode.currentElement
local oldTargetHostParent = oldElement.props.target
local targetHostParent = newElement.props.target
assert(renderer.isHostObject(targetHostParent), "Expected target to be host object")
if targetHostParent ~= oldTargetHostParent then
return replaceVirtualNode(virtualNode, newElement)
end
local children = newElement.props[Children]
updateVirtualNodeWithChildren(virtualNode, targetHostParent, children)
return virtualNode
end
local function updateFragmentVirtualNode(virtualNode, newElement)
updateVirtualNodeWithChildren(virtualNode, virtualNode.hostParent, newElement.elements)
return virtualNode
end
--[[
Update the given virtual node using a new element describing what it
should transform into.
`updateVirtualNode` will return a new virtual node that should replace
the passed in virtual node. This is because a virtual node can be
updated with an element referencing a different component!
In that case, `updateVirtualNode` will unmount the input virtual node,
mount a new virtual node, and return it in this case, while also issuing
a warning to the user.
]]
function updateVirtualNode(virtualNode, newElement, newState)
if config.internalTypeChecks then
internalAssert(Type.of(virtualNode) == Type.VirtualNode, "Expected arg #1 to be of type VirtualNode")
end
if config.typeChecks then
assert(
Type.of(newElement) == Type.Element or typeof(newElement) == "boolean" or newElement == nil,
"Expected arg #2 to be of type Element, boolean, or nil"
)
end
-- If nothing changed, we can skip this update
if virtualNode.currentElement == newElement and newState == nil then
return virtualNode
end
if typeof(newElement) == "boolean" or newElement == nil then
unmountVirtualNode(virtualNode)
return nil
end
if virtualNode.currentElement.component ~= newElement.component then
return replaceVirtualNode(virtualNode, newElement)
end
local kind = ElementKind.of(newElement)
local shouldContinueUpdate = true
if kind == ElementKind.Host then
virtualNode = renderer.updateHostNode(reconciler, virtualNode, newElement)
elseif kind == ElementKind.Function then
virtualNode = updateFunctionVirtualNode(virtualNode, newElement)
elseif kind == ElementKind.Stateful then
shouldContinueUpdate = virtualNode.instance:__update(newElement, newState)
elseif kind == ElementKind.Portal then
virtualNode = updatePortalVirtualNode(virtualNode, newElement)
elseif kind == ElementKind.Fragment then
virtualNode = updateFragmentVirtualNode(virtualNode, newElement)
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
-- Stateful components can abort updates via shouldUpdate. If that
-- happens, we should stop doing stuff at this point.
if not shouldContinueUpdate then
return virtualNode
end
virtualNode.currentElement = newElement
return virtualNode
end
--[[
Constructs a new virtual node but not does mount it.
]]
local function createVirtualNode(element, hostParent, hostKey, context, legacyContext)
if config.internalTypeChecks then
internalAssert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
internalAssert(typeof(context) == "table" or context == nil, "Expected arg #4 to be of type table or nil")
internalAssert(
typeof(legacyContext) == "table" or legacyContext == nil,
"Expected arg #5 to be of type table or nil"
)
end
if config.typeChecks then
assert(hostKey ~= nil, "Expected arg #3 to be non-nil")
assert(
Type.of(element) == Type.Element or typeof(element) == "boolean",
"Expected arg #1 to be of type Element or boolean"
)
end
return {
[Type] = Type.VirtualNode,
currentElement = element,
depth = 1,
children = {},
hostParent = hostParent,
hostKey = hostKey,
-- Legacy Context API
-- A table of context values inherited from the parent node
legacyContext = legacyContext,
-- A saved copy of the parent context, used when replacing a node
parentLegacyContext = legacyContext,
-- Context API
-- A table of context values inherited from the parent node
context = context or {},
-- A saved copy of the unmodified context; this will be updated when
-- a component adds new context and used when a node is replaced
originalContext = nil,
}
end
local function mountFunctionVirtualNode(virtualNode)
local element = virtualNode.currentElement
local children = element.component(element.props)
updateVirtualNodeWithRenderResult(virtualNode, virtualNode.hostParent, children)
end
local function mountPortalVirtualNode(virtualNode)
local element = virtualNode.currentElement
local targetHostParent = element.props.target
local children = element.props[Children]
assert(renderer.isHostObject(targetHostParent), "Expected target to be host object")
updateVirtualNodeWithChildren(virtualNode, targetHostParent, children)
end
local function mountFragmentVirtualNode(virtualNode)
local element = virtualNode.currentElement
local children = element.elements
updateVirtualNodeWithChildren(virtualNode, virtualNode.hostParent, children)
end
--[[
Constructs a new virtual node and mounts it, but does not place it into
the tree.
]]
function mountVirtualNode(element, hostParent, hostKey, context, legacyContext)
if config.internalTypeChecks then
internalAssert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
internalAssert(
typeof(legacyContext) == "table" or legacyContext == nil,
"Expected arg #5 to be of type table or nil"
)
end
if config.typeChecks then
assert(hostKey ~= nil, "Expected arg #3 to be non-nil")
assert(
Type.of(element) == Type.Element or typeof(element) == "boolean",
"Expected arg #1 to be of type Element or boolean"
)
end
-- Boolean values render as nil to enable terse conditional rendering.
if typeof(element) == "boolean" then
return nil
end
local kind = ElementKind.of(element)
local virtualNode = createVirtualNode(element, hostParent, hostKey, context, legacyContext)
if kind == ElementKind.Host then
renderer.mountHostNode(reconciler, virtualNode)
elseif kind == ElementKind.Function then
mountFunctionVirtualNode(virtualNode)
elseif kind == ElementKind.Stateful then
element.component:__mount(reconciler, virtualNode)
elseif kind == ElementKind.Portal then
mountPortalVirtualNode(virtualNode)
elseif kind == ElementKind.Fragment then
mountFragmentVirtualNode(virtualNode)
else
error(("Unknown ElementKind %q"):format(tostring(kind), 2))
end
return virtualNode
end
--[[
Constructs a new Roact virtual tree, constructs a root node for
it, and mounts it.
]]
local function mountVirtualTree(element, hostParent, hostKey)
if config.typeChecks then
assert(Type.of(element) == Type.Element, "Expected arg #1 to be of type Element")
assert(renderer.isHostObject(hostParent) or hostParent == nil, "Expected arg #2 to be a host object")
end
if hostKey == nil then
hostKey = "RoactTree"
end
local tree = {
[Type] = Type.VirtualTree,
[InternalData] = {
-- The root node of the tree, which starts into the hierarchy of
-- Roact component instances.
rootNode = nil,
mounted = true,
},
}
tree[InternalData].rootNode = mountVirtualNode(element, hostParent, hostKey)
return tree
end
--[[
Unmounts the virtual tree, freeing all of its resources.
No further operations should be done on the tree after it's been
unmounted, as indicated by its the `mounted` field.
]]
local function unmountVirtualTree(tree)
local internalData = tree[InternalData]
if config.typeChecks then
assert(Type.of(tree) == Type.VirtualTree, "Expected arg #1 to be a Roact handle")
assert(internalData.mounted, "Cannot unmounted a Roact tree that has already been unmounted")
end
internalData.mounted = false
if internalData.rootNode ~= nil then
unmountVirtualNode(internalData.rootNode)
end
end
--[[
Utility method for updating the root node of a virtual tree given a new
element.
]]
local function updateVirtualTree(tree, newElement)
local internalData = tree[InternalData]
if config.typeChecks then
assert(Type.of(tree) == Type.VirtualTree, "Expected arg #1 to be a Roact handle")
assert(Type.of(newElement) == Type.Element, "Expected arg #2 to be a Roact Element")
end
internalData.rootNode = updateVirtualNode(internalData.rootNode, newElement)
return tree
end
reconciler = {
mountVirtualTree = mountVirtualTree,
unmountVirtualTree = unmountVirtualTree,
updateVirtualTree = updateVirtualTree,
createVirtualNode = createVirtualNode,
mountVirtualNode = mountVirtualNode,
unmountVirtualNode = unmountVirtualNode,
updateVirtualNode = updateVirtualNode,
updateVirtualNodeWithChildren = updateVirtualNodeWithChildren,
updateVirtualNodeWithRenderResult = updateVirtualNodeWithRenderResult,
}
return reconciler
end
return createReconciler
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]] |
function Promise.prototype:andThen(successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise.new(function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(successHandler, resolve, reject)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(failureHandler, resolve, reject)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject("Promise is cancelled")
end
end, self)
end
|
-- Events to listen to selection changes |
Selection.ItemsAdded = Signal.new()
Selection.ItemsRemoved = Signal.new()
Selection.PartsAdded = Signal.new()
Selection.PartsRemoved = Signal.new()
Selection.FocusChanged = Signal.new()
Selection.Cleared = Signal.new()
Selection.Changed = Signal.new()
function Selection.IsSelected(Item)
-- Returns whether `Item` is selected or not
-- Check and return item presence in index
return Selection.ItemIndex[Item];
end;
local function CollectParts(Item, Table)
-- Adds parts found in `Item` to `Table`
-- Collect parts
if Item:IsA 'BasePart' then
Table[#Table + 1] = Item
-- Collect parts inside of groups
else
local Items = Item:GetDescendants()
for _, Item in ipairs(Items) do
if Item:IsA 'BasePart' then
Table[#Table + 1] = Item
end
end
end
end
function Selection.Add(Items, RegisterHistory)
-- Adds the given items to the selection
-- Get core API
local Core = GetCore();
-- Go through and validate each given item
local SelectableItems = {};
for _, Item in pairs(Items) do
-- Make sure each item is valid and not already selected
if Item.Parent and (not Selection.ItemIndex[Item]) then
table.insert(SelectableItems, Item);
end;
end;
local OldSelection = Selection.Items;
-- Track parts in new selection
local Parts = {}
-- Go through the valid new selection items
for _, Item in pairs(SelectableItems) do
-- Add each valid item to the selection
Selection.ItemIndex[Item] = true;
CreateSelectionBoxes(Item)
-- Create maid for cleaning up item listeners
local ItemMaid = Maid.new()
Selection.Maid[Item] = ItemMaid
-- Deselect items that are destroyed
ItemMaid.RemovalListener = Item.AncestryChanged:Connect(function (Object, Parent)
if Parent == nil then
Selection.Remove({ Item })
end
end)
-- Collect parts within item
CollectParts(Item, Parts)
-- Listen for new parts in groups
local IsGroup = not Item:IsA 'BasePart' or nil
ItemMaid.NewParts = IsGroup and Item.DescendantAdded:Connect(function (Descendant)
if Descendant:IsA 'BasePart' then
local NewRefCount = (Selection.PartIndex[Descendant] or 0) + 1
Selection.PartIndex[Descendant] = NewRefCount
Selection.Parts = Support.Keys(Selection.PartIndex)
if NewRefCount == 1 then
Selection.PartsAdded:Fire { Descendant }
end
end
end)
ItemMaid.RemovingParts = IsGroup and Item.DescendantRemoving:Connect(function (Descendant)
if Selection.PartIndex[Descendant] then
local NewRefCount = (Selection.PartIndex[Descendant] or 0) - 1
Selection.PartIndex[Descendant] = (NewRefCount > 0) and NewRefCount or nil
if NewRefCount == 0 then
Selection.Parts = Support.Keys(Selection.PartIndex)
Selection.PartsRemoved:Fire { Descendant }
end
end
end)
end
-- Update selected item list
Selection.Items = Support.Keys(Selection.ItemIndex);
-- Create a history record for this selection change, if requested
if RegisterHistory and #SelectableItems > 0 then
TrackSelectionChange(OldSelection);
end;
-- Register references to new parts
local NewParts = {}
for _, Part in pairs(Parts) do
local NewRefCount = (Selection.PartIndex[Part] or 0) + 1
Selection.PartIndex[Part] = NewRefCount
if NewRefCount == 1 then
NewParts[#NewParts + 1] = Part
end
end
-- Update parts list
if #NewParts > 0 then
Selection.Parts = Support.Keys(Selection.PartIndex)
Selection.PartsAdded:Fire(NewParts)
end
-- Fire relevant events
if #SelectableItems > 0 then
Selection.ItemsAdded:Fire(SelectableItems)
Selection.Changed:Fire()
end
end;
function Selection.Remove(Items, RegisterHistory)
-- Removes the given items from the selection
-- Go through and validate each given item
local DeselectableItems = {};
for _, Item in pairs(Items) do
-- Make sure each item is actually selected
if Selection.IsSelected(Item) then
table.insert(DeselectableItems, Item);
end;
end;
local OldSelection = Selection.Items;
-- Track parts in removing selection
local Parts = {}
-- Go through the valid deselectable items
for _, Item in pairs(DeselectableItems) do
-- Remove item from selection
Selection.ItemIndex[Item] = nil;
RemoveSelectionBoxes(Item)
-- Stop tracking item's parts
Selection.Maid[Item] = nil
-- Get parts associated with item
CollectParts(Item, Parts)
end;
-- Update selected item list
Selection.Items = Support.Keys(Selection.ItemIndex);
-- Create a history record for this selection change, if requested
if RegisterHistory and #DeselectableItems > 0 then
TrackSelectionChange(OldSelection);
end;
-- Clear references to removing parts
local RemovingParts = {}
for _, Part in pairs(Parts) do
local NewRefCount = (Selection.PartIndex[Part] or 0) - 1
Selection.PartIndex[Part] = (NewRefCount > 0) and NewRefCount or nil
if NewRefCount == 0 then
RemovingParts[#RemovingParts + 1] = Part
end
end
-- Update parts list
if #RemovingParts > 0 then
Selection.Parts = Support.Keys(Selection.PartIndex)
Selection.PartsRemoved:Fire(RemovingParts)
end
-- Fire relevant events
if #DeselectableItems > 0 then
Selection.ItemsRemoved:Fire(DeselectableItems)
Selection.Changed:Fire()
end
end;
function Selection.Clear(RegisterHistory)
-- Clears all items from selection
-- Remove all selected items
Selection.Remove(Selection.Items, RegisterHistory);
-- Fire relevant events
Selection.Cleared:Fire();
end;
function Selection.Replace(Items, RegisterHistory)
-- Replaces the current selection with the given new items
-- Save old selection reference for history
local OldSelection = Selection.Items;
-- Find new items
local NewItems = {}
for _, Item in ipairs(Items) do
if not Selection.ItemIndex[Item] then
table.insert(NewItems, Item)
end
end
-- Find removing items
local RemovingItems = {}
local NewItemIndex = Support.FlipTable(Items)
for _, Item in ipairs(Selection.Items) do
if not NewItemIndex[Item] then
table.insert(RemovingItems, Item)
end
end
-- Update selection
if #RemovingItems > 0 then
Selection.Remove(RemovingItems, false)
end
if #NewItems > 0 then
Selection.Add(NewItems, false)
end
-- Create a history record for this selection change, if requested
if RegisterHistory then
TrackSelectionChange(OldSelection);
end;
end;
local function IsVisible(Item)
return Item:IsA 'Model' or Item:IsA 'BasePart'
end
local function GetVisibleFocus(Item)
-- Returns a visible focus representing the item
-- Return nil if no focus
if not Item then
return nil
end
-- Return focus if it's visible
if IsVisible(Item) then
return Item
-- Return first visible item within focus if not visible itself
elseif Item then
return Item:FindFirstChildWhichIsA('BasePart') or
Item:FindFirstChildWhichIsA('Model') or
Item:FindFirstChildWhichIsA('BasePart', true) or
Item:FindFirstChildWhichIsA('Model', true)
end
end
function Selection.SetFocus(Item)
-- Selects `Item` as the focused selection item
-- Ensure focus has changed
local Focus = GetVisibleFocus(Item)
if Selection.Focus == Focus then
return
end
-- Set new focus item
Selection.Focus = Focus
-- Fire relevant events
Selection.FocusChanged:Fire(Focus)
end
function FocusOnLastSelectedPart()
-- Sets the last part of the selection as the focus
-- If selection is empty, clear the focus
if #Selection.Items == 0 then
Selection.SetFocus(nil);
-- Otherwise, focus on the last part in the selection
else
Selection.SetFocus(Selection.Items[#Selection.Items]);
end;
end;
|
-- Create the game state machine based on the attribute of this script |
local gameStateMachine = GameManager.CreateGameState(Current_Gamemode, Current_GameStateObject)
|
-- Create component |
local ScrollingFrame = Roact.PureComponent:extend 'ScrollingFrame'
|
--See: https://www.roblox.com/library/265487607/Cutter |
local function GetCenterOfMass(parts)
local TotalMass = 0
local SumOfMasses = Vector3.new(0, 0, 0)
for i = 1, #parts do
local part = parts[i]
TotalMass = TotalMass + part:GetMass()
SumOfMasses = SumOfMasses + part:GetMass() * part.Position
end
return SumOfMasses/TotalMass, TotalMass
end
local function GetBackVector(CFrameValue)
local _, _, _, _, _, r6, _, _, r9, _, _, r12 = CFrameValue:components()
return Vector3.new(r6,r9,r12)
end
local function GetCFrameFromTopBack(CFrameAt, Top, Back)
local Right = Top:Cross(Back)
return CFrame.new(CFrameAt.x, CFrameAt.y, CFrameAt.z, Right.x, Top.x, Back.x, Right.y, Top.y, Back.y,Right.z, Top.z, Back.z)
end
local function GetRotationInXZPlane(cframe)
local Back = GetBackVector(cframe)
return GetCFrameFromTopBack(cframe.p, Vector3.new(0, 1, 0), Vector3.new(Back.x, 0, Back.z).unit)
end
|
-- Handle new player join events |
Players.PlayerAdded:Connect(handlePlayerAdded)
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 3000; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
----------------------------------------------------------------------------------------------- |
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
script.Parent.CarName.Text = car.Name
car.Body.CarName.Value.VehicleSeat.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)
|
-- DONT EDIT NOTHING IN THE SCRIPT IF YOU DONT KNOW WHAT YOU DOING!
-- This script is for iiFireGamingOfDoom. |
wait(.1)
local InputService=game:GetService("UserInputService")
local Camera=game.Workspace.CurrentCamera
local Player=game.Players.LocalPlayer
local Character=Player.Character
local Head=Character.Head
local Torso=Character.Torso
local RootPart=Character.HumanoidRootPart
local RootJoint=RootPart.RootJoint
local Neck=Torso.Neck
Camera.FieldOfView=90
Camera.CameraType="Scriptable"
InputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local v3=Vector3.new
local cf=CFrame.new
local components=cf().components
local inverse=cf().inverse
local fromAxisAngle=CFrame.fromAxisAngle
local atan,atan2=math.atan,math.atan2
local acos=math.acos
local function toAxisAngleFromVector(v)
local z=v.z
return z*z<0.99999 and v3(v.y,-v.x,0).unit*acos(-z) or v3()
end
local function AxisAngleLookOrientation(c,v,t)--CFrame,Vector,Tween
local c=c-c.p
local rv=(inverse(c)*v).unit
local rz=rv.z
return rz*rz<0.99999 and c*fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or c
end
local function AxisAngleLookNew(v,t)--CFrame,Vector,Tween
local rv=v.unit
local rz=rv.z
return rz*rz<0.99999 and fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or cf()
end
local function AxisAngleLook(c,v,t)--CFrame,Vector,Tween
local rv=(inverse(c)*v).unit
local rz=rv.z
return rz*rz<0.99999 and c*fromAxisAngle(v3(rv.y,-rv.x,0),acos(-rz)*(t or 1)) or c
end
local Sensitivity=0.005
local CameraDirection=Vector3.new(0,0,0)
local function EulerAnglesYX(l)
local x,z=l.x,l.z
return atan(l.y/(x*x+z*z)^0.5),-atan2(x,-z)
end
local function AnglesXY(l)
local z=l.z
return atan2(l.y,-z),-atan2(l.x,-z)
end
local function MouseMoved(Input)
if Input.UserInputType==Enum.UserInputType.MouseMovement then
local dx,dy=Input.Delta.x*Sensitivity,Input.Delta.y*Sensitivity
local m2=dx*dx+dy*dy
if m2>0 then
CameraDirection=(AxisAngleLookOrientation(RootPart.CFrame,CameraDirection)*fromAxisAngle(v3(-dy,-dx,0),m2^0.5)).lookVector
end
local RootOrientation=RootPart.CFrame-RootPart.Position
local RelativeDirection=RootOrientation:inverse()*CameraDirection
local AngX,AngY=AnglesXY(RelativeDirection)--RootOrientation:inverse()*
if AngX<-1.57*11/12 then
local y,z,c,s=RelativeDirection.y,RelativeDirection.z,math.cos(-1.57*11/12-AngX),-math.sin(-1.57*11/12-AngX)
z,y=z*c-y*s,z*s+y*c
CameraDirection=RootOrientation*v3(RelativeDirection.x<0 and -(1-y*y-z*z)^0.5 or (1-y*y-z*z)^0.5,y,z)
elseif AngX>1.57*11/12 then
local y,z,c,s=RelativeDirection.y,RelativeDirection.z,math.cos(1.57*11/12-AngX),-math.sin(1.57*11/12-AngX)
z,y=z*c-y*s,z*s+y*c
CameraDirection=RootOrientation*v3(RelativeDirection.x<0 and -(1-y*y-z*z)^0.5 or (1-y*y-z*z)^0.5,y,z)
end
end
end
local Mouse=Player:GetMouse()
local Zoom=-0.5
Mouse.KeyDown:connect(function(k)
if k=="e" then
Zoom=-0.5
elseif k=="q" then
Zoom=-0.5
end
end)
InputService.InputChanged:connect(MouseMoved)
Neck.C1=cf()
local _
local DirectionBound=3.14159/3
local CurrentAngY=0
local function CameraUpdate()
Camera.CameraType="Scriptable"
local cx,cz=CameraDirection.x,CameraDirection.z
local rvx,rvz=RootPart.Velocity.x,RootPart.Velocity.z
if rvx*rvx+rvz*rvz>4 and cx*rvx+cz*rvz<-0.5*(cx*cx+cz*cz)^0.5*(rvx*rvx+rvz*rvz)^0.5 then
DirectionBound=math.min(DirectionBound*0.9,math.abs(CurrentAngY*0.9))
else
DirectionBound=DirectionBound*0.1+3.14159/3*0.9
end
local AngX,AngY=EulerAnglesYX((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection)
if AngY>DirectionBound then
RootPart.CFrame=RootPart.CFrame*CFrame.Angles(0,AngY-DirectionBound,0)
elseif AngY<-DirectionBound then
RootPart.CFrame=RootPart.CFrame*CFrame.Angles(0,AngY+DirectionBound,0)
end
_,CurrentAngY=EulerAnglesYX((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection)
local CameraOrientation=AxisAngleLookNew((RootPart.CFrame-RootPart.Position):inverse()*CameraDirection,1)
Neck.C0=CFrame.new(0,1,0)*CameraOrientation*CFrame.new(0,0.5,0)
local PreCam=AxisAngleLook(RootPart.CFrame*cf(0,1,0),RootPart.CFrame*v3(0,1,0)+CameraDirection)*CFrame.new(0,0.825,0)
if Zoom==8 then
local Part,Position=Workspace:findPartOnRay(Ray.new(PreCam.p,PreCam.lookVector*-8),Character)
Camera.CoordinateFrame=PreCam*CFrame.new(0,0,(Position-PreCam.p).magnitude)
else
Camera.CoordinateFrame=PreCam*CFrame.new(0,0,Zoom)
end
end
game:GetService("RunService").RenderStepped:connect(CameraUpdate)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 984 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1100 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8250 -- Use sliders to manipulate values
Tune.Redline = 8750 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5250
Tune.PeakSharpness = 5.8
Tune.CurveMult = 0.294
--Incline Compensation
Tune.InclineComp = 1.5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 400 -- RPM acceleration when clutch is off
Tune.RevDecay = 300 -- RPM decay when clutch is off
Tune.RevBounce = 450 -- RPM kickback from redline
Tune.IdleThrottle = 0 -- Percent throttle at idle
Tune.ClutchTol = 450 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--Scripted by DermonDarble |
local car = script.Parent
local stats = car.Configurations
local Raycast = require(script.RaycastModule)
local mass = 0
for i, v in pairs(car:GetChildren()) do
if v:IsA("BasePart") then
mass = mass + (v:GetMass() * 196.2)
end
end
local bodyPosition = Instance.new("BodyPosition", car.Chassis)
bodyPosition.MaxForce = Vector3.new()
local bodyGyro = Instance.new("BodyGyro", car.Chassis)
bodyGyro.MaxTorque = Vector3.new()
local function UpdateThruster(thruster)
-- Raycasting
local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value) --game.Workspace:FindPartOnRay(ray, car)
local thrusterHeight = (position - thruster.Position).magnitude
-- Wheel
local wheelWeld = thruster:FindFirstChild("WheelWeld")
wheelWeld.C0 = CFrame.new(0, -math.min(thrusterHeight, stats.Height.Value * 0.8) + (wheelWeld.Part1.Size.Y / 2), 0)
-- Wheel turning
local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
if offset.Z < 0 then
local direction = 1
if speed.Z > 0 then
direction = -1
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
end
-- Particles
if hit and thruster.Velocity.magnitude >= 5 then
wheelWeld.Part1.ParticleEmitter.Enabled = true
else
wheelWeld.Part1.ParticleEmitter.Enabled = false
end
end
car.DriveSeat.Changed:connect(function(property)
if property == "Occupant" then
if car.DriveSeat.Occupant then
local player = game.Players:GetPlayerFromCharacter(car.DriveSeat.Occupant.Parent)
if player then
car.DriveSeat:SetNetworkOwner(player)
local localCarScript = script.LocalCarScript:Clone()
localCarScript.Parent = player.PlayerGui
localCarScript.Car.Value = car
localCarScript.Disabled = false
end
else
car.DriveSeat:SetNetworkOwnershipAuto()
end
end
end)
spawn(function()
while true do
game:GetService("RunService").Stepped:wait()
for i, part in pairs(car:GetChildren()) do
if part.Name == "Thruster" then
UpdateThruster(part)
end
end
if car.DriveSeat.Occupant then
bodyPosition.MaxForce = Vector3.new()
bodyGyro.MaxTorque = Vector3.new()
else
local hit, position, normal = Raycast.new(car.Chassis.Position, car.Chassis.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value)
if hit and hit.CanCollide then
bodyPosition.MaxForce = Vector3.new(mass / 5, math.huge, mass / 5)
bodyPosition.Position = (CFrame.new(position, position + normal) * CFrame.new(0, 0, -stats.Height.Value + 0.5)).p
bodyGyro.MaxTorque = Vector3.new(math.huge, 0, math.huge)
bodyGyro.CFrame = CFrame.new(position, position + normal) * CFrame.Angles(-math.pi/2, 0, 0)
else
bodyPosition.MaxForce = Vector3.new()
bodyGyro.MaxTorque = Vector3.new()
end
end
end
end)
|
-- Other |
local MainBase = script.Parent:WaitForChild("MainBase")
local BottomBase = MainBase:WaitForChild("Bottom")
local WaterLoop = BottomBase:WaitForChild("WaterLoop")
local IsTweeningVolumeSession = 0
|
--[=[
@tag Component Class
`Construct` is called before the component is started, and should be used
to construct the component instance.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:Construct()
self.SomeData = 32
self.OtherStuff = "HelloWorld"
end
```
]=] |
function Component:Construct() end
|
--/Recoil Modification |
module.camRecoil = {
RecoilUp = 1.1
,RecoilTilt = 1
,RecoilLeft = .9
,RecoilRight = .9
}
module.gunRecoil = {
RecoilUp = 1.1
,RecoilTilt = 1
,RecoilLeft = .9
,RecoilRight = .9
}
module.AimRecoilReduction = 1
module.AimSpreadReduction = 1
module.MinRecoilPower = 1
module.MaxRecoilPower = 1
module.RecoilPowerStepAmount = 1
module.MinSpread = 1
module.MaxSpread = 1
module.AimInaccuracyStepAmount = 1
module.AimInaccuracyDecrease = 1
module.WalkMult = 1
module.MuzzleVelocityMod = 1
return module
|
--// Renders |
local L_136_
L_81_:connect(function()
if L_15_ then
L_131_, L_132_ = L_131_ or 0, L_132_ or 0
if L_134_ == nil or L_133_ == nil then
L_134_ = L_30_.C0
L_133_ = L_30_.C1
end
local L_239_ = (math.sin(L_125_ * L_127_ / 2) * L_126_)
local L_240_ = (math.sin(L_125_ * L_127_) * L_126_)
local L_241_ = CFrame.new(L_239_, L_240_, 0.02)
local L_242_ = (math.sin(L_121_ * L_124_ / 2) * L_123_)
local L_243_ = (math.cos(L_121_ * L_124_) * L_123_)
local L_244_ = CFrame.new(L_242_, L_243_, 0.02)
if L_118_ then
L_125_ = L_125_ + .017
if L_23_.WalkAnimEnabled == true then
L_119_ = L_241_
else
L_119_ = CFrame.new()
end
else
L_125_ = 0
L_119_ = CFrame.new()
end
L_117_.t = Vector3.new(L_112_, L_113_, 0)
local L_245_ = L_117_.p
local L_246_ = L_245_.X / L_114_ * (L_46_ and L_116_ or L_115_)
local L_247_ = L_245_.Y / L_114_ * (L_46_ and L_116_ or L_115_)
L_5_.CFrame = L_5_.CFrame:lerp(L_5_.CFrame * L_120_, 0.2)
if L_46_ then
L_108_ = CFrame.Angles(math.rad(-L_246_), math.rad(L_246_), math.rad(L_247_)) * CFrame.fromAxisAngle(Vector3.new(5, 0, -1), math.rad(L_246_))
L_121_ = 0
L_122_ = CFrame.new()
elseif not L_46_ then
L_108_ = CFrame.Angles(math.rad(-L_247_), math.rad(-L_246_), math.rad(-L_246_)) * CFrame.fromAxisAngle(L_29_.Position, math.rad(-L_247_))
L_121_ = L_121_ + 0.017
L_122_ = L_244_
end
if L_23_.SwayEnabled == true then
L_30_.C0 = L_30_.C0:lerp(L_134_ * L_108_ * L_119_ * L_122_, 0.1)
else
L_30_.C0 = L_30_.C0:lerp(L_134_ * L_119_, 0.1)
end
if L_49_ and not L_52_ and L_54_ and not L_46_ and not L_48_ and not Shooting then
L_30_.C1 = L_30_.C1:lerp(L_30_.C0 * L_23_.SprintPos, 0.1)
elseif not L_49_ and not L_52_ and not L_54_ and not L_46_ and not L_48_ and not Shooting then
L_30_.C1 = L_30_.C1:lerp(CFrame.new(), 0.1)
end
if L_46_ and not L_49_ then
if not L_47_ then
L_67_ = L_23_.AimCamRecoil
L_66_ = L_23_.AimGunRecoil
L_68_ = L_23_.AimKickback
end
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 then
L_30_.C1 = L_30_.C1:lerp(L_30_.C0 * CFrame.new(L_105_.position), L_23_.AimSpeed)
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = true
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_36_
L_82_.MouseDeltaSensitivity = L_36_
end
elseif not L_46_ and not L_49_ and L_15_ then
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 then
L_30_.C1 = L_30_.C1:lerp(CFrame.new(L_105_.position) * L_106_, L_23_.UnaimSpeed)
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = false
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_36_
L_82_.MouseDeltaSensitivity = L_37_
end
end
if Recoiling then
L_120_ = CFrame.Angles(L_67_, 0, 0)
--cam.CoordinateFrame = cam.CoordinateFrame * CFrame.fromEulerAnglesXYZ(math.rad(camrecoil*math.random(0,3)), math.rad(camrecoil*math.random(-1,1)), math.rad(camrecoil*math.random(-1,1)))
L_30_.C0 = L_30_.C0:lerp(L_30_.C0 * CFrame.new(0, 0, L_66_) * CFrame.Angles(-math.rad(L_68_), 0, 0), 0.3)
elseif not Recoiling then
L_120_ = CFrame.Angles(0, 0, 0)
L_30_.C0 = L_30_.C0:lerp(CFrame.new(), 0.2)
end
if L_47_ then
L_3_:WaitForChild('Humanoid').Jump = false
end
if L_15_ then
L_5_.FieldOfView = L_5_.FieldOfView * (1 - L_23_.ZoomSpeed) + (L_74_ * L_23_.ZoomSpeed)
if (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude >= 2 then
L_67_ = L_23_.AimCamRecoil
L_66_ = L_23_.AimGunRecoil
L_68_ = L_23_.AimKickback
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = true
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_36_
L_82_.MouseDeltaSensitivity = L_36_
elseif (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude < 2 and not L_46_ and not L_47_ then
L_67_ = L_23_.camrecoil
L_66_ = L_23_.gunrecoil
L_68_ = L_23_.Kickback
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Visible = false
L_27_:WaitForChild('Sense'):WaitForChild('Sensitivity').Text = L_36_
L_82_.MouseDeltaSensitivity = L_37_
end
end
if L_15_ and L_23_.CameraGo then --and (char.Head.Position - cam.CoordinateFrame.p).magnitude < 2 then
L_4_.TargetFilter = game.Workspace
local L_248_ = L_3_:WaitForChild("HumanoidRootPart").CFrame * CFrame.new(0, 1.5, 0) * CFrame.new(L_3_:WaitForChild("Humanoid").CameraOffset)
L_33_.C0 = L_8_.CFrame:toObjectSpace(L_248_)
L_33_.C1 = CFrame.Angles(-math.asin((L_4_.Hit.p - L_4_.Origin.p).unit.y), 0, 0)
L_82_.MouseIconEnabled = false
end
if L_15_ and (L_3_.Head.Position - L_5_.CoordinateFrame.p).magnitude >= 2 then
L_4_.Icon = "http://www.roblox.com/asset?id=" .. L_23_.TPSMouseIcon
L_82_.MouseIconEnabled = true
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 1
L_3_['Left Arm'].LocalTransparencyModifier = 1
end
end;
end
end)
|
-- Create checkpoint sound |
local checkpointSound = Instance.new("Sound")
checkpointSound.SoundId = "rbxassetid://4110925712"
local Soundscape = game.Soundscape
local RaceFinishedSound = Soundscape:FindFirstChild("RaceFinishedSound")
|
-- Better don't change anything. This script is WIP v.0.2
-- This screen gui doesn't work if your game has day and night loop |
game:GetService("RunService").RenderStepped:Connect(function()
if (Rake.Position - Character.HumanoidRootPart.Position).magnitude<70 and Debounce1 == false then
Debounce1 = true
NightTheme:Pause()
Found:Play()
FlashEffect.BackgroundTransparency = 0.6
wait(0.4)
ScreenShake.Disabled = false
FlashEffect.BackgroundTransparency = 1
RakeTheme:Play()
end
if (Rake.Position - Character.HumanoidRootPart.Position).magnitude>70 and Debounce1 == true then
Debounce1 = false
NightTheme:Play()
ScreenShake.Disabled = true
FlashEffect.BackgroundTransparency = 1
RakeTheme:Stop()
end
end)
|
-- Misc -- |
local CharacterTable = {}
local function OnCharacterAdded(Character : Model)
if table.find(CharacterTable, Character.Name) then return end
CharacterTable[Character.Name] = {}
CharacterTable[Character.Name].LegController = LegController.new(Character)
Character.Destroying:Connect(function()
CharacterTable[Character.Name].LegController:Destroy()
CharacterTable[Character.Name] = nil
end)
end
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local BOVact = 0
local BOVact2 = 0
local BOV_Loudness = 5 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 1 --max pitch of the BOV (not exact so might have to mess with it)
local TurboLoudness = 2 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
BOVact = math.floor(psi*20)
WP = (psi)
WV = (psi/4)*TurboLoudness
BP = (1-(-psi/20))*BOV_Pitch
BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
if FE then
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
else
car.DriveSeat.Whistle.Pitch = WP
car.DriveSeat.Whistle.Volume = WV
car.DriveSeat.BOV.Pitch = BP
car.DriveSeat.BOV.Volume = BV
end
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(psi*20)
ticc = tick()
end
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 10000 -- [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 = 350 -- 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)
|
--[[
Creates a new cooldown, with specified cooldownTime. cooldown:hasExpired returns true or false depending on if the cooldown has expired or not. There
is also an optional callbackFunction that will be called as soon as the cooldown expires.
]] |
function Cooldown.new(cooldownTime, callbackFunction)
local startTick = tick()
local cooldownObject = {
_endTick = startTick + cooldownTime
}
setmetatable(cooldownObject, {__index = Cooldown})
if callbackFunction then
delay(cooldownTime, callbackFunction)
end
return cooldownObject
end
function Cooldown:hasExpired()
return self._endTick < tick() and true or false
end
return Cooldown
|
-- ROBLOX deviation END |
local testResultModule = require(Packages.JestTestResult)
type AggregatedResult = testResultModule.AggregatedResult
type TestCaseResult = testResultModule.TestCaseResult
local jestTypesModule = require(Packages.JestTypes)
type Config_ProjectConfig = jestTypesModule.Config_ProjectConfig
type Config_GlobalConfig = jestTypesModule.Config_GlobalConfig
type Config_Path = jestTypesModule.Config_Path
local jestUtilModule = require(Packages.JestUtil)
local formatTime = jestUtilModule.formatTime
local pluralize = jestUtilModule.pluralize
local typesModule = require(CurrentModule.types)
type SummaryOptions = typesModule.SummaryOptions
type Test = typesModule.Test
local relativePath
local renderTime
local PROGRESS_BAR_WIDTH = 40
local function printDisplayName(config: Config_ProjectConfig): string
local displayName = config.displayName
-- ROBLOX deviation: Lua Chalk doesn't support chaining. Using nested calls
local white = function(...)
return chalk.reset(chalk.inverse(chalk.white(...)))
end
if not Boolean.toJSBoolean(displayName) then
return ""
end
local name, color
if displayName ~= nil then
name, color = displayName.name, displayName.color
end
local chosenColor = function(...)
if Boolean.toJSBoolean(color) and chalk[color] ~= nil then
return chalk.reset(chalk.inverse(chalk[color](...)))
else
return white(...)
end
end
-- ROBLOX deviation: chalk.supportsColor isn't defined so we'll assume
-- it supports colors unless it is explicitly set to false
return if chalk.supportsColor == nil or chalk.supportsColor == true
then chosenColor((" %s "):format(name))
else name
end
exports.printDisplayName = printDisplayName
local function trimAndFormatPath(
pad: number,
config: Config_ProjectConfig | Config_GlobalConfig,
testPath: Config_Path,
columns: number
): string
local maxLength = columns - pad
local relative = relativePath(config, testPath)
local basename = relative.basename
local dirname = relative.dirname
-- ROBLOX deviation START: assert pathLength is valid
-- length is ok
local pathLength = utf8.len(dirname .. path.sep .. basename)
assert(pathLength ~= nil)
if pathLength <= maxLength then
-- ROBLOX deviation END
return slash(chalk.dim(dirname .. path.sep) .. chalk.bold(basename))
end
-- ROBLOX deviation START: assert basenameLength is valid
-- we can fit trimmed dirname and full basename
local basenameLength = utf8.len(basename)
assert(basenameLength)
if basenameLength + 4 < maxLength then
local dirnameLength = maxLength - 4 - basenameLength
dirname = "..."
.. String.slice(
dirname,
(utf8.len(dirname) :: number) - dirnameLength + 1,
(utf8.len(dirname) :: number) + 1
)
return slash(chalk.dim(dirname .. path.sep) .. chalk.bold(basename))
end
if basenameLength + 4 == maxLength then
return slash(chalk.dim("..." .. path.sep) .. chalk.bold(basename))
end
-- can't fit dirname, but can fit trimmed basename
return slash(chalk.bold("..." .. String.slice(basename, basenameLength - maxLength - 4, basenameLength + 1)))
-- ROBLOX deviation END
end
exports.trimAndFormatPath = trimAndFormatPath
local function formatTestPath(config: Config_GlobalConfig | Config_ProjectConfig, testPath: Config_Path): string
local ref = relativePath(config, testPath)
local dirname, basename = ref.dirname, ref.basename
return slash(chalk.dim(dirname .. path.sep) .. chalk.bold(basename))
end
exports.formatTestPath = formatTestPath
function relativePath(
config: Config_GlobalConfig | Config_ProjectConfig,
testPath: Config_Path
): { basename: string, dirname: string }
-- this function can be called with ProjectConfigs or GlobalConfigs. GlobalConfigs
-- do not have config.cwd, only config.rootDir. Try using config.cwd, fallback
-- to config.rootDir. (Also, some unit just use config.rootDir, which is ok)
testPath = path:relative(
Boolean.toJSBoolean((config :: Config_ProjectConfig).cwd) and (config :: Config_ProjectConfig).cwd
or config.rootDir,
testPath
)
local dirname = path:dirname(testPath)
local basename = path:basename(testPath)
return { basename = basename, dirname = dirname }
end
exports.relativePath = relativePath
local function getValuesCurrentTestCases(currentTestCases: Array<{ test: Test, testCaseResult: TestCaseResult }>?)
if currentTestCases == nil then
currentTestCases = {}
end
local numFailingTests = 0
local numPassingTests = 0
local numPendingTests = 0
local numTodoTests = 0
local numTotalTests = 0
Array.forEach(currentTestCases :: Array<{ test: Test, testCaseResult: TestCaseResult }>, function(testCase)
local condition_ = testCase.testCaseResult.status
if condition_ == "failed" then
numFailingTests = numFailingTests + 1
elseif condition_ == "passed" then
numPassingTests = numPassingTests + 1
elseif condition_ == "skipped" then
numPendingTests = numPendingTests + 1
elseif condition_ == "todo" then
numTodoTests = numTodoTests + 1
end
numTotalTests += 1
end)
return {
numFailingTests = numFailingTests,
numPassingTests = numPassingTests,
numPendingTests = numPendingTests,
numTodoTests = numTodoTests,
numTotalTests = numTotalTests,
}
end
local function getSummary(aggregatedResults: AggregatedResult, options: SummaryOptions?): string
local runTime = (DateTime.now().UnixTimestampMillis - aggregatedResults.startTime) / 1000
if options ~= nil and options.roundTime then
runTime = math.floor(runTime)
end
local valuesForCurrentTestCases = getValuesCurrentTestCases(
if options ~= nil then options.currentTestCases else nil
)
local estimatedTime = options ~= nil and options.estimatedTime or 0
local snapshotResults = aggregatedResults.snapshot
local snapshotsAdded = snapshotResults.added
local snapshotsFailed = snapshotResults.unmatched
local snapshotsOutdated = snapshotResults.unchecked
local snapshotsFilesRemoved = snapshotResults.filesRemoved
local snapshotsDidUpdate = snapshotResults.didUpdate
local snapshotsPassed = snapshotResults.matched
local snapshotsTotal = snapshotResults.total
local snapshotsUpdated = snapshotResults.updated
local suitesFailed = aggregatedResults.numFailedTestSuites or 0
local suitesPassed = aggregatedResults.numPassedTestSuites or 0
local suitesPending = aggregatedResults.numPendingTestSuites or 0
local suitesRun = suitesFailed + suitesPassed
local suitesTotal = aggregatedResults.numTotalTestSuites or 0
local testsFailed = aggregatedResults.numFailedTests or 0
local testsPassed = aggregatedResults.numPassedTests or 0
local testsPending = aggregatedResults.numPendingTests or 0
local testsTodo = aggregatedResults.numTodoTests or 0
local testsTotal = aggregatedResults.numTotalTests or 0
local width = options ~= nil and options.width or 0
local suites = chalk.bold("Test Suites: ")
.. (if suitesFailed > 0 then chalk.bold(chalk.red(("%d failed"):format(suitesFailed))) .. ", " else "")
.. (if suitesPending > 0 then chalk.bold(chalk.yellow(("%d skipped"):format(suitesPending))) .. ", " else "")
.. (if suitesPassed > 0 then chalk.bold(chalk.green(("%d passed"):format(suitesPassed))) .. ", " else "")
.. (if suitesRun ~= suitesTotal
then tostring(suitesRun) .. " of " .. tostring(suitesTotal)
else tostring(suitesTotal))
.. " total"
local updatedTestsFailed = testsFailed + valuesForCurrentTestCases.numFailingTests
local updatedTestsPending = testsPending + valuesForCurrentTestCases.numPendingTests
local updatedTestsTodo = testsTodo + valuesForCurrentTestCases.numTodoTests
local updatedTestsPassed = testsPassed + valuesForCurrentTestCases.numPassingTests
local updatedTestsTotal = testsTotal + valuesForCurrentTestCases.numTotalTests
local tests = chalk.bold("Tests: ")
.. (if updatedTestsFailed > 0
then chalk.bold(chalk.red(("%d failed"):format(updatedTestsFailed))) .. ", "
else "")
.. (if updatedTestsPending > 0
then chalk.bold(chalk.yellow(("%d skipped"):format(updatedTestsPending))) .. ", "
else "")
.. (if updatedTestsTodo > 0
then chalk.bold(chalk.magenta(("%d todo"):format(updatedTestsTodo))) .. ", "
else "")
.. (if updatedTestsPassed > 0
then chalk.bold(chalk.green(("%d passed"):format(updatedTestsPassed))) .. ", "
else "")
.. ("%d total"):format(updatedTestsTotal)
local snapshots = chalk.bold("Snapshots: ")
.. (if snapshotsFailed > 0 then chalk.bold(chalk.red(("%d failed"):format(snapshotsFailed))) .. ", " else "")
.. (if Boolean.toJSBoolean(snapshotsOutdated) and not snapshotsDidUpdate
then chalk.bold(chalk.yellow(("%d obsolete"):format(snapshotsOutdated))) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsOutdated) and snapshotsDidUpdate
then chalk.bold(chalk.green(("%d removed"):format(snapshotsOutdated))) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsFilesRemoved) and not snapshotsDidUpdate
then chalk.bold(chalk.yellow((pluralize("file", snapshotsFilesRemoved)) .. " obsolete")) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsFilesRemoved) and snapshotsDidUpdate
then chalk.bold(chalk.green((pluralize("file", snapshotsFilesRemoved)) .. " removed")) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsUpdated)
then chalk.bold(chalk.green(("%d updated"):format(snapshotsUpdated))) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsAdded)
then chalk.bold(chalk.green(("%d written"):format(snapshotsAdded))) .. ", "
else "")
.. (if Boolean.toJSBoolean(snapshotsPassed)
then chalk.bold(chalk.green(("%d passed"):format(snapshotsPassed))) .. ", "
else "")
.. ("%d total"):format(snapshotsTotal)
local time = renderTime(runTime, estimatedTime, width)
return Array.join({ suites, tests, snapshots, time }, "\n")
end
exports.getSummary = getSummary
function renderTime(runTime: number, estimatedTime: number, width: number)
-- If we are more than one second over the estimated time, highlight it.
local renderedTime = if Boolean.toJSBoolean(estimatedTime) and runTime >= estimatedTime + 1
then chalk.bold(chalk.yellow(formatTime(runTime, 0)))
else formatTime(runTime, 0)
local time = chalk.bold("Time:") .. (" %s"):format(renderedTime)
if runTime < estimatedTime then
time ..= (", estimated %s"):format(formatTime(estimatedTime, 0))
end
-- Only show a progress bar if the test run is actually going to take
-- some time.
if Boolean.toJSBoolean(estimatedTime > 2 and runTime < estimatedTime and width) then
local availableWidth = math.min(PROGRESS_BAR_WIDTH, width)
local length = math.min(math.floor(runTime / estimatedTime * availableWidth), availableWidth)
if availableWidth >= 2 then
time ..= "\n" .. chalk.green("\u{2588}"):rep(length) .. tostring(
chalk.white("\u{2588}"):rep(availableWidth - length)
)
end
end
return time
end
|
--Initialize Chassis |
local ScriptsFolder = Car:FindFirstChild("Scripts")
local Chassis = require(ScriptsFolder:WaitForChild("Chassis"))
Chassis.InitializeDrivingValues()
Chassis.Reset()
|
-- declarations |
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Humanoid = waitForChild(Figure, "Merch")
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
|
-- Keep a container for temporary connections |
Tools.NewPart.Connections = {};
|
--[=[
Starts the timer and fires off the Tick event immediately. Will do
nothing if the timer is already running.
```lua
timer:StartNow()
```
]=] |
function Timer:StartNow()
if self._runHandle then return end
self.Tick:Fire()
self:Start()
end
|
--[[**
matches given tuple against tuple type definition
@param ... The type definition for the tuples
@returns A function that will return true iff the condition is passed
**--]] |
function t.tuple(...)
local checks = { ... }
return function(...)
local args = { ... }
for i, check in ipairs(checks) do
local success = check(args[i])
if success == false then
return false
end
end
return true
end
end
|
--------------------------------------------- |
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 1
PedValues.PedSignal2a.Value = 1
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL1 GREEN)
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 2
PedValues.PedSignal2a.Value = 2
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 2
SignalValues.Signal1a.Value = 2
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 1
PedValues.PedSignal1a.Value = 1
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL2 GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 2
PedValues.PedSignal1a.Value = 2
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 2
SignalValues.Signal2a.Value = 2
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 1
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10)--Green Time (BEGIN SIGNAL1 PROTECTED TURN GREEN)
TurnValues.TurnSignal1.Value = 2
wait(4)--Yield Time (YIELD SIGNAL1 PROTECTED TURN GREEN)
TurnValues.TurnSignal1.Value = 3
SignalValues.Signal1a.Value = 3
wait(2)-- Clearance
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10) -- Green Time + Time for Signal1a
SignalValues.Signal1.Value = 2
SignalValues.Signal1a.Value = 2
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 1
PedValues.PedSignal1a.Value = 1
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(26)--Green Time (BEGIN SIGNAL2 GREEN)
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 2
PedValues.PedSignal1a.Value = 2
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(6) -- Green Time + Time for flashing pedestrian signals
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 2
SignalValues.Signal2a.Value = 2
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 1
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10)--Green Time (BEGIN SIGNAL1a PROTECTED TURN GREEN)
TurnValues.TurnSignal1a.Value = 2
wait(4)--Yield Time (YIELD SIGNAL1a PROTECTED TURN GREEN)
TurnValues.TurnSignal1a.Value = 3
SignalValues.Signal1.Value = 3
wait(2)-- All Red Cycle
SignalValues.Signal1.Value = 1
SignalValues.Signal1a.Value = 1
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10) -- Green Time + Time for Signal1a
SignalValues.Signal1.Value = 2
SignalValues.Signal1a.Value = 2
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)-- ALL RED
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 1
TurnValues.TurnSignal2a.Value = 3
wait(10)--Green Time (BEGIN SIGNAL2 PROTECTED TURN GREEN)
TurnValues.TurnSignal2.Value = 2
wait(4)--Yield Time (YIELD SIGNAL2 PROTECTED TURN GREEN)
TurnValues.TurnSignal2.Value = 3
SignalValues.Signal2a.Value = 3
wait(2)-- All Red Cycle
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 1
SignalValues.Signal2a.Value = 1
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(10) -- Green Time + Time for Signal2a
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 2
SignalValues.Signal2a.Value = 2
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(4) -- Yellow Time
SignalValues.Signal1.Value = 3
SignalValues.Signal1a.Value = 3
SignalValues.Signal2.Value = 3
SignalValues.Signal2a.Value = 3
PedValues.PedSignal1.Value = 3
PedValues.PedSignal1a.Value = 3
PedValues.PedSignal2.Value = 3
PedValues.PedSignal2a.Value = 3
TurnValues.TurnSignal1.Value = 3
TurnValues.TurnSignal1a.Value = 3
TurnValues.TurnSignal2.Value = 3
TurnValues.TurnSignal2a.Value = 3
wait(2)--ALL RED
end
|
--Modified by Ricalou, 20/10/2013 17:10
-- NO TOUCHY TOUCHY! |
local config = script.Parent.Configuration
script.Parent.Touched:connect(function(part)
if part.Parent and Game:GetService('Players'):GetPlayerFromCharacter(part.Parent) then
local player = Game:GetService('Players'):GetPlayerFromCharacter(part.Parent)
if player:GetRankInGroup(config.GroupId.Value) >= config.RankId.Value then
script.Parent.CanCollide = false
wait(0.3)
script.Parent.CanCollide = true
end
end
end)
|
--Apply Power |
function Engine()
--Horsepower Curve
local HP=_Tune2.Horsepower.Value/100
local HP_B=((_Tune2.Horsepower.Value*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
--Horsepower Curve
function curveHP(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveHP = curveHP(_Tune.PeakRPM)
function curvePSI(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_B/(Peak^2),CurveMult^(Peak/HP_B))+HP_B)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurvePSI = curvePSI(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=(math.max(curveHP(x)/(PeakCurveHP/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Boost (addition to Horsepower)
function GetPsiCurve(x,gear)
local hp=(math.max(curvePSI(x)/(PeakCurvePSI/HP_B),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Output Cache
local HPCache = {}
local PSICache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local bhpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/100),math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local btqPlot = {}
ntqPlot.Horsepower,ntqPlot.Torque = GetCurve(rpm*100,gear-2)
btqPlot.Horsepower,btqPlot.Torque = GetPsiCurve(rpm*100,gear-2)
hp1,tq1 = GetCurve((rpm+1)*100,gear-2)
hp2,tq2 = GetPsiCurve((rpm+1)*100,gear-2)
ntqPlot.HpSlope = (hp1 - ntqPlot.Horsepower)
btqPlot.HpSlope = (hp2 - btqPlot.Horsepower)
ntqPlot.TqSlope = (tq1 - ntqPlot.Torque)
btqPlot.TqSlope = (tq2 - btqPlot.Torque)
nhpPlot[rpm] = ntqPlot
bhpPlot[rpm] = btqPlot
end
table.insert(HPCache,nhpPlot)
table.insert(PSICache,bhpPlot)
end
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
local maxCount=0
for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end
maxSpin=maxSpin/maxCount
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
local TPsi = _TPsi/_TCount
if _Tune.Aspiration ~= "Super" then
local HP2_B=((_Tune2.Horsepower.Value*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100
_Boost = _Boost + ((((((_HP*(_GThrot*1.2)/_Tune2.Horsepower.Value)/8)-(((_Boost/TPsi*(TPsi/15)))))*((8/_Tune.TurboSize)*2))/TPsi)*15)
if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end
else
if _GThrot>sthrot then
sthrot=math.min(_GThrot,sthrot+_Tune.Sensitivity)
elseif _GThrot<sthrot then
sthrot=math.max(_GThrot,sthrot-_Tune.Sensitivity)
end
_Boost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
end
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_NT = cTq.Torque+(cTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
if _Tune.Aspiration ~= "Natural" then
local bTq = PSICache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_BH = bTq.Horsepower+(bTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_BT = bTq.Torque+(bTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_HP = _NH + (_BH*(_Boost/2))
_OutTorque = _NT + (_BT*(_Boost/2))
else
_HP = _NH
_OutTorque = _NT
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and (v.Name=="RR" or v.Name=="RL") then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if _GBrake==0 then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local clutch=1
if not _ClutchOn then clutch=0 end
local throt = _GThrot * _GThrotShift
local tq = _OutTorque
--Apply AWD Vectoring
if _Tune.Config == "AWD" then
local bias = (_Tune.TorqueVector+1)/2
if v.Name=="FL" or v.Name=="FR" then
tq = tq*(1-bias)
elseif v.Name=="RL" or v.Name=="RR" then
tq = tq*bias
end
end
--Apply TCS
tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir=1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on*clutch
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
_ABSActive = (tqABS<1)
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- Hydration (when unsupported) |
export type SuspenseInstance = any
return {
supportsHydration = false,
canHydrateInstance = shim,
canHydrateTextInstance = shim,
canHydrateSuspenseInstance = shim,
isSuspenseInstancePending = shim,
isSuspenseInstanceFallback = shim,
registerSuspenseInstanceRetry = shim,
getNextHydratableSibling = shim,
getFirstHydratableChild = shim,
hydrateInstance = shim,
hydrateTextInstance = shim,
hydrateSuspenseInstance = shim,
getNextHydratableInstanceAfterSuspenseInstance = shim,
commitHydratedContainer = shim,
commitHydratedSuspenseInstance = shim,
clearSuspenseBoundary = shim,
clearSuspenseBoundaryFromContainer = shim,
didNotMatchHydratedContainerTextInstance = shim,
didNotMatchHydratedTextInstance = shim,
didNotHydrateContainerInstance = shim,
didNotHydrateInstance = shim,
didNotFindHydratableContainerInstance = shim,
didNotFindHydratableContainerTextInstance = shim,
didNotFindHydratableContainerSuspenseInstance = shim,
didNotFindHydratableInstance = shim,
didNotFindHydratableTextInstance = shim,
didNotFindHydratableSuspenseInstance = shim,
}
|
--Handle changes |
Character.DescendantAdded:Connect(Render)
Character.DescendantRemoving:Connect(Render)
|
-------------------------------------------------- |
script.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Values.Gear.Value
if gearText == 0 then
gearText = "N"
car.Body.Dash.DashSc.G.Gear.Text = "N"
car.DriveSeat.Filter:FireServer('reverse',false)
elseif gearText == -1 then
gearText = "R"
car.Body.Dash.DashSc.G.Gear.Text = "R"
car.DriveSeat.Filter:FireServer('reverse',true)
end
car.Body.Dash.DashSc.G.Gear.Text = gearText
end)
|
--Accelerate module(part of physics module) |
local e=2.718281828459045
local d=1
local s=1
local p0=0
local v0=0*p0
local p1=p0
local v1=v0
local t0=tick()
local function posvel(d,s,p0,v0,p1,v1,x)
if s==0 then
return p0
elseif d<1-1e-8 then
local h=(1-d*d)^0.5
local c1=(p0-p1+2*d/s*v1)
local c2=d/h*(p0-p1)+v0/(h*s)+(2*d*d-1)/(h*s)*v1
local co=math.cos(h*s*x)
local si=math.sin(h*s*x)
local ex=e^(d*s*x)
return co/ex*c1+si/ex*c2+p1+(x-2*d/s)*v1,
s*(co*h-d*si)/ex*c2-s*(co*d+h*si)/ex*c1+v1
elseif d<1+1e-8 then
local c1=p0-p1+2/s*v1
local c2=p0-p1+(v0+v1)/s
local ex=e^(s*x)
return (c1+c2*s*x)/ex+p1+(x-2/s)*v1,
v1-s/ex*(c1+(s*x-1)*c2)
else
local h=(d*d-1)^0.5
local a=(v1-v0)/(2*s*h)
local b=d/s*v1-(p1-p0)/2
local c1=(1-d/h)*b+a
local c2=(1+d/h)*b-a
local co=e^(-(h+d)*s*x)
local si=e^((h-d)*s*x)
return c1*co+c2*si+p1+(x-2*d/s)*v1,
si*(h-d)*s*c2-co*(d+h)*s*c1+v1
end
end
local function targposvel(p1,v1,x)
return p1+x*v1,v1
end
local self={}
function self:accelerate(a)
local time=tick()
local p,v=posvel(d,s,p0,v0,p1,v1,time-t0)
local tp,tv=targposvel(p1,v1,time-t0)
p0,v0=p,v+a
p1,v1=tp,tv
t0=time
return setmetatable(self)
end
|
-- params : ... |
frame = script.Parent.Parent
click = function()
local folder = script.Parent:FindFirstChild(script.Parent.Name)
local children = frame:GetChildren()
for i = 1, #children do
if children[i].ClassName == "TextButton" and children[i].Name ~= "MainMenu" then
children[i].Visible = false
end
end
children = folder:GetChildren()
local Xoffset = 0
local Yoffset = 70
for i = 1, #children do
local HH = frame.Parent.TextButton2:clone()
HH.Parent = frame.SubButtons
local HE = children[i]:clone()
HE.Parent = HH
HH.Name = HE.Name
HH.Text = HH.Name
HH.Size = UDim2.new(0, 100, 0, 50)
HH.Position = UDim2.new(0, Xoffset, 0, Yoffset)
HH.Visible = true
Xoffset = Xoffset + 100
if Xoffset == 200 then
Xoffset = 0
Yoffset = Yoffset + 50
end
end
end
script.Parent.MouseButton1Click:connect(click)
|
--Func |
local function loadModule(module)
local module = require(module)
if (module.Init) then
module.Init()
end
return module
end
local function loadModules (Parent, arraySoFar)
for _, obj in pairs(Parent:GetChildren()) do |
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player. |
function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
local messageObj = ShallowCopy(inMessageObj)
local oldFilterResult = messageObj.FilterResult
local player = self:GetPlayer()
local msg = ""
pcall(function()
if (messageObj.IsFilterResult) then
if (player) then
msg = oldFilterResult:GetChatForUserAsync(player.UserId)
else
msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
end
else
msg = oldFilterResult
end
end)
--// Messages of 0 length are the result of two users not being allowed
--// to chat, or GetChatForUserAsync() failing. In both of these situations,
--// messages with length of 0 should not be sent.
if (#msg > 0) then
messageObj.Message = msg
messageObj.FilterResult = nil
self:InternalSendFilteredMessage(messageObj, channelName)
end
end
function methods:InternalSendSystemMessage(messageObj, channelName)
local success, err = pcall(function()
self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
end)
if not success and err then
print("Error sending internal system message: " ..err)
end
end
function methods:UpdateChannelNameColor(channelName, channelNameColor)
self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
end
|
--[[
When the game is run, this script automatically places all of the model's contents into the correct locations and deletes any leftover clutter.
All you have to do is configure the music IDs and/or zones as described in the README - the rest will be automatically handled!
--]] |
local settings = require(script.Parent.Settings)
if settings.UseGlobalBackgroundMusic == false and settings.UseMusicZones == false then
error("Cindering's BGM error: You have disabled both Global Background Music and Music Zones. You must change at least one of these settings to 'true'.")
return
end
local name1 = "[1] Global Background Music"
local name2 = "[2] Background Music Zones"
local container = Instance.new("Folder")
container.Name = "CinderingBGM"
script.Parent.Settings.Parent = container
script.LocalBackgroundMusic.Parent = game.StarterPlayer.StarterPlayerScripts
local music = Instance.new("Folder")
local zones = Instance.new("Folder",music)
zones.Name = "MusicZones"
local global = Instance.new("Folder",music)
global.Name = "GlobalMusic"
if settings.UseMusicZones == true then
local folder = script.Parent:FindFirstChild(name2) or game.ReplicatedStorage:FindFirstChild(name2) or workspace:FindFirstChild(name2) or game:FindFirstChild(name2,true) -- never know where someone might accidentally drag that folder...
if folder then
for _,model in pairs(folder:GetChildren()) do
if (model:IsA("Model") and model:FindFirstChild("Music")) then
model.Parent = zones
end
end
else
error("Cindering's BGM error: Your background music zones folder could not be found! You may have deleted/renamed the original folder. It should be named: "..name2)
return
end
end
if settings.UseGlobalBackgroundMusic == true then
local folder = script.Parent:FindFirstChild(name1) or game.ReplicatedStorage:FindFirstChild(name1) or workspace:FindFirstChild(name1) or game:FindFirstChild(name1,true)
if folder then
for _,v in pairs(folder:GetChildren()) do
if v:IsA("Sound") then
v.Parent = global
end
end
else
error("Cindering's BGM error: Your global background music folder could not be found! You may have deleted/renamed the original folder. It should be named: "..name1)
return
end
end
if settings.UseGlobalBackgroundMusic == true and #global:GetChildren() == 0 then
warn("Cindering's BGM warning: Your global background music folder is completely empty; no music will be played from there.")
end
if settings.UseMusicZones == true and #zones:GetChildren() == 0 then
warn("Cindering's BGM warning: Your background music zones folder is completely empty; no music will be played from there.")
end
music.Name = "MusicFolder"
music.Parent = container
local count = 0
function recurse(instance)
for _,v in pairs(instance:GetChildren()) do
count = count + 1
recurse(v)
end
end
recurse(music)
local val = Instance.new("IntValue",container)
val.Name = "ObjectCount"
val.Value = count
container.Parent = game.ReplicatedStorage
script.Parent:Destroy()
|
--[=[
Detects if a table is an array, meaning purely number indexes and indexes starting at 1.
```lua
local Array = {"A", "B", "C", "D"}
local Dictionary = { NotAnArray = true }
print(TableKit.IsArray(Array), TableKit.IsArray(Dictionary)) -- prints true, false
```
@within TableKit
@param mysteryTable table
@return boolean
]=] |
function TableKit.IsArray(mysteryTable: { [unknown]: unknown }): boolean
local count = 0
for _ in mysteryTable do
count += 1
end
return count == #mysteryTable
end
|
--script.Parent.NN.Velocity = script.Parent.NN.CFrame.lookVector *script.Parent.Speed.Value
--script.Parent.NNN.Velocity = script.Parent.NNN.CFrame.lookVector *script.Parent.Speed.Value |
script.Parent.NNNN.Velocity = script.Parent.NNNN.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.O.Velocity = script.Parent.O.CFrame.lookVector *script.Parent.Speed.Value |
--// Services |
local RunService = game:GetService("RunService")
|
--[[for n = 1,80 do
wait(0.005)
script.Parent.Parent.Parent.Grabber.Claw.Body.Rope.Length = script.Parent.Parent.Claw.Body.Rope.Length - 0.175
end]] |
script.Parent.Retreat.Disabled = false
script.Parent.Parent.Parent.CardSwipe.Screen.ClickDetector.PrizeWin.Disabled = false
script.Disabled = true
end
|
-- Core selection system |
Selection = {}
Selection.Items = {}
Selection.ItemIndex = {}
Selection.Parts = {}
Selection.PartIndex = {}
Selection.Outlines = {}
Selection.Color = BrickColor.new 'Cyan'
Selection.Multiselecting = false
Selection.Maid = Maid.new()
|
--[[ Touch Events ]] | --
UserInputService.Changed:connect(function(property)
if property == 'ModalEnabled' then
IsModalEnabled = UserInputService.ModalEnabled
if lastInputType == Enum.UserInputType.Touch then
if ControlState.Current == ControlModules.Touch and IsModalEnabled then
ControlState:SwitchTo(nil)
elseif ControlState.Current == nil and not IsModalEnabled then
ControlState:SwitchTo(ControlModules.Touch)
end
end
end
end)
if BindableEvent_OnFailStateChanged then
BindableEvent_OnFailStateChanged.Event:connect(function(isOn)
if lastInputType == Enum.UserInputType.Touch and ClickToMoveTouchControls then
if isOn then
ControlState:SwitchTo(ClickToMoveTouchControls)
else
ControlState:SwitchTo(nil)
end
end
end)
end
local switchToInputType = function(newLastInputType)
lastInputType = newLastInputType
if lastInputType == Enum.UserInputType.Touch then
ControlState:SwitchTo(ControlModules.Touch)
elseif lastInputType == Enum.UserInputType.Keyboard or
lastInputType == Enum.UserInputType.MouseButton1 or
lastInputType == Enum.UserInputType.MouseButton2 or
lastInputType == Enum.UserInputType.MouseButton3 or
lastInputType == Enum.UserInputType.MouseWheel or
lastInputType == Enum.UserInputType.MouseMovement then
ControlState:SwitchTo(ControlModules.Keyboard)
elseif lastInputType == Enum.UserInputType.Gamepad1 or
lastInputType == Enum.UserInputType.Gamepad2 or
lastInputType == Enum.UserInputType.Gamepad3 or
lastInputType == Enum.UserInputType.Gamepad4 then
ControlState:SwitchTo(ControlModules.Gamepad)
end
end
if IsTouchDevice then
createTouchGuiContainer()
end
MasterControl:Init()
UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then return end
if UserInputService.KeyboardEnabled then
ControlState:SwitchTo(ControlModules.Keyboard)
elseif IsTouchDevice then
ControlState:SwitchTo(ControlModules.Touch)
end
end)
UserInputService.GamepadConnected:connect(function(gamepadEnum)
ControlState:SwitchTo(ControlModules.Gamepad)
end)
switchToInputType(UserInputService:GetLastInputType())
UserInputService.LastInputTypeChanged:connect(switchToInputType)
|
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/test-utils/src/alignedAnsiStyleSerializer.ts
-- /**
-- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
-- *
-- * This source code is licensed under the MIT license found in the
-- * LICENSE file in the root directory of this source tree.
-- */ |
local CurrentModule = script.Parent
local Packages = CurrentModule.Parent
local ansiRegex = require(Packages.PrettyFormat).plugins.ConvertAnsi.ansiRegex |
-- Load the SoundDispatcher script into Studio |
local soundDispatcherName = "SoundDispatcher"
local ServerScriptService = game:GetService("ServerScriptService")
local function LoadScript(name, parent)
local originalModule = script.Parent:WaitForChild(name)
local script = Instance.new("Script")
script.Name = name
script.Source = originalModule.Source
script.Parent = parent
return script
end
local function Install()
local soundDispatcherArchivable = true
local SoundDispatcher = ServerScriptService:FindFirstChild(soundDispatcherName)
if not SoundDispatcher then
soundDispatcherArchivable = false
SoundDispatcher = LoadScript(soundDispatcherName, ServerScriptService)
end
if not ServerScriptService:FindFirstChild(soundDispatcherName) then
local SoundDispatcherCopy = SoundDispatcher:Clone()
SoundDispatcherCopy.Archivable = false
SoundDispatcherCopy.Parent = ServerScriptService
end
SoundDispatcher.Archivable = soundDispatcherArchivable
end
return Install
|
-- ROBLOX deviation predefine variables |
local getMatchingKeyPaths, replaceKeyPathWithValue, getPath
export type Template = Record<string, any>
export type Templates = Array<Template>
export type Headings = Array<string>
local function interpolateVariables(title: string, template: Template, index: number): string
return Array.reduce(
Array.reduce(Object.keys(template), getMatchingKeyPaths(title), {}), -- aka flatMap
replaceKeyPathWithValue(template),
title
):gsub(
"%$#", -- ROBLOX deviation: escaped string
tostring(index),
1
)
end
exports.interpolateVariables = interpolateVariables
function getMatchingKeyPaths(title: string)
return function(matches: Headings, key: string)
return Array.concat(
matches,
(function()
local ref = {}
for match in title:gmatch(("%%$%s[%%.%%w]*"):format(key)) do -- ROBLOX deviation: escape characters
table.insert(ref, match)
end
return ref
end)()
)
end
end
function replaceKeyPathWithValue(template: Template): (title: string, match: string) -> string
return function(title: string, match: string)
local newMatch = match:gsub("%$", "", 1) -- ROBLOX deviation: escape string
local keyPath = String.split(newMatch, "%.") -- ROBLOX deviation: escape string
local value = getPath(template, keyPath)
if isPrimitive(value) then
return title:gsub(match, tostring(value), 1)
end
return title:gsub(match, pretty(value, { maxDepth = 1, min = true }), 1)
end
end
|
--[[ 1 ]] {"Delete","Music ID","Radio","Game Info","Settings"},
--[[ 2 ]] {"Yes","No"},
--[[ 3 ]] {"Set","Play","Stop","Back"},
--[[ 4 ]] {"Preset 1","Preset 2","Preset 3","Preset 4","Back"},
--[[ 5 ]] {"Filtered","PGS","Players","Back"},
--[[ 6 ]] {"Power","Dynamics","Background","Back"},
--[[ 7 ]] {"Valet","Eco","Comfort","Sport","Back"},
--[[ 8 ]] {"Eco","Comfort","Sport","Back"},
--[[ 9 ]] | {"Model","Specs","Transmission","Info","Back"},
}
return module
|
-- Variables |
local hasExploded = false
local function Explode()
-- Don't allow this to execute multiple times
if hasExploded then return end
hasExploded = true
wait(0.2)
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = 14
Explosion.BlastPressure = 2000
Explosion.DestroyJointRadiusPercent = 0
Explosion.Position = RootModel:GetPrimaryPartCFrame().Position
local parts = workspace:GetPartBoundsInRadius(Explosion.Position,Explosion.BlastRadius)
-- So we don't rehit the same target multiple times
local flaggedForHit = {}
-- If the part is connected to a player character then apply damage
for _, part in pairs(parts) do
local character = PartUtility.GetCharacterFromInstance_R(part)
if not character then continue end
-- Don't rehit the same character multiple times
if flaggedForHit[character] then continue end
flaggedForHit[character] = true
APICombat.ApplyDamageToCharacter(owningPlayer,character,WeaponDefinition)
end
Explosion.Parent = workspace
local effectPart = Instance.new("Part")
effectPart.Position = Explosion.Position
effectPart.Anchored = true
effectPart.Transparency = 1
effectPart.CanCollide = false
effectPart.Parent = workspace
-- Play sounds
for _, effect in pairs(EffectsToPlay:GetChildren()) do
effect.Parent = effectPart
if effect:IsA("Sound") then
effect:Play()
end
end
DebrisService:AddItem(effectPart,4)
RootModel:Destroy()
end
for _, part in pairs(RootModel:GetChildren()) do
part.Touched:Connect(function(part)
local character = PartUtility.GetCharacterFromInstance_R(part)
if owningPlayer.Character and owningPlayer.Character ~= character then
Explode()
end
end)
end
|
--Char.Humanoid.BreakJointsOnDeath = false |
if Config.EnableRagdoll == true then
Char.Humanoid.Died:Connect(function()
Ragdoll(Char)
end)
end
human.HealthChanged:Connect(function (newhealth)
if not dead.Value and Blood.Value >= 10 then
if not Config.ZeroHealthEqualsDeath then
human.Health = math.clamp(newhealth, 0.1, 100)
else
human.Health = math.clamp(newhealth, 0, 100)
end
if (rodeath.Value == true or life.Value == false) and newhealth <= -25 then
local loss = newhealth * 40
Blood.Value = Blood.Value + loss
human.PlatformStand = true
human.AutoRotate = false
Caido.Value = true
end
else
human.PlatformStand = false
human.AutoRotate = true
human.Health = 0
end
end)
|
--ControlSwitch |
ControlSwch.Changed:Connect(function()
if ControlSwch.Value == true then
ControlSwch.Parent.P1.Transparency = 1
ControlSwch.Parent.P2.Transparency = 0
ControlVal.Value = true
ClickSound:Play()
else
ControlSwch.Parent.P1.Transparency = 0
ControlSwch.Parent.P2.Transparency = 1
ClickSound:Play()
ControlVal.Value = false
end
end)
|
--[=[
Performs a raycast operation out from the mouse position (or the
`overridePos` if provided) into world space. The ray will go
`distance` studs forward (or 1000 studs if not provided).
Returns the `RaycastResult` if something was hit, else returns `nil`.
Use `Raycast` if it is important to capture any objects that could be
hit along the projected ray. If objects can be ignored and only the
final position of the ray is needed, use `Project` instead.
```lua
local params = RaycastParams.new()
local result = mouse:Raycast(params)
if result then
print(result.Instance)
else
print("Mouse raycast did not hit anything")
end
```
]=] |
function Mouse:Raycast(raycastParams: RaycastParams, distance: number?, overridePos: Vector2?): RaycastResult?
local viewportMouseRay = self:GetRay(overridePos)
local result = workspace:Raycast(viewportMouseRay.Origin, viewportMouseRay.Direction * (distance or RAY_DISTANCE), raycastParams)
return result
end
|
-- Hook events |
Entry.TextBox.FocusLost:Connect(
function(submit)
return Window:LoseFocus(submit)
end
)
UserInputService.InputBegan:Connect(
function(input, gameProcessed)
return Window:BeginInput(input, gameProcessed)
end
)
Entry.TextBox:GetPropertyChangedSignal("Text"):Connect(
function()
if Entry.TextBox.Text:match("\t") then -- Eat \t
Entry.TextBox.Text = Entry.TextBox.Text:gsub("\t", "")
return
end
if Window.OnTextChanged then
return Window.OnTextChanged(Entry.TextBox.Text)
end
end
)
Gui.ChildAdded:Connect(Window.UpdateWindowHeight)
return Window
|
-- pri:Push(obj[1], obj[2]) |
end
print(os.clock() - s)
|
--------------------------------------------------------------------------------
-- MAGIC NUMBERS CALCULATOR
--------------------------------------------------------------------------------
-- Q:
-- Is 53-bit "double" math enough to calculate square roots and cube roots of primes with 64 correct bits after decimal point?
-- A:
-- Yes, 53-bit "double" arithmetic is enough.
-- We could obtain first 40 bits by direct calculation of p^(1/3) and next 40 bits by one step of Newton's method. |
do
local function mul(src1, src2, factor, result_length)
-- src1, src2 - long integers (arrays of digits in base TWO_POW_24)
-- factor - small integer
-- returns long integer result (src1 * src2 * factor) and its floating point approximation
local result, carry, value, weight = table.create(result_length), 0, 0, 1
for j = 1, result_length do
for k = math.max(1, j + 1 - #src2), math.min(j, #src1) do
carry = carry + factor * src1[k] * src2[j + 1 - k] -- "int32" is not enough for multiplication result, that's why "factor" must be of type "double"
end
local digit = carry % TWO_POW_24
result[j] = math.floor(digit)
carry = (carry - digit) / TWO_POW_24
value = value + digit * weight
weight = weight * TWO_POW_24
end
return result, value
end
local idx, step, p, one, sqrt_hi, sqrt_lo = 0, {4, 1, 2, -2, 2}, 4, {1}, sha2_H_hi, sha2_H_lo
repeat
p = p + step[p % 6]
local d = 1
repeat
d = d + step[d % 6]
if d * d > p then
-- next prime number is found
local root = p ^ (1 / 3)
local R = root * TWO_POW_40
R = mul(table.create(1, math.floor(R)), one, 1, 2)
local _, delta = mul(R, mul(R, R, 1, 4), -1, 4)
local hi = R[2] % 65536 * 65536 + math.floor(R[1] / 256)
local lo = R[1] % 256 * 16777216 + math.floor(delta * (TWO_POW_NEG_56 / 3) * root / p)
if idx < 16 then
root = math.sqrt(p)
R = root * TWO_POW_40
R = mul(table.create(1, math.floor(R)), one, 1, 2)
_, delta = mul(R, R, -1, 2)
local hi = R[2] % 65536 * 65536 + math.floor(R[1] / 256)
local lo = R[1] % 256 * 16777216 + math.floor(delta * TWO_POW_NEG_17 / root)
local idx = idx % 8 + 1
sha2_H_ext256[224][idx] = lo
sqrt_hi[idx], sqrt_lo[idx] = hi, lo + hi * hi_factor
if idx > 7 then
sqrt_hi, sqrt_lo = sha2_H_ext512_hi[384], sha2_H_ext512_lo[384]
end
end
idx = idx + 1
sha2_K_hi[idx], sha2_K_lo[idx] = hi, lo % K_lo_modulo + hi * hi_factor
break
end
until p % d == 0
until idx > 79
end
|
--Institutional white
--Electric blue |
function SetDigit(Value)
wait(0.55)
if Value == "0" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Electric blue")
SP.D3.BrickColor = BrickColor.new("Electric blue")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Electric blue")
SP.D8.BrickColor = BrickColor.new("Electric blue")
SP.D9.BrickColor = BrickColor.new("Electric blue")
SP.D10.BrickColor = BrickColor.new("Electric blue")
SP.D11.BrickColor = BrickColor.new("Electric blue")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "1" then
SP.D1.BrickColor = BrickColor.new("Electric blue")
SP.D2.BrickColor = BrickColor.new("Electric blue")
SP.D3.BrickColor = BrickColor.new("Electric blue")
SP.D4.BrickColor = BrickColor.new("Electric blue")
SP.D5.BrickColor = BrickColor.new("Electric blue")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Electric blue")
SP.D8.BrickColor = BrickColor.new("Electric blue")
SP.D9.BrickColor = BrickColor.new("Electric blue")
SP.D10.BrickColor = BrickColor.new("Electric blue")
SP.D11.BrickColor = BrickColor.new("Electric blue")
SP.D12.BrickColor = BrickColor.new("Institutional white")
SP.D13.BrickColor = BrickColor.new("Electric blue")
SP.D14.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "M" then
SP.D1.BrickColor = BrickColor.new("Institutional white")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Institutional white")
SP.D4.BrickColor = BrickColor.new("Institutional white")
SP.D5.BrickColor = BrickColor.new("Electric blue")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Electric blue")
SP.D8.BrickColor = BrickColor.new("Electric blue")
SP.D9.BrickColor = BrickColor.new("Electric blue")
SP.D10.BrickColor = BrickColor.new("Electric blue")
SP.D11.BrickColor = BrickColor.new("Electric blue")
SP.D12.BrickColor = BrickColor.new("Institutional white")
SP.D13.BrickColor = BrickColor.new("Institutional white")
SP.D14.BrickColor = BrickColor.new("Electric blue")
return
end
if Value == "3" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really black")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really black")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "4" then
SP.D1.BrickColor = BrickColor.new("Really black")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really black")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "5" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really black")
SP.D13.BrickColor = BrickColor.new("Really black")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "6" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really black")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "7" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really black")
SP.D3.BrickColor = BrickColor.new("Really black")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really black")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really black")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "8" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "9" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really black")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "G" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really black")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really black")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really red")
return
end
if Value == "P" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really black")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really black")
return
end
if Value == "R" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
SP.D8.BrickColor = BrickColor.new("Really black")
SP.D9.BrickColor = BrickColor.new("Really black")
SP.D10.BrickColor = BrickColor.new("Really red")
SP.D11.BrickColor = BrickColor.new("Really black")
SP.D12.BrickColor = BrickColor.new("Really red")
SP.D13.BrickColor = BrickColor.new("Really red")
SP.D14.BrickColor = BrickColor.new("Really black")
return
end
if Value == "2" then
SP.D1.BrickColor = BrickColor.new("Electric blue")
SP.D2.BrickColor = BrickColor.new("Electric blue")
SP.D3.BrickColor = BrickColor.new("Electric blue")
SP.D4.BrickColor = BrickColor.new("Electric blue")
SP.D5.BrickColor = BrickColor.new("Institutional white")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Electric blue")
SP.D8.BrickColor = BrickColor.new("Institutional white")
SP.D9.BrickColor = BrickColor.new("Institutional white")
SP.D10.BrickColor = BrickColor.new("Electric blue")
SP.D11.BrickColor = BrickColor.new("Electric blue")
SP.D12.BrickColor = BrickColor.new("Institutional white")
SP.D13.BrickColor = BrickColor.new("Institutional white")
SP.D14.BrickColor = BrickColor.new("Institutional white")
return
end
end
SP.Value.Changed:connect(function() SetDigit(SP.Value.Value) end)
|
-- Public Methods |
function RadioButtonGroupClass:GetActiveRadio()
return self._ActiveRadio
end
function RadioButtonGroupClass:Destroy()
self._Maid:Sweep()
self.Frame:Destroy()
end
|
--[[
Takes two tables A and B, returns if they have the same key-value pairs
Except ignored keys
]] |
return function(A, B, ignore)
if not A or not B then
return false
elseif A == B then
return true
end
if not ignore then
ignore = {}
end
for key, value in pairs(A) do
if B[key] ~= value and not ignore[key] then
return false
end
end
for key, value in pairs(B) do
if A[key] ~= value and not ignore[key] then
return false
end
end
return true
end
|
-- Function to update hunger |
function updateHunger(delta)
hunger = hunger + delta
if hunger > maxHunger then
hunger = maxHunger
elseif hunger < 0 then
hunger = 0
end
end
|
--!strict
--[=[
@function at
@within Array
@param array {T} -- The array to get the value from.
@param index number -- The index to get the value from (can be negative).
@return T -- The value at the given index.
Gets a value from an array at the given index.
```lua
local array = { 1, 2, 3 }
local value = At(array, 1) -- 1
local value = At(array, 0) -- 3
```
]=] |
local function at<T>(array: { T }, index: number): T
local length = #array
if index < 1 then
index += length
end
return array[index]
end
return at
|
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local TouchJump = setmetatable({}, BaseCharacterController)
TouchJump.__index = TouchJump
function TouchJump.new()
local self = setmetatable(BaseCharacterController.new() :: any, TouchJump)
self.parentUIFrame = nil
self.jumpButton = nil
self.characterAddedConn = nil
self.humanoidStateEnabledChangedConn = nil
self.humanoidJumpPowerConn = nil
self.humanoidParentConn = nil
self.externallyEnabled = false
self.jumpPower = 0
self.jumpStateEnabled = true
self.isJumping = false
self.humanoid = nil -- saved reference because property change connections are made using it
return self
end
function TouchJump:EnableButton(enable)
if enable then
if not self.jumpButton then
self:Create()
end
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid and self.externallyEnabled then
if self.externallyEnabled then
if humanoid.JumpPower > 0 then
self.jumpButton.Visible = true
end
end
end
else
self.jumpButton.Visible = false
self.isJumping = false
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
end
end
function TouchJump:UpdateEnabled()
if self.jumpPower > 0 and self.jumpStateEnabled then
self:EnableButton(true)
else
self:EnableButton(false)
end
end
function TouchJump:HumanoidChanged(prop)
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if prop == "JumpPower" then
self.jumpPower = humanoid.JumpPower
self:UpdateEnabled()
elseif prop == "Parent" then
if not humanoid.Parent then
self.humanoidChangeConn:Disconnect()
end
end
end
end
function TouchJump:HumanoidStateEnabledChanged(state, isEnabled)
if state == Enum.HumanoidStateType.Jumping then
self.jumpStateEnabled = isEnabled
self:UpdateEnabled()
end
end
function TouchJump:CharacterAdded(char)
if self.humanoidChangeConn then
self.humanoidChangeConn:Disconnect()
self.humanoidChangeConn = nil
end
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
self.humanoidJumpPowerConn = self.humanoid:GetPropertyChangedSignal("JumpPower"):Connect(function()
self.jumpPower = self.humanoid.JumpPower
self:UpdateEnabled()
end)
self.humanoidParentConn = self.humanoid:GetPropertyChangedSignal("Parent"):Connect(function()
if not self.humanoid.Parent then
self.humanoidJumpPowerConn:Disconnect()
self.humanoidJumpPowerConn = nil
self.humanoidParentConn:Disconnect()
self.humanoidParentConn = nil
end
end)
self.humanoidStateEnabledChangedConn = self.humanoid.StateEnabledChanged:Connect(function(state, enabled)
self:HumanoidStateEnabledChanged(state, enabled)
end)
self.jumpPower = self.humanoid.JumpPower
self.jumpStateEnabled = self.humanoid:GetStateEnabled(Enum.HumanoidStateType.Jumping)
self:UpdateEnabled()
end
function TouchJump:SetupCharacterAddedFunction()
self.characterAddedConn = Players.LocalPlayer.CharacterAdded:Connect(function(char)
self:CharacterAdded(char)
end)
if Players.LocalPlayer.Character then
self:CharacterAdded(Players.LocalPlayer.Character)
end
end
function TouchJump:Enable(enable, parentFrame)
if parentFrame then
self.parentUIFrame = parentFrame
end
self.externallyEnabled = enable
self:EnableButton(enable)
end
function TouchJump:Create()
if not self.parentUIFrame then
return
end
if self.jumpButton then
self.jumpButton:Destroy()
self.jumpButton = nil
end
local minAxis = math.min(self.parentUIFrame.AbsoluteSize.x, self.parentUIFrame.AbsoluteSize.y)
local isSmallScreen = minAxis <= 500
local jumpButtonSize = isSmallScreen and 70 or 120
self.jumpButton = Instance.new("ImageButton")
self.jumpButton.Name = "JumpButton"
self.jumpButton.Visible = false
self.jumpButton.BackgroundTransparency = 1
self.jumpButton.Image = TOUCH_CONTROL_SHEET
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
self.jumpButton.ImageRectSize = Vector2.new(144, 144)
self.jumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)
self.jumpButton.Position = isSmallScreen and UDim2.new(1, -(jumpButtonSize*1.5-10), 1, -jumpButtonSize - 20) or
UDim2.new(1, -(jumpButtonSize*1.5-10), 1, -jumpButtonSize * 1.75)
local touchObject: InputObject? = nil
self.jumpButton.InputBegan:connect(function(inputObject)
--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
if touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch
or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
touchObject = inputObject
self.jumpButton.ImageRectOffset = Vector2.new(146, 146)
self.isJumping = true
end)
local OnInputEnded = function()
touchObject = nil
self.isJumping = false
self.jumpButton.ImageRectOffset = Vector2.new(1, 146)
end
self.jumpButton.InputEnded:connect(function(inputObject: InputObject)
if inputObject == touchObject then
OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if touchObject then
OnInputEnded()
end
end)
if not self.characterAddedConn then
self:SetupCharacterAddedFunction()
end
self.jumpButton.Parent = self.parentUIFrame
end
return TouchJump
|
--//Created by PlaasBoer
--If you find a bug comment on my video for Zed's tycoon save
--Link to my channel
--[[
https://www.youtube.com/channel/UCHIypUw5-7noRfLJjczdsqw
]] | --
|
-- Allows the character to climb ladders and trusses like a rocket while
-- continuously jumping and walking into them. Overrides default jumping
-- velocity.
--
-- Thank you for your forum post Crazyblox! Saved me a lot of time figuring
-- the solution out.
--
-- https://devforum.roblox.com/t/humanoid-jump-state-not-triggering-from-truss-jump-with-shiftlock-first-person/242877
--
-- ForbiddenJ |
Humanoid = script.Parent.Humanoid
RootPart = Humanoid.RootPart
Humanoid.Jumping:Connect(function(isJumping)
if isJumping then
RootPart.Velocity = Vector3.new(RootPart.Velocity.X, Humanoid.JumpPower * 1.1, RootPart.Velocity.Z)
end
end)
|
--------------------------------------------------- |
This = script.Parent
Elevator = This.Parent.Parent.Parent.Parent.Parent
CustomLabel = require(This.Parent.Parent.Parent.Parent.Parent.CustomLabel)
Characters = require(script.Characters)
CustomText = CustomLabel["CUSTOMFLOORLABEL"]
Elevator:WaitForChild("Floor").Changed:connect(function(floor)
ChangeFloor(tostring(floor))
end)
function ChangeFloor(SF)
if CustomText[tonumber(SF)] then
SF = CustomText[tonumber(SF)]
end
SetDisplay(2,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))
SetDisplay(3,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end
function SetDisplay(ID,CHAR)
if This.Display:FindFirstChild("Matrix"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
for r=1,5 do
This.Display["Matrix"..ID]["Row"..i]["D"..r].Visible = (l:sub(r,r) == "1" and true or false)
end
end
end
end
for M = 1, Displays do
for R = 1, 7 do
for D = 1, 5 do
This.Display["Matrix"..M]["Row"..R]["D"..D].ImageColor3 = DisplayColor
end
end
end
|
-- Put me in ReplicatedStorage |
local Settings = {
['SprintSpeed']=500; -- Speed of the player while sprinting
['ChangeFOV']=true; -- Enables the change in FOV (zooming out) while sprinting
}
return Settings
|
--[[RightShoulder:Destroy()
LeftShoulder:Destroy()
RightHip:Destroy()
LeftHip:Destroy()
Neck:Destroy()]] | |
-- Registers metadata for one merch item, given its asset id |
local function setItemInfo(itemId: string, info: types.ItemInfo)
return {
itemId = itemId,
info = info,
}
end
return Rodux.makeActionCreator(script.Name, setItemInfo)
|
--[[
Initialises a new StateHolder from defined config table, which should be formatted as below:
allowedTransitions = {
[StateName] = {} -- Within the table should be all the states this state can transition into
}
callbacks = {
global = {onLeave = function(stateHolder, from, to), onEnter = function(stateHolder, from, to)}
[StateName] = {onLeave = function(stateHolder, from, to), onEnter = function(stateHolder, from, to)}
}
initial -- Optional initial state to automatically transition into
]] |
function StateHolder:_init(config)
self._allowedTransitions = config.allowedTransitions
self._callbacks = config.callbacks
if config.initial then
spawn(
function()
self:transition(config.initial, true)
end
)
end
end
|
--[=[
Repeatedly calls a Promise-returning function up to `times` number of times, until the returned Promise resolves.
If the amount of retries is exceeded, the function will return the latest rejected Promise.
```lua
local function canFail(a, b, c)
return Promise.new(function(resolve, reject)
-- do something that can fail
local failed, thing = doSomethingThatCanFail(a, b, c)
if failed then
reject("it failed")
else
resolve(thing)
end
end)
end
local MAX_RETRIES = 10
local value = Promise.retry(canFail, MAX_RETRIES, "foo", "bar", "baz") -- args to send to canFail
```
@since 3.0.0
@param callback (...: P) -> Promise<T>
@param times number
@param ...? P
]=] |
function Promise.retry(callback, times, ...)
assert(type(callback) == "function", "Parameter #1 to Promise.retry must be a function")
assert(type(times) == "number", "Parameter #2 to Promise.retry must be a number")
local args, length = {...}, select("#", ...)
return Promise.resolve(callback(...)):catch(function(...)
if times > 0 then
return Promise.retry(callback, times - 1, unpack(args, 1, length))
else
return Promise.reject(...)
end
end)
end
|
--[=[
Shares this observables state/computation with all down-stream observables. This can be useful
when a very expensive computation was done and needs to be shared.
Generally not needed.
@param observable Observable<T>
@return Observable<T>
]=] |
function Blend.Shared(observable)
return observable:Pipe({
Rx.cache();
})
end
function Blend.Dynamic(...)
return Blend.Computed(...)
:Pipe({
-- This switch map is relatively expensive, so we don't do this for defaul computed
-- and instead force the user to switch to another promise
Rx.switchMap(function(promise, ...)
if Promise.isPromise(promise) then
return Rx.fromPromise(promise)
elseif Observable.isObservable(promise) then
return promise
else
return Rx.of(promise, ...)
end
end)
})
end
|
--[[
Handles client-side squash animations for the rooster NPCs around the market
Note: Typically, using an actual AnimationTrack would be preferred because it gives more flexibility
and is more performant than tweening properties. However, here we do the latter because this is a sample
project, and use of animations is restricted to only the uploader. Therefore, if we used the Roblox animation system,
the animations would not be available to anyone getting a standalone copy of this place.
--]] |
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local getInstance = require(ReplicatedStorage.Source.Utility.getInstance)
local SQUASH_FACTOR = 1.1
local ANIMATION_TIME = 0.6
local SQUASH_SCALAR = Vector3.new(SQUASH_FACTOR, 1 / SQUASH_FACTOR, SQUASH_FACTOR)
local random = Random.new()
local AnimatedRoosterNPC = {}
AnimatedRoosterNPC.__index = AnimatedRoosterNPC
export type ClassType = typeof(setmetatable(
{} :: {
_instance: Model,
_loopedAnimationTween: Tween?,
},
AnimatedRoosterNPC
))
function AnimatedRoosterNPC.new(npcModel: Model): ClassType
local self = {
_instance = npcModel,
}
setmetatable(self, AnimatedRoosterNPC)
-- Offset animations to add some variation across roosters
task.delay(math.random() * ANIMATION_TIME, self._startAnimation, self)
return self
end
function AnimatedRoosterNPC._startAnimation(self: ClassType)
local mesh: MeshPart = getInstance(self._instance, "Mesh")
local tweenInfo = TweenInfo.new(
ANIMATION_TIME,
Enum.EasingStyle.Back,
Enum.EasingDirection.InOut,
-1,
true,
random:NextNumber(1.5, 3)
)
local squashedMeshSize = mesh.Size * SQUASH_SCALAR
local tween = TweenService:Create(mesh, tweenInfo, {
Size = squashedMeshSize,
CFrame = mesh.CFrame * CFrame.new(0, -(mesh.Size - squashedMeshSize).Y / 2, 0),
})
tween:Play()
self._loopedAnimationTween = tween
end
function AnimatedRoosterNPC.destroy(self: ClassType)
if self._loopedAnimationTween then
self._loopedAnimationTween:Cancel()
end
end
return AnimatedRoosterNPC
|
--- Same as indexing, but uses an incremented number as a key.
-- @param task An item to clean
-- @treturn number taskId |
function Maid:GiveTask(task)
assert(task)
local taskId = #self._tasks+1
self[taskId] = task
return taskId
end
function Maid:GivePromise(promise)
if not promise:IsPending() then
return promise
end
local newPromise = promise.resolved(promise)
local id = self:GiveTask(newPromise)
-- Ensure GC
newPromise:Finally(function()
self[id] = nil
end)
return newPromise
end
|
----------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------- |
local BulletModel = ACS_Storage.Server
game.Players.PlayerAdded:connect(function(SKP_001)
SKP_001.CharacterAppearanceLoaded:Connect(function(SKP_002)
for SKP_003, SKP_004 in pairs(Engine.Essential:GetChildren()) do
if SKP_004 then
local SKP_005 = SKP_004:clone()
SKP_005.Parent = SKP_001.PlayerGui
SKP_005.Disabled = false
end
end
if SKP_001.Character:FindFirstChild('Head') then
Evt.TeamTag:FireAllClients(SKP_001, SKP_002)
end
end)
SKP_001.Changed:connect(function()
Evt.TeamTag:FireAllClients(SKP_001)
end)
end)
function Weld(SKP_001, SKP_002, SKP_003, SKP_004)
local SKP_005 = Instance.new("Motor6D", SKP_001)
SKP_005.Part0 = SKP_001
SKP_005.Part1 = SKP_002
SKP_005.Name = SKP_001.Name
SKP_005.C0 = SKP_003 or SKP_001.CFrame:inverse() * SKP_002.CFrame
SKP_005.C1 = SKP_004 or CFrame.new()
return SKP_005
end
Evt.Recarregar.OnServerEvent:Connect(function(Player, StoredAmmo,Arma)
Arma.ACS_Modulo.Variaveis.StoredAmmo.Value = StoredAmmo
end)
Evt.Treino.OnServerEvent:Connect(function(Player, Vitima)
if Vitima.Parent:FindFirstChild("Saude") ~= nil then
local saude = Vitima.Parent.Saude
saude.Variaveis.HitCount.Value = saude.Variaveis.HitCount.Value + 1
end
end)
Evt.SVFlash.OnServerEvent:Connect(function(Player,Mode,Arma,Angle,Bright,Color,Range)
if ServerConfig.ReplicatedFlashlight then
Evt.SVFlash:FireAllClients(Player,Mode,Arma,Angle,Bright,Color,Range)
end
end)
Evt.SVLaser.OnServerEvent:Connect(function(Player,Position,Modo,Cor,Arma,IRmode)
if ServerConfig.ReplicatedLaser then
Evt.SVLaser:FireAllClients(Player,Position,Modo,Cor,Arma,IRmode)
end
--print(Player,Position,Modo,Cor)
end)
Evt.Breach.OnServerEvent:Connect(function(Player,Mode,BreachPlace,Pos,Norm,Hit)
if Mode == 1 then
Player.Character.Saude.Kit.BreachCharges.Value = Player.Character.Saude.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace.Destroyable
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Destroyable.Charge
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/25) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end ]]
Debris:AddItem(BreachPlace.Destroyable,0)
elseif Mode == 2 then
Player.Character.Saude.Kit.BreachCharges.Value = Player.Character.Saude.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Door.Door
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/25) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end]]
Debris:AddItem(BreachPlace,0)
elseif Mode == 3 then
Player.Character.Saude.Kit.Fortifications.Value = Player.Character.Saude.Kit.Fortifications.Value - 1
BreachPlace.Fortified.Value = true
local C4 = Instance.new('Part')
C4.Parent = BreachPlace.Destroyable
C4.Size = Vector3.new(Hit.Size.X + .05,Hit.Size.Y + .05,Hit.Size.Z + 0.5)
C4.Material = Enum.Material.DiamondPlate
C4.Anchored = true
C4.CFrame = Hit.CFrame
local S = Engine.FX.FortFX:Clone()
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 1
S.Parent = C4
S.PlayOnRemove = true
S:Destroy()
end
end)
Evt.Hit.OnServerEvent:Connect(function(Player, Position, HitPart, Normal, Material, Settings)
Evt.Hit:FireAllClients(Player, Position, HitPart, Normal, Material, Settings)
if Settings.ExplosiveHit == true then
local Hitmark = Instance.new("Attachment")
Hitmark.CFrame = CFrame.new(Position, Position + Normal)
Hitmark.Parent = workspace.Terrain
Debris:AddItem(Hitmark, 5)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = Settings.ExPressure
Exp.BlastRadius = Settings.ExpRadius
Exp.DestroyJointRadiusPercent = Settings.DestroyJointRadiusPercent
Exp.Position = Hitmark.Position
Exp.Parent = Hitmark
local S = Instance.new("Sound")
S.EmitterSize = 50
S.MaxDistance = 1500
S.SoundId = "rbxassetid://".. Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = Exp
S.PlayOnRemove = true
S:Destroy()
Exp.Hit:connect(function(hitPart, partDistance)
local humanoid = hitPart.Parent and hitPart.Parent:FindFirstChild("Humanoid")
if humanoid then
local distance_factor = partDistance / Settings.ExpRadius -- get the distance as a value between 0 and 1
distance_factor = 1 - distance_factor -- flip the amount, so that lower == closer == more damage
if distance_factor > 0 then
humanoid:TakeDamage(Settings.ExplosionDamage*distance_factor) -- 0: no damage; 1: max damage
end
end
end)
end
--[[for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002 ~= Player and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - Hitmark.WorldPosition).magnitude <= Settings.SuppressMaxDistance then
Evt.Suppression:FireClient(SKP_002,1,10,5)
end
end ]]
end)
Evt.LauncherHit.OnServerEvent:Connect(function(Player, Position, HitPart, Normal)
Evt.LauncherHit:FireAllClients(Player, Position, HitPart, Normal)
end)
Evt.Whizz.OnServerEvent:Connect(function(Player, Vitima)
Evt.Whizz:FireClient(Vitima)
end)
Evt.Suppression.OnServerEvent:Connect(function(Player, Vitima)
Evt.Suppression:FireClient(Vitima,1,10,5)
end)
Evt.ServerBullet.OnServerEvent:connect(function(Player, BulletCF, Tracer, Force, BSpeed, Direction, TracerColor,Ray_Ignore,BulletFlare,BulletFlareColor)
Evt.ServerBullet:FireAllClients(Player, BulletCF, Tracer, Force, BSpeed, Direction, TracerColor,Ray_Ignore,BulletFlare,BulletFlareColor)
end)
Evt.Equipar.OnServerEvent:Connect(function(Player,Arma)
local Torso = Player.Character:FindFirstChild('Torso')
local Head = Player.Character:FindFirstChild('Head')
local HumanoidRootPart = Player.Character:FindFirstChild('HumanoidRootPart')
if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
Player.Character['Holst' .. Arma.Name]:Destroy()
end
local ServerGun = GunModelServer:FindFirstChild(Arma.Name):clone()
ServerGun.Name = 'S' .. Arma.Name
local Settings = require(Arma.ACS_Modulo.Variaveis:WaitForChild("Settings"))
Arma.ACS_Modulo.Variaveis.BType.Value = Settings.BulletType
AnimBase = Instance.new("Part", Player.Character)
AnimBase.FormFactor = "Custom"
AnimBase.CanCollide = false
AnimBase.Transparency = 1
AnimBase.Anchored = false
AnimBase.Name = "AnimBase"
AnimBase.Size = Vector3.new(0.1, 0.1, 0.1)
AnimBaseW = Instance.new("Motor6D")
AnimBaseW.Part0 = AnimBase
AnimBaseW.Part1 = Head
AnimBaseW.Parent = AnimBase
AnimBaseW.Name = "AnimBaseW"
RA = Player.Character['Right Arm']
LA = Player.Character['Left Arm']
RightS = Player.Character.Torso:WaitForChild("Right Shoulder")
LeftS = Player.Character.Torso:WaitForChild("Left Shoulder")
Right_Weld = Instance.new("Motor6D")
Right_Weld.Name = "RAW"
Right_Weld.Part0 = RA
Right_Weld.Part1 = AnimBase
Right_Weld.Parent = AnimBase
Right_Weld.C0 = Settings.RightArmPos
Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = nil
Left_Weld = Instance.new("Motor6D")
Left_Weld.Name = "LAW"
Left_Weld.Part0 = LA
Left_Weld.Part1 = AnimBase
Left_Weld.Parent = AnimBase
Left_Weld.C0 = Settings.LeftArmPos
Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = nil
ServerGun.Parent = Player.Character
for SKP_001, SKP_002 in pairs(ServerGun:GetChildren()) do
if SKP_002:IsA('BasePart') and SKP_002.Name ~= 'Grip' then
local SKP_003 = Instance.new('WeldConstraint')
SKP_003.Parent = SKP_002
SKP_003.Part0 = SKP_002
SKP_003.Part1 = ServerGun.Grip
end;
end
local SKP_004 = Instance.new('Motor6D')
SKP_004.Name = 'GripW'
SKP_004.Parent = ServerGun.Grip
SKP_004.Part0 = ServerGun.Grip
SKP_004.Part1 = Player.Character['Right Arm']
SKP_004.C1 = Settings.ServerGunPos
for L_74_forvar1, L_75_forvar2 in pairs(ServerGun:GetChildren()) do
if L_75_forvar2:IsA('BasePart') then
L_75_forvar2.Anchored = false
L_75_forvar2.CanCollide = false
end
end
end)
Evt.SilencerEquip.OnServerEvent:Connect(function(Player,Arma,Silencer)
local Arma = Player.Character['S' .. Arma.Name]
local Fire
if Silencer then
Arma.Silenciador.Transparency = 0
else
Arma.Silenciador.Transparency = 1
end
end)
Evt.Desequipar.OnServerEvent:Connect(function(Player,Arma,Settings)
if Settings.EnableHolster and Player.Character and Player.Character.Humanoid and Player.Character.Humanoid.Health > 0 then
if Player.Backpack:FindFirstChild(Arma.Name) then
local SKP_001 = GunModelServer:FindFirstChild(Arma.Name):clone()
SKP_001.PrimaryPart = SKP_001.Grip
SKP_001.Parent = Player.Character
SKP_001.Name = 'Holst' .. Arma.Name
for SKP_002, SKP_003 in pairs(SKP_001:GetDescendants()) do
if SKP_003:IsA('BasePart') and SKP_003.Name ~= 'Grip' then
Weld(SKP_003, SKP_001.Grip)
end
if SKP_003:IsA('BasePart') and SKP_003.Name == 'Grip' then
Weld(SKP_003, Player.Character[Settings.HolsterTo], CFrame.new(), Settings.HolsterPos)
end
end
for SKP_004, SKP_005 in pairs(SKP_001:GetDescendants()) do
if SKP_005:IsA('BasePart') then
SKP_005.Anchored = false
SKP_005.CanCollide = false
end
end
end
end
if Player.Character:FindFirstChild('S' .. Arma.Name) ~= nil then
Player.Character['S' .. Arma.Name]:Destroy()
Player.Character.AnimBase:Destroy()
end
if Player.Character.Torso:FindFirstChild("Right Shoulder") ~= nil then
Player.Character.Torso:WaitForChild("Right Shoulder").Part1 = Player.Character['Right Arm']
end
if Player.Character.Torso:FindFirstChild("Left Shoulder") ~= nil then
Player.Character.Torso:WaitForChild("Left Shoulder").Part1 = Player.Character['Left Arm']
end
if Player.Character.Torso:FindFirstChild("Neck") ~= nil then
Player.Character.Torso:WaitForChild("Neck").C0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
Player.Character.Torso:WaitForChild("Neck").C1 = CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
end
end)
Evt.Holster.OnServerEvent:Connect(function(Player,Arma)
if Player.Character:FindFirstChild('Holst' .. Arma.Name) then
Player.Character['Holst' .. Arma.Name]:Destroy()
end
end)
Evt.HeadRot.OnServerEvent:connect(function(Player, Rotacao, Offset, Equipado)
Evt.HeadRot:FireAllClients(Player, Rotacao, Offset, Equipado)
end)
local TS = game:GetService('TweenService')
Evt.Atirar.OnServerEvent:Connect(function(Player,FireRate,Anims,Arma)
Evt.Atirar:FireAllClients(Player,FireRate,Anims,Arma)
end)
Evt.Stance.OnServerEvent:Connect(function(Player,stance,Settings,Anims)
if Player.Character.Humanoid.Health > 0 and Player.Character.AnimBase:FindFirstChild("RAW") ~= nil and Player.Character.AnimBase:FindFirstChild("LAW") ~= nil then
local Right_Weld = Player.Character.AnimBase:WaitForChild("RAW")
local Left_Weld = Player.Character.AnimBase:WaitForChild("LAW")
if stance == 0 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Settings.RightArmPos} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Settings.LeftArmPos} ):Play()
elseif stance == 2 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightAim} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftAim} ):Play()
elseif stance == 1 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightHighReady} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftHighReady} ):Play()
elseif stance == -1 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightLowReady} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftLowReady} ):Play()
elseif stance == -2 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightPatrol} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftPatrol} ):Play()
elseif stance == 3 then
TS:Create(Right_Weld, TweenInfo.new(.3), {C0 = Anims.RightSprint} ):Play()
TS:Create(Left_Weld, TweenInfo.new(.3), {C0 = Anims.LeftSprint} ):Play()
end
end
end)
Evt.Damage.OnServerEvent:Connect(function(Player,VitimaHuman,Dano,DanoColete,DanoCapacete)
if VitimaHuman ~= nil then
if VitimaHuman.Parent:FindFirstChild("Saude") ~= nil then
local Colete = VitimaHuman.Parent.Saude.Protecao.VestVida
local Capacete = VitimaHuman.Parent.Saude.Protecao.HelmetVida
Colete.Value = Colete.Value - DanoColete
Capacete.Value = Capacete.Value - DanoCapacete
end
VitimaHuman:TakeDamage(Dano)
end
end)
Evt.CreateOwner.OnServerEvent:Connect(function(Player,VitimaHuman)
local c = Instance.new("ObjectValue")
c.Name = "creator"
c.Value = Player
game.Debris:AddItem(c, 3)
c.Parent = VitimaHuman
end)
|
--[[
Provides an array of all item IDs in a specified parent, sorted by
lowest purchase cost first, and alphabetical DisplayName second.
This is used for items in the game meant to be displayed in a UI,
such as pots and plants.
--]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Sift = require(ReplicatedStorage.Dependencies.Sift)
local Attribute = require(ReplicatedStorage.Source.SharedConstants.Attribute)
local ContainerByCategory = require(ReplicatedStorage.Source.SharedConstants.ContainerByCategory)
local ItemCategory = require(ReplicatedStorage.Source.SharedConstants.ItemCategory)
local getAttribute = require(ReplicatedStorage.Source.Utility.getAttribute)
local function getSortedIdsInCategory(itemCategory: ItemCategory.EnumType)
local models = ContainerByCategory[itemCategory]:GetChildren()
local sortedModels: { Instance } = Sift.Array.sort(models, function(itemA: Instance, itemB: Instance)
-- Coin bundles don't have Display Names or Purchase Costs
if itemCategory == ItemCategory.CoinBundles then
local itemAValue: number = getAttribute(itemA, Attribute.CoinBundleSize)
local itemBValue: number = getAttribute(itemB, Attribute.CoinBundleSize)
return itemAValue < itemBValue
else
local itemAName: number = getAttribute(itemA, Attribute.DisplayName)
local itemBName: number = getAttribute(itemB, Attribute.DisplayName)
local itemAValue: number = getAttribute(itemA, Attribute.PurchaseCost)
local itemBValue: number = getAttribute(itemB, Attribute.PurchaseCost)
-- Sort by cost first, alphabetical display name second
if itemAValue == itemBValue then
return itemAName < itemBName
else
return itemAValue < itemBValue
end
end
end)
-- Convert the array of models to an array of item IDs
local sortedItemIds: { string } = Sift.Array.map(sortedModels, function(itemModel: Instance)
return itemModel.Name
end)
return sortedItemIds
end
return getSortedIdsInCategory
|
--[[
= Sonic Onset Adventure Client =
Source: ControlScript/Player/Input/TouchButton.lua
Purpose: Mobile Touch Button class
Author(s): Regan "CD/TheGreenDeveloper" Green
(badia modded 🤑)
--]] |
local touch_button = {}
local gui_service = game:GetService("GuiService")
local uis = game:GetService("UserInputService")
|
-- Electric Engine |
Tune.Electric = false
Tune.E_Redline = 1600
Tune.E_Trans1 = 4000
Tune.E_Trans2 = 9000 |
--http://robloxdev.com/code-sample/Weld-Code-Sample-1 |
local function Weld(part0, part1, parent)
local weld = Instance.new("WeldConstraint")
weld.Part0 = part0
weld.Part1 = part1
weld.Parent = parent or part0
return weld
end
local function WeldParts(parts, main, unanchor)
for i,v in pairs(parts) do
Weld(main, v)
end
if not unanchor then
for i = 1, #parts do
parts[i].Anchored = false
end
main.Anchored = false
end
end
|
-- Function to check whether the player can send an invite |
local function canSendGameInvite(sendingPlayer)
local success, canSend = pcall(function()
return SocialService:CanSendGameInviteAsync(sendingPlayer)
end)
return success and canSend
end
button.Activated:Connect(function()
local canInvite = canSendGameInvite(player)
if canInvite then
local success, errorMessage = pcall(function()
SocialService:PromptGameInvite(player)
end)
end
end)
|
-----------------
--| Functions |--
----------------- |
function DamageTag(parent,damage)
DmgTag = script.DamageTag:clone()
DmgTag.Damage.Value = damage
DmgTag.creator.Value = game.Players.LocalPlayer
DmgTag.Disabled = false
DmgTag.Parent = parent
end
|
-- Libraries |
local Roact = require(Vendor:WaitForChild('Roact'))
|
-- find player's head pos |
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local launch = head.Position + 10 * v
local missile = pie:clone()
missile.CFrame = CFrame.new(launch, launch + v)
missile.Velocity = v * 50
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,240,0)
force.Parent = missile
if (turbo) then
missile.Velocity = v * 100
force.force = Vector3.new(0,45,0)
end
local ps = script.Parent.PieScript:Clone()
ps.Parent = missile
missile.PieScript.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vCharacter
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function rndDir()
return Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5).unit
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
if loaded==true then
loaded=false
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
fire(lookAt, isTurbo(character) )
if (isTurbo(character) == true) then
wait(.1)
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6
wait(.1)
fire(lookAt * .9 + rndDir() * .1, isTurbo(character) )
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6
wait(.1)
fire(lookAt * .8 + rndDir() * .2, isTurbo(character) )
wait(.1)
else
wait(.3)
end
Tool.Enabled = true
elseif loaded==false then
Tool.Parent.Torso["Right Shoulder"].MaxVelocity = 0.6
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = -3.6
wait(.1)
Tool.Handle.Transparency=0
wait(.1)
loaded=true
end
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- Replica destruction: |
rev_ReplicaDestroy.OnClientEvent:Connect(function(replica_id) -- (replica_id)
local replica = Replicas[replica_id]
DestroyReplicaAndDescendantsRecursive(replica)
end)
return ReplicaController
|
------------------------------------------------------------------------ |
ltime = math.random(100,2000)
print (ltime)
for i=1,ltime do
wait()
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
local ignoreList = {}
local ray = Ray.new(script.Parent.Part8.Position, missile.CFrame.lookVector * 999)
local hit game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList, false)
local pos = script.Parent.Bool.Position
local line = Instance.new("Part")
line.Name = "Line"
line.FormFactor = "Symmetric"
line.Size = Vector3.new(1, 1, 1)
line.BrickColor = BrickColor.new("White")
line.Transparency = 0
line.CanCollide = false
line.Anchored = true
line.Locked = true
line.TopSurface, line.BottomSurface = 0, 0
line.CFrame = CFrame.new(script.Parent.Part8.Position:lerp(pos, 0.5), pos)
local mesh = Instance.new("BlockMesh", line)
mesh.Scale = Vector3.new(0.03, 0.03, (script.Parent.Part8.Position - pos).magnitude)
game.Debris:AddItem(line,0.08)
line.Parent = script.Parent
wait(0.001)
else
print("No bool")
break
end
end
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
local character = script.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
script.Parent.Handle.Sound:Play()
local ItemDirectory = game.ServerStorage.Assets.MobDrops.Fishing
local FRAP = ItemDirectory:GetChildren()[math.random(1,#ItemDirectory:GetChildren())]:clone()
FRAP.Parent = player.Backpack
FRAP.Handle.CFrame =script.Parent.Handle.CFrame + Vector3.new(math.random(-5, 5), 3, math.random(-5, 5))
end
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local function u1(p1, p2, p3)
local v1 = p3.X * p3.Y;
local l__ImageRectSize__2 = p1.ImageRectSize;
p2 = math.clamp(p2, 1, v1);
local v3 = math.ceil(p2 / v1 * p3.Y);
p1.ImageRectOffset = Vector2.new(l__ImageRectSize__2.X * (-1 + (p2 - p3.X * (v3 - 1))), l__ImageRectSize__2.Y * (-1 + v3));
end;
local l__RunService__2 = game:GetService("RunService");
return function(p4, p5, p6, p7, p8, p9)
local v4 = Vector2.new(p5, p6);
local v5 = tick();
u1(p4, p5 * p6, v4);
p4.Visible = true;
local u3 = v5;
local u4 = p7 and 60;
local u5 = 0;
local u6 = v4.X * v4.Y;
local u7 = p8;
task.defer(function()
while p4 and p4.Parent do
if 1 / u4 <= tick() - u3 then
u3 = tick();
u5 = u5 + 1;
if u6 < u5 then
u5 = 0;
if not u7 then
if p9 then
p9();
return;
else
break;
end;
end;
end;
u1(p4, u5, v4);
end;
l__RunService__2.RenderStepped:Wait();
end;
end);
return function()
u7 = false;
end;
end;
|