prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[
PLEASE ADD THE FOLLOWING LINES OF CODE IN THE CONFIGURATION (POINTS.POINTSAWARDED)
function(newPoints,Employee) -- Runs every time points are awarded to anyone. newPoints is the new total value of points the employee has, and Employee is the employee (Player).
Employee:WaitForChild('leaderstats'):WaitForChild('Points').Value = newPoints
end; -- Recommended only for scripters
--]]
| |
--[=[
@class SoftShutdownServiceClient
]=]
|
local require = require(script.Parent.loader).load(script)
local Workspace = game:GetService("Workspace")
local UserInputService = game:GetService("UserInputService")
local StarterGui = game:GetService("StarterGui")
local TeleportService = game:GetService("TeleportService")
local AttributeValue = require("AttributeValue")
local Maid = require("Maid")
local PlayerGuiUtils = require("PlayerGuiUtils")
local Rx = require("Rx")
local SoftShutdownConstants = require("SoftShutdownConstants")
local SoftShutdownTranslator = require("SoftShutdownTranslator")
local SoftShutdownUI = require("SoftShutdownUI")
local RxValueBaseUtils = require("RxValueBaseUtils")
local SoftShutdownServiceClient = {}
local DISABLE_CORE_GUI_TYPES = {
Enum.CoreGuiType.PlayerList;
Enum.CoreGuiType.Health;
Enum.CoreGuiType.Backpack;
Enum.CoreGuiType.Chat;
Enum.CoreGuiType.EmotesMenu;
Enum.CoreGuiType.All;
}
function SoftShutdownServiceClient:Init(serviceBag)
assert(not self._serviceBag, "Already initialized")
self._serviceBag = assert(serviceBag, "No serviceBag")
self._maid = Maid.new()
self._translator = self._serviceBag:GetService(SoftShutdownTranslator)
self._isLobby = AttributeValue.new(Workspace, SoftShutdownConstants.IS_SOFT_SHUTDOWN_LOBBY_ATTRIBUTE, false)
self._isUpdating = AttributeValue.new(Workspace, SoftShutdownConstants.IS_SOFT_SHUTDOWN_UPDATING_ATTRIBUTE, false)
self._localTeleportDataSaysIsLobby = Instance.new("BoolValue")
self._localTeleportDataSaysIsLobby.Value = false
self._maid:GiveTask(self._localTeleportDataSaysIsLobby)
self._isArrivingAfterShutdown = Instance.new("BoolValue")
self._isArrivingAfterShutdown.Value = false
self._maid:GiveTask(self._isArrivingAfterShutdown)
task.spawn(function()
if self:_queryLocalTeleportInfo() then
self._localTeleportDataSaysIsLobby.Value = true
end
if self:_queryIsArrivingAfterShutdown() then
self._isArrivingAfterShutdown.Value = true;
end
end)
self._maid:GiveTask(Rx.combineLatest({
isLobby = self._isLobby:Observe();
isShuttingDown = self._isUpdating:Observe();
localTeleportDataSaysIsLobby = RxValueBaseUtils.observeValue(self._localTeleportDataSaysIsLobby);
isArrivingAfterShutdown = RxValueBaseUtils.observeValue(self._isArrivingAfterShutdown);
}):Subscribe(function(state)
if state.isLobby or state.localTeleportDataSaysIsLobby then
self._maid._shutdownUI = nil
if not self._maid._lobbyUI then
local screenGui
self._maid._lobbyUI, screenGui = self:_showSoftShutdownUI("shutdown.lobby.title", "shutdown.lobby.subtitle", true)
TeleportService:SetTeleportGui(screenGui)
end
elseif state.isShuttingDown then
local screenGui
self._maid._shutdownUI, screenGui = self:_showSoftShutdownUI("shutdown.restart.title", "shutdown.restart.subtitle")
TeleportService:SetTeleportGui(screenGui)
self._maid._lobbyUI = nil
elseif state.isArrivingAfterShutdown then
-- Construct
local maid = self:_showSoftShutdownUI("shutdown.complete.title", "shutdown.complete.subtitle", true)
self._maid._shutdownUI = maid
self._maid._lobbyUI = nil
-- Defer
task.delay(1, function()
if self._maid._shutdownUI == maid then
self._maid._shutdownUI = nil
end
end)
else
self._maid._shutdownUI = nil
self._maid._lobbyUI = nil
end
end))
end
function SoftShutdownServiceClient:_queryIsArrivingAfterShutdown()
local data = TeleportService:GetLocalPlayerTeleportData()
if type(data) == "table" and data.isSoftShutdownArrivingIntoUpdatedServer then
return true
else
return false
end
end
function SoftShutdownServiceClient:_queryLocalTeleportInfo()
local data = TeleportService:GetLocalPlayerTeleportData()
if type(data) == "table" and data.isSoftShutdownReserveServer then
return true
else
return false
end
end
function SoftShutdownServiceClient:_showSoftShutdownUI(titleKey, subtitleKey, doNotAnimateShow)
local maid = Maid.new()
local renderMaid = Maid.new()
local screenGui = Instance.new("ScreenGui")
screenGui.Name = "SoftShutdownScreenGui"
screenGui.ResetOnSpawn = false
screenGui.AutoLocalize = false
screenGui.IgnoreGuiInset = true
screenGui.DisplayOrder = 1e10
screenGui.Parent = PlayerGuiUtils.getPlayerGui()
screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
renderMaid:GiveTask(screenGui)
local softShutdownUI = SoftShutdownUI.new()
renderMaid:GiveTask(softShutdownUI)
maid:GiveTask(function()
softShutdownUI:Hide()
task.delay(1, function()
renderMaid:Destroy()
end)
end)
self:_hideCoreGuiUI(renderMaid, screenGui)
maid:GivePromise(self._translator:PromiseFormatByKey(subtitleKey)):Then(function(subtitle)
softShutdownUI:SetSubtitle(subtitle)
end)
maid:GivePromise(self._translator:PromiseFormatByKey(titleKey)):Then(function(title)
softShutdownUI:SetTitle(title)
end)
softShutdownUI:Show(doNotAnimateShow)
softShutdownUI.Gui.Parent = screenGui
return maid, screenGui
end
function SoftShutdownServiceClient:_hideCoreGuiUI(maid, ignoreScreenGui)
-- Hide all other ui
if not UserInputService.ModalEnabled then
UserInputService.ModalEnabled = true
maid:GiveTask(function()
UserInputService.ModalEnabled = false
end)
end
local playerGui = PlayerGuiUtils.getPlayerGui()
local enabledScreenGuis = {}
local function handleChild(child)
if child:IsA("ScreenGui") and child ~= ignoreScreenGui and child.Enabled then
enabledScreenGuis[child] = child
child.Enabled = false
end
end
for _, child in pairs(playerGui:GetChildren()) do
handleChild(child)
end
maid:GiveTask(playerGui.ChildAdded:Connect(function(child)
handleChild(child)
end))
maid:GiveTask(playerGui.ChildRemoved:Connect(function(child)
enabledScreenGuis[child] = nil
end))
maid:GiveTask(function()
for screenGui, _ in pairs(enabledScreenGuis) do
screenGui.Enabled = true
end
end)
for _, coreGuiType in pairs(DISABLE_CORE_GUI_TYPES) do
task.spawn(function()
if StarterGui:GetCoreGuiEnabled(coreGuiType) then
StarterGui:SetCoreGuiEnabled(coreGuiType, false)
maid:GiveTask(function()
StarterGui:SetCoreGuiEnabled(coreGuiType, true)
end)
end
end)
end
end
function SoftShutdownServiceClient:Destroy()
self._maid:DoCleaning()
end
return SoftShutdownServiceClient
|
-- Objects with any dimension thinner than this will be ignored
-- by no-clip checks, which leaves some room for events like doors
-- that close right behind players.
|
config.NoclipThicknessTolerance = 3.1
|
-- constants
|
local CAMERA = Workspace.CurrentCamera
local PLAYER = Players.LocalPlayer
local REMOTES = ReplicatedStorage:WaitForChild("Remotes")
local ITEMS = ReplicatedStorage:WaitForChild("Items")
local DROPS = Workspace:WaitForChild("Drops")
local EFFECTS = Workspace:WaitForChild("Effects")
local OUTLINE_COLOR = Color3.fromRGB(249, 142, 190)
local OUTLINE_WIDTH = 0.3
local UPDATE_RANGE = 400
|
-- This function generates a random secret and stores it in the global variable
|
function generateSecret()
-- Generate a random number between 1 and 100
secret = math.random(100)
end
|
--!strict
--[[
Original Author: TacoBellSaucePackets
Original Source: https://devforum.roblox.com/t/adonis-g-api-usage/477194/4
Description: This plugin will give a certain temporary permission level to private server owners
Place this ModuleScript in Adonis_Loader > Config > Plugins and name it "Server-PrivateServerOwnerAdmin"
--]]
| |
-- Version 3
-- Last updated: 31/07/2020
|
local Module = {}
DebugEnabled = false
Debris = game:GetService("Debris")
function Module.FracturePart(PartToFracture)
if PartToFracture then return end -- UNUSED LOL
local BreakingPointAttachment = PartToFracture:FindFirstChild("BreakingPoint")
-- Settings
local Configuration = require(script.Parent.Configuration)
local DebrisDespawn = false
local DebrisDespawnDelay = 0
local WeldDebris = false
local AnchorDebris = false
if DebugEnabled then
local DebugPart = Instance.new("Part")
DebugPart.Shape = "Ball"
DebugPart.CanCollide = false
DebugPart.Anchored = true
DebugPart.Size = Vector3.new(0.5, 0.5, 0.5)
DebugPart.Color = Color3.fromRGB(255, 0, 0)
DebugPart.Position = BreakingPointAttachment.WorldPosition
DebugPart.Parent = workspace
end
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
if BreakSound then
local SoundPart = Instance.new("Part")
SoundPart.Size = Vector3.new(0.2, 0.2, 0.2)
SoundPart.Position = PartToFracture.Position
SoundPart.Name = "TemporarySoundEmitter"
SoundPart.Anchored = true
SoundPart.CanCollide = false
SoundPart.Transparency = 1
local Sound = BreakSound:Clone()
Sound.Parent = SoundPart
SoundPart.Parent = workspace
Sound:Play()
Debris:AddItem(SoundPart, Sound.PlaybackSpeed)
end
if Configuration then
DebrisDespawn = Configuration.DebrisDespawn
DebrisDespawnDelay = Configuration.DebrisDespawnDelay
WeldDebris = Configuration.WeldDebris
AnchorDebris = Configuration.AnchorDebris
else
warn("The 'Configuration' is not a valid member of " .. PartToFracture.Name .. ". Please insert a 'Configuration' with the following values; 'DebrisDespawn' (bool), 'WeldDebris' (bool), 'DebrisDespawnDelay' (number/int)")
end
if not BreakingPointAttachment then
warn("The 'BreakingPoint' attachment is not a valid member of " .. PartToFracture.Name .. ". Please insert an attachment named 'BreakingPoint'")
end
local BreakingPointY = BreakingPointAttachment.Position.Y
local BreakingPointZ = BreakingPointAttachment.Position.Z
local ShardBottomLeft = Instance.new("WedgePart")
local ShardBottomRight = Instance.new("WedgePart")
local ShardTopLeft = Instance.new("WedgePart")
local ShardTopRight = Instance.new("WedgePart")
local BreakSound = PartToFracture:FindFirstChild("BreakSound")
-- Bottom Left
ShardBottomLeft.Material = PartToFracture.Material
ShardBottomLeft.Color = PartToFracture.Color
ShardBottomLeft.Transparency = PartToFracture.Transparency
ShardBottomLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
local OldSizeY = ShardBottomLeft.Size.Y
local OldSizeZ = ShardBottomLeft.Size.Z
ShardBottomLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardBottomLeft.Size.Y / 2), BreakingPointZ + (ShardBottomLeft.Size.Z / 2))
ShardBottomLeft.CFrame = ShardBottomLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardBottomLeft.Size = Vector3.new(ShardBottomLeft.Size.X, OldSizeZ, OldSizeY)
local ShardBottomLeft2 = ShardBottomLeft:Clone()
ShardBottomLeft2.CFrame = ShardBottomLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Bottom Right
ShardBottomRight.Material = PartToFracture.Material
ShardBottomRight.Color = PartToFracture.Color
ShardBottomRight.Transparency = PartToFracture.Transparency
ShardBottomRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) + BreakingPointZ)
ShardBottomRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardBottomRight.Size.Y / 2), BreakingPointZ + (ShardBottomRight.Size.Z / 2))
local ShardBottomRight2 = ShardBottomRight:Clone()
ShardBottomRight2.CFrame = ShardBottomRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Left
ShardTopLeft.Material = PartToFracture.Material
ShardTopLeft.Color = PartToFracture.Color
ShardTopLeft.Transparency = PartToFracture.Transparency
ShardTopLeft.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) + BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
local OldSizeY = ShardTopLeft.Size.Y
local OldSizeZ = ShardTopLeft.Size.Z
ShardTopLeft.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY + (ShardTopLeft.Size.Y / 2), BreakingPointZ - (ShardTopLeft.Size.Z / 2))
ShardTopLeft.CFrame = ShardTopLeft.CFrame * CFrame.Angles(math.rad(90), 0, 0)
ShardTopLeft.Size = Vector3.new(ShardTopLeft.Size.X, OldSizeZ, OldSizeY)
local ShardTopLeft2 = ShardTopLeft:Clone()
ShardTopLeft2.CFrame = ShardTopLeft2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
-- Top Right
ShardTopRight.Material = PartToFracture.Material
ShardTopRight.Color = PartToFracture.Color
ShardTopRight.Transparency = PartToFracture.Transparency
ShardTopRight.Size = PartToFracture.Size - Vector3.new(0, (PartToFracture.Size.Y / 2) - BreakingPointY, (PartToFracture.Size.Z / 2) - BreakingPointZ)
ShardTopRight.CFrame = PartToFracture.CFrame * CFrame.new(0, BreakingPointY - (ShardTopRight.Size.Y / 2), BreakingPointZ - (ShardTopRight.Size.Z / 2))
local ShardTopRight2 = ShardTopRight:Clone()
ShardTopRight2.CFrame = ShardTopRight2.CFrame * CFrame.Angles(math.rad(180), 0, 0)
local ShardDictionary = {ShardBottomLeft, ShardBottomLeft2, ShardBottomRight, ShardBottomRight2, ShardTopLeft, ShardTopLeft2, ShardTopRight, ShardTopRight2}
local FirstShard = nil
for Index, Shard in ipairs(ShardDictionary) do
if not FirstShard then
FirstShard = Shard
end
Shard.Anchored = AnchorDebris
if not AnchorDebris then
Shard.Velocity = PartToFracture.Velocity
Shard.RotVelocity = PartToFracture.RotVelocity
end
if WeldDebris and FirstShard then
local Weld = Instance.new("WeldConstraint")
Weld.Name = "ShardWeld"
Weld.Part0 = FirstShard
Weld.Part1 = Shard
Weld.Parent = Shard
end
Shard.Name = "Shard"
Shard.Parent = PartToFracture.Parent
if DebrisDespawn then
Debris:AddItem(Shard, DebrisDespawnDelay)
end
end
PartToFracture:Destroy()
end
return Module
|
--[[
Runs all test and reports the results using the given test reporter.
If no reporter is specified, a reasonable default is provided.
This function demonstrates the expected workflow with this testing system:
1. Locate test modules
2. Generate test plan
3. Run test plan
4. Report test results
This means we could hypothetically present a GUI to the developer that shows
the test plan before we execute it, allowing them to toggle specific tests
before they're run, but after they've been identified!
]]
|
function TestBootstrap:run(roots, reporter, otherOptions)
reporter = reporter or TextReporter
otherOptions = otherOptions or {}
local showTimingInfo = otherOptions["showTimingInfo"] or false
local runTestsByPath = {}
local testNamePattern = _G["TESTEZ_TEST_NAME_PATTERN"]
local testPathPattern = _G["TESTEZ_TEST_PATH_PATTERN"]
local testPathIgnorePatterns = _G["TESTEZ_TEST_PATH_IGNORE_PATTERNS"]
local extraEnvironment = otherOptions["extraEnvironment"] or {}
for testPath in string.gmatch(_G["TESTEZ_RUN_TESTS_PATH"] or "", "([^,]+)") do
table.insert(runTestsByPath, testPath)
end
if type(roots) ~= "table" then
error(("Bad argument #1 to TestBootstrap:run. Expected table, got %s"):format(typeof(roots)), 2)
end
local startTime = tick()
local modules = {}
for _, subRoot in ipairs(roots) do
local newModules = self:getModules(subRoot)
for _, newModule in ipairs(newModules) do
table.insert(modules, newModule)
end
end
local afterModules = tick()
local planArgs = {
runTestsByPath = runTestsByPath,
testNamePattern = testNamePattern,
testPathPattern = testPathPattern,
testPathIgnorePatterns = testPathIgnorePatterns,
extraEnvironment = extraEnvironment,
}
local plan = TestPlanner.createPlan(modules, planArgs)
local afterPlan = tick()
local results = TestRunner.runPlan(plan)
local afterRun = tick()
reporter.report(results)
local afterReport = tick()
if showTimingInfo then
local timing = {
("Took %f seconds to locate test modules"):format(afterModules - startTime),
("Took %f seconds to create test plan"):format(afterPlan - afterModules),
("Took %f seconds to run tests"):format(afterRun - afterPlan),
("Took %f seconds to report tests"):format(afterReport - afterRun),
}
print(table.concat(timing, "\n"))
end
return results
end
return TestBootstrap
|
-- Local Functions
|
local function FindAndSaveSpawns(object)
for _, child in pairs(object:GetChildren()) do
if child:IsA("SpawnLocation") then
table.insert(Spawns, child)
end
FindAndSaveSpawns(child)
end
end
|
--[[
if time>nextsound then
playsound(time)
end
--]]
|
if time>nextjump then
nextjump=time+7+(math.random()*5)
Humanoid.Jump=true
end
animate(time)
end
wait(4)
sp:Destroy() --Rest In Pizza
|
-- Set the DisplayName to the player's display name
|
local displayNameLabel = displayName
displayNameLabel.Text = player.DisplayName
displaynameprofile.Text = player.DisplayName
usernameprofile.Text = "@"..player.Name
local TextLabel = script.Parent.Parent.Parent.AppManager["App Store"].Date
local TextLabelSht = script.Parent.Parent.Parent.ShutterFrame.Date
local function getCurrentDate()
local currentDate = os.date("*t")
local day = currentDate.day
local month = os.date("%B")
local formattedDate = string.format("%d %s", day, month)
return formattedDate
end
|
--sounds
|
soundsdisabledfromrefit = {""}
local boltpsound = Instance.new("Sound", handle)
boltpsound.SoundId = "rbxassetid://456267525"
boltpsound.Volume = 0.8
boltpsound.Name = "boltpsound"
boltpsound.RollOffMinDistance = 1
boltpsound.RollOffMaxDistance = 300
local shellsound = Instance.new("Sound", handle)
shellsound.SoundId = "rbxassetid://2712533735"
shellsound.Volume = 0.5
shellsound.Name = "shellsound"
shellsound.RollOffMinDistance = 1
shellsound.RollOffMaxDistance = 300
local magoutsound = Instance.new("Sound", handle)
magoutsound.SoundId = "rbxassetid://268445237"
magoutsound.Volume = 0.8
magoutsound.Name = "magoutsound"
magoutsound.RollOffMinDistance = 1
magoutsound.RollOffMaxDistance = 300
local maginsound = Instance.new("Sound", handle)
maginsound.SoundId = "rbxassetid://2546411966"
maginsound.Volume = 0.8
maginsound.Name = "magoutsound"
maginsound.RollOffMinDistance = 1
maginsound.RollOffMaxDistance = 300
local magreachsound = Instance.new("Sound", handle)
magreachsound.SoundId = "rbxassetid://7329457810"
magreachsound.Volume = 3
magreachsound.Name = "magreachsound"
magreachsound.RollOffMinDistance = 1
magreachsound.RollOffMaxDistance = 300
local shootsound = Instance.new("Sound", handle)
shootsound.SoundId = "rbxassetid://6530496628"
shootsound.Volume = 1.5
shootsound.Name = "shootsound"
shootsound.RollOffMinDistance = 1
shootsound.RollOffMaxDistance = 300
concretesoundtick = tick()
local hitconcrete = Instance.new("Sound", handle)
hitconcrete.SoundId = "rbxassetid://6962153997"
hitconcrete.Volume = 1
hitconcrete.Name = "hitcsound"
hitconcrete.RollOffMinDistance = 1
hitconcrete.RollOffMaxDistance = 200
hitcsounds = {"6962154328", "6962154691", "6962155378", "6962153997"}
function playsound(sound, timep, playbacks, volume)
pcall(function() -- so the script wont die if someone renames sounds/attempts to play something that isnt a sound
sound.TimePosition = timep
sound.PlaybackSpeed = playbacks
sound.Volume = volume
sound:Play()
end)
end
|
--// Damage Settings
|
Damage = 26;
HeadDamage = 100;
|
-- [[ Update ]]--
|
function OrbitalCamera:Update(dt)
local now = tick()
local timeDelta = (now - self.lastUpdate)
local userPanningTheCamera = (self.UserPanningTheCamera == true)
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local player = PlayersService.LocalPlayer
local cameraSubject = camera and camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform')
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
if self.lastUpdate then
local gamepadRotation = self:UpdateGamepad()
if self:ShouldUseVRRotation() then
self.RotateInput = self.RotateInput + self:GetVRRotationInput()
else
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math.min(0.1, timeDelta)
if gamepadRotation ~= ZERO_VECTOR2 then
userPanningTheCamera = true
self.rotateInput = self.rotateInput + (gamepadRotation * delta)
end
local angle = 0
if not (isInVehicle or isOnASkateboard) then
angle = angle + (self.TurningLeft and -120 or 0)
angle = angle + (self.TurningRight and 120 or 0)
end
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(math.rad(angle * delta), 0)
userPanningTheCamera = true
end
end
end
-- Reset tween speed if user is panning
if userPanningTheCamera then
self.lastUserPanCamera = tick()
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
-- Process any dollying being done by gamepad
-- TODO: Move this
if self.gamepadDollySpeedMultiplier ~= 1 then
self:SetCameraToSubjectDistance(self.currentSubjectDistance * self.gamepadDollySpeedMultiplier)
end
local VREnabled = VRService.VREnabled
newCameraFocus = VREnabled and self:GetVRFocus(subjectPosition, timeDelta) or CFrame.new(subjectPosition)
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > self.currentSubjectDistance or self.rotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, self.currentSubjectDistance)
-- Note that CalculateNewLookVector is overridden from BaseCamera
vecToSubject = self:CalculateNewLookVector(vecToSubject.unit * X1_Y0_Z1, Vector2.new(self.rotateInput.x, 0)) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if self.rotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
self.RotateInput = ZERO_VECTOR2
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
-- self.RotateInput is a Vector2 of mouse movement deltas since last update
self.curAzimuthRad = self.curAzimuthRad - self.rotateInput.x
if self.useAzimuthLimits then
self.curAzimuthRad = Util.Clamp(self.minAzimuthAbsoluteRad, self.maxAzimuthAbsoluteRad, self.curAzimuthRad)
else
self.curAzimuthRad = (self.curAzimuthRad ~= 0) and (math.sign(self.curAzimuthRad) * (math.abs(self.curAzimuthRad) % TAU)) or 0
end
self.curElevationRad = Util.Clamp(self.minElevationRad, self.maxElevationRad, self.curElevationRad + self.rotateInput.y)
local cameraPosVector = self.currentSubjectDistance * ( CFrame.fromEulerAnglesYXZ( -self.curElevationRad, self.curAzimuthRad, 0 ) * UNIT_Z )
local camPos = subjectPosition + cameraPosVector
newCameraCFrame = CFrame.new(camPos, subjectPosition)
self.rotateInput = ZERO_VECTOR2
end
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
return OrbitalCamera
|
--[=[
Gets an event that will fire off whenever something is stored at this level
@return Signal
]=]
|
function DataStoreStage:GetTopLevelDataStoredSignal()
if self._topLevelStoreSignal then
return self._topLevelStoreSignal
end
self._topLevelStoreSignal = Signal.new()
self._maid:GiveTask(self._topLevelStoreSignal)
return self._topLevelStoreSignal
end
|
-- Events to listen to any player inputs
|
Seat1.Changed:connect(OnSeatsChange)
Seat2.Changed:connect(OnSeatsChange)
|
--Dont touch
|
local car = script.Parent.Bike.Value
local UserInputService = game:GetService("UserInputService")
local _InControls = false
local wheelie = false
local WheelieInput = 0
local KeyWhel = false
function DealWithInput(input)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then
if (input.KeyCode == Enum.KeyCode[WheelieButton]) and input.UserInputState == Enum.UserInputState.Begin then
KeyWhel = true
WheelieInput = 1
elseif (input.KeyCode == Enum.KeyCode[WheelieButton]) and input.UserInputState == Enum.UserInputState.End then
KeyWhel = false
WheelieInput = 0
end
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Wheelie
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
if input.Position.Y>= 0 then
local cDZone = math.min(.99,DeadZone/100)
if math.abs(input.Position.Y)>cDZone then
KeyWhel = false
WheelieInput = (input.Position.Y-cDZone)/(1-cDZone)
else
KeyWhel = false
WheelieInput = 0
end
else
local cDZone = math.min(.99,DeadZone/100)
if math.abs(input.Position.Y)>cDZone then
KeyWhel = false
WheelieInput = (input.Position.Y+cDZone)/(1-cDZone)
else
KeyWhel = false
WheelieInput = 0
end
end
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
if not car.Body.Weight:FindFirstChild("wheelie") then
gyro = Instance.new("BodyGyro")
gyro.Name = "wheelie"
gyro.Parent = car.Body.Weight
else
gyro = car.Body.Weight.wheelie
end
car.Body.Weight:WaitForChild("wheelie")
car.DriveSeat.ChildRemoved:connect(function(child)
gyro.D = 0
gyro.MaxTorque = Vector3.new(0,0,0)
gyro.P = 0
gyro.cframe = CFrame.new(car.Body.Weight.CFrame.p,car.Body.Weight.CFrame.p+car.Body.Weight.CFrame.lookVector)*CFrame.Angles(0,0,0)
end)
WheelieDivider = math.max(1,WheelieDivider)
StoppieDivider = math.max(1,StoppieDivider)
while wait(clock) do
_InControls = script.Parent.ControlsOpen.Value
if KeyWhel then
WheelieOutput = -WheelieInput*(script.Parent.Values.Throttle.Value-script.Parent.Values.Brake.Value)
else
WheelieOutput = WheelieInput
end
if script.Parent.Values.Throttle.Value > .1 then
gyro.D = WheelieD*(-(math.min(WheelieOutput,0))*script.Parent.Values.Throttle.Value)
gyro.MaxTorque = Vector3.new(WheelieTq*(-(math.min(WheelieOutput,0))*script.Parent.Values.Throttle.Value),0,0)
gyro.P = WheelieP*(-(math.min(WheelieOutput,0))*script.Parent.Values.Throttle.Value)
gyro.cframe = CFrame.new(car.Body.Weight.CFrame.p,car.Body.Weight.CFrame.p+car.Body.Weight.CFrame.lookVector)*CFrame.Angles((-(math.min(WheelieOutput,0)*WheelieMultiplier/WheelieDivider)*script.Parent.Values.Throttle.Value)-car.Body.Weight.CFrame.lookVector.Y,0,0)
elseif script.Parent.Values.Brake.Value > .1 then
gyro.D = StoppieD*((math.min(-WheelieOutput,0))*script.Parent.Values.Brake.Value)
gyro.MaxTorque = Vector3.new(StoppieTq*((math.min(-WheelieOutput,0))*script.Parent.Values.Brake.Value),0,0)
gyro.P = StoppieP*((math.min(-WheelieOutput,0))*script.Parent.Values.Brake.Value)
gyro.cframe = CFrame.new(car.Body.Weight.CFrame.p,car.Body.Weight.CFrame.p+car.Body.Weight.CFrame.lookVector)*CFrame.Angles(((math.min(-WheelieOutput,0)*StoppieMultiplier/StoppieDivider)*script.Parent.Values.Brake.Value)-car.Body.Weight.CFrame.lookVector.Y,0,0)
else
gyro.D = 0
gyro.MaxTorque = Vector3.new(0,0,0)
gyro.P = 0
gyro.cframe = CFrame.new(car.Body.Weight.CFrame.p,car.Body.Weight.CFrame.p+car.Body.Weight.CFrame.lookVector)*CFrame.Angles(0,0,0)
end
end
|
--[=[
Converts an arbitrary value to a LinearValue if Roblox has not defined this value
for multiplication and addition.
@param value T
@return LinearValue<T> | T
]=]
|
function SpringUtils.toLinearIfNeeded(value)
if typeof(value) == "Color3" then
return LinearValue.new(Color3.new, {value.r, value.g, value.b})
elseif typeof(value) == "UDim2" then
return LinearValue.new(UDim2.new, {value.X.Scale, value.X.Offset, value.Y.Scale, value.Y.Offset})
elseif typeof(value) == "UDim" then
return LinearValue.new(UDim.new, {value.scale, value.offset})
else
return value
end
end
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local gui = script.Parent.Parent--client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
local gone = false
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local fadeSteps = 10
local blurSize = 10
local textFade = 0.1
local strokeFade = 0.5
local frameFade = 0.3
local blurStep = blurSize/fadeSteps
local frameStep = frameFade/fadeSteps
local textStep = 0.1
local strokeStep = 0.1
local function fadeIn()
gTable:Ready()
for i = 1,fadeSteps do
if msg.TextTransparency>textFade then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if msg.TextStrokeTransparency>strokeFade then
msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
end
if frame.BackgroundTransparency>frameFade then
frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
end
local function fadeOut()
if not gone then
gone = true
for i = 1,fadeSteps do
if msg.TextTransparency<1 then
msg.TextTransparency = msg.TextTransparency+textStep
ttl.TextTransparency = ttl.TextTransparency+textStep
end
if msg.TextStrokeTransparency<1 then
msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
end
if frame.BackgroundTransparency<1 then
frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
service.UnWrap(gui):Destroy()
end
end
gTable.CustomDestroy = function()
fadeOut()
end
fadeIn()
if not tim then
local _,time = message:gsub(" ","")
time = math.clamp(time/2,4,11)+1
wait(time)
else
wait(tim)
end
if not gone then
fadeOut()
end
end
|
-- Dont touch anything here
|
local PGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("TopbarEnabled",false)
repeat wait() until script.Parent.Parent == game.Players.LocalPlayer:WaitForChild("PlayerGui")
while wait() do
local Load = game:GetService("ContentProvider").RequestQueueSize
print('Loading game ('..Load..')')
if Load == 0 then
wait(3)
script.Parent.BackGround.LoadIcon.Visible = false
script.Parent.BackGround.Text.LocalScript:Destroy()
script.Parent.BackGround.Text.Text = "Game Loaded!"
for i=1, 100 do
script.Parent.BackGround.BackgroundTransparency = i/100
script.Parent.BackGround.Text.TextTransparency = i/100
script.Parent.TopBar.BackgroundTransparency = i/100
wait(.01)
end
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCore("TopbarEnabled",true)
script.Parent:Destroy()
break
end
end
|
-- Function to handle key release
|
local function handleKeyRelease(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
setWalkspeed(defaultWalkspeed)
end
end
|
--made by Bertox
--lul
|
script.Parent.Parent.Parent.Parent.DriveSeat.Changed:connect(function()
if script.Parent.Parent.Parent.Parent.DriveSeat.Occupant ~= nil then
script.Parent.Transparency = 0
elseif script.Parent.Parent.Parent.Parent.DriveSeat.Occupant == nil then
script.Parent.Transparency = 1
end
end)
|
--[=[
Solving for angle across from c
@param a number
@param b number
@param c number
@return number? -- Returns nil if this cannot be solved for
]=]
|
function Math.lawOfCosines(a: number, b: number, c: number): number?
local l = (a*a + b*b - c*c) / (2 * a * b)
local angle = math.acos(l)
if angle ~= angle then
return nil
end
return angle
end
|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
end
end
function onClicked()
DoorClose()
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors.F14
then StopE() DoorOpen()
end
end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors.F14.Position
clicker = true
end
function DoorOpen()
while Shaft13.MetalDoor.Transparency < 1.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft13.MetalDoor.CanCollide = false
end
|
--[[Leaning]]
|
--
Tune.LeanSpeed = .05 -- How quickly the the bike will lean, .01 being slow, 1 being almost instantly
Tune.LeanProgressiveness = 30 -- How much steering is kept at higher speeds, a lower number is less steering, a higher number is more steering
Tune.MaxLean = 55 -- Maximum lean angle in degrees
Tune.LeanD = 90 -- Dampening of the lean
Tune.LeanMaxTorque = 500 -- Force of the lean
Tune.LeanP = 300 -- Aggressiveness of the lean
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -10
Tune.RCamber = -10
Tune.FToe = 0
Tune.RToe = 0
|
-- Issue with play solo? (F6)
|
while not UserInputService.KeyboardEnabled and not UserInputService.TouchEnabled do
wait()
end
|
-- lightOn(a)
-- wait(0.15)
--
-- lightOff(a)
-- wait(0.1)
|
lightOn(b)
wait(0.2)
lightOff(b)
wait(0.2)
|
--------END AUDIENCE BACK RIGHT--------
|
game.Workspace.rightpalette.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l14.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.rightpalette.l24.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
wait(0.15)
|
--Tune
|
local _Select = "Slicks" --(AllSeason, Slicks, SemiSlicks, AllTerrain, DragRadials, Custom) Caps and space sensitive
local _Custom = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = 0 , --How fast your tires will degrade (Front)
FTargetFriction = .3 , --Friction in optimal conditions (Front)
FMinFriction = 0.3 , --Friction in worst conditions (Front)
RWearSpeed = 0 , --How fast your tires will degrade (Rear)
RTargetFriction = .3 , --Friction in optimal conditions (Rear)
RMinFriction = 0.3 , --Friction in worst conditions (Rear)
--Tire Slip
TCSOffRatio = 1 , --How much optimal grip your car will lose with TCS off, set to 1 if you dont want any losses.
WheelLockRatio = 1/6 , --How much grip your car will lose when locking the wheels
WheelspinRatio = 1/1.2 , --How much grip your car will lose when spinning the wheels
--Wheel Properties
FFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front) (PGS)
RFrictionWeight = 2 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear) (PGS)
FLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Front)
RLgcyFrWeight = 0 , --Ratio of friction between wheel and terrain, the higher it is, the more true to target friction your grip wil be (Rear)
FElasticity = 0 , --How much your wheel will bounce (Front) (PGS)
RElasticity = 0 , --How much your wheel will bounce (Rear) (PGS)
FLgcyElasticity = 0 , --How much your wheel will bounce (Front)
RLgcyElasticity = 0 , --How much your wheel will bounce (Rear)
FElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front) (PGS)
RElastWeight = 1 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear) (PGS)
FLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Front)
RLgcyElWeight = 10 , --Ratio of elasticity between wheel and terrain, the higher it is, the more true to the wheel elasticity it will be (Rear)
--Wear Regen
RegenSpeed = 0 , --Don't change this
}
local _AllSeason = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .2 , --Don't change this
FTargetFriction = .6 , -- .58 to .63
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .2 , --Don't change this
RTargetFriction = .6 , -- .58 to .63
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 2 , --Don't change this
RFrictionWeight = 2 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _Slicks = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .6 , --Don't change this
FTargetFriction = .93 , -- .88 to .93
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .6 , --Don't change this
RTargetFriction = .93 , -- .88 to .93
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 0.6 , --Don't change this
RFrictionWeight = 0.6 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _SemiSlicks = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .5 , --Don't change this
FTargetFriction = .78 , -- .73 to .78
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .5 , --Don't change this
RTargetFriction = .78 , -- .73 to .78
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 0.6 , --Don't change this
RFrictionWeight = 0.6 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _AllTerrain = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .3 , --Don't change this
FTargetFriction = .5 , -- .48 to .53
FMinFriction = 0.35 , --Don't change this
RWearSpeed = .3 , --Don't change this
RTargetFriction = .5 , -- .48 to .53
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 10 , --Don't change this
RFrictionWeight = 10 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 3.6 , --Don't change this
}
local _DragRadials = {
TireWearOn = true ,
--Friction and Wear
FWearSpeed = 30 , --Don't change this
FTargetFriction = 1.2 , -- 1.18 to 1.23
FMinFriction = 0.35 , --Don't change this
RWearSpeed = 30 , --Don't change this
RTargetFriction = 1.2 , -- 1.18 to 1.23
RMinFriction = 0.35 , --Don't change this
--Tire Slip
TCSOffRatio = 1 , --Don't change this
WheelLockRatio = 1/6 , --Don't change this
WheelspinRatio = 1/1.2 , --Don't change this
--Wheel Properties
FFrictionWeight = 1 , --Don't change this
RFrictionWeight = 1 , --Don't change this
FLgcyFrWeight = 0 , --Don't change this
RLgcyFrWeight = 0 , --Don't change this
FElasticity = 0 , --Don't change this
RElasticity = 0 , --Don't change this
FLgcyElasticity = 0 , --Don't change this
RLgcyElasticity = 0 , --Don't change this
FElastWeight = 1 , --Don't change this
RElastWeight = 1 , --Don't change this
FLgcyElWeight = 10 , --Don't change this
RLgcyElWeight = 10 , --Don't change this
--Wear Regen
RegenSpeed = 20 , --Don't change this
}
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local cValues = script.Parent.Parent:WaitForChild("Values")
local _WHEELTUNE = _AllSeason
if _Select == "DragRadials" then
_WHEELTUNE = _DragRadials
elseif _Select == "Custom" then
_WHEELTUNE = _Custom
elseif _Select == "AllTerrain" then
_WHEELTUNE = _AllTerrain
elseif _Select == "Slicks" then
_WHEELTUNE = _Slicks
elseif _Select == "SemiSlicks" then
_WHEELTUNE = _SemiSlicks
else
_WHEELTUNE = _AllSeason
end
car.DriveSeat.TireStats.Fwear.Value = _WHEELTUNE.FWearSpeed
car.DriveSeat.TireStats.Ffriction.Value = _WHEELTUNE.FTargetFriction
car.DriveSeat.TireStats.Fminfriction.Value = _WHEELTUNE.FMinFriction
car.DriveSeat.TireStats.Ffweight.Value = _WHEELTUNE.FFrictionWeight
car.DriveSeat.TireStats.Rwear.Value = _WHEELTUNE.RWearSpeed
car.DriveSeat.TireStats.Rfriction.Value = _WHEELTUNE.RTargetFriction
car.DriveSeat.TireStats.Rminfriction.Value = _WHEELTUNE.RMinFriction
car.DriveSeat.TireStats.Rfweight.Value = _WHEELTUNE.RFrictionWeight
car.DriveSeat.TireStats.TCS.Value = _WHEELTUNE.TCSOffRatio
car.DriveSeat.TireStats.Lock.Value = _WHEELTUNE.WheelLockRatio
car.DriveSeat.TireStats.Spin.Value = _WHEELTUNE.WheelspinRatio
car.DriveSeat.TireStats.Reg.Value = _WHEELTUNE.RegenSpeed
|
-- Create the player join event handler
|
Players.PlayerAdded:Connect(function(player)
-- Add the player to the game state
gameState.players[player.Name] = player
-- Load the first level
loadLevel(1)
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.ChickWings-- 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)
|
--[[Steering]]
|
Tune.SteerInner = 34 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 28 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .18 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .2 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent._Index
local Package = require(PackageIndex["GoodSignal"]["GoodSignal"])
return Package
|
-- << WARNINGS >>
--CloseX
|
local function showLoading(warningFrame, status)
if status then
warningFrame.LoadingButton.Visible = true
warningFrame.MainButton.Visible = false
else
warningFrame.LoadingButton.Visible = false
warningFrame.MainButton.Visible = true
end
end
for _, warningFrame in pairs(main.warnings:GetChildren()) do
warningFrame.CloseX.MouseButton1Down:Connect(function()
main.warnings.Visible = false
end)
local button = warningFrame:FindFirstChild("MainButton")
if button then
local buttonDe = true
button.MouseButton1Down:Connect(function()
if buttonDe then
buttonDe = false
if warningFrame.Name == "BuyFrame" then
local productId = button.ProductId.Value
local productType = button.ProductType.Value
if productType == "Gamepass" then
main.marketplaceService:PromptGamePassPurchase(main.player, productId)
else
main.marketplaceService:PromptPurchase(main.player, productId)
end
elseif warningFrame.Name == "UnBan" then
showLoading(warningFrame, true)
main.signals.RequestCommand:InvokeServer(main.pdata.Prefix.."undirectban "..warningFrame.PlrName.Text)
main:GetModule("PageAdmin"):CreateBanland()
showLoading(warningFrame, false)
main.warnings.Visible = false
elseif warningFrame.Name == "PermRank" then
showLoading(warningFrame, true)
local userName = warningFrame.PlrName.Text
local id = main:GetModule("cf"):GetUserId(userName)
main.signals.RemovePermRank:InvokeServer{id, userName}
main:GetModule("PageAdmin"):CreateRanks()
showLoading(warningFrame, false)
main.warnings.Visible = false
elseif warningFrame.Name == "Teleport" then
showLoading(warningFrame, true)
local placeId = warningFrame.MainButton.PlaceId.Value
main.teleportService:Teleport(placeId)
main.teleportService.TeleportInitFailed:Wait()
showLoading(warningFrame, false)
end
buttonDe = true
end
end)
end
end
main.warnings.Visible = false
|
--
--
|
function Sword:Connect()
Handle.Touched:connect(function(hit)
local myPlayer = GLib.GetPlayerFromPart(Tool)
local character, player, humanoid = GLib.GetCharacterFromPart(hit)
if myPlayer~=nil and character~=nil and humanoid~=nil and myPlayer~=player then
local isTeammate = GLib.IsTeammate(myPlayer, player)
local myCharacter = myPlayer.Character
local myHumanoid = myCharacter and myCharacter:FindFirstChild'Humanoid'
if player.StarterGear:findFirstChild("Sword") then
if (Config.CanTeamkill.Value==true or isTeammate~=true) and (myHumanoid and myHumanoid:IsA'Humanoid' and myHumanoid.Health > 0) and (Config.CanKillWithForceField.Value or myCharacter:FindFirstChild'ForceField'==nil) then
local doDamage = Config.IdleDamage.Value
if Sword.State == 'Slashing' then
doDamage = Config.SlashDamage.Value
elseif Sword.State == 'Lunging' then
doDamage = Config.LungeDamage.Value
end
GLib.TagHumanoid(humanoid, myPlayer, 1)
humanoid:TakeDamage(doDamage)
end
end
end
end)
end
function Sword:Attack()
local myCharacter, myPlayer, myHumanoid = GLib.GetCharacterFromPart(Tool)
if myHumanoid~=nil and myHumanoid.Health > 0 then
if Config.CanKillWithForceField.Value or myCharacter:FindFirstChild'ForceField'==nil then
local now = tick()
if Sword.State == 'Slashing' and now-Sword.SlashingStartedAt < Sword.DoubleClickMaxTime then
Sword.AttackTicket = Sword.AttackTicket+1
Sword:Lunge(Sword.AttackTicket)
elseif Sword.State == 'Idle' then
Sword.AttackTicket = Sword.AttackTicket+1
Sword.SlashingStartedAt = now
Sword:Slash(Sword.AttackTicket)
end
end
end
end
function Sword:LocalAttack()
local myCharacter, myPlayer, myHumanoid = GLib.GetCharacterFromPart(Tool)
if myHumanoid~=nil and myHumanoid.Health > 0 then
if Config.CanKillWithForceField.Value or myCharacter:FindFirstChild'ForceField'==nil then
local now = tick()
if Sword.LocalState == 'Slashing' and now-Sword.LocalSlashingStartedAt < Sword.LocalDoubleClickMaxTime then
Sword.LocalAttackTicket = Sword.LocalAttackTicket+1
Sword:LocalLunge(Sword.LocalAttackTicket)
elseif Sword.LocalState == 'Idle' then
Sword.LocalAttackTicket = Sword.LocalAttackTicket+1
Sword.LocalSlashingStartedAt = now
Sword:LocalSlash(Sword.LocalAttackTicket)
end
end
end
end
function Sword:Slash(ticket)
Sword.State = 'Slashing'
Handle.SlashSound:Play()
Sword:Animate'Slash'
wait(0.5)
if Sword.AttackTicket == ticket then
Sword.State = 'Idle'
end
end
function Sword:LocalSlash(ticket)
Sword.LocalState = 'Slashing'
wait(0.5)
if Sword.LocalAttackTicket == ticket then
Sword.LocalState = 'Idle'
end
end
function Sword:Lunge(ticket)
Sword.State = 'Lunging'
Handle.LungeSound:Play()
Sword:Animate'Lunge'
local force = Instance.new'BodyVelocity'
force.velocity = Vector3.new(0, 10, 0)
force.maxForce = Vector3.new(0, 4000, 0)
force.Parent = Tool.Parent:findFirstChild'Torso' or Tool.Parent:findFirstChild'UpperTorso'
Sword.DestroyOnUnequip[force] = true
wait(0.25)
Tool.Grip = CFrame.new(0, 0, -1.5, 0, -1, -0, -1, 0, -0, 0, 0, -1)
wait(0.25)
force:Destroy()
Sword.DestroyOnUnequip[force] = nil
wait(0.5)
Tool.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Sword.State = 'Idle'
end
function Sword:LocalLunge(ticket)
Sword.LocalState = 'Lunging'
wait(0.25)
wait(0.25)
wait(0.5)
Sword.LocalState = 'Idle'
end
function Sword:Animate(name)
local tag = Instance.new'StringValue'
tag.Name = 'toolanim'
tag.Value = name
tag.Parent = Tool -- Tag gets removed by the animation script
end
function Sword:Unequip()
for obj in next, Sword.DestroyOnUnequip do
obj:Destroy()
end
Sword.DestroyOnUnequip = {}
Tool.Grip = CFrame.new(0, 0, -1.5, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Sword.State = 'Idle'
Sword.LocalState = 'Idle'
end
|
-- tween engine sound volume when we start driving
|
local engineStartTween = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
local Remotes = Vehicle:WaitForChild("Remotes")
local SetThrottleRemote = Remotes:WaitForChild("SetThrottle")
local SetThrottleConnection = nil
local EngineSoundEnabled = true
local TireTrailEnabled = true
local ignitionTime = 1.75 -- seconds
local lastAvgAngularVelocity = 0
local throttleEnabled = true
local lastThrottleUpdate = 0
local enginePower = 0 -- current rpm of the engine
local gainModifier = 1 -- modifier to engine rpm gain (lower if approaching max speed)
|
-- Modules / Directories --
|
local LegController = require(ReplicatedStorage.LegController)
|
--mobile support
|
local Buttons = script.Parent:WaitForChild("Buttons")
local Left = Buttons:WaitForChild("Left")
local Right = Buttons:WaitForChild("Right")
local Brake = Buttons:WaitForChild("Brake")
local Gas = Buttons:WaitForChild("Gas")
local Handbrake = Buttons:WaitForChild("Handbrake")
if UserInputService.TouchEnabled and not UserInputService.MouseEnabled then
Buttons.Visible = true
end
local function LeftTurn(Touch, GPE)
if Touch.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
Left.InputBegan:Connect(LeftTurn)
Left.InputEnded:Connect(LeftTurn)
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Owner", };
{4.7, "Owner admin", {"",0}, };
{4.6, "Youtuber Admin", {"",0}, };
{4.5, "Legendary Admin", {"",0}, };
{4, "Super Admin", {"",0}, };
{3, "level 2 Admin", {"",0}, };
{2, "Free Admin", };
};
|
--N63
|
shuriken = script.Parent
local sparkle = Instance.new("Sparkles")
sparkle.Color = Color3.new(10,10,255)
function onTouched(part)
connection:disconnect()
--local h = part.Parent:findFirstChild("Humanoid")
--if h then
sparkle.Parent = shuriken
shuriken.Anchored = true
wait(0.7)
local e = Instance.new("Explosion")
e.BlastPressure = 500000
e.BlastRadius = 3
e.Position = shuriken.Position
e.Parent = game.Workspace
--end
shuriken.Parent = nil
end
connection = shuriken.Touched:connect(onTouched)
wait(30)
shuriken.Parent = nil
|
----------------------------------------------
--- Scroll down for settings ---
--- Do not alter the three variables below ---
----------------------------------------------
|
local settings = {}; --// The settings table which contains all settings
local Settings = settings; --// For custom commands that use 'Settings' rather than the lowercase 'settings'
local descs = {}; --// Contains settings descriptions
|
-- KEY IS UP --
|
UIS.InputEnded:Connect(function(Input, isTyping)
if isTyping then return end
if Input.KeyCode == Enum.KeyCode.R then
if Holding.Value == "R" then
isHolding = false
SkillsHandler:FireServer("R", Mouse:GetHit().Position)
Animations.R:AdjustSpeed(1)
end
end
end)
Holding:GetPropertyChangedSignal("Value"):Connect(function()
if Holding.Value ~= "None" then
HumRP.Anchored = true
isHolding = true
if Holding.Value == "R" then
Animations.R:Play()
Animations.R:GetMarkerReachedSignal("Idle"):Connect(function()
if isHolding == true then
Animations.R:AdjustSpeed(0)
end
end)
repeat
HumRP.CFrame = CFrame.lookAt(HumRP.Position, Mouse:GetHit().Position)
task.wait()
until Holding.Value ~= "R"
end
else
HumRP.Anchored = false
end
end)
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS
|
function onRunning(speed)
if speed > 0.5 then
local scale = 16.0
playAnimation("walk", 0.2, zombie)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.2, zombie)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, zombie)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, zombie)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, zombie)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.8 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] .1 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] .328 , -- Reverse, Neutral, and 1st gear are required
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--Click to Open/Close Drawer--
|
local proximityPrompt = script.Parent.Parent.ClickBox.ProximityPrompt
local clicker = script.Parent.Parent.ClickBox
game:GetService("SoundService")
local Phone = script.Parent.PhoneSound
local isPlaying = false
proximityPrompt.Triggered:Connect(function()
print("Phone Clicked")
if not isPlaying then
isPlaying = true
proximityPrompt.Enabled = false
print("SoundPlayed")
local copysound = Phone:Clone()
copysound.Parent = clicker
copysound.Ended:Connect(function()
isPlaying = false
proximityPrompt.Enabled = true
copysound:Destroy()
print("SoundKilled")
end)
copysound:Play()
end
end)
|
-- Runners
|
function Sound.Init()
for _,v in pairs(game.ReplicatedStorage.Assets.Sounds:GetDescendants()) do
if v:IsA("Sound") then
local Name = v.Name:lower()
if Map[Name] then warn("Two sound with the same name '" .. Name .. "'.") end
Map[Name] = v
if v.Parent:IsA("Folder") then
local Name = v.Parent.Name:lower()
if not Groups[Name] then Groups[Name] = {} end
table.insert(Groups[Name], v)
end
end
end
end
Sound.ClientInit = Sound.Init
return Sound
|
--[[
if script.Parent.Parent.hc.Value == false then
repeat
spin()
until
script.Parent.Parent.Parent["cutscene."]["finished."].Value == true
else
local startTime = tick()
repeat
spin()
until
tick() - startTime > 8
end
]]
|
while true do
spin()
end
|
--!strict
|
type Array<T> = { [number]: T }
type callbackFn<T, U> = (element: T, index: number, array: Array<T>) -> U
type callbackFnWithThisArg<T, U, V> = (thisArg: V, element: T, index: number, array: Array<T>) -> U
type Object = { [string]: any }
|
--bullet data
|
local settingsfolder = tool:WaitForChild("settings")
local bchambered = settingsfolder:WaitForChild("bchambered")
local binmag = settingsfolder:WaitForChild("inmag")
local gunspeed = settingsfolder:WaitForChild("speed")
local magleft = settingsfolder:WaitForChild("magleft")
local bspeed = settingsfolder:WaitForChild("bspeed")
local maxpen = settingsfolder:WaitForChild("maxwpenetration")
local maxmagcap = settingsfolder:WaitForChild("maxmagcapacity")
local bulletholetime = 10
local shellflytime = 0.5
local shellfallspeed = 80
|
--[=[
@return boolean
@param opt Option
Metamethod to check equality between two options. Returns `true` if both
options hold the same value _or_ both options are None.
```lua
local o1 = Option.Some(32)
local o2 = Option.Some(32)
local o3 = Option.Some(64)
local o4 = Option.None
local o5 = Option.None
print(o1 == o2) --> true
print(o1 == o3) --> false
print(o1 == o4) --> false
print(o4 == o5) --> true
```
]=]
|
function Option:__eq(opt)
if Option.Is(opt) then
if self:IsSome() and opt:IsSome() then
return (self:Unwrap() == opt:Unwrap())
elseif self:IsNone() and opt:IsNone() then
return true
end
end
return false
end
|
--[=[
Private queue class for loading system.
@private
@class Queue
]=]
|
local Queue = {}
Queue.ClassName = "Queue"
Queue.__index = Queue
|
-- Create a wrapper around a function to capture what arguments it was called
-- with.
|
local symbols = require(script.Parent.symbols)
local isAMagicMock = require(script.Parent.isAMagicMock)
local Spy = {}
Spy.__index = Spy
Spy.__call = function(self, ...)
return self.inner(...)
end
local spyLookup = {}
setmetatable(spyLookup, {__mode = "kv"})
function Spy.new(inner)
local spy = {
[symbols.isSpy] = true,
[symbols.Calls] = {}
}
setmetatable(spy, Spy)
local wrapper = function(...)
local call = {
args = table.pack(...),
result = table.pack(inner(...)),
}
table.insert(spy[symbols.Calls], call)
return table.unpack(call.result)
end
spy.inner = wrapper
spyLookup[wrapper] = spy
return spy, wrapper
end
function Spy.lookup(wrapper)
return spyLookup[wrapper]
end
function Spy.is(object)
if not isAMagicMock(object) then
return type(object) == "table" and object[symbols.isSpy] ~= nil
end
return false
end
return Spy
|
-- This function isn't supported in a testing environment
|
ServerSceneFramework.GetServerTimeNow = function()
return workspace:GetServerTimeNow()
end
local hasBeenCalled = false
return function(stubs)
if hasBeenCalled then
error("Server Scene Framework has already been called")
return
end
-- Used for testing only
if stubs then
for i, v in pairs(stubs) do
ServerSceneFramework[i] = v
end
end
-- Load Character Remote Event: Load a player's character if primary part isn't detected for new scene
ServerSceneFramework.handleLoadCharacterRemoteEvent = ServerSceneFramework.LoadCharacterRemoteEventModule
ServerSceneFramework.LoadCharacterRemoteEvent.OnServerEvent:Connect(
ServerSceneFramework.handleLoadCharacterRemoteEvent
)
-- Load Scene: Loads a scene: Core functionality
ServerSceneFramework.LoadScene = ServerSceneFramework.LoadSceneModule(ServerSceneFramework)
-- Orchestrate Scene
ServerSceneFramework.OrchestrateSceneConnection = ServerSceneFramework.OrchestrateSceneEvent.OnServerEvent:Connect(
ServerSceneFramework.HandleOrchestrateEvent
)
-- Finished Loading Remote Event: Send Configs over for the current scene per player when they finish loading
ServerSceneFramework.handleFinishedLoadingRemoteEvent = ServerSceneFramework.FinishedLoadingClientModule(
ServerSceneFramework.SendSceneConfigForPlayer
)
ServerSceneFramework.FinishedLoadingRemoteEvent.OnServerEvent:Connect(
ServerSceneFramework.handleFinishedLoadingRemoteEvent
)
-- Get Current Scene Environment: Returns the folder containing respective scene's workspace assets
ServerSceneFramework.handleGetCurrentSceneEnvironment = ServerSceneFramework.GetCurrentSceneEnvironmentModule
ServerSceneFramework.GetCurrentSceneEnvironment.OnInvoke = ServerSceneFramework.handleGetCurrentSceneEnvironment
ServerSceneFramework.GetCurrentServerEnvironmentFromClient.OnServerInvoke =
ServerSceneFramework.handleGetCurrentSceneEnvironment
-- Is Loading Scene: Lets people know if SSF is loading a scene
ServerSceneFramework.handleIsLoadingScene = ServerSceneFramework.IsLoadingSceneModule
ServerSceneFramework.IsLoadingScene.OnInvoke = ServerSceneFramework.handleIsLoadingScene
-- Load Scene From List Event: LoadScene, but from the UI when user has permissions
ServerSceneFramework.handleLoadSceneFromListEvent = ServerSceneFramework.LoadSceneFromListEventModule(
ServerSceneFramework
)
ServerSceneFramework.LoadSceneFromListEvent.OnServerEvent:Connect(ServerSceneFramework.handleLoadSceneFromListEvent)
-- Load Scene Server: LoadScene programmatically from a server script
ServerSceneFramework.handleLoadSceneServer = ServerSceneFramework.LoadSceneServerModule(ServerSceneFramework)
ServerSceneFramework.LoadSceneServer.Event:Connect(ServerSceneFramework.handleLoadSceneServer)
-- On Player Added: Loads the current scene, if any, for a new player
ServerSceneFramework.OnPlayerAddedModule(ServerSceneFramework)
-- Check Folder For Loaded Scenes: Checks the workspace folders for a potentially loaded scene from plugin
ServerSceneFramework.CheckFolderForLoadedScenes = ServerSceneFramework.CheckFolderForLoadedScenesModule
-- Find Client Folder: checks for a possibly loaded scene's client folder
ServerSceneFramework.FindClientFolder = ServerSceneFramework.FindClientFolderModule
-- Find Server Folder: checks for a possibly loaded scene's server folder
ServerSceneFramework.FindServerFolder = ServerSceneFramework.FindServerFolderModule
-- Similar to running on require
ServerSceneFramework.InitModule(ServerSceneFramework)
hasBeenCalled = true
return ServerSceneFramework
end
|
-- Holding Services
|
Players = game:GetService("Players")
|
--Creates a random droplet on screen
|
local function CreateDroplet()
--Setup
local DecidedSize = Random_:NextNumber(0.01,0.07)
local stretch = 1 + math.random(15) / 10
local RunAmount = math.random(4)
local Tweens = table.create(RunAmount * 2 + 2)
local TweensLength = 0
local SizeOffset = math.random((DecidedSize / 3) * -10, (DecidedSize / 3) * 10) / 10
local Scale = DecidedSize + SizeOffset
local MeshScale = Vector3.new(Scale, Scale, Scale)
--Main droplet object
local DropletMain = Instance.new("Part")
DropletMain.Material = Enum.Material.Glass
DropletMain.CFrame = EMPTY_CFRAME
DropletMain.CanCollide = false
DropletMain.Transparency = 0.5
DropletMain.Name = "Droplet_Main"
DropletMain.Color = Color3.fromRGB(255, 255, 255)
DropletMain.Size = DROPLET_SIZE
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = MeshScale
Mesh.Parent = DropletMain
--Create droplet extrusions
for i = 1, RunAmount do
local eSizeOffset = math.random(
(DecidedSize / 3) * -100,
(DecidedSize / 3) * 100
) / 100
local ExtrusionCFrame = CFrame.new(Vector3.new(
math.random(-(DecidedSize * 40), DecidedSize * 40) / 100,
math.random(-(DecidedSize * 40), DecidedSize * 40) / 100,
0
))
local ExtrusionScale = DecidedSize / 1.5 + eSizeOffset
local ExtrusionMeshScale = Vector3.new(ExtrusionScale, ExtrusionScale, ExtrusionScale)
local Extrusion = Instance.new("Part")
Extrusion.Material = Enum.Material.Glass
Extrusion.CFrame = ExtrusionCFrame
Extrusion.CanCollide = false
Extrusion.Transparency = 0.5
Extrusion.Name = "Extrusion_" .. i
Extrusion.Color = Color3.fromRGB(255, 255, 255)
Extrusion.Size = DROPLET_SIZE
local ExtrusionMesh = Instance.new("SpecialMesh")
ExtrusionMesh.MeshType = Enum.MeshType.Sphere
ExtrusionMesh.Scale = ExtrusionMeshScale
ExtrusionMesh.Parent = Extrusion
Extrusion.Parent = DropletMain
local weld = Instance.new("Weld")
weld.C0 = ExtrusionCFrame:Inverse() * EMPTY_CFRAME
weld.Part0 = Extrusion
weld.Part1 = DropletMain
weld.Parent = Extrusion
IgnoreLength = IgnoreLength + 1
TweensLength = TweensLength + 1
ignoreList[IgnoreLength] = Extrusion
Tweens[TweensLength] = TweenService:Create(Extrusion, fadeInfo, fadeGoal)
TweensLength = TweensLength + 1
Tweens[TweensLength] = TweenService:Create(ExtrusionMesh, strechInfo, {
Scale = Vector3.new(ExtrusionScale, ExtrusionScale * stretch, ExtrusionScale);
Offset = Vector3.new(0, -(ExtrusionScale * stretch) / 2.05, 0);
})
end
IgnoreLength = IgnoreLength + 1
TweensLength = TweensLength + 1
ignoreList[IgnoreLength] = DropletMain
Tweens[TweensLength] = TweenService:Create(DropletMain, fadeInfo, fadeGoal)
TweensLength = TweensLength + 1
Tweens[TweensLength] = TweenService:Create(Mesh, strechInfo, {
Scale = Vector3.new(Scale, Scale * stretch, Scale);
Offset = Vector3.new(0, -(Scale * stretch) / 2.05, 0);
})
local NewCFrame = ScreenBlockCFrame:ToWorldSpace(CFrame.new(
math.random(-100, 100) / 100,
math.random(-100, 100) / 100,
-1
))
DropletMain.CFrame = NewCFrame
local weld = Instance.new("Weld")
weld.C0 = NewCFrame:Inverse() * ScreenBlockCFrame
weld.Part0 = DropletMain
weld.Part1 = ScreenBlock
weld.Parent = DropletMain
for _, t in ipairs(Tweens) do
t:Play()
end
local DestroyRoutine = coroutine.create(DestroyDroplet)
coroutine.resume(DestroyRoutine, DropletMain)
DropletMain.Parent = ScreenBlock
end
local function OnGraphicsChanged()
CanShow = GameSettings.SavedQualityLevel.Value >= 8
end
GameSettings:GetPropertyChangedSignal("SavedQualityLevel"):Connect(OnGraphicsChanged)
|
--Dynamic Variables--
|
local dodgingObstacles = script.Parent.DodgingObstacles
local criticalAction = false
local engineRunning = false
local desiredHeight = mySettings.Height.Value
|
-- Tables to keep track of which characters are on fire
|
local charactersOnFire = {}
local signalBindings = {}
|
--This script is what make tabs and pages work.
|
function HideAllTabs()
local Tabs = script.Parent.TABS:GetChildren()
for i = 1, #Tabs do
Tabs[i].Visible = false
end
local Buttons = script.Parent.SelectTab:GetChildren()
for i = 1, #Buttons do
Buttons[i].Style = "RobloxButton"
end
end
function Sword()
HideAllTabs()
script.Parent.TABS.SwordFrame1.Visible = true
script.Parent.SelectTab.Swords.Style = "RobloxButtonDefault"
script.Parent.CurrentPage.Value = 1
script.Parent.CurrentType.Value = "Sword"
script.Parent.Page.Text = script.Parent.CurrentPage.Value
end
function Staff()
HideAllTabs()
script.Parent.TABS.StaffFrame1.Visible = true
script.Parent.SelectTab.Staffs.Style = "RobloxButtonDefault"
script.Parent.CurrentPage.Value = 1
script.Parent.CurrentType.Value = "Staff"
script.Parent.Page.Text = script.Parent.CurrentPage.Value
end
function Ranged()
HideAllTabs()
script.Parent.TABS.RangedFrame1.Visible = true
script.Parent.SelectTab.Ranged.Style = "RobloxButtonDefault"
script.Parent.CurrentPage.Value = 1
script.Parent.CurrentType.Value = "Ranged"
script.Parent.Page.Text = script.Parent.CurrentPage.Value
end
|
--- Runs the command. Handles dispatching to the server if necessary.
-- Command:Validate() must be called before this is called or it will throw.
|
function Command:Run ()
if self._Validated == nil then
error("Must validate a command before running.")
end
local beforeRunHook = self.Dispatcher:RunHooks("BeforeRun", self)
if beforeRunHook then
return beforeRunHook
end
if not IsServer and self.Object.Data and self.Data == nil then
local values, length = self:GatherArgumentValues()
self.Data = self.Object.Data(self, unpack(values, 1, length))
end
if not IsServer and self.Object.ClientRun then
local values, length = self:GatherArgumentValues()
self.Response = self.Object.ClientRun(self, unpack(values, 1, length))
end
if self.Response == nil then
if self.Object.Run then -- We can just Run it here on this machine
local values, length = self:GatherArgumentValues()
self.Response = self.Object.Run(self, unpack(values, 1, length))
elseif IsServer then -- Uh oh, we're already on the server and there's no Run function.
if self.Object.ClientRun then
warn(self.Name, "command fell back to the server because ClientRun returned nil, but there is no server implementation! Either return a string from ClientRun, or create a server implementation for this command.")
else
warn(self.Name, "command has no implementation!")
end
self.Response = "No implementation."
else -- We're on the client, so we send this off to the server to let the server see what it can do with it.
self.Response = self.Dispatcher:Send(self.RawText, self.Data)
end
end
local afterRunHook = self.Dispatcher:RunHooks("AfterRun", self)
if afterRunHook then
return afterRunHook
else
return self.Response
end
end
|
-- / CarController.lua / --
|
BodyPostion.Position = CarModel.Position;
BodyGyro.CFrame = CarModel.CFrame;
Seat:GetPropertyChangedSignal("Occupant"):Connect(function(t)
if Seat.Occupant and not currentOccupant then
local player = Players:GetPlayerFromCharacter(Seat.Occupant.Parent);
if player then
currentOccupant = player;
CarModel:SetNetworkOwner(player);
currentClient = Client:Clone();
currentClient.Parent = player.PlayerGui;
end
elseif not Seat.Occupant and currentOccupant then
currentClient:Destroy();
currentClient = nil;
currentOccupant = nil;
CarModel:SetNetworkOwner(nil);
end
end)
|
--[[
Shorthand for a done handler that returns the given value.
]]
|
function Promise.prototype:doneReturn(...)
local length, values = pack(...)
return self:_finally(debug.traceback(nil, 2), function()
return unpack(values, 1, length)
end, true)
end
|
--------END STAGE--------
--------CREW--------
|
game.Workspace.crewp1.Decal.Texture = game.Workspace.Screens.ProjectionL.Value
game.Workspace.crewp2.Decal.Texture = game.Workspace.Screens.ProjectionR.Value
game.Workspace.crewp3.Decal.Texture = game.Workspace.Screens.ProjectionL.Value
game.Workspace.crewp4.Decal.Texture = game.Workspace.Screens.ProjectionR.Value
|
-- Game update loop
|
local function onHeartbeat(delta)
local damage = LAVA_DPS * delta
-- Go through all of the characters on fire and make them take damage
for character in pairs(charactersOnFire) do
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
humanoid:TakeDamage(damage)
end
end
end
|
-- body.MP.OutsideSound.Muffle.Enabled = false
|
end
end)
|
-- Loop through all the buttons in the parent and apply the hover function to them
|
for _, button in pairs(parent:GetChildren()) do
if button:IsA("TextButton") then
hover(button, button.BackgroundColor3, Color3.fromRGB(44, 44, 44), Color3.fromRGB(0, 46, 73))
end
end
|
--------AUDIENCE BACK LEFT--------
|
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 100
function getHumanoid(obj)
local get = obj:getChildren()
for i=1, #get do
if get[i].className == "Humanoid" then
return get[i]
end
end
return nil
end
function blow(hit)
connection:disconnect()
local human = getHumanoid(hit.Parent)
if human ~= nil then
tagHumanoid(human)
human:takeDamage(damage)
wait(0.5)
untagHumanoid(human)
end
script.Parent:remove()
end
function tagHumanoid(humanoid)
local creator_tag = script.Parent.creator:clone()
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
connection = script.Parent.Touched:connect(blow)
wait(8)
script.Parent:remove()
|
-- Activation]:
|
if TurnCharacterToMouse == true then
MseGuide = true
HeadHorFactor = 0
BodyHorFactor = 0
end
game:GetService("RunService").RenderStepped:Connect(function()
local CamCF = Cam.CoordinateFrame
if ((IsR6 and Body["Torso"]) or Body["UpperTorso"])~=nil and Body["Head"]~=nil then --[Check for the Torso and Head...]
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
if IsR6 and Neck or Neck and Waist then --[Make sure the Neck still exists.]
if Cam.CameraSubject:IsDescendantOf(Body) or Cam.CameraSubject:IsDescendantOf(Plr) then
local Dist = nil;
local Diff = nil;
if not MseGuide then --[If not tracking the Mouse then get the Camera.]
Dist = (Head.CFrame.p-CamCF.p).magnitude
Diff = Head.CFrame.Y-CamCF.Y
if not IsR6 then --[R6 and R15 Neck rotation C0s are different; R15: X axis inverted and Z is now the Y.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aSin(Diff/Dist)*HeadVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang((aSin(Diff/Dist)*BodyVertFactor), -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else --[R15s actually have the properly oriented Neck CFrame.]
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aSin(Diff/Dist)*HeadVertFactor), 0, -(((HdPos-CamCF.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor),UpdateSpeed/2)
end
else
local Point = Mouse.Hit.p
Dist = (Head.CFrame.p-Point).magnitude
Diff = Head.CFrame.Y-Point.Y
if not IsR6 then
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0), UpdateSpeed/2)
Waist.C0 = Waist.C0:lerp(WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-Point).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0), UpdateSpeed/2)
else
Neck.C0 = Neck.C0:lerp(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-Point).Unit):Cross(TrsoLV)).Y*HeadHorFactor), UpdateSpeed/2)
end
end
end
end
end
if TurnCharacterToMouse == true then
Hum.AutoRotate = false
Core.CFrame = Core.CFrame:lerp(CFrame.new(Core.Position, Vector3.new(Mouse.Hit.p.x, Core.Position.Y, Mouse.Hit.p.z)), UpdateSpeed / 2)
else
Hum.AutoRotate = true
end
end)
game.ReplicatedStorage.Look.OnClientEvent:Connect(function(otherPlayer, neckCFrame, WaistCFrame)
local Neck = otherPlayer.Character:FindFirstChild("Neck", true)
local Waist = otherPlayer.Character:FindFirstChild("Waist", true)
if Neck and Waist then
game:GetService('TweenService'):Create(Neck, TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {C0 = neckCFrame}):Play()
game:GetService('TweenService'):Create(Waist, TweenInfo.new(.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out, 0, false, 0), {C0 = WaistCFrame}):Play()
end
end)
while wait(0.0001) do
game.ReplicatedStorage.Look:FireServer(Neck.C0, Waist.C0)
end
|
-- SirNoobly
|
local hat = script.Parent
hat.PrimaryPart = hat:WaitForChild("Head") -- Make sure the Head is the same size as a normal Head.
function weldParts(part0, part1) -- welds the 2 parts based on their position
local newWeld = Instance.new("Weld")
newWeld.Part0 = part0
newWeld.Part1 = part1
newWeld.C0 = CFrame.new()
newWeld.C1 = part1.CFrame:toObjectSpace(part0.CFrame)
newWeld.Parent = part0
end
hat.Head.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") and not hit.Parent:FindFirstChild("Earl's Coronet")then else return end
local head = hit.Parent:FindFirstChild("Head")
local newHat = hat:Clone()
newHat:FindFirstChild("HatScript"):Destroy()
newHat:SetPrimaryPartCFrame(head.CFrame) -- puts the head into the head
newHat.PrimaryPart:Destroy()
for _, part in pairs (newHat:GetChildren()) do
if part:IsA("BasePart") then
weldParts(head, part)
part.CanCollide = false
part.Anchored = false
end
end
newHat.Parent = hit.Parent
end)
|
-- move front UI --
|
titleEnd = {}
titleEnd.Position = UDim2.new(0.04, 0, 0, 0)
soloEnd = {}
soloEnd.Position = UDim2.new(0.055, 0, 0.4, 0)
customizeEnd = {}
customizeEnd.Position = UDim2.new(0.055, 0 , 0.55, 0)
achievementsEnd = {}
achievementsEnd.Position = UDim2.new(0.055, 0 , 0.7, 0)
settingsEnd = {}
settingsEnd.Position = UDim2.new(0.055, 0 , 0.85, 0)
backEnd = {}
backEnd.Position = UDim2.new(0.5, 0, 1.5, 0)
|
-- << CONFIGURATION >>
|
local rank = "VIP"
local rankType = "Perm" -- "Temp", "Perm" or "Perm". For more info, visit: https://devforum.roblox.com/t/HD/266932
local successColor = Color3.fromRGB(0,255,0)
local errorColor = Color3.fromRGB(255,0,0)
|
--[=[
@return Promise
Returns a promise that is resolved once Knit has started. This is useful
for any code that needs to tie into Knit controllers but is not the script
that called `Start`.
```lua
Knit.OnStart():andThen(function()
local MyController = Knit.GetController("MyController")
MyController:DoSomething()
end):catch(warn)
```
]=]
|
function KnitClient.OnStart()
if startedComplete then
return Promise.resolve()
else
return Promise.fromEvent(onStartedComplete.Event)
end
end
return KnitClient
|
--local functions
|
function weld(a, b, c0, c1)
local w = Instance.new("Weld", a)
w.Part0 = a
w.Part1 = b
if c0 then w.C0 = c0 end
if c1 then w.C1 = c1 end
return w
end
function setHeight(n)
if ai.Model:findFirstChild("Right Leg") then
ai.Model["Right Leg"]:BreakJoints()
ai.Model["Right Leg"].Size = ai.Model["Right Leg"].Size * Vector3.new(1,0,1) + Vector3.new(0, math.max(0.2, n or 0),0)
weld(ai.Model.Torso, ai.Model["Right Leg"], CFrame.new(0, -n + ai.Model["Right Leg"].Size.Y/2 - ai.Model.Torso.Size.Y/2,0))
end
if m and ai.Model:findFirstChild("Head") then
ai.Model.Head:BreakJoints()
weld(ai.Model.Torso, ai.Model.Head, CFrame.new(0, m - ai.Model.Head.Size.Y/2 + ai.Model.Torso.Size.Y/2,0))
end
end
function objAhead(loc)
if not _G.AntiJumpCache then
_G.AntiJumpCache = {}
end
local ray = Ray.new(ai.Model.Torso.Position, ((loc - ai.Model.Torso.Position) * Vector3.new(1,0,1)).unit * 5)
local obj, pos = workspace:FindPartOnRayWithIgnoreList(ray, _G.AntiJumpCache)
if obj then
if not obj.CanCollide then
table.insert(_G.AntiJumpCache, obj)
elseif obj.Parent:findFirstChild("Humanoid") then
table.insert(_G.AntiJumpCache, obj.Parent)
else
return true
end
--add to cache if necessary, otherwise recurse
return objAhead(loc)
end
end
function ai.canSee(obj, fov)
local direction = (obj.Position - ai.Model.Head.Position).unit
if fov and direction:Dot(ai.Model.Head.CFrame.lookVector) < math.cos(math.rad(fov)) then
return false
end
local ray = Ray.new(ai.Model.Head.Position, direction * 900)
local hit, pos = workspace:FindPartOnRayWithIgnoreList(ray, {ai.Model})
if hit then
--add to cache if transparent?
if hit == obj then
return true
end
end
end
function attack(hum)
print("pow")
lastAttack = time()
hum:TakeDamage(atkDamage)
end
function initialize()
for _, obj in pairs(ai.Model:GetChildren()) do
if obj:IsA("BasePart") then
obj.Anchored = false
end
end
setHeight(2, 1)
ai.tWeld = weld(ai.Model.Torso, ai.Model.torso, CFrame.new(0,-1,0), CFrame.new(0,-1,0) * CFrame.Angles(math.rad(45),0,0))
ai.hWeld = weld(ai.Model.torso, ai.Model.head2, CFrame.new(0,.8,0), CFrame.new(0,-.6,0) * CFrame.Angles(math.rad(-22.5),0,0))
ai.lWeld1 = weld(ai.Model.torso, ai.Model.leftLeg, CFrame.new(-0.5,-1,0), CFrame.new(0,1,0) * CFrame.Angles(math.rad(-45),0,0))
ai.lWeld2 = weld(ai.Model.torso, ai.Model.rightLeg, CFrame.new(0.5,-1,0), CFrame.new(0,1,0) * CFrame.Angles(math.rad(-45),0,0))
ai.aWeld1 = weld(ai.Model.torso, ai.Model.leftArm, CFrame.new(-1,0.5,0), CFrame.new(0.5,0.5,0) * CFrame.Angles(math.rad(-45),0,0))
ai.aWeld2 = weld(ai.Model.torso, ai.Model.rightArm, CFrame.new(1,0.5,0), CFrame.new(-0.5,0.5,0) * CFrame.Angles(math.rad(-45),0,0))
ai.HWeld = weld(ai.Model.Torso, ai.Model.Head)
anim(math.rad(20),0,0)
ai.Humanoid = Instance.new("Humanoid", ai.Model)
ai.Humanoid.WalkSpeed = math.random(8,14) + math.max(0, math.random(-5,3))
ai.State = "Idle"
ai.Model.ChildRemoved:connect(delete)
ai.Humanoid.Died:connect(delete)
ai.Humanoid.Running:connect(animate)
table.insert(_G.aiTable, ai)
end
function delete()
wait(0)
if not ai.Humanoid or not (ai.Humanoid.Health > 0) or not ai.Model:findFirstChild("Torso") or not ai.Model:FindFirstChild("Head") or not ai.Model:FindFirstChild("head2") then
for i, a in pairs(_G.aiTable) do
if a == ai then
table.remove(_G.aiTable, i)
end
end
ai.Model:BreakJoints()
game.Debris:AddItem(ai.Model, 3)
for i, obj in pairs(ai.Model:GetChildren()) do
if obj:IsA("BasePart") and obj.Transparency ~= 1 then
obj.CanCollide = true
elseif obj ~= script then
obj:Destroy()
end
end
ai = nil
goalPos = nil
elseif not (ai.Model:FindFirstChild("leftLeg") and ai.Model:FindFirstChild("rightLeg")) and not crawling then
crawl()
end
if ai and crawling and not (ai.Model:FindFirstChild("leftArm") and ai.Model:FindFirstChild("rightArm")) then
ai.Humanoid.Health = 0
end
end
function animate(a)
if not running2 then
running = a > 0
if running then
Spawn(function()
running2 = true
local start = time()
while running do
wait(0)
local cycle = (tick() - start) * 5
local tPitch = math.rad(25 + math.cos(cycle * 2) * -5)
local tRoll = math.rad(math.sin(cycle) * 10)
local lPitch = math.rad(math.sin(cycle) * 45)
anim(tPitch, tRoll, lPitch)
end
running2 = false
anim(math.rad(20),0,0)
end)
end
else
running = a > 0
end
end
function anim(tPitch, tRoll, lPitch)
if not ai then return end
local crawlMod = crawling and math.rad(50) or 0
local crawlMod2 = crawling and 4 or 1
local attackMod = (attackTime - math.min(attackTime,(time() - lastAttack)))/attackTime * math.rad(140)
lPitch2 = crawling and lPitch / 3 or lPitch
if ai.tWeld then
ai.tWeld.C1 = CFrame.new(0,-1,0) * CFrame.Angles(tPitch + crawlMod,0,tRoll + limp[1] * .4)
end
if ai.hWeld then
ai.hWeld.C1 = CFrame.new(0,-0.6,0) * CFrame.Angles(-tPitch/2,0,tRoll + limp[2] * .4)
end
if ai.lWeld1 then
ai.lWeld1.C1 = CFrame.new(0,1,0) * CFrame.Angles(lPitch2 - tPitch + crawlMod + limp[3] * .4,0,-tRoll - limp[1] * .4)
end
if ai.lWeld2 then
ai.lWeld2.C1 = CFrame.new(0,1,0) * CFrame.Angles(-lPitch2 - tPitch + crawlMod + limp[4] * .4,0,-tRoll - limp[1] * .4)
end
if ai.aWeld1 then
ai.aWeld1.C1 = CFrame.new(0.5,0.5,0) * CFrame.Angles(0,0, crawlMod/2) * CFrame.Angles(lPitch * math.abs(limp[5]) * -0.4 * crawlMod2 - tPitch - crawlMod - attackMod + limp[5] * .2, 0, -tRoll - limp[1] * .4)
end
if ai.aWeld2 then
ai.aWeld2.C1 = CFrame.new(-0.5,0.5,0) * CFrame.Angles(0,0, -crawlMod/2) * CFrame.Angles(lPitch * math.abs(limp[6]) * 0.4 * crawlMod2 - tPitch - crawlMod - attackMod + limp[6] * .2, 0, -tRoll - limp[1] * .4)
end
if ai.HWeld and ai.Model:findFirstChild("head2") then
ai.HWeld.C0 = ai.Model.Torso.CFrame:toObjectSpace(ai.Model.head2.CFrame)
end
end
function crawl()
crawling = true
setHeight(0,0)
ai.Humanoid.WalkSpeed = math.random(4, 6)
end
while not _G.aiTable do
wait(0)
end
initialize()
|
--// Aim|Zoom|Sensitivity Customization
|
ZoomSpeed = 0.23; -- The lower the number the slower and smoother the tween
AimZoom = 70; -- Default zoom
AimSpeed = 0.23;
UnaimSpeed = 0.23;
CycleAimZoom = 70; -- Cycled zoom
MouseSensitivity = 0.5; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
-- This is the same engine as A-Chassis 6C V1.4 and onwards.
| |
--local soundBank = game.ReplicatedStorage.Sounds.NPC.Banto:GetChildren()
| |
--////////////////////////////// Include
--//////////////////////////////////////
|
local Chat = game:GetService("Chat")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local modulesFolder = script.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local CurveUtil = require(modulesFolder:WaitForChild("CurveUtil"))
local commandModules = clientChatModules:WaitForChild("CommandModules")
local WhisperModule = require(commandModules:WaitForChild("Whisper"))
local MessageSender = require(modulesFolder:WaitForChild("MessageSender"))
local ChatLocalization = nil
|
--// WebPanel module uploaded as a group model due to there being multiple maintainers
--// Module source available at https://www.roblox.com/library/6289861017/WebPanel-Module
|
return function(Vargs)
local server = Vargs.Server;
local service = Vargs.Service;
local Settings = server.Settings
local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps =
server.Functions, server.Commands, server.Admin, server.Anti, server.Core, server.HTTP, server.Logs, server.Remote, server.Process, server.Variables, server.Deps
--[[
settings.WebPanel_Enabled = true;
wait(1)
settings.WebPanel_ApiKey = _G.ADONIS_WEBPANEL_TESTING_APIKEY;
--]]
--// Note: This will only run/be required if the WebPanel_Enabled setting is true at server startup
if Settings.WebPanel_Enabled then
local ran,WebModFunc = pcall(require, 6289861017)
if ran and WebModFunc then
coroutine.wrap(WebModFunc)(Vargs)
elseif not ran then
warn("WebPanel Loading Failed: ".. tostring(WebModFunc))
end
end
Logs:AddLog("Script", "WebPanel Module Loaded");
end
|
-- Public Constructors
|
function SpringClass.new(stiffness, dampingCoeff, dampingRatio, initialPos)
local self = setmetatable({}, SpringClass)
self.instant = false
self.marginOfError = 1E-6
dampingRatio = dampingRatio or 1
local m = dampingCoeff*dampingCoeff/(4*stiffness*dampingRatio*dampingRatio)
self.k = stiffness/m
self.d = -dampingCoeff/m
self.x = initialPos
self.t = initialPos
self.v = initialPos*0
return self
end
|
-- Constants
|
local FADE_IN_TWEEN = TweenInfo.new(1, Enum.EasingStyle.Linear)
local FADE_OUT_TWEEN = TweenInfo.new(1, Enum.EasingStyle.Linear)
local MusicPlayer = {}
function MusicPlayer:TransitionSoundVolumes(sounds: {Sound}, targetVolume: number, tweenInfo: TweenInfo)
for _, sound in sounds do
local tween = tweenService:Create(sound, tweenInfo, {Volume = targetVolume})
tween:Play()
if targetVolume > 0 and not sound.IsPlaying then
sound:Play()
elseif targetVolume == 0 and sound.IsPlaying then
tween.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed and targetVolume == 0 then
sound:Stop()
end
end)
end
end
end
function MusicPlayer:FadeSoundsIn(sounds: {Sound})
self:TransitionSoundVolumes(sounds, 0.5, FADE_IN_TWEEN)
end
function MusicPlayer:FadeSoundsOut(sounds: {Sound})
self:TransitionSoundVolumes(sounds, 0, FADE_OUT_TWEEN)
end
return MusicPlayer
|
--// # key, Takedown
|
mouse.KeyDown:connect(function(key)
if key==";" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.Remotes.TakedownEvent:FireServer(true)
end
end)
|
--["Walk"] = "rbxassetid://1136173829",
|
["Walk"] = "http://www.roblox.com/asset/?id=507767714",
["Idle"] = "http://www.roblox.com/asset/?id=507766666",
["SwingTool"] = "rbxassetid://1262318281"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.Walk:Stop()
anims.SwingTool:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
rep.Events.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.Walk.IsPlaying then
anims.Walk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
|
--[=[
Tracks pending promises
@class PendingPromiseTracker
]=]
|
local PendingPromiseTracker = {}
PendingPromiseTracker.ClassName = "PendingPromiseTracker"
PendingPromiseTracker.__index = PendingPromiseTracker
function PendingPromiseTracker.new()
local self = setmetatable({}, PendingPromiseTracker)
self._pendingPromises = {}
return self
end
function PendingPromiseTracker:Add(promise)
if promise:IsPending() then
self._pendingPromises[promise] = true
promise:Finally(function()
self._pendingPromises[promise] = nil
end)
end
end
function PendingPromiseTracker:GetAll()
local promises = {}
for promise, _ in pairs(self._pendingPromises) do
table.insert(promises, promise)
end
return promises
end
return PendingPromiseTracker
|
-- LocalScript
|
local numValue = script.Parent.ExpValue -- substitua "NumValue" pelo nome da sua NumberValue
local textLabel = script.Parent.Exp -- substitua "TextLabel" pelo nome do seu TextLabel
|
--[=[
An object to represent runtime errors that occur during execution.
Promises that experience an error like this will be rejected with
an instance of this object.
@class Error
]=]
|
local Error do
Error = {
Kind = makeEnum("Promise.Error.Kind", {
"ExecutionError",
"AlreadyCancelled",
"NotResolvedInTime",
"TimedOut",
}),
}
Error.__index = Error
function Error.new(options, parent)
options = options or {}
return setmetatable({
error = tostring(options.error) or "[This error has no error text.]",
trace = options.trace,
context = options.context,
kind = options.kind,
parent = parent,
createdTick = os.clock(),
createdTrace = debug.traceback(),
}, Error)
end
function Error.is(anything)
if type(anything) == "table" then
local metatable = getmetatable(anything)
if type(metatable) == "table" then
return rawget(anything, "error") ~= nil and type(rawget(metatable, "extend")) == "function"
end
end
return false
end
function Error.isKind(anything, kind)
assert(kind ~= nil, "Argument #2 to Promise.Error.isKind must not be nil")
return Error.is(anything) and anything.kind == kind
end
function Error:extend(options)
options = options or {}
options.kind = options.kind or self.kind
return Error.new(options, self)
end
function Error:getErrorChain()
local runtimeErrors = { self }
while runtimeErrors[#runtimeErrors].parent do
table.insert(runtimeErrors, runtimeErrors[#runtimeErrors].parent)
end
return runtimeErrors
end
function Error:__tostring()
local errorStrings = {
string.format("-- Promise.Error(%s) --", self.kind or "?"),
}
for _, runtimeError in ipairs(self:getErrorChain()) do
table.insert(errorStrings, table.concat({
runtimeError.trace or runtimeError.error,
runtimeError.context,
}, "\n"))
end
return table.concat(errorStrings, "\n")
end
end
|
-- Set defaults
|
TextBox.defaultProps = {
BackgroundTransparency = 1,
BorderSizePixel = 0,
Size = UDim2.new(1, 0, 1, 0),
TextSize = 16,
Font = 'SourceSans',
TextColor3 = Color3.new(0, 0, 0),
TextXAlignment = 'Left'
}
|
--[[**
<description>
Run this once to combine all keys provided into one "main key".
Internally, this means that data will be stored in a table with the key mainKey.
This is used to get around the 2-DataStore2 reliability caveat.
</description>
<parameter name = "mainKey">
The key that will be used to house the table.
</parameter>
<parameter name = "...">
All the keys to combine under one table.
</parameter>
**--]]
|
function DataStore2.Combine(mainKey, ...)
for _, name in ipairs({...}) do
combinedDataStoreInfo[name] = mainKey
end
end
function DataStore2.ClearCache()
DataStoreCache = {}
end
function DataStore2.SaveAll(player)
if DataStoreCache[player] then
for _, dataStore in pairs(DataStoreCache[player]) do
if dataStore.combinedStore == nil then
dataStore:Save()
end
end
end
end
DataStore2.SaveAllAsync = Promise.promisify(DataStore2.SaveAll)
function DataStore2.PatchGlobalSettings(patch)
for key, value in pairs(patch) do
assert(Settings[key] ~= nil, "No such key exists: " .. key)
-- TODO: Implement type checking with this when osyris' t is in
Settings[key] = value
end
end
function DataStore2.__call(_, dataStoreName, player)
assert(
typeof(dataStoreName) == "string" and IsPlayer.Check(player),
("DataStore2() API call expected {string dataStoreName, Player player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(player)
)
)
if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then
return DataStoreCache[player][dataStoreName]
elseif combinedDataStoreInfo[dataStoreName] then
local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player)
dataStore:BeforeSave(function(combinedData)
for key in pairs(combinedData) do
if combinedDataStoreInfo[key] then
local combinedStore = DataStore2(key, player)
local value = combinedStore:Get(nil, true)
if value ~= nil then
if combinedStore.combinedBeforeSave then
value = combinedStore.combinedBeforeSave(clone(value))
end
combinedData[key] = value
end
end
end
return combinedData
end)
local combinedStore = setmetatable({
combinedName = dataStoreName,
combinedStore = dataStore,
}, {
__index = function(_, key)
return CombinedDataStore[key] or dataStore[key]
end,
})
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = combinedStore
return combinedStore
end
local dataStore = {
Name = dataStoreName,
UserId = player.UserId,
callbacks = {},
beforeInitialGet = {},
afterSave = {},
bindToClose = {},
}
dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore)
setmetatable(dataStore, DataStoreMetatable)
local saveFinishedEvent, isSaveFinished = Instance.new("BindableEvent"), false
local bindToCloseEvent = Instance.new("BindableEvent")
local bindToCloseCallback = function()
if not isSaveFinished then
-- Defer to avoid a race between connecting and firing "saveFinishedEvent"
Promise.defer(function()
bindToCloseEvent:Fire() -- Resolves the Promise.race to save the data
end)
saveFinishedEvent.Event:Wait()
end
local value = dataStore:Get(nil, true)
for _, bindToClose in ipairs(dataStore.bindToClose) do
bindToClose(player, value)
end
end
local success, errorMessage = pcall(function()
game:BindToClose(function()
if bindToCloseCallback == nil then
return
end
bindToCloseCallback()
end)
end)
if not success then
warn("DataStore2 could not BindToClose", errorMessage)
end
Promise.race({
Promise.fromEvent(bindToCloseEvent.Event),
Promise.fromEvent(player.AncestryChanged, function()
return not player:IsDescendantOf(game)
end),
}):andThen(function()
dataStore:SaveAsync():andThen(function()
--print("player left, saved", dataStoreName)
end):catch(function(error)
-- TODO: Something more elegant
warn("error when player left!", error)
end):finally(function()
isSaveFinished = true
saveFinishedEvent:Fire()
end)
--Give a long delay for people who haven't figured out the cache :^(
return Promise.delay(40):andThen(function()
DataStoreCache[player] = nil
bindToCloseCallback = nil
end)
end)
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = dataStore
return dataStore
end
DataStore2.Constants = Constants
return setmetatable(DataStore2, DataStore2)
|
--//Input
--PC/Xbox
|
uis.InputBegan:Connect(function(key, processed)
if key.KeyCode == Enum.KeyCode.Space or key.KeyCode == Enum.KeyCode.ButtonA then
ToggleFlying()
end
end)
|
--Front Suspension
|
Tune.FSusStiffness = 25000 -- Spring Force
Tune.FSusDamping = 400 -- Spring Dampening
Tune.FAntiRoll = 400 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 1.9 -- Resting Suspension length (in studs)
Tune.FPreCompress = .1 -- Pre-compression adds resting length force
Tune.FExtensionLim = .4 -- Max Extension Travel (in studs)
Tune.FCompressLim = .2 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
|
-- Load all components in some folder:
|
Component.Auto(script.Parent.Components)
Knit.Start():Then(function()
print("Knit running")
end):Catch(function(err)
warn(err)
end)
|
--Vars
|
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GBrake=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = true
local _TCSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
--[[
remoteProperty = ClientRemoteProperty.new(valueObject: Instance)
remoteProperty:Get(): any
remoteProperty:Destroy(): void
remoteProperty.Changed(newValue: any): Connection
--]]
|
local IS_SERVER = game:GetService("RunService"):IsServer()
local Signal = require(script.Parent.Parent.Signal)
local ClientRemoteProperty = {}
ClientRemoteProperty.__index = ClientRemoteProperty
function ClientRemoteProperty.new(object)
assert(not IS_SERVER, "ClientRemoteProperty can only be created on the client")
local self = setmetatable({
_object = object;
_value = nil;
_isTable = object:IsA("RemoteEvent");
}, ClientRemoteProperty)
local function SetValue(v)
self._value = v
end
if (self._isTable) then
self.Changed = Signal.new()
self._change = object.OnClientEvent:Connect(function(tbl)
SetValue(tbl)
self.Changed:Fire(tbl)
end)
SetValue(object.TableRequest:InvokeServer())
else
SetValue(object.Value)
self.Changed = object.Changed
self._change = object.Changed:Connect(SetValue)
end
return self
end
function ClientRemoteProperty:Get()
return self._value
end
function ClientRemoteProperty:Destroy()
self._change:Disconnect()
if (self._isTable) then
self.Changed:Destroy()
end
end
return ClientRemoteProperty
|
--[[ Display Names ]]
--Uses DisplayNames instead of UserNames in chat messages
|
module.PlayerDisplayNamesEnabled =true
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Big Spin bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Enables a warning when trying to spread a 'key' to an element
-- a deprecated pattern we want to get rid of in the future
|
exports.warnAboutSpreadingKeyToJSX = true
exports.enableComponentStackLocations = true
exports.enableNewReconciler = true
|
--//SS6 PLUGIN; SPLASH//--
|
--//INSPARE 2017//--
local ai = script.Parent.Main_Frame.A.Frame.ImageLabel
local bi = script.Parent.Main_Frame.B.Frame.ImageLabel
local ci = script.Parent.Main_Frame.C.Frame.ImageLabel
local di = script.Parent.Main_Frame.D.Frame.ImageLabel
local ei = script.Parent.Main_Frame.E.Frame.ImageLabel
wait(.2)
script.Parent.SplashFade.WI:Play()
while true do
for i=1,3 do
for i=1,5 do
ai.Position = ai.Position - UDim2.new(4,0,0,0)
bi.Position = bi.Position - UDim2.new(4,0,0,0)
ci.Position = ci.Position - UDim2.new(4,0,0,0)
di.Position = di.Position - UDim2.new(4,0,0,0)
ei.Position = ei.Position - UDim2.new(4,0,0,0)
wait(.045)
end
ai.Position = ai.Position + UDim2.new(20,0,-3,0)
bi.Position = bi.Position + UDim2.new(20,0,-3,0)
ci.Position = ci.Position + UDim2.new(20,0,-3,0)
di.Position = di.Position + UDim2.new(20,0,-3,0)
ei.Position = ei.Position + UDim2.new(20,0,-3,0)
wait(.045)
end
for i=1,3 do
ai.Position = ai.Position - UDim2.new(4,0,0,0)
bi.Position = bi.Position - UDim2.new(4,0,0,0)
ci.Position = ci.Position - UDim2.new(4,0,0,0)
di.Position = di.Position - UDim2.new(4,0,0,0)
ei.Position = ei.Position - UDim2.new(4,0,0,0)
wait(.045)
end
ai.Position = ai.Position + UDim2.new(12,0,9,0)
bi.Position = bi.Position + UDim2.new(12,0,9,0)
ci.Position = ci.Position + UDim2.new(12,0,9,0)
di.Position = di.Position + UDim2.new(12,0,9,0)
ei.Position = ei.Position + UDim2.new(12,0,9,0)
wait(.045)
end
|
-- its best to anchor while welding, and then unanchor when finished
|
function weld(modelgroup,anchored,cancollide)
local parts,last = {}
local function scan(parent)
for _,v in pairs(parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (last) then
local w = Instance.new("Weld")
w.Name = ("Weld")
w.Part0,w.Part1 = last,v
w.C0 = last.CFrame:inverse()
w.C1 = v.CFrame:inverse()
w.Parent = last
end
last = v
table.insert(parts,v)
end
scan(v)
end
end
scan(modelgroup)
for _,v in pairs(parts) do
v.Anchored=anchored
v.CanCollide=cancollide
end
end
weld(script.Parent,true,false)
print("DOne")
|
-- ================================================================================
-- RACER PUBLIC FUNCTIONS
-- ================================================================================
|
function Racer.new()
local newRacer = {}
setmetatable(newRacer, Racer)
newRacer.CurrentLap = 1
newRacer.Laps = {}
newRacer.FinishedRace = false
return newRacer
end -- Racer.new()
function Racer:StartLap(lapNumber)
self.Laps[lapNumber] = Lap.new()
end -- Racer:StartLap()
function Racer:FinishLap(lapNumber)
local lap = self.Laps[lapNumber]
lap.LapTime = tick() - lap.StartTime
lap.Finished = true
return lap.LapTime
end -- Racer:FinishLap()
function Racer:HasStartedLap(lapNumber)
if lapNumber <= #self.Laps then
return self.Laps[lapNumber].Started
end
return false
end -- Race:HasStartedLap()
function Racer:HasFinishedLap(lapNumber)
if lapNumber <= #self.Laps then
return self.Laps[lapNumber].Finished
end
return false
end -- Racer:HasFinishedLap()
|
-- Container for temporary connections (disconnected automatically)
|
local Connections = {};
function SurfaceTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
EnableSurfaceSelection();
-- Set our current surface mode
SetSurface(SurfaceTool.Surface);
end;
function SurfaceTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
ClearConnections();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if SurfaceTool.UI then
-- Reveal the UI
SurfaceTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
SurfaceTool.UI = Core.Tool.Interfaces.BTSurfaceToolGUI:Clone();
SurfaceTool.UI.Parent = Core.UI;
SurfaceTool.UI.Visible = true;
-- Create the surface selection dropdown
SurfaceDropdown = Core.Cheer(SurfaceTool.UI.SideOption.Dropdown).Start({ 'All', 'Top', 'Bottom', 'Front', 'Back', 'Left', 'Right' }, 'All', SetSurface);
-- Map type label names to actual type names
local SurfaceTypes = {
['Studs'] = 'Studs',
['Inlets'] = 'Inlet',
['Smooth'] = 'Smooth',
['Weld'] = 'Weld',
['Glue'] = 'Glue',
['Universal'] = 'Universal',
['Hinge'] = 'Hinge',
['Motor'] = 'Motor',
['No Outline'] = 'SmoothNoOutlines'
};
-- Create the surface type selection dropdown
SurfaceTypeDropdown = Core.Cheer(SurfaceTool.UI.TypeOption.Dropdown).Start({ 'Studs', 'Inlets', 'Smooth', 'Weld', 'Glue', 'Universal', 'Hinge', 'Motor', 'No Outline' }, '', function (Option)
SetSurfaceType(Enum.SurfaceType[SurfaceTypes[Option]]);
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not SurfaceTool.UI then
return;
end;
-- Hide the UI
SurfaceTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function GetSurfaceTypeDisplayName(SurfaceType)
-- Returns a more friendly name for the given `SurfaceType`
-- For stepping motors, add a space
if SurfaceType == Enum.SurfaceType.SteppingMotor then
return 'Stepping Motor';
-- For no outlines, simplify name
elseif SurfaceType == Enum.SurfaceType.SmoothNoOutlines then
return 'No Outline';
-- For other surface types, return their normal name
else
return SurfaceType.Name;
end;
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not SurfaceTool.UI then
return;
end;
-- Only show and identify current surface type if selection is not empty
if #Selection.Items == 0 then
SurfaceTypeDropdown.SetOption('');
return;
end;
------------------------------------
-- Update the surface type indicator
------------------------------------
-- Collect all different surface types in selection
local SurfaceTypeVariations = {};
for _, Part in pairs(Selection.Items) do
-- Search for variations on all surfaces if all surfaces are selected
if SurfaceTool.Surface == 'All' then
table.insert(SurfaceTypeVariations, Part.TopSurface);
table.insert(SurfaceTypeVariations, Part.BottomSurface);
table.insert(SurfaceTypeVariations, Part.FrontSurface);
table.insert(SurfaceTypeVariations, Part.BackSurface);
table.insert(SurfaceTypeVariations, Part.LeftSurface);
table.insert(SurfaceTypeVariations, Part.RightSurface);
-- Search for variations on single selected surface
else
table.insert(SurfaceTypeVariations, Part[SurfaceTool.Surface .. 'Surface']);
end;
end;
-- Identify common surface type in selection
local CommonSurfaceType = Support.IdentifyCommonItem(SurfaceTypeVariations);
-- Update the current surface type in the surface type dropdown
SurfaceTypeDropdown.SetOption(CommonSurfaceType and GetSurfaceTypeDisplayName(CommonSurfaceType) or '*');
end;
function SetSurface(Surface)
-- Changes the surface option to `Surface`
-- Set the surface option
SurfaceTool.Surface = Surface;
-- Update the current surface in the surface dropdown
SurfaceDropdown.SetOption(Surface);
end;
function SetSurfaceType(SurfaceType)
-- Changes the selection's surface type on the currently selected surface
-- Make sure a surface has been selected
if not SurfaceTool.Surface then
return;
end;
-- Track changes
TrackChange();
-- Change the surface of the parts locally
for _, Part in pairs(Selection.Items) do
-- Change all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Part.TopSurface = SurfaceType;
Part.BottomSurface = SurfaceType;
Part.FrontSurface = SurfaceType;
Part.BackSurface = SurfaceType;
Part.LeftSurface = SurfaceType;
Part.RightSurface = SurfaceType;
-- Change specific selected surface
else
Part[SurfaceTool.Surface .. 'Surface'] = SurfaceType;
end;
end;
-- Register changes
RegisterChange();
end;
function EnableSurfaceSelection()
-- Allows the player to select surfaces by clicking on them
-- Watch out for clicks on selected parts
Connections.SurfaceSelection = Selection.FocusChanged:connect(function (Part)
if Selection.IsSelected(Core.Mouse.Target) then
-- Set the surface option to the target surface
SetSurface(Core.Mouse.TargetSurface.Name);
end;
end);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Parts = Support.CloneTable(Selection.Items);
BeforeSurfaces = {};
AfterSurfaces = {};
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Surfaces = Record.BeforeSurfaces[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncSurface', Changes);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Surfaces = Record.AfterSurfaces[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncSurface', Changes);
end;
};
-- Collect the selection's initial state
for _, Part in pairs(HistoryRecord.Parts) do
-- Begin to record surfaces
HistoryRecord.BeforeSurfaces[Part] = {};
local Surfaces = HistoryRecord.BeforeSurfaces[Part];
-- Record all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Surfaces.Top = Part.TopSurface;
Surfaces.Bottom = Part.BottomSurface;
Surfaces.Front = Part.FrontSurface;
Surfaces.Back = Part.BackSurface;
Surfaces.Left = Part.LeftSurface;
Surfaces.Right = Part.RightSurface;
-- Record specific selected surface
else
Surfaces[SurfaceTool.Surface] = Part[SurfaceTool.Surface .. 'Surface'];
end;
end;
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Collect the selection's final state
local Changes = {};
for _, Part in pairs(HistoryRecord.Parts) do
-- Begin to record surfaces
HistoryRecord.AfterSurfaces[Part] = {};
local Surfaces = HistoryRecord.AfterSurfaces[Part];
-- Record all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Surfaces.Top = Part.TopSurface;
Surfaces.Bottom = Part.BottomSurface;
Surfaces.Front = Part.FrontSurface;
Surfaces.Back = Part.BackSurface;
Surfaces.Left = Part.LeftSurface;
Surfaces.Right = Part.RightSurface;
-- Record specific selected surface
else
Surfaces[SurfaceTool.Surface] = Part[SurfaceTool.Surface .. 'Surface'];
end;
-- Create the change request for this part
table.insert(Changes, { Part = Part, Surfaces = Surfaces });
end;
-- Send the changes to the server
Core.SyncAPI:Invoke('SyncSurface', Changes);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.