prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Created by BobNoobington |
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local car = script.Parent.Car.Value
local values = script.Parent.Values.Gear
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "v" then
for index, child in ipairs(script.Parent:GetChildren()) do
if child.ClassName == "Frame" or child.ClassName == "ImageLabel" then
child.Visible = not child.Visible
end
end
end
end)
|
--[[ I wont' be using promises for TopbarPlus so we can ignore this method
function Maid:givePromise(promise)
if (promise:getStatus() ~= Promise.Status.Started) then
return promise
end
local newPromise = Promise.resolve(promise)
local id = self:giveTask(newPromise)
-- Ensure GC
newPromise:finally(function()
self[id] = nil
end)
return newPromise, id
end--]] |
function Maid:give(taskOrPromise)
local taskId
if type(taskOrPromise) == "table" and taskOrPromise.isAPromise then
_, taskId = self:givePromise(taskOrPromise)
else
taskId = self:giveTask(taskOrPromise)
end
return taskOrPromise, taskId
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Baguette-- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--griptcf = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-math.pi/2+0.5, 0, 0) |
script.Parent.Unequipped:connect(function()
--Bring_Arm_Down animation
for i = 1, 0, -0.05 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3*i, 0, -0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7*i, 0, 0.8*i)
LW.C1 = CFrame.new(-0.3*i, 0.5+1.2*i, 0)
end
RW.Parent = nil
LW.Parent = nil
RSH.Parent = player.Character.Torso
LSH.Parent = player.Character.Torso
end)
function HomeRunHit(part)
local h = (part.Parent or game):FindFirstChild("Humanoid") --or findfirstchild optimization
if h then
h.Parent = nil
end
end
function HomeRun()
for i = 0, 1, 0.1 do
if anim ~= "homerun" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+1.2*i, -0.5*i, -0.5+i)
--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5, 0.5)
LW.C0 = CFrame.new(-1.5+0.5*i, 0.5, -0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
--L.C0 = CFrame.new(-1.0, 0.5, -0.5) * CFrame.fromEulerAnglesXYZ(1.7, 0, 1)
end
--start homerunhit connection--
local con = script.Parent.Handle.Touched:connect(HomeRunHit)
----------------------------------------
for i = 0, 1, 0.2 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -0.5-1.7*i, 0.5+0.5*i)
--R.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2, 1)
LW.C0 = CFrame.new(-1-0.5*i, 0.5, -0.5+0.5*i) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8-1.2*i)
LW.C1 = CFrame.new(0, 0.5-i, 0)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-2*i, 0, 0)
end
for i = 0, 1, 0.2 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5, -2.2-0.6*i, 1)
end
wait(0.1)
----end homerun connection---
con:disconnect()
--------------------------------------
for i = 0, 1, 0.1 do
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.5-1.2*i, -2.8+2.8*i, 1-1.5*i)
--RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3, 0, -0.5)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, -0.4+1.2*i)
LW.C1 = CFrame.new(0, -0.5+i*2, 0)
--LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7, 0, 0.8)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-3+2*i, 0, 0)
end
end
function Whack()
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.3+i, 0, -0.5+0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.7-0.25*i, 0, 0.8-0.6*i)
end
for i = 0, 1, 0.25 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(2.3-2.5*i, 0, 0)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.45-0.25*i, 0, 0.2)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1-0.5*i, 0, 0)
end
--insert camshake and hit nearby people
for _, p in pairs(game.Players:GetChildren()) do
if p.Character:FindFirstChild("Torso") then
if (p.Character.Torso.Position - (script.Parent.Handle.CFrame*CFrame.new(0, -3, 0)).p).magnitude < 10 then
local s = script.Parent._CamShake:clone()
s.Disabled = false
s.Parent = p.Backpack
if p ~= player then
p.Parent = nil
end
end
end
end
------
for i = 0, 1, 0.2 do
if anim ~= "norm" then return end
wait()
RW.C0 = CFrame.new(1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(-0.2+1.5*i, 0, -0.5*i)
LW.C0 = CFrame.new(-1.5, 0.5, 0) * CFrame.fromEulerAnglesXYZ(1.2+0.5*i, 0, 0.2+0.6*i)
GRP.C0 = CFrame.new(0, -1, 0) * CFrame.fromEulerAnglesXYZ(-1.5+0.5*i, 0, 0)
end
end
local a = false
local co = nil |
-- Disable spawning on join. This is handle by the client requesting the spawn |
PlayersService.CharacterAutoLoads = false
|
--[[
Called when the watched state changes value.
]] |
function class:update()
for callback in pairs(self._changeListeners) do
coroutine.wrap(callback)()
end
return false
end
|
-- Standard saving of data stores
-- The key you provide to DataStore2 is the name of the store with GetDataStore
-- GetAsync/UpdateAsync are then called based on the user ID |
local DataStoreService = game:GetService("DataStoreService")
local Promise = require(script.Parent.Parent.Promise)
local Standard = {}
Standard.__index = Standard
function Standard:Get()
return Promise.async(function(resolve)
resolve(self.dataStore:GetAsync(self.userId))
end)
end
function Standard:Set(value)
return Promise.async(function(resolve)
self.dataStore:UpdateAsync(self.userId, function()
return value
end)
resolve()
end)
end
function Standard.new(dataStore2)
return setmetatable({
dataStore = DataStoreService:GetDataStore(dataStore2.Name),
userId = dataStore2.UserId,
}, Standard)
end
return Standard
|
--[[Transmission]] |
Tune.TransModes = {"Semi"} --"Auto", "Semi", or "Manual". Can have more than one; order from first to last
--Automatic Settings
Tune.AutoShiftMode = "Speed" --"Speed" or "RPM"
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 2000 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.97 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.42 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.75 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.38 ,
--[[ 3 ]] 1.72 ,
--[[ 4 ]] 1.34 ,
--[[ 5 ]] 1.11 ,
--[[ 6 ]] .95 ,
--[[ 7 ]] .84 ,
}
Tune.FDMult = 1 -- -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
Tune.FDMult = 1 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Get references to the DockShelf and its children |
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.EBrush
local opened = aFinderButton.Opened
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Reindeer = require(script:WaitForChild("Reindeer"))
BaseUrl = "http://www.roblox.com/asset/?id="
BasePart = Create("Part"){
Material = Enum.Material.Plastic,
Shape = Enum.PartType.Block,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
FormFactor = Enum.FormFactor.Custom,
Size = Vector3.new(0.2, 0.2, 0.2),
CanCollide = true,
Locked = true,
}
Rate = (1 / 60)
ToolEquipped = false
Handle.Transparency = 0
Tool.Enabled = true
DisplayModel = Tool:FindFirstChild("DisplayModel")
if DisplayModel then
DisplayModel:Destroy()
end
function RayCast(Position, Direction, MaxDistance, IgnoreList)
local IgnoreList = ((type(IgnoreList) == "table" and IgnoreList) or {IgnoreList})
return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
end
function SpawnReindeer(CreateNew)
for i, v in pairs(Tool:GetChildren()) do
if (v:IsA("Model") or v:IsA("BasePart")) and v ~= Handle then
v:Destroy()
end
end
if not CreateNew then
return
end
local BeforeCFrame = Torso.CFrame
local ReindeerCopy = Reindeer:Clone()
local Body = ReindeerCopy.Body
local TorsoWeld = Create("Weld"){
Part0 = Torso,
Part1 = Body,
C0 = CFrame.new(-0.25, -0.3, -0.9),
C1 = CFrame.new(0, 0, 0),
Parent = Body
}
ReindeerCopy.Parent = Tool
local RayHit, RayPos, RayNormal = RayCast(BeforeCFrame.p, Vector3.new(0, -1, 0), (Torso.Size.Y * 2), {Character})
if RayHit then
Torso.CFrame = (BeforeCFrame + Vector3.new(0, ((Torso.Size.Y / 2) + 2.5), 0))
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Spawn(function()
SpawnReindeer(true)
end)
Handle.Transparency = 1
end
function Unequipped()
SpawnReindeer(false)
ToolEquipped = false
Handle.Transparency = 0
end
SpawnReindeer(false)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--DisableBackpack:Destroy() |
Services.Debris:AddItem(TrackOrb,1)
Services.Debris:AddItem(FixCam,2)
script:Destroy()
|
-- requires luaP, luaX, luaY |
local luaY
local luaK = {}
local luaP = require(script.Parent.LuaP)
local luaX = require(script.Parent.LuaX)
|
--[=[
Disconnects all connected events to the signal. Voids the signal as unusable.
Sets the metatable to nil.
]=] |
function Signal:Destroy()
if self._bindableEvent then
-- This should disconnect all events, but in-flight events should still be
-- executed.
self._bindableEvent:Destroy()
self._bindableEvent = nil
end
-- Do not remove the argmap. It will be cleaned up by the cleanup connection.
setmetatable(self, nil)
end
return Signal
|
-- update stats loop |
while true do
for _, player in ipairs(game.Players:GetPlayers()) do
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then
continue
end
for _, statObject in ipairs(leaderstats:GetChildren()) do
local saveValue = trackedStats[statObject.Name](player)
if not saveValue then
continue
end
statObject.Value = saveValue
end
end
wait(1)
end
|
-- 100 == 1 0 == 0 1/0.5 |
function JamCalculation()
local L_153_
if (math.random(1, 100) <= L_23_.JamChance) then
L_153_ = true
L_57_ = true
else
L_153_ = false
end
return L_153_
end
function TracerCalculation()
local L_154_
if (math.random(1, 100) <= L_23_.TracerChance) then
L_154_ = true
else
L_154_ = false
end
return L_154_
end
function SearchResupply(L_155_arg1)
local L_156_ = false
local L_157_ = nil
if L_155_arg1:FindFirstChild('ResupplyVal') or L_155_arg1.Parent:FindFirstChild('ResupplyVal') then
L_156_ = true
if L_155_arg1:FindFirstChild('ResupplyVal') then
L_157_ = L_155_arg1.ResupplyVal
elseif L_155_arg1.Parent:FindFirstChild('ResupplyVal') then
L_157_ = L_155_arg1.Parent.ResupplyVal
end
end
return L_156_, L_157_
end
|
--Horn Sound Code, Metrotren |
m1=script.Parent.StartHorn
m2=script.Parent.HornSound
m3=script.Parent.EndHorn
m1:Stop() --Initial setup
m2:Stop()
m3:Stop()
m1.Volume = 0
m2.Volume = 0
m3.Volume = 0
m2.Looped = false
m2.Playing = false
script.Parent.Parent:WaitForChild("Drive").Locotrol.Event:connect(function(data)
if data["Horn"] == true then
m2.Volume = 0
m2.Looped = false
m2:Stop()
m2.Playing = false
m3.Volume = 0
m3:stop()
m1.Volume = 1
m1:Play()
--wait(m1.TimeLength) --disabled because it makes looping part stuck playing if stopped too soon.
if m1.TimePosition < m1.TimeLength then
m2.Looped = true
m2.Volume = 1
m2:Play()
else
m1.Volume = 0
m1:Stop()
end
elseif data["Horn"] == false then
m1.Volume = 0
m1:Stop()
--For 3 part option
m2.Volume = 0
m2:Stop()
m2.Looped = false
m2.Playing = false
m3.Volume = 0
m3:Play()
--[[ -- For 2 part option
if m2.IsPlaying == true then
for i=1, 0, -.1 do
m2.Volume = i*1
wait(.1)
end
end
m2.Volume = 0
m2.Looped = false
m2.Playing = false
m2:Stop()
--]]
end
end)
|
--[=[
@param value T
@return Option<T> | Option<None>
Safely wraps the given value as an option. If the
value is `nil`, returns `Option.None`, otherwise
returns `Option.Some(value)`.
]=] |
function Option.Wrap(value)
if value == nil then
return Option.None
else
return Option.Some(value)
end
end
|
-- << CLIENT COMMANDS >> |
local module = {
----------------------------------------------------------------------
["ping"] = {
Function = function(speaker, args)
local startTime = tick()
local returnValue = main.signals.GetPing:InvokeServer(math.random(1,1000))
local timeTaken = tick() - startTime
local ping = timeTaken/2
local pingMs = ping*1000
local depth = 1000
local pingMsRounded = math.floor((pingMs*depth)+0.5)/depth
main:GetModule("Notices"):Notice("Notice", main.hdAdminCoreName, "Your ping is "..pingMsRounded.."!")
end;
};
----------------------------------------------------------------------
["blur"] = {
Function = function(speaker, args)
main.blur.Size = (args[2] ~= 0 and args[2]) or 20
end;
UnFunction = function(speaker, args)
main.blur.Size = 0
end;
};
----------------------------------------------------------------------
["showGuis"] = {
Function = function(speaker, args)
for a,b in pairs(hiddenGuis) do
a.Enabled = true
end
hiddenGuis = {}
end;
};
----------------------------------------------------------------------
["hideGuis"] = {
Function = function(speaker, args)
for a,b in pairs(main.playerGui:GetChildren()) do
if b:IsA("ScreenGui") and b.Name ~= "Chat" and b.Name ~= "HDAdminGUIs" then
if b.Enabled == true then
hiddenGuis[b] = true
end
b.Enabled = false
end
end
end;
};
----------------------------------------------------------------------
["view"] = {
Function = function(speaker, args)
local plr = args[1]
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if humanoid then
main:GetModule("cf"):SetCameraSubject(humanoid)
end
end;
UnFunction = function(speaker, args)
local humanoid = main:GetModule("cf"):GetHumanoid(speaker)
if humanoid then
main.signals.SetCameraSubject:FireClient(speaker, (humanoid))
end
end
};
----------------------------------------------------------------------
["nightVision"] = {
Function = function(speaker, args)
for _,plr in pairs(main.players:GetChildren()) do
local head = main:GetModule("cf"):GetHead(plr)
if plr.Name ~= main.player.Name and head then
for a,b in pairs(plr.Character:GetChildren()) do
if b:IsA("BasePart") and b:FindFirstChild("HDNightVision") == nil then
for i = 1,6 do
local nv = main.client.Assets.NightVision:Clone()
nv.Parent = b
nv.Face = i-1
nv.Name = "HDAdminNightVision"
end
end
end
local nv = main.client.Assets.Nickname:Clone()
nv.TextLabel.Text = plr.Name
nv.Parent = head
nv.Name = "HDAdminNightVision"
end
end
end;
UnFunction = function(speaker, args)
for _,plr in pairs(main.players:GetChildren()) do
if plr.Character then
for a,b in pairs(plr.Character:GetDescendants()) do
if b.Name == "HDAdminNightVision" then
b:Destroy()
end
end
end
end
end;
};
----------------------------------------------------------------------
["cmdbar"] = {
Function = function(speaker, args)
main:GetModule("CmdBar"):OpenCmdBar()
end;
};
----------------------------------------------------------------------
["cmdbar2"] = {
Function = function(speaker, args)
main:GetModule("cf"):CreateNewCommandMenu("cmdbar2", {}, 2)
end;
};
----------------------------------------------------------------------
["rainbowFart"] = {
Function = function(speaker, args)
local plr = args[1]
local maxPoops = 20
local poopSounds = {174658105,148635119}
local function poopSound(sound_id,part)
local soundPoop = Instance.new("Sound",part)
soundPoop.SoundId = "rbxassetid://"..sound_id
soundPoop.Volume = 0.5
soundPoop:Play()
local soundPlaying = soundPoop.IsPlaying or soundPoop.Played:Wait()
--repeat wait() until soundPoop.IsPlaying
wait()
end
local function poop(clone,toilet,sound_id,poopCount, poopGroup)
local poop = main.client.Assets.Poop:Clone()
poopSound(sound_id,poop)
poop.CanCollide = false
-- Changed to 'rainbow' as Roblox 'do not allow the use of commands where the central focus is the egregious act of defecation'
local totalPoops = maxPoops
local increment = 1/totalPoops
local newH = (poopCount-1)*increment
local newColor = Color3.fromHSV(newH, 0.7, 0.7)
poop.Color = newColor
--
poop.CFrame = toilet.Seat.CFrame * CFrame.new(0,(poopCount*1)-0.5,0)
clone:SetPrimaryPartCFrame(poop.CFrame * CFrame.new(0,3,0))
poop.Parent = poopGroup
end
local head = main:GetModule("cf"):GetHead(plr)
if not head then return end
local originalCFrame = head.CFrame
plr.Character.Parent = nil
local clone, tracks = main:GetModule("cf"):CreateClone(plr.Character)
--
if tracks.sit.Length <= 0 then repeat wait() until tracks.sit.Length > 0 end
--
clone.Head.CFrame = originalCFrame
if plr == main.player then
main:GetModule("cf"):Movement(false)
main:GetModule("cf"):SetCameraSubject(clone.Humanoid)
end
--main:GetModule("cf"):SetTransparency(plr.Character, 1)
local poopCount = 0
local poopGroup = Instance.new("Model",workspace)
local toilet = main.client.Assets.Toilet:Clone()
poopGroup.Name = plr.Name.."'s poop"
toilet.PrimaryPart = toilet.Seat
toilet:SetPrimaryPartCFrame(clone.HumanoidRootPart.CFrame * CFrame.new(0,-1,0)) --* CFrame.Angles(0,math.rad(90), 0))
toilet.Parent = workspace
toilet.Seat:Sit(clone.Humanoid)
tracks.sit:Play(0)
clone.Head.face.Texture = "rbxassetid://304907108"
wait()
clone.PrimaryPart = clone.Head
clone:SetPrimaryPartCFrame(toilet.PrimaryPart.CFrame * CFrame.new(0,3,0))
for a,b in pairs(clone:GetChildren()) do
if b:IsA("BasePart") and b.Name ~= "HumanoidRootPart" then
b.Anchored = true
end
end
wait(1)
--
poopSound(174658105,clone.HumanoidRootPart)
wait(2)
poopCount = poopCount + 1
poop(clone,toilet,148635119,poopCount, poopGroup, poopGroup)
clone.Head.face.Texture = "rbxassetid://338312149"
wait(1.5)
clone.Head.face.Texture = "rbxassetid://316545711"
for i = 1,maxPoops do
if i == maxPoops-2 then
for a,b in pairs(clone:GetChildren()) do
if b:IsA("BasePart") and b.Name ~= "HumanoidRootPart" then
b.Anchored = false
end
end
local explosion = Instance.new("Explosion")
explosion.Position = clone.Head.Position
explosion.Parent = clone
explosion.DestroyJointRadiusPercent = 0
clone:BreakJoints()
elseif i > maxPoops-1 then
for a,b in pairs(poopGroup:GetChildren()) do
b.Anchored = false
b.CanCollide = true
end
end
poopCount = poopCount + 1
if i >= maxPoops then
wait(1.5)
else
poop(clone,toilet,poopSounds[math.random(1,#poopSounds)],poopCount, poopGroup)
wait()
end
end
wait(3)
poopGroup:Destroy()
toilet:Destroy()
clone:Destroy()
if plr == main.player then
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if humanoid then
main:GetModule("cf"):Movement(true)
main:GetModule("cf"):SetCameraSubject(humanoid)
end
end
--main:GetModule("cf"):SetTransparency(plr.Character, 0)
plr.Character.Parent = workspace
end;
};
----------------------------------------------------------------------
["icecream"] = {
Function = function(speaker, args)
local plr = args[1]
--Create clone and hide char
plr.Character.Parent = nil
local clone, tracks = main:GetModule("cf"):CreateClone(plr.Character)
local hrp = clone:FindFirstChild("HumanoidRootPart")
if hrp == nil then clone:Destroy() return end
hrp.Anchored = true
--tracks.idle:Play()
--main:GetModule("cf"):SetTransparency(plr.Character, 1)
--Create van
local van = main.client.Assets.IcecreamVan:Clone()
van.PrimaryPart = van.VanDoor.Part1
van:SetPrimaryPartCFrame(hrp.CFrame * CFrame.new(-210,3,-4) * CFrame.Angles(0,math.rad(90), 0))
van.Parent = workspace
--Disable movement and set camera if player == plr
if plr == main.player then
main:GetModule("cf"):Movement(false)
main:GetModule("cf"):SetCameraSubject(clone.Humanoid)
for a,b in pairs(van:GetDescendants()) do
if b:IsA("BasePart") then
b.CanCollide = true
end
end
end
--Setup Sounds
local soundIcecream = main:GetModule("cf"):CreateSound{SoundId = 260910474, Volume = 0.5, Parent = van.PrimaryPart}
local soundClowns = main:GetModule("cf"):CreateSound{SoundId = 861942173, Volume = 4, Parent = van.PrimaryPart}
local soundBaby = main:GetModule("cf"):CreateSound{SoundId = 2628538600, Volume = 0.15, Parent = van.PrimaryPart}
local soundScream = main:GetModule("cf"):CreateSound{SoundId = 147758746, Volume = 0.8, Parent = van.PrimaryPart}
--Tween van to plr
soundIcecream:Play()
main:GetModule("cf"):TweenModel(van, van.PrimaryPart.CFrame * CFrame.new(0, 0, 210), TweenInfo.new(8))
wait(8.1)
local tween = main.tweenService:Create(soundIcecream, TweenInfo.new(0.5), {Volume = 0})
tween:Play()
tween.Completed:Wait()
soundIcecream:Stop()
soundIcecream:Destroy()
wait(1)
--Open doors, get plr and close doors
van.VanDoor.Part1.Transparency = 1
van.VanDoor.Part2.Transparency = 1
wait(1)
clone.PrimaryPart = clone.Head
clone:SetPrimaryPartCFrame(van.Clown.Head.CFrame * CFrame.new(0,0,-2.5) * CFrame.Angles(0,math.rad(180), 0))
local originalMinZoom = plr.CameraMinZoomDistance
local originalMaxZoom = plr.CameraMaxZoomDistance
if plr == main.player then
plr.CameraMaxZoomDistance = 0.5
spawn(function()
plr.CameraMaxZoomDistance = 1
end)
end
local face = clone.Head:FindFirstChild("face")
if face then
face.Texture = "rbxassetid://338312149"
end
soundClowns:Play()
wait(1)
van.VanDoor.Part1.Transparency = 0
van.VanDoor.Part2.Transparency = 0
clone.Parent = van
for a,b in pairs(clone:GetChildren()) do
if b:IsA("Accessory") then
b:remove()
end
end
--Tween van away
soundIcecream:Play()
main:GetModule("cf"):TweenModel(van, van.PrimaryPart.CFrame * CFrame.new(0, 0, 400), TweenInfo.new(14, Enum.EasingStyle.Quad, Enum.EasingDirection.In))
--Show scary stuff and scream
wait(4)
local arm = van.Clown["Right Arm"]
arm.CFrame = arm.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(45), 0, 0)
for a,b in pairs(van.Doll:GetChildren()) do
b.Transparency = 0
end
van.Doll.Head.face.Transparency = 0
wait(0.1)
soundBaby:Play()
wait(1.5)
soundScream:Play()
if face then
face.Texture = "rbxassetid://288918236"
end
wait(2.5)
--Explode
if plr == main.player then
local explosion = Instance.new("Explosion")
explosion.Position = clone.Head.Position
explosion.Parent = clone
clone:BreakJoints()
main.audio.Oof:Play()
end
wait(5)
--Destroy van and reset player
if plr == main.player then
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if humanoid then
main:GetModule("cf"):Movement(true)
main:GetModule("cf"):SetCameraSubject(humanoid)
end
plr.CameraMaxZoomDistance = 20
wait()
plr.CameraMinZoomDistance = 20
wait()
plr.CameraMinZoomDistance = originalMinZoom
plr.CameraMaxZoomDistance = originalMaxZoom
end
--main:GetModule("cf"):SetTransparency(plr.Character, 0)
if plr.Character then
plr.Character.Parent = workspace
end
van:Destroy()
end;
};
----------------------------------------------------------------------
["laserEyes"] = {
DisplayLaser = function(laserHead, laserTarget, status)
local leftBeam = laserTarget:FindFirstChild("LeftBeam")
if leftBeam then
leftBeam.Enabled = status
laserTarget.RightBeam.Enabled = status
laserTarget.MidAttachment.GlowHit.Enabled = status
end
end;
Activate = function(self)
local commandName = self.Name
local head = main:GetModule("cf"):GetHead()
local humanoid = main:GetModule("cf"):GetHumanoid()
local hrp = main:GetModule("cf"):GetHRP()
if head and humanoid and main.mouseDown then
local laserHead = head:FindFirstChild("HDAdminLaserHead")
local neck = main:GetModule("cf"):GetNeck()
local r6 = false
if humanoid.RigType == Enum.HumanoidRigType.R6 then
r6 = true
end
head.Parent.PrimaryPart = hrp
if laserHead and neck then
local maxDistance = 30
local lastUpdate = tick()-1
local originalC0 = neck.C0
local additionalY = humanoid.HipHeight/2.5
local laserTarget = laserHead.LaserTarget
local fire = laserTarget.MidAttachment2.Fire
local sparks = laserTarget.MidAttachment.Sparks
local sizzle = main.audio.Sizzle
local sizzle2 = main.audio.Sizzle2
sizzle:Play()
self.DisplayLaser(laserHead, laserTarget, true)
repeat
local hit, position = main:GetModule("cf"):GetMousePoint(main.lastHitPosition)
local targetCFrame = CFrame.new(position, head.Position)
local distanceFromPlayer = main.player:DistanceFromCharacter(targetCFrame.p)
local exceededMaxDistance = false
if distanceFromPlayer > maxDistance then
targetCFrame = targetCFrame * CFrame.new(0, 0, maxDistance-distanceFromPlayer)
exceededMaxDistance = true
end
laserTarget.CFrame = targetCFrame
local headPos = head.Position
local targetPos = laserTarget.Position
local direction = (Vector3.new(targetPos.X, headPos.Y, targetPos.Z) - head.Position).Unit
if head.Parent.PrimaryPart == nil then
head.Parent.PrimaryPart = head.parent.HumanoidRootPart
end
local lookCFrame = (CFrame.new(Vector3.new(), (head.Parent.PrimaryPart.CFrame):VectorToObjectSpace(direction)))
if r6 then
lookCFrame = lookCFrame * CFrame.new(0,1,0) * CFrame.fromEulerAnglesXYZ(math.rad(90),math.rad(180),0)
else
lookCFrame = lookCFrame * CFrame.new(0,additionalY,0)
end
neck.C0 = lookCFrame
if tick() - 0.6 > lastUpdate then
lastUpdate = tick()
main:GetModule("cf"):ReplicateEffect(self.Name, {targetCFrame, lookCFrame})
end
if hit and not exceededMaxDistance and (hit.Parent:FindFirstChild("Humanoid") or hit.Name == "Handle") then
fire.Enabled = true
sparks.Enabled = true
if not sizzle2.Playing then
sizzle2:Play()
end
else
fire.Enabled = false
sparks.Enabled = false
if sizzle2.Playing then
sizzle2:Stop()
end
end
wait()
until not main.mouseDown or not main.commandsActive[commandName] or not head or not head.Parent or not neck
neck.C0 = originalC0
self.DisplayLaser(laserHead, laserTarget, false)
fire.Enabled = false
sparks.Enabled = false
sizzle:Stop()
sizzle2:Stop()
end
end
main.commandsActive[commandName] = nil
end;
ReplicationEffect = function(speaker, args, self)
local targetCFrame, lookCFrame = args[1], args[2]
local plr = speaker
local head = main:GetModule("cf"):GetHead(plr)
if head then
local laserHead = head:FindFirstChild("HDAdminLaserHead")
local neck = main:GetModule("cf"):GetNeck(plr)
if laserHead and neck then
local laserTarget = laserHead.LaserTarget
--Laser is already active
if lasersActive[plr] then
lasersActive[plr] = lasersActive[plr] + 1
else -- New laser
lasersActive[plr] = 1
originalNecks[plr] = neck.C0
local randomZ = math.random(10,40) - 15
laserTarget.CFrame = targetCFrame * CFrame.new(0, 0, randomZ)
neck.C0 = lookCFrame
laserTarget.MidAttachment.GlowHit.Rate = 50
self.DisplayLaser(laserHead, laserTarget, true)
end
main.tweenService:Create(laserTarget, laserTweenInfo, {CFrame = targetCFrame}):Play()
main.tweenService:Create(neck, laserTweenInfo, {C0 = lookCFrame}):Play()
wait(laserTweenTime)
lasersActive[plr] = lasersActive[plr] - 1
if lasersActive[plr] <= 0 then
self.DisplayLaser(laserHead, laserTarget, false)
neck.C0 = originalNecks[plr]
originalNecks[plr] = nil
lasersActive[plr] = nil
end
end
end
end;
};
----------------------------------------------------------------------
["warp"] = {
Function = function(speaker, args)
local maxDistort = 1
local increment = 0.005
local distort = maxDistort-increment
local distortDirection = -increment
repeat main.runService.RenderStepped:Wait()
if distort < increment then
distort = increment
distortDirection = increment
elseif distort > maxDistort then
distort = maxDistort
distortDirection = -increment
end
main.camera.CFrame = main.camera.CFrame*CFrame.new(0,0,0,distort,0,0,0,distort,0,0,0,1)
distort = distort + distortDirection
until distort > maxDistort
end;
};
----------------------------------------------------------------------
["fly"] = {
Activate = function(self)
main:GetModule("FlyCommand"):Fly(self.Name)
end;
};
----------------------------------------------------------------------
["fly2"] = {
Activate = function(self)
main:GetModule("FlyCommand"):Fly(self.Name)
end;
};
----------------------------------------------------------------------
["noclip"] = {
Activate = function(self)
local commandName = self.Name
local humanoid = main:GetModule("cf"):GetHumanoid()
local hrp = main:GetModule("cf"):GetHRP()
if humanoid and hrp then
local lastUpdate = tick()
hrp.Anchored = true
humanoid.PlatformStand = true
repeat wait()
local delta = tick()-lastUpdate
local look = (main.camera.Focus.p-main.camera.CFrame.p).unit
local move = main:GetModule("cf"):GetNextMovement(delta, main.commandSpeeds[commandName])
local pos = hrp.Position
hrp.CFrame = CFrame.new(pos,pos+look) * move
lastUpdate = tick()
until not main.commandsActive[commandName]
if hrp and humanoid then
hrp.Anchored = false
hrp.Velocity = Vector3.new()
humanoid.PlatformStand = false
end
end
end;
};
----------------------------------------------------------------------
["noclip2"] = {
Activate = function(self)
main:GetModule("FlyCommand"):Fly(self.Name, true)
end;
};
----------------------------------------------------------------------
["clip"] = {
Function = function(speaker, args, self)
main:GetModule("cf"):DeactivateCommand("noclip")
end;
};
----------------------------------------------------------------------
["boing"] = {
ExpandTime = 4;
ExpandAmount = 3;
EndBoing = {};
Function = function(speaker, args, self)
local plr = args[1]
local head = main:GetModule("cf"):GetHead(plr)
local humanoid = main:GetModule("cf"):GetHumanoid(plr)
if head and humanoid and not self.UnFunction(speaker, args, self) then
local headMesh = head:FindFirstChild("Mesh")
if headMesh then
local hats = {}
local character = plr.Character
for a,b in pairs(character:GetChildren()) do
if b:IsA("Accessory") then
table.insert(hats, b)
b.Parent = nil
end
end
local originalScale = headMesh.Scale
local tween = main.tweenService:Create(headMesh, TweenInfo.new(self.ExpandTime, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out), {Scale = Vector3.new(originalScale.X, originalScale.Y * self.ExpandAmount, originalScale.Z)})
tween:Play()
--
local endEvent = Instance.new("BindableEvent")
self.EndBoing[plr] = endEvent
main:GetModule("cf"):WaitForEvent(endEvent, humanoid.Died, plr.CharacterAdded)
self.EndBoing[plr] = nil
endEvent:Destroy()
--
if headMesh then
local tween = main.tweenService:Create(headMesh, TweenInfo.new(2, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out), {Scale = originalScale})
tween:Play()
tween.Completed:Wait()
end
for i,v in pairs(hats) do
if character then
v.Parent = character
else
v:Destroy()
end
end
end
end
end;
UnFunction = function(speaker, args, self)
local plr = args[1]
local endEvent = self.EndBoing[plr]
if endEvent then
endEvent:Fire()
return true
end
end;
};
----------------------------------------------------------------------
};
|
-- ROBLOX deviation START: handle template data |
local function maybeHandleTemplateString(table_: any): Global_EachTable
if typeof(table_) == "string" then
local templateString = table_ :: string
local raw = templateString
local strings = {}
local expressions = {}
local startIndex = 1
local endIndex = 1
local expressionStarted = false
for i = 1, #templateString do
local current = string.sub(templateString, i, i)
local next = if i < #templateString then string.sub(templateString, i + 1, i + 1) else nil
if i == #templateString then
if expressionStarted then
error("expression not closed")
end
table.insert(strings, string.sub(templateString, startIndex))
elseif not expressionStarted and current == "$" then
if next == "{" then
expressionStarted = true
endIndex = i - 1
end
elseif expressionStarted and current == "}" then
local str = string.sub(templateString, startIndex, endIndex)
local exp = string.sub(templateString, endIndex + 3, i - 1)
table.insert(strings, str)
table.insert(expressions, exp)
startIndex = i + 1
expressionStarted = false
end
end
return (setmetatable(strings, {
__index = {
raw = raw,
},
}) :: any) :: Global_EachTable
else
return table_
end
end |
--// bolekinds |
script.Parent.Triggered:Connect(function(plr)
plr.PlayerGui.Shop.Frame.Visible = true
plr.PlayerGui.Shop.Frame.Startup:Play()
end)
|
--------LEFT DOOR 9-------- |
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(135)
|
-- TUNING VALUES
----------------------------------------
-- Factor of torque applied to get the wheels spinning
-- Larger number generally means faster acceleration |
local TORQUE = 16000
|
-- game.Workspace.Points:ClearAllChildren()
-- local ps = path:GetPointCoordinates()
-- for _, point in pairs(ps) do
-- local part = Instance.new("Part", game.Workspace.Points)
-- part.CanCollide = false
-- part.Anchored = true
-- part.FormFactor = Enum.FormFactor.Custom
-- part.Size = Vector3.new(1,1,1)
-- part.Position = point
-- end |
currentPointIndex = 1
lastTargetPos = target
end
if path then
local points = path:GetPointCoordinates()
if currentPointIndex < #points then
local currentPoint = points[currentPointIndex]
if character:FindFirstChild("HumanoidRootPart") then
local distance = (character.HumanoidRootPart.Position - currentPoint).magnitude
if distance < NextPointThreshold then
currentPointIndex = currentPointIndex + 1
end
character.Humanoid:MoveTo(points[currentPointIndex])
if points[currentPointIndex].Y - character.HumanoidRootPart.Position.Y > JumpThreshold then
character.Humanoid.Jump = true
end
end
else
if character:FindFirstChild("Humanoid") then
character.Humanoid:MoveTo(target)
end
end
end
end
return this
end
return PathfindingUtility
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Cashmere",Paint)
end)
|
--[[
___ _____
/ _ |/ ___/ Avxnturador | Novena
/ __ / /__
/_/ |_\___/ LuaInt | Novena
*I assume you know what you're doing if you're gonna change something here.* ]] | --
--[[START]]
script.Parent:WaitForChild("Car")
script.Parent:WaitForChild("IsOn")
script.Parent:WaitForChild("ControlsOpen")
script.Parent:WaitForChild("Values")
--[[Dependencies]]
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
--[[Output Scaling Factor]]
local FBrakeForce = _Tune.BrakeForce*_Tune.BrakeBias--luaint edit
local RBrakeForce = _Tune.BrakeForce*(1-_Tune.BrakeBias)--luaint edit
local PBrakeForceF = _Tune.PBrakeForce*_Tune.PBrakeBias
local PBrakeForceR = _Tune.PBrakeForce*(1-_Tune.PBrakeBias)
local EBrakeForce = _Tune.EBrakeForce
local SteerOuter = _Tune.SteerOuter--luaint edit
local SteerInner = _Tune.SteerInner--luaint edit
local RSteerOuter = _Tune.RSteerOuter
local RSteerInner = _Tune.RSteerInner
if not workspace:PGSIsEnabled() then
error("PGS is not enabled: A-Chassis will not work.")
end
--[[Status Vars]]
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart and (_Tune.Engine or _Tune.Electric) then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _InThrot=0
local _IThrot=_Tune.IdleThrottle/100
local _GBrake=0
local _InBrake=0
local _IBrake=0
local _ClPressing = false
local _PlayerClutch = false
local _Clutch = 0
local _ClutchKick = 0
local _ClutchModulate = 0
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _ShiftUp = false
local _ShiftDn = false
local _Shifting = false
local _spLimit = 0
local _Boost = 0
local _TCount = 0
local _TPsi = 0
local _TBoost = 0
local _SCount = 0
local _SPsi = 0
local _SBoost = 0
local _NH = 0
local _NT = 0
local _EH = 0
local _ET = 0
local _TH = 0
local _TT = 0
local _SH = 0
local _ST = 0
local _BH = 0
local _BT = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
--[[Shutdown]]
car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") then script.Parent:Destroy() end end)
--[[Controls]]
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<=1) and _Tune.AutoShiftVers == "New") or _TMode=="Semi") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftDn then _ShiftDn = true end
--Shift Up [Manual Transmission]
elseif (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<1) and _Tune.AutoShiftVers == "New") or _TMode=="Semi") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftUp then _ShiftUp = true end
--Toggle Clutch
elseif (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClPressing = true
_PlayerClutch = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClPressing = false
_PlayerClutch = false
end
--Toggle PBrake
elseif input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then _PBrake = false end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
_IThrot = 1
else
_IThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_IBrake = 1
else
_IBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_IThrot = _Tune.IdleThrottle/100
_IBrake = 0
_GSteerT = 0
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end
--Toggle ABS
elseif _Tune.ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif input.KeyCode == _CTRL["ContlrThrottle"] then
if _IsOn then
_IThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
else
_IThrot = _Tune.IdleThrottle/100
end
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_IBrake = input.Position.Z
end
end
else
_IThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_IBrake = 0
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
--[[Drivetrain Initialize]]
local Drive={}
--Power Front Wheels
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.insert(Drive,v) end end end
--Power Rear Wheels
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then table.insert(Drive,v) end end end
--Determine Wheel Size
local wDia = 0 for i,v in pairs(Drive) do if v.Size.x>wDia then wDia = v.Size.x end end
--Pre-Toggled PBrake
for i,v in pairs(car.Wheels:GetChildren()) do if (math.abs(v["#BV"].MotorMaxTorque-PBrakeForceF)<1) or (math.abs(v["#BV"].MotorMaxTorque-PBrakeForceR)<1) then _PBrake=true end end
--[[Throttle and Brake Input Smoothening]]
function Inputs(dt)
local deltaTime = (60/(1/dt))
if _InThrot <= _IThrot then
_InThrot = math.min(_IThrot,_InThrot+(_Tune.ThrotAccel*deltaTime))
else
_InThrot = math.max(_IThrot,_InThrot-(_Tune.ThrotDecel*deltaTime))
end
if _InBrake <= _IBrake then
_InBrake = math.min(_IBrake,_InBrake+(_Tune.BrakeAccel*deltaTime))
else
_InBrake = math.max(_IBrake,_InBrake-(_Tune.BrakeDecel*deltaTime))
end
end
--[[Steering]]
if _Tune.SteeringType == 'New' then--luaint edit
SteerOuter = (_Tune.LockToLock*180)/_Tune.SteerRatio
SteerInner = math.min(SteerOuter-(SteerOuter*(1-_Tune.Ackerman)),SteerOuter*1.2)
end
function Steering(dt)
local deltaTime = (60/(1/dt))
--Mouse Steer
if _MSteer then
local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
local mdZone = _Tune.Peripherals.MSteerDZone/100
local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
if math.abs(mST)<=mdZone then
_GSteerT = 0
else
_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
end
end
--Interpolate Steering
if _GSteerC < _GSteerT then
if _GSteerC<0 then
_GSteerC = math.min(_GSteerT,_GSteerC+(_Tune.ReturnSpeed*deltaTime))
else
_GSteerC = math.min(_GSteerT,_GSteerC+(_Tune.SteerSpeed*deltaTime))
end
else
if _GSteerC>0 then
_GSteerC = math.max(_GSteerT,_GSteerC-(_Tune.ReturnSpeed*deltaTime))
else
_GSteerC = math.max(_GSteerT,_GSteerC-(_Tune.SteerSpeed*deltaTime))
end
end
--Steer Decay Multiplier
local sDecay = (1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
local rsDecay = (1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerDecay,1-(_Tune.MinSteer/100)))
--Apply Steering
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="F" then
v.Arm.Steer.CFrame=car.Wheels.F.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerInner*sDecay),0)
elseif v.Name=="FL" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerOuter*sDecay),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerInner*sDecay),0)--luaint edit
end
elseif v.Name=="FR" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerInner*sDecay),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerOuter*sDecay),0)--luaint edit
end
elseif v.Name=='R' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
elseif _Tune.FWSteer=='Speed' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
elseif _Tune.FWSteer=='Both' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif v.Name=='RL' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Speed' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Both' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
end
elseif v.Name=='RR' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Speed' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Both' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
end
end
end
end
--[[Engine]]
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
--Electric Only Setup
if not _Tune.Engine and _Tune.Electric then
_Tune.Redline = _Tune.E_Redline
_Tune.PeakRPM = _Tune.E_Trans2
_Tune.Turbochargers = 0
_Tune.Superchargers = 0
_Tune.Clutch = false
_Tune.IdleRPM = 0
_Tune.ClutchType = "Clutch"
_Tune.AutoShiftType = "DCT"
_Tune.ShiftUpTime = 0.1
_Tune.ShiftDnTime = 0.1
end
--Aspiration Setup
_TCount = _Tune.Turbochargers
_TPsi = _Tune.T_Boost*_Tune.Turbochargers
_SCount = _Tune.Superchargers
_SPsi = _Tune.S_Boost*_Tune.Superchargers
--Engine Curve
local HP=_Tune.Horsepower/100
local HP_T=((_Tune.Horsepower*((_TPsi)*(_Tune.CompressionRatio/10))/7.5)/2)/100
local HP_S=((_Tune.Horsepower*((_SPsi)*(_Tune.CompressionRatio/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
function CurveN(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveN = CurveN(_Tune.PeakRPM)
function CurveT(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_T/(Peak^2),CurveMult^(Peak/HP_T))+HP_T)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveT = CurveT(_Tune.PeakRPM)
function CurveS(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_S/(Peak^2),CurveMult^(Peak/HP_S))+HP_S)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveS = CurveS(_Tune.PeakRPM)
--Electric Curve
local EHP=_Tune.E_Horsepower/100
local ETQ=_Tune.E_Torque/100
local ETrans1=_Tune.E_Trans1/1000
local ETrans2=_Tune.E_Trans2/1000
local ELimit=_Tune.E_Redline/1000
function elecHP(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<=ETrans1 then
retVal=((((RPM/ETrans1)^_Tune.EH_FrontMult)/(1/EHP))*(RPM/ETrans1))+((((RPM/ETrans1)^(1/_Tune.EH_FrontMult))/(1/EHP))*(1-(RPM/ETrans1)))
elseif ETrans1<RPM and RPM<ETrans2 then
retVal=EHP
elseif ETrans2<=RPM then
retVal=EHP-(((RPM-ETrans2)/(ELimit-ETrans2))^_Tune.EH_EndMult)/(1/(EHP*(_Tune.EH_EndPercent/100)))
else
error( "\n\t [AC6C]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric horsepower."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
function elecTQ(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<ETrans1 then
retVal=ETQ
elseif ETrans1<=RPM then
retVal=ETQ-(((RPM-ETrans1)/(ELimit-ETrans1))^_Tune.ET_EndMult)/(1/(ETQ*(_Tune.ET_EndPercent/100)))
else
error( "\n\t [AC6C]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric torque."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
--Plot Current Naturally Aspirated Engine Horsepower
function GetNCurve(x,gear)
local hp=(math.max(CurveN(x)/(PeakCurveN/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD)*1000
end
--Plot Current Electric Horsepower
function GetECurve(x,gear)
local hp=(math.max(elecHP(x),0))*100
local tq=(math.max(elecTQ(x),0))*100
if gear~=0 then
return hp,math.max(tq*_Tune.Ratios[gear+2]*fFD,0)
else
return 0,0
end
end
--Plot Current Turbocharger Horsepower
function GetTCurve(x,gear)
local hp=(math.max(CurveT(x)/(PeakCurveT/HP_T),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD)*1000
end
--Plot Current Supercharger Horsepower
function GetSCurve(x,gear)
local hp=(math.max(CurveS(x)/(PeakCurveS/HP_S),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD)*1000
end
--Output Cache
local NCache = {}
local ECache = {}
local TCache = {}
local SCache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local ehpPlot = {}
local thpPlot = {}
local shpPlot = {}
for rpm = 0, math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local etqPlot = {}
local ttqPlot = {}
local stqPlot = {}
if rpm~=0 then
if _Tune.Engine then
ntqPlot.Horsepower,ntqPlot.Torque = GetNCurve(rpm*100,gear-2)
if _TCount~=0 then
ttqPlot.Horsepower,ttqPlot.Torque = GetTCurve(rpm*100,gear-2)
else
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
end
if _SCount~=0 then
stqPlot.Horsepower,stqPlot.Torque = GetSCurve(rpm*100,gear-2)
else
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Electric then
etqPlot.Horsepower,etqPlot.Torque = GetECurve(rpm*100,gear-2)
else
etqPlot.Horsepower,etqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
etqPlot.Horsepower,etqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Engine then
nhp,ntq = GetNCurve((rpm+1)*100,gear-2)
if _TCount~=0 then
thp,ttq = GetTCurve((rpm+1)*100,gear-2)
else
thp,ttq = 0,0
end
if _SCount~=0 then
shp,stq = GetSCurve((rpm+1)*100,gear-2)
else
shp,stq = 0,0
end
else
nhp,ntq = 0,0
thp,ttq = 0,0
shp,stq = 0,0
end
if _Tune.Electric then
ehp,etq = GetECurve((rpm+1)*100,gear-2)
else
ehp,etq = 0,0
end
ntqPlot.HpSlope,ntqPlot.TqSlope = (nhp-ntqPlot.Horsepower),(ntq-ntqPlot.Torque)
etqPlot.HpSlope,etqPlot.TqSlope = (ehp-etqPlot.Horsepower),(etq-etqPlot.Torque)
ttqPlot.HpSlope,ttqPlot.TqSlope = (thp-ttqPlot.Horsepower),(ttq-ttqPlot.Torque)
stqPlot.HpSlope,stqPlot.TqSlope = (shp-stqPlot.Horsepower),(stq-stqPlot.Torque)
nhpPlot[rpm] = ntqPlot
ehpPlot[rpm] = etqPlot
thpPlot[rpm] = ttqPlot
shpPlot[rpm] = stqPlot
end
table.insert(NCache,nhpPlot)
table.insert(ECache,ehpPlot)
table.insert(TCache,thpPlot)
table.insert(SCache,shpPlot)
end
--Powertrain
wait()
--Automatic Transmission
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
if _Tune.AutoShiftVers == "Old" and _CGear == 0 then _CGear = 1 _ClPressing = false end
if _CGear >= 1 then
if (_CGear==1 and _InBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5) and _Tune.AutoShiftVers == "Old" then
_CGear = -1 _ClPressing = false
elseif car.DriveSeat.Velocity.Magnitude > 5 then
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
end
end
else
if (_InThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 5) and _Tune.AutoShiftVers == "Old" then
_CGear = 1 _ClPressing = false
end
end
end
end
function Gear()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _ShiftUp and not _Shifting then
if (_TMode == "Manual" and not _ClPressing) or (_TMode == "Manual" and _Tune.ClutchRel and (_InThrot-(_Tune.IdleThrottle/100)>0)) or _CGear == #_Tune.Ratios-2 or (_TMode ~= "Manual" and not _IsOn) then _ShiftUp = false return end
local NextGear = math.min(_CGear+3,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>0 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftUpTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM<=math.max(math.min(maxSpin*_Tune.Ratios[NextGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftDn
end
end
end
_ShiftUp = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
if _TMode ~= "Manual" or (_TMode == "Manual" and _CGear == 1) and _IsOn then _ClPressing = false end
end
if _ShiftDn and not _Shifting then
if (_TMode == "Manual" and not _ClPressing) or _CGear == -1 or (_TMode ~= "Manual" and not _IsOn) then _ShiftDn = false return end
local PrevGear = math.min(_CGear+1,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>1 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftDnTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM>=math.max(math.min(maxSpin*_Tune.Ratios[PrevGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftUp
end
end
end
_ShiftDn = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.max(_CGear-1,-1)
if _TMode ~= "Manual" or (_TMode == "Manual" and _CGear == -1) and _IsOn then _ClPressing = false end
end
end
local _GoalRPM=0
local tqTCS = 1
local sthrot = 0
local _StallOK = false
local ticc = tick()
--Apply Power
function Engine(dt)
local deltaTime = (60/(1/dt))
--Neutral Gear
if ((_CGear == 0 or _Shifting) and _IsOn) then
_ClPressing = true
_Clutch = 1
_StallOK = false
end
local revMin = _Tune.IdleRPM
local goalMin = _Tune.IdleRPM
local goalMax = _Tune.Redline
if _Tune.Stall and _Tune.Clutch then revMin = 0 end
if _Shifting and _ShiftUp then
_GThrot = 0
elseif _Shifting and _ShiftDn then
_GThrot = (_Tune.ShiftThrot/100)
else
if (_Tune.AutoShiftVers == "Old" and _CGear==-1 and _TMode=="Auto") then
_GThrot = _InBrake
else
_GThrot = _InThrot
end
end
if (_Tune.AutoShiftVers == "Old" and _CGear==-1 and _TMode=="Auto") then
_GBrake = _InThrot-(_Tune.IdleThrottle/100)
else
_GBrake = _InBrake
end
if not _IsOn then
ticc = tick()
revMin = 0
goalMin = 0
_GThrot = _Tune.IdleThrottle/100
if _TMode~="Manual" then
_CGear = 0
_ClPressing = true
_Clutch = 1
end
end
if ((_ClPressing and _CGear == 0) or (_PlayerClutch and _CGear ~= 0)) and _Tune.NeutralLimit then
if (_CGear == 0 and not _Tune.LimitClutch) or _Tune.LimitClutch then
goalMax = _Tune.NeutralRevRPM
end
end
--Determine RPM
local maxSpin=0
local maxCount=0
local revThrot=_GThrot
for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end
maxSpin=maxSpin/maxCount
if _GoalRPM>goalMax+100 then
revThrot = _Tune.IdleThrottle/100
end
if _Tune.Engine or _Tune.Electric then
_GoalRPM = math.clamp((_RPM-_Tune.RevDecay*deltaTime)+((_Tune.RevDecay+_Tune.RevAccel)*revThrot*deltaTime),goalMin,_Tune.Redline+100)
end
if _GoalRPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_GoalRPM = _GoalRPM-_Tune.RevBounce
else
_GoalRPM = _GoalRPM-_Tune.RevBounce*.5
end
end
local _WheelRPM = maxSpin*_Tune.Ratios[_CGear+2]*fFDr
if _Tune.Clutch then
if script.Parent.Values.AutoClutch.Value and _IsOn then
if _Tune.ClutchType == "Clutch" then
if _ClPressing then _ClutchKick = 1 end
_ClutchKick = _ClutchKick*(_Tune.ClutchEngage/100)
local ClRPMInfluence = math.max((_RPM-_Tune.IdleRPM)*_Tune.ClutchRPMMult/(_Tune.Redline-_Tune.IdleRPM),0)
if _Tune.ClutchMode == "New" then ClRPMInfluence = 0 end
_ClutchModulate = math.min(((((script.Parent.Values.Velocity.Value.Magnitude/_Tune.SpeedEngage)/math.abs(_CGear)) + ClRPMInfluence) - _ClutchKick), 1)
elseif _Tune.ClutchType == "CVT" or (_Tune.ClutchType == "TorqueConverter" and _Tune.TQLock) then
if (_GThrot-(_Tune.IdleThrottle/100)==0 and script.Parent.Values.Velocity.Value.Magnitude<_Tune.SpeedEngage) or (_GThrot-(_Tune.IdleThrottle/100)~=0 and (_RPM < _Tune.RPMEngage and _WheelRPM < _Tune.RPMEngage)) then
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100), 1)
else
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100)+(1-(_Tune.ClutchEngage/100)), 1)
end
elseif _Tune.ClutchType == "TorqueConverter" and not _Tune.TQLock then
_ClutchModulate = math.min((_RPM/_Tune.Redline)*0.7, 1)
end
if not _ClPressing then _Clutch = math.min(1-_ClutchModulate,1) else _Clutch = 1 end
_StallOK = (_Clutch<=0.01) or _StallOK
else
_StallOK = _Tune.Stall
_Clutch = script.Parent.Values.Clutch.Value
end
else
_StallOK = false
if not _ClPressing and not _Shifting then _Clutch = 0 else _Clutch = 1 end
end
local aRPM = math.max(math.min((_GoalRPM*_Clutch) + (_WheelRPM*(1-_Clutch)),_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/(_Tune.Flywheel*deltaTime),.9)
if _ClPressing then clutchP = 0 end
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
if _RPM<=(_Tune.IdleRPM/4) and _StallOK and (tick()-ticc>=0.2) then script.Parent.IsOn.Value = not _Tune.Stall end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
--Aspiration
local TPsi = _TPsi/_TCount
local _BThrot = _GThrot
if _Tune.Engine then
if _TCount~=0 and _TCount~=2 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T_BoostLag/(deltaTime)))*2))/TPsi)*15)
if _TBoost < 0.05 then _TBoost = 0.05 elseif _TBoost > 2 then _TBoost = 2 end
elseif _TCount==2 then
if _TBoost<1 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T_BoostLag/(deltaTime)))*2))/TPsi)*15)
elseif _TBoost>=1 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T2_BoostLag/(deltaTime)))*2))/TPsi)*15)
end
if _TBoost < 0.05 then _TBoost = 0.05 elseif _TBoost > 2 then _TBoost = 2 end
else
_TBoost = 0
end
if _SCount~=0 then
if _BThrot>sthrot then
sthrot=math.min(_BThrot,sthrot+_Tune.S_Sensitivity*deltaTime)
elseif _BThrot<sthrot then
sthrot=math.max(_BThrot,sthrot-_Tune.S_Sensitivity*deltaTime)
end
_SBoost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
else
_SBoost = 0
end
else
_TBoost = 0
_SBoost = 0
end
--Torque calculations
if _Tune.Engine then
local cTq = NCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_NT = cTq.Torque+(cTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
if _TCount~=0 then
local tTq = TCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_TH = (tTq.Horsepower+(tTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
_TT = (tTq.Torque+(tTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
else
_TH,_TT = 0,0
end
if _SCount~=0 then
local sTq = SCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_SH = (sTq.Horsepower+(sTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
_ST = (sTq.Torque+(sTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
else
_SH,_ST = 0,0
end
_BH = _TH+_SH
_BT = _TT+_ST
else
_NH,_NT = 0,0
_TH,_TT = 0,0
_SH,_ST = 0,0
_BH,_BT = 0,0
end
if _Tune.Electric and _CGear~=0 then
local eTq = ECache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(100,_RPM))/100)]
_EH = eTq.Horsepower+(eTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_ET = eTq.Torque+(eTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
else
_EH,_ET = 0,0
end
_HP = _NH + _BH + _EH
_OutTorque = _NT + _BT + _ET
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
local RRdiffMult=1
local RLdiffMult=1
local FRdiffMult=1
local FLdiffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--Differential/Torque-Vectoring
if _Tune.DifferentialType=='Old' then
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
else
if v.Name=="FR" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.FL.RotVelocity.Magnitude)-1)*(_Tune.FDiffPreload/10)
FRdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.FDiffPower/100)*avg*_GThrot) + ((_Tune.FDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
FLdiffMult=2-FRdiffMult
elseif v.Name=="FL" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.FR.RotVelocity.Magnitude)-1)*(_Tune.FDiffPreload/10)
FLdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.FDiffPower/100)*avg*_GThrot) + ((_Tune.FDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
FRdiffMult=2-FLdiffMult
elseif v.Name=="RR" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.RL.RotVelocity.Magnitude)-1)*(_Tune.RDiffPreload/10)
RRdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.RDiffPower/100)*avg*_GThrot) + ((_Tune.RDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
RLdiffMult=2-RRdiffMult
elseif v.Name=="RL" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.RR.RotVelocity.Magnitude)-1)*(_Tune.RDiffPreload/10)
RLdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.RDiffPower/100)*avg*_GThrot) + ((_Tune.RDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
RRdiffMult=2-RLdiffMult
end
end
_TCSActive = false
_ABSActive = false
--Output
--Apply Power
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
local brake = _GBrake
local clutch=1
if _ClPressing then clutch=0 end
local tq = _OutTorque
--Apply ABS
local tqABS = 1
if _ABS and brake>0 and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
_ABSActive = (tqABS<1)
local PBrakeV=0
if _PBrake==true then PBrakeV=1 else PBrakeV=0 end
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
--Apply AWD Vectoring
if _Tune.Config == "AWD" then
local bias = (_Tune.TorqueVector+1)/2
if string.find(v.Name,"F") then
tq = tq*(1-bias)
elseif string.find(v.Name,"R") then
tq = tq*bias
end
end
--Apply TCS
tqTCS = 1
if _TCS and throt>0 then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir=1
if _CGear==-1 then dir = -1 end--luaint edit
if _Tune.ClutchKick and car.DriveSeat.Velocity.Magnitude<_Tune.KickSpeedThreshold and _RPM>_Tune.Redline-_Tune.KickRPMThreshold and v["#BV"].MotorMaxTorque<1 then
tq = (tq*_Tune.KickMult)
end
local tqOUT = (tq/1.5)*(60/workspace:GetRealPhysicsFPS())*throt*tqTCS*on*clutch
if v.Name=='RR' then
v["#AV"].MotorMaxTorque=tqOUT*RRdiffMult*diffMult
elseif v.Name=='RL' then
v["#AV"].MotorMaxTorque=tqOUT*RLdiffMult*diffMult
elseif v.Name=='FR' then
v["#AV"].MotorMaxTorque=tqOUT*FRdiffMult*diffMult
elseif v.Name=='FL' then
v["#AV"].MotorMaxTorque=tqOUT*FLdiffMult*diffMult
else
v["#AV"].MotorMaxTorque=tqOUT*diffMult
end
v["#AV"].AngularVelocity=_spLimit*dir
if string.find(v.Name,"F") then
v["#BV"].MotorMaxTorque=(FBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(EBrakeForce*((1-throt)*(_RPM/_Tune.Redline)))+(PBrakeForceF*PBrakeV)
else
v["#BV"].MotorMaxTorque=(RBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(EBrakeForce*((1-throt)*(_RPM/_Tune.Redline)))+(PBrakeForceR*PBrakeV)
end
else--luaint edit
v["#AV"].MotorMaxTorque=0
v["#AV"].AngularVelocity=0
if string.find(v.Name,"F") then
v["#BV"].MotorMaxTorque=(FBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(PBrakeForceF*PBrakeV)
else
v["#BV"].MotorMaxTorque=(RBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(PBrakeForceR*PBrakeV)
end
end
end
end
--[[Flip]]
function Flip()
--Detect Orientation
if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
FlipWait=tick()
--Apply Flip
else
if tick()-FlipWait>=3 then
FlipDB=true
local gyro = car.DriveSeat.Flip
gyro.maxTorque = Vector3.new(10000,0,10000)
gyro.P=3000
gyro.D=500
wait(1)
gyro.maxTorque = Vector3.new(0,0,0)
gyro.P=0
gyro.D=0
FlipDB=false
end
end
end
--[[Run]]
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("Novena: AC6C Loaded - Version "..ver..", Update "..script.Parent.Version.Value)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Heartbeat:connect(function(dt)
--Update Internal Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
--Inputs
Inputs(dt)
--Steering
Steering(dt)
--Gear
Gear()
--Power
Engine(dt)
--Update External Values
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = ((_TBoost/2)*_TPsi)+((_SBoost/2)*_SPsi)
script.Parent.Values.BoostTurbo.Value = (_TBoost/2)*_TPsi
script.Parent.Values.BoostSuper.Value = (_SBoost/2)*_SPsi
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpElectric.Value = _EH
script.Parent.Values.HpTurbo.Value = _TH
script.Parent.Values.HpSuper.Value = _SH
script.Parent.Values.HpBoosted.Value = _BH
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.TqNatural.Value = _NT/_Tune.Ratios[_CGear+2]/fFD
script.Parent.Values.TqElectric.Value = _ET/_Tune.Ratios[_CGear+2]/fFD
script.Parent.Values.TqTurbo.Value = _TT/_Tune.Ratios[_CGear+2]/fFD
script.Parent.Values.TqSuper.Value = _ST/_Tune.Ratios[_CGear+2]/fFD
script.Parent.Values.TqBoosted.Value = script.Parent.Values.TqTurbo.Value+script.Parent.Values.TqSuper.Value
script.Parent.Values.Torque.Value = script.Parent.Values.TqNatural.Value+script.Parent.Values.TqElectric.Value+script.Parent.Values.TqBoosted.Value
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
if script.Parent.Values.AutoClutch.Value then
script.Parent.Values.Clutch.Value = _Clutch
end
script.Parent.Values.SteerC.Value = _GSteerC
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
--15 c/s
while wait(.0667) do
--Automatic Transmission
if _TMode == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
return function(p1, p2, ...)
local v1, v2 = ...;
local v3 = math.clamp(v2, 0, 1);
p1.desc.Text = v1;
p1.percent.Text = u1.Functions.Format.Round(v3 * 100) .. "%";
for v4 = 1, 5 do
p1.bars:FindFirstChild(v4).progress.Size = UDim2.new(math.clamp(v3 * 5 - (v4 - 1), 0, 1), 0, 1, 0);
end;
end;
|
-- Get reference to the Dock frame |
local dock = script.Parent.Parent.Wallpaper
|
--[[
Returns a boolean value of whether a plant fits in a pot based on the
plant size and the pot size. These sizes are pulled from attributes
on the plant and pot prefabs.
--]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Attribute = require(ReplicatedStorage.Source.SharedConstants.Attribute)
local ItemCategory = require(ReplicatedStorage.Source.SharedConstants.ItemCategory)
local getItemByIdInCategory = require(ReplicatedStorage.Source.Utility.Farm.getItemByIdInCategory)
local getAttribute = require(ReplicatedStorage.Source.Utility.getAttribute)
local function checkSeedFitsInPot(seedId: string, potId: string)
local seedModel = getItemByIdInCategory(seedId, ItemCategory.Seeds)
local potModel = getItemByIdInCategory(potId, ItemCategory.Pots)
local plantSize: number = getAttribute(seedModel, Attribute.PlantSize)
local potSize: number = getAttribute(potModel, Attribute.MaxPlantSize)
return plantSize <= potSize
end
return checkSeedFitsInPot
|
-- Depending on the player's preference, this fades away other players.
--
-- ForbiddenJ |
RunService = game:GetService("RunService")
FullyOpaqueDistance = 32
LocalPlayer = game.Players.LocalPlayer
GhostPlayersSetting = game.ReplicatedStorage.ClientConfig.GhostPlayers
PlayerCharacters = {} -- List of character models indexed by player objects.
function RegisterPlayer(player)
player.CharacterAdded:Connect(function(character)
PlayerCharacters[player] = character
if GhostPlayersSetting.Value == 2 then
SetTransparency(character, 1)
end
end)
player.CharacterRemoving:Connect(function(character)
PlayerCharacters[player] = nil
end)
PlayerCharacters[player] = player.Character
if player.Character ~= nil and GhostPlayersSetting.Value == 2 then
SetTransparency(player.Character, 1)
end
end
function SetTransparency(character, transparency)
assert(typeof(character) == "Instance" and character:IsA("Model"), "Must provide a valid Model.")
assert(typeof(transparency) == "number", "Must provide a valid number for transparency.")
local roundedTransparency = math.ceil(transparency * 10) / 10
if character ~= PlayerCharacters[LocalPlayer] then
for i, item in ipairs(character:GetDescendants()) do
if item:IsA("BasePart") then
item.LocalTransparencyModifier = roundedTransparency
end
end
end
end
function Update()
if GhostPlayersSetting.Value == 1 then
local playerTorso = PlayerCharacters[LocalPlayer] and PlayerCharacters[LocalPlayer]:FindFirstChild("HumanoidRootPart")
local playerPosition = playerTorso ~= nil and playerTorso.Position or Vector3.new(0, 0, 0)
for player, character in pairs(PlayerCharacters) do
if player ~= LocalPlayer then
local rootPart = character:FindFirstChild("HumanoidRootPart")
local magnitude = rootPart ~= nil and (rootPart.Position - playerPosition).Magnitude or FullyOpaqueDistance
local transparency = 1 - math.min(magnitude / FullyOpaqueDistance, 1)
SetTransparency(character, transparency)
end
end
end
end
for i, player in ipairs(game.Players:GetPlayers()) do
RegisterPlayer(player)
end
game.Players.PlayerAdded:Connect(RegisterPlayer)
GhostPlayersSetting.Changed:Connect(function(value)
if value == 0 then
for player, character in pairs(PlayerCharacters) do
SetTransparency(character, 0)
end
elseif value == 2 then
for player, character in pairs(PlayerCharacters) do
SetTransparency(character, 1)
end
end
end) |
--{{ Important Values }}-- |
local playerStats = script:WaitForChild("Value")
local change = script.Parent
|
----[[ Color Settings ]] |
module.BackGroundColor = Color3.new(0, 0, 0)
module.DefaultChatColor = Color3.new(1, 1, 1)
module.DefaultMessageColor = Color3.new(1, 1, 1)
module.DefaultNameColor = Color3.new(1, 1, 1)
module.ChatBarBackGroundColor = Color3.new(0, 0, 0)
module.ChatBarBoxColor = Color3.new(1, 1, 1)
module.ChatBarTextColor = Color3.new(0, 0, 0)
module.ChannelsTabUnselectedColor = Color3.new(0, 0, 0)
module.ChannelsTabSelectedColor = Color3.new(30/255, 30/255, 30/255)
module.DefaultChannelNameColor = Color3.fromRGB(35, 76, 142)
module.WhisperChannelNameColor = Color3.fromRGB(102, 14, 102)
module.ErrorMessageTextColor = Color3.fromRGB(245, 50, 50)
|
-- Decompiled with the Synapse X Luau decompiler. |
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
return function(p1, p2, ...)
local v1, v2 = ...;
p1.title.Text = v1;
if v2 == "Mythical" or v2 == "Exclusive" then
p1.title.TextColor3 = Color3.new(1, 1, 1);
u1.Assets.UI.Raritys:FindFirstChild(v2):Clone().Parent = p1.title;
end;
end;
|
-- Show where the red lines are going. You can change their colour and width in VisualizerCache |
local SHOW_DEBUG_RAY_LINES: boolean = false
|
--------------| 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 = 2; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 2; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 5; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = true; -- 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 = true; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = true; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- 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;
};
|
--[=[
@return Shake
Construct a new Shake instance.
]=] |
function Shake.new()
local self = setmetatable({}, Shake)
self.Amplitude = 1
self.Frequency = 1
self.FadeInTime = 1
self.FadeOutTime = 1
self.SustainTime = 0
self.Sustain = false
self.PositionInfluence = Vector3.one
self.RotationInfluence = Vector3.one
self.TimeFunction = if RunService:IsRunning() then time else os.clock
self._timeOffset = rng:NextNumber(-1e9, 1e9)
self._startTime = 0
self._trove = Trove.new()
self._running = false
return self
end
|
--game:GetService("UserInputService").InputBegan:Connect(function(input,gp)
-- local c = 0 | |
-- Builds a set of runnable Tweens from a table of instances and values |
local function BuildTweens(root, tweenTable, origin)
local tweens = {}
local initialFrame
local initialPos, initialRot, originPos, originRot
local center
if origin ~= nil then
if root:IsA("Model") then
center = root.PrimaryPart
if center == nil then
error("Root Model must have a PrimaryPart to use SetOrigin.")
end
elseif root:IsA("BasePart") then
center = root
else
error("Root must be a BasePart or Model to use SetOrigin.")
end
initialFrame = center.CFrame:inverse()
initialPos = initialFrame.Position
initialRot = initialFrame - initialPos
originPos = origin.Position
originRot = origin - originPos
end
VisitAllInstances(root, tweenTable, function(instance, props)
for prop, values in pairs(props) do
if origin and instance:IsA("BasePart") then
local newValue = ApplyOrigin(prop, values.InitialValue, initialFrame, origin)
if newValue then
values.InitialValue = newValue
end
end
local keyframes = values.Keyframes
local lastTime = 0
for _, keyframe in ipairs(keyframes) do
if origin and instance:IsA("BasePart") then
local newValue = ApplyOrigin(prop, keyframe.Value, initialFrame, origin)
if newValue then
keyframe.Value = newValue
end
end
local tweenInfo = TweenInfo.new(keyframe.Time - lastTime,
keyframe.EasingStyle,keyframe.EasingDirection, 0, false, 0)
local propTable = {
[prop] = keyframe.Value
}
local tween = TweenService:Create(instance, tweenInfo, propTable)
table.insert(tweens, {
Tween = tween,
DelayTime = lastTime,
})
lastTime = keyframe.Time
end
end
end)
return tweens
end
local TweenUtilities = {}
TweenUtilities.__index = TweenUtilities
function TweenUtilities.new(root, tweenTable)
local self = {
running = false,
root = root,
tweenTable = tweenTable,
tweens = BuildTweens(root, tweenTable),
origin = nil,
}
setmetatable(self, TweenUtilities)
return self
end
function TweenUtilities:ResetValues()
if self.origin then
if self.root:IsA("Model") then
if self.root.PrimaryPart == nil then
error("Root Model must have a PrimaryPart to use SetOrigin.")
end
self.root:SetPrimaryPartCFrame(self.origin)
elseif self.root:IsA("BasePart") then
self.root.CFrame = self.origin
else
error("Root must be a BasePart or Model to use SetOrigin.")
end
end
VisitAllInstances(self.root, self.tweenTable, function(instance, props)
for prop, values in pairs(props) do
local initialValue = values.InitialValue
instance[prop] = initialValue
end
end)
end
function TweenUtilities:SetOrigin(origin)
if self.running then
error("Cannot SetOrigin while the animation is running.")
end
self.origin = origin
self.tweens = BuildTweens(self.root, self.tweenTable, origin)
end
function TweenUtilities:PlayTweens(callback)
if self.running then
self:PauseTweens()
end
self.running = true
local delayedTweens = {}
for _, props in pairs(self.tweens) do
local tween = props.Tween
local delayTime = props.DelayTime
if delayTime == 0 then
tween:Play()
else
table.insert(delayedTweens, {
Tween = tween,
DelayTime = delayTime,
Playing = false,
})
end
end
local heartbeatConnection
local start = tick()
local tweensDone = false
heartbeatConnection = RunService.Heartbeat:Connect(function()
local now = tick() - start
if not self.running then
self.running = false
heartbeatConnection:Disconnect()
if callback then
callback()
end
return
end
if tweensDone then
local allDone = true
for _, props in pairs(self.tweens) do
local tween = props.Tween
if tween.PlaybackState == Enum.PlaybackState.Playing then
allDone = false
end
end
if allDone then
self.running = false
heartbeatConnection:Disconnect()
if callback then
callback()
end
return
end
else
local allPlaying = true
for _, props in pairs(delayedTweens) do
if not props.Playing then
if now > props.DelayTime then
props.Playing = true
props.Tween:Play()
else
allPlaying = false
end
end
end
tweensDone = allPlaying
end
end)
end
function TweenUtilities:PauseTweens()
self.running = false
for _, props in pairs(self.tweens) do
local tween = props.Tween
tween:Cancel()
end
end
return TweenUtilities
|
-- Luke |
local uis = game:GetService('UserInputService')
local tweenService = game:GetService('TweenService')
local runService = game:GetService('RunService')
local playersService = game:GetService('Players')
local localPlayer = playersService.LocalPlayer
local gui = script:WaitForChild('TokenTransitionGui')
local viewportFrame = gui:WaitForChild('ViewportFrame')
local tokenModel = viewportFrame:WaitForChild('Token')
local glowPart = viewportFrame:WaitForChild('GlowPart')
local glowDecal = glowPart:WaitForChild('GlowDecal')
local background = gui:WaitForChild('Background')
local sound = gui:WaitForChild('FlySound')
local camera = Instance.new('Camera')
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(0,0,0)
camera.FieldOfView = 40
camera.Parent = viewportFrame
viewportFrame.CurrentCamera = camera
local DISABLE_TIME = 3
local TOKEN_SPIN_RATE = -.25
local CLICK_VELOCITY = .3
local SPIN_DAMPER = .15
local MAX_SPEED = 1.5
local ICON_FADE_IN_TIME = 2
local ICON_FADE_OUT_TIME = 3
local rng = Random.new()
local qpi = math.pi*.5
local tau = math.pi*2
local enabled = false
local changeIndex = 0
local renderstepBound = false
local inputConnection = nil
local requestedBadge = false
local tokenOriginalCF = tokenModel.PrimaryPart.CFrame
local tokenPartCFrames = {}
for _,child in pairs(tokenModel:GetDescendants()) do
if child:IsA("BasePart") and child ~= tokenModel.PrimaryPart then
tokenPartCFrames[child] = child.CFrame:ToObjectSpace(tokenModel.PrimaryPart.CFrame)
end
end
local spin = 0
local spinVelocity = 0
function spinToken(delta)
--local spin = os.clock()*tau*TOKEN_SPIN_RATE
spin = (spin + delta*tau*(TOKEN_SPIN_RATE+spinVelocity))%tau
if math.abs(spinVelocity) < delta*SPIN_DAMPER then
spinVelocity = 0
else
spinVelocity = spinVelocity - delta * SPIN_DAMPER * math.sign(spinVelocity)
end
local newCFrame = tokenOriginalCF * CFrame.Angles(0, spin, 0)
tokenModel.PrimaryPart.CFrame = newCFrame
for tokenModelPart, cframeOffset in pairs(tokenPartCFrames) do
tokenModelPart.CFrame = newCFrame * cframeOffset
end
local glownessPercent = math.sin(spin*2+qpi)*.5+.5
glowDecal.Transparency = .75+.1*(1-glownessPercent)
local width = 7.5+1*glownessPercent
glowPart.Size = Vector3.new(width, .01, width)
end
function requestBadge()
if not requestedBadge then --TODO: replace with a debounce timer
requestedBadge = true
--TODO: request badge
end
end
function spinAction(direction)
spinVelocity = math.clamp(spinVelocity + CLICK_VELOCITY*direction, -MAX_SPEED, MAX_SPEED)
requestBadge()
end
local leftControls = {
[Enum.KeyCode.DPadLeft] = true,
[Enum.KeyCode.ButtonL1] = true,
[Enum.KeyCode.A] = true,
[Enum.KeyCode.Left] = true,
}
local rightControls = {
[Enum.KeyCode.DPadRight] = true,
[Enum.KeyCode.ButtonR1] = true,
[Enum.KeyCode.D] = true,
[Enum.KeyCode.Right] = true,
}
function handleInput(input, processed)
if input and input.UserInputState == Enum.UserInputState.Begin then
if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
local direction = math.sign(input.Position.X - viewportFrame.AbsoluteSize.X*.5)
spinAction(direction)
elseif input.UserInputType == Enum.UserInputType.Gamepad1 or input.UserInputType == Enum.UserInputType.Keyboard then
if leftControls[input.KeyCode] then
spinAction(-1)
elseif rightControls[input.KeyCode] then
spinAction(1)
end
end
end
end
function enable(spinControl)
local playerGui = localPlayer:FindFirstChild('PlayerGui')
if not enabled and playerGui then
enabled = true
changeIndex = changeIndex + 1
local thisChangeIndex = changeIndex
if not gui.Enabled then
spin = tau*.9 -- Initial rotation
spinVelocity = 0
background.BackgroundTransparency = 1
camera.CFrame = CFrame.new(-7,0,-10)
end
viewportFrame.ImageTransparency = 0
viewportFrame.Visible = true
gui.Parent = playerGui
gui.Enabled = true
sound.PlaybackSpeed = .5
sound.Volume = .5
sound:Play()
if not renderstepBound then
renderstepBound = true
runService:BindToRenderStep('TokenTransition', Enum.RenderPriority.Camera.Value-1, spinToken)
end
tweenService:Create(sound,
TweenInfo.new(DISABLE_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['Volume'] = .5,}
):Play()
tweenService:Create(viewportFrame,
TweenInfo.new(.1, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['ImageTransparency'] = 0,}
):Play()
tweenService:Create(camera,
TweenInfo.new(1.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{['CFrame'] = CFrame.new(0,0,-10),}
):Play()
task.delay(1.5, function()
if thisChangeIndex == changeIndex then
if inputConnection then
inputConnection:Disconnect()
inputConnection = nil
end
if spinControl then
inputConnection = uis.InputBegan:connect(handleInput)
end
tweenService:Create(background,
TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{['BackgroundTransparency'] = 0,}
):Play()
tweenService:Create(camera,
TweenInfo.new(4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut),
{['CFrame'] = CFrame.new(0,0,0),}
):Play()
end
end)
end
end
function disable()
local playerGui = localPlayer:FindFirstChild('PlayerGui')
if enabled and playerGui then
enabled = false
changeIndex = changeIndex + 1
local thisChangeIndex = changeIndex
if inputConnection then
inputConnection:Disconnect()
inputConnection = nil
end
sound.PlaybackSpeed = .5
sound:Play()
tweenService:Create(sound,
TweenInfo.new(DISABLE_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['Volume'] = 0,}
):Play()
tweenService:Create(camera,
TweenInfo.new(DISABLE_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['CFrame'] = CFrame.new(0,0,300),}
):Play()
tweenService:Create(background,
TweenInfo.new(DISABLE_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['BackgroundTransparency'] = 1,}
):Play()
tweenService:Create(viewportFrame,
TweenInfo.new(DISABLE_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['ImageTransparency'] = 1,}
):Play()
task.delay(DISABLE_TIME, function()
if thisChangeIndex == changeIndex then
for _,iconLabel in pairs(gui:GetChildren()) do
if iconLabel and iconLabel.Parent and iconLabel.Name == 'CleaningUpIcon' or iconLabel.Name == 'Icon' then
iconLabel:Destroy()
end
end
gui.Enabled = false
gui.ViewportFrame.Visible = false
gui.Parent = script
if not renderstepBound then
renderstepBound = false
runService:UnbindFromRenderStep('TokenTransition')
end
end
end)
end
end
local module = {
Enable = enable,
Disable = disable,
}
return module
|
-- Calls Destroy on this script's Parent after TimeToLive |
while not script:FindFirstChild("TimeToLive") do wait() end -- Irony
wait(script.TimeToLive.Value)
if script.Parent then script.Parent:Destroy() end
|
-- Function to bind to equip event |
local function equip()
local torso = player.Character.Torso
-- Setup joint variables
neck = torso.Neck
oldNeckC0 = neck.C0
shoulder = torso:FindFirstChild("Right Shoulder")
oldShoulderC0 = shoulder.C0
-- Remember old mouse icon and update current
oldIcon = mouse.Icon
mouse.Icon = "http://www.roblox.com/asset/?id=79658449"
-- Bind TouchMoved event if on mobile. Otherwise connect to renderstepped
if userInputService.TouchEnabled then
connection = userInputService.TouchMoved:connect(mobileFrame)
else
connection = render:connect(pcFrame)
end
-- Bind TouchStarted and TouchEnded. Used to determine if character should rotate
-- during touch input
userInputService.TouchStarted:connect(function(touch, processed)
mobileShouldTrack = not processed
end)
userInputService.TouchEnded:connect(function(touch, processed)
mobileShouldTrack = false
end)
-- Fire server's equip event
game.ReplicatedStorage.ROBLOX_PistolEquipEvent:FireServer()
-- Bind event for when mouse is clicked to fire server's fire event
mouse.Button1Down:connect(function()
game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p)
end)
-- Bind reload event to mobile button and r key
contextActionService:BindActionToInputTypes("Reload", function()
game.ReplicatedStorage.ROBLOX_PistolReloadEvent:FireServer()
end, true, "r")
-- If game uses filtering enabled then need to update server while tool is
-- held by character.
if workspace.FilteringEnabled then
while connection do
wait()
game.ReplicatedStorage.ROBLOX_PistolUpdateEvent:FireServer(neck.C0, shoulder.C0)
end
end
end
|
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]] | --
function onTouched(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
game:GetService("TeleportService"):Teleport(4641921091,player) --replace the numbers with your place id
end
end
script.Parent.Torso.Touched:connect(onTouched)
|
--[=[
Creates a new Blend State which is actually just a ValueObject underneath.
@param defaultValue T
@param checkType string | nil
@return ValueObject<T>
]=] |
function Blend.State(defaultValue, checkType)
return ValueObject.new(defaultValue, checkType)
end
|
--End of example plugin
----------------------------------------------------------------------------
--[[
--Below are some real plugins that are functional.
--As another example I have included a plugin that will change the permissions of specific commands. You can see it below.
return function(set)
--make the table that holds our new perms and what command they are for
local coms={
{cmd='insert',perms=5};
{cmd='m',perms=5};
{cmd='gear',perms=5};
} --Changes insert, m, and gear to place owners only.
--These are the commandss and the new permission level, refer to the top of Example Plugin for perm levels.
-- Do note the cmd HAS to be the command thats shown in :cmds command, so if you want tornado to
-- be usable by the game owner only you would put {cmd='tornado',perms=5}; but you CAN NOT user twister instead of tornado.
for i=1,#set.Commands do --grab commands, for i,v in pairs for some reason does not like to work for this
coroutine.wrap(function() --wrap it to make the process go a little faster overall
for k,v in pairs(coms) do --grab our table with the new command perms
if v.cmd==set.Commands[i].Cmds[1] then -- if the cmd is the same as the first cmd of the target command then...
set.Commands[i].AdminLevel=v.perms --set its admin level to our intended one.
end
end
end)()
end
end
------------------------------------------------------------------------
below is a plugin I made for an automated barista bot that allows it to get chats from
the admin script and send them to the barista bot for processing, for server to server
communication like this its recommended to use bindable events, for more information here
is the bindable event roblox wiki link: http://wiki.roblox.com/index.php?title=Bindableevent
return function(set)
local barista
for i,v in pairs(workspace:children()) do
if v.Name=='Jessica' and v:IsA('Model') and v:FindFirstChild('BaristaStuff') then barista=v end
end --find the barista
local backup=barista:Clone() --make a backup of the barista
set.MakePluginEvent('Chat',function(msg,plr) --Add a new function to run on chat for the plugin
local sendchat=barista.BaristaStuff.Event --Declare the event
sendchat:Fire(msg,plr) --send the chat to the barista
end)
--lets make the reset and on/off commands
set.MakeCommand('Reset Barista',2,set.Prefix,{'resetbarista','fixbarista'},{},0,function(plr,args)
barista:Destroy() --destroy old barista
barista=backup:Clone() --clone the backup
barista.Parent=workspace --put it in workspace
barista:MakeJoints() --make some joints
end)
set.MakeCommand('Turn Barista On/Off',3,set.Prefix,{'barista'},{'on/off'},1,function(plr,args)
if args[1]=='off' then
barista:Destroy()
elseif args[1]=='on' then
barista=backup:Clone()
barista.Parent=workspace
barista:MakeJoints()
end
end)--does basically the same stuff as reset.
end
--]] | |
-----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
-----!Instructions!-----
--Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
--Just place this script into any gun and edit the values below.--
--Editting anything else will risk breaking it.--
------------------------ |
Damage = 17
SPS = 18 -- Shots Per Second, gives a limit of how fast the gun shoots.
Recoil = 4 -- [1-10] [1 = Minigun, 10 = Sniper]
WallShoot = false -- Shoots through walls.
GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
BulletColor = "Cool yellow" -- Any Brickcolor will work.
Flash = true |
--[=[
Returns a tuple of fire, fail and complete functions which
can be chained into the the next subscription.
```lua
return function(source)
return Observable.new(function(sub)
sub:Fire("hi")
return source:Subscribe(sub:GetFireFailComplete())
end)
end
```
@return function
@return function
@return function
]=] |
function Subscription:GetFireFailComplete()
return function(...)
self:Fire(...)
end, function(...)
self:Fail(...)
end, function(...)
self:Complete(...)
end
end
|
--[[
Returns false if the given table has any of the following:
- a key that is neither a number or a string
- a mix of number and string keys
- number keys which are not exactly 1..#t
]] |
return function(t)
local containsNumberKey = false
local containsStringKey = false
local numberConsistency = true
local index = 1
for x, _ in pairs(t) do
if type(x) == 'string' then
containsStringKey = true
elseif type(x) == 'number' then
if index ~= x then
numberConsistency = false
end
containsNumberKey = true
else
return false
end
if containsStringKey and containsNumberKey then
return false
end
index = index + 1
end
if containsNumberKey then
return numberConsistency
end
return true
end
|
--[[ Main Script ]] | --
Players = game:GetService("Players")
Workspace = game:GetService("Workspace")
Seat = script.Parent
GUI = script.GUI
Active = false
Player = nil
NewGui = nil
Seat.ChildAdded:connect(function(Child)
if Active == false then
if Child.Name == "SeatWeld" then
Active = true
Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
if Player ~= nil then
PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui ~= nil then
NewGui = GUI:Clone()
NewGui.Parent = PlayerGui
end
end
end
end
end)
Seat.ChildRemoved:connect(function(child)
if child.Name == "SeatWeld" then
if Active == true then
Active = false
pcall(function() NewGui:Destroy() end)
Player = nil
NewGui = nil
end
end
end)
|
--- Returns Maid[key] if not part of Maid metatable
-- @return Maid[key] value |
function Maid:__index(Index)
if Maid[Index] then
return Maid[Index]
else
return self.Tasks[Index]
end
end
|
-- Define the tool's color |
Tools.NewPart.Color = BrickColor.new( "Really black" );
|
-- MODULES --- |
local Remotes = require(ReplicatedStorage.Remotes)
local DataService = require(game.ServerScriptService.Services.DataService)
|
-- / world / -- |
local world = workspace.World
local temp = world.Temp
|
--boolean IsValid
--* returns whether this response is available.
--* if we have a condition set, we use it. |
function Response:IsValid()
if self.Condition then
return self.Condition(self.Graph.ConversingPlayer, self.Graph.DialogueFolder)
end
return true
end
return Response
|
-- Remote variables |
local RemoteFolder = script.Parent.Parent:WaitForChild("RemoteEvents")
local TiltRemote = RemoteFolder:WaitForChild("TiltRemote")
local PlaySound = RemoteFolder:WaitForChild("PlaySound")
local StopSound = RemoteFolder:WaitForChild("StopSound")
local ChangeSound = RemoteFolder:WaitForChild("ChangeSound")
local AnchorSegway = RemoteFolder:WaitForChild("AnchorSegway")
local UndoTags = RemoteFolder:WaitForChild("UndoTags")
local UndoHasWelded = RemoteFolder:WaitForChild("UndoHasWelded")
local DeleteWelds = RemoteFolder:WaitForChild("DeleteWelds")
local ConfigHumanoid = RemoteFolder:WaitForChild("ConfigHumanoid")
local ConfigLights = RemoteFolder:WaitForChild("ConfigLights")
|
--inputS.TouchEnded:Connect(function(object)
-- if object == Enum.KeyCode.DPadUp or seat.Throttle == 0 or seat.Throttle == -1 then
-- w=false
-- elseif object == Enum.KeyCode.DPadLeft or seat.Steer == 0 or seat.Steer == 1 then
-- a=false
-- elseif object == Enum.KeyCode.DPadDown or seat.Throttle == 0 or seat.Throttle == 1 then
-- s=false
-- elseif object == Enum.KeyCode.DPadRight or seat.Steer == 0 or seat.Steer == -1 then
-- d=false
-- end
--end) |
mouse.Move:connect(function()
if not engine:FindFirstChild("BodyGyro") then
local gyro=engine.BodyGyro
gyro.cframe = mouse.Hit
end
end)
mouse.Button1Down:Connect(function()
firing:FireServer(true,mouse.Hit,mouse.Target)
end)
mouse.Button1Up:Connect(function()
firing:FireServer(false,mouse.Hit,mouse.Target)
end)
function rotorSpd(spd)
rotor1.TopParamA=-spd
rotor1.TopParamB=spd
rotor2.BottomParamA=-spd
rotor2.BottomParamB=spd
end
local chg=Vector3.new(0,0,0)
local rot=0
local inc=0
while wait(.1) do
local lv=engine.CFrame.lookVector
local Vector = ControlModule:GetMoveVector() |
--local KeySequence = game:GetService("KeyframeSequenceProvider")
--humanoid.Animation.AnimationId = KeySequence:RegisterKeyframeSequence(humanoid.OrangeJustice) |
humanoid:LoadAnimation(humanoid.Animation):Play()
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name |
return function(data)
local gui = script.Parent.Parent
local bar = gui.TextLabel
local playergui = service.PlayerGui
--[[
local TopbarMatchAdmin = client.GetReturn("Setting","TopbarMatchAdmin")
local TopbarColor = client.GetReturn("Setting","TopbarColor")
local TopbarTransparency = client.GetReturn("Setting","TopbarTransparency")
local TopbarText = client.GetReturn("Setting","TopbarText")
if not TopbarMatchAdmin then
local text=TopbarText
if text=="%TIME" then
cPcall(function()
repeat
local t4=GetTime()
local nt4
local hour=t4:match("%d+")
if tonumber(hour)>12 or tonumber(hour)<1 then
nt4=math.abs(tonumber(hour)-12)..t4:match(":%d+").." PM"
else
nt4=t4.." AM"
end
bar.Text=t4.." / "..nt4
until not wait(1)
end)
else
bar.Text=TopbarText
end
bar.BackgroundColor3=TopbarColor
bar.BorderSizePixel=0
bar.BackgroundTransparency=TopbarTransparency
end
--]]
--bar.Position=UDim2.new(0,0,0,-35)
gTable:Ready()
end
|
-- theObj : (variant) the table with values to print |
return function(theObj)
local function printAll(t, spaceIndex)
if not spaceIndex then
spaceIndex = 0
elseif spaceIndex > 10 then
return "... tree too deep ..."
end
local spacer = string.rep(" ", spaceIndex)
local outStr
if not t then
outStr = "nil"
elseif type(t) == "table" then
local parts = {}
table.insert(parts, "{")
for k, v in pairs(t) do
local substr = string.format("%s%s : %s", spacer, tostring(k), printAll(v, spaceIndex + 1))
table.insert(parts, substr)
end
table.insert(parts, string.format("%s}", spacer))
outStr = table.concat(parts, "\n")
else
outStr = string.format("<%s> - %s", type(t), tostring(t))
end
return string.format("%s", outStr)
end
local outString = table.concat({
" ********************************* ",
printAll(theObj),
" ********************************* "
}, "\n")
return outString
end
|
-- Force direction |
function EjectionForce.CalculateForce()
return Vector3.new(
math.random(95,135) / 10, -- Side to side
math.random(45,55) / 10, -- Up
-math.random(75,85) / 10 -- Front
)
end
|
----------------------------------------------------------------------------------------------------
--------------------=[ 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, -.9) * 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
|
-------- |
SYNC_RATE:Connect(function()
for Index, Object in ipairs(ActiveHitboxes) do
if Object.deleted then
Handler:remove(Object.object)
else
for _, Point in ipairs(Object.points) do
if not Object.active then
Point.LastPosition = nil
else
local rayStart, rayDir, RelativePointToWorld = Point.solver:solve(Point, Object.debugMode)
local raycastResult = workspace:Raycast(rayStart, rayDir, Object.raycastParams)
Point.solver:lastPosition(Point, RelativePointToWorld)
if raycastResult then
local hitPart = raycastResult.Instance
local findModel = not Object.partMode and hitPart:FindFirstAncestorOfClass("Model")
local humanoid = findModel and findModel:FindFirstChildOfClass("Humanoid")
local target = humanoid or (Object.partMode and hitPart)
if target and not Object.targetsHit[target] then
Object.targetsHit[target] = true
Object.OnHit:Fire(hitPart, humanoid, raycastResult, Point.group)
end
end
if Object.endTime > 0 then
if Object.endTime <= clock() then
Object.endTime = 0
Object:HitStop()
end
end
Object.OnUpdate:Fire(Point.LastPosition)
end
end
end
end
end)
return Handler
|
--[[Engine]] |
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
--Horsepower Curve
local fgc_h=_Tune.Horsepower/100
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
--Output Cache
local CacheTorque = false
local HPCache = {}
local HPInc = 100
if CacheTorque then
for gear,ratio in pairs(_Tune.Ratios) do
local hpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/HPInc),math.ceil(((script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline)+100)/HPInc) do
local tqPlot = {}
tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*HPInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*HPInc,gear-2)
tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(HPInc/1000)
tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(HPInc/1000)
hpPlot[rpm] = tqPlot
end
table.insert(HPCache,hpPlot)
end
end
--Powertrain
--Update RPM
function RPM()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,(script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline)+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>(script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline) then
_RPM = _RPM-(script.Parent.Values.LaunchMode.Value == true and 0 or script.Parent.Values.LaunchMode.Value == false and _Tune.RevBounce)*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,(script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline)+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = ((script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline)+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>(script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline) then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-(script.Parent.Values.LaunchMode.Value == true and 0 or script.Parent.Values.LaunchMode.Value == false and _Tune.RevBounce)
else
_RPM = _RPM-(script.Parent.Values.LaunchMode.Value == true and 0 or script.Parent.Values.LaunchMode.Value == false and _Tune.RevBounce)*.5
end
end
end
--Apply Power
function Engine()
--Get Torque
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min((script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline),math.max(_Tune.IdleRPM,_RPM))/HPInc)]
_HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
_OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,(script.Parent.Values.LaunchMode.Value == true and script.Parent.Values.LaunchRedline.Value or script.Parent.Values.LaunchMode.Value == false and _Tune.Redline)+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > (math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD)) or script.Parent.Values.RPM.Value > 4000 and script.Parent.Values.PreShift.Value == true then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) and script.Parent.Values.PreShift.Value == false then
_CGear=math.max(_CGear-1,1)
elseif script.Parent.Values.RPM.Value < 2000 and script.Parent.Values.PreShift.Value == true then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
--// End Viewport |
function RotateViewportModule:EndViewport()
if (event) then
event:Disconnect()
end
end
|
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts. |
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
xSize = xSize or BaseFrame.AbsoluteSize.X
local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
if textBoundsSize.Y ~= math.floor(textBoundsSize.Y) then
-- HACK Alert. TODO: Remove this when we switch UDim2 to use float Offsets
-- This is nessary due to rounding issues on mobile devices when translating between screen pixels and native pixels
return textBoundsSize.Y + 1
end
return textBoundsSize.Y
end
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize = self:GetStringTextBounds(str, font, textSize)
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
function methods:CreateBaseMessage(message, font, textSize, chatColor)
local BaseFrame = self:GetFromObjectPool("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 0, 18)
BaseFrame.Visible = true
BaseFrame.BackgroundTransparency = 1
local messageBorder = 8
local BaseMessage = self:GetFromObjectPool("TextLabel")
BaseMessage.Selectable = false
BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
BaseMessage.BackgroundTransparency = 1
BaseMessage.Font = font
BaseMessage.TextSize = textSize
BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
BaseMessage.TextTransparency = 0
BaseMessage.TextStrokeTransparency = 0.75
BaseMessage.TextColor3 = chatColor
BaseMessage.TextWrapped = true
BaseMessage.ClipsDescendants = true
BaseMessage.Text = message
BaseMessage.Visible = true
BaseMessage.Parent = BaseFrame
return BaseFrame, BaseMessage
end
function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
local NameButton = self:GetFromObjectPool("TextButton")
NameButton.Selectable = false
NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
NameButton.Position = UDim2.new(0, 0, 0, 0)
NameButton.BackgroundTransparency = 1
NameButton.Font = BaseMessage.Font
NameButton.TextSize = BaseMessage.TextSize
NameButton.TextXAlignment = BaseMessage.TextXAlignment
NameButton.TextYAlignment = BaseMessage.TextYAlignment
NameButton.TextTransparency = BaseMessage.TextTransparency
NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
NameButton.TextColor3 = nameColor
NameButton.Text = formatName
NameButton.Visible = true
NameButton.Parent = BaseMessage
local clickedConn = NameButton.MouseButton1Click:connect(function()
self:NameButtonClicked(NameButton, playerName)
end)
local changedConn = nil
changedConn = NameButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return NameButton
end
function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
local ChannelButton = self:GetFromObjectPool("TextButton")
ChannelButton.Selectable = false
ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
ChannelButton.Position = UDim2.new(0, 0, 0, 0)
ChannelButton.BackgroundTransparency = 1
ChannelButton.Font = BaseMessage.Font
ChannelButton.TextSize = BaseMessage.TextSize
ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
ChannelButton.TextTransparency = BaseMessage.TextTransparency
ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
ChannelButton.TextColor3 = channelColor
ChannelButton.Text = formatChannelName
ChannelButton.Visible = true
ChannelButton.Parent = BaseMessage
local clickedConn = ChannelButton.MouseButton1Click:connect(function()
self:ChannelButtonClicked(ChannelButton, channelName)
end)
local changedConn = nil
changedConn = ChannelButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return ChannelButton
end
function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText, tagGradient)
local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
local TagLabel = self:GetFromObjectPool("TextLabel")
TagLabel.Selectable = false
TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
TagLabel.Position = UDim2.new(0, 0, 0, 0)
TagLabel.BackgroundTransparency = 1
TagLabel.Font = BaseMessage.Font
TagLabel.TextSize = BaseMessage.TextSize
TagLabel.TextXAlignment = BaseMessage.TextXAlignment
TagLabel.TextYAlignment = BaseMessage.TextYAlignment
TagLabel.TextTransparency = BaseMessage.TextTransparency
TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
TagLabel.TextColor3 = tagColor
TagLabel.Text = formatTagText
TagLabel.Visible = true
TagLabel.Parent = BaseMessage
if tagGradient ~= nil then
tagGradient:Clone().Parent = TagLabel
end
return TagLabel
end
function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
function methods:NameButtonClicked(nameButton, playerName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnPlayerNameToWhisper then
local player = Players:FindFirstChild(playerName)
if player and player ~= LocalPlayer then
local whisperChannel = GetWhisperChannelPrefix() ..playerName
if self.ChatWindow:GetChannel(whisperChannel) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= whisperChannel then
self.ChatWindow:SwitchCurrentChannel(whisperChannel)
end
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
elseif not self.ChatBar:IsInCustomState() then
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
end
end
end
end
function methods:ChannelButtonClicked(channelButton, channelName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnChannelNameToSetMainChannel then
if self.ChatWindow:GetChannel(channelName) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= channelName then
self.ChatWindow:SwitchCurrentChannel(channelName)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
end
end
end
function methods:RegisterChatWindow(chatWindow)
self.ChatWindow = chatWindow
self.ChatBar = chatWindow:GetChatBar()
end
function methods:GetFromObjectPool(className)
if self.ObjectPool == nil then
return Instance.new(className)
end
return self.ObjectPool:GetInstance(className)
end
function methods:RegisterObjectPool(objectPool)
self.ObjectPool = objectPool
end
|
--[[Brakes]] |
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 10 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2500 -- Front brake force
Tune.RBrakeForce = 2000 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
-- Enable CoreGui |
StarterGui = game:GetService('StarterGui')
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,true)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
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 throt=0
local redline=0
script:WaitForChild("Rev")
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
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
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 Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
end
|
--owner.CameraMode = "LockFirstPerson" |
local part = Instance.new("Part", owner.Character.Head)
part.Size = Vector3.new(0.1,0.1,0.1)
part.Transparency = 1
part.CanCollide = false
part.Name = "camera"
part:BreakJoints()
local weld = Instance.new("Weld", part)
weld.Part0 = owner.Character.Head
weld.Part1 = part
weld.C0 = CFrame.new(0,0,-1)
cangoup = true
rolling = false
while game:GetService("RunService").RenderStepped:wait() do
if (workspace.CurrentCamera.CFrame.p - part.Position).magnitude <= 1.7 then
game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position,Vector3.new(mouse.Hit.p.x,game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.Position.y,mouse.Hit.p.z))
workspace.CurrentCamera.FieldOfView = 80
for i,v in pairs(owner.Character:GetChildren()) do
if v.ClassName == "Part" or v.ClassName == "MeshPart" and v.Name ~= "Head" then
v.LocalTransparencyModifier = 0
end
if v.ClassName == "Accessory" then
v.Handle.Transparency = 1
end
end
if owner.Character.Head:findFirstChildOfClass("Decal") then
owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 1
end
owner.Character.Head.Transparency = 1
workspace.CurrentCamera.CameraSubject = part
else
for i,v in pairs(owner.Character:GetChildren()) do
if v.ClassName == "Accessory" then
v.Handle.Transparency = 0
end
end
workspace.CurrentCamera.FieldOfView = 70
owner.Character.Head.Transparency = 0
if owner.Character.Head:findFirstChildOfClass("Decal") then
owner.Character.Head:findFirstChildOfClass("Decal").Transparency = 0
end
workspace.CurrentCamera.CameraSubject = owner.Character
end
end
|
--TextStuff |
local Text = script.Parent
Text.Text = RebirthLevel.Value
RebirthLevel.Changed:Connect(function()
Text.Text = RebirthLevel.Value
end)
|
--[=[
Returns a boolean determining if the object is a ScriptSignal.
```lua
local janitor = Janitor.new()
local signal = ScriptSignal.new()
ScriptSignal.Is(signal) -> true
ScriptSignal.Is(janitor) -> false
```
@param object any
@return boolean
@ignore
]=] |
function ScriptSignal.Is(object): boolean
return typeof(object) == 'table'
and getmetatable(object) == ScriptSignal
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__math_pi__1 = math.pi;
local u2 = math.pi * 2;
return function(p1, p2)
local v1 = p2 - p1;
if l__math_pi__1 < v1 then
return v1 - u2;
end;
if v1 < -l__math_pi__1 then
v1 = v1 + u2;
end;
return v1;
end;
|
-- /**
-- * Handles more complex objects ( such as objects with circular references.
-- * maps and sets etc )
-- */ |
local function printComplexValue(
val: any,
config: Config,
indentation: string,
depth: number,
refs: Refs,
hasCalledToJSON: boolean?
): string
if table.find(refs, val) ~= nil then
return "[Circular]"
end
refs = { unpack(refs) }
table.insert(refs, val)
depth = depth + 1
local hitMaxDepth = depth > config.maxDepth
local min = config.min
if
config.callToJSON
and not hitMaxDepth
and val.toJSON
and typeof(val.toJSON) == "function"
and not hasCalledToJSON
then
return printer(val.toJSON(), config, indentation, depth, refs, true)
end
-- ROBLOX deviation start: rewrote this part since lua only has tables
if hitMaxDepth then
if getType(val) == "set" then
return "[Set]"
else
return "[Table]"
end
end
local retval = ""
if not min then
retval = if config.printBasicPrototype then "Table" .. " " else ""
end
if is_array(val) then
return retval .. "{" .. printListItems(val, config, indentation, depth, refs, printer) .. "}"
end
if getType(val) == "set" then
if hitMaxDepth then
return "[Set]"
else
return "Set {" .. printListItems(val._array, config, indentation, depth, refs, printer) .. "}"
end
end
return retval .. "{" .. printTableEntries(val, config, indentation, depth, refs, printer) .. "}"
-- ROBLOX deviation end
end
local function isNewPlugin(plugin_: Plugin): boolean
return (plugin_ :: NewPlugin).serialize ~= nil
end
function printPlugin(plugin_: Plugin, val: any, config: Config, indentation: string, depth: number, refs: Refs): string
local printed
local ok, err = pcall(function()
if isNewPlugin(plugin_) then
printed = (plugin_ :: NewPlugin).serialize(val, config, indentation, depth, refs, printer)
else
printed = (plugin_ :: OldPlugin).print(val, function(valChild)
return printer(valChild, config, indentation, depth, refs)
end, function(str)
local indentationNext = indentation .. config.indent
return indentationNext .. str:gsub("\n", "\n" .. indentationNext)
end, {
edgeSpacing = config.spacingOuter,
min = config.min,
spacing = config.spacingInner,
}, config.colors)
end
end)
if not ok then
error(PrettyFormatPluginError(err))
end
if typeof(printed) ~= "string" then
error(
Error(
string.format(
'pretty-format: Plugin must return type "string" but instead returned "%s".',
typeof(printed)
)
)
)
end
return printed
end
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 800 -- Spring Dampening
Tune.FSusStiffness = 10000 -- Spring Force
Tune.FAntiRoll = 90 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 800 -- Spring Dampening
Tune.RSusStiffness = 10000 -- Spring Force
Tune.FAntiRoll = 85 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
----- Private Variables ----- |
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Remotes = ReplicatedStorage.Remote
local Players = game:GetService("Players")
|
-- Connexion du clic sur le bouton GUI |
script.Parent.MouseButton1Click:Connect(function()
-- Activez la vitesse de marche à 16 lorsque le joueur clique sur le bouton
player.Character:WaitForChild("Humanoid").WalkSpeed = 16
-- Envoyez la demande au serveur
game.ReplicatedStorage.TeamSelect:FireServer(script.Parent.Name)
-- Désactivez le parent du bouton GUI
script.Parent.Parent.Enabled = false
end)
|
-- Constants |
local Local_Player = PlayersService.LocalPlayer
local Crosshair_Screen = script:WaitForChild("Crosshair")
local Crosshair_Frame = Crosshair_Screen.Frame
local Crosshair_Image = Crosshair_Frame.CrosshairImage
|
-- This was automatically inserted by the Ban Hammer plugin.
-- You can re-parent this script and change it any way you see fit. | |
--end
--if SignalValues.Signal2.Value == 2 then |
SignalValues.Signal2.Value = 3 |
--orange 9 |
if k == "u" and ibo.Value==true then
bin.Blade.BrickColor = BrickColor.new("Deep orange")
bin.Blade2.BrickColor = BrickColor.new("Institutional white")
bin.Blade.White.Enabled=false colorbin.white.Value = false
bin.Blade.Blue.Enabled=false colorbin.blue.Value = false
bin.Blade.Green.Enabled=false colorbin.green.Value = false
bin.Blade.Magenta.Enabled=false colorbin.magenta.Value = false
bin.Blade.Orange.Enabled=true colorbin.orange.Value = true
bin.Blade.Viridian.Enabled=false colorbin.viridian.Value = false
bin.Blade.Violet.Enabled=false colorbin.violet.Value = false
bin.Blade.Red.Enabled=false colorbin.red.Value = false
bin.Blade.Silver.Enabled=false colorbin.silver.Value = false
bin.Blade.Black.Enabled=false colorbin.black.Value = false
bin.Blade.NavyBlue.Enabled=false colorbin.navyblue.Value = false
bin.Blade.Yellow.Enabled=false colorbin.yellow.Value = false
bin.Blade.Cyan.Enabled=false colorbin.cyan.Value = false
end |
--Automatic: Revmatching |
Tune.ShiftThrot = 100 -- Throttle level when shifting down to revmatch, 0 - 100%
|
-- find player's head pos |
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
--local head = vCharacter:findFirstChild("Head")
local head = locateHead()
if head == nil then return end
--computes a the intended direction of the projectile based on where the mouse was clicked in reference to the head
local dir = mouse_pos - head.Position
dir = computeDirection(dir)
local launch = head.Position + 3 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
local missile = Pellet:clone()
missile.CanCollide = true
missile.Position = launch
missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
missile.StarScript.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function locateHead()
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
return vCharacter:findFirstChild("Head")
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
fire(targetPos)
wait(2)
Tool.Enabled = true
Tool.Handle.Transparency=0
end
script.Parent.Activated:connect(onActivated)
|
-- stravant's AnimEdit helper, to make sure tools actually animate. |
function Create(ty)
return function(data)
local obj = Instance.new(ty)
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
end
local Tool = script.Parent.Parent
local armChildRemovedConn = nil
local Motor6DGrip = nil
local EquippedNum = 0
Tool.Equipped:connect(function()
EquippedNum = EquippedNum + 1
local myEquip = EquippedNum
--some vars
local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
local Character = Player.Character
local rightarm = Character:FindFirstChild('Right Arm')
if rightarm and rightarm:FindFirstChild('RightGrip') then
local rightGrip = rightarm['RightGrip']
local handle = rightGrip.Part1
--kill my joint when the normal joint is removed
--this must be done here so that the joint is removed
--_right away_ after unequipping and the character doesn't
--glitch up.
local armChildRemovedConn = rightarm.ChildRemoved:connect(function(ch)
if ch == rightGrip then
Motor6DGrip:Remove()
Motor6DGrip = nil
--
if handle and Character:FindFirstChild('Torso') then
if Tool.Parent.Parent:IsA('Player') then
--the sword has been deselected
--put the sword far away so the user doesn't notice that the handle doesn't
--update for about 0.1 seconds after selecting the tool.
handle.CFrame = CFrame.new(100000, 100000, 100000)
else
--if in the workspace, position the handle where it should be dropped
--use the size of the handle to make sure it's dropped far enough away
handle.CFrame = Character.Torso.CFrame * CFrame.new(0, 0, -(handle.Size.magnitude+2))
end
end
end
end)
--make my new joint
Motor6DGrip = Create'Motor6D'{
Name = 'RightGrip_Motor';
Part0 = rightarm;
Part1 = handle;
C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, -0); -- from original right grip
C1 = CFrame.new(0.1, -0.6, 0.4, 1, 0, 0, 0, 0, -1, 0, 1, 0);
}
--kill the old weld
rightGrip.Part1 = nil
rightGrip.Part0 = nil
Motor6DGrip.Parent = rightGrip.Parent
end
end)
Tool.Unequipped:connect(function()
EquippedNum = EquippedNum + 1
if armChildRemovedConn then
armChildRemovedConn:disconnect()
armChildRemovedConn = nil
end
end)
|
-- создадим 10 копий |
for i=1,10 do
local x=rnd:NextInteger(-200,200)
local z=rnd:NextInteger(-200,200)
local v=CFrame.new(Vector3.new(x,0,z))
local newModel = target:Clone()
newModel:SetPrimaryPartCFrame(v)
newModel.Parent = targets
end
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388 |
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 = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(-1.5, -0.15, 0) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--[[
Creates folders for RemoteFunctions and RemoteEvents used by
Network. These folders are then populated with new RemoteEvents
and RemoteFunctions for each name specified in the RemoteNames constants module.
--]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEventName = require(ReplicatedStorage.Source.Network.RemoteName.RemoteEventName)
local RemoteFunctionName = require(ReplicatedStorage.Source.Network.RemoteName.RemoteFunctionName)
local RemoteFolderName = require(ReplicatedStorage.Source.Network.RemoteFolderName)
local createInstanceTree = require(ReplicatedStorage.Source.Utility.createInstanceTree)
local getInstance = require(ReplicatedStorage.Source.Utility.getInstance)
type PropertiesTable = { [string]: any }
local function createRemotes(remoteFolder: Folder)
local remoteEventsFolder: Folder = getInstance(remoteFolder, RemoteFolderName.RemoteEvents)
for eventName in pairs(RemoteEventName) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = eventName
remoteEvent.Parent = remoteEventsFolder
end
local remoteFunctionsFolder: Folder = getInstance(remoteFolder, RemoteFolderName.RemoteFunctions)
for functionName in pairs(RemoteFunctionName) do
local remoteFunction = Instance.new("RemoteFunction")
remoteFunction.Name = functionName
remoteFunction.Parent = remoteFunctionsFolder
end
end
local function createRemotesFolders(rootFolderName: string): Folder
local folder = createInstanceTree({
className = "Folder",
properties = {
Name = rootFolderName,
},
children = {
{
className = "Folder",
properties = {
Name = RemoteFolderName.RemoteFunctions,
} :: PropertiesTable,
},
{
className = "Folder",
properties = {
Name = RemoteFolderName.RemoteEvents,
} :: PropertiesTable,
},
},
})
createRemotes(folder)
return folder
end
return createRemotesFolders
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 840 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1000 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 15000 -- Use sliders to manipulate values
Tune.Redline = 14000 -- 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 = 200 -- 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)
|
-- excluding the `+` and `*` character, since findOr tests and graphql use them explicitly |
local luaPatternCharacters = "([" .. ("$%^()-[].?"):gsub("(.)", "%%%1") .. "])"
local function findOr(str: string, patternTable: { string }, initIndex: number?): Match | nil
-- loop through all options in patern patternTable
local init = utf8.offset(str, initIndex or 1)
local matches = {}
for _, value in patternTable do
value = value:gsub(luaPatternCharacters, "%%%1")
local iStart, iEnd = string.find(str, value, init)
if iStart then
local prefix = string.sub(str, 1, iStart - 1)
local prefixEnd, invalidBytePosition = utf8.len(prefix)
if prefixEnd == nil then
error(("string `%s` has an invalid byte at position %s"):format(prefix, tostring(invalidBytePosition)))
end
local iStartIndex = prefixEnd :: number + 1
local match = {
index = iStartIndex,
match = string.sub(str, iStart, iEnd),
}
table.insert(matches, match)
end
end
-- if no matches, return nil
if #matches == 0 then
return nil
end
-- find the first matched index (after the init param)
-- for each, if we get a hit, return the earliest index and matched term
local firstMatch
for _, value in matches do
-- load first condition
if firstMatch == nil then
firstMatch = value
end
-- identify if current match comes before first match
if value.index < firstMatch.index then
firstMatch = value
end
end
-- return first match
return firstMatch
end
return findOr
|
---------------
-- Constants --
--------------- |
local FADE_TARGET = 0.75
local FADE_RATE = 0.1
local MODE = {
CUSTOM = 1, -- Whatever you want!
LIMBS = 2, -- Track limbs
MOVEMENT = 3, -- Track movement
CORNERS = 4, -- Char model corners
CIRCLE1 = 5, -- Circle of casts around character
CIRCLE2 = 6, -- Circle of casts around character, camera relative
LIMBMOVE = 7, -- LIMBS mode + MOVEMENT mode
}
Invisicam.MODE = MODE
local STARTING_MODE = MODE.LIMBS
local LIMB_TRACKING_SET = {
['Head'] = true,
['Left Arm'] = true,
['Right Arm'] = true,
['Left Leg'] = true,
['Right Leg'] = true,
}
local CORNER_FACTORS = {
Vector3.new(1, 1, -1),
Vector3.new(1, -1, -1),
Vector3.new(-1, -1, -1),
Vector3.new(-1, 1, -1)
}
local CIRCLE_CASTS = 10
local MOVE_CASTS = 3
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 5
black = BrickColor.new("Really black")
local slash_damage = 22
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local player = game.Players:FindFirstChild(hit.Parent.Name)
if player then
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
local myteam = vPlayer.TeamColor
local theirteam = player.TeamColor
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm") or vCharacter:FindFirstChild("RightHand")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
if player and player ~= vPlayer and not vPlayer.Neutral and not player.Neutral and (myteam ~= theirteam or (myteam == black and theirteam == black)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = require(script.Parent);
local v2 = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v3 = game["Run Service"];
local l__UserInputService__4 = game:GetService("UserInputService");
local l__ProximityPromptService__5 = game:GetService("ProximityPromptService");
local l__TextService__6 = game:GetService("TextService");
local v7 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("GetPlatform"));
local v8 = script:FindFirstAncestor("MainUI");
if v7() == "mobile" then
v8.MainFrame:WaitForChild("MobileButtons").Visible = true;
end;
local l__PromptFrame__1 = v8:WaitForChild("MainFrame"):WaitForChild("PromptFrame");
local u2 = require(script:WaitForChild("MouseIcons"));
local u3 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("ButtonIcons"));
local l__InteractButton__4 = v8.MainFrame:WaitForChild("MobileButtons"):WaitForChild("InteractButton");
local u5 = require(script:WaitForChild("Hint"));
local l__TweenService__6 = game:GetService("TweenService");
local u7 = nil;
local u8 = tick();
local l__Highlight__9 = script:WaitForChild("Highlight");
local u10 = Vector3.new(0, 0, 0);
local u11 = nil;
function update(p1, p2)
task.spawn(function()
l__PromptFrame__1.Title.Text = p1.ObjectText;
l__PromptFrame__1.Desc.Text = p1.ActionText;
l__PromptFrame__1.Key.Text = p1.KeyboardKeyCode.Name;
l__PromptFrame__1.Bar.Bar.Size = UDim2.new(0, 0, 1, 0);
l__PromptFrame__1.Bar.Bar:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Sine", 0.1, true);
l__PromptFrame__1.CenterImage.Image = u2.getIcon(p1.ActionText);
if p1.ActionText == "Collect" then
task.delay(0.2, function()
p1:InputHoldBegin();
end);
end;
local v9 = UDim.new(0.925, 0);
if v7() ~= "pc" then
l__PromptFrame__1.Key.Visible = false;
l__PromptFrame__1.UIScale.Scale = 1.5;
if v7() == "console" then
l__PromptFrame__1.KeyXbox.Image = u3[p1.GamepadKeyCode.Name];
l__PromptFrame__1.KeyXbox.Visible = true;
elseif v7() == "mobile" then
l__PromptFrame__1.KeyXbox.Visible = false;
end;
else
l__PromptFrame__1.Key.Visible = true;
l__PromptFrame__1.KeyXbox.Visible = false;
end;
l__InteractButton__4.Icon.Image = l__PromptFrame__1.CenterImage.Image;
if p1.ObjectText == "Hint" then
local v10 = UDim.new(0.85, 0);
l__PromptFrame__1.Key.Text = u5[p1.ActionText];
l__PromptFrame__1.CenterImage.Image = u2.getIcon(p1.ObjectText);
end;
local v11 = {
BackgroundColor3 = Color3.fromRGB(0, 0, 0)
};
if p2 == true then
l__PromptFrame__1.BackgroundColor3 = Color3.new(0.776471, 0.729412, 0.376471);
l__TweenService__6:Create(l__PromptFrame__1, TweenInfo.new(0.15, Enum.EasingStyle.Quart, Enum.EasingDirection.In), v11):Play();
else
l__PromptFrame__1.BackgroundColor3 = Color3.new(0.337255, 0.423529, 0.533333);
l__TweenService__6:Create(l__PromptFrame__1, TweenInfo.new(0.4, Enum.EasingStyle.Sine, Enum.EasingDirection.In), v11):Play();
end;
if 0 < p1.HoldDuration then
l__PromptFrame__1.Bar.Visible = true;
else
l__PromptFrame__1.Bar.Visible = false;
end;
script.Holding:Stop();
local l__CurrentCamera__12 = workspace.CurrentCamera;
local v13 = l__CurrentCamera__12.CFrame.Position;
local v21
local v22, v23 = l__CurrentCamera__12:WorldToScreenPoint(v13 - Vector3.new(0, 0.2, 0));
local l__Parent__14 = p1.Parent;
local v15 = false;
u8 = tick();
if l__Parent__14 then
if not l__Parent__14:IsA("BasePart") then
if l__Parent__14:IsA("Model") then
v13 = l__Parent__14:GetPivot().Position;
v15 = true;
elseif l__Parent__14:IsA("Attachment") then
v13 = l__Parent__14.WorldPosition;
end;
else
v13 = l__Parent__14:GetPivot().Position;
v15 = true;
end;
l__Highlight__9.Adornee = l__Parent__14;
l__Highlight__9.Enabled = true;
l__PromptFrame__1.Visible = true;
l__PromptFrame__1.Position = UDim2.new(0.5, 0, 2, 0);
local v16 = u10;
if v16 then
if 7 <= (v16 - v13).Magnitude then
v16 = nil;
elseif v16 then
end;
end;
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 0.9,
OutlineTransparency = 0
}):Play();
local v17 = nil;
local v18 = nil;
if v7() == "mobile" then
l__InteractButton__4.Visible = true;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 0.35
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 0
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 0
}):Play();
v17 = l__InteractButton__4.InputBegan:Connect(function()
p1:InputHoldBegin();
end);
v18 = l__InteractButton__4.InputEnded:Connect(function()
p1:InputHoldEnd();
end);
end;
local v19 = tick();
local v20 = 1 - 1;
if not l__Parent__14:IsA("BasePart") then
if not l__Parent__14:IsA("Model") then
if l__Parent__14:IsA("Attachment") then
while true do
if p1 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 == u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if l__PromptFrame__1.Visible then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if v15 then
v21 = l__Parent__14:GetPivot().Position;
else
v21 = l__Parent__14.WorldPosition;
end;
if v16 then
if v16 ~= nil then
v21 = v16:Lerp(v21, l__TweenService__6:GetValue((tick() - v19) * 4, Enum.EasingStyle.Quart, Enum.EasingDirection.Out));
end;
end;
u10 = v13;
l__PromptFrame__1.Position = UDim2.new(0, math.clamp(v22.X, 80, v8.AbsoluteSize.X - 80), 0, math.clamp(v22.Y, 80, v8.AbsoluteSize.Y - 80));
l__Highlight__9.Adornee = l__Parent__14;
l__Highlight__9.Enabled = true;
task.wait();
if 0 <= 1 then
if v20 < 100000000 then
else
break;
end;
elseif 100000000 < v20 then
else
break;
end;
v20 = v20 + 1;
end;
end;
else
v19 = tick();
v20 = 1 - 1;
while true do
if p1 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 == u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if l__PromptFrame__1.Visible then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if v15 then
v21 = l__Parent__14:GetPivot().Position;
else
v21 = l__Parent__14.WorldPosition;
end;
if v16 then
if v16 ~= nil then
v21 = v16:Lerp(v21, l__TweenService__6:GetValue((tick() - v19) * 4, Enum.EasingStyle.Quart, Enum.EasingDirection.Out));
end;
end;
u10 = v13;
v22, v23 = l__CurrentCamera__12:WorldToScreenPoint(v13 - Vector3.new(0, 0.2, 0));
l__PromptFrame__1.Position = UDim2.new(0, math.clamp(v22.X, 80, v8.AbsoluteSize.X - 80), 0, math.clamp(v22.Y, 80, v8.AbsoluteSize.Y - 80));
l__Highlight__9.Adornee = l__Parent__14;
l__Highlight__9.Enabled = true;
task.wait();
if 0 <= 1 then
if v20 < 100000000 then
else
break;
end;
elseif 100000000 < v20 then
else
break;
end;
v20 = v20 + 1;
end;
end;
else
v19 = tick();
v20 = 1 - 1;
while true do
if p1 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 == u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if u7 then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if l__PromptFrame__1.Visible then
else
pcall(function()
if v17 then
if v18 then
v17:Disconnect();
v18:Disconnect();
end;
end;
end);
if u7 == nil then
l__TweenService__6:Create(l__Highlight__9, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
FillTransparency = 1,
OutlineTransparency = 1
}):Play();
task.wait(0.2);
if u7 == nil then
if u8 == u8 then
l__Highlight__9.Adornee = nil;
l__Highlight__9.Enabled = false;
l__PromptFrame__1.Visible = false;
l__TweenService__6:Create(l__InteractButton__4, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
BackgroundTransparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.UIStroke, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
Transparency = 1
}):Play();
l__TweenService__6:Create(l__InteractButton__4.Icon, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {
ImageTransparency = 1
}):Play();
end;
end;
elseif l__PromptFrame__1.Visible then
u11 = v13;
end;
break;
end;
if v15 then
v21 = l__Parent__14:GetPivot().Position;
else
v21 = l__Parent__14.WorldPosition;
end;
if v16 then
if v16 ~= nil then
v21 = v16:Lerp(v21, l__TweenService__6:GetValue((tick() - v19) * 4, Enum.EasingStyle.Quart, Enum.EasingDirection.Out));
end;
end;
u10 = v13;
v22, v23 = l__CurrentCamera__12:WorldToScreenPoint(v13 - Vector3.new(0, 0.2, 0));
l__PromptFrame__1.Position = UDim2.new(0, math.clamp(v22.X, 80, v8.AbsoluteSize.X - 80), 0, math.clamp(v22.Y, 80, v8.AbsoluteSize.Y - 80));
l__Highlight__9.Adornee = l__Parent__14;
l__Highlight__9.Enabled = true;
task.wait();
if 0 <= 1 then
if v20 < 100000000 then
else
break;
end;
elseif 100000000 < v20 then
else
break;
end;
v20 = v20 + 1;
end;
end;
end;
end);
end;
local u12 = 0;
l__ProximityPromptService__5.PromptShown:Connect(function(p3)
if p3.ObjectText ~= "Hint" then
u7 = p3.Changed:Connect(function()
update(p3);
end);
u12 = u12 + 1;
update(p3);
script.Notification:Play();
end;
end);
l__ProximityPromptService__5.PromptHidden:Connect(function(p4)
if p4.ObjectText ~= "Hint" then
l__PromptFrame__1.Bar.Bar:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Sine", 0.1, true);
l__PromptFrame__1.Visible = false;
pcall(function()
u7:Disconnect();
end);
u7 = nil;
u12 = u12 - 1;
end;
end);
l__ProximityPromptService__5.PromptTriggered:Connect(function(p5)
if p5.ObjectText ~= "Hint" then
update(p5, true);
v1.camShaker:ShakeOnce(1, 1, 0.2, 0.7, Vector3.new(0, 0, 0));
l__PromptFrame__1.Bar.Bar:TweenSize(UDim2.new(0, 0, 1, 0), "Out", "Sine", 0.1, true);
script.Triggered:Play();
script.Holding:Stop();
l__PromptFrame__1.CenterImage.Position = UDim2.new(0.5, 0, 0.52, 0);
l__TweenService__6:Create(l__PromptFrame__1.CenterImage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.5, 0),
ImageTransparency = 0
}):Play();
end;
end);
l__ProximityPromptService__5.PromptButtonHoldBegan:Connect(function(p6)
if p6.ObjectText ~= "Hint" then
update(p6);
l__PromptFrame__1.Bar.Bar:TweenSize(UDim2.new(1, 0, 1, 0), "In", "Sine", p6.HoldDuration, true);
script.Holding:Play();
l__TweenService__6:Create(l__PromptFrame__1.CenterImage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.52, 0),
ImageTransparency = 0
}):Play();
end;
end);
l__ProximityPromptService__5.PromptButtonHoldEnded:Connect(function(p7)
if p7.ObjectText ~= "Hint" then
update(p7);
script.Holding:Stop();
l__TweenService__6:Create(l__PromptFrame__1.CenterImage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.5, 0),
ImageTransparency = 0
}):Play();
end;
end);
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 2700; -- Bullet Speed
BulletSpread = 1; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
-- print(hum.Health) |
if hum.Health<1 then return end
end
if hit.Parent:findFirstChild("Humanoid2") ~= nil then
local hum=hit.Parent:findFirstChild("Humanoid2") |
-------------------------------------------------------------------------------------------------- |
if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",2)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
end
local Equipped = false
local Enabled = true
local Down = false
local HoldDown = false
local Reloading = false
local AimDown = false
local Scoping = false
local Mag = MagValue.Value
local Ammo = AmmoValue.Value
local MaxAmmo = Module.MaxAmmo
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
IdleAnim = Tool:WaitForChild("IdleAnim")
IdleAnim = Humanoid:LoadAnimation(IdleAnim)
end
if Module.FireAnimationID ~= nil then
FireAnim = Tool:WaitForChild("FireAnim")
FireAnim = Humanoid:LoadAnimation(FireAnim)
end
if Module.ReloadAnimationID ~= nil then
ReloadAnim = Tool:WaitForChild("ReloadAnim")
ReloadAnim = Humanoid:LoadAnimation(ReloadAnim)
end
if Module.ShotgunClipinAnimationID ~= nil then
ShotgunClipinAnim = Tool:WaitForChild("ShotgunClipinAnim")
ShotgunClipinAnim = Humanoid:LoadAnimation(ShotgunClipinAnim)
end
if Module.HoldDownAnimationID ~= nil then
HoldDownAnim = Tool:WaitForChild("HoldDownAnim")
HoldDownAnim = Humanoid:LoadAnimation(HoldDownAnim)
end
if Module.EquippedAnimationID ~= nil then
EquippedAnim = Tool:WaitForChild("EquippedAnim")
EquippedAnim = Humanoid:LoadAnimation(EquippedAnim)
end
function wait(TimeToWait)
if TimeToWait ~= nil then
local TotalTime = 0
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
while TotalTime < TimeToWait do
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
end
else
game:GetService("RunService").Heartbeat:wait()
end
end
function numLerp(A, B, Alpha)
return A + (B - A) * Alpha
end
function RAND(Min, Max, Accuracy)
local Inverse = 1 / (Accuracy or 1)
return (math.random(Min * Inverse, Max * Inverse) / Inverse)
end
function GetFireDirection(CurrentPosOnScreen, FirePointObject)
local X = CurrentPosOnScreen.X + math.random(-Module.SpreadX * 2, Module.SpreadX * 2) * (AimDown and 1-Module.SpreadRedutionIS and 1-Module.SpreadRedutionS or 1)
local Y = CurrentPosOnScreen.Y + math.random(-Module.SpreadY * 2, Module.SpreadY * 2) * (AimDown and 1-Module.SpreadRedutionIS and 1-Module.SpreadRedutionS or 1)
local RayMag1 = Camera:ScreenPointToRay(X, Y) --Hence the var name, the magnitude of this is 1.
local NewRay = Ray.new(RayMag1.Origin, RayMag1.Direction * 5000)
local Target, Position = workspace:FindPartOnRay(NewRay, Character)
--NOTE: This ray is from camera to object's position. This is why I check for a position value - With that value, I can get the proper direction
return (Position - FirePointObject.WorldPosition).Unit
end
MarkerEvent.Event:connect(function(IsHeadshot)
pcall(function()
if Module.HitmarkerEnabled then
if IsHeadshot then
GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColorHS
GUI.Crosshair.Hitmarker.ImageTransparency = 0
TweeningService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTimeHS, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
local markersound = GUI.Crosshair.MarkerSound:Clone()
markersound.PlaybackSpeed = Module.HitmarkerSoundPitchHS
markersound.Parent = Player.PlayerGui
markersound:Play()
game:GetService("Debris"):addItem(markersound,markersound.TimeLength)
else
GUI.Crosshair.Hitmarker.ImageColor3 = Module.HitmarkerColor
GUI.Crosshair.Hitmarker.ImageTransparency = 0
TweeningService:Create(GUI.Crosshair.Hitmarker, TweenInfo.new(Module.HitmarkerFadeTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {ImageTransparency = 1}):Play()
local markersound = GUI.Crosshair.MarkerSound:Clone()
markersound.PlaybackSpeed = Module.HitmarkerSoundPitch
markersound.Parent = Player.PlayerGui
markersound:Play()
game:GetService("Debris"):addItem(markersound,markersound.TimeLength)
end
end
end)
end)
function EjectShell(ShootingHandle)
if Module.BulletShellEnabled then
local ShellPos = (ShootingHandle.CFrame * CFrame.new(Module.BulletShellOffset.X,Module.BulletShellOffset.Y,Module.BulletShellOffset.Z)).p
local Chamber = Instance.new("Part")
Chamber.Name = "Chamber"
Chamber.Size = Vector3.new(0.01,0.01,0.01)
Chamber.Transparency = 1
Chamber.Anchored = false
Chamber.CanCollide = false
Chamber.TopSurface = Enum.SurfaceType.SmoothNoOutlines
Chamber.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
local Weld = Instance.new("Weld",Chamber)
Weld.Part0 = ShootingHandle
Weld.Part1 = Chamber
Weld.C0 = CFrame.new(Module.BulletShellOffset.X,Module.BulletShellOffset.Y,Module.BulletShellOffset.Z)
Chamber.Position = ShellPos
Chamber.Parent = workspace.CurrentCamera
local function spawner()
local Shell = Instance.new("Part")
Shell.CFrame = Chamber.CFrame * CFrame.fromEulerAnglesXYZ(-2.5,1,1)
Shell.Size = Module.ShellSize
Shell.CanCollide = Module.AllowCollide
Shell.Name = "Shell"
--VVV Edit here VVV--
Shell.Velocity = Chamber.CFrame.lookVector * 20 + Vector3.new(math.random(-10,10),20,math.random(-10,10))
Shell.RotVelocity = Vector3.new(0,200,0)
--^^^ Edit here ^^^--
Shell.Parent = workspace.CurrentCamera
local shellmesh = Instance.new("SpecialMesh")
shellmesh.Scale = Module.ShellScale
shellmesh.MeshId = "rbxassetid://"..Module.ShellMeshID
shellmesh.TextureId = "rbxassetid://"..Module.ShellTextureID
shellmesh.MeshType = "FileMesh"
shellmesh.Parent = Shell
game:GetService("Debris"):addItem(Shell,Module.DisappearTime)
end
spawn(spawner)
game.Debris:AddItem(Chamber,10)
end
end
function RecoilCamera()
if Module.CameraRecoilingEnabled then
local CurrentRecoil = Module.Recoil*(AimDown and 1-Module.RecoilRedution or 1)
local RecoilX = math.rad(CurrentRecoil * RAND(Module.AngleX_Min, Module.AngleX_Max, Module.Accuracy))
local RecoilY = math.rad(CurrentRecoil * RAND(Module.AngleY_Min, Module.AngleY_Max, Module.Accuracy))
local RecoilZ = math.rad(CurrentRecoil * RAND(Module.AngleZ_Min, Module.AngleZ_Max, Module.Accuracy))
CameraModule:accelerate(RecoilX,RecoilY,RecoilZ)
delay(0.05, function()
CameraModule:accelerateXY(-RecoilX,-RecoilY)
end)
end
end
function Fire(ShootingHandle, InputPos)
if FireAnim then FireAnim:Play(nil,nil,Module.FireAnimationSpeed) end
if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then ShootingHandle.FireSound:Play() end
local FireDirection = GetFireDirection(InputPos, ShootingHandle:FindFirstChild("GunFirePoint"))
Player.PlayerScripts.BulletVisualizerScript.Visualize:Fire(nil,Tool,ShootingHandle,FireDirection,
ShootingHandle:FindFirstChild("GunFirePoint"),
{Module.HitEffectEnabled,Module.HitSoundIDs,Module.HitSoundPitch,Module.HitSoundVolume,script:WaitForChild("HitEffect"),Module.CustomHitEffect},
{Module.BloodEnabled,Module.HitCharSndIDs,Module.HitCharSndPitch,Module.HitCharSndVolume,script:WaitForChild("BloodEffect")},
{Module.BulletHoleEnabled,Module.BulletHoleSize,Module.BulletHoleTexture,Module.PartColor,Module.BulletHoleVisibleTime,Module.BulletHoleFadeTime},
{Module.FleshHole,Module.FleshHoleSize,Module.FleshHoleTexture,Module.FleshHoleColor,Module.FleshHoleVisibleTime,Module.FleshHoleFadeTime},
{Module.ExplosiveEnabled,Module.ExplosionRadius,Module.ExplosionSoundEnabled,Module.ExplosionSoundIDs,Module.ExplosionSoundPitch,Module.ExplosionSoundVolume,Module.CustomExplosion,script:WaitForChild("ExplosionEffect")},
{Module.BulletTracerEnabled,Module.BulletTracerOffset0,Module.BulletTracerOffset1,script:WaitForChild("TracerEffect"),Module.BulletParticleEnaled,script:WaitForChild("ParticleEffect"),Module.Range,Module.BulletSpeed,Module.DropGravity,Module.WindOffset,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,Module.BulletMaterial,Module.BulletShape,Module.BulletMeshEnabled,Module.BulletMeshID,Module.BulletTextureID,Module.BulletMeshScale},
{Module.BaseDamage,Module.HeadshotDamageMultiplier,Module.HeadshotEnabled},
{Module.WhizSoundEnabled,Module.WhizSoundID,Module.WhizSoundVolume,Module.WhizSoundPitch},
{Module.BulletLightEnabled,Module.BulletLightBrightness,Module.BulletLightColor,Module.BulletLightRange,Module.BulletLightShadows},
{Module.Knockback, Module.Lifesteal, Module.FlamingBullet})
VisualizeBullet:FireServer(Tool,ShootingHandle,FireDirection,
ShootingHandle:FindFirstChild("GunFirePoint"),
{Module.HitEffectEnabled,Module.HitSoundIDs,Module.HitSoundPitch,Module.HitSoundVolume,script:WaitForChild("HitEffect"),Module.CustomHitEffect},
{Module.BloodEnabled,Module.HitCharSndIDs,Module.HitCharSndPitch,Module.HitCharSndVolume,script:WaitForChild("BloodEffect")},
{Module.BulletHoleEnabled,Module.BulletHoleSize,Module.BulletHoleTexture,Module.PartColor,Module.BulletHoleVisibleTime,Module.BulletHoleFadeTime},
{Module.FleshHole,Module.FleshHoleSize,Module.FleshHoleTexture,Module.FleshHoleColor,Module.FleshHoleVisibleTime,Module.FleshHoleFadeTime},
{Module.ExplosiveEnabled,Module.ExplosionRadius,Module.ExplosionSoundEnabled,Module.ExplosionSoundIDs,Module.ExplosionSoundPitch,Module.ExplosionSoundVolume,Module.CustomExplosion,script:WaitForChild("ExplosionEffect")},
{Module.BulletTracerEnabled,Module.BulletTracerOffset0,Module.BulletTracerOffset1,script:WaitForChild("TracerEffect"),Module.BulletParticleEnaled,script:WaitForChild("ParticleEffect"),Module.Range,Module.BulletSpeed,Module.DropGravity,Module.WindOffset,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,Module.BulletMaterial,Module.BulletShape,Module.BulletMeshEnabled,Module.BulletMeshID,Module.BulletTextureID,Module.BulletMeshScale},
{Module.BaseDamage,Module.HeadshotDamageMultiplier,Module.HeadshotEnabled},
{Module.WhizSoundEnabled,Module.WhizSoundID,Module.WhizSoundVolume,Module.WhizSoundPitch},
{Module.BulletLightEnabled,Module.BulletLightBrightness,Module.BulletLightColor,Module.BulletLightRange,Module.BulletLightShadows},
{Module.Knockback, Module.Lifesteal, Module.FlamingBullet})
end
function Reload()
if Enabled and not Reloading and (Ammo > 0 or not Module.LimitedAmmoEnabled) and Mag < Module.AmmoPerMag then
Reloading = true
if AimDown then
TweeningService:Create(Camera, TweenInfo.new(Module.TweenLengthNAD, Module.EasingStyleNAD, Module.EasingDirectionNAD), {FieldOfView = 70}):Play()
CrosshairModule:setcrossscale(1)
--[[local GUI = game:GetService("Players").LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
Scoping = false
game:GetService("Players").LocalPlayer.CameraMode = Enum.CameraMode.Classic
UserInputService.MouseDeltaSensitivity = InitialSensitivity
AimDown = false
end
UpdateGUI()
if Module.ShotgunReload then
for i = 1,(Module.AmmoPerMag - Mag) do
if ShotgunClipinAnim then ShotgunClipinAnim:Play(nil,nil,Module.ShotgunClipinAnimationSpeed) end
Handle.ShotgunClipin:Play()
wait(Module.ShellClipinSpeed)
end
end
if ReloadAnim then ReloadAnim:Play(nil,nil,Module.ReloadAnimationSpeed) end
Handle.ReloadSound:Play()
wait(Module.ReloadTime)
if Module.LimitedAmmoEnabled then
local ammoToUse = math.min(Module.AmmoPerMag - Mag, Ammo)
Mag = Mag + ammoToUse
Ammo = Ammo - ammoToUse
else
Mag = Module.AmmoPerMag
end
ChangeMagAndAmmo:FireServer(Mag,Ammo)
Reloading = false
UpdateGUI()
end
end
function UpdateGUI()
GUI.Frame.Mag.Fill:TweenSizeAndPosition(UDim2.new(Mag/Module.AmmoPerMag,0,1,0), UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
GUI.Frame.Ammo.Fill:TweenSizeAndPosition(UDim2.new(Ammo/Module.MaxAmmo,0,1,0), UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
GUI.Frame.Mag.Current.Text = Mag
GUI.Frame.Mag.Max.Text = Module.AmmoPerMag
GUI.Frame.Ammo.Current.Text = Ammo
GUI.Frame.Ammo.Max.Text = Module.MaxAmmo
GUI.Frame.Mag.Current.Visible = not Reloading
GUI.Frame.Mag.Max.Visible = not Reloading
GUI.Frame.Mag.Frame.Visible = not Reloading
GUI.Frame.Mag.Reloading.Visible = Reloading
GUI.Frame.Ammo.Current.Visible = not (Ammo <= 0)
GUI.Frame.Ammo.Max.Visible = not (Ammo <= 0)
GUI.Frame.Ammo.Frame.Visible = not (Ammo <= 0)
GUI.Frame.Ammo.NoMoreAmmo.Visible = (Ammo <= 0)
GUI.Frame.Ammo.Visible = Module.LimitedAmmoEnabled
GUI.Frame.Size = Module.LimitedAmmoEnabled and UDim2.new(0,250,0,100) or UDim2.new(0,250,0,55)
GUI.Frame.Position = Module.LimitedAmmoEnabled and UDim2.new(2,0,1,0)or UDim2.new(2,0,1,0)
GUI.MobileButtons.Visible = UserInputService.TouchEnabled --For mobile version
GUI.MobileButtons.AimButton.Visible = Module.SniperEnabled or Module.IronsightEnabled
GUI.MobileButtons.HoldDownButton.Visible = Module.HoldDownEnabled
end
|
-- ================================================================================
-- Settings - Training Jet
-- ================================================================================ |
local Settings = {}
Settings.DefaultSpeed = 110 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 180 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 9 -- Duration of boost in seconds
Settings.Steering = 6 -- How quickly the speeder turns [Range: 1-10] |
--// Aim|Zoom|Sensitivity Customization |
ZoomSpeed = 0.125; -- The lower the number the slower and smoother the tween
AimZoom = 5; -- Default zoom
AimSpeed = 0.70;
UnaimSpeed = 0.23;
CycleAimZoom = 55; -- Cycled zoom
MouseSensitivity = 0.05; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
--Horsepower Curve |
local fgc_h=_Tune.Horsepower/100
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
|
-- |
tool.Equipped:connect(function()
equipped = true
trail.Enabled = false
cananimate = true
canattack = false
handle.Transparency = 1
owner = game:GetService("Players"):GetPlayerFromCharacter(tool.Parent)
character = owner.Character
local rightarm = Instance.new("Weld", character.Torso)
rightarm.Part0 = character.Torso
rightarm.Part1 = character["Right Arm"]
rightarm.C0 = CFrame.new(1.5,0,0)
rightarm.Name = "RightArmWeldbat"
local leftarm = Instance.new("Weld", character.Torso)
leftarm.Part0 = character.Torso
leftarm.Part1 = character["Left Arm"]
leftarm.C0 = CFrame.new(-1.5,0,0)
leftarm.Name = "LeftArmWeldbat"
local head = Instance.new("Weld", character.Torso)
head.Part0 = character.Torso
head.Part1 = character.Head
head.C0 = CFrame.new(0,1.5,0)
head.Name = "HeadWeldbat"
local humanoidrootpart = Instance.new("Weld", character.HumanoidRootPart)
humanoidrootpart.Part0 = character.HumanoidRootPart
humanoidrootpart.Part1 = character.Torso
humanoidrootpart.Name = "HumanoidRootPartWeldbat"
for i = 0,1 , 0.05 do
humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.fromEulerAnglesXYZ(0,math.rad(25),0),i)
leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.pi+math.rad(10),math.rad(75),math.rad(-10)) * CFrame.new(0,-0.5,0),i)
rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(0,0,math.rad(10)) * CFrame.new(0,-0.5,0),i)
runservice.Stepped:wait()
end
local grip = character["Right Arm"]:WaitForChild("RightGrip")
grip.Part1 = nil
local weldd = Instance.new("Weld", handle)
weldd.Part0 = character["Left Arm"]
weldd.Part1 = handle
weldd.Name = "AIDS"
weldd.C0 = CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0) * CFrame.fromEulerAnglesXYZ((math.pi/2),math.rad(15),0) * CFrame.new(-0.7,0,-0.1)
cananimate = true
if character:findFirstChild("BatBack") then
character:findFirstChild("BatBack").Transparency = 1
end
handle.Transparency = 0
equipsound:Play()
local WHEN = 0
coroutine.wrap(function()
while runservice.Stepped:wait() and equipped do
if cananimate then
if WHEN < 40 then
WHEN = WHEN + 1
elseif WHEN == 40 then
WHEN = 41
grip.Part1 = handle
canattack = true
weldd:destroy()
end
tool.Grip = tool.Grip:lerp(CFrame.new(0, 0, -1.70000005, 0, 0, 1, 1, 0, 0, 0, 1, 0),0.1)
head.C0 = head.C0:lerp(CFrame.new(0,1.5,0),0.1)
humanoidrootpart.C0 = humanoidrootpart.C0:lerp(CFrame.new(),0.1)
leftarm.C0 = leftarm.C0:lerp(CFrame.new(-1.4,0.5,0) * CFrame.fromEulerAnglesXYZ((math.pi/2)-math.rad(50)+math.sin(tick())/15,0,math.rad(50)) * CFrame.new(0,-0.8,0),0.1)
rightarm.C0 = rightarm.C0:lerp(CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ((math.pi/2)-math.rad(35)+math.sin(tick())/15,math.rad(20),math.rad(-40)) * CFrame.new(0,-0.8,0),0.1)
end
end
end)()
end)
tool.Unequipped:connect(function()
equipped = false
mouseclick = false
cananimate = false
if character.Torso:findFirstChild("LeftArmWeldbat") then
character.Torso:findFirstChild("LeftArmWeldbat"):destroy()
end
if character.Torso:findFirstChild("RightArmWeldbat") then
character.Torso:findFirstChild("RightArmWeldbat"):destroy()
end
if character.Torso:findFirstChild("HeadWeldbat") then
character.Torso:findFirstChild("HeadWeldbat"):destroy()
end
if character:findFirstChild("HumanoidRootPart") then
if character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldbat") then
character.HumanoidRootPart:findFirstChild("HumanoidRootPartWeldbat"):destroy()
end
end
if not character:findFirstChild("BatBack") then
local clone = handle:Clone()
clone:BreakJoints()
for i,v in pairs(clone:GetDescendants()) do
if v.ClassName ~= "SpecialMesh" and v.ClassName ~= "TouchTransmitter" then
v:destroy()
end
end
local weld = Instance.new("Weld", clone)
weld.Part0 = character.Torso
weld.Part1 = clone
weld.C0 = CFrame.new(0,0,0.55)
weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(0,math.pi/2,math.pi/2)
weld.C0 = weld.C0 * CFrame.fromEulerAnglesXYZ(math.pi,math.rad(60)+math.pi,0)
clone.Parent = character
clone.Name = "BatBack"
else
character:findFirstChild("BatBack").Transparency = 0
end
handle.Transparency = 1
character.BatBack:findFirstChildOfClass("SpecialMesh").TextureId = handle:findFirstChildOfClass("SpecialMesh").TextureId
end)
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]] | --
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2, p3)
local l__Gravity__1 = game.Workspace.Gravity;
local v2 = math.atan((p3 ^ 2 + math.sqrt(p3 ^ 4 - l__Gravity__1 * (l__Gravity__1 * p1 ^ 2 + 2 * p2 * p3 ^ 2))) / (l__Gravity__1 * p1));
if v2 ~= v2 then
v2 = math.pi / 4;
end;
return v2;
end;
|
--= Functions =-- |
UIS.InputBegan:connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
character.Humanoid.WalkSpeed = NewWalkSpeed
sprinting = true
while power > 0 and sprinting do
power = power - .03
Bar.Size = UDim2.new(power / 10, 0, 1, 0)
--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 42, 42), 0.001)
tween:Play()
wait()
if power <= 0 then
character.Humanoid.WalkSpeed = NormalWalkSpeed
end
end
end
end)
UIS.InputEnded:connect(function(key, gameProcessed)
if key.KeyCode == Enum.KeyCode.LeftShift and gameProcessed == false then
character.Humanoid.WalkSpeed = NormalWalkSpeed
sprinting = false
while power < 10 and not sprinting do
power = power + .03
Bar.Size = UDim2.new(power / 10, 0, 1, 0)
--Bar.BackgroundColor3 = Bar.BackgroundColor3:lerp(Color3.fromRGB(255, 166, 11), 0.001)
tween2:Play()
wait()
if power <= 0 then
character.Humanoid.WalkSpeed = NormalWalkSpeed
end
end
end
end)
|
--[[
This function spawns a set number of tools within each room. Spawn locations are randomly picked, as long as it's
within the room, and there is sufficient free space around the ranodmly picked location.
]] |
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RoomManager = require(ServerStorage.Source.Managers.RoomManager)
local getRandomClearLocationInRegionAsync = require(ServerStorage.Source.Common.getRandomClearLocationInRegionAsync)
local toolsFolder = ReplicatedStorage.Tools
local gravityFuel = toolsFolder.GravityFuel
local repairKit = toolsFolder.RepairKit
local broom = toolsFolder.Broom
local largeCargo = toolsFolder.LargeCargo
local smallCargo = toolsFolder.SmallCargo
local torch = toolsFolder.Torch
local TOTAL_TOOLS_PER_ROOM = 7
local AREA_CLEAR_SIZE = Vector3.new(5, 5, 5)
local random = Random.new(tick())
|
--// F key, HornOn |
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
veh.Lightbar.HORN.Transparency = 0
end
end)
|