prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--------
|
local HitboxObject = {}
local Hitbox = {}
Hitbox.__index = Hitbox
function Hitbox:__tostring()
return string.format("Hitbox for instance %s [%s]", self.object.Name, self.object.ClassName)
end
function HitboxObject:new()
return setmetatable({}, Hitbox)
end
function Hitbox:config(object, ignoreList)
self.active = false
self.deleted = false
self.partMode = false
self.debugMode = false
self.points = {}
self.targetsHit = {}
self.endTime = 0
self.OnHit = Signal:Create()
self.OnUpdate = Signal:Create()
self.raycastParams = RaycastParams.new()
self.raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
self.raycastParams.FilterDescendantsInstances = ignoreList or {}
self.object = object
CollectionService:AddTag(self.object, "RaycastModuleManaged")
end
function Hitbox:SetPoints(object, vectorPoints, groupName)
if object and (object:IsA("BasePart") or object:IsA("MeshPart") or object:IsA("Attachment")) then
for _, vectors in ipairs(vectorPoints) do
if typeof(vectors) == "Vector3" then
local Point = {
IsAttachment = object:IsA("Attachment"),
RelativePart = object,
Attachment = vectors,
LastPosition = nil,
group = groupName,
solver = CastVectorPoint
}
table.insert(self.points, Point)
end
end
end
end
function Hitbox:RemovePoints(object, vectorPoints)
if object then
if object:IsA("BasePart") or object:IsA("MeshPart") then --- for some reason it doesn't recognize meshparts unless I add it in
for i = 1, #self.points do
local Point = self.points[i]
for _, vectors in ipairs(vectorPoints) do
if typeof(Point.Attachment) == "Vector3" and Point.Attachment == vectors and Point.RelativePart == object then
self.points[i] = nil
end
end
end
end
end
end
function Hitbox:LinkAttachments(primaryAttachment, secondaryAttachment)
if primaryAttachment:IsA("Attachment") and secondaryAttachment:IsA("Attachment") then
local group = primaryAttachment:FindFirstChild("Group")
local Point = {
RelativePart = nil,
Attachment = primaryAttachment,
Attachment0 = secondaryAttachment,
LastPosition = nil,
group = group and group.Value,
solver = CastLinkAttach
}
table.insert(self.points, Point)
end
end
function Hitbox:UnlinkAttachments(primaryAttachment)
for i, Point in ipairs(self.points) do
if Point.Attachment and Point.Attachment == primaryAttachment then
table.remove(self.points, i)
break
end
end
end
function Hitbox:seekAttachments(attachmentName, canWarn)
if #self.points <= 0 then
table.insert(self.raycastParams.FilterDescendantsInstances, workspace.Terrain)
end
for _, attachment in ipairs(self.object:GetDescendants()) do
if attachment:IsA("Attachment") and attachment.Name == attachmentName then
local group = attachment:FindFirstChild("Group")
local Point = {
Attachment = attachment,
RelativePart = nil,
LastPosition = nil,
group = group and group.Value,
solver = CastAttachment
}
table.insert(self.points, Point)
end
end
if canWarn then
if #self.points <= 0 then
warn(string.format("\n[[RAYCAST WARNING]]\nNo attachments with the name '%s' were found in %s. No raycasts will be drawn. Can be ignored if you are using SetPoints.",
attachmentName, self.object.Name)
)
else
print(string.format("\n[[RAYCAST MESSAGE]]\n\nCreated Hitbox for %s - Attachments found: %s",
self.object.Name, #self.points)
)
end
end
end
function Hitbox:Destroy()
if self.deleted then return end
if self.OnHit then self.OnHit:Delete() end
if self.OnUpdate then self.OnUpdate:Delete() end
self.points = nil
self.active = false
self.deleted = true
end
function Hitbox:HitStart(seconds)
self.active = true
if seconds then
assert(type(seconds) == "number", "Argument #1 must be a number!")
local minSeconds = 1 / 60 --- Seconds cannot be under 1/60th
if seconds <= minSeconds or seconds == math.huge then
seconds = minSeconds
end
self.endTime = clock() + seconds
end
end
function Hitbox:HitStop()
if self.deleted then return end
self.active = false
self.endTime = 0
table.clear(self.targetsHit)
end
function Hitbox:PartMode(bool)
self.partMode = bool
end
function Hitbox:DebugMode(bool)
self.debugMode = bool
end
return HitboxObject
|
--[=[
An object that can be cleaned up
@type MaidTask function | thread | Destructable | RBXScriptConnection
@within MaidTaskUtils
]=]
|
local MaidTaskUtils = {}
|
-- SolarCrane
|
local MAX_TWEEN_RATE = 2.8 -- per second
local function clamp(low, high, num)
if low <= high then
return math.min(high, math.max(low, num))
end
return num
end
local function Round(num, places)
places = places or 0
local decimalPivot = 10^places
return math.floor(num * decimalPivot + 0.5) / decimalPivot
end
local function CreateTransparencyController()
local module = {}
local LastUpdate = tick()
local TransparencyDirty = false
local Enabled = false
local LastTransparency = nil
local DescendantAddedConn, DescendantRemovingConn = nil, nil
local ToolDescendantAddedConns = {}
local ToolDescendantRemovingConns = {}
local CachedParts = {}
local function HasToolAncestor(object)
if object.Parent == nil then return false end
return object.Parent:IsA('Tool') or HasToolAncestor(object.Parent)
end
local function IsValidPartToModify(part)
if part:IsA('BasePart') or part:IsA('Decal') then
return not HasToolAncestor(part)
end
return false
end
local function CachePartsRecursive(object)
if object then
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
end
for _, child in pairs(object:GetChildren()) do
CachePartsRecursive(child)
end
end
end
local function TeardownTransparency()
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = 0
end
CachedParts = {}
TransparencyDirty = true
LastTransparency = nil
if DescendantAddedConn then
DescendantAddedConn:disconnect()
DescendantAddedConn = nil
end
if DescendantRemovingConn then
DescendantRemovingConn:disconnect()
DescendantRemovingConn = nil
end
for object, conn in pairs(ToolDescendantAddedConns) do
conn:disconnect()
ToolDescendantAddedConns[object] = nil
end
for object, conn in pairs(ToolDescendantRemovingConns) do
conn:disconnect()
ToolDescendantRemovingConns[object] = nil
end
end
local function SetupTransparency(character)
TeardownTransparency()
if DescendantAddedConn then DescendantAddedConn:disconnect() end
DescendantAddedConn = character.DescendantAdded:connect(function(object)
local Pet = (object.Name == "Pet" and object) or character:FindFirstChild("Pet");
if Pet and object:IsDescendantOf(Pet) then
return;
end
-- This is a part we want to invisify
if IsValidPartToModify(object) then
CachedParts[object] = true
TransparencyDirty = true
-- There is now a tool under the character
elseif object:IsA('Tool') then
if ToolDescendantAddedConns[object] then ToolDescendantAddedConns[object]:disconnect() end
ToolDescendantAddedConns[object] = object.DescendantAdded:connect(function(toolChild)
CachedParts[toolChild] = nil
if toolChild:IsA('BasePart') or toolChild:IsA('Decal') then
-- Reset the transparency
toolChild.LocalTransparencyModifier = 0
end
end)
if ToolDescendantRemovingConns[object] then ToolDescendantRemovingConns[object]:disconnect() end
ToolDescendantRemovingConns[object] = object.DescendantRemoving:connect(function(formerToolChild)
wait() -- wait for new parent
if character and formerToolChild and formerToolChild:IsDescendantOf(character) then
if IsValidPartToModify(formerToolChild) then
CachedParts[formerToolChild] = true
TransparencyDirty = true
end
end
end)
end
end)
if DescendantRemovingConn then DescendantRemovingConn:disconnect() end
DescendantRemovingConn = character.DescendantRemoving:connect(function(object)
if CachedParts[object] then
CachedParts[object] = nil
-- Reset the transparency
object.LocalTransparencyModifier = 0
end
end)
CachePartsRecursive(character)
end
function module:SetEnabled(newState)
if Enabled ~= newState then
Enabled = newState
self:Update()
end
end
function module:SetSubject(subject)
local character = subject and subject:IsA('Humanoid') and subject.Parent
if character then
SetupTransparency(character)
else
TeardownTransparency()
end
end
function module:Update()
local instant = false
local now = tick()
local currentCamera = workspace.CurrentCamera
if currentCamera then
local transparency = 0
if not Enabled then
instant = true
else
local distance = (currentCamera.Focus.p - currentCamera.CoordinateFrame.p).magnitude
transparency = (7 - distance) / 5
if transparency < 0.5 then
transparency = 0
end
if LastTransparency then
local deltaTransparency = transparency - LastTransparency
-- Don't tween transparency if it is instant or your character was fully invisible last frame
if not instant and transparency < 1 and LastTransparency < 0.95 then
local maxDelta = MAX_TWEEN_RATE * (now - LastUpdate)
deltaTransparency = clamp(-maxDelta, maxDelta, deltaTransparency)
end
transparency = LastTransparency + deltaTransparency
else
TransparencyDirty = true
end
transparency = clamp(0, 1, Round(transparency, 2))
end
if TransparencyDirty or LastTransparency ~= transparency then
for child, _ in pairs(CachedParts) do
child.LocalTransparencyModifier = transparency
end
TransparencyDirty = false
LastTransparency = transparency
end
end
LastUpdate = now
end
return module
end
return CreateTransparencyController
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local l__TweenService__2 = game:GetService("TweenService");
v1.module_events = require(script.Parent.Parent.Module_Events);
local u1 = game:GetService("ReplicatedStorage").Misc.Eyes:GetChildren();
function v1.tease(p1, p2, p3, p4, p5)
local u2 = p4;
spawn(function()
if not u2 then
u2 = math.random(1, 500);
end;
u2 = Random.new(u2);
local v3 = {};
local v4 = {};
for v5, v6 in pairs(p2:GetDescendants()) do
if v6:IsA("BasePart") then
if v6.Name == "Wall" or v6.Name == "Wall_Strip" then
table.insert(v3, v6);
end;
if v6.Name == "Carpet" then
table.insert(v4, v6);
end;
end;
end;
if #v4 <= 0 then
for v7, v8 in pairs(p2:GetDescendants()) do
if v8:IsA("BasePart") and v8.Name == "Floor" then
table.insert(v4, v8);
end;
end;
end;
local v9 = RaycastParams.new();
v9.CollisionGroup = "CheckWallStuff";
local v10 = RaycastParams.new();
v10.CollisionGroup = "CheckWallStuff";
v1.module_events.flickerLights(p2, math.clamp(p3 / 5, 0.4, 1));
local v11 = p3;
for v12 = 1, 100 do
local v13 = workspace:Raycast(v4[u2:NextInteger(1, #v4)].Position + Vector3.new(u2:NextInteger(-5, 5), u2:NextInteger(5, 11), u2:NextInteger(-5, 5)), CFrame.Angles(0, math.rad(u2:NextInteger(0, 360)), 0).LookVector * 150, v9);
local v14 = Vector3.new(4, 2, 0);
if v13 then
local l__Position__15 = v13.Position;
local l__Instance__16 = v13.Instance;
local l__Normal__17 = v13.Normal;
if l__Position__15 and l__Instance__16 and l__Instance__16.Anchored == true and (l__Instance__16.Name == "Wall" or l__Instance__16.Name == "WallAlt") then
for v18 = 1, 4 do
if v18 <= 2 then
local v19 = 1;
else
v19 = -1;
end;
if v18 == 2 or v18 == 4 then
local v20 = 1;
else
v20 = -1;
end;
local v21 = workspace:Raycast((CFrame.new(l__Position__15 + l__Normal__17, l__Position__15) * CFrame.new(v14.X / 2 * v19, v14.Y / 2 * v20, 0)).p, l__Normal__17 * -1.1, v10);
if not v21 then
local v22 = false;
break;
end;
local l__Instance__23 = v21.Instance;
local l__Normal__24 = v21.Normal;
if not v21.Position then
v22 = false;
break;
end;
if not l__Instance__23 then
v22 = false;
break;
end;
if l__Instance__23.Anchored ~= true then
v22 = false;
break;
end;
if l__Instance__23.Name ~= "Wall" and l__Instance__23.Name ~= "WallAlt" then
v22 = false;
break;
end;
end;
else
v22 = false;
end;
if v22 == true then
local v25 = u1[u2:NextInteger(1, #u1)]:Clone();
v25:SetPrimaryPartCFrame(CFrame.new(l__Position__15, l__Position__15 + l__Normal__17) * CFrame.Angles(0, 0, math.rad(u2:NextInteger(-20, 20))));
v25.Parent = p2;
v25.PrimaryPart.PlaySound:Play();
v25.PrimaryPart.Splat.Pitch = u2:NextInteger(80, 120) / 100;
v25.PrimaryPart.Splat:Play();
spawn(function()
pcall(function()
task.delay(3, function()
for v26, v27 in pairs(v25:GetDescendants()) do
if v27:IsA("BasePart") then
v27.CanCollide = false;
v27.CanQuery = false;
v27.CanTouch = false;
v27.CollisionGroupId = 1;
end;
end;
end);
end);
if UserSettings().GameSettings.SavedQualityLevel.Value >= 5 then
pcall(function()
for v28 = 1, math.random(1, 3) do
wait(math.random(5, 50) / 10);
v25.Eye.Transparency = 1;
v25.Eye.Decal.Transparency = 1;
v25.PrimaryPart.ParticleEmitter:Emit(2);
v25.PrimaryPart.Blink.Pitch = u2:NextInteger(80, 120) / 120;
v25.PrimaryPart.Blink:Play();
wait(0.1);
v25.Eye.Transparency = 0;
v25.Eye.Decal.Transparency = 0;
end;
end);
end;
end);
v11 = v11 - 1;
end;
end;
task.wait(0.016666666666666666);
if v11 <= 0 then
break;
end;
end;
end);
if p5 == true then
spawn(function()
for v29, v30 in pairs(p2:GetDescendants()) do
if UserSettings().GameSettings.SavedQualityLevel.Value >= 5 and v30:IsA("BasePart") and (v30.Name == "Wall" or v30.Name == "Wall_Strip" or v30.Name == "WallAlt" or v30.Name == "Floor" or v30.Name == "Carpet" or v30.Name == "Ceiling") then
local v31 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left, Enum.NormalId.Top, Enum.NormalId.Bottom };
if v30.Name == "Wall" or v30.Name == "Wall_Strip" or v30.Name == "WallAlt" then
v31 = { Enum.NormalId.Front, Enum.NormalId.Back, Enum.NormalId.Right, Enum.NormalId.Left };
end;
if v30.Name == "Floor" or v30.Name == "Carpet" then
v31 = { Enum.NormalId.Top };
end;
if v30.Name == "Ceiling" then
v31 = { Enum.NormalId.Bottom };
end;
for v32, v33 in pairs(v31) do
local v34 = game:GetService("ReplicatedStorage").Misc.EyesTexture:Clone();
v34.Face = v33;
v34.Parent = v30;
task.spawn(function()
local v35 = tick();
for v36 = 1, 100 do
v34.OffsetStudsU = math.random(-50, 50);
v34.OffsetStudsV = math.random(-50, 50);
task.wait(math.random(20, 100) / 100);
if v35 + 12 <= tick() then
break;
end;
end;
end);
game.Debris:AddItem(v34, 12);
end;
end;
end;
end);
end;
end;
return v1;
|
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.MouseButton1Click:connect(function()
if car.Misc.Popups.Parts.L.L.L.Enabled == false and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,255/255,0)
script.Parent.TextStrokeColor3 = Color3.new(0,255/255,0)
car.Misc.Popups.Parts.L.L.L.Enabled = true
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.H.L.L.Enabled = false
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
elseif car.Misc.Popups.Parts.L.L.L.Enabled == true and car.Body.Lights.H.L.L.Enabled == false then
script.Parent.BackgroundColor3 = Color3.new(0,0,255/255)
script.Parent.TextStrokeColor3 = Color3.new(0,0,255/255)
car.Misc.Popups.Parts.L.L.L.Enabled = false
car.Body.Lights.R.L.L.Enabled = true
car.Body.Lights.H.L.L.Enabled = true
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.Neon
end
elseif car.Misc.Popups.Parts.L.L.L.Enabled == false and car.Body.Lights.H.L.L.Enabled == true then
script.Parent.BackgroundColor3 = Color3.new(0,0,0)
script.Parent.TextStrokeColor3 = Color3.new(0,0,0)
car.Misc.Popups.Parts.L.L.L.Enabled = false
car.Body.Lights.R.L.L.Enabled = false
car.Body.Lights.H.L.L.Enabled = false
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Misc.Popups.Parts.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.R:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.H:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 and script.Parent.Parent.Parent.IsOn.Value then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .2
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = require(script.Parent);
local v3 = require(script:FindFirstAncestor("MainUI").Modules.WindShake);
local v4 = require(l__LocalPlayer__1:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v5 = game["Run Service"];
local l__UserInputService__6 = game:GetService("UserInputService");
local l__TweenService__7 = game:GetService("TweenService");
local v8 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("Module_Events"));
v3:Init();
v2.gd:WaitForChild("ChaseInSession").Changed:Connect(function(p1)
end);
local function v9()
local v10 = workspace.CurrentRooms:FindFirstChild(v2.gd.LatestRoom.Value);
if v10 and v10:GetAttribute("RequiresKey") == true then
end;
if v10:WaitForChild("Door", 1) then
local l__Door__11 = v10:FindFirstChild("Door");
local v12 = 12;
if v2.chase then
v12 = 24;
end;
if l__Door__11 then
local l__Value__1 = v2.gd.LatestRoom.Value;
task.spawn(function()
for v13 = 1, 10000 do
wait(0.1);
if l__Value__1 < tonumber(l__LocalPlayer__1:GetAttribute("CurrentRoom")) then
return;
end;
if (l__LocalPlayer__1.Character.PrimaryPart.Position - l__Door__11.PrimaryPart.Position).Magnitude < v12 then
local v14 = RaycastParams.new();
v14.CollisionGroup = "Player";
v14.FilterDescendantsInstances = { l__Door__11, l__LocalPlayer__1.Character };
local v15 = workspace:Raycast(l__LocalPlayer__1.Character.PrimaryPart.Position, CFrame.new(l__LocalPlayer__1.Character.PrimaryPart.Position, l__Door__11.PrimaryPart.Position).LookVector * (l__LocalPlayer__1.Character.PrimaryPart.Position - l__Door__11.PrimaryPart.Position).Magnitude, v14);
if not v15 then
l__Door__11.ClientOpen:FireServer();
return;
end;
if not v15.Position then
l__Door__11.ClientOpen:FireServer();
return;
end;
end;
end;
end);
end;
end;
if v10:FindFirstChild("Shopkeeper") then
require(script.Shopkeeper).run(v10);
end;
local v16, v17, v18 = ipairs(v10:GetDescendants());
while true do
v16(v17, v18);
if not v16 then
break;
end;
v18 = v16;
if v17:IsA("BasePart") and v17:GetAttribute("WindShake") == true then
print("sup");
v3:AddObjectShake(v17);
elseif v17.Name == "GuidingLightStuff" or v17.Name == "HelpLight" or v17.Name == "HelpParticle" then
if v17:IsA("SpotLight") then
if UserSettings().GameSettings.SavedQualityLevel.Value <= 4 then
v17.Color = Color3.fromRGB(39, 190, 255);
v17.Brightness = 8;
v17.Range = 32;
v17.Angle = 40;
end;
elseif v17:IsA("ParticleEmitter") and UserSettings().GameSettings.SavedQualityLevel.Value <= 5 then
v17.Rate = 50;
end;
end;
end;
if v10:GetAttribute("Header") ~= nil and v10:GetAttribute("Header") ~= "" and v10:GetAttribute("Header") ~= " " then
print("doing header");
v2.titlelocation(v10:GetAttribute("Header"));
end;
if v10:FindFirstChild("FigureSetup", true) then
local l__FigureRagdoll__19 = v10:FindFirstChild("FigureSetup", true).FigureRagdoll;
local l__Parent__20 = l__FigureRagdoll__19.Parent;
local v21 = 0;
local l__Click__22 = l__FigureRagdoll__19.Head.Click;
local l__Growl__23 = l__FigureRagdoll__19.Head.Growl;
local v24 = {};
for v25, v26 in pairs(l__FigureRagdoll__19:GetDescendants()) do
if v26:IsA("Light") and v26.Name == "BlisterLight" then
v26.Enabled = true;
v26.Brightness = 0;
table.insert(v24, {
Light = v26,
Distance = l__FigureRagdoll__19.Head.Position - v26.Parent.WorldPosition
});
end;
end;
local v27 = TweenInfo.new(0.1, Enum.EasingStyle.Linear);
for v28 = 1, 100000000 do
wait(0.1);
if not l__FigureRagdoll__19 then
break;
end;
if l__FigureRagdoll__19.Parent ~= l__Parent__20 then
break;
end;
local v29 = (l__Click__22.PlaybackLoudness + l__Growl__23.PlaybackLoudness) / 60;
if v29 ~= v21 then
for v30, v31 in v24, nil do
delay(v31.Distance / 2, function()
l__TweenService__7:Create(v31.Light, v27, {
Brightness = v29
}):Play();
end);
end;
end;
v21 = v29;
end;
end;
if v10:FindFirstChild("FigureAnimatedWelded", true) then
local l__FigureAnimatedWelded__32 = v10:FindFirstChild("FigureAnimatedWelded", true);
local l__Parent__33 = l__FigureAnimatedWelded__32.Parent;
local v34 = 0;
local l__Click__35 = l__FigureAnimatedWelded__32.Parent.Head.Click;
local l__Growl__36 = l__FigureAnimatedWelded__32.Parent.Head.Growl;
local v37 = {};
for v38, v39 in pairs(l__FigureAnimatedWelded__32:GetDescendants()) do
if v39:IsA("Light") and v39.Name == "BlisterLight" then
v39.Enabled = true;
v39.Brightness = 0;
table.insert(v37, {
Light = v39,
Distance = l__FigureAnimatedWelded__32.Parent.Head.Position - v39.Parent.WorldPosition
});
end;
end;
local v40 = TweenInfo.new(0.1, Enum.EasingStyle.Linear);
for v41 = 1, 100000000 do
wait(0.1);
if not l__FigureAnimatedWelded__32 then
break;
end;
if l__FigureAnimatedWelded__32.Parent ~= l__Parent__33 then
break;
end;
local v42 = (l__Click__35.PlaybackLoudness + l__Growl__36.PlaybackLoudness) / 90 - 0.15;
if v42 ~= v34 then
for v43, v44 in v37, nil do
delay(v44.Distance / 4, function()
l__TweenService__7:Create(v44.Light, v40, {
Brightness = v42
}):Play();
end);
end;
end;
v34 = v42;
end;
end;
end;
v2.gd:WaitForChild("FinishedLoadingRoom").Changed:Connect(v9);
v2.gd:WaitForChild("Preload").Changed:Connect(v9);
workspace:WaitForChild("Ambience_Dark").Played:Connect(function()
end);
l__LocalPlayer__1:GetAttributeChangedSignal("CurrentRoom"):Connect(function()
local v45 = workspace.CurrentRooms:FindFirstChild(l__LocalPlayer__1:GetAttribute("CurrentRoom"));
if v45 then
local v46 = Color3.fromRGB(67, 51, 56);
local v47 = v45:GetAttribute("Ambient");
if v47 and type(v47) == "userdata" then
v46 = v47;
end;
l__TweenService__7:Create(game.Lighting, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {
Ambient = v46
}):Play();
end;
end);
local l__Shopkeeper__48 = workspace:FindFirstChild("Shopkeeper", true);
if l__Shopkeeper__48 then
require(script.Shopkeeper).run(l__Shopkeeper__48.Parent);
end;
|
-- If in-game, enable ctrl hotkeys for sibling selection & selection clearing
|
if Mode == 'Tool' then
AssignHotkey({ 'LeftControl', 'LeftBracket' }, Support.Call(Targeting.SelectSiblings, false, false));
AssignHotkey({ 'RightControl', 'LeftBracket' }, Support.Call(Targeting.SelectSiblings, false, false));
AssignHotkey({ 'LeftControl', 'R' }, Support.Call(Selection.Clear, true));
AssignHotkey({ 'RightControl', 'R' }, Support.Call(Selection.Clear, true));
end;
function GroupSelection(GroupType)
-- Groups the selected items
-- Create history record
local HistoryRecord = {
Items = Support.CloneTable(Selection.Items),
CurrentParents = Support.GetListMembers(Selection.Items, 'Parent')
}
function HistoryRecord:Unapply()
SyncAPI:Invoke('SetParent', self.Items, self.CurrentParents)
SyncAPI:Invoke('Remove', { self.NewParent })
Selection.Replace(self.Items)
end
function HistoryRecord:Apply()
SyncAPI:Invoke('UndoRemove', { self.NewParent })
SyncAPI:Invoke('SetParent', self.Items, self.NewParent)
Selection.Replace({ self.NewParent })
end
-- Perform group creation
HistoryRecord.NewParent = SyncAPI:Invoke('CreateGroup', GroupType,
GetHighestParent(HistoryRecord.Items),
HistoryRecord.Items
)
-- Register history record
History.Add(HistoryRecord)
-- Select new group
Selection.Replace({ HistoryRecord.NewParent })
end
function UngroupSelection()
-- Ungroups the selected groups
-- Create history record
local HistoryRecord = {
Selection = Selection.Items
}
function HistoryRecord:Unapply()
SyncAPI:Invoke('UndoRemove', self.Groups)
-- Reparent children
for GroupId, Items in ipairs(self.GroupChildren) do
coroutine.resume(coroutine.create(function ()
SyncAPI:Invoke('SetParent', Items, self.Groups[GroupId])
end))
end
-- Reselect groups
Selection.Replace(self.Selection)
end
function HistoryRecord:Apply()
-- Get groups from selection
self.Groups = {}
for _, Item in ipairs(self.Selection) do
if Item:IsA 'Model' or Item:IsA 'Folder' then
self.Groups[#self.Groups + 1] = Item
end
end
-- Perform ungrouping
self.GroupParents = Support.GetListMembers(self.Groups, 'Parent')
self.GroupChildren = SyncAPI:Invoke('Ungroup', self.Groups)
-- Get unpacked children
local UnpackedChildren = Support.CloneTable(self.Selection)
for GroupId, Children in pairs(self.GroupChildren) do
for _, Child in ipairs(Children) do
UnpackedChildren[#UnpackedChildren + 1] = Child
end
end
-- Select unpacked items
Selection.Replace(UnpackedChildren)
end
-- Perform action
HistoryRecord:Apply()
-- Register history record
History.Add(HistoryRecord)
end
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Alder",Paint)
end)
|
--[=[
@within Plasma
@function arrow
@tag widgets
@param from Vector3 | CFrame | BasePart
@param to Vector3 | BasePart | nil
@param color Color3? -- Optional color. Random if not specified.
- `arrow(from: Vector3, to: Vector3)` -> Creates an arrow between `from` and `to`
- `arrow(point: Vector3)` -> Creates an arrow pointing at `point`
- `arrow(cframe: CFrame)` -> Creates an arrow with its point at the CFrame position facing the CFrame LookVector
- `arrow(part: BasePart)` -> Arrow represents the Part's CFrame
- `arrow(fromPart: BasePart, toPart: BasePart)` -> Arrow between the two parts

```lua
Plasma.arrow(Vector3.new(0, 0, 0))
Plasma.arrow(Vector3.new(5, 5, 5), Vector3.new(10, 10, 10))
```
]=]
|
local function arrow(name, container, scale, color, zindex)
local body = Instance.new("CylinderHandleAdornment")
body.Name = name .. "Body"
body.Color3 = color
body.Radius = 0.15
body.Adornee = workspace.Terrain
body.Transparency = 0
body.Radius = 0.15 * scale
body.Transparency = 0
body.AlwaysOnTop = true
body.ZIndex = zindex
body.Parent = container
local point = Instance.new("ConeHandleAdornment")
scale = scale == 1 and 1 or 1.4
point.Name = name .. "Point"
point.Color3 = color
point.Radius = 0.5 * scale
point.Transparency = 0
point.Adornee = workspace.Terrain
point.Height = 2 * scale
point.AlwaysOnTop = true
point.ZIndex = zindex
point.Parent = container
end
local function update(body, point, from, to, scale)
body.Height = (from - to).magnitude - 2
body.CFrame = CFrame.lookAt(((from + to) / 2) - ((to - from).unit * 1), to)
point.CFrame = CFrame.lookAt((CFrame.lookAt(to, from) * CFrame.new(0, 0, -2 - ((scale - 1) / 2))).p, to)
end
local Runtime = require(script.Parent.Parent.Runtime)
return Runtime.widget(function(from, to, color)
local fallbackColor = Runtime.useState(BrickColor.random().Color)
color = color or fallbackColor
if typeof(from) == "Instance" then
if from:IsA("BasePart") then
from = from.CFrame
elseif from:IsA("Attachment") then
from = from.WorldCFrame
end
if to ~= nil then
from = from.p
end
end
if typeof(to) == "Instance" then
if to:IsA("BasePart") then
to = to.Position
elseif to:IsA("Attachment") then
to = to.WorldPosition
end
end
if typeof(from) == "CFrame" and to == nil then
local look = from.lookVector
to = from.p
from = to + (look * -10)
end
if to == nil then
to = from
from = to + Vector3.new(0, 10, 0)
end
assert(typeof(from) == "Vector3" and typeof(to) == "Vector3", "Passed parameters are of invalid types")
local refs = Runtime.useInstance(function(ref)
local container = Instance.new("Folder")
container.Name = "Arrow"
ref.folder = container
arrow("front", container, 1, color, 1)
arrow("back", container, 2, Color3.new(0, 0, 0), -1)
return container
end)
local folder = refs.folder
update(folder.frontBody, folder.frontPoint, from, to, 1)
update(folder.backBody, folder.backPoint, from, to, 1.4)
folder.frontBody.Color3 = color
folder.frontPoint.Color3 = color
end)
|
--[[
*
* Signals allow events to be dispatched to any number of listeners.
]]
|
local Signal
do
Signal = setmetatable({}, {
__tostring = function()
return "Signal"
end,
})
Signal.__index = Signal
function Signal.new(...)
local self = setmetatable({}, Signal)
return self:constructor(...) or self
end
function Signal:constructor()
self.waitingThreads = {}
self._handlerListHead = nil
end
function Signal:Connect(callback)
local connection = Connection.new(self, callback)
if self._handlerListHead ~= nil then
connection._next = self._handlerListHead
end
self._handlerListHead = connection
return connection
end
function Signal:Once(callback)
local done = false
local c
c = self:Connect(function(...)
local args = { ... }
if done then
return nil
end
done = true
c:Disconnect()
callback(unpack(args))
end)
return c
end
function Signal:Fire(...)
local args = { ... }
local item = self._handlerListHead
while item do
if item.Connected then
task.spawn(item._fn, unpack(args))
end
item = item._next
end
end
function Signal:FireDeferred(...)
local args = { ... }
local item = self._handlerListHead
while item do
if item.Connected then
task.defer(item._fn, unpack(args))
end
item = item._next
end
end
function Signal:Wait()
local running = coroutine.running()
self.waitingThreads[running] = true
self:Once(function(...)
local args = { ... }
self.waitingThreads[running] = nil
task.spawn(running, unpack(args))
end)
return coroutine.yield()
end
function Signal:DisconnectAll()
local item = self._handlerListHead
while item do
item.Connected = false
item = item._next
end
self._handlerListHead = nil
local _waitingThreads = self.waitingThreads
local _arg0 = function(thread)
return task.cancel(thread)
end
for _v in _waitingThreads do
_arg0(_v, _v, _waitingThreads)
end
table.clear(self.waitingThreads)
end
function Signal:Destroy()
self:DisconnectAll()
end
end
return {
Connection = Connection,
Signal = Signal,
}
|
-- BASIC VARIABLES --
|
local Player = game.Players.LocalPlayer
local Char
local HumRP
local Humanoid
local Tool = script.Parent
|
--bp.Position = shelly.PrimaryPart.Position
|
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
while true do
if shellyGood then
MoveShelly()
else
wait(1)
end
end
|
------------------------------------------------------------------------
--
-- * used only in luaK:prefix()
------------------------------------------------------------------------
|
function luaK:codenot(fs, e)
self:dischargevars(fs, e)
local k = e.k
if k == "VNIL" or k == "VFALSE" then
e.k = "VTRUE"
elseif k == "VK" or k == "VKNUM" or k == "VTRUE" then
e.k = "VFALSE"
elseif k == "VJMP" then
self:invertjump(fs, e)
elseif k == "VRELOCABLE" or k == "VNONRELOC" then
self:discharge2anyreg(fs, e)
self:freeexp(fs, e)
e.info = self:codeABC(fs, "OP_NOT", 0, e.info, 0)
e.k = "VRELOCABLE"
else
assert(0) -- cannot happen
end
-- interchange true and false lists
e.f, e.t = e.t, e.f
self:removevalues(fs, e.f)
self:removevalues(fs, e.t)
end
|
--REVERSE
|
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 0 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--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
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo 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 ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" 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 ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==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 throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local 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
_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))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--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
if tqABS < 1 then
_ABSActive = true
end
--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
|
-- Services
|
local playerService = game:GetService("Players")
playerService.PlayerAdded:Connect(function (plr)
plr.CharacterAdded:wait()
plr.CameraMode = Enum.CameraMode.LockFirstPerson
end)
|
-- Initialization
|
game.StarterGui.ResetPlayerGuiOnSpawn = false
ScreenGui.Parent = Player:WaitForChild("PlayerGui")
|
---------------
-- Constants --
---------------
|
local POP_RESTORE_RATE = 0.3
local CAST_SCREEN_SCALES = { -- (Relative)
Vector2.new(1, 1) / 2, -- Center
Vector2.new(0, 0), -- Top left
Vector2.new(1, 0), -- Top right
Vector2.new(1, 1), -- Bottom right
Vector2.new(0, 1), -- Bottom left
}
local NEAR_CLIP_PLANE_OFFSET = 0.5 --NOTE: Not configurable
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Roact"]["Roact"])
return Package
|
--Main
|
return require(ReplicatedStorage.Systems.EntitySystem.EntityClient.EntityComponent)
|
--[[Driver Handling]]
|
--Driver Sit
car.Body.CarName.Value.VehicleSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
--Distribute Client Interface
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.Body.CarName.Value.VehicleSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
--Driver Leave
car.Body.CarName.Value.VehicleSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
--Remove Flip Force
if car.Body.CarName.Value.VehicleSeat:FindFirstChild("Flip")~=nil then
car.Body.CarName.Value.VehicleSeat.Flip.MaxTorque = Vector3.new()
end
--Remove Wheel Force
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"]:IsA("BodyAngularVelocity") then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
else
if v["#AV"].AngularVelocity>0 then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
end
end
end
end
end
end)
|
--------------------- TEMPLATE BLADE WEAPON ---------------------------
-- Waits for the child of the specified parent
|
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local SLASH_DAMAGE = 100
local DOWNSTAB_DAMAGE = 100
local THROWING_DAMAGE = 100
local HOLD_TO_THROW_TIME = 0.38
local Damage = 100
local MyHumanoid = nil
local MyTorso = nil
local MyCharacter = nil
local MyPlayer = nil
local Tool = script.Parent
local kn = WaitForChild(Tool, 'kn')
local BlowConnection
local Button1DownConnection
local Button1UpConnection
local PlayStabPunch
local PlayDownStab
local PlayThrow
local PlayThrowCharge
local IconUrl = Tool.TextureId -- URL to the weapon knife icon asset
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local SlashSound
local HitPlayers = {}
local LeftButtonDownTime = nil
local Attacking = false
function Blow(hit)
if Attacking then
BlowDamage(hit, Damage)
end
end
function BlowDamage(hit, damage)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
local player = PlayersService:GetPlayerFromCharacter(hit.Parent)
if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then
if not MyPlayer.Neutral then
-- Ignore teammates hit
if player and player ~= MyPlayer and player.TeamColor == MyPlayer.TeamColor then
return
end
end
-- final check, make sure weapon is in-hand
local rightArm = MyCharacter:FindFirstChild('Right Arm')
if (rightArm ~= nil) then
-- Check if the weld exists between the hand and the weapon
local joint = rightArm:FindFirstChild('RightGrip')
if (joint ~= nil and (joint.Part0 == kn or joint.Part1 == kn)) then
-- Make sure you only hit them once per swing
if player and not HitPlayers[player] then
TagHumanoid(humanoid, MyPlayer)
print("Sending " .. damage)
humanoid:TakeDamage(damage)
kn.Hit.Volume = 1
HitPlayers[player] = true
end
end
end
end
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new('ObjectValue')
creatorTag.Value = player
creatorTag.Name = 'creator'
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new('StringValue')
weaponIconTag.Value = IconUrl
weaponIconTag.Name = 'icon'
weaponIconTag.Parent = creatorTag
DebrisService:AddItem(weaponIconTag, 1.5)
end
function HardAttack()
Damage = SLASH_DAMAGE
SlashSound:play()
if PlayStabPunch then
PlayStabPunch.Value = true
wait(1.0)
PlayStabPunch.Value = false
end
end
function NormalAttack()
Damage = DOWNSTAB_DAMAGE
KnifeDown()
SlashSound:play()
if PlayDownStab then
PlayDownStab.Value = true
wait(1.0)
PlayDownStab.Value = false
end
KnifeUp()
end
function ThrowAttack()
KnifeOut()
if PlayThrow then
PlayThrow.Value = true
wait(0.3)
if not kn then return end
local throwingkn = kn:Clone()
DebrisService:AddItem(throwingkn, 5)
throwingkn.Parent = Workspace
if MyCharacter and MyHumanoid then
throwingkn.Velocity = (MyHumanoid.TargetPoint - throwingkn.CFrame.p).unit * 100
-- set the orientation to the direction it is being thrown in
throwingkn.CFrame = CFrame.new(throwingkn.CFrame.p, throwingkn.CFrame.p + throwingkn.Velocity) * CFrame.Angles(0, 0, math.rad(-90))
local floatingForce = Instance.new('BodyForce', throwingkn)
floatingForce.force = Vector3.new(0, 196.2 * throwingkn:GetMass() * 0.98, 0)
local spin = Instance.new('BodyAngularVelocity', throwingkn)
spin.angularvelocity = throwingkn.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0))
end
kn.Transparency = 1
-- Wait so that the knife has left the thrower's general area
wait(0.08)
if throwingkn then
local touchedConn = throwingkn.Touched:connect(function(hit) print("hit throw") BlowDamage(hit, THROWING_DAMAGE) end)
end
-- must check if it still exists since we waited
if throwingkn then
throwingkn.CanCollide = true
end
wait(0.6)
if kn and PlayThrow then
kn.Transparency = 0
PlayThrow.Value = false
end
end
KnifeUp()
end
function KnifeUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function KnifeDown()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,-1)
end
function KnifeOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function OnLeftButtonDown()
LeftButtonDownTime = time()
if PlayThrowCharge then
PlayThrowCharge.Value = true
end
end
function OnLeftButtonUp()
if not Tool.Enabled then return end
-- Reset the list of hit players every time we start a new attack
HitPlayers = {}
if PlayThrowCharge then
PlayThrowCharge.Value = false
end
if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
Tool.Enabled = false
local currTime = time()
if LeftButtonDownTime and currTime - LeftButtonDownTime > HOLD_TO_THROW_TIME and
currTime - LeftButtonDownTime < 1.15 then
ThrowAttack()
else
Attacking = true
if math.random(1, 2) == 1 then
HardAttack()
else
NormalAttack()
end
Attacking = false
end
Tool.Enabled = true
end
end
function OnEquipped(mouse)
PlayStabPunch = WaitForChild(Tool, 'PlayStabPunch')
PlayDownStab = WaitForChild(Tool, 'PlayDownStab')
PlayThrow = WaitForChild(Tool, 'PlayThrow')
PlayThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')
SlashSound = WaitForChild(kn, 'Equip')
kn.Splat.Volume = 0
SlashSound:play()
BlowConnection = kn.Touched:connect(Blow)
MyCharacter = Tool.Parent
MyTorso = MyCharacter:FindFirstChild('Torso')
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyPlayer = PlayersService.LocalPlayer
if mouse then
Button1DownConnection = mouse.Button1Down:connect(OnLeftButtonDown)
Button1UpConnection = mouse.Button1Up:connect(OnLeftButtonUp)
end
KnifeUp()
end
function OnUnequipped()
-- Unequip logic here
if BlowConnection then
BlowConnection:disconnect()
BlowConnection = nil
end
if Button1DownConnection then
Button1DownConnection:disconnect()
Button1DownConnection = nil
end
if Button1UpConnection then
Button1UpConnection:disconnect()
Button1UpConnection = nil
end
MyHumanoid = nil
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
-- Initialize the tool
|
local PaintTool = {
Name = 'Paint Tool';
Color = BrickColor.new 'Really red';
-- Default options
BrickColor = nil;
};
function PaintTool:Equip()
-- Enables the tool's equipped functionality
-- Set up maid for cleanup
self.Maid = Maid.new()
-- Start up our interface
ShowUI();
self:BindShortcutKeys()
self:EnableClickPainting()
end;
function PaintTool:Unequip()
-- Disables the tool's equipped functionality
-- Hide UI
HideUI()
-- Clean up resources
self.Maid = self.Maid:Destroy()
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if PaintTool.UI then
-- Reveal the UI
PaintTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
PaintTool.UI = Core.Tool.Interfaces.BTPaintToolGUI:Clone();
PaintTool.UI.Parent = Core.UI;
PaintTool.UI.Visible = true;
-- Track palette buttons
PaletteButtons = {};
-- Enable the palette
for _, Column in pairs(PaintTool.UI.Palette:GetChildren()) do
for _, Button in pairs(Column:GetChildren()) do
if Button.ClassName == 'TextButton' then
-- Recolor the selection when the button is clicked
Button.MouseButton1Click:Connect(function ()
SetColor(BrickColor.new(Button.Name).Color);
end);
-- Register the button
PaletteButtons[Button.Name] = Button;
end;
end;
end;
-- Paint selection when current color indicator is clicked
PaintTool.UI.Controls.LastColorButton.MouseButton1Click:Connect(PaintParts);
-- Enable color picker button
PaintTool.UI.Controls.ColorPickerButton.MouseButton1Click:Connect(function ()
Core.Cheer(Core.Tool.Interfaces.BTHSVColorPicker, Core.UI).Start(
Support.IdentifyCommonProperty(Selection.Parts, 'Color') or Color3.new(1, 1, 1),
SetColor,
Core.Targeting.CancelSelecting,
PreviewColor
);
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not PaintTool.UI then
return;
end;
-- Hide the UI
PaintTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not PaintTool.UI then
return;
end;
-----------------------------------------
-- Update the color information indicator
-----------------------------------------
-- Clear old color indicators
for Color, Button in pairs(PaletteButtons) do
Button.Text = '';
end;
-- Indicate the variety of colors in the selection
for _, Part in pairs(Selection.Parts) do
if PaletteButtons[Part.BrickColor.Name] and Part.Color == Part.BrickColor.Color then
PaletteButtons[Part.BrickColor.Name].Text = '+';
end;
end;
-- Update the color picker button's background
local CommonColor = Support.IdentifyCommonProperty(Selection.Parts, 'Color');
PaintTool.UI.Controls.ColorPickerButton.ImageColor3 = CommonColor or PaintTool.BrickColor or Color3.new(1, 0, 0);
end;
function SetColor(Color)
-- Changes the color option to `Color`
-- Set the color option
PaintTool.BrickColor = Color;
-- Use BrickColor name if color matches one
local EquivalentBrickColor = BrickColor.new(Color);
local RGBText = ('(%d, %d, %d)'):format(Color.r * 255, Color.g * 255, Color.b * 255);
local ColorText = (EquivalentBrickColor.Color == Color) and EquivalentBrickColor.Name or RGBText;
-- Shortcuts to color indicators
local ColorLabel = PaintTool.UI.Controls.LastColorButton.ColorName;
local ColorSquare = ColorLabel.ColorSquare;
-- Update the indicators
ColorLabel.Visible = true;
ColorLabel.Text = ColorText;
ColorSquare.BackgroundColor3 = Color;
ColorSquare.Position = UDim2.new(1, -ColorLabel.TextBounds.X - 18, 0.2, 1);
-- Paint currently selected parts
PaintParts();
end;
function PaintParts()
-- Recolors the selection with the selected color
-- Make sure painting is possible
if (not PaintTool.BrickColor) or (#Selection.Parts == 0) then
return
end
-- Create history record
local Record = PaintHistoryRecord.new()
Record.TargetColor = PaintTool.BrickColor
-- Perform action
Record:Apply(true)
-- Register history record
Core.History.Add(Record)
end
function PreviewColor(Color)
-- Previews the given color on the selection
-- Reset colors to initial state if previewing is over
if not Color and InitialState then
for Part, State in pairs(InitialState) do
-- Reset part color
Part.Color = State.Color;
-- Update union coloring options
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = State.UsePartColor;
end;
end;
-- Clear initial state
InitialState = nil;
-- Skip rest of function
return;
-- Ensure valid color is given
elseif not Color then
return;
-- Save initial state if first time previewing
elseif not InitialState then
InitialState = {};
for _, Part in pairs(Selection.Parts) do
InitialState[Part] = { Color = Part.Color, UsePartColor = (Part.ClassName == 'UnionOperation') and Part.UsePartColor or nil };
end;
end;
-- Apply preview color
for _, Part in pairs(Selection.Parts) do
Part.Color = Color;
-- Enable union coloring
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = true;
end;
end;
end;
function PaintTool:BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
self.Maid.Hotkeys = Support.AddUserInputListener('Began', 'Keyboard', false, function (Input)
-- Paint selection if Enter is pressed
if (Input.KeyCode.Name == 'Return') or (Input.KeyCode.Name == 'KeypadEnter') then
return PaintParts()
end
-- Check if the R key was pressed, and it wasn't the selection clearing hotkey
if (Input.KeyCode.Name == 'R') and (not Selection.Multiselecting) then
-- Set the current color to that of the current mouse target (if any)
if Core.Mouse.Target then
SetColor(Core.Mouse.Target.Color);
end;
end;
end)
end;
function PaintTool:EnableClickPainting()
-- Allows the player to paint parts by clicking on them
-- Watch out for clicks on selected parts
self.Maid.ClickPainting = Selection.FocusChanged:Connect(function (Focus)
local Target, ScopeTarget = Core.Targeting:UpdateTarget()
if Selection.IsSelected(ScopeTarget) then
-- Paint the selected parts
PaintParts();
end;
end);
end;
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {14,18} --- Vertical Recoil
,HRecoil = {9,12} --- Horizontal Recoil
,AimRecover = .65 ---- Between 0 & 1
,RecoilPunch = .15
,VPunchBase = 2.55 --- Vertical Punch
,HPunchBase = 1.6 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = .5
,MaxRecoilPower = 3
,RecoilPowerStepAmount = .25
,MinSpread = 0.95 --- Min bullet spread value | Studs
,MaxSpread = 47 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = .75
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 1.5 --- Max sway value based on player stamina | Studs
|
--[[
_______ ___________ ___________ ____________ _ ______
/ __/ _ \/ _/ ___/ / / _/ ___/ // /_ __/ __/ | | / /_ /
/ _// ___// // /__/ /___/ // (_ / _ / / / _\ \ | |/ //_ <
/___/_/ /___/\___/____/___/\___/_//_/ /_/ /___/ |___/____/
https://discord.gg/Vk7uGNnX9M
join the discord for any questions or support relating to my plugins
]]
|
--
local F = {}
local TweenService = game:GetService("TweenService")
local DriveSeat = script.Parent.Parent:WaitForChild("DriveSeat")
local car = DriveSeat.Parent
local event = script.Parent
local leaveseatevent = script.Parent.OnLeave
local lights = car.Body.Lights
local misc = car.Misc
local PHeadlights = misc:FindFirstChild("Popups")
local trunk = misc:FindFirstChild("TK")
local isSetupCompleted = false
local doors = {}
local mirrorL
local mirrorR
local intlights
local doorFunction
for i, v in pairs(misc:GetDescendants()) do
if v.Name == "FL" or v.Name == "FR" or v.Name == "RL" or v.Name == "RR" then
table.insert(doors, v)
end
end
local rl_loc
local l_tweeninfo
local ind_tweeninfo
F.Setup = function(lowbeamc, highbeamc, runninglightc, frontindc, rearindc, foglightc, popupe, platelighte, platelightc, trunklighte, mirrorinde, run_loc, ft, ind_fr, intlightse, intlightsc, doorFunctione)
if not isSetupCompleted then
l_tweeninfo = TweenInfo.new(ft, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
ind_tweeninfo = TweenInfo.new(ind_fr / 2.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out, 0, false, 0)
event.IndicatorsAfterLeave.Disabled = true
intlights = intlightse
doorFunction = doorFunctione
if trunklighte and trunk ~= nil then
for i, v in pairs(trunk.Brake:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Brake" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 38
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 0, 0)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(248, 87, 73)
v.Transparency = 1
end
end
for i, v in pairs(trunk.Rear:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Rear" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 25
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 0, 0)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(248, 87, 73)
v.Transparency = 1
end
end
for i, v in pairs(trunk.Reverse:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Reverse" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 20
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 255, 255)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(255, 255, 255)
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Brake:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Brake" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 38
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 0, 0)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(248, 87, 73)
v.Transparency = 1
end
end
for i, v in pairs(lights.Rear:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Rear" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 25
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 0, 0)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(248, 87, 73)
v.Transparency = 1
end
end
for i, v in pairs(lights.Reverse:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Reverse" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 20
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(255, 255, 255)
spot.Shadows = true
spot.Angle = 180
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
v.Color = Color3.fromRGB(255, 255, 255)
v.Transparency = 1
end
end
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v.Name == "L" and v.Parent.Parent.Name == "LeftInd" and #v:GetChildren() < 1 then
local sfc = Instance.new("SurfaceLight", v)
sfc.Name = "L"
sfc.Brightness = 0
sfc.Range = 16
sfc.Face = Enum.NormalId.Front
sfc.Angle = 180
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
sfc.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
sfc.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
sfc.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
sfc.Color = Color3.fromRGB(198, 107, 54)
else
sfc.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
sfc.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
sfc.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
sfc.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
sfc.Color = Color3.fromRGB(198, 107, 54)
else
sfc.Color = rearindc
end
end
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = rearindc
end
end
v.Transparency = 1
elseif string.sub(v.Name, 1, 2) == "SI" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = rearindc
end
end
v.Transparency = 1
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v.Name == "L" and v.Parent.Parent.Name == "RightInd" and #v:GetChildren() < 1 then
local sfc = Instance.new("SurfaceLight", v)
sfc.Name = "L"
sfc.Brightness = 0
sfc.Range = 16
sfc.Face = Enum.NormalId.Front
sfc.Angle = 180
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
sfc.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
sfc.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
sfc.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
sfc.Color = Color3.fromRGB(198, 107, 54)
else
sfc.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
sfc.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
sfc.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
sfc.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
sfc.Color = Color3.fromRGB(198, 107, 54)
else
sfc.Color = rearindc
end
end
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = rearindc
end
end
v.Transparency = 1
elseif string.sub(v.Name, 1, 2) == "SI" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if v.Parent.Name == "Front" or v.Parent.Name == "Side" then
if frontindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif frontindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif frontindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif frontindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = frontindc
end
elseif v.Parent.Name == "Rear" then
if rearindc == "Light Orange" then
v.Color = Color3.fromRGB(255, 130, 80)
elseif rearindc == "Yellow" then
v.Color = Color3.fromRGB(181, 154, 45)
elseif rearindc == "Red" then
v.Color = Color3.fromRGB(241, 57, 60)
elseif rearindc == "Dark Orange" then
v.Color = Color3.fromRGB(198, 107, 54)
else
v.Color = rearindc
end
end
v.Transparency = 1
end
end
if platelighte then
for i, v in pairs(lights.Plate:GetDescendants()) do
if v.Name == "L" and v.Parent.Name == "Plate" and #v:GetChildren() < 1 then
local sfc = Instance.new("SurfaceLight", v)
sfc.Name = "L"
sfc.Angle = 135
sfc.Brightness = 0
sfc.Range = 1
sfc.Face = Enum.NormalId.Bottom
sfc.Shadows = true
if lowbeamc == "Pure White" then
sfc.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
sfc.Color = Color3.fromRGB(255, 237, 199)
elseif lowbeamc == "Xenon" then
sfc.Color = Color3.fromRGB(205, 227, 255)
elseif lowbeamc == "Brilliant Blue" then
sfc.Color = Color3.fromRGB(74, 137, 255)
elseif lowbeamc == "Light Green" then
sfc.Color = Color3.fromRGB(175, 196, 196)
elseif lowbeamc == "Golden Yellow" then
sfc.Color = Color3.fromRGB(255, 239, 193)
elseif lowbeamc == "Bubu's Purple" then
sfc.Color = Color3.fromRGB(197, 197, 255)
elseif lowbeamc == "Yellow" then
sfc.Color = Color3.fromRGB(181, 178, 87)
else
sfc.Color = lowbeamc
end
sfc.Shadows = true
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if lowbeamc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif lowbeamc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif lowbeamc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif lowbeamc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif lowbeamc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif lowbeamc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif lowbeamc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = lowbeamc
end
v.Transparency = 1
end
end
end
if run_loc == "Low Beam / Indicators" then
rl_loc = 1
elseif run_loc == "Low Beam" then
rl_loc = 2
elseif run_loc == "Custom DRL" then
rl_loc = 3
for i, v in pairs(lights.Headlights.Running:GetDescendants()) do
if v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if runninglightc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif runninglightc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif runninglightc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif runninglightc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif runninglightc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif runninglightc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif runninglightc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif runninglightc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = runninglightc
end
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Low" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Angle = 180
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
if lowbeamc == "Pure White" then
spot.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
spot.Color = Color3.fromRGB(255, 237, 199)
elseif lowbeamc == "Xenon" then
spot.Color = Color3.fromRGB(205, 227, 255)
elseif lowbeamc == "Brilliant Blue" then
spot.Color = Color3.fromRGB(74, 137, 255)
elseif lowbeamc == "Light Green" then
spot.Color = Color3.fromRGB(175, 196, 196)
elseif lowbeamc == "Golden Yellow" then
spot.Color = Color3.fromRGB(255, 239, 193)
elseif lowbeamc == "Bubu's Purple" then
spot.Color = Color3.fromRGB(197, 197, 255)
elseif lowbeamc == "Yellow" then
spot.Color = Color3.fromRGB(181, 178, 87)
else
spot.Color = lowbeamc
end
spot.Shadows = true
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if lowbeamc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif lowbeamc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif lowbeamc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif lowbeamc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif lowbeamc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif lowbeamc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif lowbeamc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = lowbeamc
end
v.Transparency = 1
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "High" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Angle = 180
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
if highbeamc == "Pure White" then
spot.Color = Color3.fromRGB(255, 255, 255)
elseif highbeamc == "OEM White" then
spot.Color = Color3.fromRGB(255, 237, 199)
elseif highbeamc == "Xenon" then
spot.Color = Color3.fromRGB(205, 227, 255)
elseif highbeamc == "Brilliant Blue" then
spot.Color = Color3.fromRGB(74, 137, 255)
elseif highbeamc == "Light Green" then
spot.Color = Color3.fromRGB(175, 196, 196)
elseif highbeamc == "Golden Yellow" then
spot.Color = Color3.fromRGB(255, 239, 193)
elseif highbeamc == "Bubu's Purple" then
spot.Color = Color3.fromRGB(197, 197, 255)
elseif highbeamc == "Yellow" then
spot.Color = Color3.fromRGB(181, 178, 87)
else
spot.Color = highbeamc
end
spot.Shadows = true
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if highbeamc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif highbeamc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif highbeamc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif highbeamc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif highbeamc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif highbeamc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif highbeamc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif highbeamc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = highbeamc
end
v.Transparency = 1
end
end
if popupe and PHeadlights ~= nil then
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v.Name == "L" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Angle = 180
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
if lowbeamc == "Pure White" then
spot.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
spot.Color = Color3.fromRGB(255, 237, 199)
elseif lowbeamc == "Xenon" then
spot.Color = Color3.fromRGB(205, 227, 255)
elseif lowbeamc == "Brilliant Blue" then
spot.Color = Color3.fromRGB(74, 137, 255)
elseif lowbeamc == "Light Green" then
spot.Color = Color3.fromRGB(175, 196, 196)
elseif lowbeamc == "Golden Yellow" then
spot.Color = Color3.fromRGB(255, 239, 193)
elseif lowbeamc == "Bubu's Purple" then
spot.Color = Color3.fromRGB(197, 197, 255)
elseif lowbeamc == "Yellow" then
spot.Color = Color3.fromRGB(181, 178, 87)
else
spot.Color = lowbeamc
end
spot.Shadows = true
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if lowbeamc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif lowbeamc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif lowbeamc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif lowbeamc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif lowbeamc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif lowbeamc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif lowbeamc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif lowbeamc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = lowbeamc
end
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Fog:GetChildren()) do
if v.Name == "L" and v.Parent.Name == "Fog" and #v:GetChildren() < 1 then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
spot.Angle = 180
spot.Brightness = 0
spot.Range = 48
spot.Face = Enum.NormalId.Front
if foglightc == "Pure White" then
spot.Color = Color3.fromRGB(255, 255, 255)
elseif foglightc == "OEM White" then
spot.Color = Color3.fromRGB(255, 237, 199)
elseif foglightc == "Xenon" then
spot.Color = Color3.fromRGB(205, 227, 255)
elseif foglightc == "Brilliant Blue" then
spot.Color = Color3.fromRGB(74, 137, 255)
elseif foglightc == "Light Green" then
spot.Color = Color3.fromRGB(175, 196, 196)
elseif foglightc == "Golden Yellow" then
spot.Color = Color3.fromRGB(255, 239, 193)
elseif foglightc == "Bubu's Purple" then
spot.Color = Color3.fromRGB(197, 197, 255)
elseif foglightc == "Yellow" then
spot.Color = Color3.fromRGB(181, 178, 87)
else
spot.Color = foglightc
end
spot.Shadows = true
elseif v.Name == "LN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if foglightc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif foglightc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif foglightc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif foglightc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif foglightc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif foglightc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif foglightc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif foglightc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = foglightc
end
v.Transparency = 1
end
end
if intlightse then
for i, v in pairs(lights.Interior:GetChildren()) do
if v.Name == "FrontL" then
local spot = Instance.new("SpotLight", v)
spot.Name = "L"
print(spot.Parent.Name)
spot.Angle = 135
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Bottom
if intlightsc == "Pure White" then
spot.Color = Color3.fromRGB(255, 255, 255)
elseif intlightsc == "OEM White" then
spot.Color = Color3.fromRGB(255, 237, 199)
elseif intlightsc == "Xenon" then
spot.Color = Color3.fromRGB(205, 227, 255)
elseif intlightsc == "Brilliant Blue" then
spot.Color = Color3.fromRGB(74, 137, 255)
elseif intlightsc == "Light Green" then
spot.Color = Color3.fromRGB(175, 196, 196)
elseif intlightsc == "Golden Yellow" then
spot.Color = Color3.fromRGB(255, 239, 193)
elseif intlightsc == "Bubu's Purple" then
spot.Color = Color3.fromRGB(197, 197, 255)
elseif intlightsc == "Yellow" then
spot.Color = Color3.fromRGB(181, 178, 87)
else
spot.Color = intlightsc
end
spot.Shadows = true
elseif v.Name == "CenterL" then
local point = Instance.new("PointLight", v)
point.Name = "L"
point.Brightness = 0
point.Range = 0
if intlightsc == "Pure White" then
point.Color = Color3.fromRGB(255, 255, 255)
elseif intlightsc == "OEM White" then
point.Color = Color3.fromRGB(255, 237, 199)
elseif intlightsc == "Xenon" then
point.Color = Color3.fromRGB(205, 227, 255)
elseif intlightsc == "Brilliant Blue" then
point.Color = Color3.fromRGB(74, 137, 255)
elseif intlightsc == "Light Green" then
point.Color = Color3.fromRGB(175, 196, 196)
elseif intlightsc == "Golden Yellow" then
point.Color = Color3.fromRGB(255, 239, 193)
elseif intlightsc == "Bubu's Purple" then
point.Color = Color3.fromRGB(197, 197, 255)
elseif intlightsc == "Yellow" then
point.Color = Color3.fromRGB(181, 178, 87)
else
point.Color = intlightsc
end
point.Shadows = true
elseif v.Name == "CLN" or v.Name == "FLN" then
if v:IsA("MeshPart") then
v.TextureID = ""
end
v.Material = Enum.Material.Neon
if highbeamc == "Pure White" then
v.Color = Color3.fromRGB(255, 255, 255)
elseif highbeamc == "OEM White" then
v.Color = Color3.fromRGB(255, 180, 161)
elseif highbeamc == "Xenon" then
v.Color = Color3.fromRGB(226, 231, 255)
elseif highbeamc == "Brilliant Blue" then
v.Color = Color3.fromRGB(97, 126, 255)
elseif highbeamc == "Light Green" then
v.Color = Color3.fromRGB(165, 195, 196)
elseif highbeamc == "Golden Yellow" then
v.Color = Color3.fromRGB(255, 169, 140)
elseif highbeamc == "Bubu's Purple" then
v.Color = Color3.fromRGB(150, 146, 255)
elseif highbeamc == "Yellow" then
v.Color = Color3.fromRGB(181, 178, 87)
else
v.Color = highbeamc
end
v.Transparency = 1
end
end
end
print("EpicLights Version 3 // Setup completed!")
isSetupCompleted = true
end
intLights()
end
F.SignalLeft = function(b, tp, t, seq, iseg)
if tp == 0.71 then
if t == "Halogen" then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
TweenService:Create(v, ind_tweeninfo, {Transparency = 1}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Front" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
v.Transparency = 1
elseif v.Name == "LN" and v.Parent.Name == "Front" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
if not seq then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
else
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
else
if string.sub(v.Name, 1, 2) == "SI" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
end
end
end
elseif t == "LED" then
if not seq then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
else
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
v.Transparency = tp
end
else
v.Transparency = tp
end
end
end
end
end
end
end
F.SignalRight = function(b, tp, t, seq, iseg)
if tp == 0.71 then
if t == "Halogen" then
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
TweenService:Create(v, ind_tweeninfo, {Transparency = 1}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Front" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
v.Transparency = 1
elseif v.Name == "LN" and v.Parent.Name == "Front" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
if not seq then
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
else
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
else
if string.sub(v.Name, 1, 2) == "SI" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
end
end
end
elseif t == "LED" then
if not seq then
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
else
for i, v in pairs(lights.RightInd:GetDescendants()) do
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
v.Transparency = tp
end
else
v.Transparency = tp
end
end
end
end
end
end
F.Hazards = function(b, tp, t, seq, iseg)
if tp == 0.71 then
if t == "Halogen" then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
TweenService:Create(v, ind_tweeninfo, {Transparency = 1}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Front" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
TweenService:Create(v, ind_tweeninfo, {Transparency = 1}):Play()
elseif v.Name == "LN" and v.Parent.Name == "Front" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
v.Transparency = 1
elseif v.Name == "LN" and v.Parent.Name == "Front" then
v.Transparency = tp
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" and v.Parent.Name == "Rear" then
v.Transparency = 1
elseif v.Name == "LN" and v.Parent.Name == "Front" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
if not seq then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
else
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
else
if string.sub(v.Name, 1, 2) == "SI" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
else
if string.sub(v.Name, 1, 2) == "SI" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
end
end
end
elseif t == "LED" then
if not seq then
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
else
for i, v in pairs(lights.LeftInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
v.Transparency = tp
end
else
v.Transparency = tp
end
end
end
for i, v in pairs(lights.RightInd:GetDescendants()) do
if v:IsA("BasePart") or v:IsA("MeshPart") then
if tp < 1 then
if v.Name == "SI"..tostring(iseg) then
v.Transparency = tp
end
else
v.Transparency = tp
end
end
end
end
end
end
end
F.Headlights = function(b, tp, r, rl_a, pe, t, ls)
if not pe then
if t == "Halogen" then
if rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
elseif not rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
elseif ls == 1 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
end
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif ls == 2 then
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(lights.Headlights.High:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
elseif t == "LED" then
if rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
v.Transparency = tp
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
v.Transparency = tp
end
end
end
elseif not rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
v.Transparency = tp
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
v.Transparency = tp
end
end
end
elseif ls == 1 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.71
end
end
end
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(lights.Headlights.High:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
elseif ls == 2 then
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(lights.Headlights.High:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = tp
end
end
end
elseif not rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
v.Transparency = tp
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
v.Transparency = tp
end
end
end
if ls == 1 then
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(lights.Headlights.High:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = 0
v.Range = 0
elseif v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
end
end
else
if rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
else
for i, v in pairs(lights.Headlights.Running:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
end
end
elseif not rl_a and ls == 0 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif rl_loc == 2 then
for i, v in pairs(lights.Headlights.Low:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
else
for i, v in pairs(lights.Headlights.Running:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
for i, v in pairs(lights.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
if v.Parent.Name == "High" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
elseif v.Parent.Name == "Low" and rl_loc ~= 2 and rl_loc ~= 1 then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
end
end
elseif ls == 1 then
if rl_loc == 1 then
for i, v in pairs(lights.LeftInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
for i, v in pairs(lights.RightInd.Front:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
elseif rl_loc == 3 then
for i, v in pairs(lights.Headlights.Running:GetChildren()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.71}):Play()
end
end
end
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif ls == 2 then
for i, v in pairs(lights.Headlights.Low:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(lights.Headlights.High:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(PHeadlights.Parts.Headlights:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
v.Range = r
elseif v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
end
end
end
F.CustomDRL = function(s, t)
if t == "Halogen" then
if s then
for i, v in pairs(lights.Headlights.Running:GetDescendants()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.02}):Play()
end
end
else
for i, v in pairs(lights.Headlights.Running:GetDescendants()) do
if v:IsA("MeshPart") and v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
else
if s then
for i, v in pairs(lights.Headlights.Running:GetDescendants()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 0.02
end
end
else
for i, v in pairs(lights.Headlights.Running:GetDescendants()) do
if v:IsA("MeshPart") and v.Name == "LN" then
v.Transparency = 1
end
end
end
end
end
F.PlateLights = function(s, t)
if s then
if t == "Halogen" then
for i, v in pairs(lights.Plate:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = 1}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Plate:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = 1
elseif v.Name == "LN" then
v.Transparency = 0
end
end
end
else
if t == "Halogen" then
for i, v in pairs(lights.Plate:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = 0}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Plate:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = 0
elseif v.Name == "LN" then
v.Transparency = 1
end
end
end
end
end
F.Popups = function(state, enabled, hinge_angle)
if enabled then
local motor = PHeadlights.Hinge:WaitForChild("Motor")
motor.MaxVelocity = 0.06
if state then
motor.DesiredAngle = hinge_angle
elseif not state then
motor.DesiredAngle = 0
end
end
end
F.FogLights = function(b, tp, t)
if t == "Halogen" then
for i, v in pairs(lights.Fog:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, ind_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, ind_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Fog:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
end
F.BrakeLights = function(t, b, tp, te)
if not te then
if t == "Halogen" then
for i, v in pairs(lights.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
for i, v in pairs(lights.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(trunk.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(trunk.Brake:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
end
end
F.RearLights = function(t, b, tp, te)
if not te then
if t == "Halogen" then
for i, v in pairs(lights.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
for i, v in pairs(lights.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(trunk.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(trunk.Rear:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
end
end
F.DashboardIndicators = function(headlights, indicators, parklights)
end
F.Reverse = function(t, b, tp, te)
if not te then
if t == "Halogen" then
for i, v in pairs(lights.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
else
if t == "Halogen" then
for i, v in pairs(lights.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
for i, v in pairs(trunk.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
TweenService:Create(v, l_tweeninfo, {Brightness = b}):Play()
elseif v.Name == "LN" then
TweenService:Create(v, l_tweeninfo, {Transparency = tp}):Play()
end
end
elseif t == "LED" then
for i, v in pairs(lights.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
for i, v in pairs(trunk.Reverse:GetDescendants()) do
if v:IsA("Light") and v.Name == "L" then
v.Brightness = b
elseif v.Name == "LN" then
v.Transparency = tp
end
end
end
end
end
function intLights()
if intlights then
local center_override = false
local front_override = false
local door_open = false
local int_triggers = car.Body:FindFirstChild("InteriorTriggers")
local event1 = int_triggers:FindFirstChild("OverrideTriggers")
if #doors > 0 and doorFunction then
for i, v in pairs(doors) do
local event2 = v:FindFirstChild("EpicLightsDoor")
event2.Event:Connect(function(s)
door_open = s
if s then
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Name == "L" and v:IsA("SpotLight") and not front_override then
TweenService:Create(v, l_tweeninfo, {Brightness = 0.5, Range = 9}):Play()
elseif v.Name == "L" and v:IsA("PointLight") and not center_override then
TweenService:Create(v, l_tweeninfo, {Brightness = 0.5, Range = 9}):Play()
elseif v.Name == "FLN" and not front_override then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.2}):Play()
elseif v.Name == "CLN" and not center_override then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.2}):Play()
end
end
else
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Name == "L" and v:IsA("SpotLight") and not front_override then
TweenService:Create(v, l_tweeninfo, {Brightness = 0, Range = 0}):Play()
elseif v.Name == "L" and v:IsA("PointLight") and not center_override then
TweenService:Create(v, l_tweeninfo, {Brightness = 0, Range = 0}):Play()
elseif v.Name == "FLN" and not front_override then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
elseif v.Name == "CLN" and not center_override then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
end)
end
end
event1.Event:Connect(function(s, t)
if t == "Center" then
center_override = s
if not door_open then
if s then
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Parent.Name == "CenterL" and v:IsA("PointLight") then
TweenService:Create(v, l_tweeninfo, {Brightness = 0.5, Range = 9}):Play()
elseif v.Name == "CLN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.2}):Play()
end
end
else
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Parent.Name == "CenterL" and v:IsA("PointLight") then
TweenService:Create(v, l_tweeninfo, {Brightness = 0, Range = 0}):Play()
elseif v.Name == "CLN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
end
elseif t == "Front" then
front_override = s
if not door_open then
if s then
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Parent.Name == "FrontL" and v:IsA("SpotLight") then
TweenService:Create(v, l_tweeninfo, {Brightness = 0.5, Range = 9}):Play()
elseif v.Name == "FLN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 0.2}):Play()
end
end
else
for i, v in pairs(lights.Interior:GetDescendants()) do
if v.Parent.Name == "FrontL" and v:IsA("SpotLight") then
TweenService:Create(v, l_tweeninfo, {Brightness = 0, Range = 0}):Play()
elseif v.Name == "FLN" then
TweenService:Create(v, l_tweeninfo, {Transparency = 1}):Play()
end
end
end
end
end
end)
end
end
F.IndsOnLeave = function(left, right, hazard, sequential, segs, fr, type)
event.IndicatorsAfterLeave.Disabled = false
wait()
leaveseatevent:Fire(left, right, hazard, sequential, segs, fr, type)
end
event.OnServerEvent:Connect(function(pl, Fnc, ...)
F[Fnc](...)
end) -- 1627 lines previously
|
--[=[
Forces the value to be nil on cleanup, cleans up the Maid
Does not fire the event since 3.5.0
]=]
|
function ValueObject:Destroy()
rawset(self, "_value", nil)
self._maid:DoCleaning()
setmetatable(self, nil)
end
return ValueObject
|
--WRITE YOUR ABILITIES HERE--
|
hum.WalkSpeed = 40
|
-- if Character:IsA("Model") then
-- Character:BreakJoints()
| |
-- May return NaN or inf or -inf
-- This is a way of finding the angle between the two vectors:
|
local function findAngleBetweenXZVectors(vec2, vec1)
return math.atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end
local function CreateAttachCamera()
local module = RootCameraCreator()
local lastUpdate = tick()
function module:Update()
local now = tick()
local camera = workspace.CurrentCamera
local player = PlayersService.LocalPlayer
if lastUpdate == nil or now - lastUpdate > 1 then
module:ResetCameraLook()
self.LastCameraTransform = nil
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraZoom()
if zoom <= 0 then
zoom = 0.1
end
if self.LastCameraTransform then
local humanoid = self:GetHumanoid()
if lastUpdate and humanoid and humanoid.Torso then
local forwardVector = humanoid.Torso.CFrame.lookVector
local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook())
if IsFinite(y) and math.abs(y) > 0.0001 then
self.RotateInput = self.RotateInput + Vector2.new(y, 0)
end
end
end
local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput)
self.RotateInput = Vector2.new()
camera.Focus = CFrame.new(subjectPosition)
camera.CoordinateFrame = CFrame.new(camera.Focus.p - (zoom * newLookVector), camera.Focus.p)
self.LastCameraTransform = camera.CoordinateFrame
end
lastUpdate = now
end
return module
end
return CreateAttachCamera
|
-- Shift to sprint script for Stamina System V1.
-- Delete if you don't want to use.
|
local UserInputService = game:GetService("UserInputService")
local StaminaModule = require(script.Parent.StaminaModule)
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local defaultSpeed = 16
local belowStaminaSpeed = 18
local sprintSpeed = 24
local staminaDeductRate = 1
local staminaDeductInterval = 0.1
local minimumStaminaToSprint = 15
local sprinting = false
local regainDelay = 1
local belowStaminaDelay = 2
local function deductStamina()
while sprinting and StaminaModule.StaminaValue.Value > 0 do
local character = player.Character
if character then
local humanoid = character:WaitForChild("Humanoid")
-- Only deduct stamina if the player is moving
if humanoid.MoveDirection.Magnitude > 0 then
StaminaModule.RemoveStamina(staminaDeductRate)
StaminaModule.StaminaCanRegen = false
else
StaminaModule.StaminaCanRegen = true
end
end
wait(staminaDeductInterval)
end
end
local function tweenWalkSpeed(humanoid, speed, time)
local info = TweenInfo.new(time)
local tween = TweenService:Create(humanoid, info, {WalkSpeed = speed})
tween:Play()
end
UserInputService.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
local character = player.Character
if character then
local humanoid = character:WaitForChild("Humanoid")
if StaminaModule.StaminaValue.Value >= minimumStaminaToSprint then
tweenWalkSpeed(humanoid, sprintSpeed, 1)
sprinting = true
StaminaModule.StaminaCanRegen = false
deductStamina()
end
end
end
end)
UserInputService.InputEnded:Connect(function(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
local character = player.Character
if character then
local humanoid = character:WaitForChild("Humanoid")
tweenWalkSpeed(humanoid, defaultSpeed, 1)
sprinting = false
wait(regainDelay)
StaminaModule.StaminaCanRegen = true
end
end
end)
StaminaModule.StaminaValue:GetPropertyChangedSignal("Value"):Connect(function()
local character = player.Character
if character then
local humanoid = character:WaitForChild("Humanoid")
if StaminaModule.StaminaValue.Value < minimumStaminaToSprint and sprinting then
tweenWalkSpeed(humanoid, belowStaminaSpeed, 2)
end
if StaminaModule.StaminaValue.Value <= 0 then
tweenWalkSpeed(humanoid, defaultSpeed, 1)
sprinting = false
wait(belowStaminaDelay)
StaminaModule.StaminaCanRegen = true
end
end
end)
|
-- Colors
|
local FriendlyReticleColor = Color3.new(1, 0, 0)
local EnemyReticleColor = Color3.new(1, 0, 0)
local NeutralReticleColor = Color3.new(1, 0, 0)
local Spread = MinSpread
local AmmoInClip = ClipSize
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local WeaponGui = nil
local LeftButtonDown
local Reloading = false
local IsShooting = false
|
--Function For Making Rays Which Kills Bricks
|
function ray(angle,radius, orig)
----------------SET POSITIONS
local startPos = (orig * CFrame.new(0,0,3) ).p
local secondPos = orig
* CFrame.Angles(0, 0, math.rad(angle))
* CFrame.new(radius,0,-6)
----------------MAKE RAY
local damageRay = Ray.new (startPos,(secondPos - startPos).p)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(damageRay, ignoreList)
--if hit then print("Hit: "..hit.Name) else print("Hit: nil") end
----------------DRAW RAY
if makeRays then
local distance = (position - startPos).magnitude
makeRay(CFrame.new(startPos, secondPos.p) * CFrame.new(0, 0, -distance/2),
Vector3.new(0.2, 0.2, distance))
end
if not hit then return end
if hit.Name == "FakeTrack" then
ignoreList[#ignoreList+1] = hit
ray(angle,radius, orig)
return
end
if not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
local player = game.Players:findFirstChild(hit.Parent.Name)
if human and player then
if player.TeamColor ~= BrickColor.new("Earth green") then
human:takeDamage(110)
end
end
if hit.Parent.Name == "Parts" then return end
if hit.Parent.Parent then --look if what we hit is a tank
tank = hit.Parent.Parent:findFirstChild("Tank")
if not tank and hit.Parent.Parent.Parent then
tank = hit.Parent.Parent.Parent:findFirstChild("Tank")
end
end
if not tank or tank == parts.Parent.Parent.Tank then return end
----------------IF ITS A DAMAGEABLE PART
local damagable = hit.Parent:findFirstChild("Damage")
if damagable then
if damagable.Value == "Barrel" and not tank.Parent.GunDamaged.Value and math.random(1,8) == 1 then
tank.Parent.GunDamaged.Value = true
print("Damaged Barrel")
elseif damagable.Value == "LTrack" and not tank.Parent.LTrack.Value and math.random(1,8) == 1 then
tank.Parent.LTrack.Value = true
print("Damaged Left Track")
local list = hit.Parent:getChildren()
local randSide = math.random(1,2)
for i = 1, #list do
if list[i].Name == ("trackDamage"..randSide) then
list[i].Transparency = 1
end
end
elseif damagable.Value == "RTrack" and not tank.Parent.RTrack.Value and math.random(1,8) == 1 then
tank.Parent.RTrack.Value = true
print("Damaged Right Track")
local list = hit.Parent:getChildren()
local randSide = math.random(1,2)
for i = 1, #list do
if list[i].Name == ("trackDamage"..randSide) then
list[i].Transparency = 1
end
end
end
elseif hit.Name == "Fuel" then --if we hit their weak point
tank.Value = BrickColor.new("Black")
else
local damage = hit:findFirstChild("Damage") --Check if There's a Damage Value Already in the Brick
if not damage then
damage = Instance.new("NumberValue")
damage.Parent = hit
damage.Name = "Damage"
local volume = hit.Size.X*hit.Size.Y*hit.Size.Z
damage.Value = volume*hit.Parent.ArmourValue.Value
end
damage.Value = damage.Value - dealingDamage
if damage.Value <= 0 then
if math.random(1,2) == 1 then
hit:BreakJoints()
else
hit:remove()
end
end
end
end
round = Instance.new("Part", user)
round.Name = "RayPart"
round.Material = "Neon"
round.Transparency = 0.5
round.Anchored = true
round.CanCollide = false
round.TopSurface = Enum.SurfaceType.Smooth
round.BottomSurface = Enum.SurfaceType.Smooth
round.formFactor = Enum.FormFactor.Custom
round.BrickColor = BrickColor.new("Bright blue")
yOffset = -0.2
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
DebugLogger = {};
function DebugLogger.new(p1, p2)
local v2 = p2 and typeof(p2) == "string";
assert(v2, "Invalid script name");
local v3 = {
scriptName = p2
};
setmetatable(v3, p1);
p1.__index = p1;
return v3;
end;
function DebugLogger.Log(p3, p4, p5)
pcall(function()
local v4 = p3.scriptName .. " - " .. p4 .. " called with parameters ";
for v5, v6 in pairs(p5) do
v4 = v4 .. tostring(v5) .. " : " .. tostring(v6) .. ", ";
end;
print(v4);
end);
end;
function DebugLogger.LogFunctionCall(p6, p7, p8)
p6:Log(p7, p8);
end;
function DebugLogger.LogString(p9, p10)
pcall(function()
print(p9.scriptName .. " - " .. p10);
end);
end;
v1.DebugLogger = DebugLogger;
return v1;
|
--[[
REFERENCE:
command_full_name: The name of a command (e.g. :cmds)
[command_full_name] = {
Player = 0;
Server = 0;
Cross = 0;
}
]]
|
}
settings.HttpWait = 60 -- How long things that use the HttpService will wait before updating again
settings.Trello_Enabled = false -- Are the Trello features enabled?
settings.Trello_Primary = "" -- Primary Trello board
settings.Trello_Secondary = {} -- Secondary Trello boards (read-only) Format: {"BoardID";"BoardID2","etc"}
settings.Trello_AppKey = "" -- Your Trello AppKey Link: https://trello.com/app-key
settings.Trello_Token = "" -- Trello token (DON'T SHARE WITH ANYONE!) Link: https://trello.com/1/connect?name=Trello_API_Module&response_type=token&expires=never&scope=read,write&key=YOUR_APP_KEY_HERE
settings.G_API = true -- If true allows other server scripts to access certain functions described in the API module through _G.Adonis
settings.G_Access = false -- If enabled allows other scripts to access Adonis using _G.Adonis.Access; Scripts will still be able to do things like _G.Adonis.CheckAdmin(player)
settings.G_Access_Key = "Example_Key" -- Key required to use the _G access API; Example_Key will not work for obvious reasons
settings.G_Access_Perms = "Read" -- Access perms
settings.Allowed_API_Calls = {
Client = false; -- Allow access to the Client (not recommended)
Settings = false; -- Allow access to settings (not recommended)
DataStore = false; -- Allow access to the DataStore (not recommended)
Core = false; -- Allow access to the script's core table (REALLY not recommended)
Service = false; -- Allow access to the script's service metatable
Remote = false; -- Communication table
HTTP = false; -- HTTP related things like Trello functions
Anti = false; -- Anti-Exploit table
Logs = false;
UI = false; -- Client UI table
Admin = false; -- Admin related functions
Functions = false; -- Functions table (contains functions used by the script that don't have a subcategory)
Variables = true; -- Variables table
API_Specific = true; -- API Specific functions
}
settings.FunCommands = true -- Are fun commands enabled?
settings.PlayerCommands = true -- Are player-level utility commands enabled?
settings.CommandFeedback = false -- Should players be notified when commands with non-obvious effects are run on them?
settings.CrossServerCommands = true -- Are commands which affect more than one server enabled?
settings.ChatCommands = true -- If false you will not be able to run commands via the chat; Instead you MUST use the console or you will be unable to run commands
settings.CreatorPowers = true -- Gives me creator level admin; This is strictly used for debugging; I can't debug without full access to the script
settings.CodeExecution = true -- Enables the use of code execution in Adonis; Scripting related (such as :s) and a few other commands require this
settings.SilentCommandDenials = false -- If true, there will be no differences between the error messages shown when a user enters an invalid command and when they have insufficient permissions for the command
settings.BanMessage = "Banned" -- Message shown to banned users upon kick
settings.LockMessage = "Not Whitelisted" -- Message shown to people when they are kicked while the game is :slocked
settings.SystemTitle = "System Message" -- Title to display in :sm and :bc
settings.MaxLogs = 5000 -- Maximum logs to save before deleting the oldest
settings.SaveCommandLogs = true -- If command logs are saved to the datastores
settings.Notification = true -- Whether or not to show the "You're an admin" and "Updated" notifications
settings.SongHint = true -- Display a hint with the current song name and ID when a song is played via :music
settings.TopBarShift = false -- By default hints and notifs will appear from the top edge of the window, this is acheived by offsetting them by -35 into the transparent region where roblox buttons menu/chat/leaderstat buttons are. Set this to true if you don't want hints/notifs to appear in that region.
settings.Messages = {} -- A list of notification messages to show HeadAdmins and above on join
settings.AutoClean = false -- Will auto clean workspace of things like hats and tools
settings.AutoCleanDelay = 60 -- Time between auto cleans
settings.AutoBackup = false -- Run :backupmap automatically when the server starts. To restore the map, run :restoremap
settings.Console = true -- Whether the command console is enabled
settings.Console_AdminsOnly = false -- If true, only admins will be able to access the console
settings.HelpSystem = true -- Allows players to call admins for help using !help
settings.HelpButton = true -- Shows a little help button in the bottom right corner.
settings.HelpButtonImage = "rbxassetid://357249130" -- Change this to change the help button's image
settings.DonorCapes = true -- Donors get to show off their capes; Not disruptive :)
settings.DonorCommands = true -- Show your support for the script and let donors use harmless commands like !sparkles
settings.LocalCapes = false -- Makes Donor capes local so only the donors see their cape [All players can still disable capes locally]
settings.Detection = true -- Attempts to detect certain known exploits
settings.CheckClients = true -- Checks clients every minute or two to make sure they are still active
settings.ExploitNotifications = true -- Notify all moderators and higher ups when a player is kicked or crashed from the AntiExploit
settings.CharacterCheckLogs = false -- If the character checks appear in exploit logs and exploit notifications
settings.AntiNoclip = false -- Attempts to detect noclipping and kills the player if found
settings.AntiRootJointDeletion = false -- Attempts to detect paranoid and kills the player if found
settings.AntiHumanoidDeletion = false -- (Very important) Prevents invalid humanoid deletion. Un-does the deletion and kills the player
settings.AntiMultiTool = false -- Prevents multitooling and because of that many other exploits
settings.AntiGod = false -- If a player does not respawn when they should have they get respawned
settings.AntiSpeed = true -- (Client-Sided) Attempts to detect speed exploits
settings.AntiBuildingTools = false -- (Client-Sided) Attempts to detect any HopperBin(s)/Building Tools added to the client
settings.AntiClientIdle = false -- (Client-Sided) Kick the player if they are using an anti-idle exploit
settings.ProtectHats = false -- Prevents hats from being un-welded from their characters through unnormal means
|
-- Detectors
|
local handler = DriveSeat.AirbagFilter
local side = nil
local sent = false
local speedVar = nil
function handle(x, y)
if x == nil then print('Errored!') end
if sent == false then
if speedVar > 20 and DriveSeat.Parent.Electrics.Value == true then
if y.CanCollide == true then
handler:FireServer(x)
print('fired to remote')
script.Parent.epicFrame.Visible = true
DriveSeat.FE_Lights:FireServer('blinkers', 'Hazards')
wait(2)
sent = false
end
end
end
end
|
-- Settings
|
local amientReverb : EnumItem = Enum.ReverbType.Alley
local bubbleChatEnabled : boolean = false
local gravity : number = 196.2 -- 35 is realistic
local walkSpeed : number = 16 -- 17 is good for low gravity
local jumpPower : number = 50 -- 16 is good for low gravity
local respawnTime : number = 5 -- 1 is enough
local clockTime : number = 0
local fogColor : Color3 = Color3.fromRGB(0, 0, 0)
local fogEnd : number = 150
local fogStart : number = 0
|
--Fuction that plays when we click the button.
|
Button.MouseClick:Connect(function(player)
local newcode = game.ReplicatedStorage:WaitForChild("CodeDoor"):InvokeClient(player) --we invoke the players client and wait until they return the code
if newcode == Code.Value then
print('correct')
Light.Color = Color3.fromRGB(73, 181, 71) --Light (part) color changes
Light.PointLight.Color = Color3.fromRGB(73, 181, 71) --PointLight color changes (optional, disabled by default)
script.Parent.Parent.Lock.Disabled = false
script.Parent.Button:Destroy()
else --If the code is not correct, we just print "incorrect"
print('incorrect')
end
end)
|
--Made by Stickmasterluke
|
sp=script.Parent
db=true
firerate=22
power=50
rate=1/30
debris=game:GetService("Debris")
equipped=false
check=true
local event = script.Parent:WaitForChild("RemoteEvent")
function onEquipped(mouse)
equipped=true
if mouse~=nil then
mouse.Button1Down:connect(function()
if db then
event:FireServer(mouse.Hit,check)
db=false
wait(firerate)
db=true
end
end)
end
end
function onUnequipped()
equipped=false
sp.Handle.Transparency=1
end
sp.Equipped:connect(onEquipped)
sp.Unequipped:connect(onUnequipped)
|
--LIBS
-- RANDOM
---- WeightedRandom(t, default)
----- Uses a simple weighted random technique to choose
----- a table value based on its weight.
----- Syntax for the table must be like this:
------ { Value = [value], Weight = [weight] }
----- The function will return the Value key of the
----- chosen table.
----- You may specify a default value if you are
----- completely insane.
---- TrueRandom(min, max)
----- Multiplies the min and max by 100, uses math.random
----- on those, and then divides the result by 100
----- Mostly just did this to get finer granularity from
----- random numbers
-- TABLES
---- IndexOf(t, obj)
----- Given a table t, returns the index of the specified
----- object obj, assuming the object is in the table.
----- By default, returns 0.
---- Contains(t, obj)
----- Returns a boolean representing whether or not the
----- specified object is in the table.
-- VECTOR3
---- Half(vector)
----- Just halves a vector with a "/ 2"
----- Don't know why I needed this.
---- Distance(vec1, vec2)
----- Returns the distance between two vectors.
| |
--// Positioning
|
RightArmPos = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08);
LeftArmPos = CFrame.new(1.06851184, 0.973718464, -1.99667926, 0.787567914, -0.220087856, -0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098);
GunPos = CFrame.new(0.284460306, -0.318524063, 1.06423128, 1, 0, 0, 0, -2.98023224e-08, -0.99999994, 0, 0.99999994, -2.98023224e-08);
|
--[=[
Initializes a new promise with the given function in a spawn wrapper.
@param func (resolve: (...) -> (), reject: (...) -> ()) -> ()?
@return Promise<T>
]=]
|
function Promise.spawn(func)
local self = Promise.new()
task.spawn(func, self:_getResolveReject())
return self
end
|
-- MODULES --
|
local bezierTween = require(Modules.BezierTweens)
local Waypoints = bezierTween.Waypoints
local partCacheMod = require(Modules.PartCache)
|
-- Main
|
game:GetService("RunService").Heartbeat:Connect(function()
for f, g in pairs(game:GetService("Players"):GetChildren()) do
Checker(g)
end
end
|
-- services
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
|
-- BEHAVIOUR
--Controller support
|
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(iconModule)
local controllerOptionIcon = Icon.new()
:setProperty("internalIcon", true)
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage(11162828670)
:setRight()
:setEnabled(false)
:setTip("Controller mode")
:setProperty("deselectWhenOtherIconSelected", false)
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(IconController._determineControllerDisplay)
userInputService.GamepadConnected:Connect(IconController._determineControllerDisplay)
userInputService.GamepadDisconnected:Connect(IconController._determineControllerDisplay)
IconController._determineControllerDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabledAccountingForMimic() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB and not IconController.disableButtonB then
if IconController.activeButtonBCallbacks == 1 and TopbarPlusGui.Indicator.Image == "rbxassetid://5278151556" then
IconController.activeButtonBCallbacks = 0
guiService.SelectedObject = nil
end
if IconController.activeButtonBCallbacks == 0 then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setProperty("internalIcon", true)
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
overflowIcon.lockedSettings = {
["iconImage"] = true,
["order"] = true,
["alignment"] = true,
}
end
end
-- This checks if voice chat is enabled
task.defer(function()
local success, enabledForUser
while true do
success, enabledForUser = pcall(function() return voiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId) end)
if success then
break
end
task.wait(1)
end
local function checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled then
if success and enabledForUser then
voiceChatIsEnabledForUserAndWithinExperience = true
IconController.updateTopbar()
end
end
end
checkVoiceChatManuallyEnabled()
--------------- FEEL FREE TO DELETE THIS IS YOU DO NOT USE VOICE CHAT WITHIN YOUR EXPERIENCE ---------------
localPlayer.PlayerGui:WaitForChild("TopbarPlus", 999)
task.delay(10, function()
checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled == nil and success and enabledForUser and isStudio then
warn("⚠️TopbarPlus Action Required⚠️ If VoiceChat is enabled within your experience it's vital you set IconController.voiceChatEnabled to true ``require(game.ReplicatedStorage.Icon.IconController).voiceChatEnabled = true`` otherwise the BETA label will not be accounted for within your live servers. This warning will disappear after doing so. Feel free to delete this warning if you have not enabled VoiceChat within your experience.")
end
end)
------------------------------------------------------------------------------------------------------------
end)
if not isStudio then
local ownerId = game.CreatorId
local groupService = game:GetService("GroupService")
if game.CreatorType == Enum.CreatorType.Group then
local success, ownerInfo = pcall(function() return groupService:GetGroupInfoAsync(game.CreatorId).Owner end)
if success then
ownerId = ownerInfo.Id
end
end
local version = require(iconModule.VERSION)
if localPlayer.UserId ~= ownerId then
local marketplaceService = game:GetService("MarketplaceService")
local success, placeInfo = pcall(function() return marketplaceService:GetProductInfo(game.PlaceId) end)
if success and placeInfo then
-- Required attrbute for using TopbarPlus
-- This is not printed within stuido and to the game owner to prevent mixing with debug prints
local gameName = placeInfo.Name
print(("\n\n\n⚽ %s uses TopbarPlus %s\n🍍 TopbarPlus was developed by ForeverHD and the Nanoblox Team\n🚀 You can learn more and take a free copy by searching for 'TopbarPlus' on the DevForum\n\n"):format(gameName, version))
end
end
end
end)()
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Spin string" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Constructs a new state. Should not be called directly.
-- @param Table or Instance
-- @param StateMachine
-- @return BaseState
|
function BaseState.New(stateFolder,StateMachine)
local self = {}
setmetatable(self,BaseState)
self.stateFolder = stateFolder
self.StateMachine = StateMachine
self.handles = {}
self.stateTime = 0
self.offStateTime = 0
return self
end
|
--PromptChained
--* very similar to PromptShown, except there are no responses.
--* that means there's a prompt following this prompt. the only
--* responsibility of this function is to call the clalback in
--* order to acknowledge that the chain should proceed. this
--* allows you to use your own timing scheme for how the chain
--* should proceed, with a continue button, arbitrary timing, etc.
--* promptTable is in the following format:
--* {
--* Line = "The prompt string.",
--* Data = [the data from the prompt node],
--* }
|
function Interface.PromptChained(dialogueFolder, promptTable, callback)
end
return Interface
|
-- Setup animation objects
|
function scriptChildModified(child)
print(animTable)
local fileList = animNames[child.Name]
if (fileList ~= nil) then
configureAnimationSet(child.Name, fileList)
end
end
script.ChildAdded:connect(scriptChildModified)
script.ChildRemoved:connect(scriptChildModified)
|
-- Looking for how exactly to set up your background music? Open the Readme/Instructions script!
|
local settings = {}
|
--[[
The Enabler is a script that enables the Main script once it gets put into the Player's backpack. This script is needed
because Roblox updates prevented the Tool from being enabled the first time the plane tool was selected.
]]
|
local Main = script.Parent.Main
repeat wait() until game.Players.LocalPlayer
Main.Disabled = false
|
--[[Weight and CG]]
|
Tune.Weight = 6500 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 4 ,
--[[Length]] 15 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = MORE STABLE / carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--- Returns whether it should be possible to scope into the given item.
-- @returns boolean
|
local function IsItemScopable(Item)
return Item:IsA('Model')
or Item:IsA('Folder')
or Item:IsA('Tool')
or Item:IsA('Accessory')
or Item:IsA('Accoutrement')
or (Item:IsA('BasePart') and Item:FindFirstChildWhichIsA('BasePart', true))
end
|
-- Table setup containing product IDs and functions for handling purchases
|
local developerProductFunctions = {}
|
--WRITE YOUR ABILITIES HERE--
|
hum.WalkSpeed = 25
|
-- UI elements
|
local intro = script.Parent:WaitForChild("Intro")
intro.Visible = true
local tokensLabel = script.Parent:WaitForChild("Tokens") -- the textlabel in our maingui
local tokens = game.Players.LocalPlayer:WaitForChild("Tokens") -- value with our tokens in the player object
wait(2)
game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
game.Workspace.Camera.CFrame = CFrame.new(game.Workspace.IntroTunnel.CameraOrigin.Position,game.Workspace.IntroTunnel.CameraFace.Position)
local topStatus = script.Parent:WaitForChild("TopStatus")
topStatus.Text = status.Value
status:GetPropertyChangedSignal("Value"):Connect(function()
topStatus.Text = status.Value
end)
tokensLabel.Text = tokens.Value
tokens:GetPropertyChangedSignal("Value"):Connect(function()
tokensLabel.Text = tokens.Value
end)
intro.Play.MouseButton1Click:Connect(function()
if game.ReplicatedStorage.MapVoting.Value == true then
script.Parent.MapVoting.Visible = true
end
intro.Visible = false
topStatus.Visible = true
game.ReplicatedStorage.MenuPlay:FireServer()
game.Workspace.Camera.CameraType = Enum.CameraType.Custom
end)
game.ReplicatedStorage.KillFeed.OnClientEvent:Connect(function(text)
script.Parent.KillFeed.Visible = true
script.Parent.KillFeed.Text = text
wait(2)
script.Parent.KillFeed.Visible = false
end)
game.ReplicatedStorage.Announcement.OnClientEvent:Connect(function(text)
script.Parent.Announcement.Text = text
script.Parent.Announcement.Visible = true
wait(5)
script.Parent.Announcement.Visible = false
end)
intro.Store.MouseButton1Click:Connect(function()
script.Parent:WaitForChild("Shop").Visible = true
intro.Visible = false
end)
script.Parent:WaitForChild("ShopBtn").MouseButton1Click:Connect(function()
script.Parent:WaitForChild("Shop").Visible = not script.Parent:WaitForChild("Shop").Visible
end)
script.Parent:WaitForChild("Shop"):WaitForChild("Close").MouseButton1Click:Connect(function()
if game.Players.LocalPlayer:FindFirstChild("InMenu") then
-- we know you are in the menu
intro.Visible = true
end
script.Parent:WaitForChild("Shop").Visible = false
end)
|
--face = "none",
|
},
toolbar = {
{name = "Rock",
lastSwing = 0,}, -- 1
{}, -- 2
{}, -- 3
{}, -- 4
{}, -- 5
{}, -- 6
}, -- end of toolbar
customRecipes = {},
ownedCosmetics = {},
} -- end of default data table
end, -- end of function
} -- end of module
return module
|
--!strict
|
local Find = require(script.Parent.find)
|
-- / Functions / --
|
RagdollModule.SetupRagdoll = function(Character)
for _, Joint in pairs(Character:GetDescendants()) do
if Joint:IsA("Motor6D") then
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
A0.Parent = Joint.Part0
A1.Parent = Joint.Part1
A0.CFrame = Joint.C0
A1.CFrame = Joint.C1
local BallSocketConstraint = Instance.new("BallSocketConstraint")
BallSocketConstraint.Parent = Joint.Parent
BallSocketConstraint.Enabled = false
BallSocketConstraint.Attachment0 = A0
BallSocketConstraint.Attachment1 = A1
end
end
end
RagdollModule.Ragdoll = function(Character)
for _, CharacterObject in pairs(Character:GetDescendants()) do
if CharacterObject:IsA("Motor6D") then
local Joint = CharacterObject
Joint:Destroy()
elseif CharacterObject:IsA("BallSocketConstraint") then
local BallSocketConstraint = CharacterObject
BallSocketConstraint.Enabled = true
elseif CharacterObject.Name == "Head" then
if CharacterObject:IsA("BasePart") then
local Head = CharacterObject
local HRP = Character:WaitForChild("HumanoidRootPart")
Head.CanCollide = true
local HeadWeld = Instance.new("WeldConstraint")
HeadWeld.Parent = Head
HeadWeld.Part0 = Head
HeadWeld.Part1 = HRP
end
end
end
end
|
-- orig.Leaderboard.SurfaceGui.scrLeader.Disabled=false -- оригинал
|
wait(1)
|
--Optimization--
|
local rad = math.rad
local random = math.random
local NewCFrame = CFrame.new
local Angles = CFrame.Angles
local NewVector = Vector3.new
local CFLookAt = CFrame.lookAt
local NewInstance = Instance.new
local function IsHeadAccessory(Handle)
if Handle:FindFirstChild("HatAttachment") or Handle:FindFirstChild("HairAttachment") or Handle:FindFirstChild("NeckAttachment") or Handle:FindFirstChild("FaceFrontAttachment") then
return true
else
return false
end
end
local function OnLengthChanged(Cast, LastPoint, Direction, Length, Velocity, Bullet)
if Bullet then
local BulletLength = Bullet.Size.Z/2
local Offset = NewCFrame(0,0,-(Length - BulletLength))
Bullet.CFrame = CFLookAt(LastPoint, LastPoint + Direction):ToWorldSpace(Offset)
end
end
local function OnHit(Cast, Result, Velocity, Bullet)
local HitCoroutine = coroutine.create(function()
local Hit = Result.Instance
local Damage = random(MinimumDamage,MaximumDamage)
if Hit.Parent:IsA("Model") and not core.isAlly(Hit.Parent) then
if Hit.Parent:FindFirstChild("Humanoid") then
local Humanoid = Hit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid")
if Hit.Name == "Head" then
Humanoid:TakeDamage(Damage * headshotmultiplier)
else
Humanoid:TakeDamage(Damage)
end
local HitSound = NewInstance("Sound",Hit)
HitSound.PlayOnRemove = true
HitSound.SoundId = HitFleshSound
HitSound:Destroy()
else
local newBulletHole = combat.getBulletHole()
newBulletHole.CFrame = NewCFrame(Result.Position,Result.Position + Result.Normal)
for i = 1, random(2,3) do
local chunk = NewInstance("Part")
chunk.Color = Result.Instance.Color
chunk.Material = Result.Instance.Material
local size = random(5)/20
chunk.Size = NewVector(size,size,size)
chunk.CFrame = NewCFrame(Result.Position)
chunk.Anchored = false
chunk.Velocity = NewVector(random(-20,20),random(10,20),random(-20,20))
chunk.Parent = workspace.IgnoreFolder
chunk:SetNetworkOwner(nil)
debrisService:AddItem(chunk,1)
end
local soundattachment = NewInstance("Part",workspace.IgnoreFolder)
soundattachment.Size = NewVector(0,0,0)
soundattachment.CanCollide = false
soundattachment.CFrame = NewCFrame(Result.Position)
soundattachment.Anchored = true
local HitSound = NewInstance("Sound",soundattachment)
HitSound.SoundId = HitWallSounds[random(1,#HitWallSounds)]
HitSound.Volume = 1
HitSound:Play()
debrisService:AddItem(soundattachment,1.5)
debrisService:AddItem(newBulletHole,5)
end
elseif Hit.Parent:IsA("Accessory") then
local IsAHeadAccessory = IsHeadAccessory(Hit)
if Hit.Parent.Parent:IsA("Model") and not core.isAlly(Hit.Parent.Parent) then
local Model = Hit.Parent.Parent
if Model:FindFirstChild("Humanoid") then
if IsAHeadAccessory then
Model.Humanoid:TakeDamage(Damage * headshotmultiplier)
else
Model.Humanoid:TakeDamage(Damage)
end
local HitSound = NewInstance("Sound",Hit)
HitSound.PlayOnRemove = true
HitSound.SoundId = HitFleshSound
HitSound:Destroy()
end
end
end
end)
coroutine.resume(HitCoroutine)
debrisService:AddItem(Bullet,0.7)
if Bullet:FindFirstChild("Whiz") then
Bullet.Whiz:Stop()
end
end
function combat.getBulletHole()
local c = game.ServerStorage:WaitForChild("Hole"):Clone()
c.Parent = workspace.IgnoreFolder
return c
end
function combat.getBullet()
local c = game.ServerStorage:WaitForChild("Bullet"):Clone()
c.Parent = workspace.IgnoreFolder
return c
end
function combat.getCase()
local c = game.ServerStorage:WaitForChild("Case"):Clone()
c.Parent = workspace.IgnoreFolder
return c
end
function pushBullet(bullet)
-- replaced all the code in this function
local origin = barrel.WorldPosition
local direction = (NewCFrame(origin,(barrel.WorldCFrame * NewCFrame(0,0,-5)).Position) * Angles(rad(random(-spread,spread)),rad(random(-spread,spread)),rad(random(-spread,spread)))).LookVector
local NewVelocity = direction * bulletspeed
NewCaster:Fire(origin, direction, NewVelocity, Behaviour)
local MaxLength = 0 -- value starts at zero and works its way up to the maximum distance as the bullet travels (used to detect how far the cosmetic bullet travels before being destroyed if it reaches max distance)
NewCaster.LengthChanged:Connect(function(Cast,LastPoint,NewDirection,Length,NewVelocity,Bullet)
OnLengthChanged(Cast, LastPoint, NewDirection, Length, NewVelocity, Bullet)
MaxLength += Length
if MaxLength >= maxdistance and Bullet ~= nil then
Bullet:Destroy()
end
end)
NewCaster.RayHit:Connect(OnHit)
end
local flashIndex = 1
function combat.shoot(target)
if status:get("weaponCool") and not status:get("reloading") then
status:set("weaponCool",false)
local shot
if core.checkDist(target,myRoot) > 60 then
shot = 1
else
shot = burstamount
end
if not fullauto then
for i = 1, shot do
if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end
if core.checkDist(myRoot,target) < 7 then break end
wait(firerate)
status:set("mag",status:get("mag")-1)
--flash:Emit(1)
local FlashCoroutine = coroutine.create(function()
barrel.MuzzleFlash:Emit(20)
barrel.Dust:Emit(40)
lightFlash.Enabled = true
wait(0.1)
lightFlash.Enabled = false
end)
coroutine.resume(FlashCoroutine)
--bullet.CFrame = m4.CFrame * NewCFrame(0,0.2,-2.5) --z: 0.5
if shotgunpellets > 1 then
for i = 1,shotgunpellets,1 do
spawn(function()
local bullet = combat.getBullet()
pushBullet(bullet)
bullet:Destroy()
end)
end
else
local bullet = combat.getBullet()
pushBullet(bullet)
bullet:Destroy()
end
local case = combat.getCase()
case.CFrame = chamber.WorldCFrame
case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
case:SetNetworkOwner(nil)
core.spawn(function()
wait(0.05)
case.CanCollide = true
wait(2)
case:Destroy()
end)
fireSound:Play()
--Kick
local original = m4.HingeAttach1.Position
m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()
end
else
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {marine}
local Success,Error = pcall(function() -- gonna make sure if something strange happens the whole script wont freeze
for i = 1, status:get("mag") do
if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end
local cansee = false
local eyesight = workspace:Raycast(myHead.Position,(target.Parent.Head.Position - myHead.Position).Unit * detectionrange,Params)
pcall(function()
if eyesight.Instance and eyesight.Instance:IsDescendantOf(target.Parent) then
cansee = true
end
end)
if not cansee then break end
wait(firerate)
status:set("mag",status:get("mag")-1)
--flash:Emit(1)
local FlashCoroutine = coroutine.create(function()
barrel.MuzzleFlash:Emit(20)
barrel.Dust:Emit(40)
lightFlash.Enabled = true
wait(0.1)
lightFlash.Enabled = false
end)
coroutine.resume(FlashCoroutine)
if shotgunpellets > 1 then
for i = 1,shotgunpellets,1 do
spawn(function()
local bullet = combat.getBullet()
pushBullet(bullet)
bullet:Destroy()
end)
end
else
local bullet = combat.getBullet()
pushBullet(bullet)
bullet:Destroy()
end
local case = combat.getCase()
case.CFrame = chamber.WorldCFrame
case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
core.spawn(function()
wait(0.05)
case.CanCollide = true
wait(2)
case:Destroy()
end)
fireSound:Play()
--Kick
local original = m4.HingeAttach1.Position
m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()
end
end)
if not Success then
warn(Error)
end
end
if status:get("mag") <= 0 then
wait(delaybeforereloading)
actions.reload()
end
--New thread here before
wait(mySettings.M4.Delay.Value)
status:set("weaponCool",true)
end
end
function combat.throwGrenade(target)
if status:get("weaponCool") and status:get("grenadeCool") then
status:set("weaponCool",false)
status:set("grenadeCool",false)
actions.yieldWeapons()
local g = marine.Grenade:Clone()
g.Boom.PlayOnRemove = true
g.Parent = workspace
g.CanCollide = true
g.CFrame = marine["Right Arm"].CFrame * NewCFrame(0,-1.3,0) * Angles(0,0,rad(90))
g:SetNetworkOwner(nil)
debrisService:AddItem(g,5)
marine.Grenade.Transparency = 1
local w = NewInstance("WeldConstraint",g)
w.Part0 = marine["Right Arm"]
w.Part1 = g
throwAnimation:Play()
marine.Grenade.Pin:Play()
--Rotate and throw
myHuman.AutoRotate = false
for i=1,4 do
wait(0.1)
myRoot.CFrame = CFLookAt(NewVector(myRoot.Position.X,myRoot.Position.Y,myRoot.Position.Z),NewVector(target.Position.X,myRoot.Position.Y,target.Position.Z))
end
myHuman.AutoRotate = true
if myHuman.Health <= 0 then
return
end
throwAnimation:Stop()
w.Part1 = nil
local targetPos = target.Position + (target.Velocity)
troubleshoot.mark(targetPos)
local dist = core.checkDist(myRoot,target)
local aimCFrame = CFLookAt(myRoot.Position,targetPos)
--g.Velocity = (aimCFrame.LookVector + NewVector(0,1.1,0)) * NewVector(dist,dist*1.5,dist)
g.Velocity = (myRoot.CFrame.LookVector + NewVector(0,1,0)) * NewVector(dist,dist*1.5,dist)
--Wait until grenade is thrown before it can be primed
touched = g.Touched:Connect(function(obj)
if not obj:IsDescendantOf(marine) then
touched:Disconnect()
g.HitWall:Play()
wait(0.5)
local x = NewInstance("Explosion",workspace)
x.Position = g.Position
x.BlastRadius = 16
x.BlastPressure = 0
x.Hit:Connect(function(obj,dist)
local human = obj.Parent:FindFirstChild("Humanoid")
if human then
core.applyDamage(human,20-dist)
end
end)
g:Destroy()
debrisService:AddItem(x,2)
end
end)
local attach0 = g.Attach0
local attach1 = g.Attach1
local t = NewInstance("Trail",g)
t.Attachment0 = attach0
t.Attachment1 = attach1
t.Lifetime = 0.5
t.Color = ColorSequence.new(Color3.fromRGB(150,150,150))
t.WidthScale = NumberSequence.new(1,0)
core.spawn(function()
wait(1)
status:set("weaponCool",true)
wait(5)
status:set("grenadeCool",true)
marine.Grenade.Transparency = 0
end)
end
end
local knife = marine.Knife
function combat.stab()
local canStab = false
for i,v in pairs(status:get("currentTarget").Parent:GetChildren()) do
if v:IsA("BasePart") and core.checkDist(v,myRoot) < 7 then
canStab = true
end
end
if canStab then
myHuman:MoveTo(status:get("currentTarget").Position)
knife.Stab:Play()
knife.Attack:Play()
if random(2) == 1 then
stabAnimation:Play(0.1,1,2)
else
stabPunchAnimation:Play()
end
local human = status:get("currentTarget").Parent.Humanoid
core.applyDamage(human,random(MinimumDamage,MaximumDamage))
if human.Health <= 0 then
targeting.findTarget()
end
--stabAnimation.Stopped:Wait()
wait(0.5)
else
wait(0.2)
end
end
function combat.checkCluster(target)
--Check for nearby allies
for i,v in ipairs(status:get("activeAllies")) do
if core.checkDist(target,v) < 30 then
return false
end
end
--Check if enemies are paired close together
for i,v in ipairs(status:get("potentialTargets")) do
if v ~= target then
if core.checkDist(target,v) < 15 then
return true
end
end
end
return false
end
return combat
|
----- Service Table -----
|
local ProfileService = {
ServiceLocked = false, -- Set to true once the server is shutting down
IssueSignal = Madwork.NewScriptSignal(), -- (error_message, profile_store_name, profile_key) -- Fired when a DataStore API call throws an error
CorruptionSignal = Madwork.NewScriptSignal(), -- (profile_store_name, profile_key) -- Fired when DataStore key returns a value that has
-- all or some of it's profile components set to invalid data types. E.g., accidentally setting Profile.Data to a noon table value
CriticalState = false, -- Set to true while DataStore service is throwing too many errors
CriticalStateSignal = Madwork.NewScriptSignal(), -- (is_critical_state) -- Fired when CriticalState is set to true
-- (You may alert players with this, or set up analytics)
ServiceIssueCount = 0,
_active_profile_stores = {
--[[
{
_profile_store_name = "", -- [string] -- DataStore name
_profile_template = {} / nil, -- [table / nil]
_global_data_store = global_data_store, -- [GlobalDataStore] -- Object returned by DataStoreService:GetDataStore(_profile_store_name)
_loaded_profiles = {
[profile_key] = {
Data = {}, -- [table] -- Loaded once after ProfileStore:LoadProfileAsync() finishes
MetaData = {}, -- [table] -- Updated with every auto-save
GlobalUpdates = {, -- [GlobalUpdates]
_updates_latest = {}, -- [table] {update_index, {{update_id, version_id, update_locked, update_data}, ...}}
_pending_update_lock = {update_id, ...} / nil, -- [table / nil]
_pending_update_clear = {update_id, ...} / nil, -- [table / nil]
_new_active_update_listeners = {listener, ...} / nil, -- [table / nil]
_new_locked_update_listeners = {listener, ...} / nil, -- [table / nil]
_profile = Profile / nil, -- [Profile / nil]
_update_handler_mode = true / nil, -- [bool / nil]
}
_profile_store = ProfileStore, -- [ProfileStore]
_profile_key = "", -- [string]
_release_listeners = {listener, ...} / nil, -- [table / nil]
_view_mode = true / nil, -- [bool / nil]
_load_timestamp = os.clock(),
_is_user_mock = false, -- ProfileStore.Mock
},
...
},
_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
_mock_loaded_profiles = {[profile_key] = Profile, ...},
_mock_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
_is_pending = false, -- Waiting for live access check
},
...
--]]
},
_auto_save_list = { -- loaded profile table which will be circularly auto-saved
--[[
Profile,
...
--]]
},
_issue_queue = {}, -- [table] {issue_time, ...}
_critical_state_start = 0, -- [number] 0 = no critical state / os.clock() = critical state start
-- Debug:
_mock_data_store = {},
_user_mock_data_store = {},
_use_mock_data_store = false,
}
|
--[[
If a Repair Kit touches the system, increase the health - if it's a monster, decrease its health.
]]
|
local function onTouched(self, otherPart)
if otherPart.Anchored then
return
end
if CollectionService:HasTag(otherPart, Constants.Tag.Tool.RepairKit) then
if self._health ~= self._maxHealth then
otherPart:Destroy()
self:incrementHealth(DEFAULT_TOOLKIT_HEALING_AMOUNT)
end
elseif CollectionService:HasTag(otherPart, Constants.Tag.Monster) and not self._monsterDebounce then
self._monsterDebounce = true
self:incrementHealth(-MONSTER_DAMAGE)
delay(
MONSTER_DEBOUNCE_TIME,
function()
self._monsterDebounce = false
end
)
end
end
local BaseSystem = ClassUtils.makeClass(script.Name)
|
-- Services
|
local RbxUtility = LoadLibrary("RbxUtility")
local Create = RbxUtility.Create
|
----
----
|
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local target1 = "RightLowerArm"
local target2 = "RightLowerArm2"
if hit.Parent:findFirstChild(target2) == nil then
local g = script.Parent.Parent[target2]:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent[target1]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
|
-- Styles
|
local function CreateColor3(r, g, b) return Color3.new(r/255,g/255,b/255) end
local Styles = {
Font = Enum.Font.Arial;
Margin = 5;
Black = CreateColor3(0,0,0);
White = CreateColor3(255,255,255);
}
local Row = {
Font = Styles.Font;
FontSize = Enum.FontSize.Size14;
TextXAlignment = Enum.TextXAlignment.Left;
TextColor = Styles.Black;
TextColorOver = Styles.White;
TextLockedColor = CreateColor3(120,120,120);
Height = 24;
BorderColor = CreateColor3(216,216,216);
BackgroundColor = Styles.White;
BackgroundColorAlternate = CreateColor3(246,246,246);
BackgroundColorMouseover = CreateColor3(211,224,244);
TitleMarginLeft = 15;
}
local DropDown = {
Font = Styles.Font;
FontSize = Enum.FontSize.Size14;
TextColor = CreateColor3(0,0,0);
TextColorOver = Styles.White;
TextXAlignment = Enum.TextXAlignment.Left;
Height = 16;
BackColor = Styles.White;
BackColorOver = CreateColor3(86,125,188);
BorderColor = CreateColor3(216,216,216);
BorderSizePixel = 2;
ArrowColor = CreateColor3(160,160,160);
ArrowColorOver = Styles.Black;
}
local BrickColors = {
BoxSize = 13;
BorderSizePixel = 1;
BorderColor = CreateColor3(160,160,160);
FrameColor = CreateColor3(160,160,160);
Size = 20;
Padding = 4;
ColorsPerRow = 8;
OuterBorder = 1;
OuterBorderColor = Styles.Black;
}
wait(1)
local Gui = script.Parent.Parent
local PropertiesFrame = Gui:WaitForChild("PropertiesFrame")
local ExplorerFrame = Gui:WaitForChild("ExplorerPanel")
local bindGetSelection = ExplorerFrame.GetSelection
local bindSelectionChanged = ExplorerFrame.SelectionChanged
local bindGetApi = PropertiesFrame.GetApi
local bindGetAwait = PropertiesFrame.GetAwaiting
local bindSetAwait = PropertiesFrame.SetAwaiting
local ContentUrl = ContentProvider.BaseUrl .. "asset/?id="
local SettingsRemote = Gui:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local propertiesSearch = PropertiesFrame.Header.TextBox
local AwaitingObjectValue = false
local AwaitingObjectObj
local AwaitingObjectProp
function searchingProperties()
if propertiesSearch.Text ~= "" and propertiesSearch.Text ~= "Search Properties" then
return true
end
return false
end
local function GetSelection()
local selection = bindGetSelection:Invoke()
if #selection == 0 then
return nil
else
return selection
end
end
|
-- Set up an on-screen thumbstick control:
|
local function ThumbstickSetup(frame, callback)
local stick = frame:WaitForChild("Stick")
local btn = frame:WaitForChild("Button")
local btnDown = false
-- Calculate relative position of thumbstick when dragged to screen position "pos":
local function TouchDragged(pos)
local x = (pos.X - frame.AbsolutePosition.X)
local y = (pos.Y - frame.AbsolutePosition.Y)
x = (x < 0 and 0 or x > frame.AbsoluteSize.X and frame.AbsoluteSize.X or x)
y = (y < 0 and 0 or y > frame.AbsoluteSize.Y and frame.AbsoluteSize.Y or y)
local ratioX = ((x / frame.AbsoluteSize.X) - 0.5) * 2
local ratioY = -((y / frame.AbsoluteSize.Y) - 0.5) * 2
stick.Position = UDim2.new(0, x, 0, y)
callback(ratioX, ratioY)
end
local function StartTouch(pos)
btnDown = true
TouchDragged(pos)
btn.Size = UDim2.new(10, 0, 10, 0)
end
local function StopTouch(pos)
btnDown = false
stick:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Quint", 0.15, true)
btn.Size = UDim2.new(1, 0, 1, 0)
callback(0, 0)
end
btn.InputChanged:Connect(function(input)
if (btnDown and input.UserInputType == Enum.UserInputType.Touch) then
TouchDragged(input.Position)
end
end)
btn.MouseButton1Down:Connect(function(x, y)
StartTouch(Vector3.new(x, y, 0))
end)
btn.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Touch then
StopTouch(input.Position)
end
end)
end -- ThumbstickSetup()
|
--[[ The Class ]]
|
--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local VRNavigation = setmetatable({}, BaseCharacterController)
VRNavigation.__index = VRNavigation
function VRNavigation.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable(BaseCharacterController.new(), VRNavigation)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.navigationRequestedConn = nil
self.heartbeatConn = nil
self.currentDestination = nil
self.currentPath = nil
self.currentPoints = nil
self.currentPointIdx = 0
self.expectedTimeToNextPoint = 0
self.timeReachedLastPoint = tick()
self.moving = false
self.isJumpBound = false
self.moveLatch = false
self.userCFrameEnabledConn = nil
return self
end
function VRNavigation:SetLaserPointerMode(mode)
pcall(function()
StarterGui:SetCore("VRLaserPointerMode", mode)
end)
end
function VRNavigation:GetLocalHumanoid()
local character = LocalPlayer.Character
if not character then
return
end
for _, child in pairs(character:GetChildren()) do
if child:IsA("Humanoid") then
return child
end
end
return nil
end
function VRNavigation:HasBothHandControllers()
return VRService:GetUserCFrameEnabled(Enum.UserCFrame.RightHand) and VRService:GetUserCFrameEnabled(Enum.UserCFrame.LeftHand)
end
function VRNavigation:HasAnyHandControllers()
return VRService:GetUserCFrameEnabled(Enum.UserCFrame.RightHand) or VRService:GetUserCFrameEnabled(Enum.UserCFrame.LeftHand)
end
function VRNavigation:IsMobileVR()
return UserInputService.TouchEnabled
end
function VRNavigation:HasGamepad()
return UserInputService.GamepadEnabled
end
function VRNavigation:ShouldUseNavigationLaser()
--Places where we use the navigation laser:
-- mobile VR with any number of hands tracked
-- desktop VR with only one hand tracked
-- desktop VR with no hands and no gamepad (i.e. with Oculus remote?)
--using an Xbox controller with a desktop VR headset means no laser since the user has a thumbstick.
--in the future, we should query thumbstick presence with a features API
if self:IsMobileVR() then
return true
else
if self:HasBothHandControllers() then
return false
end
if not self:HasAnyHandControllers() then
return not self:HasGamepad()
end
return true
end
end
function VRNavigation:StartFollowingPath(newPath)
currentPath = newPath
currentPoints = currentPath:GetPointCoordinates()
currentPointIdx = 1
moving = true
timeReachedLastPoint = tick()
local humanoid = self:GetLocalHumanoid()
if humanoid and humanoid.Torso and #currentPoints >= 1 then
local dist = (currentPoints[1] - humanoid.Torso.Position).magnitude
expectedTimeToNextPoint = dist / humanoid.WalkSpeed
end
movementUpdateEvent:Fire("targetPoint", self.currentDestination)
end
function VRNavigation:GoToPoint(point)
currentPath = true
currentPoints = { point }
currentPointIdx = 1
moving = true
local humanoid = self:GetLocalHumanoid()
local distance = (humanoid.Torso.Position - point).magnitude
local estimatedTimeRemaining = distance / humanoid.WalkSpeed
timeReachedLastPoint = tick()
expectedTimeToNextPoint = estimatedTimeRemaining
movementUpdateEvent:Fire("targetPoint", point)
end
function VRNavigation:StopFollowingPath()
currentPath = nil
currentPoints = nil
currentPointIdx = 0
moving = false
self.moveVector = ZERO_VECTOR3
end
function VRNavigation:TryComputePath(startPos, destination)
local numAttempts = 0
local newPath = nil
while not newPath and numAttempts < 5 do
newPath = PathfindingService:ComputeSmoothPathAsync(startPos, destination, MAX_PATHING_DISTANCE)
numAttempts = numAttempts + 1
if newPath.Status == Enum.PathStatus.ClosestNoPath or newPath.Status == Enum.PathStatus.ClosestOutOfRange then
newPath = nil
break
end
if newPath and newPath.Status == Enum.PathStatus.FailStartNotEmpty then
startPos = startPos + (destination - startPos).unit
newPath = nil
end
if newPath and newPath.Status == Enum.PathStatus.FailFinishNotEmpty then
destination = destination + Vector3.new(0, 1, 0)
newPath = nil
end
end
return newPath
end
function VRNavigation:OnNavigationRequest(destinationCFrame, inputUserCFrame )
local destinationPosition = destinationCFrame.p
local lastDestination = self.currentDestination
if not IsFiniteVector3(destinationPosition) then
return
end
self.currentDestination = destinationPosition
local humanoid = self:GetLocalHumanoid()
if not humanoid or not humanoid.Torso then
return
end
local currentPosition = humanoid.Torso.Position
local distanceToDestination = (self.currentDestination - currentPosition).magnitude
if distanceToDestination < NO_PATH_THRESHOLD then
self:GoToPoint(self.currentDestination)
return
end
if not lastDestination or (self.currentDestination - lastDestination).magnitude > RECALCULATE_PATH_THRESHOLD then
local newPath = self:TryComputePath(currentPosition, self.currentDestination)
if newPath then
self:StartFollowingPath(newPath)
if PathDisplay then
PathDisplay.setCurrentPoints(self.currentPoints)
PathDisplay.renderPath()
end
else
self:StopFollowingPath()
if PathDisplay then
PathDisplay.clearRenderedPath()
end
end
else
if moving then
self.currentPoints[#currentPoints] = self.currentDestination
else
self:GoToPoint(self.currentDestination)
end
end
end
function VRNavigation:OnJumpAction(actionName, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
self.isJumping = true
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
function VRNavigation:BindJumpAction(active)
if active then
if not self.isJumpBound then
self.isJumpBound = true
if FFlagPlayerScriptsBindAtPriority then
ContextActionService:BindActionAtPriority("VRJumpAction", (function() return self:OnJumpAction() end), false,
self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonA)
else
ContextActionService:BindAction("VRJumpAction", (function() self:OnJumpAction() end), false, Enum.KeyCode.ButtonA)
end
end
else
if self.isJumpBound then
self.isJumpBound = false
ContextActionService:UnbindAction("VRJumpAction")
end
end
end
function VRNavigation:ControlCharacterGamepad(actionName, inputState, inputObject)
if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if inputState == Enum.UserInputState.Cancel then
self.moveVector = ZERO_VECTOR3
return
end
if inputState ~= Enum.UserInputState.End then
self:StopFollowingPath()
if PathDisplay then
PathDisplay.clearRenderedPath()
end
if self:ShouldUseNavigationLaser() then
self:BindJumpAction(true)
self:SetLaserPointerMode("Hidden")
end
if inputObject.Position.magnitude > THUMBSTICK_DEADZONE then
self.moveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
if self.moveVector.magnitude > 0 then
self.moveVector = self.moveVector.unit * math.min(1, inputObject.Position.magnitude)
end
self.moveLatch = true
end
else
self.moveVector = ZERO_VECTOR3
if self:ShouldUseNavigationLaser() then
self:BindJumpAction(false)
self:SetLaserPointerMode("Navigation")
end
if self.moveLatch then
self.moveLatch = false
movementUpdateEvent:Fire("offtrack")
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
function VRNavigation:OnHeartbeat(dt)
local newMoveVector = self.moveVector
local humanoid = self:GetLocalHumanoid()
if not humanoid or not humanoid.Torso then
return
end
if self.moving and self.currentPoints then
local currentPosition = humanoid.Torso.Position
local goalPosition = currentPoints[1]
local vectorToGoal = (goalPosition - currentPosition) * XZ_VECTOR3
local moveDist = vectorToGoal.magnitude
local moveDir = vectorToGoal / moveDist
if moveDist < POINT_REACHED_THRESHOLD then
local estimatedTimeRemaining = 0
local prevPoint = currentPoints[1]
for i, point in pairs(currentPoints) do
if i ~= 1 then
local dist = (point - prevPoint).magnitude
prevPoint = point
estimatedTimeRemaining = estimatedTimeRemaining + (dist / humanoid.WalkSpeed)
end
end
table.remove(currentPoints, 1)
currentPointIdx = currentPointIdx + 1
if #currentPoints == 0 then
self:StopFollowingPath()
if PathDisplay then
PathDisplay.clearRenderedPath()
end
return
else
if PathDisplay then
PathDisplay.setCurrentPoints(currentPoints)
PathDisplay.renderPath()
end
local newGoal = currentPoints[1]
local distanceToGoal = (newGoal - currentPosition).magnitude
expectedTimeToNextPoint = distanceToGoal / humanoid.WalkSpeed
timeReachedLastPoint = tick()
end
else
local ignoreTable = {
game.Players.LocalPlayer.Character,
workspace.CurrentCamera
}
local obstructRay = Ray.new(currentPosition - Vector3.new(0, 1, 0), moveDir * 3)
local obstructPart, obstructPoint, obstructNormal = workspace:FindPartOnRayWithIgnoreList(obstructRay, ignoreTable)
if obstructPart then
local heightOffset = Vector3.new(0, 100, 0)
local jumpCheckRay = Ray.new(obstructPoint + moveDir * 0.5 + heightOffset, -heightOffset)
local jumpCheckPart, jumpCheckPoint, jumpCheckNormal = workspace:FindPartOnRayWithIgnoreList(jumpCheckRay, ignoreTable)
local heightDifference = jumpCheckPoint.Y - currentPosition.Y
if heightDifference < 6 and heightDifference > -2 then
humanoid.Jump = true
end
end
local timeSinceLastPoint = tick() - timeReachedLastPoint
if timeSinceLastPoint > expectedTimeToNextPoint + OFFTRACK_TIME_THRESHOLD then
self:StopFollowingPath()
if PathDisplay then
PathDisplay.clearRenderedPath()
end
movementUpdateEvent:Fire("offtrack")
end
newMoveVector = self.moveVector:Lerp(moveDir, dt * 10)
end
end
if IsFiniteVector3(newMoveVector) then
self.moveVector = newMoveVector
end
end
function VRNavigation:OnUserCFrameEnabled()
if self:ShouldUseNavigationLaser() then
self:BindJumpAction(false)
self:SetLaserPointerMode("Navigation")
else
self:BindJumpAction(true)
self:SetLaserPointerMode("Hidden")
end
end
function VRNavigation:Enable(enable)
self.moveVector = ZERO_VECTOR3
self.isJumping = false
if enable then
self.navigationRequestedConn = VRService.NavigationRequested:Connect(function(destinationCFrame, inputUserCFrame) self:OnNavigationRequest(destinationCFrame, inputUserCFrame) end)
self.heartbeatConn = RunService.Heartbeat:Connect(function(dt) self:OnHeartbeat(dt) end)
if FFlagPlayerScriptsBindAtPriority then
ContextActionService:BindAction("MoveThumbstick", (function(actionName, inputState, inputObject) return self:ControlCharacterGamepad(actionName, inputState, inputObject) end),
false, self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Thumbstick1)
else
ContextActionService:BindAction("MoveThumbstick", (function(actionName, inputState, inputObject) self:ControlCharacterGamepad(actionName, inputState, inputObject) end), false, Enum.KeyCode.Thumbstick1)
end
ContextActionService:BindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)
self.userCFrameEnabledConn = VRService.UserCFrameEnabled:Connect(function() self:OnUserCFrameEnabled() end)
self:OnUserCFrameEnabled()
VRService:SetTouchpadMode(Enum.VRTouchpad.Left, Enum.VRTouchpadMode.VirtualThumbstick)
VRService:SetTouchpadMode(Enum.VRTouchpad.Right, Enum.VRTouchpadMode.ABXY)
self.enabled = true
else
-- Disable
self:StopFollowingPath()
ContextActionService:UnbindAction("MoveThumbstick")
ContextActionService:UnbindActivate(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonR2)
self:BindJumpAction(false)
self:SetLaserPointerMode("Disabled")
if self.navigationRequestedConn then
self.navigationRequestedConn:Disconnect()
self.navigationRequestedConn = nil
end
if self.heartbeatConn then
self.heartbeatConn:Disconnect()
self.heartbeatConn = nil
end
if self.userCFrameEnabledConn then
self.userCFrameEnabledConn:Disconnect()
self.userCFrameEnabledConn = nil
end
self.enabled = false
end
end
return VRNavigation
|
-- CONNECTIONS
|
local iconCreationCount = 0
IconController.iconAdded:Connect(function(icon)
topbarIcons[icon] = true
if IconController.gameTheme then
icon:setTheme(IconController.gameTheme)
end
icon.updated:Connect(function()
IconController.updateTopbar()
end)
-- When this icon is selected, deselect other icons if necessary
icon.selected:Connect(function()
local allIcons = IconController.getIcons()
for _, otherIcon in pairs(allIcons) do
if icon.deselectWhenOtherIconSelected and otherIcon ~= icon and otherIcon.deselectWhenOtherIconSelected and otherIcon:getToggleState() == "selected" then
otherIcon:deselect(icon)
end
end
end)
-- Order by creation if no order specified
iconCreationCount = iconCreationCount + 1
icon:setOrder(iconCreationCount)
-- Apply controller view if enabled
if IconController.controllerModeEnabled then
IconController._enableControllerModeForIcon(icon, true)
end
IconController:_updateSelectionGroup()
IconController.updateTopbar()
end)
IconController.iconRemoved:Connect(function(icon)
topbarIcons[icon] = nil
icon:setEnabled(false)
icon:deselect()
icon.updated:Fire()
IconController:_updateSelectionGroup()
end)
|
-- Get references to the DockShelf and the AppManager frame
|
local gui = script.Parent.Parent.Parent.Parent.AppManager.Settings
local openGui = gui.Main
local TweenService = game:GetService("TweenService")
|
--[[
This module script contains all the main animations. I put it into this script so it'll be easier to edit.
Both arms are welded to a single brick called "animBase". This makes it easier to edit movement animations because you only have to
edit the cframe of one brick instead of 2 arms.
The idling, walking, and running animations have a Pos and a Rot component. The Pos component is the position of the weld and the Rot component
is the rotation of the weld. They're vector3 values so the script can multiply each value by an alpha and add them together to make the smooth
transitions possible
The table directly below lets you know how each component of the Vector affects the movement of the weld so it's easier to edit
This module also contains the reload animation which I moved here for easier editing. The animation function has a parameter S that contains all
the functions and variables that are necessary to make the animation run
HOW TO EDIT THE RELOAD ANIMATION:
-Make sure each block of the animation is made into a separate function, it needs to be like this so if the reload animation needs to be stopped
midway, the arms don't glitch out
-Each animation piece should only have one wait command at the end of the function
-Multiply every duration value, including the wait time values by the animSpeed. That way if you change the reload time, you won't have to change
each individual time value for all the animation components
--]]
|
local Animations = {
Reload = function(S) --This is the main reload animation. The parameter S contains all the variables and functions that are necessary for this animation
--[[
FUNCTION LIST_
S.tweenJoint(Joint, newC0, newC1, Alpha, Duration) --This function tweens a joint to a given C0 and C1. The Alpha parameter is function
that returns a number between 0 and 1 given an argument of a number between 0 and 90. The Duration is how fast the joint tweens. NOTE,
you can put nil as an argument for the newC0 or newC1 parameter and the function won't tween that specific property of the weld. This
is useful if you only want to mess with the C0 or C1 property of a weld.
S.makeMagInvisible() --This function makes the mag invisible so it looks like the mag was removed
S.makeMagVisible() --This function makes the mag visible again at whatever the previous transparency of the mag parts were
S.isMagVisible() --This function returns a true or false value based on whether or not the mag is visible. This can be used to tell if
the animation was stopped midway and where to restart the animation
S.isMagEmpty() --This function returns a true or false value based on whether or not the mag is empty, meaning the ammo is 0. This can be
used to decide if a chambering animation should play after the reload animation
S.setNewMag() --This function sets the newMag variable in the clientMain to true which basically lets the script know that a new mag was
put into the gun. This is used so that if the reload animation is broken after the new mag was put in but before the chambering animation
then the script will simply play the chambering animation instead of putting in another mag
S.isNewMag() --This function returns a true or false value based on whether or not the mag that is currently attached to the gun is a new
mag. In order for it to be a new mag, it needs to have full ammo. Once you fire, the mag becomes an old mag
S.createMag(Key) --This functions clones the Mag and puts it in a table with a Key parameter so you can access the mag in a separate
function and it returns a Model containing the Mag and a table that contains the original mag bricks and the corresponding clone. NOTE,
the mag bricks will be made non can collide
S.getMag(Key) --This function gets a Mag from the mag table given a Key argument and it returns the model that the mag is contained in
and the brick that all the other mag parts are welded to
S.attachGripToHead() --This function detaches the grip from the right arm and attaches it to the Head. This is so you can make reload
animations that require using the right arm to manipulate the gun in any way. The C0 of the grip is changed so the gun stays in the
position that it was in before you detached the grip from the right arm.
S.attachGripToArm() --This function detaches the grip from the Head and attaches it to the Arm. The C0 of the grip is changed so the gun
stays in the position that it was in before you detached the grip from the head
S.Sine(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return the
sine of that number, which is a number between 0 and 1, which is used to tween a Joint with a Sine movement
S.Linear(X) --This function is an Alpha function for the tweenJoint function. Given a number between 0 and 90, the function will return
the number / 90, which is a number between 0 and 1, which is used to a tween a Joint with a Linear movement
VARIABLE LIST_
S.Handle --This variable is the Handle of gun
S.LArm --This variable is the left arm
S.RArm --This variable is the right arm
S.LWeld --This variable is the left arm weld which is attached to the animBase
S.RWeld --This variable is the right arm weld which is attached to the animBase
S.LC0 --This variable is the cframe of the left arm joint with respect to the torso
S.RC0 --This variable is the cframe of the right arm joint with respect to the torso
S.Grip --This variable is the Grip weld which is attached to right arm
S.gunIgnore --This variable is the gun ignore model which contains the fake arms and bullets and other stuff
S.Cam --This variable is the player camera
S.CF --This variable is the shortened form of CFrame.new which you can use instead of CFrame.new
S.CFANG --This variable is the shortened form of CFrame.Angles which you can use instead of CFrame.Angles
S.V3 --This variable is the shortened form of Vector3.new which you can use instead of Vector3.new
S.RAD --This variable is the shortened form of math.rad which you can use instead of math.rad
S.reloadTimeLoaded --This variable is the reload time for when the gun is loaded which you can use to modify how fast the reload
animation runs
S.reloadTimeEmpty --This variable is the reload time for when the gun is empty which you can use to modify how fast the reload
animation runs
--]]
local W1 = nil
local W2 = nil
local animSpeed = S.isMagEmpty() and S.reloadTimeEmpty / 1.3 or S.reloadTimeLoaded / 0.9
return {
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
local Mag1, magTable1 = S.createMag("Mag1")
Mag1.Parent = S.gunIgnore
W1 = Instance.new("Weld")
W1.Part0 = magTable1[1].magClone
W1.Part1 = S.Handle
W1.C0 = magTable1[1].Original.CFrame:toObjectSpace(S.Handle.CFrame)
W1.Parent = magTable1[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(90), 0, S.RAD(-60)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.RWeld, nil, S.CF(0.3, 0.2, -0.51) * S.CFANG(S.RAD(-12), 0, S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.1 * animSpeed)
wait(0.2 * animSpeed)
end
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
if S.isMagVisible() then
S.makeMagInvisible()
W1:Destroy()
local Mag1, magTable1 = S.getMag("Mag1")
magTable1[1].magClone.Velocity = S.Handle.Velocity + S.Handle.CFrame:vectorToWorldSpace(S.V3(0, -1, 0)) * 20
S.tweenJoint(S.Grip, nil, S.CFANG(0, S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
else
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0, 0.5, 0) * S.CFANG(S.RAD(95), 0, S.RAD(-25)), S.Sine, 0.2 * animSpeed)
wait(0.25 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, magTable1 = S.getMag("Mag1")
if Mag1 then Mag1:Destroy() end
local Mag2, magTable2 = S.createMag("Mag2")
Mag2.Parent = S.gunIgnore
local LArmCF = S.LWeld.Part0.CFrame * S.LWeld.C0 * (S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60))):inverse()
local RArmCF = S.RWeld.Part0.CFrame * S.RWeld.C0 * (S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25))):inverse()
local handleOffsetCF = S.RArm.CFrame:toObjectSpace(S.RArm.CFrame * S.Grip.C0 * (S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10))):inverse())
local originalMagOffsetCF = S.Handle.CFrame:toObjectSpace(magTable2[1].Original.CFrame)
local newMagC0 = LArmCF:toObjectSpace(RArmCF * handleOffsetCF * originalMagOffsetCF)
W2 = Instance.new("Weld")
W2.Part0 = S.LArm
W2.Part1 = magTable2[1].magClone
W2.C0 = newMagC0
W2.Parent = magTable2[1].magClone
S.tweenJoint(S.LWeld, nil, S.CF(0.55, 0.6, -2.4) * S.CFANG(S.RAD(-20), S.RAD(20), S.RAD(-60)), S.Sine, 0.2 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-12), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.2 * animSpeed)
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
script.Parent.Handle.MagIn:Play()
wait(0.2 * animSpeed)
end
end;
function()
if (not S.isNewMag()) then
local Mag1, _ = S.getMag("Mag1")
local Mag2, _ = S.getMag("Mag2")
S.makeMagVisible()
S.setNewMag()
if Mag1 then Mag1:Destroy() end
Mag2:Destroy()
end
end;
function()
if S.isMagEmpty() then
if S.isNewMag() then
S.tweenJoint(S.Grip, nil, S.CFANG(S.RAD(-10), S.RAD(20), S.RAD(10)), S.Sine, 0.15 * animSpeed)
S.tweenJoint(S.LWeld, nil, S.CF(0.58, 1.63, -1.4) * S.CFANG(S.RAD(-22), S.RAD(20), S.RAD(-60)), S.Sine, 0.15 * animSpeed)--0.25
S.tweenJoint(S.RWeld, nil, S.CF(0.6, 0.2, -0.61) * S.CFANG(S.RAD(-15), S.RAD(20), S.RAD(25)), S.Sine, 0.2 * animSpeed)
end
S.tweenJoint(S.LWeld, nil, S.CF(0.2, 1.9, -0.45) * S.CFANG(S.RAD(-23), 0.1, S.RAD(-40)), S.Sine, 0.1 * animSpeed)
wait(0.4 * animSpeed)
end
end;
function()
if S.isMagEmpty() then
S.tweenJoint(S.LWeld, nil, S.CF(-0.2, 1.7, -0.45) * S.CFANG(S.RAD(-23), 0.1, S.RAD(-40)), S.Sine, 0.1 * animSpeed)
script.Parent.Handle.Prime:Play()
wait(0.3 * animSpeed)
end
end;
function()
if S.isMagEmpty() then
S.tweenJoint(S.LWeld, nil, S.CF(0.2, 1.9, -0.45) * S.CFANG(S.RAD(-23), 0.1, S.RAD(-40)), S.Sine, 0.1 * animSpeed)
wait(0.3 * animSpeed)
end
end;
}
end;
Cocking = function(S)
end;
Crawling = function(X, moveDirection, moveSpeed) --This is the animation for when you're crawling
--[[
The moveDirection gives you the angle at which your character is moving with respect to the way you're facing. So if you're
moving to the right and you're facing forward then the moveDirection will give you an angle of -90. If you're moving backward
and you're facing forward then the moveDirection will give you an angle of 180. I use this angle to adjust the crawling animation
so that you're arms move in the direction that you're moving so it looks more realistic rather than the arms constantly moving forward
The moveVelocity gives you how fast you're moving in the X-Z plane. It doesn't take your Y-velocity into account so if you're falling your
moveVelocity will still be how fast you're moving horizontally. You can use this to adjust how fast the crawling animation runs so if you're
moving really slow the animation will play slower
--]]
return {
leftArm = CFrame.Angles( --This is what the cframe of the right arm will be when you're crawling
0,
math.rad(90),
math.rad(-10)
) * CFrame.new(
math.sin(moveDirection) * (math.sin(X * 6) / 4) - 0.2,
math.cos(moveDirection) * (math.sin(X * 6) / 2) - 0.1,
math.max(math.cos(X * 6) / 4, 0) - 0.1
) * CFrame.Angles(
-math.max(math.cos(X * 6) / 4, 0),
0,
0
);
leftLeg = CFrame.new( --This is what the cframe of the left leg will be when you're crawling
math.sin(moveDirection) * (-math.sin(X * 6) / 4) - 0.2,
math.cos(moveDirection) * (math.sin(X * 6) / 2) + 0.3,
math.max(math.cos(X * 6) / 4, 0) - 0.1
):inverse() * CFrame.Angles(
0,
0,
-math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
);
rightArm = CFrame.Angles( --This is what the cframe of the left arm will be when you're crawling
0,
math.rad(-5),
math.rad(10)
) * CFrame.new(
math.sin(moveDirection) * (-math.sin(X * 6) / 4) + 0.2,
math.cos(moveDirection) * (-math.sin(X * 6) / 5) - 0.2,
math.max(math.cos((X + math.rad(30)) * 6) / 10, 0) - 0.1
) * CFrame.Angles(
-math.max(math.cos((X + math.rad(30)) * 6) / 10, 0),
0,
0
);
rightLeg = CFrame.new( --This is what the cframe of the right leg will be when you're crawling
math.sin(moveDirection) * (math.sin(X * 6) / 4) + 0.2,
math.cos(moveDirection) * (-math.sin(X * 6) / 2) + 0.3,
math.max(math.cos((X + math.rad(30)) * 6) / 4, 0) - 0.1
):inverse() * CFrame.Angles(
0,
0,
math.rad(15) - math.cos(moveDirection) * (math.rad(15) * math.sin(X * 6))
);
Grip = CFrame.Angles( --This is what the cframe of the grip will be when you're crawling
math.max(math.cos((X + math.rad(30)) * 6) / 7, 0),
math.rad(5),
0
);
Camera = 1.5 * math.rad(math.cos((X + math.rad(30)) * 6)) + math.rad(0.5); --This is what the roll of the camera will be when you're crawling
}
end;
Idling = { --This table holds the Idling animations
unAimed = function(X) --This is the animation when the gun is not aimed
return {
Pos = Vector3.new(
math.sin(X / 2) / 70, --Side to Side motion
math.sin(X * 5 / 4) / 70, --Up and Down motion
math.sin(X * 3 / 4) / 70 --Forward and backward motion
);
Rot = Vector3.new(
0, --Pitch rotation
0, --Yaw rotation
0 --Roll rotation
);
}
end;
Aimed = function(X) --This is the animation when the gun is aimed
return {
Pos = Vector3.new(
math.sin(X * 3 / 8) / 120,
math.sin(X * 15 / 16) / 120,
0
);
Rot = Vector3.new(
0,
0,
0
);
}
end;
};
Walking = { --This table holds the Walking animations
unAimed = function(X) --This is the animation when the gun is not aimed
return {
Pos = Vector3.new(
4 * math.sin(X * 4.5) / 50,
1.5 * math.sin(X * 9) / 50,
0
);
Rot = Vector3.new(
0,
0,
math.rad(math.sin(X * 4.5)) * 2
);
}
end;
Aimed = function(X) --This is the animation when the gun is aimed
return {
Pos = Vector3.new(
2 * math.sin(X * 3) / 150,
0.75 * math.sin(X * 6) / 150,
0
);
Rot = Vector3.new(
0,
0,
math.rad(math.sin(X * 3)) / 3
);
}
end;
};
Running = function(X) --This is the animation when the player is running
return {
Pos = Vector3.new(
4 * math.sin(X * 4.5 * 1.5) / 30,
1.5 * math.sin(X * 9 * 1.5) / 40 + 0.2,
0
);
Rot = Vector3.new(
0,
-math.rad(math.sin(X * 4.5 * 1.5)) * 5 + math.rad(3),
math.rad(math.sin(X * 4.5 * 1.5)) * 5
);
}
end;
}
return Animations
|
-- Casts and recasts until it hits either: nothing, or something not transparent or collidable
|
local function PiercingCast(fromPoint, toPoint, ignoreList) --NOTE: Modifies ignoreList!
repeat
local hitPart, hitPoint = CastRay(fromPoint, toPoint, ignoreList)
if hitPart and (hitPart.Transparency > 0.95 or hitPart.CanCollide == false) then
table.insert(ignoreList, hitPart)
else
return hitPart, hitPoint
end
until false
end
local function ScreenToWorld(screenPoint, screenSize, pushDepth)
local cameraFOV, cameraCFrame = Camera.FieldOfView, Camera.CoordinateFrame
local imagePlaneDepth = screenSize.y / (2 * math.tan(math.rad(cameraFOV) / 2))
local direction = Vector3.new(screenPoint.x - (screenSize.x / 2), (screenSize.y / 2) - screenPoint.y, -imagePlaneDepth)
local worldDirection = (cameraCFrame:vectorToWorldSpace(direction)).Unit
local theta = math.acos(math.min(1, worldDirection:Dot(cameraCFrame.lookVector)))
local fixedPushDepth = pushDepth / math.sin((math.pi / 2) - theta)
return cameraCFrame.p + worldDirection * fixedPushDepth
end
local function OnCameraChanged(property)
if property == 'CameraSubject' then
local newSubject = Camera.CameraSubject
if newSubject and newSubject:IsA('VehicleSeat') then
VehicleParts = newSubject:GetConnectedParts(true)
else
VehicleParts = {}
end
end
end
local function OnCharacterAdded(player, character)
PlayerCharacters[player] = character
end
local function OnPlayersChildAdded(child)
if child:IsA('Player') then
child.CharacterAdded:connect(function(character)
OnCharacterAdded(child, character)
end)
if child.Character then
OnCharacterAdded(child, child.Character)
end
end
end
local function OnPlayersChildRemoved(child)
if child:IsA('Player') then
PlayerCharacters[child] = nil
end
end
local function OnWorkspaceChanged(property)
if property == 'CurrentCamera' then
local newCamera = workspace.CurrentCamera
if newCamera then
Camera = newCamera
if CameraChangeConn then
CameraChangeConn:disconnect()
end
CameraChangeConn = Camera.Changed:connect(OnCameraChanged)
end
end
end
|
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/preRunMessage.ts
| |
--easter egg
|
mouse.KeyDown:connect(function(key)
if key=="u" and script.Blown.Value == false then
Heat = Heat+100
end
end)
if not FE then
radiator.Oil.Enabled = false
radiator.Antifreeze.Enabled = false
radiator.Liquid.Volume = 0
radiator.Fan:Play()
radiator.Fan.Pitch = 1+FanSpeed
radiator.Steam:Play()
radiator.Liquid:Play()
script.Blown.Value = false
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
radiator.Fan.Volume = FanVolume
elseif Heat < FanTempAlpha then
FanCool = 0
radiator.Fan.Volume = 0
end
Load = ((script.Parent.Parent.Values.Throttle.Value*script.Parent.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
radiator.Break:Play()
radiator.Liquid.Volume = .5
radiator.Oil.Enabled = true
radiator.Antifreeze.Enabled = true
script.Parent.Parent.IsOn.Value = false
script.Blown.Value = true
car.Body.ExhaustH.Fire.Fire.Enabled = true
car.Body.ExhaustH.Fire.FireLight.Enabled = true
car.Body.ExhaustH.Fire.Smoke.Enabled = true
elseif Heat >= BlowupTemp-20 then
radiator.Smoke.Transparency = NumberSequence.new((BlowupTemp-Heat)/10,1)
radiator.Smoke.Enabled = true
radiator.Steam.Volume = math.abs(((BlowupTemp-Heat)-10)/10)
else
radiator.Smoke.Enabled = false
radiator.Steam.Volume = 0
car.Body.ExhaustH.Fire.Fire.Enabled = false
car.Body.ExhaustH.Fire.FireLight.Enabled = false
car.Body.ExhaustH.Fire.Smoke.Enabled = false
end
script.Celsius.Value = Heat
script.Parent.Temp.Text = math.floor(Heat).."°c"
script.Parent.Temp.TextColor3 = Color3.fromRGB(255,255-((Heat-FanTemp)*10),255-((Heat-FanTemp)*10))
end
else
handler:FireServer("Initialize",FanSpeed)
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
handler:FireServer("FanVolume",FanVolume)
else
FanCool = 0
handler:FireServer("FanVolume",0)
end
Load = ((script.Parent.Parent.Values.Throttle.Value*script.Parent.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
handler:FireServer("Blown")
script.Parent.Parent.IsOn.Value = false
script.Blown.Value = true
elseif Heat >= BlowupTemp-10 then
handler:FireServer("Smoke",true,BlowupTemp,Heat)
else
handler:FireServer("Smoke",false,BlowupTemp,Heat)
end
script.Celsius.Value = Heat
script.Parent.Temp.Text = math.floor(Heat).."°c"
end
end
|
--- Add a task to clean up
-- @usage
-- Maid[key] = (function) Adds a task to perform
-- Maid[key] = (event connection) Manages an event connection
-- Maid[key] = (Maid) Maids can act as an event connection, allowing a Maid to have other maids to clean up.
-- Maid[key] = (Object) Maids can cleanup objects with a `Destroy` method
-- Maid[key] = nil Removes a named task. If the task is an event, it is disconnected. If it is an object,
-- it is destroyed.
|
function Maid:__newindex(index, newTask)
if Maid[index] ~= nil then
error(("'%s' is reserved"):format(tostring(index)), 2)
end
local tasks = self._tasks
local oldTask = tasks[index]
tasks[index] = newTask
if oldTask then
if type(oldTask) == "function" then
oldTask()
elseif typeof(oldTask) == "RBXScriptConnection" then
oldTask:Disconnect()
elseif oldTask.Destroy then
oldTask:Destroy()
end
end
end
|
-- [[[[[[[[[[[[[[[[[ MAIN GAME LOOP ]]]]]]]]]]]]]]]]] --
|
while wait() do
-- 1. Check for at least two players
repeat
local availablePlayers = {} -- creating an empty table to fill
for i, v in pairs(game.Players:GetPlayers()) do
if not v:FindFirstChild("InMenu") then
table.insert(availablePlayers,v)
end
end
Status.Value = "Need at least two players"..#availablePlayers.."/2"
-- need to wait or else it will crash the game
wait (2)
until #availablePlayers >= 2
RoundModule.Intermission(5)
print ("Intermission end .. Setup beginning")
-- [[[[[[[[[[[[[[[[[ GAME START ]]]]]]]]]]]]]]]]] --
-- 2a. Choose a Map and import to the workspace
local chosenChapter = RoundModule.SelectChapter() -- returns a map object of the chosen chapter
local clonedChapter = chosenChapter:Clone() -- making a copy to not mess up the Chapters folder instance
clonedChapter.Name = "Map" -- used in other scripts
clonedChapter.Parent = game.Workspace -- put in view of the player so they can teleport to it
print ("Map Chosen")
-- 2b. Setup the doors
-- wait a bit to load the doors
wait (2)
local DoorModule = require(script.DoorModule)
if clonedChapter:FindFirstChild("Doors") then
DoorModule.ActivateDoors(clonedChapter.Doors) -- sending in a folder
else
warn("Fatal Error, please have Doors folder in the Chapter Map Model -- Also the Door parts in the Doors folder")
end
print ("Doors Setup")
-- 3. Choose Piggy from players NOT in the menu
-- a player is in the menu if they did not click on 'Play' yet
-- a player is in the menu if the player has a tag attached. the tag gets deleted/destroyed once the player clicks play
local contestants = {} -- creating an empty table to fill
for i, v in pairs(game.Players:GetPlayers()) do
if not v:FindFirstChild("InMenu") then
table.insert(contestants,v)
end
end
local chosenPiggy = RoundModule.ChoosePiggy(contestants)
-- remove chosen piggy from list of contestants
for i, v in pairs(contestants) do
if v == chosenPiggy then
table.remove(contestants,i)
else
-- loop through all non-piggy players
game.ReplicatedStorage.ToggleCrouch:FireClient(v, true)
end
end
-- Dress up chosen contestant as Piggy!
RoundModule.DressPiggy(chosenPiggy)
-- avoids "torso" issue when the player is falling and the map loads afterwards
print ("Piggy Chosen")
-- 4. Teleport Piggy and players to their spawn spots
RoundModule.TeleportPiggy(chosenPiggy)
RoundModule.TeleportPlayers(contestants, clonedChapter.PlayerSpawns:GetChildren())
print ("Players teleported to map")
-- 5. Tag players as "contestant" and as "piggy"
RoundModule.InsertTag(contestants, "Contestant")
RoundModule.InsertTag({chosenPiggy}, "Piggy")
print ("Game Start")
-- 6. Start the game!
RoundModule.StartRound(1200, chosenPiggy, clonedChapter)
-- [[[[[[[[[[[[[[[[[ GAME END ]]]]]]]]]]]]]]]]] --
-- 7. Game ended, time to clean up!
contestants = {}
for i, v in pairs(game.Players:GetPlayers()) do
-- if an existing player is not in the menu, add them to the table
if not v:FindFirstChild("InMenu") then
table.insert(contestants,v)
end
end
-- ERROR CHECK: check if the spawns folder is in the gamespace
if game.Workspace.Lobby:FindFirstChild("Spawns") then
RoundModule.TeleportPlayers(contestants, game.Workspace.Lobby.Spawns:GetChildren())
end
-- destroy the map
clonedChapter:Destroy()
-- clean up piggy and players (remove tags and tools)
RoundModule.RemoveTags()
end
|
--[[*
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
]]
|
local function is(x: any, y: any): boolean
return x == y and (x ~= 0 or 1 / x == 1 / y) or x ~= x and y ~= y -- eslint-disable-line no-self-compare
end
|
--[[
Used to set a handler for when the promise resolves, rejects, or is
cancelled. Returns a new promise chained from this promise.
]]
|
function Promise.prototype:finally(finallyHandler)
self._unhandledRejection = false
-- Return a promise chained off of this promise
return Promise.new(function(resolve, reject)
local finallyCallback = resolve
if finallyHandler then
finallyCallback = createAdvancer(finallyHandler, resolve, reject)
end
if self._status == Promise.Status.Started then
-- The promise is not settled, so queue this.
table.insert(self._queuedFinally, finallyCallback)
else
-- The promise already settled or was cancelled, run the callback now.
finallyCallback(self._status)
end
end, self)
end
|
--
|
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
local Drive=car.Wheels:GetChildren()
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
for _,v in pairs(Drive) do
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.FToe))
end
elseif v.Name=="RL" or v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.RToe))
end
end
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.FCaster),0)
elseif v.Name=="FR" or v.Name=="F" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.FCaster),0)
elseif v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.RCaster),0)
elseif v.Name=="RR" or v.Name=="R" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.RCaster),0)
end
local arm=Instance.new("Part",v)
arm.Name="Arm"
arm.Anchored=true
arm.CanCollide=false
arm.FormFactor=Enum.FormFactor.Custom
arm.Size=Vector3.new(1,1,1)
arm.CFrame=(v.CFrame*CFrame.new(0,_Tune.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
local base=arm:Clone()
base.Parent=v
base.Name="Base"
base.CFrame=base.CFrame*CFrame.new(0,1,0)
base.BottomSurface=Enum.SurfaceType.Hinge
local axle=arm:Clone()
axle.Parent=v
axle.Name="Axle"
axle.CFrame=CFrame.new(v.Position-((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle.BackSurface=Enum.SurfaceType.Hinge
if v.Name=="F" or v.Name=="R" then
local axle2=arm:Clone()
axle2.Parent=v
axle2.Name="Axle"
axle2.CFrame=CFrame.new(v.Position+((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle2.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle2.BackSurface=Enum.SurfaceType.Hinge
MakeWeld(arm,axle2)
end
MakeWeld(car.DriveSeat,base)
if v.Parent.Name == "RL" or v.Parent.Name == "RR" or v.Name=="R" then
MakeWeld(car.DriveSeat,arm)
end
MakeWeld(arm,axle)
arm:MakeJoints()
axle:MakeJoints()
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,axle)
end
if v:FindFirstChild("Parts")~=nil then
ModelWeld(v.Parts,v)
end
if v:FindFirstChild("Steer") then
v:FindFirstChild("Steer"):Destroy()
end
local gyro=Instance.new("BodyGyro",v)
gyro.Name="Stabilizer"
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
gyro.D=_Tune.FGyroD
gyro.MaxTorque=_Tune.FGyroMaxTorque
gyro.P=_Tune.FGyroP
else
gyro.D=_Tune.RGyroD
gyro.MaxTorque=_Tune.RGyroMaxTorque
gyro.P=_Tune.RGyroP
end
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
steer.cframe=base.CFrame
else
MakeWeld(base,axle,"Weld")
end
local AV=Instance.new("BodyAngularVelocity",v)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(_Tune.PBrakeForce,0,_Tune.PBrakeForce)
AV.P=1e9
end
for i,v in pairs(script:GetChildren()) do
if v:IsA("ModuleScript") then
require(v)
end
end
wait()
ModelWeld(car.Body,car.DriveSeat)
local flipG = Instance.new("BodyGyro",car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
wait()
UnAnchor(car)
script.Parent["A-Chassis Interface"].Car.Value=car
for i,v in pairs(script.Parent.Plugins:GetChildren()) do
for _,a in pairs(v:GetChildren()) do
if a:IsA("RemoteEvent") or a:IsA("RemoteFunction") then
a.Parent=car
for _,b in pairs(a:GetChildren()) do
if b:IsA("Script") then b.Disabled=false end
end
end
end
v.Parent = script.Parent["A-Chassis Interface"]
end
script.Parent.Plugins:Destroy()
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(car.DriveSeat:GetChildren()) do
if v:IsA("Sound") then v:Stop() end
end
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
end
end
end
end)
ver = require(script.Parent.README)
|
--[This script makes the movement that a conveyor would do.]
|
if script.Disabled == false then
local conveyor = script.Parent
conveyor.Velocity = conveyor.CFrame:vectorToWorldSpace(Vector3.new(0, 0, -conveyor.Configuration.Speed.Value))
end
|
-- Mimic roblox menu when opened and closed
|
guiService.MenuClosed:Connect(function()
menuOpen = false
if not IconController.controllerModeEnabled then
IconController.setTopbarEnabled(IconController.topbarEnabled,false)
end
end)
guiService.MenuOpened:Connect(function()
menuOpen = true
IconController.setTopbarEnabled(false,false)
end)
bindCamera()
return IconController
|
--[[
PhysicsSolver:CreateSolver(CharacterClass)
Creates a new physics solver from CharacterClass
RETURNS: PhysicsSolverClass
CLASS PhysicsSolverClass
PhysicsSolverClass:SetNewContext(Pos)
Sets the next position to override ray casting. Used for teleporting
PhysicsSolverClass:SetEnabled(Enabled)
Sets whether the solver is enabled or disabled
PhysicsSolverClass:Disconnect()
Disconnects all events
--]]
|
local PhysicsSolver = {}
local Configuration = require(script.Parent.Parent:WaitForChild("Configuration"))
local GRAVITY = Configuration.PhysicsSolver.GRAVITY
local USE_FALLING_SIMULATION = Configuration.PhysicsSolver.USE_FALLING_SIMULATION
local DESTROY_HEIGHT = game:GetService("Workspace").FallenPartsDestroyHeight
local RunService = game:GetService("RunService")
local Util = require(script.Parent:WaitForChild("Util"))
local V3new = Vector3.new
function PhysicsSolver:CreateSolver(CharacterClass)
local Enabled = true
local PhysicsSolverClass = {}
local Head = CharacterClass.CharacterModel:WaitForChild("Head")
local LeftFoot,RightFoot
local function UpdateFeet()
LeftFoot = CharacterClass.CharacterModel:FindFirstChild("LeftFoot")
RightFoot = CharacterClass.CharacterModel:FindFirstChild("RightFoot")
end
UpdateFeet()
local OverridePos
local LastY,LastTargetY = 0,0
function PhysicsSolverClass:SetNewContext(NewOverridePos)
OverridePos = NewOverridePos + V3new(0,4,0)
LastY = OverridePos.Y
end
function PhysicsSolverClass:SetEnabled(NewEnabled)
Enabled = NewEnabled
end
local DownDirection500 = V3new(0,-500,0)
if GRAVITY > 0 then
DownDirection500 = V3new(0,500,0)
end
local FootOffset = Vector3.new(0,2,0)
local SolverEvent
if USE_FALLING_SIMULATION then
local Velocity = 0
SolverEvent = RunService.RenderStepped:Connect(function(DeltaTime)
if Enabled then
local EndPart,BottomPos
if OverridePos then
EndPart,BottomPos = Util:FindCollidablePartOnRay(OverridePos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
elseif LeftFoot and RightFoot then
local LeftFootPos = LeftFoot.Position + FootOffset
local RightFootPos = RightFoot.Position + FootOffset
local LeftEndPart,LeftBottomPos = Util:FindCollidablePartOnRay(LeftFootPos,DownDirection500,CharacterClass.CharacterModel)
local RightEndPart,RightBottomPos = Util:FindCollidablePartOnRay(RightFootPos,DownDirection500,CharacterClass.CharacterModel)
if LeftBottomPos.Y > RightBottomPos.Y then
EndPart,BottomPos = LeftEndPart,LeftBottomPos
else
EndPart,BottomPos = RightEndPart,RightBottomPos
end
elseif LeftFoot then
local LeftFootPos = LeftFoot.Position + FootOffset
EndPart,BottomPos = Util:FindCollidablePartOnRay(LeftFootPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
elseif RightFoot then
local RightFootPos = RightFoot.Position + FootOffset
EndPart,BottomPos = Util:FindCollidablePartOnRay(RightFootPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
else
local HeadPos = Head.Position
EndPart,BottomPos = Util:FindCollidablePartOnRay(HeadPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
end
local EndY = BottomPos.Y
Velocity = Velocity + (GRAVITY * DeltaTime)
local DestinationY = LastY + Velocity
if DestinationY > EndY then
LastY = DestinationY
else
Velocity = 0
LastY = EndY
end
CharacterClass:SetWorldYOffset(LastY)
if OverridePos then
OverridePos = nil
end
if LastY < DESTROY_HEIGHT then
Enabled = false
CharacterClass.Humanoid.Health = 0
end
end
end)
else
SolverEvent = RunService.RenderStepped:Connect(function()
if Enabled then
local EndPart,BottomPos
if OverridePos then
EndPart,BottomPos = Util:FindCollidablePartOnRay(OverridePos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
elseif LeftFoot and RightFoot then
local LeftFootPos = LeftFoot.Position + FootOffset
local RightFootPos = RightFoot.Position + FootOffset
local LeftEndPart,LeftBottomPos = Util:FindCollidablePartOnRay(LeftFootPos,DownDirection500,CharacterClass.CharacterModel)
local RightEndPart,RightBottomPos = Util:FindCollidablePartOnRay(RightFootPos,DownDirection500,CharacterClass.CharacterModel)
if LeftBottomPos.Y > RightBottomPos.Y then
EndPart,BottomPos = LeftEndPart,LeftBottomPos
else
EndPart,BottomPos = RightEndPart,RightBottomPos
end
elseif LeftFoot then
local LeftFootPos = LeftFoot.Position + FootOffset
EndPart,BottomPos = Util:FindCollidablePartOnRay(LeftFootPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
elseif RightFoot then
local RightFootPos = RightFoot.Position + FootOffset
EndPart,BottomPos = Util:FindCollidablePartOnRay(RightFootPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
else
local HeadPos = Head.Position
EndPart,BottomPos = Util:FindCollidablePartOnRay(HeadPos,DownDirection500,CharacterClass.CharacterModel)
UpdateFeet()
end
if EndPart then
LastY = BottomPos.Y
end
CharacterClass:SetWorldYOffset(LastY)
if OverridePos then
OverridePos = nil
end
if LastY < DESTROY_HEIGHT then
Enabled = false
CharacterClass.Humanoid.Health = 0
end
end
end)
end
function PhysicsSolverClass:Disconnect()
SolverEvent:Disconnect()
end
return PhysicsSolverClass
end
return PhysicsSolver
|
----------------------This is just an example-----------------------------
|
end
function onKeyPressG()
print("G is pressed")
PageLayout:JumpTo(script.Parent.Grenade)
|
--if another player picks up the pizza during the tutorial, give it to the persion in the tutorial
|
local Handle = script.Parent.Handle
script.Parent.Equipped:connect(function()
local player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
if player and Handle:FindFirstChild("Tutorial") and Handle.Tutorial.Value and Handle.Tutorial.Value ~= player then
wait()
script.Parent.Parent = Handle.Tutorial.Value.Character
end
end)
|
--This script only activates when the ClickDetector's activation distance is over 0
|
function onClicked(p)
script.Parent.Parent.Open.Transparency = 0 --Open the trap
script.Parent.Parent.Close.Transparency = 1
script.Parent.Captured.Value = false
script.Parent.ClickDetector.MaxActivationDistance = 0 --Make it so that you can't click it
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- уничтожаем огонь и скрипт
|
script.Parent.Fire:Destroy()
script:Destroy()
|
--Weld stuff here
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.4,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
--[=[
@within Gamepad
@prop GamepadChanged Signal<gamepad: Enum.UserInputType>
@readonly
Fires when the active gamepad switches. Internally, the gamepad
object will always wrap around the active gamepad, so nothing
needs to be changed.
```lua
gamepad.GamepadChanged:Connect(function(newGamepad: Enum.UserInputType)
print("Active gamepad changed to:", newGamepad)
end)
```
]=]
| |
-------------------
---[[Variables]]---
-------------------
|
local module = {}
local TweenService = game:GetService("TweenService")
|
--//Remote Functions\\--
|
fire.OnServerEvent:Connect(function(player, mouseHit)
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
local weaponAccuracy = Vector3.new(math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2), math.random(-accuracy.Value * 2, accuracy.Value * 2))
if humanoid and humanoid ~= 0 then
local projectile = Instance.new("Part", workspace)
local trail = Instance.new("Trail", projectile)
trail.FaceCamera = true
trail.Lifetime = 0.3
trail.MinLength = 0.15
trail.LightEmission = 0.25
local attachment0 = Instance.new("Attachment", projectile)
attachment0.Position = Vector3.new(0.35, 0, 0)
attachment0.Name = "Attachment1"
local attachment1 = Instance.new("Attachment", projectile)
attachment1.Position = Vector3.new(-0.35, 0, 0)
attachment1.Name = "Attachment1"
trail.Attachment0 = attachment0
trail.Attachment1 = attachment1
projectile.Name = "Bullet"
projectile.BrickColor = BrickColor.new("Smoky gray")
projectile.Shape = "Ball"
projectile.Material = Enum.Material.Metal
projectile.TopSurface = 0
projectile.BottomSurface = 0
projectile.Size = Vector3.new(1, 1, 1)
projectile.Transparency = 1
projectile.CFrame = CFrame.new(muzzle.CFrame.p, mouseHit.p)
projectile.CanCollide = false
local transparencyPoints = {}
local startColor = Color3.new(255, 255, 0)
local endColor = Color3.new(213, 115, 61)
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0, 1))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(0.25, 0))
table.insert(transparencyPoints, NumberSequenceKeypoint.new(1, 1))
local determinedTransparency = NumberSequence.new(transparencyPoints)
local determinedColors = ColorSequence.new(startColor, endColor)
trail.Transparency = determinedTransparency
trail.Color = determinedColors
local bodyVelocity = Instance.new("BodyVelocity", projectile)
bodyVelocity.MaxForce = Vector3.new(9e9, 9e9, 9e9)
bodyVelocity.Velocity = (mouseHit.lookVector * velocity.Value) + weaponAccuracy
debris:AddItem(projectile, 20)
projectile.Touched:Connect(function(hit)
local eHumanoid = hit.Parent:FindFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
local damage = math.random(minDamage.Value, maxDamage.Value)
if not eHumanoid and not hit.Anchored and not hit:IsDescendantOf(character) then
projectile:Destroy()
elseif eHumanoid and eHumanoid ~= humanoid and eHumanoid.Health > 0 and hit ~= projectile then
if hit.Name == "Head" or hit:IsA("Hat") then
damage = damage * 10.5
end
local criticalPoint = maxDamage.Value
DamageAndTagHumanoid(player, eHumanoid, damage)
if showDamageText then
DynamicText(damage, criticalPoint, eHumanoid)
else
end
projectile:Destroy()
elseif hit.CanCollide == true and not hit:IsDescendantOf(player.Character) and hit.Anchored == true then
projectile:Destroy()
end
end)
handle.Fire:Play()
muzzleEffect.Visible = true
muzzleEffect.Rotation = math.random(-360, 360)
delay(0.1, function()
muzzleEffect.Visible = false
end)
end
end)
activateSpecial.OnServerEvent:Connect(function(player)
accuracy.Value, fireRate.Value = accuracy.Value / 2, fireRate.Value / 2
minDamage.Value, maxDamage.Value = minDamage.Value / 2, maxDamage.Value / 2
spawn(function()
local chargeSound = Instance.new("Sound", player.PlayerGui)
chargeSound.Name = "ChargeSound"
chargeSound.SoundId = "rbxassetid://163619849"
chargeSound:Play()
chargeSound.Ended:Connect(function() chargeSound:Destroy() end)
local sparkles = Instance.new("Sparkles", handle)
sparkles.SparkleColor = Color3.fromRGB(255, 236, 21)
local activatedGui = Instance.new("ScreenGui", player.PlayerGui)
activatedGui.Name = "SpecialActivated"
local textLabel = Instance.new("TextLabel", activatedGui)
textLabel.TextColor3 = Color3.fromRGB(0, 180, 30)
textLabel.Text = "Trigger Happy activated!"
textLabel.Font = Enum.Font.SourceSans
textLabel.TextScaled = true
textLabel.TextStrokeTransparency = 0
textLabel.Size = UDim2.new(0, 300, 0, 50)
textLabel.Position = UDim2.new(2.5, 0, 0.15, -10)
textLabel.BackgroundTransparency = 1
textLabel:TweenPosition(UDim2.new(0.5, -(textLabel.Size.X.Offset / 2), 0.1, -10), Enum.EasingDirection.Out, Enum.EasingStyle.Back, 1)
debris:AddItem(sparkles, specialDuration.Value)
debris:AddItem(chargeSound, 3)
wait(3)
TextEffects(textLabel, 200, Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 1)
end)
for i = specialDuration.Value, 0, -1 do
wait(1)
print("Special activated: "..i)
end
accuracy.Value, fireRate.Value = accuracy.Value * 5, fireRate.Value * 10
minDamage.Value, maxDamage.Value = minDamage.Value * 4, maxDamage.Value * 8
activateSpecial:FireClient(player)
end)
|
--Made by Stickmasterluke
|
local sp=script.Parent
damage=40
cooldown=.30
debris=game:GetService("Debris")
check=true
function waitfor(parent,name)
while true do
local child=parent:FindFirstChild(name)
if child~=nil then
return child
end
wait()
end
end
local handle=waitfor(sp,"Handle")
local debris=game:GetService("Debris")
function randomcolor()
if handle then
local m=handle:FindFirstChild("Mesh")
if m~=nil then
m.VertexColor=Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))*.5
end
end
end
function onButton1Down(mouse)
if check then
check=false
mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
local h=sp.Parent:FindFirstChild("Humanoid")
local t=sp.Parent:FindFirstChild("Torso")
local anim=sp:FindFirstChild("RightSlash")
if anim and t and h then
theanim=h:LoadAnimation(anim)
theanim:Play(nil,nil,1.5)
if theanim and h.Health>0 then
local sound=sp.Handle:FindFirstChild("SlashSound")
if sound then
sound:Play()
end
wait(.25)
handle.Transparency=1
local p=handle:clone()
p.Name="Effect"
p.CanCollide=false
p.Transparency=1
p.Script.Disabled=false
local tag=Instance.new("ObjectValue")
tag.Name="creator"
tag.Value=h
tag.Parent=p
p.RotVelocity=Vector3.new(0,0,0)
p.Velocity=(mouse.Hit.p-p.Position).unit*300+Vector3.new(0,60,0)
p.CFrame=CFrame.new(handle.Position,mouse.Hit.p)*CFrame.Angles(-math.pi/2,0,0)
debris:AddItem(p,20+math.random()*5)
p.Parent=game.Workspace
end
end
wait(cooldown-.25)
mouse.Icon="rbxasset://textures\\GunCursor.png"
randomcolor()
handle.Transparency=1
check=true
end
end
sp.Equipped:connect(function(mouse)
if mouse==nil then
print("Mouse not found")
return
end
equipped=true
mouse.Icon="rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
onButton1Down(mouse)
end)
end)
sp.Unequipped:connect(function()
equipped=false
handle.Transparency=1
randomcolor()
end)
|
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
|
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateFlash()
if FlashHolder then
local flash = Instance.new('Fire', FlashHolder)
flash.Color = Color3.new(0, 145 / 255, 255)
flash.SecondaryColor = Color3.new(1, 0, 0)
flash.Size = 0.3
DebrisService:AddItem(flash, FireRate / 1.5)
else
FlashHolder = Instance.new("Part", Tool)
FlashHolder.Transparency = 1
FlashHolder.CanCollide= false
FlashHolder.Size = Vector3.new(1, 1, 1)
FlashHolder.Position = Tool.Handle.Position
local Weld = Instance.new("ManualWeld")
Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Weld.Part0 = FlashHolder
Weld.Part1 = Tool.Handle
Weld.Parent = FlashHolder
end
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = MyPlayer.TeamColor
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
local fire = Instance.new("Fire", bullet)
fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.Size = 5
fire.Heat = 0
DebrisService:AddItem(fire, 0.2)
return bullet
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
wait(ReloadTime)
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
end
Reloading = false
end
end
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
RecoilTrack:Play()
end
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading do
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
TagHumanoid(hitHumanoid, MyPlayer)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
IsShooting = false
if AmmoInClip == 0 then
Reload()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
end
function OnEquipped(mouse)
RecoilAnim = WaitForChild(Tool, 'Recoil')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
|
--This script turns the light on at night and off in in the day!
|
b = script.Parent
local oh,om = 6,20 -- Open Time (hours,minutes)
local ch,cm = 17,45 -- Close Time (hours, minutes)
local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end
function TimeChanged()
local ot = (oh + (om/60)) * 60
local ct = (ch + (cm/60)) * 60
if (ot < ct) then
if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
b.Enabled = false
else
b.Enabled = true
end
elseif (ot > ct) then
if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
b.Enabled = false
else
b.Enabled = true
end
end
end
TimeChanged()
game.Lighting.Changed:connect(function(property)
if (property == "TimeOfDay") then
TimeChanged()
end
end)
|
--Rescripted by Luckymaxer
--Updated for R15 avatars by StarWars
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Mesh = Handle:WaitForChild("Mesh")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
BaseUrl = "http://www.roblox.com/asset/?id="
Meshes = {
GrappleWithHook = 33393806,
Grapple = 30308256,
Hook = 30307623,
}
Animations = {
Crouch = {Animation = Tool:WaitForChild("Crouch"), FadeTime = 0.25, Weight = nil, Speed = nil},
R15Crouch = {Animation = Tool:WaitForChild("R15Crouch"), FadeTime = 0.25, Weight = nil, Speed = nil}
}
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Connect = Handle:WaitForChild("Connect"),
Hit = Handle:WaitForChild("Hit"),
}
for i, v in pairs(Meshes) do
Meshes[i] = (BaseUrl .. v)
end
local BaseRopeConstraint = Instance.new("RopeConstraint")
BaseRopeConstraint.Thickness = 0.2
BaseRopeConstraint.Restitution = 1
BaseRopeConstraint.Color = BrickColor.new("Really black")
BasePart = Create("Part"){
Material = Enum.Material.Plastic,
Shape = Enum.PartType.Block,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
Size = Vector3.new(0.2, 0.2, 0.2),
CanCollide = true,
Locked = true,
}
BaseRope = BasePart:Clone()
BaseRope.Name = "Effect"
BaseRope.BrickColor = BrickColor.new("Bright red")
BaseRope.Anchored = true
BaseRope.CanCollide = false
Create("CylinderMesh"){
Scale = Vector3.new(1, 1, 1),
Parent = BaseRope,
}
BaseGrappleHook = BasePart:Clone()
BaseGrappleHook.Name = "Projectile"
BaseGrappleHook.Transparency = 0
BaseGrappleHook.Size = Vector3.new(1, 0.4, 1)
BaseGrappleHook.Anchored = false
BaseGrappleHook.CanCollide = true
Create("SpecialMesh"){
MeshType = Enum.MeshType.FileMesh,
MeshId = (BaseUrl .. "30307623"),
TextureId = (BaseUrl .. "30307531"),
Scale = Mesh.Scale,
VertexColor = Vector3.new(1, 1, 1),
Offset = Vector3.new(0, 0, 0),
Parent = BaseGrappleHook,
}
local RopeAttachment = Instance.new("Attachment")
RopeAttachment.Name = "RopeAttachment"
RopeAttachment.Parent = BaseGrappleHook
Create("BodyGyro"){
Parent = BaseGrappleHook,
}
for i, v in pairs({Sounds.Connect, Sounds.Hit}) do
local Sound = v:Clone()
Sound.Parent = BaseGrappleHook
end
Rate = (1 / 60)
MaxDistance = 200
CanFireWhileGrappling = true
Crouching = false
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Tool,
})
ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Tool,
})
for i, v in pairs(Tool:GetChildren()) do
if v:IsA("BasePart") and v ~= Handle then
v:Destroy()
end
end
Mesh.MeshId = Meshes.GrappleWithHook
Handle.Transparency = 0
Tool.Enabled = true
function CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.find(string.lower(String), string.lower(v)) then
return true
end
end
return false
end
function CheckIntangible(Hit)
local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet", "GrappleHook"}
if Hit and Hit.Parent then
if ((not Hit.CanCollide or CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
return true
end
end
return false
end
function CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
function AdjustRope()
if not Rope or not Rope.Parent or not CheckIfGrappleHookAlive() then
return
end
local StartPosition = Handle.RopeAttachment.WorldPosition
local EndPosition = GrappleHook.RopeAttachment.WorldPosition
local RopeLength = (StartPosition - EndPosition).Magnitude
Rope.Size = Vector3.new(1, 1, 1)
Rope.Mesh.Scale = Vector3.new(0.1, RopeLength, 0.1)
Rope.CFrame = (CFrame.new(((StartPosition + EndPosition) / 2), EndPosition) * CFrame.Angles(-(math.pi / 2), 0, 0))
end
function DisconnectGrappleHook(KeepBodyObjects)
for i, v in pairs({Rope, GrappleHook, GrappleHookChanged}) do
if v then
if tostring(v) == "Connection" then
v:disconnect()
elseif type(v) == "userdata" and v.Parent then
v:Destroy()
end
end
end
if CheckIfAlive() and not KeepBodyObjects then
for i, v in pairs(Torso:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
end
Connected = false
Mesh.MeshId = Meshes.GrappleWithHook
end
function TryToConnect()
if not ToolEquipped or not CheckIfAlive() or not CheckIfGrappleHookAlive() or Connected then
DisconnectGrappleHook()
return
end
local DistanceApart = (Torso.Position - GrappleHook.Position).Magnitude
if DistanceApart > MaxDistance then
DisconnectGrappleHook()
return
end
local Directions = {Vector3.new(0, 1, 0), Vector3.new(0, -1, 0), Vector3.new(1, 0, 0), Vector3.new(-1, 0, 0), Vector3.new(0, 0, 1), Vector3.new(0, 0, -1)}
local ClosestRay = {DistanceApart = math.huge}
for i, v in pairs(Directions) do
local Direction = CFrame.new(GrappleHook.Position, (GrappleHook.CFrame + v * 2).p).lookVector
local RayHit, RayPos, RayNormal = CastRay((GrappleHook.Position + Vector3.new(0, 0, 0)), Direction, 2, {Character, GrappleHook, Rope}, false)
if RayHit then
local DistanceApart = (GrappleHook.Position - RayPos).Magnitude
if DistanceApart < ClosestRay.DistanceApart then
ClosestRay = {Hit = RayHit, Pos = RayPos, Normal = RayNormal, DistanceApart = DistanceApart}
end
end
end
if ClosestRay.Hit then
Connected = true
local GrappleCFrame = CFrame.new(ClosestRay.Pos, (CFrame.new(ClosestRay.Pos) + ClosestRay.Normal * 2).p) * CFrame.Angles((math.pi / 2), 0, 0)
GrappleCFrame = (GrappleCFrame * CFrame.new(0, -(GrappleHook.Size.Y / 1.5), 0))
GrappleCFrame = (CFrame.new(GrappleCFrame.p, Handle.Position) * CFrame.Angles(0, math.pi, 0))
local Weld = Create("Motor6D"){
Part0 = GrappleHook,
Part1 = ClosestRay.Hit,
C0 = GrappleCFrame:inverse(),
C1 = ClosestRay.Hit.CFrame:inverse(),
Parent = GrappleHook,
}
for i, v in pairs(GrappleHook:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
local HitSound = GrappleHook:FindFirstChild("Hit")
if HitSound then
HitSound:Play()
end
local BackUpGrappleHook = GrappleHook
wait(0.4)
if not CheckIfGrappleHookAlive() or GrappleHook ~= BackUpGrappleHook then
return
end
Sounds.Connect:Play()
local ConnectSound = GrappleHook:FindFirstChild("Connect")
if ConnectSound then
ConnectSound:Play()
end
for i, v in pairs(Torso:GetChildren()) do
if string.find(string.lower(v.ClassName), string.lower("Body")) then
v:Destroy()
end
end
local TargetPosition = GrappleHook.Position
local BackUpPosition = TargetPosition
local BodyPos = Create("BodyPosition"){
D = 1000,
P = 3000,
maxForce = Vector3.new(1000000, 1000000, 1000000),
position = TargetPosition,
Parent = Torso,
}
local BodyGyro = Create("BodyGyro"){
maxTorque = Vector3.new(100000, 100000, 100000),
cframe = CFrame.new(Torso.Position, Vector3.new(GrappleCFrame.p.X, Torso.Position.Y, GrappleCFrame.p.Z)),
Parent = Torso,
}
Spawn(function()
while TargetPosition == BackUpPosition and CheckIfGrappleHookAlive() and Connected and ToolEquipped and CheckIfAlive() do
BodyPos.position = GrappleHook.Position
wait()
end
end)
end
end
function CheckIfGrappleHookAlive()
return (((GrappleHook and GrappleHook.Parent --[[and Rope and Rope.Parent]]) and true) or false)
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
local MousePosition = InvokeClient("MousePosition")
if not MousePosition then
return
end
MousePosition = MousePosition.Position
if CheckIfGrappleHookAlive() then
if not CanFireWhileGrappling then
return
end
if GrappleHookChanged then
GrappleHookChanged:disconnect()
end
DisconnectGrappleHook(true)
end
if GrappleHookChanged then
GrappleHookChanged:disconnect()
end
Tool.Enabled = false
Sounds.Fire:Play()
Mesh.MeshId = Meshes.Grapple
GrappleHook = BaseGrappleHook:Clone()
GrappleHook.CFrame = (CFrame.new((Handle.Position + (MousePosition - Handle.Position).Unit * 5), MousePosition) * CFrame.Angles(0, 0, 0))
local Weight = 70
GrappleHook.Velocity = (GrappleHook.CFrame.lookVector * Weight)
local Force = Create("BodyForce"){
force = Vector3.new(0, workspace.Gravity * 0.98 * GrappleHook:GetMass(), 0),
Parent = GrappleHook,
}
GrappleHook.Parent = Tool
GrappleHookChanged = GrappleHook.Changed:connect(function(Property)
if Property == "Parent" then
DisconnectGrappleHook()
end
end)
Rope = BaseRope:Clone()
Rope.Parent = Tool
Spawn(function()
while CheckIfGrappleHookAlive() and ToolEquipped and CheckIfAlive() do
AdjustRope()
Spawn(function()
if not Connected then
TryToConnect()
end
end)
wait()
end
end)
wait(2)
Tool.Enabled = true
end
function Equipped(Mouse)
Character = Tool.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
Player = Players:GetPlayerFromCharacter(Character)
if not CheckIfAlive() then
return
end
Spawn(function()
DisconnectGrappleHook()
if HumanoidJumping then
HumanoidJumping:disconnect()
end
HumanoidJumping = Humanoid.Jumping:connect(function()
DisconnectGrappleHook()
end)
end)
Crouching = false
ToolEquipped = true
end
function Unequipped()
if HumanoidJumping then
HumanoidJumping:disconnect()
end
DisconnectGrappleHook()
Crouching = false
ToolEquipped = false
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
if mode == "KeyPress" then
local Key = value.Key
local Down = value.Down
if Key == "q" and Down then
DisconnectGrappleHook()
elseif Key == "c" and Down then
Crouching = not Crouching
Spawn(function()
local Animation = Animations.Crouch
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Animation = Animations.R15Crouch
end
InvokeClient(((Crouching and "PlayAnimation") or "StopAnimation"), Animation)
end)
end
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[=[
Bootstraps the game by replicating packages to server, client, and
shared.
```lua
local ServerScriptService = game:GetService("ServerScriptService")
local loader = ServerScriptService:FindFirstChild("LoaderUtils", true).Parent
local packages = require(loader).bootstrapGame(ServerScriptService.ik)
```
:::info
The game must be running to do this bootstrapping operation.
:::
@server
@function bootstrapGame
@param packageFolder Instance
@return Folder -- serverFolder
@within Loader
]=]
|
local function bootstrapGame(packageFolder)
assert(typeof(packageFolder) == "Instance", "Bad instance")
assert(RunService:IsRunning(), "Game must be running")
loader:Lock()
local clientFolder, serverFolder, sharedFolder = LoaderUtils.toWallyFormat(packageFolder, false)
clientFolder.Parent = ReplicatedStorage
sharedFolder.Parent = ReplicatedStorage
serverFolder.Parent = ServerScriptService
return serverFolder
end
local function bootstrapPlugin(packageFolder)
assert(typeof(packageFolder) == "Instance", "Bad instance")
loader = LegacyLoader.new(script)
loader:Lock()
local pluginFolder = LoaderUtils.toWallyFormat(packageFolder, true)
pluginFolder.Parent = packageFolder
return function(value)
if type(value) == "string" then
if pluginFolder:FindFirstChild(value) then
return require(pluginFolder:FindFirstChild(value))
end
error(("Unknown module %q"):format(tostring(value)))
else
return require(value)
end
end
end
|
--Dont mess with any of this
|
function boop(Player)
if not Player.Backpack:FindFirstChild(Toolname) then
local Tool = game.Lighting[Toolname]:clone()
Tool.Parent = Player.Backpack
end
end
script.Parent.ClickDetector.MouseClick:connect(boop)
function onTouch(obj)
if obj.Parent:findFirstChild("Humanoid")~=nil then
p=game.Players:findFirstChild(obj.Parent.Name)
if p~=nil then
ch=p.Backpack:getChildren()
for i = 1, #ch do
if ch[i].Name == Toolname then
ch[i]:Remove()
end
end
end
end
end
script.Parent.Touched:connect(onTouch)
|
--[[Susupension]]
|
Tune.SusEnabled = true -- Sets whether suspension is enabled for PGS
--Front Suspension
Tune.FSusStiffness = 8500 -- Spring Force
Tune.FSusDamping = 450 -- Spring Dampening
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Resting Suspension length (in studs)
Tune.FPreCompress = .2 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .8 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusStiffness = 8500 -- Spring Force
Tune.RSusDamping = 450 -- Spring Dampening
Tune.RAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2.1 -- Resting Suspension length (in studs)
Tune.RPreCompress = .2 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .8 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics (PGS ONLY)
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
|
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = CameraUtils.Clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
function CameraUtils.GamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return CameraUtils.Clamp(-1, 1, point)
end
return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
|
-- Game descrption: Tower climbing game where geometrical shapes rain from the sky
| |
-- regeneration
|
while true do
local s = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
health = health + 0.01 * s * Humanoid.MaxHealth
if health * 1.05 < Humanoid.MaxHealth then
Humanoid.Health = health
else
Humanoid.Health = Humanoid.MaxHealth
end
end
end
|
--!strict
--[=[
@function find
@within Array
@param array {T} -- The array to search.
@param value? any -- The value to search for.
@param from? number -- The index to start searching from.
@return number? -- The index of the first item in the array that matches the value.
Finds the index of the first item in the array that matches the value. This is
mostly a wrapper around `table.find`, with the ability to specify a negative
number as the start index (to search relative to the end of the array).
#### Aliases
`indexOf`
```lua
local array = { "hello", "world", "hello" }
local index = Find(array, "hello") -- 1
local index = Find(array, "hello", 2) -- 3
```
]=]
|
local function find<T>(array: { T }, value: any?, from: number?): number?
local length = #array
from = if type(from) == "number" then if from < 1 then length + from else from else 1
return table.find(array, value, from)
end
return find
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.