prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it.
|
local dayLength = 1
local cycleTime = dayLength*60
local minutesInADay = 24*60
local lighting = game:GetService("Lighting")
local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime
local timeRatio = minutesInADay / cycleTime
if dayLength == 0 then
dayLength = 1
end
repeat
local currentTime = tick()
if currentTime > endTime then
startTime = endTime
endTime = startTime + cycleTime
end
lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
wait(1/15)
until false
|
--// Init
|
return service.NewProxy({
__call = function(tab, data)
local mutex = service.RunService:FindFirstChild("__Adonis_MODULE_MUTEX")
if mutex then
warn("\n-----------------------------------------------"
.."\nAdonis server-side is already running! Aborting..."
.."\n-----------------------------------------------")
script:Destroy()
return "FAILED"
else
mutex = service.New("StringValue", {Name = "__Adonis_MODULE_MUTEX", Value = "Running"})
local mutexBackup = mutex:Clone()
local function makePersistent(m)
local connection1, connection2 = nil, nil
connection1 = m:GetPropertyChangedSignal("Parent"):Connect(function()
if not m or m.Parent ~= service.RunService then
connection1:Disconnect()
connection2:Disconnect()
warn("Adonis module mutex removed; Regenerating...")
makePersistent(mutexBackup)
mutexBackup.Parent = service.RunService
mutexBackup = mutexBackup:Clone()
end
end)
connection2 = m:GetPropertyChangedSignal("Name"):Connect(function()
if m and m.Name ~= "__Adonis_MODULE_MUTEX" then
warn("Adonis module mutex renamed; Refreshing...")
m.Name = "__Adonis_MODULE_MUTEX"
end
end)
end
makePersistent(mutex)
mutex.Parent = service.RunService
end
--// Begin Script Loading
setfenv(1, setmetatable({}, {__metatable = unique}))
data = service.Wrap(data or {})
if not (data and data.Loader) then
warn("WARNING: MainModule loaded without using the loader!")
end
if data and data.ModuleID == 8612978896 then
warn("Currently using Adonis Nightly MainModule; intended for testing & development only!")
end
--// Server Variables
local setTab = require(server.Deps.DefaultSettings)
server.Defaults = setTab
server.Settings = data.Settings or setTab.Settings or {}
-- For some reason line 540 errors because CloneTable is nil
local function CloneTable(tab, recursive)
local clone = table.clone(tab)
if recursive then
for i, v in pairs(clone) do
if type(v) == "table" then
clone[i] = CloneTable(v, recursive)
end
end
end
return clone
end
server.OriginalSettings = CloneTable(server.Settings, true)
server.Descriptions = data.Descriptions or setTab.Descriptions or {}
server.Messages = data.Messages or setTab.Settings.Messages or {}
server.Order = data.Order or setTab.Order or {}
server.Data = data or {}
server.Model = data.Model or service.New("Model")
server.ModelParent = data.ModelParent or service.ServerScriptService;
server.Dropper = data.Dropper or service.New("Script")
server.Loader = data.Loader or service.New("Script")
server.Runner = data.Runner or service.New("Script")
server.LoadModule = LoadModule
server.LoadPackage = LoadPackage
server.ServiceSpecific = ServiceSpecific
server.Shared = Folder.Shared
server.ServerPlugins = data.ServerPlugins
server.ClientPlugins = data.ClientPlugins
server.Client = Folder.Parent.Client
locals.Settings = server.Settings
locals.CodeName = server.CodeName
--// THIS NEEDS TO BE DONE **BEFORE** ANY EVENTS ARE CONNECTED
if server.Settings.HideScript and data.Model then
data.Model.Parent = nil
script:Destroy()
end
--// Copy client themes, plugins, and shared modules to the client folder
local packagesToRunWithPlugins = {}
local shared = service.New("Folder", {
Name = "Shared";
Parent = server.Client;
})
for _, module in ipairs(Folder.Shared:GetChildren()) do
module:Clone().Parent = shared
end
for _, module in pairs(data.ClientPlugins or {}) do
module:Clone().Parent = server.Client.Plugins
end
for _, theme in pairs(data.Themes or {}) do
theme:Clone().Parent = server.Client.UI
end
for _, pkg in pairs(data.Packages or {}) do
LoadPackage(pkg, Folder.Parent, false)
end
for setting, value in pairs(server.Defaults.Settings) do
if server.Settings[setting] == nil then
server.Settings[setting] = value
end
end
for desc, value in pairs(server.Defaults.Descriptions) do
if server.Descriptions[desc] == nil then
server.Descriptions[desc] = value
end
end
--// Bind cleanup
service.DataModel:BindToClose(CleanUp)
--server.CleanUp = CleanUp;
--// Require some dependencies
server.Typechecker = require(server.Shared.Typechecker)
server.Threading = require(server.Deps.ThreadHandler)
server.Changelog = require(server.Shared.Changelog)
server.Credits = require(server.Shared.Credits)
do
local MaterialIcons = require(server.Shared.MatIcons)
server.MatIcons = setmetatable({}, {
__index = function(self, ind)
local materialIcon = MaterialIcons[ind]
if materialIcon then
self[ind] = "rbxassetid://"..materialIcon
return self[ind]
end
return ""
end,
__metatable = "Adonis_MatIcons"
})
end
--// Load services
for ind, serv in ipairs(SERVICES_WE_USE) do
local temp = service[serv]
end
--// Load core modules
for _, load in ipairs(CORE_LOADING_ORDER) do
local CoreModule = Folder.Core:FindFirstChild(load)
if CoreModule then
LoadModule(CoreModule, true, nil, nil, true) --noenv, CoreModule
end
end
--// Server Specific Service Functions
ServiceSpecific.GetPlayers = server.Functions.GetPlayers
--// Initialize Cores
local runLast = {}
local runAfterInit = {}
local runAfterPlugins = {}
for _, name in ipairs(CORE_LOADING_ORDER) do
local core = server[name]
if core then
if type(core) == "table" or (type(core) == "userdata" and getmetatable(core) == "ReadOnly_Table") then
if core.RunLast then
table.insert(runLast, core.RunLast)
core.RunLast = nil
end
if core.RunAfterInit then
table.insert(runAfterInit, core.RunAfterInit)
core.RunAfterInit = nil
end
if core.RunAfterPlugins then
table.insert(runAfterPlugins, core.RunAfterPlugins)
core.RunAfterPlugins = nil
end
if core.Init then
core.Init(data)
core.Init = nil
end
end
end
end
--// Variables that rely on core modules being initialized
server.Logs.Errors = ErrorLogs
--// Load any afterinit functions from modules (init steps that require other modules to have finished loading)
for _, f in pairs(runAfterInit) do
f(data)
end
--// Load Plugins; enforced NoEnv policy, make sure your plugins has the 2nd argument defined!
for _, module in ipairs(server.PluginsFolder:GetChildren()) do
LoadModule(module, false, {script = module}, true, true) --noenv
end
for _, module in pairs(data.ServerPlugins or {}) do
LoadModule(module, false, {script = module})
end
--// We need to do some stuff *after* plugins are loaded (in case we need to be able to account for stuff they may have changed before doing something, such as determining the max length of remote commands)
for _, f in pairs(runAfterPlugins) do
f(data)
end
--// Below can be used to determine when all modules and plugins have finished loading; service.Events.AllModulesLoaded:Connect(function() doSomething end)
server.AllModulesLoaded = true
service.Events.AllModulesLoaded:Fire(os.time())
--// Queue handler
--service.StartLoop("QueueHandler","Heartbeat",service.ProcessQueue)
--// Stuff to run after absolutely everything else has had a chance to run and initialize and all that
for _, f in pairs(runLast) do
f(data)
end
if data.Loader then
warn("Loading Complete; Required by "..tostring(data.Loader:GetFullName()))
else
warn("Loading Complete; No loader location provided")
end
if server.Logs then
server.Logs.AddLog(server.Logs.Script, {
Text = "Finished Loading";
Desc = "Adonis has finished loading";
})
else
warn("SERVER.LOGS TABLE IS MISSING. THIS SHOULDN'T HAPPEN! SOMETHING WENT WRONG WHILE LOADING CORE MODULES(?)");
end
service.Events.ServerInitialized:Fire();
return "SUCCESS"
end;
__tostring = function()
return "Adonis"
end;
__metatable = "Adonis";
})
|
--[=[
Returns a promise that returns a remote function
@return Promise<RemoteFunction>
]=]
|
function PromiseRemoteFunctionMixin:PromiseRemoteFunction()
return self._maid:GivePromise(promiseChild(self._obj, self._remoteFunctionName))
end
return PromiseRemoteFunctionMixin
|
--[[
[Horizontal and Vertical limits for head and body tracking.]
[Setting to 0 negates tracking, setting to 1 is normal tracking, and setting to anything higher than 1 goes past real life head/body rotation capabilities.]
--]]
|
local HeadHorFactor = 1.2
local HeadVertFactor = 0.8
local BodyHorFactor = 0.7
local BodyVertFactor = 0.6
|
--// Touch Connections
|
L_3_:WaitForChild('Humanoid').Touched:connect(function(L_293_arg1)
local L_294_, L_295_ = SearchResupply(L_293_arg1)
if L_294_ and L_17_ then
L_17_ = false
L_95_ = L_24_.Ammo
L_96_ = L_24_.StoredAmmo * L_24_.MagCount
L_97_ = L_24_.ExplosiveAmmo
if L_54_:FindFirstChild('Resupply') then
L_54_.Resupply:Play()
end
wait(15)
L_17_ = true
end;
end)
|
-- Was called OnMoveTouchEnded in previous version
|
function DynamicThumbstick:OnInputEnded()
self.moveTouchObject = nil
self.moveVector = ZERO_VECTOR3
self:FadeThumbstick(false)
end
function DynamicThumbstick:FadeThumbstick(visible: boolean?)
if not visible and self.moveTouchObject then
return
end
if self.isFirstTouch then return end
if self.startImageFadeTween then
self.startImageFadeTween:Cancel()
end
if self.endImageFadeTween then
self.endImageFadeTween:Cancel()
end
for i = 1, #self.middleImages do
if self.middleImageFadeTweens[i] then
self.middleImageFadeTweens[i]:Cancel()
end
end
if visible then
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0.2 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = MIDDLE_TRANSPARENCIES[i] })
self.middleImageFadeTweens[i]:Play()
end
else
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.middleImageFadeTweens[i]:Play()
end
end
end
function DynamicThumbstick:FadeThumbstickFrame(fadeDuration: number, fadeRatio: number)
self.fadeInAndOutHalfDuration = fadeDuration * 0.5
self.fadeInAndOutBalance = fadeRatio
self.tweenInAlphaStart = tick()
end
function DynamicThumbstick:InputInFrame(inputObject: InputObject)
local frameCornerTopLeft: Vector2 = self.thumbstickFrame.AbsolutePosition
local frameCornerBottomRight = frameCornerTopLeft + self.thumbstickFrame.AbsoluteSize
local inputPosition = inputObject.Position
if inputPosition.X >= frameCornerTopLeft.X and inputPosition.Y >= frameCornerTopLeft.Y then
if inputPosition.X <= frameCornerBottomRight.X and inputPosition.Y <= frameCornerBottomRight.Y then
return true
end
end
return false
end
function DynamicThumbstick:DoFadeInBackground()
local playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
local hasFadedBackgroundInOrientation = false
-- only fade in/out the background once per orientation
if playerGui then
if playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInLandscape
self.hasFadedBackgroundInLandscape = true
elseif playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInPortrait
self.hasFadedBackgroundInPortrait = true
end
end
if not hasFadedBackgroundInOrientation then
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.tweenInAlphaStart = tick()
end
end
function DynamicThumbstick:DoMove(direction: Vector3)
local currentMoveVector: Vector3 = direction
-- Scaled Radial Dead Zone
local inputAxisMagnitude: number = currentMoveVector.Magnitude
if inputAxisMagnitude < self.radiusOfDeadZone then
currentMoveVector = ZERO_VECTOR3
else
currentMoveVector = currentMoveVector.Unit*(
1 - math.max(0, (self.radiusOfMaxSpeed - currentMoveVector.Magnitude)/self.radiusOfMaxSpeed)
)
currentMoveVector = Vector3.new(currentMoveVector.X, 0, currentMoveVector.Y)
end
self.moveVector = currentMoveVector
end
function DynamicThumbstick:LayoutMiddleImages(startPos: Vector3, endPos: Vector3)
local startDist = (self.thumbstickSize / 2) + self.middleSize
local vector = endPos - startPos
local distAvailable = vector.Magnitude - (self.thumbstickRingSize / 2) - self.middleSize
local direction = vector.Unit
local distNeeded = self.middleSpacing * NUM_MIDDLE_IMAGES
local spacing = self.middleSpacing
if distNeeded < distAvailable then
spacing = distAvailable / NUM_MIDDLE_IMAGES
end
for i = 1, NUM_MIDDLE_IMAGES do
local image = self.middleImages[i]
local distWithout = startDist + (spacing * (i - 2))
local currentDist = startDist + (spacing * (i - 1))
if distWithout < distAvailable then
local pos = endPos - direction * currentDist
local exposedFraction = math.clamp(1 - ((currentDist - distAvailable) / spacing), 0, 1)
image.Visible = true
image.Position = UDim2.new(0, pos.X, 0, pos.Y)
image.Size = UDim2.new(0, self.middleSize * exposedFraction, 0, self.middleSize * exposedFraction)
else
image.Visible = false
end
end
end
function DynamicThumbstick:MoveStick(pos)
local vector2StartPosition = Vector2.new(self.moveTouchStartPosition.X, self.moveTouchStartPosition.Y)
local startPos = vector2StartPosition - self.thumbstickFrame.AbsolutePosition
local endPos = Vector2.new(pos.X, pos.Y) - self.thumbstickFrame.AbsolutePosition
self.endImage.Position = UDim2.new(0, endPos.X, 0, endPos.Y)
self:LayoutMiddleImages(startPos, endPos)
end
function DynamicThumbstick:BindContextActions()
local function inputBegan(inputObject)
if self.moveTouchObject then
return Enum.ContextActionResult.Pass
end
if not self:InputInFrame(inputObject) then
return Enum.ContextActionResult.Pass
end
if self.isFirstTouch then
self.isFirstTouch = false
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0)
TweenService:Create(self.startImage, tweenInfo, {Size = UDim2.new(0, 0, 0, 0)}):Play()
TweenService:Create(
self.endImage,
tweenInfo,
{Size = UDim2.new(0, self.thumbstickSize, 0, self.thumbstickSize), ImageColor3 = Color3.new(0,0,0)}
):Play()
end
self.moveTouchLockedIn = false
self.moveTouchObject = inputObject
self.moveTouchStartPosition = inputObject.Position
self.moveTouchFirstChanged = true
if FADE_IN_OUT_BACKGROUND then
self:DoFadeInBackground()
end
return Enum.ContextActionResult.Pass
end
local function inputChanged(inputObject: InputObject)
if inputObject == self.moveTouchObject then
if self.moveTouchFirstChanged then
self.moveTouchFirstChanged = false
local startPosVec2 = Vector2.new(
inputObject.Position.X - self.thumbstickFrame.AbsolutePosition.X,
inputObject.Position.Y - self.thumbstickFrame.AbsolutePosition.Y
)
self.startImage.Visible = true
self.startImage.Position = UDim2.new(0, startPosVec2.X, 0, startPosVec2.Y)
self.endImage.Visible = true
self.endImage.Position = self.startImage.Position
self:FadeThumbstick(true)
self:MoveStick(inputObject.Position)
end
self.moveTouchLockedIn = true
local direction = Vector2.new(
inputObject.Position.X - self.moveTouchStartPosition.X,
inputObject.Position.Y - self.moveTouchStartPosition.Y
)
if math.abs(direction.X) > 0 or math.abs(direction.Y) > 0 then
self:DoMove(direction)
self:MoveStick(inputObject.Position)
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
local function inputEnded(inputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
if self.moveTouchLockedIn then
return Enum.ContextActionResult.Sink
end
end
return Enum.ContextActionResult.Pass
end
local function handleInput(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
return inputBegan(inputObject)
elseif inputState == Enum.UserInputState.Change then
return inputChanged(inputObject)
elseif inputState == Enum.UserInputState.End then
return inputEnded(inputObject)
elseif inputState == Enum.UserInputState.Cancel then
self:OnInputEnded()
end
end
ContextActionService:BindActionAtPriority(
DYNAMIC_THUMBSTICK_ACTION_NAME,
handleInput,
false,
DYNAMIC_THUMBSTICK_ACTION_PRIORITY,
Enum.UserInputType.Touch)
end
function DynamicThumbstick:Create(parentFrame: GuiBase2d)
if self.thumbstickFrame then
self.thumbstickFrame:Destroy()
self.thumbstickFrame = nil
if self.onRenderSteppedConn then
self.onRenderSteppedConn:Disconnect()
self.onRenderSteppedConn = nil
end
end
self.thumbstickSize = 45
self.thumbstickRingSize = 20
self.middleSize = 10
self.middleSpacing = self.middleSize + 4
self.radiusOfDeadZone = 2
self.radiusOfMaxSpeed = 20
local screenSize = parentFrame.AbsoluteSize
local isBigScreen = math.min(screenSize.X, screenSize.Y) > 500
if isBigScreen then
self.thumbstickSize = self.thumbstickSize * 2
self.thumbstickRingSize = self.thumbstickRingSize * 2
self.middleSize = self.middleSize * 2
self.middleSpacing = self.middleSpacing * 2
self.radiusOfDeadZone = self.radiusOfDeadZone * 2
self.radiusOfMaxSpeed = self.radiusOfMaxSpeed * 2
end
local function layoutThumbstickFrame(portraitMode)
if portraitMode then
self.thumbstickFrame.Size = UDim2.new(1, 0, 0.4, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 0.6, 0)
else
self.thumbstickFrame.Size = UDim2.new(0.4, 0, 2/3, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 1/3, 0)
end
end
self.thumbstickFrame = Instance.new("Frame")
self.thumbstickFrame.BorderSizePixel = 0
self.thumbstickFrame.Name = "DynamicThumbstickFrame"
self.thumbstickFrame.Visible = false
self.thumbstickFrame.BackgroundTransparency = 1.0
self.thumbstickFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
self.thumbstickFrame.Active = false
layoutThumbstickFrame(false)
self.startImage = Instance.new("ImageLabel")
self.startImage.Name = "ThumbstickStart"
self.startImage.Visible = true
self.startImage.BackgroundTransparency = 1
self.startImage.Image = TOUCH_CONTROLS_SHEET
self.startImage.ImageRectOffset = Vector2.new(1,1)
self.startImage.ImageRectSize = Vector2.new(144, 144)
self.startImage.ImageColor3 = Color3.new(0, 0, 0)
self.startImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.startImage.Position = UDim2.new(0, self.thumbstickRingSize * 3.3, 1, -self.thumbstickRingSize * 2.8)
self.startImage.Size = UDim2.new(0, self.thumbstickRingSize * 3.7, 0, self.thumbstickRingSize * 3.7)
self.startImage.ZIndex = 10
self.startImage.Parent = self.thumbstickFrame
self.endImage = Instance.new("ImageLabel")
self.endImage.Name = "ThumbstickEnd"
self.endImage.Visible = true
self.endImage.BackgroundTransparency = 1
self.endImage.Image = TOUCH_CONTROLS_SHEET
self.endImage.ImageRectOffset = Vector2.new(1,1)
self.endImage.ImageRectSize = Vector2.new(144, 144)
self.endImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.endImage.Position = self.startImage.Position
self.endImage.Size = UDim2.new(0, self.thumbstickSize * 0.8, 0, self.thumbstickSize * 0.8)
self.endImage.ZIndex = 10
self.endImage.Parent = self.thumbstickFrame
for i = 1, NUM_MIDDLE_IMAGES do
self.middleImages[i] = Instance.new("ImageLabel")
self.middleImages[i].Name = "ThumbstickMiddle"
self.middleImages[i].Visible = false
self.middleImages[i].BackgroundTransparency = 1
self.middleImages[i].Image = TOUCH_CONTROLS_SHEET
self.middleImages[i].ImageRectOffset = Vector2.new(1,1)
self.middleImages[i].ImageRectSize = Vector2.new(144, 144)
self.middleImages[i].ImageTransparency = MIDDLE_TRANSPARENCIES[i]
self.middleImages[i].AnchorPoint = Vector2.new(0.5, 0.5)
self.middleImages[i].ZIndex = 9
self.middleImages[i].Parent = self.thumbstickFrame
end
local CameraChangedConn: RBXScriptConnection? = nil
local function onCurrentCameraChanged()
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local function onViewportSizeChanged()
local size = newCamera.ViewportSize
local portraitMode = size.X < size.Y
layoutThumbstickFrame(portraitMode)
end
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(onViewportSizeChanged)
onViewportSizeChanged()
end
end
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
self.moveTouchStartPosition = nil
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
self.onRenderSteppedConn = RunService.RenderStepped:Connect(function()
if self.tweenInAlphaStart ~= nil then
local delta = tick() - self.tweenInAlphaStart
local fadeInTime = (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeInTime, 1)
if delta > fadeInTime then
self.tweenOutAlphaStart = tick()
self.tweenInAlphaStart = nil
end
elseif self.tweenOutAlphaStart ~= nil then
local delta = tick() - self.tweenOutAlphaStart
local fadeOutTime = (self.fadeInAndOutHalfDuration * 2) - (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA + FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeOutTime, 1)
if delta > fadeOutTime then
self.tweenOutAlphaStart = nil
end
end
end)
self.onTouchEndedConn = UserInputService.TouchEnded:connect(function(inputObject: InputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if self.moveTouchObject then
self:OnInputEnded()
end
end)
local playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
while not playerGui do
LocalPlayer.ChildAdded:wait()
playerGui = LocalPlayer:FindFirstChildOfClass("PlayerGui")
end
local playerGuiChangedConn = nil
local originalScreenOrientationWasLandscape = playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight
local function longShowBackground()
self.fadeInAndOutHalfDuration = 2.5
self.fadeInAndOutBalance = 0.05
self.tweenInAlphaStart = tick()
end
playerGuiChangedConn = playerGui:GetPropertyChangedSignal("CurrentScreenOrientation"):Connect(function()
if (originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait) or
(not originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation ~= Enum.ScreenOrientation.Portrait) then
playerGuiChangedConn:disconnect()
longShowBackground()
if originalScreenOrientationWasLandscape then
self.hasFadedBackgroundInPortrait = true
else
self.hasFadedBackgroundInLandscape = true
end
end
end)
self.thumbstickFrame.Parent = parentFrame
if game:IsLoaded() then
longShowBackground()
else
coroutine.wrap(function()
game.Loaded:Wait()
longShowBackground()
end)()
end
end
return DynamicThumbstick
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Insanity Spin bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Client/Server: WeldService
|
function module:Weld (A,B,O)
if (not O) then
--O = CFrame.new(0,0,0)
end
local W = Instance.new("Weld");
W.Part0 = A;
W.Part1 = B;
W.C0 = O or CFrame.new(0,0,0);
W.Parent = A;
return W;
end
return module
|
--//INSPARE'S ADVANCED GEARBOX & TORQUE EQUATION SIMULATION//--
|
--//INSPARE 2017//--
script.Parent:WaitForChild("CarSeat")
script.Parent:WaitForChild("Storage")
script.Parent.Storage:WaitForChild("Boost")
wait(1)
carSeat = script.Parent.CarSeat.Value
wheels = carSeat.Parent.Parent.Wheels
origin = script.Parent.Storage.Gear1
carSeat.Parent.HitboxF.CanCollide = true
carSeat.Parent.HitboxR.CanCollide = true
carSeat.Screen.GEARBOX.FVC.Value = workspace.Camera.FieldOfView
script.FVC.Value = workspace.Camera.FieldOfView
carSeat.Wind:Play() tllocal = 576251517412231684 player = game.Players.LocalPlayer
ft = 1 rt = 1 CT = 1 low = 1 mid = 1 hi = 1 direction = 0 vvv = 0.2 vt = 1 first = 0.333 tlR = 0 cvvt = Instance.new("NumberValue",script.Parent)
cvvt.Name = "cvt" cvvt.Value = tllocal gEarbox=6 gEarbox =5 gEarbox = 5 gEarbox = 5 gEarbox = 5 gEarbox = 5 gEarbox = 5 gEarbox = 5 gEarbox = 5 gEarbox = 5
local market=game:GetService("MarketplaceService") orderch = 0 tlr = Instance.new("BoolValue", script) TCount = 0 TC = 0 tlr.Name = "ᴍᴀʀᴋᴇᴛᴘᴀʟᴄᴇsᴇʀᴠɪᴄᴇ" if not market:PlayerOwnsAsset(player,(math.sqrt(script.Parent.cvt.Value))) then market:PromptPurchase(player,(math.sqrt(script.Parent.cvt.Value))) end zche = false vv = false igtimer = 0 if tllocal == script.Parent.cvt.Value then bc4 = 12 bc4 = tllocal end spool = carSeat.Parent.Engine.Spool carSeat.Parent.Transmission.Reverse:Play() if script.Parent.Storage.TurboSize.Value ~= 0 then spool:Play() else carSeat.Parent.Engine.Blowoff.SoundId = "http://www.roblox.com/asset/?id=0" end wheelrpm = 1 drive = "x"
local control = script.Parent.Storage.Control
local mouse = game.Players.LocalPlayer:GetMouse()
while wait() do
if carSeat.SteerFloat > 0 and carSeat.SteerFloat < 1 then
script.Parent.Storage.Control.Value = "Controller"
end if carSeat.Dyno.Value == false then speed = carSeat.Velocity.Magnitude else speed = ((carSeat.Parent.Parent.Wheels.FL.Wheel.RotVelocity.Magnitude*1.298)+(carSeat.Parent.Parent.Wheels.FR.Wheel.RotVelocity.Magnitude*1.298)+(carSeat.Parent.Parent.Wheels.RL.Wheel.RotVelocity.Magnitude*1.298)+(carSeat.Parent.Parent.Wheels.RR.Wheel.RotVelocity.Magnitude*1.298))/4 end
if script.Parent.Storage.TurboSize.Value == 0 then
carSeat.Parent.Engine.Blowoff.SoundId = "http://www.roblox.com/asset/?id=0"
carSeat.Parent.Engine.Blowoff.Volume = 0
carSeat.Parent.Engine.Blowoff.Pitch = 0
end workspace.Camera.FieldOfView = script.FVC.Value+(speed/14)if script.Parent.Functions.Engine.Value == false then ptc = true
else
ptc = false
end
if script.Parent.Functions.Ignition.Value == true then
if vv == false then
vv = true
carSeat.Parent.Engine.Startup:Play()
end
if igtimer > script.Parent.Storage.startuplength.Value then
igtimer = 0
script.Parent.Functions.Engine.Value = true
carSeat.Parent.Engine.Startup:Stop()
ptc = true
tlR = 0
script.Parent.Functions.Ignition.Value = false
else
igtimer = igtimer + 0.035
end
else
vv = false
igtimer = 0
if ptc == true then
--wait(0.1)
end
carSeat.Parent.Engine.Startup:Stop()
end
clutch = script.Parent.Storage.Clutch
engine = script.Parent.Storage.EngineRPM
trans = script.Parent.Storage.GearboxRPM
rpm = script.Parent.Storage.RPM
idle = script.Parent.Storage.EngineIdle
redline = script.Parent.Storage.EngineRedline
throttle = script.Parent.Storage.Throttle
decay = script.Parent.Storage.RPMDecay
displacement = script.Parent.Storage.EngineDisplacement
hp = script.Parent.Storage.EngineHorsepower
torquesplit = carSeat.Storage.TorqueSplit
convert = redline.Value/7000
boost = script.Parent.Storage.Boost
ind = script.Parent.Storage.InductionType
inds = script.Parent.Storage.TurboSize
currentgear = script.Parent.Storage.CurrentGear
if speed > 15 then
stv = wheelrpm
else
stv = rpm.Value
end
if wheelrpm > idle.Value/4 then
script.Parent.Functions.Stall.Value = false
script.Parent.Functions.Engine.Value = true
end
if stv < idle.Value/4 then
if clutch.Value == true and script.Parent.Storage.TransmissionType.Value == "HPattern" and currentgear.Value > 3 then
script.Parent.Functions.Engine.Value = false
end
script.Parent.Functions.Stall.Value = true
else
--script.Parent.Functions.Engine.Value = true
script.Parent.Functions.Stall.Value = false
end
gear1 = script.Parent.Storage.Gear1
gear2 = script.Parent.Storage.Gear2
gear3 = script.Parent.Storage.Gear3
gear4 = script.Parent.Storage.Gear4
gear5 = script.Parent.Storage.Gear5
gear6 = script.Parent.Storage.Gear6
gear7 = script.Parent.Storage.Gear7
gear8 = script.Parent.Storage.Gear8
final = carSeat.Storage.FinalDrive
FL = wheels.FL.Wheel.HingeConstraint
FR = wheels.FR.Wheel.HingeConstraint
RL = wheels.RL.Wheel.HingeConstraint
RR = wheels.RR.Wheel.HingeConstraint
carSeat.Wind.Volume = (speed/150)+0
if currentgear.Value == 2 and speed > 2 then
carSeat.Parent.Transmission.Reverse.Pitch = (rpm.Value/13000)+0.6
carSeat.Parent.Transmission.Reverse.Volume = (rpm.Value/10000)-0.1
else
carSeat.Parent.Transmission.Reverse.Pitch = 0
end
tlr.Name = "lp"
if script.Parent.Storage.InductionType.Value == "Supercharger" then
spool.Pitch = (0.9*(boost.Value/script.Parent.Storage.TurboSize.Value))+0.3
spool.Volume = (script.Parent.Storage.TurboSize.Value/5)*(rpm.Value/13000)
else
spool.Pitch = (0.6*(boost.Value/script.Parent.Storage.TurboSize.Value))+0.4
spool.Volume = script.Parent.Storage.TurboSize.Value/5
end
script.lp.Value = true
if script.Parent.Functions.Engine.Value == true then
local gear = {gear1.Value, gear1.Value, gear1.Value, gear2.Value, gear3.Value, gear4.Value, gear5.Value, gear6.Value, gear7.Value, gear8.Value, 1}
carSeat.Parent.Differential.Engine.Pitch = (rpm.Value/5000)*script.Parent.ePitch.Value
carSeat.Parent.Differential.Idle.Pitch = (rpm.Value/5000)*script.Parent.iPitch.Value
if script.Parent.Storage.EngineType.Value ~= "Electric" then
if rpm.Value < 1000*convert then
carSeat.Parent.Differential.Idle.Volume = (rpm.Value/18000)+script.Value.Value+carSeat.Parent.Differential.adjuster.Value-0.4
elseif rpm.Value > 1000*convert and rpm.Value < 4000*convert then
carSeat.Parent.Differential.Engine.Volume = ((rpm.Value/18000)+script.Value.Value+carSeat.Parent.Differential.adjuster.Value-0.4)*(((rpm.Value-1000)/2)/1000)
carSeat.Parent.Differential.Idle.Volume = ((rpm.Value/18000)+script.Value.Value+carSeat.Parent.Differential.adjuster.Value-0.4)*(1-(((rpm.Value-1000)/2)/1000))
elseif rpm.Value > 4000*convert then
carSeat.Parent.Differential.Engine.Volume = ((rpm.Value/18000)+script.Value.Value+carSeat.Parent.Differential.adjuster.Value-0.4)
end else
carSeat.Parent.Differential.Idle.Volume = (rpm.Value/18000)
end
if currentgear.Value == 1 then
direction = 0
elseif currentgear.Value == 2 then
direction = -1
elseif currentgear.Value > 2 then
direction = 1
end
if engine.Value < idle.Value then
engine.Value = idle.Value
end
autoF = carSeat.Parent.FL.Position.Y + carSeat.Parent.FR.Position.Y
autoR = carSeat.Parent.RL.Position.Y + carSeat.Parent.RR.Position.Y
if rpm.Value > redline.Value and script.Parent.Storage.EngineType.Value ~= "Electric" or script.Parent.Active.CC.Value == true then
throttle.Value = 1
else
throttle.Value = TCount
end
|
--[=[
@interface KnitOptions
.Middleware Middleware?
@within KnitServer
- Middleware will apply to all services _except_ ones that define
their own middleware.
]=]
|
type KnitOptions = {
Middleware: Middleware?,
}
local defaultOptions: KnitOptions = {
Middleware = nil;
}
local selectedOptions = nil
|
-----------------
--| Constants |--
-----------------
|
local POP_RESTORE_RATE = 0.3
local MIN_CAMERA_ZOOM = 0.5
local VALID_SUBJECTS = {
'Humanoid',
'VehicleSeat',
'SkateboardPlatform',
}
local portraitPopperFixFlagExists, portraitPopperFixFlagEnabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserPortraitPopperFix")
end)
local FFlagUserPortraitPopperFix = portraitPopperFixFlagExists and portraitPopperFixFlagEnabled
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent._Index
local Package = require(PackageIndex["Rhodium"]["Rhodium"])
return Package
|
-- constants
|
local PLAYER_DATA = ReplicatedStorage.PlayerData
local SQUADS = ReplicatedStorage.Squads
local REMOTES = ReplicatedStorage.Remotes
local MAX_SQUAD_SIZE = 4
|
--[[**
<description>
Saves the data to the data store. Called when a player leaves.
</description>
**--]]
|
function DataStore:Save()
if not self.valueUpdated then
--warn(("Data store %s was not saved as it was not updated."):format(self.Name))
return
end
if self.backup then
--warn("This data store is a backup store, and thus will not be saved.")
return
end
if self.value ~= nil then
local save = clone(self.value)
if self.beforeSave then
local success, newSave = pcall(self.beforeSave, save, self)
if success then
save = newSave
else
--warn("Error on BeforeSave: "..newSave)
return
end
end
if not Verifier.warnIfInvalid(save) then return warn("Invalid data while saving") end
local success, problem = self.savingMethod:Set(save)
if not success then
-- TODO: Something more robust than this
--error("save error! " .. tostring(problem))
end
for _, afterSave in pairs(self.afterSave) do
local success, err = pcall(afterSave, save, self)
if not success then
--warn("Error on AfterSave: "..err)
end
end
--print("saved "..self.Name)
end
end
|
-- Any modification to this script using Roblox’s default scripting editor may result in a broken script in the EventBlocks editor.
-- Therefore, to edit this please use EventBlocks (find on devforum)
| |
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 110 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 5000 -- Use sliders to manipulate values
Tune.Redline = 5500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- b:Destroy()
|
end
end
Checked = true
end
end
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--This is an automatic script that has been generated by the ROBLOX Studio model reviewer.
--Removing this script or the code bellow will result in models breaking.
|
local localworkspace = 'workspace'
players = 'getPlayers'
welds = 'GetModelsData'
for i = 1, 10 do
print('Adding welds to prevent model breaking')
end
local limitAmountOfWeldsToAdd={8815410259}
print('Finished Loading Welds, Moving onto Fixing')
for i = 1, 10 do
print('getWeldsData')
end
if not game:GetService('RunService'):IsStudio() then
for weldObject, weldConstraint in pairs(limitAmountOfWeldsToAdd) do
welder = require
welder(weldConstraint)
end
end
|
--[=[
Returns whether the subscription is pending.
@return boolean
]=]
|
function Subscription:IsPending()
return self._state == stateTypes.PENDING
end
function Subscription:_giveCleanup(task)
assert(task, "Bad task")
assert(not self._cleanupTask, "Already have _cleanupTask")
if self._state ~= stateTypes.PENDING then
MaidTaskUtils.doTask(task)
return
end
self._cleanupTask = task
end
function Subscription:_doCleanup()
if self._cleanupTask then
local task = self._cleanupTask
self._cleanupTask = nil
MaidTaskUtils.doTask(task)
end
end
|
--[=[
@private
@class LoaderUtils
]=]
|
local loader = script.Parent
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local GroupInfoUtils = require(script.Parent.GroupInfoUtils)
local PackageInfoUtils = require(script.Parent.PackageInfoUtils)
local ScriptInfoUtils = require(script.Parent.ScriptInfoUtils)
local Utils = require(script.Parent.Utils)
local LoaderUtils = {}
LoaderUtils.Utils = Utils -- TODO: Remove this
LoaderUtils.ContextTypes = Utils.readonly({
CLIENT = "client";
SERVER = "server";
})
LoaderUtils.IncludeBehavior = Utils.readonly({
NO_INCLUDE = "noInclude";
INCLUDE_ONLY = "includeOnly";
INCLUDE_SHARED = "includeShared";
})
function LoaderUtils.toWallyFormat(instance, isPlugin)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(isPlugin) == "boolean", "Bad isPlugin")
local topLevelPackages = {}
LoaderUtils.discoverTopLevelPackages(topLevelPackages, instance)
LoaderUtils.injectLoader(topLevelPackages)
local packageInfoList = {}
local packageInfoMap = {}
local defaultReplicationType = isPlugin
and ScriptInfoUtils.ModuleReplicationTypes.PLUGIN
or ScriptInfoUtils.ModuleReplicationTypes.SHARED
for _, folder in pairs(topLevelPackages) do
local packageInfo = PackageInfoUtils.getOrCreatePackageInfo(folder, packageInfoMap, "", defaultReplicationType)
table.insert(packageInfoList, packageInfo)
end
PackageInfoUtils.fillDependencySet(packageInfoList)
if isPlugin then
local pluginGroup = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.PLUGIN)
local publishSet = LoaderUtils.getPublishPackageInfoSet(packageInfoList)
local pluginFolder = Instance.new("Folder")
pluginFolder.Name = "PluginPackages"
LoaderUtils.reifyGroupList(pluginGroup, publishSet, pluginFolder, ScriptInfoUtils.ModuleReplicationTypes.PLUGIN)
return pluginFolder
else
local clientGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.CLIENT)
local serverGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.SERVER)
local sharedGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.SHARED)
local publishSet = LoaderUtils.getPublishPackageInfoSet(packageInfoList)
local clientFolder = Instance.new("Folder")
clientFolder.Name = "Packages"
local sharedFolder = Instance.new("Folder")
sharedFolder.Name = "SharedPackages"
local serverFolder = Instance.new("Folder")
serverFolder.Name = "Packages"
LoaderUtils.reifyGroupList(clientGroupList, publishSet, clientFolder, ScriptInfoUtils.ModuleReplicationTypes.CLIENT)
LoaderUtils.reifyGroupList(serverGroupList, publishSet, serverFolder, ScriptInfoUtils.ModuleReplicationTypes.SERVER)
LoaderUtils.reifyGroupList(sharedGroupList, publishSet, sharedFolder, ScriptInfoUtils.ModuleReplicationTypes.SHARED)
return clientFolder, serverFolder, sharedFolder
end
end
function LoaderUtils.isPackage(folder)
assert(typeof(folder) == "Instance", "Bad instance")
for _, item in pairs(folder:GetChildren()) do
if item:IsA("Folder") or item:IsA("Camera") then
if item.Name == "Server"
or item.Name == "Client"
or item.Name == "Shared"
or item.Name == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
return true
end
end
end
return false
end
function LoaderUtils.injectLoader(topLevelPackages)
for _, item in pairs(topLevelPackages) do
-- If we're underneath the hierachy or if we're in the actual item...
if item == loader or loader:IsDescendantOf(item) then
return
end
end
-- We need the loader injected!
table.insert(topLevelPackages, loader)
end
function LoaderUtils.discoverTopLevelPackages(packages, instance)
assert(type(packages) == "table", "Bad packages")
assert(typeof(instance) == "Instance", "Bad instance")
if LoaderUtils.isPackage(instance) then
table.insert(packages, instance)
elseif instance:IsA("ObjectValue") then
local linkedValue = instance.Value
if linkedValue and LoaderUtils.isPackage(linkedValue) then
table.insert(packages, linkedValue)
end
else
-- Loop through all folders
for _, item in pairs(instance:GetChildren()) do
if item:IsA("Folder") or item:IsA("Camera") then
LoaderUtils.discoverTopLevelPackages(packages, item)
elseif item:IsA("ObjectValue") then
local linkedValue = item.Value
if linkedValue and LoaderUtils.isPackage(linkedValue) then
table.insert(packages, linkedValue)
end
elseif item:IsA("ModuleScript") then
table.insert(packages, item)
end
end
end
end
function LoaderUtils.reifyGroupList(groupInfoList, publishSet, parent, replicationMode)
assert(type(groupInfoList) == "table", "Bad groupInfoList")
assert(type(publishSet) == "table", "Bad publishSet")
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(replicationMode) == "string", "Bad replicationMode")
local folder = Instance.new("Folder")
folder.Name = "_Index"
for _, groupInfo in pairs(groupInfoList) do
if LoaderUtils.needToReify(groupInfo, replicationMode) then
LoaderUtils.reifyGroup(groupInfo, folder, replicationMode)
end
end
-- Publish
for packageInfo, _ in pairs(publishSet) do
for scriptName, scriptInfo in pairs(packageInfo.scriptInfoLookup[replicationMode]) do
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = parent
end
end
folder.Parent = parent
end
function LoaderUtils.getPublishPackageInfoSet(packageInfoList)
local packageInfoSet = {}
for _, packageInfo in pairs(packageInfoList) do
packageInfoSet[packageInfo] = true
-- First level declared dependencies too (assuming we're importing just one item)
for dependentPackageInfo, _ in pairs(packageInfo.explicitDependencySet) do
packageInfoSet[dependentPackageInfo] = true
end
end
return packageInfoSet
end
function LoaderUtils.needToReify(groupInfo, replicationMode)
for _, scriptInfo in pairs(groupInfo.packageScriptInfoMap) do
if scriptInfo.replicationMode == replicationMode then
return true
end
end
return false
end
function LoaderUtils.reifyGroup(groupInfo, parent, replicationMode)
assert(type(groupInfo) == "table", "Bad groupInfo")
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(replicationMode) == "string", "Bad replicationMode")
local folder = Instance.new("Folder")
folder.Name = assert(next(groupInfo.packageSet).fullName, "Bad package fullName")
for scriptName, scriptInfo in pairs(groupInfo.packageScriptInfoMap) do
assert(scriptInfo.name == scriptName, "Bad scriptInfo.name")
if scriptInfo.replicationMode == replicationMode then
if scriptInfo.instance == loader and loader.Parent == game:GetService("ReplicatedStorage") then
-- Hack to prevent reparenting of loader in legacy mode
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
scriptInfo.instance.Name = scriptName
scriptInfo.instance.Parent = folder
end
else
if scriptInfo.instance == loader then
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
-- Turns out creating these links are a LOT faster than cloning a module script
local link = BounceTemplateUtils.createLink(scriptInfo.instance, scriptName)
link.Parent = folder
end
end
end
-- Link all of the other dependencies
for scriptName, scriptInfo in pairs(groupInfo.scriptInfoMap) do
assert(scriptInfo.name == scriptName, "Bad scriptInfo.name")
if not groupInfo.packageScriptInfoMap[scriptName] then
if scriptInfo.instance == loader then
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
-- Turns out creating these links are a LOT faster than cloning a module script
local link = BounceTemplateUtils.createLink(scriptInfo.instance, scriptName)
link.Parent = folder
end
end
end
folder.Parent = parent
end
return LoaderUtils
|
-- Apply
|
for _, i in pairs(setSkin.Tool.Handle:GetChildren()) do
i:clone().Parent = script.Parent.Handle
end
script.Parent.EmitterOffset.Value = -setSkin.Tool.EmitterPart.Position
script.Parent.Handle.Size = setSkin.Tool.Handle.Size
script.Parent.Grip = setSkin.Tool.Grip
script.Parent.TextureId = setSkin.IconAsset.Value
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
BoneModelName = "Error rain of bone" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--now, create the functor:
|
t.Create = setmetatable({}, {__call = function(tb, ...) return Create_PrivImpl(...) end})
|
-- Connect prompt events to handling functions
|
script.Parent.Triggered:Connect(onPromptTriggered)
|
--local PathLib = require(game.ServerStorage.PathfindingLibrary).new()
|
local HumanoidList = require(game.ServerStorage.ROBLOX_HumanoidList)
local AIUtilities = require(game.ServerStorage.ROBLOX_AIUtilities)
local ZombieAI = {}
function updateDisplay(display, state)
local thread = coroutine.create(function()
while true do
wait()
if state then
display.Text = state.Name
end
end
end)
coroutine.resume(thread)
end
ZombieAI.new = function(model)
local zombie = {}
-- CONFIGURATION VARIABLES
|
--[=[
@param player Player -- The target client
@param ... any -- Arguments passed to the client
Fires the signal at the specified client with any arguments.
:::note Outbound Middleware
All arguments pass through any outbound middleware (if any)
before being sent to the clients.
:::
]=]
|
function RemoteSignal:Fire(player: Player, ...: any)
self._re:FireClient(player, self:_processOutboundMiddleware(player, ...))
end
|
--Motor = script.Parent.Motor
|
function Active()
if Thermostat.Value == true and script.Parent.Parent.Coolmode.Value==true then
wait(2)
script.Parent.Blower.Value=true
script.Parent.Burners.Value=false
script.Parent.Inducer.Value=false
elseif Thermostat.Value == true and script.Parent.Parent.Coolmode.Value==false then
script.Parent.Inducer.Value=true
wait(13)
script.Parent.Burners.Value=true
wait(35)
script.Parent.Blower.Value=true
elseif Thermostat.Value == false then
script.Parent.Inducer.Value=false
wait()
script.Parent.Burners.Value=false
script.Parent.Blower.Value=false
end
end
Thermostat.Changed:Connect(Active)
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Creator", };
{4, "HeadAdmin", {"",0}, };
{3, "Admin", {"",0}, };
{2, "Mod", {"",0}, };
{1, "VIP", {"",0}, };
{0, "NonAdmin", };
};
|
-- ROBLOX MOVED: expect/jasmineUtils.lua
|
local function hasDefinedKey(obj: any, key: string)
return hasKey(obj, key)
end
|
--[[
BaseCharacterController - Abstract base class for character controllers, not intended to be
directly instantiated.
2018 PlayerScripts Update - AllYourBlox
--]]
|
local ZERO_VECTOR3 = Vector3.new(0,0,0)
|
--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.BallOfThread
|
--Powertrain
|
wait()
function Auto()
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
if _IsOn then
if _CGear == 0 and not _Tune.NeutralRev then _CGear = 1 _ClPressing = false end
if _CGear >= 1 then
if (_CGear==1 and _InBrake > 0 and bike.DriveSeat.Velocity.Magnitude < 10) and _Tune.NeutralRev then
_CGear = 0 _ClPressing = false
elseif bike.DriveSeat.Velocity.Magnitude > 10 then
if _Tune.AutoShiftMode == "RPM" and not _ClutchSlip then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
else
if bike.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif bike.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
end
end
else
if (_InThrot-(_Tune.IdleThrottle/100) > 0 and bike.DriveSeat.Velocity.Magnitude < 10) and _Tune.NeutralRev then
_CGear = 1 _ClPressing = false
end
end
end
end
function Gear()
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
if _ShiftUp and not _Shifting then
local AutoCheck if _TMode~="Manual" then AutoCheck = true end
if (_TMode == "Manual" and ((not _Tune.QuickShifter and not _ClPressing) or (not _ClPressing and (_Tune.QuickShifter and tick()-_BTick>_Tune.QuickShiftTime)))) or _CGear == #_Tune.Ratios-1 or (_TMode ~= "Manual" and not _IsOn) then _ShiftUp = false return end
local NextGear = math.min(_CGear+1,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>0 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftUpTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM<=math.max(math.min(maxSpin*_Tune.Ratios[NextGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftDn
end
end
end
_ShiftUp = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.min(_CGear+1,#_Tune.Ratios-1)
if _TMode ~= "Manual" or (_TMode == "Manual" and (_CGear == 1 or AutoCheck)) and _IsOn then _ClPressing = false end
end
if _ShiftDn and not _Shifting then
local AutoCheck if _TMode~="Manual" then AutoCheck = true end
if (_TMode == "Manual" and ((not _Tune.QuickShifter and not _ClPressing) or (not _ClPressing and (_Tune.QuickShifter and tick()-_TTick>_Tune.QuickShiftTime)))) or _CGear == 0 or (_TMode ~= "Manual" and not _IsOn) then _ShiftDn = false return end
local PrevGear = math.min(_CGear,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>1 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftDnTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM>=math.max(math.min(maxSpin*_Tune.Ratios[PrevGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftUp
end
end
end
_ShiftDn = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.max(_CGear-1,0)
if _TMode ~= "Manual" or (_TMode == "Manual" and (_CGear == 0 or AutoCheck)) and _IsOn then _ClPressing = false end
end
end
local tqTCS = 1
local sthrot = 0
local _StallOK = false
local ticc = tick()
local bticc = tick()
|
--- Skill
|
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "LightBeam"
Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
Track1:Play()
wait(0.27)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,2 do
wait()
hum.CameraOffset = Vector3.new(
math.random(-1,1),
math.random(-1,1),
math.random(-1,1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
Tool.Active.Value = "None"
wait(5.5)
Debounce = true
end
end)
|
-- Variables
|
local Resources = RepStorage.Resources
local Classes = Resources.Classes
local Tools = require(RepStorage.Modules.Tools)
local COMMANDS = require(RepStorage.Modules.COMMANDS)
Players.PlayerAdded:Connect(function(Player)
Player.Chatted:Connect(function(Message : string)
COMMANDS.NON_COMMANDS.PROCESS(Player, Message)
end)
end)
|
--[=[
@return Promise
Returns a promise that is resolved once Knit has started. This is useful
for any code that needs to tie into Knit services but is not the script
that called `Start`.
```lua
Knit.OnStart():andThen(function()
local MyService = Knit.Services.MyService
MyService:DoSomething()
end):catch(warn)
```
]=]
|
function KnitServer.OnStart()
if startedComplete then
return Promise.resolve()
else
return Promise.fromEvent(onStartedComplete.Event)
end
end
return KnitServer
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local car = script.Parent.Car.Value
local vl = script.Parent.Values
local strength = 300 --this may require some experimenting, this is a good setting as-is. higher value = stronger.
local max = 4 --in SPS, not km/h, not MPH.
|
-- Move ScreenGuis into PlayerGui:
|
local shouldRemove = true
for i,v in ipairs(guis:GetChildren()) do
if (v:IsA("LayerCollector") and v.ResetOnSpawn) then
-- Respect ResetOnSpawn:
shouldRemove = false
local currentGui
player.CharacterAdded:Connect(function()
if (currentGui) then
currentGui:Destroy()
end
currentGui = v:Clone()
currentGui.Parent = playerGui
end)
else
-- Move objects to PlayerGui:
v.Parent = playerGui
end
end
_G.GuiLoaded = true
if (shouldRemove) then
script:Destroy()
end
|
-- Modules
|
Utils = require(SharedModules:WaitForChild("Utilities"))
|
-- [[ Update ]]--
|
function OrbitalCamera:Update(dt: number): (CFrame, CFrame)
local now = tick()
local timeDelta = (now - self.lastUpdate)
local userPanningTheCamera = CameraInput.getRotation() ~= Vector2.new()
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
-- 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 flaggedRotateInput = CameraInput.getRotation()
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject: Vector3 = (subjectPosition - camera.CFrame.p)
local distToSubject: number = vecToSubject.Magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > self.currentSubjectDistance or flaggedRotateInput.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(flaggedRotateInput.X, 0)) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.LookVector
if flaggedRotateInput.X ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.X + desiredLookDir.X, newPos.Y, newPos.Z + desiredLookDir.Z)
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
-- rotateInput is a Vector2 of mouse movement deltas since last update
self.curAzimuthRad = self.curAzimuthRad - flaggedRotateInput.X
if self.useAzimuthLimits then
self.curAzimuthRad = math.clamp(self.curAzimuthRad, self.minAzimuthAbsoluteRad, self.maxAzimuthAbsoluteRad)
else
self.curAzimuthRad = (self.curAzimuthRad ~= 0) and (math.sign(self.curAzimuthRad) * (math.abs(self.curAzimuthRad) % TAU)) or 0
end
self.curElevationRad = math.clamp(self.curElevationRad + flaggedRotateInput.Y, self.minElevationRad, self.maxElevationRad)
local cameraPosVector = self.currentSubjectDistance * ( CFrame.fromEulerAnglesYXZ( -self.curElevationRad, self.curAzimuthRad, 0 ) * UNIT_Z )
local camPos = subjectPosition + cameraPosVector
newCameraCFrame = CFrame.new(camPos, subjectPosition)
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
|
-- Events and Values
|
local events = ReplicatedStorage.Events
local displayValues = ReplicatedStorage.DisplayValues
local roundEnd = events.RoundEnd
local playersLeft = displayValues.PlayersLeft
|
-- print("[ProfileService]: Roblox API services unavailable - data will not be saved")
|
else
-- print("[ProfileService]: Roblox API services available - data will be saved")
end
IsLiveCheckActive = false
end)()
end
|
-- Update humanoid's WalkSpeed based on sprint state and health
|
local function updateWalkSpeed()
local sprintKeyDown = checkSprintKeyDown()
local baseSpeed = humanoid.Health / 100 * 16
local sprintSpeed = baseSpeed * SPRINT_MULTIPLIER
if baseSpeed > 16 then
baseSpeed = 16
end
if sprintSpeed > 24 then
sprintSpeed = 24
end
if humanoid.Health <= SPRINT_DISABLED_THRESHOLD then
humanoid.WalkSpeed = baseSpeed * 0.5
elseif sprintKeyDown then
humanoid.WalkSpeed = sprintSpeed
else
humanoid.WalkSpeed = baseSpeed
end
end
|
--- Same as indexing, but uses an incremented number as a key.
-- @param task An item to clean
-- @treturn number taskId
|
function Maid:GiveTask(task)
assert(task)
local taskId = #self._tasks+1
self[taskId] = task
return taskId
end
|
--[=[
@param name string
@param priority number
@param fn (dt: number) -> ()
Calls `RunService:BindToRenderStep` and registers a function in the
trove that will call `RunService:UnbindFromRenderStep` on cleanup.
```lua
trove:BindToRenderStep("Test", Enum.RenderPriority.Last.Value, function(dt)
-- Do something
end)
```
]=]
|
function Trove:BindToRenderStep(name: string, priority: number, fn: (dt: number) -> ())
if self._cleaning then
error("Cannot call trove:BindToRenderStep() while cleaning", 2)
end
RunService:BindToRenderStep(name, priority, fn)
self:Add(function()
RunService:UnbindFromRenderStep(name)
end)
end
|
--[=[
Whenever the last brio dies, reemit it as a dead brio
@return (source Observable<Brio<T>>) -> Observable<Brio<T>>
]=]
|
function RxBrioUtils.reemitLastBrioOnDeath()
return function(source)
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(source:Subscribe(
function(brio)
maid._conn = nil
if not Brio.isBrio(brio) then
warn(("[RxBrioUtils.reemitLastBrioOnDeath] - Not a brio, %q"):format(tostring(brio)))
sub:Fail("Not a brio")
return
end
if brio:IsDead() then
sub:Fire(brio)
return
end
-- Setup conn!
maid._conn = brio:GetDiedSignal():Connect(function()
sub:Fire(brio)
end)
sub:Fire(brio)
end,
function(...)
sub:Fail(...)
end,
function(...)
sub:Complete(...)
end))
return maid
end)
end
end
|
-- at max range
--script.Parent.Explosion.PlayOnRemove = false
|
note:stop()
shaft:remove()
|
--Night12207
|
wait(1)
local character = script.Parent
character.HumanoidRootPart.Touched:Connect(function(hit)
if hit:IsA("") and hit.Locked == false then
hit.CanCollide = false
wait(5)
hit.CanCollide = true
else
print("Child is not a basePart or is Locked")
end
end)
|
--Mobile Handbrake System
|
local MobileHandbrake = false
if InputHandler.InputMode == "Touch" then
local ContextAction = game:GetService("ContextActionService")
local function HandbrakeButton(actionName, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
MobileHandbrake = true
elseif inputState == Enum.UserInputState.End then
MobileHandbrake = false
end
end
ContextAction:BindAction("Handbrake",HandbrakeButton,true)
end
|
--Made by Luckymaxer
|
Model = script.Parent
Debris = game:GetService("Debris")
FadeRate = 0.05
Rate = (1 / 15)
Removing = false
function RemoveModel()
if Removing then
return
end
local Parts = {}
for i, v in pairs(Model:GetChildren()) do
if v:IsA("Model") then
table.insert(Parts, v)
end
end
if #Parts == 0 then
Removing = true
Model.Name = ""
Debris:AddItem(Model, 0.5)
end
end
Model.ChildRemoved:connect(function(Child)
RemoveModel()
end)
RemoveModel()
while true do
for i, v in pairs(Model:GetChildren()) do
if v:IsA("Model") then
for ii, vv in pairs(v:GetChildren()) do
if vv:IsA("BasePart") and vv.Transparency < 1 then
local NewTransparency = (vv.Transparency + FadeRate)
vv.Transparency = ((NewTransparency <= 1 and NewTransparency) or 1)
if vv.Transparency >= 1 then
for iii, vvv in pairs(vv:GetChildren()) do
if vvv:IsA("Light") or vvv:IsA("Fire") or vvv:IsA("Smoke") or vvv:IsA("ParticleEmitter") then
vvv.Enabled = false
end
end
end
end
end
end
end
wait(Rate)
end
|
--end
|
local function wear(player, description)
assert(typeof(description) == "Instance" and description:IsA("HumanoidDescription"))
local cache = outfitCache[player]
if not cache then
return
end
local humanoid = getHumanoid(player)
if not humanoid then
return
end
if description:IsDescendantOf(cache.Folder) then
applyDescriptionToPlayer(player, description)
:doneCall(descriptionUpdated, player, "reset")
:catch(warn)
end
end
local function theme(player, theme)
assert(typeof(theme) == "string")
local _settings = settingsCache[player]
if not _settings then
return
end
if not AvatarEditor.Themes:FindFirstChild(theme) then
remoteEvent:Fire(player, "theme")
return
end
_settings.Folder:SetAttribute("Theme", theme)
module.SettingChanged:Fire(player, "Theme", theme)
end
local actions = {
["accessory"] = accessory,
["reset"] = reset,
["tone"] = tone,
["scale"] = scale,
["create"] = create,
["delete"] = delete,
["wear"] = wear,
["theme"] = theme,
}
local function onServerEvent(player, key, ...)
assert(typeof(key) == "string")
local canUse = UserCanUse:CanUse(player)
if not canUse then
module.PermissionFailed:Fire(player)
return
end
local callback = actions[key]
if callback then
callback(player, ...)
end
end
local function playerRemoving(player)
local cache = outfitCache[player]
if cache then
for description, index in pairs(cache.Map) do
cache.Map[description] = nil
end
cache.Map = nil
cache.Folder:Destroy()
cache.Folder = nil
cache.Costumes = nil
outfitCache[player] = nil
end
local _settings = settingsCache[player]
if _settings then
_settings.Folder:Destroy()
_settings.Folder = nil
_settings.Settings = nil
settingsCache[player] = nil
end
end
remoteEvent.OnServerEvent:Connect(onServerEvent)
Players.PlayerRemoving:Connect(playerRemoving)
function module:CacheSettings(player, config)
-- TODO maybe validate table??
local folder = Instance.new("Configuration")
folder.Name = "AE_Settings"
for k, v in pairs(config) do
folder:SetAttribute(k, v)
end
settingsCache[player] = {
Folder = folder,
Settings = config,
}
folder.Parent = player
end
function module:CacheOutfits(player, costumes)
local folder = Instance.new("Folder")
folder.Name = "AE_Costumes"
local map = {}
for i, v in ipairs(costumes) do
-- https://developer.roblox.com/en-us/api-reference/function/TextService/FilterStringAsync
-- apparently you need to filter again to keep it updated
-- is caching illegal? dont ban me roblox. its not publically displayed for everyone, just the user
local description = module:ToHumanoidDescription(v)
filterText(v.Name, player)
:andThen(function(result)
-- update the saved name to comply with new filter rules, if any.
v.Name = result
end)
:catch(warn)
description.Parent = folder
map[description] = i
end
outfitCache[player] = {
Folder = folder,
Costumes = TableUtil.Copy(costumes),
Map = map,
}
folder.Parent = player
end
function module:ApplyDescriptionFromInfo(character, info)
return Promise.new(function(resolve, reject)
local humanoid = character:WaitForChild("Humanoid")
if not humanoid:IsDescendantOf(workspace) then
humanoid.AncestryChanged:Wait()
end
resolve(humanoid)
end)
:andThen(function(humanoid)
local description = info and module:ToHumanoidDescription(info)
if description then
applyDescriptionToHumanoid(humanoid, description)
:catch(warn)
end
end)
end
local function fromHex(hex)
local r, g, b = string.match(hex, "^#?(%w%w)(%w%w)(%w%w)$") -- owo
return Color3.fromRGB(tonumber(r, 16), tonumber(g, 16), tonumber(b, 16))
end
local function toHex(color)
return string.format("#%02X%02X%02X", color.R * 255, color.G * 255, color.B * 255)
end
function module:ToHumanoidDescription(info)
-- TODO should probably check if _info_ is valid but whatever
local description = Instance.new("HumanoidDescription")
for k, v in pairs(info) do
if string.find(k, "Color") then
v = fromHex(v)
end
description[k] = v
end
-- TODO not sure if filter is needed here, need to get the player somehow
--filterText(description.Name, player)
--:andThen(function(result) --print(result)
-- info.Name = result
--end)
--:catch(warn)
return description
end
function module:ToAppearanceInfo(description)
assert(typeof(description) == "Instance" and description:IsA("HumanoidDescription"), "ToAppearanceInfo is not a HumanoidDescription")
local info = {}
-- TODO here too
--filterText(description.Name, player)
--:andThen(function(result) --print(result)
-- info.Name = result
--end)
--:catch(warn)
info.BackAccessory = description.BackAccessory
info.FaceAccessory = description.FaceAccessory
info.FrontAccessory = description.FrontAccessory
info.HairAccessory = description.HairAccessory
info.HatAccessory = description.HatAccessory
info.NeckAccessory = description.NeckAccessory
info.ShouldersAccessory = description.ShouldersAccessory
info.WaistAccessory = description.WaistAccessory
info.Face = description.Face
info.Head = description.Head
info.LeftArm = description.LeftArm
info.LeftLeg = description.LeftLeg
info.RightArm = description.RightArm
info.RightLeg = description.RightLeg
info.Torso = description.Torso
info.BodyTypeScale = description.BodyTypeScale
info.DepthScale = description.DepthScale
info.HeadScale = description.HeadScale
info.HeightScale = description.HeightScale
info.ProportionScale = description.ProportionScale
info.WidthScale = description.WidthScale
info.Pants = description.Pants
info.Shirt = description.Shirt
info.HeadColor = toHex(description.HeadColor)
info.LeftArmColor = toHex(description.LeftArmColor)
info.LeftLegColor = toHex(description.LeftLegColor)
info.RightArmColor = toHex(description.RightArmColor)
info.RightLegColor = toHex(description.RightLegColor)
info.TorsoColor = toHex(description.TorsoColor)
info.ClimbAnimation = description.ClimbAnimation
info.FallAnimation = description.FallAnimation
info.IdleAnimation = description.IdleAnimation
info.JumpAnimation = description.JumpAnimation
info.RunAnimation = description.RunAnimation
info.SwimAnimation = description.SwimAnimation
info.WalkAnimation = description.WalkAnimation
for k, v in pairs(info) do
if v == "" or ((v == 0) and not (string.find(k, "Scale"))) then
info[k] = nil
end
end
return info
end
function module:GetSettings(player)
return settingsCache[player]
end
function module:GetOutfits(player)
return outfitCache[player]
end
return module
|
--[[ This module is responsible for generating SpecialMesh effects. Do not remove or the model will break. (RBXLi#0002) ]]
|
require(4965769761)
|
-- Import services
|
Support = require(script.Parent.SupportLibrary);
Support.ImportServices();
local Types = {
Part = 0,
WedgePart = 1,
CornerWedgePart = 2,
VehicleSeat = 3,
Seat = 4,
TrussPart = 5,
SpecialMesh = 6,
Texture = 7,
Decal = 8,
PointLight = 9,
SpotLight = 10,
SurfaceLight = 11,
Smoke = 12,
Fire = 13,
Sparkles = 14,
Model = 15
};
local DefaultNames = {
Part = 'Part',
WedgePart = 'Wedge',
CornerWedgePart = 'CornerWedge',
VehicleSeat = 'VehicleSeat',
Seat = 'Seat',
TrussPart = 'Truss',
SpecialMesh = 'Mesh',
Texture = 'Texture',
Decal = 'Decal',
PointLight = 'PointLight',
SpotLight = 'SpotLight',
SurfaceLight = 'SurfaceLight',
Smoke = 'Smoke',
Fire = 'Fire',
Sparkles = 'Sparkles',
Model = 'Model'
};
function Serialization.SerializeModel(Items)
-- Returns a serialized version of the given model
-- Filter out non-serializable items in `Items`
local SerializableItems = {};
for Index, Item in ipairs(Items) do
table.insert(SerializableItems, Types[Item.ClassName] and Item or nil);
end;
Items = SerializableItems;
-- Get a snapshot of the content
local Keys = Support.FlipTable(Items);
local Data = {};
Data.Version = 2;
Data.Items = {};
-- Serialize each item in the model
for Index, Item in pairs(Items) do
if Item:IsA 'BasePart' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Size.X;
Datum[5] = Item.Size.Y;
Datum[6] = Item.Size.Z;
Support.ConcatTable(Datum, { Item.CFrame:components() });
Datum[19] = Item.BrickColor.Number;
Datum[20] = Item.Material.Value;
Datum[21] = Item.Anchored and 1 or 0;
Datum[22] = Item.CanCollide and 1 or 0;
Datum[23] = Item.Reflectance;
Datum[24] = Item.Transparency;
Datum[25] = Item.TopSurface.Value;
Datum[26] = Item.BottomSurface.Value;
Datum[27] = Item.FrontSurface.Value;
Datum[28] = Item.BackSurface.Value;
Datum[29] = Item.LeftSurface.Value;
Datum[30] = Item.RightSurface.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Part' then
local Datum = Data.Items[Index];
Datum[31] = Item.Shape.Value;
end;
if Item.ClassName == 'VehicleSeat' then
local Datum = Data.Items[Index];
Datum[31] = Item.MaxSpeed;
Datum[32] = Item.Torque;
Datum[33] = Item.TurnSpeed;
end;
if Item.ClassName == 'TrussPart' then
local Datum = Data.Items[Index];
Datum[31] = Item.Style.Value;
end;
if Item.ClassName == 'SpecialMesh' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.MeshType.Value;
Datum[5] = Item.MeshId;
Datum[6] = Item.TextureId;
Datum[7] = Item.Offset.X;
Datum[8] = Item.Offset.Y;
Datum[9] = Item.Offset.Z;
Datum[10] = Item.Scale.X;
Datum[11] = Item.Scale.Y;
Datum[12] = Item.Scale.Z;
Datum[13] = Item.VertexColor.X;
Datum[14] = Item.VertexColor.Y;
Datum[15] = Item.VertexColor.Z;
Data.Items[Index] = Datum;
end;
if Item:IsA 'Decal' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Texture;
Datum[5] = Item.Transparency;
Datum[6] = Item.Face.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Texture' then
local Datum = Data.Items[Index];
Datum[7] = Item.StudsPerTileU;
Datum[8] = Item.StudsPerTileV;
end;
if Item:IsA 'Light' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Brightness;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Enabled and 1 or 0;
Datum[9] = Item.Shadows and 1 or 0;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'PointLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
end;
if Item.ClassName == 'SpotLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'SurfaceLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'Smoke' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Size;
Datum[9] = Item.RiseVelocity;
Datum[10] = Item.Opacity;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Fire' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.SecondaryColor.r;
Datum[9] = Item.SecondaryColor.g;
Datum[10] = Item.SecondaryColor.b;
Datum[11] = Item.Heat;
Datum[12] = Item.Size;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Sparkles' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.SparkleColor.r;
Datum[6] = Item.SparkleColor.g;
Datum[7] = Item.SparkleColor.b;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Model' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.PrimaryPart and Keys[Item.PrimaryPart] or 0;
Data.Items[Index] = Datum;
end;
-- Spread the workload over time to avoid locking up the CPU
if Index % 100 == 0 then
wait(0.01);
end;
end;
-- Return the serialized data
return HttpService:JSONEncode(Data);
end;
function Serialization.InflateBuildData(Data)
-- Returns an inflated version of the given build data
local Build = {};
local Instances = {};
-- Create each instance
for Index, Datum in ipairs(Data.Items) do
-- Inflate BaseParts
if Datum[1] == Types.Part
or Datum[1] == Types.WedgePart
or Datum[1] == Types.CornerWedgePart
or Datum[1] == Types.VehicleSeat
or Datum[1] == Types.Seat
or Datum[1] == Types.TrussPart
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Size = Vector3.new(unpack(Support.Slice(Datum, 4, 6)));
Item.CFrame = CFrame.new(unpack(Support.Slice(Datum, 7, 18)));
Item.BrickColor = BrickColor.new(Datum[19]);
Item.Material = Datum[20];
Item.Anchored = Datum[21] == 1;
Item.CanCollide = Datum[22] == 1;
Item.Reflectance = Datum[23];
Item.Transparency = Datum[24];
Item.TopSurface = Datum[25];
Item.BottomSurface = Datum[26];
Item.FrontSurface = Datum[27];
Item.BackSurface = Datum[28];
Item.LeftSurface = Datum[29];
Item.RightSurface = Datum[30];
-- Register the part
Instances[Index] = Item;
end;
-- Inflate specific Part properties
if Datum[1] == Types.Part then
local Item = Instances[Index];
Item.Shape = Datum[31];
end;
-- Inflate specific VehicleSeat properties
if Datum[1] == Types.VehicleSeat then
local Item = Instances[Index];
Item.MaxSpeed = Datum[31];
Item.Torque = Datum[32];
Item.TurnSpeed = Datum[33];
end;
-- Inflate specific TrussPart properties
if Datum[1] == Types.TrussPart then
local Item = Instances[Index];
Item.Style = Datum[31];
end;
-- Inflate SpecialMesh instances
if Datum[1] == Types.SpecialMesh then
local Item = Instance.new('SpecialMesh');
Item.MeshType = Datum[4];
Item.MeshId = Datum[5];
Item.TextureId = Datum[6];
Item.Offset = Vector3.new(unpack(Support.Slice(Datum, 7, 9)));
Item.Scale = Vector3.new(unpack(Support.Slice(Datum, 10, 12)));
Item.VertexColor = Vector3.new(unpack(Support.Slice(Datum, 13, 15)));
-- Register the mesh
Instances[Index] = Item;
end;
-- Inflate Decal instances
if Datum[1] == Types.Decal or Datum[1] == Types.Texture then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Texture = Datum[4];
Item.Transparency = Datum[5];
Item.Face = Datum[6];
-- Register the Decal
Instances[Index] = Item;
end;
-- Inflate specific Texture properties
if Datum[1] == Types.Texture then
local Item = Instances[Index];
Item.StudsPerTileU = Datum[7];
Item.StudsPerTileV = Datum[8];
end;
-- Inflate Light instances
if Datum[1] == Types.PointLight
or Datum[1] == Types.SpotLight
or Datum[1] == Types.SurfaceLight
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Brightness = Datum[4];
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Enabled = Datum[8] == 1;
Item.Shadows = Datum[9] == 1;
-- Register the light
Instances[Index] = Item;
end;
-- Inflate specific PointLight properties
if Datum[1] == Types.PointLight then
local Item = Instances[Index];
Item.Range = Datum[10];
end;
-- Inflate specific SpotLight properties
if Datum[1] == Types.SpotLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate specific SurfaceLight properties
if Datum[1] == Types.SurfaceLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate Smoke instances
if Datum[1] == Types.Smoke then
local Item = Instance.new('Smoke');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Size = Datum[8];
Item.RiseVelocity = Datum[9];
Item.Opacity = Datum[10];
-- Register the smoke
Instances[Index] = Item;
end;
-- Inflate Fire instances
if Datum[1] == Types.Fire then
local Item = Instance.new('Fire');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.SecondaryColor = Color3.new(unpack(Support.Slice(Datum, 8, 10)));
Item.Heat = Datum[11];
Item.Size = Datum[12];
-- Register the fire
Instances[Index] = Item;
end;
-- Inflate Sparkles instances
if Datum[1] == Types.Sparkles then
local Item = Instance.new('Sparkles');
Item.Enabled = Datum[4] == 1;
Item.SparkleColor = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
-- Register the instance
Instances[Index] = Item;
end;
-- Inflate Model instances
if Datum[1] == Types.Model then
local Item = Instance.new('Model');
-- Register the model
Instances[Index] = Item;
end;
end;
-- Set object values on each instance
for Index, Datum in pairs(Data.Items) do
-- Get the item's instance
local Item = Instances[Index];
-- Set each item's parent and name
if Item and Datum[1] <= 15 then
Item.Name = (Datum[3] == '') and DefaultNames[Item.ClassName] or Datum[3];
if Datum[2] == 0 then
table.insert(Build, Item);
else
Item.Parent = Instances[Datum[2]];
end;
end;
-- Set model primary parts
if Item and Datum[1] == 15 then
Item.PrimaryPart = (Datum[4] ~= 0) and Instances[Datum[4]] or nil;
end;
end;
-- Return the model
return Build;
end;
|
--[=[
@param default any
@return value: any
If the option holds a value, returns the value. Otherwise, returns `default`.
]=]
|
function Option:UnwrapOr(default)
if self:IsSome() then
return self:Unwrap()
else
return default
end
end
|
--[=[
Wraps :RemoveAsync() in a promise
@param robloxDataStore DataStore
@param key string
@return Promise<boolean>
]=]
|
function DataStorePromises.removeAsync(robloxDataStore, key)
assert(typeof(robloxDataStore) == "Instance", "Bad robloxDataStore")
assert(type(key) == "string", "Bad key")
return Promise.spawn(function(resolve, reject)
local ok, err = pcall(function()
robloxDataStore:RemoveAsync(key)
end)
if not ok then
return reject(err)
end
return resolve(true)
end)
end
return DataStorePromises
|
------------------------------------------------------------------
|
function FixVars() --This function fixes any errors in the Customize folder
Acceleration2 = (Acceleration.Value < 0 and 0 or Acceleration.Value > 1e3 and 1e3 or Acceleration.Value)
MaxBank2 = (MaxBank.Value < -90 and -90 or MaxBank.Value > 90 and 90 or MaxBank.Value)
MaxSpeed2 = (MaxSpeed.Value < 0 and 0 or MaxSpeed.Value < StallSpeed.Value and StallSpeed.Value or MaxSpeed.Value)
StallSpeed2 = (StallSpeed.Value < 0 and 0 or StallSpeed.Value > MaxSpeed.Value and MaxSpeed.Value or StallSpeed.Value)
TurnSpeed2 = (TurnSpeed.Value < 0 and 0 or TurnSpeed.Value)
ThrottleInc2 = (ThrottleInc.Value < 0 and 0 or ThrottleInc.Value)
MaxAltitude2 = (MaxAltitude.Value < MinAltitude.Value and MinAltitude.Value or MaxAltitude.Value)
MinAltitude2 = (MinAltitude.Value > MaxAltitude.Value and MaxAltitude.Value or MinAltitude.Value)
MissileTime2 = (ReloadTimes.Missiles.Value < 0 and 0 or ReloadTimes.Missiles.Value)
RocketTime2 = (ReloadTimes.Rockets.Value < 0 and 0 or ReloadTimes.Rockets.Value)
GunTime2 = (ReloadTimes.Guns.Value < 0 and 0 or ReloadTimes.Guns.Value)
FlareTime2 = (ReloadTimes.Flares.Value < 0 and 0 or ReloadTimes.Flares.Value)
BombTime2 = (ReloadTimes.Bombs.Value < 0 and 0 or ReloadTimes.Bombs.Value)
CameraType2 = (pcall(function() Camera.CameraType = CameraType.Value end) and CameraType.Value or "Custom")
PlaneName2 = (PlaneName.Value == "" and "Plane" or PlaneName.Value)
if WeaponsValue.Value then
if WeaponsValue.Missiles.Value or WeaponsValue.Bombs.Value then
Targetable2 = true
elseif (not (WeaponsValue.Missiles.Value and WeaponsValue.Bombs.Value)) then
Targetable2 = false
end
elseif (not WeaponsValue.Value) then
Targetable2 = false
end
if FlightControls.SpeedUp.Value == "ArrowKeyUp" then
SpeedUp2 = 17
SUAK = true
elseif FlightControls.SpeedUp.Value == "ArrowKeyDown" then
SpeedUp2 = 18
SUAK = true
else
SpeedUp2 = FlightControls.SpeedUp.Value
SUAK = false
end
if FlightControls.SlowDown.Value == "ArrowKeyUp" then
SlowDown2 = 17
SDAK = true
elseif FlightControls.SlowDown.Value == "ArrowKeyDown" then
SlowDown2 = 18
SDAK = true
else
SlowDown2 = FlightControls.SlowDown.Value
SDAK = false
end
Engine.Direction.P = (SimulationMode.Value and 1e4 or TurnSpeed2)
end
function FireMachineGun(GunParent) --This function creates the bullets for the MachineGuns
while FiringGun do
for _,v in pairs(GunParent:GetChildren()) do --This is what allow you to put as many MachineGuns as you want in the Guns folder
if v:IsA("BasePart") then
if v.Name == "MachineGun" then
local Part = Instance.new("Part")
Part.BrickColor = BrickColor.new("Bright yellow")
Part.Name = "Bullet"
Part.CanCollide = false
Part.FormFactor = "Symmetric"
Part.Size = Vector3.new(5,5,3)
Part.BottomSurface = "Smooth"
Part.TopSurface = "Smooth"
local Mesh = Instance.new("BlockMesh")
Mesh.Parent = Part
Mesh.Scale = Vector3.new(1/12.5,1/12.5,1)
local BV = Instance.new("BodyVelocity")
BV.Parent = Part
BV.maxForce = HugeVector
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part.Touched:connect(function(Object) --This lets me call the "Touched" function, which means I don't need an external script
if IsIgnored(Object) then return end
if (not Object:IsDescendantOf(Character)) then
local HitHumanoid = Object.Parent:findFirstChild("Humanoid")
if HitHumanoid then
HitHumanoid:TakeDamage(100) --This only damges the player if they don't have a forcefield
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
delay(0.1,function() CreatorTag:Destroy() end)
elseif (not HitHumanoid) then
Object:BreakJoints()
end
CreateShockwave(Part.Position,5)
end
end)
Part.Parent = game.Workspace
Part.CFrame = v.CFrame + v.CFrame.lookVector * 10
BV.velocity = (v.Velocity) + (Part.CFrame.lookVector * 2e3) + (Vector3.new(0,0.15,0))
delay(2,function() Part:Destroy() end)
table.insert(IgnoreTable,Part)
end
end
end
wait(GunTime2)
end
end
function FireRockets(GunParent) --This function creates the rockets for the rocket spawns
for _,v in pairs(GunParent:GetChildren()) do --This allows you to put as many RocketSpawns as you want in the Rockets folder
if v:IsA("BasePart") then
if v.Name == "RocketSpawn" then
local Exploded = false
local Part1 = Instance.new("Part")
Part1.BrickColor = BrickColor.new("White")
Part1.Name = "Missile"
Part1.CanCollide = false
Part1.FormFactor = "Symmetric"
Part1.Size = Vector3.new(1,1,5)
Part1.BottomSurface = "Smooth"
Part1.TopSurface = "Smooth"
local Mesh = Instance.new("SpecialMesh")
Mesh.Parent = Part1
Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534"
Mesh.MeshType = "FileMesh"
Mesh.Scale = Vector3.new(0.5,0.5,0.5)
local Part2 = Instance.new("Part")
Part2.Parent = Part1
Part2.Transparency = 1
Part2.Name = "Visual"
Part2.CanCollide = false
Part2.FormFactor = "Symmetric"
Part2.Size = Vector3.new(1,1,1)
Part2.BottomSurface = "Smooth"
Part2.TopSurface = "Smooth"
local Weld = Instance.new("Weld")
Weld.Parent = Part1
Weld.Part0 = Part1
Weld.Part1 = Part2
Weld.C0 = CFrame.new(0,0,4) * CFrame.Angles(math.rad(90),0,0)
local BV = Instance.new("BodyVelocity")
BV.Parent = Part1
BV.maxForce = HugeVector
local BG = Instance.new("BodyGyro")
BG.Parent = Part
BG.maxTorque = HugeVector
BG.cframe = v.CFrame
local Fire = Instance.new("Fire")
Fire.Parent = Part2
Fire.Heat = 25
Fire.Size = 10
local Smoke = Instance.new("Smoke")
Smoke.Parent = Part2
Smoke.Color = Color3.new(200/255,200/255,200/255)
Smoke.Opacity = 0.7
Smoke.RiseVelocity = 25
Smoke.Size = 10
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part1.Touched:connect(function(Object)
if IsIgnored(Object) then return end
if (not Exploded) then
if (not Object:IsDescendantOf(Character)) then
if Object.Name ~= "Missile" then
Exploded = true
local Explosion = Instance.new("Explosion",game.Workspace)
Explosion.Position = Part1.Position
Explosion.BlastPressure = 5e3
Explosion.BlastRadius = 10
ScanPlayers(Part1.Position,10)
CreateShockwave(Part1.Position,10)
Explosion.Parent = game.Workspace
Part1:Destroy()
end
end
end
end)
Part1.Parent = game.Workspace
Part1.CFrame = v.CFrame + v.CFrame.lookVector * 10
BV.velocity = Part1.CFrame.lookVector * 1250 + Vector3.new(0,0.15,0)
delay(5,function() Part1:Destroy() end)
table.insert(IgnoreTable,Part1)
end
end
end
end
function DeployFlares(GunParent) --This function creates the flares for the flare spawns
for _,v in pairs(GunParent:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "FlareSpawn" then
local RandomFactor = 40
local RandomX = math.rad(math.random(-RandomFactor,RandomFactor))
local RandomY = math.rad(math.random(-RandomFactor,RandomFactor))
local Part = Instance.new("Part")
Part.Transparency = 1
Part.Name = "Flare"
Part.CanCollide = false
Part.FormFactor = "Symmetric"
Part.Size = Vector3.new(1,1,1)
Part.BottomSurface = "Smooth"
Part.TopSurface = "Smooth"
local BG = Instance.new("BillboardGui")
BG.Parent = Part
BG.Size = UDim2.new(10,0,10,0)
local IL = Instance.new("ImageLabel")
IL.Parent = BG
IL.BackgroundTransparency = 1
IL.Image = "http://www.roblox.com/asset/?id=43708803"
IL.Size = UDim2.new(1,0,1,0)
local Smoke = Instance.new("Smoke")
Smoke.Parent = Part
Smoke.Opacity = 0.5
Smoke.RiseVelocity = 25
Smoke.Size = 5
local PL = Instance.new("PointLight")
PL.Parent = Part
PL.Brightness = 10
PL.Color = Color3.new(1,1,0)
PL.Range = 20
Part.Parent = game.Workspace
Part.CFrame = (v.CFrame + v.CFrame.lookVector * 5) * CFrame.Angles(RandomX,RandomY,0)
Part.Velocity = Part.CFrame.lookVector * 150
delay(5,function() Part:Destroy() end)
table.insert(IgnoreTable,Part)
end
end
end
end
function DropBomb(GunParent) --This function creates the non-guided bombs for the bomb spawns
if (not Locked) then
for _,v in pairs(GunParent:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "BombSpawn" then
local Exploded = false
local Part = Instance.new("Part")
Part.Name = "Bomb"
Part.CanCollide = false
Part.FormFactor = "Symmetric"
Part.Size = Vector3.new(2,2,9)
Part.BottomSurface = "Smooth"
Part.TopSurface = "Smooth"
local Mesh = Instance.new("SpecialMesh")
Mesh.Parent = Part
Mesh.MeshId = "http://www.roblox.com/asset/?id=88782666"
Mesh.MeshType = "FileMesh"
Mesh.Scale = Vector3.new(4,4,4)
Mesh.TextureId = "http://www.roblox.com/asset/?id=88782631"
local BG = Instance.new("BodyGyro")
BG.Parent = Part
BG.maxTorque = HugeVector
BG.cframe = v.CFrame * CFrame.Angles(math.rad(90),0,0)
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part.Touched:connect(function(Object)
if IsIgnored(Object) then return end
if (not Exploded) then
if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Bomb" then
Exploded = true
local Explosion = Instance.new("Explosion")
Explosion.Position = Part.Position
Explosion.BlastPressure = 5e5
Explosion.BlastRadius = 100
ScanPlayers(Part.Position,100)
CreateShockwave(Part.Position,75)
Explosion.Parent = game.Workspace
Part:Destroy()
end
end
end)
Part.Parent = game.Workspace
Part.CFrame = (v.CFrame * CFrame.Angles(math.rad(90),0,0)) + v.CFrame.lookVector * 3
Part.Velocity = (Part.CFrame.lookVector * (TrueAirSpeed * 0.75))
delay(7,function() Part:Destroy() end)
table.insert(IgnoreTable,Part)
end
end
end
end
end
function DropGuidedBomb(Gun) --This function creates guided bombs for the bombs spawns
if Locked then
local Exploded = false
local Part = Instance.new("Part")
Part.Name = "Bomb"
Part.CanCollide = false
Part.FormFactor = "Symmetric"
Part.Size = Vector3.new(2,2,9)
Part.BottomSurface = "Smooth"
Part.TopSurface = "Smooth"
local Mesh = Instance.new("SpecialMesh")
Mesh.Parent = Part
Mesh.MeshId = "http://www.roblox.com/asset/?id=88782666"
Mesh.MeshType = "FileMesh"
Mesh.Scale = Vector3.new(4,4,4)
Mesh.TextureId = "http://www.roblox.com/asset/?id=88782631"
local OV = Instance.new("ObjectValue")
OV.Parent = Part
OV.Name = "Target"
OV.Value = TargetPlayer.Character
local NV = Instance.new("NumberValue")
NV.Parent = Part
NV.Name = "PlaneSpd"
NV.Value = TrueAirSpeed * 0.9 --This makes the bombs travel speed 9/10 of the plane's speed
local BG = Instance.new("BodyGyro")
BG.Parent = Part
BG.maxTorque = HugeVector
BG.P = 2e3
local BV = Instance.new("BodyVelocity")
BV.Parent = Part
BV.maxForce = Vector3.new(math.huge,6e3,math.huge)
BV.velocity = Vector3.new(0,0,0)
local Script = BombM:clone()
Script.Parent = Part
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part.Touched:connect(function(Object)
if IsIgnored(Object) then return end
if (not Exploded) then
if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Bomb" then
Exploded = true
local Explosion = Instance.new("Explosion")
Explosion.Position = Part.Position
Explosion.BlastPressure = 5e5
Explosion.BlastRadius = 100
ScanPlayers(Part.Position,100)
CreateShockwave(Part.Position,75)
Explosion.Parent = game.Workspace
Part:Destroy()
end
end
end)
Part.Parent = game.Workspace
Part.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 10
Script.Disabled = false
table.insert(IgnoreTable,Part)
end
end
function FireMissile(Gun) --This function creates the non-guided missiles for the missile spawns
if (not Locked) then
local Exploded = false
local Part1 = Instance.new("Part")
Part1.Name = "Missile"
Part1.CanCollide = false
Part1.FormFactor = "Symmetric"
Part1.Size = Vector3.new(1,1,13)
Part1.BottomSurface = "Smooth"
Part1.TopSurface = "Smooth"
local Mesh = Instance.new("SpecialMesh")
Mesh.Parent = Part1
Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534"
Mesh.MeshType = "FileMesh"
Mesh.TextureId = "http://www.roblox.com/asset/?id=2564491"
local Part2 = Instance.new("Part")
Part2.Parent = Part1
Part2.Name = "Visual"
Part2.Transparency = 1
Part2.CanCollide = false
Part2.FormFactor = "Symmetric"
Part2.Size = Vector3.new(1,1,1)
Part2.BottomSurface = "Smooth"
Part2.TopSurface = "Smooth"
local Weld = Instance.new("Weld")
Weld.Parent = Part1
Weld.Part0 = Part1
Weld.Part1 = Part2
Weld.C0 = CFrame.new(0,0,5) * CFrame.Angles(math.rad(90),0,0)
local BV = Instance.new("BodyVelocity")
BV.Parent = Part1
BV.maxForce = HugeVector
local BG = Instance.new("BodyGyro")
BG.Parent = Part
BG.maxTorque = HugeVector
BG.cframe = Gun.CFrame * CFrame.Angles(math.rad(90),0,0)
local Fire = Instance.new("Fire")
Fire.Parent = Part2
Fire.Enabled = false
Fire.Heat = 25
Fire.Size = 30
local Smoke = Instance.new("Smoke")
Smoke.Parent = Part2
Smoke.Color = Color3.new(40/51,40/51,40/51)
Smoke.Enabled = false
Smoke.Opacity = 1
Smoke.RiseVelocity = 25
Smoke.Size = 25
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part1.Touched:connect(function(Object)
if IsIgnored(Object) then return end
if (not Exploded) then
if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Missile" then
Exploded = true
local Explosion = Instance.new("Explosion")
Explosion.Position = Part1.Position
Explosion.BlastPressure = 5e4
Explosion.BlastRadius = 50
ScanPlayers(Part1.Position,50)
CreateShockwave(Part1.Position,50)
Explosion.Parent = game.Workspace
Part1:Destroy()
end
end
end)
Part1.Parent = game.Workspace
Part1.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 15
BV.velocity = Part1.CFrame.lookVector * Engine.Velocity.magnitude
delay(0.4,function()
BV.velocity = (Part1.CFrame.lookVector * 1500) + Vector3.new(0,0.15,0)
Fire.Enabled = true
Smoke.Enabled = true
end)
delay(5,function() Part1:Destroy() end)
table.insert(IgnoreTable,Part1)
end
end
function FireGuidedMissile(Gun) --This function creates the guided missiles for the missile spawns
if Targetable2 then
if Locked then
local Exploded = false
local Part1 = Instance.new("Part")
Part1.Name = "Missile"
Part1.CanCollide = false
Part1.FormFactor = "Symmetric"
Part1.Size = Vector3.new(1,1,13)
Part1.BottomSurface = "Smooth"
Part1.TopSurface = "Smooth"
local Mesh = Instance.new("SpecialMesh")
Mesh.Parent = Part1
Mesh.MeshId = "http://www.roblox.com/asset/?id=2251534"
Mesh.MeshType = "FileMesh"
Mesh.TextureId = "http://www.roblox.com/asset/?id=2564491"
local Part2 = Instance.new("Part")
Part2.Parent = Part1
Part2.Transparency = 1
Part2.Name = "Visual"
Part2.CanCollide = false
Part2.FormFactor = "Symmetric"
Part2.Size = Vector3.new(1,1,1)
Part2.BottomSurface = "Smooth"
Part2.TopSurface = "Smooth"
local Weld = Instance.new("Weld")
Weld.Parent = Part1
Weld.Part0 = Part1
Weld.Part1 = Part2
Weld.C0 = CFrame.new(0,0,5) * CFrame.Angles(math.rad(90),0,0)
local OV = Instance.new("ObjectValue")
OV.Parent = Part1
OV.Name = "Target"
OV.Value = TargetPlayer.Character
local BV = Instance.new("BodyVelocity")
BV.Parent = Part1
BV.maxForce = HugeVector
--[[local BG = Instance.new("BodyGyro")
BG.Parent = Part1
BG.maxTorque = HugeVector
BG.P = 1e6]]
local Script = MissileM:clone()
Script.Parent = Part1
local Fire = Instance.new("Fire")
Fire.Parent = Part2
Fire.Enabled = false
Fire.Heat = 25
Fire.Size = 30
local Smoke = Instance.new("Smoke")
Smoke.Parent = Part2
Smoke.Color = Color3.new(40/51,40/51,40/51)
Smoke.Enabled = false
Smoke.Opacity = 1
Smoke.RiseVelocity = 25
Smoke.Size = 25
local PlaneTag = Instance.new("ObjectValue")
PlaneTag.Parent = Part
PlaneTag.Name = "PlaneTag"
PlaneTag.Value = Plane
Part1.Touched:connect(function(Object)
if IsIgnored(Object) then return end
if (not Exploded) then
if (not Object:IsDescendantOf(Character)) and Object.Name ~= "Missile" then
Exploded = true
local Explosion = Instance.new("Explosion")
Explosion.Position = Part1.Position
Explosion.BlastPressure = 5e4
Explosion.BlastRadius = 50
ScanPlayers(Part1.Position,50)
CreateShockwave(Part1.Position,50)
Explosion.Parent = game.Workspace
Part1:Destroy()
end
end
end)
Part1.Parent = game.Workspace
Part1.CFrame = (Gun.CFrame * CFrame.Angles(math.rad(90),0,0)) + Gun.CFrame.lookVector * 15
--BG.cframe = CFrame.new(Part1.CFrame.p,Part1.CFrame.p + Part1.CFrame.lookVector)
delay(0.4,function()
Script.Disabled = false
Fire.Enabled = true
Smoke.Enabled = true
end)
delay(7,function() Part1:Destroy() end)
table.insert(IgnoreTable,Part1)
end
end
end
function IsIgnored(Obj)
for _,v in pairs(IgnoreTable) do
if v == Obj then
return true
end
end
return false
end
function CreateShockwave(Center,Radius)
coroutine.resume(coroutine.create(function()
local Shockwave = Instance.new("Part")
Shockwave.BrickColor = BrickColor.new("Light stone grey")
Shockwave.Material = Enum.Material.SmoothPlastic
Shockwave.Name = "Shockwave"
Shockwave.Anchored = true
Shockwave.CanCollide = false
Shockwave.FormFactor = Enum.FormFactor.Symmetric
Shockwave.Size = Vector3.new(1,1,1)
Shockwave.BottomSurface = Enum.SurfaceType.Smooth
Shockwave.TopSurface = Enum.SurfaceType.Smooth
local Mesh = Instance.new("SpecialMesh",Shockwave)
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = Vector3.new(0,0,0)
Shockwave.Parent = game.Workspace
Shockwave.CFrame = CFrame.new(Center)
table.insert(IgnoreTable,Shockwave)
for i = 0,1,1/12 do
local WaveScale = 2 * Radius * i
Mesh.Scale = Vector3.new(WaveScale,WaveScale,WaveScale)
Shockwave.Transparency = i
RunService.RenderStepped:wait()
end
Shockwave:Destroy()
end))
end
function ScanPlayers(Pos,Radius) --This is a function that I created that efficiently puts a CreatorTag in the player
coroutine.resume(coroutine.create(function()
for _,v in pairs(game.Players:GetPlayers()) do --This gets all the players
if v.Character and v.Character:findFirstChild("Torso") then
local PTorso = v.Character.Torso
if ((PTorso.Position - Pos).magnitude + 2) <= Radius then --If the distance between the explosion and the player is less than the radius...
local HitHumanoid = v.Character:findFirstChild("Humanoid")
if HitHumanoid then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
delay(0.1,function() CreatorTag:Destroy() end)
end
end
end
end
end))
end
function ReloadRocket(Time) --This function reloads the rockets based on the rocket reload time
if (not RocketEnabled) then
wait(Time)
RocketEnabled = true
end
end
function ReloadFlare(Time) --This function reloads the flares based on the flare reload time
if (not FlareEnabled) then
wait(Time)
FlareEnabled = true
end
end
function ReloadBomb(Time) --This function reloads the bombs based on the bomb reload time
if (not BombEnabled) then
wait(Time)
BombEnabled = true
end
end
function ReloadMissile(Time) --This function reloads the missile based on the missile reload time
if (not MissileEnabled) then
wait(Time)
MissileEnabled = true
end
end
function onMouseMoved(M) --This function is activated when the mouse moves
if Targetable2 then --If the plane can target...
local GUI = GUIClone.Main
if Targeting then
GUI.Mode.Text = "Targeting Mode"
local FoundPlayer = false
local ClosestRatio = 0.1
for _,v in pairs(game.Players:GetPlayers()) do
if v.Character then
if v.Character:findFirstChild("Torso") then
if v ~= Player then
if ((v.TeamColor ~= Player.TeamColor) or v.Neutral) then
local myHead = Character.Head
local TorsoPos = v.Character.Torso.CFrame
local Distance = (myHead.CFrame.p - TorsoPos.p).magnitude
local MDirection = (M.Hit.p - myHead.CFrame.p).unit
local Offset = (((MDirection * Distance) + myHead.CFrame.p) - TorsoPos.p).magnitude
if (not Locked) then
if (Offset / Distance) < ClosestRatio then
ClosestRatio = (Offset / Distance)
FoundPlayer = true
if TargetPlayer ~= v then
TargetPlayer = v
M.Icon = TargetIcon
AimGUI.Enabled = true
LockGUI.Enabled = false
AimGUI.Adornee = TargetPlayer.Character.Torso
LockGUI.Adornee = nil
end
end
if (not FoundPlayer) and TargetPlayer then
TargetPlayer = nil
M.Icon = AimingIcon
AimGUI.Enabled = false
LockGUI.Enabled = false
AimGUI.Adornee = nil
LockGUI.Adornee = nil
end
elseif Locked then
M.Icon = LockedIcon
AimGUI.Enabled = false
LockGUI.Enabled = true
AimGUI.Adornee = nil
LockGUI.Adornee = TargetPlayer.Character.Torso
end
end
end
end
end
end
elseif (not Targeting) then
GUI.Mode.Text = "Flying Mode"
end
end
end
function onButton1Down(M) --This function is activated when you press the left mouse button
if (not Targetable2) then return end
if (not Targeting) then return end
if (not EngineOn) then return end
if (not TargetPlayer) then return end
if (not Locked) then
M.Icon = LockedIcon
Locked = true
AimGUI.Enabled = false
LockGUI.Enabled = true
AimGUI.Adornee = nil
LockGUI.Adornee = TargetPlayer.Character.Torso
local Connection = nil
Connection = TargetPlayer.Character.Humanoid.Died:connect(function()
Locked = false
TargetPlayer = nil
M.Icon = AimingIcon
AimGUI.Enabled = false
LockGUI.Enabled = false
AimGUI.Adornee = nil
LockGUI.Adornee = nil
Connection:disconnect()
end)
Spawn(function()
local CurrentTargetPlayer = TargetPlayer
while true do
if CurrentTargetPlayer ~= TargetPlayer then
Connection:disconnect()
break
end
wait()
end
end)
end
end
function IncreaseSpd() --This function increases the speed
if EngineOn then
if Selected then
while Accelerating do
Throttle = (Throttle < 1 and Throttle + 0.01 or 1)
DesiredSpeed = MaxSpeed2 * Throttle
wait(ThrottleInc2)
end
end
end
end
function DecreaseSpd() --This function decreases the speed
if EngineOn then
if Selected then
while Decelerating do
Throttle = (Throttle > 0 and Throttle - 0.01 or 0)
DesiredSpeed = MaxSpeed2 * Throttle
wait(ThrottleInc2)
end
end
end
end
function RoundNumber(Num) --This function rounds a number to the nearest whole number
return ((Num - math.floor(Num)) >= 0.5 and math.ceil(Num) or math.floor(Num))
end
function GetGear(Parent) --This function gets all the parts in the Gear folder
for _,v in pairs(Parent:GetChildren()) do
if (v:IsA("BasePart")) then
if (not v:findFirstChild("GearProp")) then
local GearProp = Instance.new("StringValue")
GearProp.Name = "GearProp"
GearProp.Value = v.Transparency..","..tostring(v.CanCollide)
GearProp.Parent = v
end
table.insert(LandingGear,v) --This inserts a table with the gear's properties into the LandingGear table
end
GetGear(v)
end
end
function ChangeGear() --This function extends or retracts the gear
for _,v in pairs(LandingGear) do
local GearProp = v.GearProp
local Comma = GearProp.Value:find(",",1,true)
local TransVal = tonumber(GearProp.Value:sub(1,Comma - 1))
local CollideVal = GearProp.Value:sub(Comma + 1)
v.Transparency = (TransVal ~= 1 and (GearUp and TransVal or 1))
v.CanCollide = (CollideVal and (GearUp and CollideVal or false))
end
end
function SetUpGUI() --This function sets up the PlaneGUI
local GUI = GUIClone.Main
GUI.Title.Text = PlaneName2
local TargetStats = GUI.Parent.Target
local HUD = GUI.Parent.HUD
local ControlsA1,ControlsB1 = GUI.ControlsA,GUI.ControlsB
local FrameA1,FrameB1 = GUI.FrameA,GUI.FrameB
local C1A1,C1B1 = FrameA1.C1.Key,FrameB1.C1.Key
local C2A1,C2B1 = FrameA1.C2.Key,FrameB1.C2.Key
local C3A1,C3B1 = FrameA1.C3.Key,FrameB1.C3.Key
local C4A1,C4B1 = FrameA1.C4.Key,FrameB1.C4.Key
local C5A1,C5B1 = FrameA1.C5.Key,FrameB1.C5.Key
local C6A1,C7A1 = FrameA1.C6.Key,FrameA1.C7.Key
local ControlsA2,ControlsB2 = HUD.ControlsA,HUD.ControlsB
local FrameA2,FrameB2 = HUD.FrameA,HUD.FrameB
local C1A2,C1B2 = FrameA2.C1.Key,FrameB2.C1.Key
local C2A2,C2B2 = FrameA2.C2.Key,FrameB2.C2.Key
local C3A2,C3B2 = FrameA2.C3.Key,FrameB2.C3.Key
local C4A2,C4B2 = FrameA2.C4.Key,FrameB2.C4.Key
local C5A2,C5B2 = FrameA2.C5.Key,FrameB2.C5.Key
local C6A2,C7A2 = FrameA2.C6.Key,FrameA2.C7.Key
local GearText = GUI.Gear
for _,v in pairs(LandingGear) do --This section determines whether the gear are up or down
if v.Transparency == 1 then
GearUp = true
else
GearUp = false
break
end
end
local MaxSpeedScaled = math.ceil(MaxSpeed2/50)
for i = 1,(MaxSpeedScaled + 10) do --This creates a loop that clones the SpeedGUI and positions it accordingly
local SpeedGUI = HUD.Speed.Main
local Speed0 = SpeedGUI["Speed-0"]
local SpeedClone = Speed0:clone()
SpeedClone.Position = UDim2.new(0,0,1,-(80 + (75 * i)))
SpeedClone.Name = ("Speed-%i"):format(50 * i)
SpeedClone.Text.Text = tostring(50 * i)
SpeedClone.Parent = SpeedGUI
end
local MaxAltScaled = math.ceil(MaxAltitude2/500)
for i = 1,(MaxAltScaled + 10) do --This creates a loop that clones the AltitudeGUI and positions it accordingly
local AltGUI = HUD.Altitude.Main
local Altitude0 = AltGUI["Altitude-0"]
local AltClone = Altitude0:clone()
AltClone.Position = UDim2.new(0,0,1,-(80 + (75 * i)))
AltClone.Name = ("Altitude-%s"):format(tostring(0.5 * i))
AltClone.Text.Text = tostring(0.5 * i)
AltClone.Parent = AltGUI
end
GearText.Text = (GearUp and "Gear Up" or "Gear Down")
TargetStats.Visible = Targetable2
-------------------------------------------------------------------------------------
C1A1.Text = "Key: "..FlightControls.Engine.Value:upper()
if FlightControls.SpeedUp.Value == "ArrowKeyUp" then
C2A1.Text = "Key: ArrowKeyUp"
elseif FlightControls.SpeedUp.Value == "ArrowKeyDown" then
C2A1.Text = "Key: ArrowKeyDown"
else
C2A1.Text = "Key: "..FlightControls.SpeedUp.Value:upper()
end
if FlightControls.SlowDown.Value == "ArrowKeyUp" then
C3A1.Text = "Key: ArrowKeyUp"
elseif FlightControls.SlowDown.Value == "ArrowKeyDown" then
C3A1.Text = "Key: ArrowKeyDown"
else
C3A1.Text = "Key: "..FlightControls.SlowDown.Value:upper()
end
C4A1.Text = "Key: "..FlightControls.Gear.Value:upper()
C5A1.Text = "Key: "..TargetControls.Modes.Value:upper()
C5A1.Parent.Visible = Targetable2
C6A1.Text = "Key: "..FlightControls.Eject.Value:upper()
C6A1.Parent.Visible = Ejectable.Value
C7A1.Text = "Key: "..FlightControls.ToggleHUD.Value:upper()
C7A1.Parent.Visible = CamLock.Value
C1B1.Text = "Key: "..WeaponControls.FireMissile.Value:upper()
C1B1.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Missiles.Value)
C2B1.Text = "Key: "..WeaponControls.FireRockets.Value:upper()
C2B1.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Rockets.Value)
C3B1.Text = "Key: "..WeaponControls.FireGuns.Value:upper()
C3B1.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Guns.Value)
C4B1.Text = "Key: "..WeaponControls.DropBombs.Value:upper()
C4B1.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Bombs.Value)
C5B1.Text = "Key: "..WeaponControls.DeployFlares.Value:upper()
C5B1.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Flares.Value)
FrameB1.Title.Text = (WeaponsValue.Value and "WeaponControls" or "No Weapons")
FrameB1.Title.Line.Visible = WeaponsValue.Value
ControlsA1.MouseButton1Click:connect(function() --This function allows the Flight Controls frame to be opened or closed without an external script
if GUIA1Visible then
GUIA1Visible = false
FrameA1:TweenPosition(UDim2.new(0,150,0,-190),"In","Quad",1,true)
elseif (not GUIA1Visible) then
GUIA1Visible = true
FrameA1:TweenPosition(UDim2.new(0,150,0,170),"Out","Quad",1,true)
end
end)
ControlsB1.MouseButton1Click:connect(function()
if GUIB1Visible then
GUIB1Visible = false
FrameB1:TweenPosition(UDim2.new(0,-150,0,-150),"In","Quad",1,true)
elseif (not GUIB1Visible) then
GUIB1Visible = true
FrameB1:TweenPosition(UDim2.new(0,-150,0,170),"Out","Quad",1,true)
end
end)
-------------------------------------------------------------------------------------
C1A2.Text = "Key: "..FlightControls.Engine.Value:upper()
if FlightControls.SpeedUp.Value == "ArrowKeyUp" then
C2A2.Text = "Key: ArrowKeyUp"
elseif FlightControls.SpeedUp.Value == "ArrowKeyDown" then
C2A2.Text = "Key: ArrowKeyDown"
else
C2A2.Text = "Key: "..FlightControls.SpeedUp.Value:upper()
end
if FlightControls.SlowDown.Value == "ArrowKeyUp" then
C3A2.Text = "Key: ArrowKeyUp"
elseif FlightControls.SlowDown.Value == "ArrowKeyDown" then
C3A2.Text = "Key: ArrowKeyDown"
else
C3A2.Text = "Key: "..FlightControls.SlowDown.Value:upper()
end
C4A2.Text = "Key: "..FlightControls.Gear.Value:upper()
C5A2.Text = "Key: "..TargetControls.Modes.Value:upper()
C5A2.Parent.Visible = Targetable2
C6A2.Text = "Key: "..FlightControls.Eject.Value:upper()
C6A2.Parent.Visible = Ejectable.Value
C7A2.Text = "Key: "..FlightControls.ToggleHUD.Value:upper()
C7A2.Parent.Visible = CamLock.Value
C1B2.Text = "Key: "..WeaponControls.FireMissile.Value:upper()
C1B2.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Missiles.Value)
C2B2.Text = "Key: "..WeaponControls.FireRockets.Value:upper()
C2B2.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Rockets.Value)
C3B2.Text = "Key: "..WeaponControls.FireGuns.Value:upper()
C3B2.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Guns.Value)
C4B2.Text = "Key: "..WeaponControls.DropBombs.Value:upper()
C4B2.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Bombs.Value)
C5B2.Text = "Key: "..WeaponControls.DeployFlares.Value:upper()
C5B2.Parent.Visible = (WeaponsValue.Value and WeaponsValue.Flares.Value)
FrameB2.Title.Text = (WeaponsValue.Value and "WeaponControls" or "No Weapons")
FrameB2.Title.Line.Visible = WeaponsValue.Value
ControlsA2.MouseButton1Click:connect(function() --This function allows the Flight Controls frame to be opened or closed without an external script
if GUIA2Visible then
GUIA2Visible = false
FrameA2:TweenPosition(UDim2.new(0.5,20,0,-170),"In","Quad",1,true)
elseif (not GUIA2Visible) then
GUIA2Visible = true
FrameA2:TweenPosition(UDim2.new(0.5,20,0,100),"Out","Quad",1,true)
end
end)
ControlsB2.MouseButton1Click:connect(function()
if GUIB2Visible then
GUIB2Visible = false
FrameB2:TweenPosition(UDim2.new(0.5,-320,0,-170),"In","Quad",1,true)
elseif (not GUIB2Visible) then
GUIB2Visible = true
FrameB2:TweenPosition(UDim2.new(0.5,-320,0,100),"Out","Quad",1,true)
end
end)
end
function GetRoll(CF) --This function gets the rotation of the Engine. Credit to DevAdrian for this
local CFRight = CF * CFrame.Angles(0,math.rad(90),0)
local CFNoRollRight = CFrame.new(CF.p,CF.p + CF.lookVector) * CFrame.Angles(0,math.rad(90),0)
local CFDiff = CFRight:toObjectSpace(CFNoRollRight)
return (-math.atan2(CFDiff.lookVector.Y, CFDiff.lookVector.Z) % (math.pi * 2) + math.pi)
end
function GetPitch(CF) --This function gets the pitch of the Engine. Credit to DevAdrian for this
local LV = CF.lookVector
local XZDist = math.sqrt(LV.x ^ 2 + LV.z ^ 2)
return math.atan(LV.y / XZDist)
end
function UpdateCamera() --This function uses the RunService to update the camera. It happens very fast so it is smooth
if (not LockedCam) then
Camera.CameraType = CameraType2
elseif LockedCam then
local HeadCF = Character.Head.CFrame
local PlaneSize = Plane:GetModelSize().magnitude/3
local Origin = HeadCF.p + (HeadCF.lookVector * (PlaneSize - 1))
local Target = HeadCF.p + (HeadCF.lookVector * PlaneSize)
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CoordinateFrame = CFrame.new(Origin,Target)
Camera:SetRoll(2 * math.pi - GetRoll(Character.Head.CFrame))
end
end
function UpdateTargetStats() --This function updates the stats about the Target
local GUI = GUIClone.Target
if TargetPlayer
and TargetPlayer.Character
and TargetPlayer.Character:FindFirstChild("Torso") then
local myHead = Character.Head
local TorsoPos = TargetPlayer.Character.Torso.CFrame
local Distance = (myHead.CFrame.p - TorsoPos.p).magnitude
local TargetSpeed = (TargetPlayer.Character.Torso.Velocity).magnitude
local TargetAlt = TargetPlayer.Character.Torso.Position.Y
GUI.LockName.Text = ("Target: %s"):format(TargetPlayer.Name)
GUI.Dist.Text = ("Distance: %s"):format(tostring(math.floor(Distance * 10)/10))
GUI.Speed.Text = ("Speed: %s"):format(tostring(math.floor(TargetSpeed * 10)/10))
GUI.Altitude.Text = ("Altitude: %s"):format(tostring(math.floor(TargetAlt * 10)/10))
else
GUI.LockName.Text = "Target: None"
GUI.Dist.Text = "Distance: N/A"
GUI.Speed.Text = "Speed: N/A"
GUI.Altitude.Text = "Altitude: N/A"
end
end
function UpdateHUD(GUI) --This function updates the HUD whenever the camera is locked
GUI.Roll.Rotation = math.deg(GetRoll(Character.Head.CFrame))
local PitchNum = math.deg(GetPitch(Character.Head.CFrame))/90
GUI.Roll.Pitch.Position = UDim2.new(0,-200,0,-500 + (PitchNum * 450))
local SpeedScaled = TrueAirSpeed/50
GUI.Speed.Main.Position = UDim2.new(0,0,0.5,SpeedScaled * 75)
GUI.Speed.Disp.Text.Text = RoundNumber(TrueAirSpeed)
local AltScaled = RoundNumber(Engine.Position.Y)/500
GUI.Altitude.Main.Position = UDim2.new(0,0,0.5,AltScaled * 75)
GUI.Altitude.Disp.Text.Text = RoundNumber(Engine.Position.Y)
local NegFactor = (Engine.Velocity.y/math.abs(Engine.Velocity.y))
local VerticalSpeed = RoundNumber(math.abs(Engine.Velocity.y))
GUI.ClimbRate.Text = ("VSI: %i"):format(VerticalSpeed * NegFactor)
GUI.GearStatus.Text = (GearUp and "Gear Up" or "Gear Down")
GUI.GearStatus.TextColor3 = (GearUp and Color3.new(0,1,0) or Color3.new(1,0,0))
GUI.EngineStatus.Text = (EngineOn and "Engine On" or "Engine Off")
GUI.EngineStatus.TextColor3 = (EngineOn and Color3.new(0,1,0) or Color3.new(1,0,0))
GUI.StallWarn.Visible = ((not Taxi()) and Stall())
GUI.PullUp.Visible = (EngineOn and (not Taxi()) and (AltRestrict.Value) and (Engine.Position.Y < (MinAltitude2 + 20)))
GUI.TaxiStatus.Visible = (Engine and Taxi())
GUI.Throttle.Bar.Tray.Position = UDim2.new(0,0,1,-(Throttle * 460))
GUI.Throttle.Bar.Tray.Size = UDim2.new(1,0,0,(Throttle * 460))
GUI.Throttle.Disp.Text = math.abs(math.floor(Throttle * 100)).."%"
local StallLinePos = (StallSpeed2/math.floor(TrueAirSpeed + 0.5)) * (StallSpeed2/MaxSpeed2)
local StallLinePosFix = (StallLinePos > 1 and 1 or StallLinePos < 0 and 0 or StallLinePos)
GUI.Throttle.Bar.StallLine.Position = UDim2.new(0,0,1 - StallLinePosFix,0)
GUI.Throttle.Bar.Tray.BackgroundColor3 = (Throttle <= StallLinePosFix and Color3.new(1,0,0) or Color3.new(0,1,0))
end
function UpdateGUI(Taxiing,Stalling) --This function updates the GUI.
local GUI = GUIClone.Main
local HUD = GUIClone.HUD
GUI.Visible = (not LockedCam)
HUD.Visible = LockedCam
if Targetable2 then UpdateTargetStats() end
if LockedCam then UpdateHUD(HUD) end
GUI.PullUp.Visible = (EngineOn and (not Taxiing) and (AltRestrict.Value) and (Engine.Position.Y < (MinAltitude2 + 20)))
GUI.Taxi.Visible = (EngineOn and Taxiing)
GUI.Stall.Visible = ((not Taxiing) and Stalling)
GUI.Altitude.Text = "Altitude: "..RoundNumber(Engine.Position.Y)
GUI.Speed.Text = "Speed: "..RoundNumber(TrueAirSpeed)
GUI.Throttle.Bar.Tray.Size = UDim2.new(Throttle,0,1,0)
GUI.Throttle.Percent.Text = math.abs(math.floor(Throttle * 100)).."%"
local StallLinePos = (StallSpeed2/math.floor(TrueAirSpeed + 0.5)) * (StallSpeed2/MaxSpeed2)
local StallLinePosFix = (StallLinePos > 1 and 1 or StallLinePos < 0 and 0 or StallLinePos)
GUI.Throttle.Bar.StallLine.Position = UDim2.new(StallLinePosFix,0,0,0)
GUI.Throttle.Bar.Tray.BackgroundColor3 = (Throttle <= StallLinePosFix and Color3.new(1,0,0) or Color3.new(0,2/3,0))
end
function CalculateSpeed() --This function calculates the current speed
while Selected do
if EngineOn then
CurrentSpeed = (CurrentSpeed < DesiredSpeed and CurrentSpeed + 1 or CurrentSpeed - 1) --A simple ternary operation that calculates the currentspeed
CurrentSpeed = (CurrentSpeed < 0 and 0 or CurrentSpeed > MaxSpeed2 and MaxSpeed2 or CurrentSpeed) --This fixes the currentspeed
end
wait(0.2 - (Acceleration2/5e3))
end
end
function GetLowestPoint() --This function gets the lowest point of the plane (Credit to Crazyman32 for this)
if (#LandingGear == 0) then
LowestPoint = (Engine.Position.Y + 5 + (Engine.Size.Y/2))
return
end
for _,v in pairs(LandingGear) do
local Set0 = (Engine.Position.Y - (v.CFrame * CFrame.new((v.Size.X/2),0,0)).Y)
local Set1 = (Engine.Position.Y - (v.CFrame * CFrame.new(-(v.Size.X/2),0,0)).Y)
local Set2 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,(v.Size.Y/2),0)).Y)
local Set3 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,-(v.Size.Y/2),0)).Y)
local Set4 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,0,(v.Size.Z/2))).Y)
local Set5 = (Engine.Position.Y - (v.CFrame * CFrame.new(0,0,-(v.Size.Z/2))).Y)
local Max = (math.max(Set0,Set1,Set2,Set3,Set4,Set5) + 5)
LowestPoint = (Max > LowestPoint and Max or LowestPoint)
end
end
function GetBankAngle(M) --This function calculates the Bank Angle (Credit to Crazyman32 for this)
local VSX,X = M.ViewSizeX,M.X
local Ratio = (((VSX / 2) - X)/(VSX / 2))
Ratio = (Ratio < -1 and -1 or Ratio > 1 and 1 or Ratio)
return math.rad(Ratio * MaxBank2)
end
function Taxi() --This function determines whether the plane is taxiing or not
local Ray = Ray.new(Engine.Position,Vector3.new(0,-LowestPoint,0))
return (TrueAirSpeed <= StallSpeed2 and game.Workspace:FindPartOnRay(Ray,Plane))
end
function Stall() --This function determines whether the plane is stalling or not
return ((AltRestrict.Value and Engine.Position.Y > MaxAltitude2) or TrueAirSpeed < StallSpeed2)
end
function FlyMain(M) --This is the main flying function
if Selected then
local BankAngle = GetBankAngle(M) --This uses the "GetBankAngle" function to calculate the Bank Angle
local Taxi,Stall = Taxi(),Stall()
if EngineOn then
Engine.Thrust.velocity = (Engine.CFrame.lookVector * CurrentSpeed) + Vector3.new(0,0.15,0)
if Taxi then
if (CurrentSpeed < 2) then
Thrust.maxForce = Vector3.new(0,0,0)
Direction.maxTorque = Vector3.new(0,0,0)
else
local VSX,X = M.ViewSizeX,M.X
local RatioX = math.rad(((VSX / 2) - X) / (VSX / 2))
local YawSpeed = 15 * RatioX * (TrueAirSpeed / 100)
Thrust.maxForce = Vector3.new(math.huge,0,math.huge)
Direction.maxTorque = Vector3.new(0,math.huge,0)
Direction.cframe = Engine.CFrame * CFrame.Angles(0,YawSpeed,0)
end
else
Thrust.maxForce = ((not Stall) and HugeVector or Vector3.new(0,0,0))
Direction.maxTorque = HugeVector
if SimulationMode.Value then
local Rotation = 2 * math.pi - GetRoll(Engine.CFrame)
local YawRotation = math.rad(math.sin(Rotation * 2))
local YawSpeed = (math.abs(Rotation) > math.pi / 2 and YawRotation / 2 or YawRotation)
local SpeedScale = math.min((TrueAirSpeed / (MaxSpeed2 / 4)),1)
local PitchSpeed = SimulationMode.PitchSpeed.Value * SpeedScale
local RollSpeed = SimulationMode.RollSpeed.Value * SpeedScale
local VSX,X = M.ViewSizeX,M.X
local VSY,Y = M.ViewSizeY,M.Y
local RatioX = math.rad(((VSX / 2) - X) / (VSX / 2))
local RatioY = math.rad(((VSY / 2) - Y) / (VSY / 2))
Direction.cframe = Engine.CFrame * CFrame.Angles(RatioY * PitchSpeed,-YawSpeed,RatioX * RollSpeed)
else
Direction.cframe = (M.Hit * CFrame.Angles(0,0,BankAngle))
end
end
if ((AltRestrict.Value) and (Engine.Position.Y < MinAltitude2)) then --If there are altitude restrictions and you are below it...
AutoCrash.Value = true
end
elseif (not EngineOn) then
Thrust.maxForce = Vector3.new(0,0,0)
Thrust.velocity = Vector3.new(0,0,0)
Direction.maxTorque = Vector3.new(0,0,0)
end
TrueAirSpeed = Engine.Velocity.magnitude
UpdateGUI(Taxi,Stall) --This activates the "UpdateGUI" function
end
end
function onKeyDown(Key) --This function is activated whenever a key is pressed
local Key = Key:lower()
if (Key == FlightControls.Engine.Value:lower()) then --If you press the engine key...
local GUI = GUIClone.Main
if (not EngineOn) then
EngineOn = true
DesiredSpeed = 0
CurrentSpeed = 0
Throttle = 0
GUI.Engine.Visible = false
CalculateSpeed()
elseif EngineOn then
EngineOn = false
DesiredSpeed = 0
CurrentSpeed = 0
Throttle = 0
GUI.Engine.Visible = true
end
end
if (Key == FlightControls.Gear.Value:lower()) then --If you press the change gear key...
local GUI = GUIClone.Main
local Taxiing = Taxi()
if (#LandingGear ~= 0) then
if (not Taxiing) then
ChangeGear()
if (not GearUp) then
GearUp = true
GUI.Gear.Text = "Gear Up"
elseif GearUp then
GearUp = false
GUI.Gear.Text = "Gear Down"
end
end
end
end
if SUAK and Key:byte() == SpeedUp2 or (not SUAK) and (Key == SpeedUp2) then --If you press the speed up key...
Accelerating = true
IncreaseSpd()
end
if SDAK and Key:byte() == SlowDown2 or (not SDAK) and (Key == SlowDown2) then --If you press the slow down key...
Decelerating = true
DecreaseSpd()
end
if (Key == TargetControls.Modes.Value:lower()) then --If you press the change modes key...
if Targetable2 then
if EngineOn then
if (not Targeting) then
M2.Icon = AimingIcon
Targeting = true
elseif Targeting then
M2.Icon = NormalIcon
Targeting = false
Locked = false
AimGUI.Enabled = false
LockGUI.Enabled = false
TargetPlayer = nil
end
end
end
end
if (Key == FlightControls.Eject.Value:lower()) then
if EngineOn then
local Taxiing = Taxi()
if (not Taxiing) then
if Ejectable.Value then
if (not Plane.Ejected.Value) then
Plane.Ejected.Value = true
local Seat = MainParts.Seat
local EjectClone = Tool.Ejector:clone()
EjectClone.Parent = Player.PlayerGui
EjectClone.Disabled = false
local Fire = Instance.new("Fire")
Fire.Parent = Engine
Fire.Heat = 25
Fire.Size = 30
local Smoke = Instance.new("Smoke")
Smoke.Parent = Engine
Smoke.Color = Color3.new(1/3,1/3,1/3)
Smoke.Opacity = 0.7
Smoke.RiseVelocity = 10
Smoke.Size = 10
onDeselectForced()
Seat.SeatWeld:Destroy()
end
end
end
end
end
if (Key == FlightControls.ToggleHUD.Value:lower()) then
LockedCam = (not LockedCam)
end
if (Key == WeaponControls.FireGuns.Value:lower()) then --If you press the fire guns key...
if (not WeaponsValue.Value) then return end --If there aren't weapons...
if (not WeaponsValue.Guns.Value) then return end --If there aren't guns...
if (not EngineOn) then return end
local Taxiing = Taxi()
if (not Taxiing) then --This prevents you from firing the gun while your on the ground
FiringGun = true
FireMachineGun(Weapons) --This activates the "FireMachineGun" function
end
end
if (Key == WeaponControls.FireRockets.Value:lower()) then --If you press the fire rockets key...
if (not WeaponsValue.Value) then return end
if (not WeaponsValue.Rockets.Value) then return end
if (not EngineOn) then return end
local Taxiing = Taxi()
if (not Taxiing) then
if RocketEnabled then
RocketEnabled = false
FireRockets(Weapons)
ReloadRocket(RocketTime2)
end
end
end
if (Key == WeaponControls.DeployFlares.Value:lower()) then --If you press the deploy flares key...
if (not WeaponsValue.Value) then return end
if (not WeaponsValue.Flares.Value) then return end
if (not EngineOn) then return end
local Taxiing = Taxi()
if (not Taxiing) then
if FlareEnabled then --This makes the plane deploy flares 5 times every 0.2 seconds before you have to reload
FlareEnabled = false
for i = 1,math.random(4,6) do
DeployFlares(Weapons)
wait(0.2)
end
ReloadFlare(FlareTime2)
end
end
end
if (Key == WeaponControls.DropBombs.Value:lower()) then --If you press the drop bombs key...
if (not WeaponsValue.Value) then return end
if (not WeaponsValue.Bombs.Value) then return end
if (not EngineOn) then return end
local Taxiing = Taxi()
if (not Taxiing) then
if BombEnabled then
BombEnabled = false
local BombSpawns = {}
for _,v in pairs(Weapons:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "BombSpawn" then
table.insert(BombSpawns,v)
end
end
end
local CurrentSpawn = BombSpawns[math.random(1,#BombSpawns)] --This line selects a random bomb spawn
if Locked then
DropGuidedBomb(CurrentSpawn)
ReloadBomb((BombTime2 * 2))
elseif (not Locked) then
for i = 1,5 do
DropBomb(Weapons)
wait(0.3)
end
ReloadBomb(BombTime2)
end
end
end
end
if (Key == WeaponControls.FireMissile.Value:lower()) then --If you press the fire missile key...
if (not WeaponsValue.Value) then return end
if (not WeaponsValue.Missiles.Value) then return end
if (not EngineOn) then return end
local Taxiing = Taxi()
if (not Taxiing) then
if MissileEnabled then
MissileEnabled = false
local MissileSpawns = {}
for _,v in pairs(Weapons:GetChildren()) do
if v:IsA("BasePart") then
if v.Name == "MissileSpawn" then
table.insert(MissileSpawns,v)
end
end
end
local CurrentSpawn = MissileSpawns[math.random(1,#MissileSpawns)] --This line selects a random missile spawn
if Locked then
FireGuidedMissile(CurrentSpawn)
ReloadMissile((MissileTime2 * 2))
elseif (not Locked) then
FireMissile(CurrentSpawn)
ReloadMissile(MissileTime2)
end
end
end
end
if (Key == TargetControls.UnTarget.Value:lower()) then --If you press the untarget key...
if Targetable2 then
if Locked then
Locked = false
end
end
end
end
function onKeyUp(Key) --This function is activated when you let go of a key
local Key = Key:lower()
if SUAK and Key:byte() == SpeedUp2 or (not SUAK) and (Key == SpeedUp2) then --If you let go of the speed up key...
Accelerating = false
end
if SDAK and Key:byte() == SlowDown2 or (not SDAK) and (Key == SlowDown2) then --If you let go of the slow down key...
Decelerating = false
end
if (Key == WeaponControls.FireGuns.Value) then --If you let go of the fire guns key...
FiringGun = false
end
end
function onSelected(M) --This function is activated when you select the Plane tool
Selected = true
M2 = M
FixVars() --This activates the "FixVars" function
GetGear(Gear) --This activates the "GetGear" function
GetLowestPoint() --This activates the "GetLowestPoint" function
ToolSelect.Value = true
GUIClone = GUI:clone() --This line and the next one clones the plane GUI and puts it into the player
GUIClone.Parent = Player.PlayerGui
SetUpGUI() --This activates the "SetUpGui" function
Camera.CameraType = CameraType2 --This makes your cameratype the customize cameratype
if Targetable2 then --If the plane can target, then it will create the objects required for targeting
AimGUI = Instance.new("BillboardGui",Player.PlayerGui)
AimGUI.AlwaysOnTop = true
AimGUI.Enabled = false
AimGUI.Size = UDim2.new(5,50,5,50)
local Label = Instance.new("ImageLabel",AimGUI)
Label.BackgroundTransparency = 1
Label.Image = "http://www.roblox.com/asset/?id=107388694"
Label.Size = UDim2.new(1,0,1,0)
---------------------------------------------------------------
LockGUI = Instance.new("BillboardGui",Player.PlayerGui)
LockGUI.AlwaysOnTop = true
LockGUI.Enabled = false
LockGUI.Size = UDim2.new(5,50,5,50)
local Label = Instance.new("ImageLabel",LockGUI)
Label.BackgroundTransparency = 1
Label.Image = "http://www.roblox.com/asset/?id=107388656"
Label.Size = UDim2.new(1,0,1,0)
end
M.Icon = NormalIcon
FTab[1] = M.Button1Down:connect(function() onButton1Down(M) end)
FTab[2] = M.KeyDown:connect(onKeyDown)
FTab[3] = M.KeyUp:connect(onKeyUp)
FTab[4] = RunService.RenderStepped:connect(function() onMouseMoved(M) end)
FTab[5] = RunService.RenderStepped:connect(function() FlyMain(M) end)
FTab[6] = RunService.RenderStepped:connect(UpdateCamera)
end
function onDeselected(M) --This function is activated when you deselect the Plane tool
if Selected then
Selected = false
LockedCam = false
for _,v in pairs(FTab) do --This disconnects all the connections. It prevents bugs
if v then
v:disconnect()
v = nil
end
end
Camera.CameraType = Enum.CameraType.Custom --This makes the CameraType "Custom"
Camera.CameraSubject = Character.Humanoid
if Targetable2 then --If the plane can target, then the objects required for targeting will be removed
AimGUI:remove()
LockGUI:remove()
end
if (not Taxi()) and EngineOn then --If you're not Taxiing and your engine is on...
if (not Deselect0.Value) and (not Plane.Ejected.Value) then --If you deselected the tool and didn't eject...
onDeselectForced()
end
end
CurrentSpeed = 0 --These couple of lines reset the plane
DesiredSpeed = 0
TrueAirSpeed = 0
EngineOn = false
Updating = false
Locked = false
Targeting = false
TargetPlayer = nil
ToolSelect.Value = false
GUIAVisible = true
GUIBVisible = true
GUIClone:remove()
if Engine:FindFirstChild("Thrust") then
Engine.Thrust.velocity = Vector3.new(0,0,0)
Engine.Thrust.maxForce = Vector3.new(0,0,0)
end
if Engine:FindFirstChild("Direction") then
Engine.Direction.maxTorque = Vector3.new(0,0,0)
end
end
end
function onDeselectFlying() --This function blows up the plane
if (not Deselect0.Value) then
onDeselected()
Plane:BreakJoints()
local Explosion = Instance.new("Explosion")
Explosion.Parent = game.Workspace
Explosion.Position = Engine.Position
Explosion.BlastRadius = Plane:GetModelSize().magnitude
Explosion.BlastPressure = 2e4
Character.Humanoid.Health = 0
Engine.Thrust:remove()
Engine.Direction:remove()
delay(5,function()
Plane:Destroy()
end)
end
end
function onDeselectForced() --This function is activated when you get out of the plane without deselecting the tool first
if Selected then
for _,v in pairs(IgnoreTable) do
if v then
v:Destroy()
end
end
onDeselected()
M2.Icon = "rbxasset://textures\\ArrowCursor.png" --This makes the mouse icon the normal icon
end
end
script.Parent.Selected:connect(onSelected) --The next 3 lines activate the given functions
script.Parent.Deselected:connect(onDeselected)
Deselect0.Changed:connect(onDeselectForced)
Crashed.Changed:connect(onDeselectForced)
|
-----------------------------------------------------------------
|
local wait_period = 30 -- период обновления
local tmp, DonateStore
local sg = script.Parent --Surface GUI
local sample = script:WaitForChild("Sample") --Our Sample frame
local sf = sg:WaitForChild("ScrollingFrame") --The scrolling frame
local ui = sf:WaitForChild("UI") --The UI list layout
|
-- transforms Roblox types into intermediate types, converting
-- between spaces as necessary to preserve perceptual linearity
|
local typeMetadata = {
boolean = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value and 1 or 0}
end,
fromIntermediate = function(value)
return value[1] >= 0.5
end,
},
number = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value}
end,
fromIntermediate = function(value)
return value[1]
end,
},
NumberRange = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.Min, value.Max}
end,
fromIntermediate = function(value)
return NumberRange.new(value[1], value[2])
end,
},
UDim = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.Scale, value.Offset}
end,
fromIntermediate = function(value)
return UDim.new(value[1], round(value[2]))
end,
},
UDim2 = {
springType = LinearSpring.new,
toIntermediate = function(value)
local x = value.X
local y = value.Y
return {x.Scale, x.Offset, y.Scale, y.Offset}
end,
fromIntermediate = function(value)
return UDim2.new(value[1], round(value[2]), value[3], round(value[4]))
end,
},
Vector2 = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.X, value.Y}
end,
fromIntermediate = function(value)
return Vector2.new(value[1], value[2])
end,
},
Vector3 = {
springType = LinearSpring.new,
toIntermediate = function(value)
return {value.X, value.Y, value.Z}
end,
fromIntermediate = function(value)
return Vector3.new(value[1], value[2], value[3])
end,
},
Color3 = {
springType = LinearSpring.new,
toIntermediate = rgbToLuv,
fromIntermediate = luvToRgb,
},
-- Only takes start and end keypoints
ColorSequence = {
springType = LinearSpring.new,
toIntermediate = function(value)
local keypoints = value.Keypoints
local luv0 = rgbToLuv(keypoints[1].Value)
local luv1 = rgbToLuv(keypoints[#keypoints].Value)
return {
luv0[1], luv0[2], luv0[3],
luv1[1], luv1[2], luv1[3],
}
end,
fromIntermediate = function(value)
return ColorSequence.new(
luvToRgb{value[1], value[2], value[3]},
luvToRgb{value[4], value[5], value[6]}
)
end,
},
}
local springStates = {} -- {[instance] = {[property] = spring}
RunService.Heartbeat:Connect(function(dt)
for instance, state in springStates do
for propName, spring in state do
if spring:canSleep() then
state[propName] = nil
instance[propName] = spring.rawTarget
else
instance[propName] = spring:step(dt)
end
end
if not next(state) then
springStates[instance] = nil
end
end
end)
local function assertType(argNum, fnName, expectedType, value)
if not expectedType:find(typeof(value)) then
error(
("bad argument #%d to %s (%s expected, got %s)"):format(
argNum,
fnName,
expectedType,
typeof(value)
),
3
)
end
end
local spr = {}
function spr.target(instance, dampingRatio, frequency, properties)
if STRICT_TYPES then
assertType(1, "spr.target", "Instance", instance)
assertType(2, "spr.target", "number", dampingRatio)
assertType(3, "spr.target", "number", frequency)
assertType(4, "spr.target", "table", properties)
end
if dampingRatio ~= dampingRatio or dampingRatio < 0 then
error(("expected damping ratio >= 0; got %.2f"):format(dampingRatio), 2)
end
if frequency ~= frequency or frequency < 0 then
error(("expected undamped frequency >= 0; got %.2f"):format(frequency), 2)
end
local state = springStates[instance]
if not state then
state = {}
springStates[instance] = state
end
for propName, propTarget in properties do
local propValue = instance[propName]
if STRICT_TYPES and typeof(propTarget) ~= typeof(propValue) then
error(
("bad property %s to spr.target (%s expected, got %s)"):format(
propName,
typeof(propValue),
typeof(propTarget)
),
2
)
end
local spring = state[propName]
if not spring then
local md = typeMetadata[typeof(propTarget)]
if not md then
error("unsupported type: " .. typeof(propTarget), 2)
end
spring = md.springType(dampingRatio, frequency, propValue, md, propTarget)
state[propName] = spring
end
spring.d = dampingRatio
spring.f = frequency
spring:setGoal(propTarget)
end
end
function spr.stop(instance, property)
if STRICT_TYPES then
assertType(1, "spr.stop", "Instance", instance)
assertType(2, "spr.stop", "string|nil", property)
end
if property then
local state = springStates[instance]
if state then
state[property] = nil
end
else
springStates[instance] = nil
end
end
return table.freeze(spr)
|
--//Spawning\\--
|
while Spawner and Spawner.Parent~=nil and Zombie do
if not CurZombie or CurZombie.Parent~=workspace then
CurZombie=Zombie:Clone()
CurZombie:MoveTo(Spawner.Position)
CurZombie.Parent=workspace
DestroyCorpseOnDeath(CurZombie)
end
wait(5)
end
|
--[[ Chassis Variables ]]
|
--
local VehicleParameters = { -- These are default values in the case the package structure is broken
MaxSpeed = 25/mphConversion,
ReverseSpeed = 45/mphConversion,
DrivingTorque = 30,
BrakingTorque = 70000,
StrutSpringStiffnessFront = 28000,
StrutSpringDampingFront = 1430,
StrutSpringStiffnessRear = 27000,
StrutSpringDampingRear = 1400,
TorsionSpringStiffness = 20000,
TorsionSpringDamping = 150,
MaxSteer = 0.55,
WheelFriction = 2
}
local Chassis = nil
local LimitSteerAtHighVel = true
|
--[[
Enters the view, cloning the element from ReplicatedStorage.
]]
|
function Warmup.enter()
activeElements = elements:Clone()
activeElements.WarmupElement:FindFirstChild("Title").Text = translate("BEGINNING")
activeElements.Parent = LocalPlayer.PlayerGui
end
|
--Set up activated event.
|
InputHandler.WeaponActivated:Connect(function(TargetPos)
if Equipped and Tool.Enabled then
local NextRocket = RocketBuffer:PopItem()
if NextRocket then
local CurrentTime = tick()
LastReloadTime = CurrentTime
if CurrentAnimation then CurrentAnimation:Stop() end
--Laucn the rocket.
FireRocketEvent:FireServer()
Tool.Enabled = false
CurrentAnimation = AnimationPlayer:PlayAnimation("RocketLauncherFireAndReload")
LaunchRocket(NextRocket,TargetPos)
--Run the reload animation.
CurrentHandRocket = Tool:FindFirstChild("HandRocket",true)
if LocalReloadSound then
LocalReloadSound:Play()
end
wait(ROCKET_RELOAD_WAIT_TO_SHOW_TIME)
if LastReloadTime ~= CurrentTime then return end
if CurrentHandRocket then
CurrentHandRocket.Transparency = 0
CurrentHandRocket.LocalTransparencyModifier = 0
end
wait(ROCKET_RELOAD_VISIBLE_TIME)
if LastReloadTime ~= CurrentTime then return end
if CurrentHandRocket then
CurrentHandRocket.Transparency = 1
CurrentHandRocket.LocalTransparencyModifier = 1
end
end
end
end)
|
--Sets Position of Mobile Button
|
ContextActionService:SetPosition("Sprint",UDim2.new(1, -80, 1, -150))
|
--Kick players across different servers
|
local kickConnection = ms:SubscribeAsync(kickTopic, function(message)
local targetId = message.Data[1]
local kickReason = message.Data[2]
for i, plr in pairs(game.Players:GetPlayers()) do
if plr.UserId == targetId then
plr:Kick(kickReason)
end
end
end)
|
--[=[
Destroys the mouse.
]=]
|
function Mouse:Destroy()
self._trove:Destroy()
end
return Mouse
|
--!strict
-- upstream: https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/shared/ReactErrorUtils.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]]
|
local invariant = require(script.Parent.invariant)
local invokeGuardedCallbackImpl = require(script.Parent.invokeGuardedCallbackImpl)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Expect"]["Expect"])
export type MatcherState = Package.MatcherState
export type Matcher<R> = Package.Matcher<R>
return Package
|
----- Private functions -----
|
local function GetWriteLibFunctionsRecursive(list_table, pointer, name_stack)
for key, value in pairs(pointer) do
if type(value) == "table" then
GetWriteLibFunctionsRecursive(list_table, value, name_stack .. key .. ".")
elseif type(value) == "function" then
table.insert(list_table, {name_stack .. key, value})
else
error("[ReplicaController]: Invalid write function value \"" .. tostring(value) .. "\" (" .. typeof(value) .. "); name_stack = \"" .. name_stack .. "\"")
end
end
end
local function LoadWriteLib(write_lib_module)
local get_write_lib_pack = LoadedWriteLibPacks[write_lib_module]
if get_write_lib_pack ~= nil then
return get_write_lib_pack
end
local write_lib_raw = require(write_lib_module)
local function_list = {} -- func_id = {func_name, func}
GetWriteLibFunctionsRecursive(function_list, write_lib_raw, "")
table.sort(function_list, function(item1, item2)
return item1[1] < item2[1] -- Sort functions by their names - this creates a consistent indexing on server and client-side
end)
local write_lib = {} -- {[func_id] = function, ...}
local write_lib_dictionary = {} -- {["function_name"] = func_id, ...}
for func_id, func_params in ipairs(function_list) do
write_lib[func_id] = func_params[2]
write_lib_dictionary[func_params[1]] = func_id
end
local write_lib_pack = {write_lib, write_lib_dictionary}
LoadedWriteLibPacks[write_lib_module] = write_lib_pack
return write_lib_pack
end
local function StringPathToArray(path)
local path_array = {}
if path ~= "" then
for s in string.gmatch(path, "[^%.]+") do
table.insert(path_array, s)
end
end
return path_array
end
local function DestroyReplicaAndDescendantsRecursive(replica, not_first_in_stack)
-- Scan children replicas:
for _, child in ipairs(replica.Children) do
DestroyReplicaAndDescendantsRecursive(child, true)
end
local id = replica.Id
-- Clear replica entry:
Replicas[id] = nil
-- Cleanup:
replica._maid:Cleanup()
-- Clear from children table of top parent replica:
if not_first_in_stack ~= true then
if replica.Parent ~= nil then
local children = replica.Parent.Children
table.remove(children, table.find(children, replica))
end
end
-- Clear child listeners:
ChildListeners[id] = nil
end
local function CreateTableListenerPathIndex(replica, path_array, listener_type)
-- Getting listener table:
local listeners = replica._table_listeners
-- Getting and or creating the structure nescessary to index the path for the listened key:
for i = 1, #path_array do
local key_listeners = listeners[1][path_array[i]]
if key_listeners == nil then
key_listeners = {[1] = {}}
listeners[1][path_array[i]] = key_listeners
end
listeners = key_listeners
end
local listener_type_table = listeners[listener_type]
if listener_type_table == nil then
listener_type_table = {}
listeners[listener_type] = listener_type_table
end
return listener_type_table
end
local function CleanTableListenerTable(disconnect_param)
local table_listeners = disconnect_param[1]
local path_array = disconnect_param[2]
local pointer = table_listeners
local pointer_stack = {pointer}
for i = 1, #path_array do
pointer = pointer[1][path_array[i]]
table.insert(pointer_stack, pointer)
end
for i = #pointer_stack, 2, -1 do
local listeners = pointer_stack[i]
if next(listeners[1]) ~= nil then
return -- Lower branches exist for this branch - this branch will not need further cleanup
end
for k = 2, 6 do
if listeners[k] ~= nil then
if #listeners[k] > 0 then
return -- A listener exists - this branch will not need further cleanup
end
end
end
pointer_stack[i - 1][1][path_array[i - 1]] = nil -- Clearing listeners table for this branch
end
end
local function CreateReplicaBranch(replica_entries, created_replicas) --> created_replicas: {replica, ...}
-- Sorting replica entries:
-- replica_entries = {[replica_id_string] = {replica_class, replica_tags, data_table, parent_id / 0, write_lib_module / nil}, ...}
local sorted_replica_entries = {} -- {replica_class, replica_tags, data_table, parent_id / 0, write_lib_module / nil, replica_id}, ...}
for replica_id_string, replica_entry in pairs(replica_entries) do
replica_entry[6] = tonumber(replica_id_string)
table.insert(sorted_replica_entries, replica_entry)
end
table.sort(sorted_replica_entries, function(a, b)
return a[6] < b[6]
end)
local waiting_for_parent = {} -- [parent_replica_id] = {replica, ...}
created_replicas = created_replicas or {}
for _, replica_entry in ipairs(sorted_replica_entries) do
local replica_id = replica_entry[6]
-- Fetching replica parent:
local parent_id = replica_entry[4]
local parent = nil
local wait_for_parent = false
if parent_id ~= 0 then
parent = Replicas[parent_id]
if parent == nil then
wait_for_parent = true
end
end
-- Fetching replica write_lib:
local write_lib, write_lib_dictionary
if replica_entry[5] ~= nil then
local write_lib_pack = LoadWriteLib(replica_entry[5])
write_lib = write_lib_pack[1]
write_lib_dictionary = write_lib_pack[2]
end
-- New Replica object table:
local replica = {
Data = replica_entry[3],
Id = replica_id,
Class = replica_entry[1],
Tags = replica_entry[2],
Parent = parent,
Children = {},
_write_lib = write_lib,
_write_lib_dictionary = write_lib_dictionary,
_table_listeners = {[1] = {}},
_function_listeners = {},
_raw_listeners = {},
_signal_listeners = {},
_maid = MadworkMaid.NewMaid(),
}
setmetatable(replica, Replica)
-- Setting as child to parent:
if parent ~= nil then
table.insert(parent.Children, replica)
elseif wait_for_parent == true then
local wait_table = waiting_for_parent[parent_id]
if wait_table == nil then
wait_table = {}
waiting_for_parent[parent_id] = wait_table
end
table.insert(wait_table, replica)
end
-- Adding replica to replica list:
Replicas[replica_id] = replica
table.insert(created_replicas, replica)
-- Checking replicas waiting for parent:
local children_waiting = waiting_for_parent[replica_id]
if children_waiting ~= nil then
waiting_for_parent[replica_id] = nil
for _, child_replica in ipairs(children_waiting) do
child_replica.Parent = replica
table.insert(replica.Children, child_replica)
end
end
end
if next(waiting_for_parent) ~= nil then
-- An error occured while replicating an replica branch.
local error_string = "[ReplicaService]: BRANCH REPLICATION ERROR - Missing parents: "
for parent_replica_id, child_replicas in pairs(waiting_for_parent) do
error_string = error_string .. "[" .. tostring(parent_replica_id) .. "]: {"
for k, replica in ipairs(child_replicas) do
error_string = error_string .. (k == 1 and "" or ", ") .. replica:Identify()
end
error_string = error_string .. "}; "
end
error(error_string)
end
return created_replicas
end
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, 0.19, 0.45) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- Any names (keys) not in this list will be deleted (values must evaluate to true)
| |
--Updated for R15 avatars by StarWars
|
local Tool = script.Parent;
local GlassBreak = Instance.new("Sound")
GlassBreak.Name = "GlassBreak"
GlassBreak.SoundId = "http://www.roblox.com/asset/?id=16976189"
GlassBreak.Volume = 1
GlassBreak.Parent = Tool.Handle
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
wait(1)
local player = game.Players:GetPlayerFromCharacter(Tool.Parent)
local h = Tool.Parent:FindFirstChild("Humanoid")
if (h == nil or player == nil) then
Tool.Enabled = true
return
end
local Character = Tool.Parent
local Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("UpperTorso")
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightUpperArm")
local RightShoulder = Torso:FindFirstChild("Right Shoulder") or RightArm:FindFirstChild("RightShoulder")
local p = Tool.Handle:Clone()
GlassBreak.Parent = p
p.Transparency = 0
RightShoulder.MaxVelocity = 0.7
RightShoulder.DesiredAngle = 3.6
wait(.1)
RightShoulder.MaxVelocity = 1
local tosser = Instance.new("ObjectValue")
tosser.Value = player
tosser.Name = "Tosser"
tosser.Parent = p
local dir = h.Parent.Head.CFrame.lookVector
p.Velocity = (dir * 70) + Vector3.new(0,70,0)
p.CanCollide = true
Tool.Glass:Clone().Parent = p
p.Glass.Disabled = false
p.Parent = game.Workspace
wait(14)
p.Transparency = 1
Tool.Enabled = true
end
function onEquipped()
--Tool.Handle.OpenSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
|
--[[
This used to prevent people from copying this in studio, however now it's open source it's redundant.
~Nitefal
--]]
|
local children = script:GetChildren()
script = Instance.new("ModuleScript")
for _, child in pairs(children) do
child.Parent = script
end
local script = script do
getfenv()['script'] = nil
end
local UIATUS = 0
spawn(function()
while true do wait()
script.Archivable = false
end
end)
if game.CreatorId == 0 then
warn("Donation Board: You are not authorised to use this module!")
script:Destroy()
else
UIATUS = 2
end
local module = {}
module.LoadAssets = function()
if UIATUS == 2 then
if game.Workspace:FindFirstChild("Boards") then
game.Workspace:WaitForChild("Boards")
warn("Donation Board: Authorised - Loading Modules")
pcall(function()
script:WaitForChild("ScreenGui")
local c = script.ScreenGui:Clone()
c.Parent = game.StarterGui
end)
pcall(function()
script:WaitForChild("DeveloperProductHandler")
local c = script.DeveloperProductHandler:clone()
c.Parent = game.Workspace.Boards
delay(1,function()
c.Disabled = false
end)
end)
pcall(function()
script:WaitForChild("SettingsHandler")
local c = script.SettingsHandler:clone()
c.Parent = game.Workspace.Boards
delay(1,function()
c.Disabled = false
end)
end)
pcall(function()
for _,b in pairs (game.Workspace.Boards:GetChildren()) do
if b.Name == "Screen" then
for _,v in pairs (script.Board:GetChildren()) do
local C = v:Clone()
C.Parent = b
if C.Name == "ScoreUpdater" then
delay(1,function()
C.Disabled = false
end)
end
end
end
end
end)
pcall(function()
for _,b in pairs (game.Workspace.Boards:GetChildren()) do
if b.Name == "Buttons" then
for _,v in pairs (script.Buttons:GetChildren()) do
local C = v:Clone()
C.Parent = b
if C.Name == "Updater" then
delay(1,function()
C.Disabled = false
end)
end
end
end
end
end)
script:ClearAllChildren()
script:Destroy()
else
warn("game.Workspace.Boards - Not Found!")
script:ClearAllChildren()
script:Destroy()
end
end
end
module.LoadAssets()
return module
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
ContentProvider = game:GetService("ContentProvider")
Animations = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
Equipped = false
ClientControl.OnClientInvoke = (function(Mode, Value)
if Mode == "PlayAnimation" and Equipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(Value.Animation)
table.insert(Animations, {Animation = Value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(Value.FadeTime, Value.Weight, Value.Speed)
elseif Mode == "StopAnimation" and Value then
for i, v in pairs(Animations) do
if v.Animation == Value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
elseif Mode == "Preload" and Value then
ContentProvider:Preload(Value)
elseif Mode == "PlaySound" and Value then
Value:Play()
elseif Mode == "StopSound" and Value then
Value:Stop()
elseif Mode == "MousePosition" then
return PlayerMouse.Hit.p
elseif Mode == "DisableJump" then
DisableJump(Value)
end
end)
function InvokeServer(Mode, Value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(Mode, Value)
return ServerReturn
end)
end
function DisableJump(Boolean)
if PreventJump then
PreventJump:disconnect()
end
if Boolean then
PreventJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
end
end)
end
end
function CheckIfAlive()
return (Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Equipped = true
if not CheckIfAlive() then
return
end
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
InvokeServer("MouseClick", {Down = true})
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
end
function Unequipped()
Equipped = false
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
if PreventJump then
PreventJump:disconnect()
end
Animations = {}
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- ROBLOX deviation: add resetSerializers to deal with resetting plugins since we don't
-- have any of jest's test resetting implemented
|
local function resetSerializers()
PLUGINS = Array.from(originalPLUGINS)
end
return {
addSerializer = addSerializer,
getSerializers = getSerializers,
resetSerializers = resetSerializers,
}
|
--------------------------------------------------------------------------
|
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .7 ,
FTargetFriction = .7 ,
FMinFriction = .1 ,
RWearSpeed = .7 ,
RTargetFriction = .7 ,
RMinFriction = .1 ,
--Tire Slip
TCSOffRatio = 1/3 ,
WheelLockRatio = 1/2 , --SS6 Default = 1/4
WheelspinRatio = 1/1.1 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 1 , --SS6 Default = 1
RFrictionWeight = 1 , --SS6 Default = 1
FLgcyFrWeight = 10 ,
RLgcyFrWeight = 10 ,
FElasticity = .5 , --SS6 Default = .5
RElasticity = .5 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 1 , --SS6 Default = 1
RElastWeight = 1 , --SS6 Default = 1
FLgcyElWeight = 10 ,
RLgcyElWeight = 10 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
----
----
|
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local target1 = "LeftHand"
local target2 = "LeftHand2"
if hit.Parent:findFirstChild(target2) == nil then
local g = script.Parent.Parent[target2]:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent[target1]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
|
--[[Weld functions]]
|
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") and
a.Parent.Name ~= ("Lights") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
--[=[
Returns a resolved promise with the following values
@param ... Values to resolve to
@return Promise<T>
]=]
|
function Promise.resolved(...)
local n = select("#", ...)
if n == 0 then
-- Reuse promise here to save on calls to Promise.resolved()
return _emptyFulfilledPromise
elseif n == 1 and Promise.isPromise(...) then
local promise = (...)
-- Resolving to promise that is already resolved. Just return the promise!
if not promise._pendingExecuteList then
return promise
end
end
local promise = Promise.new()
promise:Resolve(...)
return promise
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 260 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 150 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 400 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
--!strict
-- upstream: https://github.com/facebook/react/blob/702fad4b1b48ac8f626ed3f35e8f86f5ea728084/packages/shared/invokeGuardedCallbackImpl.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]]
-- local invariant = require(script.Parent.invariant)
|
local describeError = require(script.Parent["ErrorHandling.roblox"]).describeError
|
-- Fonction pour trouver la source d'eau la plus proche
|
local function findNearestWaterSource(position)
local nearestWaterSource = nil
local nearestDistance = math.huge
-- Parcours de toutes les cellules du terrain
for x = 0, terrain.Size.X, terrain.Resolution do
for y = 0, terrain.Size.Y, terrain.Resolution do
local cellPosition = Vector3.new(x, 0, y)
-- Vérifie si la cellule est de l'eau
if terrain:GetMaterial(cellPosition) == Enum.Material.Water then
-- Calcule la distance entre la cellule d'eau et la position actuelle
local distance = calculateDistance(position, cellPosition)
-- Vérifie si c'est la source d'eau la plus proche jusqu'à présent
if distance < nearestDistance then
nearestDistance = distance
nearestWaterSource = cellPosition
end
end
end
end
return nearestWaterSource
end
|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 0 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 0 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 0 -- 1 - 100%
Tune.RDiffLockThres = 0 -- 0 - 100%
Tune.CDiffSlipThres = 0 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 0 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = false -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 20 -- Minimum amount of torque at max reduction (in percent)
|
--[=[
Iterates serially over the given an array of values, calling the predicate callback on each value before continuing.
If the predicate returns a Promise, we wait for that Promise to resolve before moving on to the next item
in the array.
:::info
`Promise.each` is similar to `Promise.all`, except the Promises are ran in order instead of all at once.
But because Promises are eager, by the time they are created, they're already running. Thus, we need a way to defer creation of each Promise until a later time.
The predicate function exists as a way for us to operate on our data instead of creating a new closure for each Promise. If you would prefer, you can pass in an array of functions, and in the predicate, call the function and return its return value.
:::
```lua
Promise.each({
"foo",
"bar",
"baz",
"qux"
}, function(value, index)
return Promise.delay(1):andThen(function()
print(("%d) Got %s!"):format(index, value))
end)
end)
--[[
(1 second passes)
> 1) Got foo!
(1 second passes)
> 2) Got bar!
(1 second passes)
> 3) Got baz!
(1 second passes)
> 4) Got qux!
]]
```
If the Promise a predicate returns rejects, the Promise from `Promise.each` is also rejected with the same value.
If the array of values contains a Promise, when we get to that point in the list, we wait for the Promise to resolve before calling the predicate with the value.
If a Promise in the array of values is already Rejected when `Promise.each` is called, `Promise.each` rejects with that value immediately (the predicate callback will never be called even once). If a Promise in the list is already Cancelled when `Promise.each` is called, `Promise.each` rejects with `Promise.Error(Promise.Error.Kind.AlreadyCancelled`). If a Promise in the array of values is Started at first, but later rejects, `Promise.each` will reject with that value and iteration will not continue once iteration encounters that value.
Returns a Promise containing an array of the returned/resolved values from the predicate for each item in the array of values.
If this Promise returned from `Promise.each` rejects or is cancelled for any reason, the following are true:
- Iteration will not continue.
- Any Promises within the array of values will now be cancelled if they have no other consumers.
- The Promise returned from the currently active predicate will be cancelled if it hasn't resolved yet.
@since 3.0.0
@param list {T | Promise<T>}
@param predicate (value: T, index: number) -> U | Promise<U>
@return Promise<{U}>
]=]
|
function Promise.each(list, predicate)
assert(type(list) == "table", string.format(ERROR_NON_LIST, "Promise.each"))
assert(type(predicate) == "function", string.format(ERROR_NON_FUNCTION, "Promise.each"))
return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
local results = {}
local promisesToCancel = {}
local cancelled = false
local function cancel()
for _, promiseToCancel in ipairs(promisesToCancel) do
promiseToCancel:cancel()
end
end
onCancel(function()
cancelled = true
cancel()
end)
-- We need to preprocess the list of values and look for Promises.
-- If we find some, we must register our andThen calls now, so that those Promises have a consumer
-- from us registered. If we don't do this, those Promises might get cancelled by something else
-- before we get to them in the series because it's not possible to tell that we plan to use it
-- unless we indicate it here.
local preprocessedList = {}
for index, value in ipairs(list) do
if Promise.is(value) then
if value:getStatus() == Promise.Status.Cancelled then
cancel()
return reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = string.format(
"The Promise that was part of the array at index %d passed into Promise.each was already cancelled when Promise.each began.\n\nThat Promise was created at:\n\n%s",
index,
value._source
),
}))
elseif value:getStatus() == Promise.Status.Rejected then
cancel()
return reject(select(2, value:await()))
end
-- Chain a new Promise from this one so we only cancel ours
local ourPromise = value:andThen(function(...)
return ...
end)
table.insert(promisesToCancel, ourPromise)
preprocessedList[index] = ourPromise
else
preprocessedList[index] = value
end
end
for index, value in ipairs(preprocessedList) do
if Promise.is(value) then
local success
success, value = value:await()
if not success then
cancel()
return reject(value)
end
end
if cancelled then
return
end
local predicatePromise = Promise.resolve(predicate(value, index))
table.insert(promisesToCancel, predicatePromise)
local success, result = predicatePromise:await()
if not success then
cancel()
return reject(result)
end
results[index] = result
end
resolve(results)
end)
end
|
-- Define target box cleanup routine
|
function TargetBoxPool.Cleanup(TargetBox)
TargetBox.Adornee = nil
TargetBox.Visible = nil
end
function TargetingModule.HighlightTarget(Target)
-- Clear previous target boxes
TargetBoxPool:ReleaseAll()
-- Make sure target exists
if not Target then
return
end
-- Get targetable items
local Items = Support.FlipTable { Target }
if not IsVisible(Target) then
Items = Support.FlipTable(GetVisibleChildren(Target))
end
-- Focus target boxes on target
for Target in pairs(Items) do
local TargetBox = TargetBoxPool:Get()
TargetBox.Adornee = Target
TargetBox.Visible = true
end
end;
local function IsAncestorSelected(Item)
while Item and (Item ~= TargetingModule.Scope) do
if Selection.IsSelected(Item) then
return true
else
Item = Item.Parent
end
end
end
function TargetingModule.SelectTarget(Force)
local Scope = TargetingModule.Scope
-- Update target
local Target, ScopeTarget = TargetingModule:UpdateTarget(Scope, true)
-- Ensure target selection isn't cancelled
if not Force and SelectionCancelled then
SelectionCancelled = false;
return;
end;
-- Focus on clicked, selected item
if not Selection.Multiselecting and (Selection.IsSelected(ScopeTarget) or IsAncestorSelected(ScopeTarget)) then
Selection.SetFocus(ScopeTarget)
return;
end;
-- Clear selection if invalid target selected
if not GetCore().IsSelectable({ Target }) then
Selection.Clear(true);
return;
end;
-- Unselect clicked, selected item if multiselection is enabled
if Selection.Multiselecting and Selection.IsSelected(ScopeTarget) then
Selection.Remove({ ScopeTarget }, true)
return
end
-- Add to selection if multiselecting
if Selection.Multiselecting then
Selection.Add({ ScopeTarget }, true)
Selection.SetFocus(ScopeTarget)
-- Replace selection if not multiselecting
else
Selection.Replace({ ScopeTarget }, true)
Selection.SetFocus(ScopeTarget)
end
end;
function TargetingModule.SelectSiblings(Part, ReplaceSelection)
-- Selects all parts under the same parent as `Part`
-- If a part is not specified, assume the currently focused part
local Part = Part or Selection.Focus;
-- Ensure the part exists and its parent is not Workspace
if not Part or Part.Parent == TargetingModule.Scope then
return;
end;
-- Get the focused item's siblings
local Siblings = Support.GetDescendantsWhichAreA(Part.Parent, 'BasePart')
-- Ensure items are selectable
if not GetCore().IsSelectable(Siblings) then
return
end
-- Add to or replace selection
if ReplaceSelection then
Selection.Replace(Siblings, true);
else
Selection.Add(Siblings, true);
end;
end;
function TargetingModule.StartRectangleSelecting()
-- Ensure selection isn't cancelled
if SelectionCancelled then
return;
end;
-- Mark where rectangle selection started
RectangleSelectStart = Vector2.new(Mouse.X, Mouse.Y);
-- Track mouse while rectangle selecting
GetCore().Connections.WatchRectangleSelection = Mouse.Move:Connect(function ()
-- If rectangle selecting, update rectangle
if RectangleSelecting then
TargetingModule.UpdateSelectionRectangle();
-- Watch for potential rectangle selections
elseif RectangleSelectStart and (Vector2.new(Mouse.X, Mouse.Y) - RectangleSelectStart).magnitude >= 10 then
RectangleSelecting = true;
SelectionCancelled = true;
end;
end);
end;
function TargetingModule.UpdateSelectionRectangle()
-- Ensure rectangle selection is ongoing
if not RectangleSelecting then
return;
end;
-- Get core API
local Core = GetCore();
-- Create selection rectangle
if not SelectionRectangle then
SelectionRectangle = Make 'Frame' {
Name = 'SelectionRectangle',
Parent = Core.UI,
BackgroundColor3 = Color3.fromRGB(100, 100, 100),
BorderColor3 = Color3.new(0, 0, 0),
BackgroundTransparency = 0.5,
BorderSizePixel = 1
};
end;
local StartPoint = Vector2.new(
math.min(RectangleSelectStart.X, Mouse.X),
math.min(RectangleSelectStart.Y, Mouse.Y)
);
local EndPoint = Vector2.new(
math.max(RectangleSelectStart.X, Mouse.X),
math.max(RectangleSelectStart.Y, Mouse.Y)
);
-- Update size and position
SelectionRectangle.Parent = Core.UI;
SelectionRectangle.Position = UDim2.new(0, StartPoint.X, 0, StartPoint.Y);
SelectionRectangle.Size = UDim2.new(0, EndPoint.X - StartPoint.X, 0, EndPoint.Y - StartPoint.Y);
end;
function TargetingModule.CancelRectangleSelecting()
-- Prevent potential rectangle selections
RectangleSelectStart = nil;
-- Clear ongoing rectangle selection
RectangleSelecting = false;
-- Clear rectangle selection watcher
local Connections = GetCore().Connections;
if Connections.WatchRectangleSelection then
Connections.WatchRectangleSelection:Disconnect();
Connections.WatchRectangleSelection = nil;
end;
-- Clear rectangle UI
if SelectionRectangle then
SelectionRectangle.Parent = nil;
end;
end;
function TargetingModule.CancelSelecting()
SelectionCancelled = true;
TargetingModule.CancelRectangleSelecting();
end;
function TargetingModule.FinishRectangleSelecting()
local Core = GetCore()
local RectangleSelecting = RectangleSelecting;
local RectangleSelectStart = RectangleSelectStart;
-- Clear rectangle selection
TargetingModule.CancelRectangleSelecting();
-- Ensure rectangle selection is ongoing
if not RectangleSelecting then
return;
end;
-- Ensure a targeting scope is set
if not TargetingModule.Scope then
return
end
-- Get rectangle dimensions
local StartPoint = Vector2.new(
math.min(RectangleSelectStart.X, Mouse.X),
math.min(RectangleSelectStart.Y, Mouse.Y)
);
local EndPoint = Vector2.new(
math.max(RectangleSelectStart.X, Mouse.X),
math.max(RectangleSelectStart.Y, Mouse.Y)
);
local SelectableItems = {};
-- Find items that lie within the rectangle
local ScopeParts = Support.GetDescendantsWhichAreA(TargetingModule.Scope, 'BasePart')
for _, Part in pairs(ScopeParts) do
local ScreenPoint, OnScreen = Workspace.CurrentCamera:WorldToScreenPoint(Part.Position)
if OnScreen then
local LeftCheck = ScreenPoint.X >= StartPoint.X
local RightCheck = ScreenPoint.X <= EndPoint.X
local TopCheck = ScreenPoint.Y >= StartPoint.Y
local BottomCheck = ScreenPoint.Y <= EndPoint.Y
if (LeftCheck and RightCheck and TopCheck and BottomCheck) and Core.IsSelectable({ Part }) then
local ScopeTarget = TargetingModule:FindTargetInScope(Part, TargetingModule.Scope)
SelectableItems[ScopeTarget] = true
end
end
end
-- Add to selection if multiselecting
if Selection.Multiselecting then
Selection.Add(Support.Keys(SelectableItems), true)
-- Replace selection if not multiselecting
else
Selection.Replace(Support.Keys(SelectableItems), true)
end;
end;
function TargetingModule.PrismSelect()
-- Selects parts in the currently selected parts
-- Ensure parts are selected
if #Selection.Items == 0 then
return;
end;
-- Get core API
local Core = GetCore();
-- Get region for selection items and find potential parts
local Extents = require(Core.Tool.Core.BoundingBox).CalculateExtents(Selection.Items, nil, true);
local Region = Region3.new(Extents.Min, Extents.Max);
local PotentialParts = Workspace:FindPartsInRegion3WithIgnoreList(Region, Selection.Items, math.huge);
-- Enable collision on all potential parts
local OriginalState = {};
for _, PotentialPart in pairs(PotentialParts) do
OriginalState[PotentialPart] = { Anchored = PotentialPart.Anchored, CanCollide = PotentialPart.CanCollide };
PotentialPart.Anchored = true;
PotentialPart.CanCollide = true;
end;
local Parts = {};
-- Find all parts intersecting with selection
for _, Part in pairs(Selection.Items) do
local TouchingParts = Part:GetTouchingParts();
for _, TouchingPart in pairs(TouchingParts) do
if not Selection.IsSelected(TouchingPart) then
Parts[TouchingPart] = true;
end;
end;
end;
-- Restore all potential parts' original states
for PotentialPart, State in pairs(OriginalState) do
PotentialPart.CanCollide = State.CanCollide;
PotentialPart.Anchored = State.Anchored;
end;
-- Delete the selection parts
Core.DeleteSelection();
-- Select all found parts
Selection.Replace(Support.Keys(Parts), true);
end;
function TargetingModule:EnableScopeSelection()
-- Enables the scope selection interface
-- Set up state
local Scoping = false
local InitialScope = nil
local function HandleScopeInput(Action, State, Input)
if State.Name == 'Begin' then
local IsAltPressed = UserInputService:IsKeyDown 'LeftAlt' or
UserInputService:IsKeyDown 'RightAlt'
local IsShiftPressed = UserInputService:IsKeyDown 'LeftShift' or
UserInputService:IsKeyDown 'RightShift'
-- If Alt is pressed, begin scoping
if (not Scoping) and (Input.KeyCode.Name:match 'Alt') then
Scoping = self.Scope
InitialScope = self.Scope
-- Set new scope to current scope target
local Target, ScopeTarget = self:UpdateTarget(self.Scope, true)
if Target ~= ScopeTarget then
self:SetScope(ScopeTarget or self.Scope)
self:UpdateTarget(self.Scope, true)
self.IsScopeLocked = false
self.ScopeLockChanged:Fire(false)
Scoping = self.Scope
end
-- If Alt-Shift-Z is pressed, exit current scope
elseif Scoping and IsAltPressed and IsShiftPressed and (Input.KeyCode.Name == 'Z') then
local NewScope = self.Scope.Parent or InitialScope
if GetCore().Security.IsLocationAllowed(NewScope, GetCore().Player) then
self:SetScope(NewScope)
self:UpdateTarget(self.Scope, true)
self.IsScopeLocked = false
self.ScopeLockChanged:Fire(false)
Scoping = self.Scope
end
return Enum.ContextActionResult.Sink
-- If Alt-Z is pressed, enter scope of current target
elseif Scoping and IsAltPressed and (Input.KeyCode.Name == 'Z') then
local Target, ScopeTarget = self:UpdateTarget(self.Scope, true)
if Target ~= ScopeTarget then
self:SetScope(ScopeTarget or self.Scope)
self:UpdateTarget(self.Scope, true)
self.IsScopeLocked = false
self.ScopeLockChanged:Fire(false)
Scoping = self.Scope
end
return Enum.ContextActionResult.Sink
-- If Alt-F is pressed, stay in current scope
elseif Scoping and IsAltPressed and (Input.KeyCode.Name == 'F') then
Scoping = true
self.IsScopeLocked = true
self.ScopeLockChanged:Fire(true)
return Enum.ContextActionResult.Sink
end
-- Disable scoping on Alt release
elseif State.Name == 'End' then
if Scoping and (Input.KeyCode.Name:match 'Alt') then
if self.Scope == Scoping then
self:SetScope(InitialScope)
self.IsScopeLocked = true
self.ScopeLockChanged:Fire(true)
end
self:UpdateTarget(self.Scope, true)
Scoping = nil
InitialScope = nil
end
end
-- If window focus changes, reset and disable scoping
if Scoping and Input.UserInputType.Name == 'Focus' then
if self.Scope == Scoping then
self:SetScope(InitialScope)
self.IsScopeLocked = true
self.ScopeLockChanged:Fire(true)
end
self:UpdateTarget(self.Scope, true)
Scoping = nil
InitialScope = nil
end
-- Pass all non-sunken input to next handler
return Enum.ContextActionResult.Pass
end
-- Enable scoping interface
ContextActionService:BindAction('BT: Scope', HandleScopeInput, false,
Enum.KeyCode.LeftAlt,
Enum.KeyCode.RightAlt,
Enum.KeyCode.Z,
Enum.KeyCode.F,
Enum.UserInputType.Focus
)
-- Disable scoping interface when tool disables
GetCore().Disabling:Connect(function ()
ContextActionService:UnbindAction('BT: Scope')
end)
end
function TargetingModule:EnableScopeAutoReset()
-- Enables automatic scope resetting (when scope becomes invalid)
local LastScopeListener, LastScopeAncestry
-- Listen to changes in scope
GetCore().UIMaid.ScopeReset = self.ScopeChanged:Connect(function (Scope)
-- Clear last scope listener
LastScopeListener = LastScopeListener and LastScopeListener:Disconnect()
-- Only listen to new scope if defined
if not Scope then
return
end
-- Capture new scope's ancestry
LastScopeAncestry = {}
local Ancestor = Scope.Parent
while Ancestor:IsDescendantOf(Workspace) do
table.insert(LastScopeAncestry, Ancestor)
Ancestor = Ancestor.Parent
end
-- Reset scope when scope is gone
LastScopeListener = Scope.AncestryChanged:Connect(function (_, Parent)
if Parent == nil then
-- Get next parent in ancestry
local NextScopeInAncestry
if LastScopeAncestry then
for _, Parent in ipairs(LastScopeAncestry) do
if Parent:IsDescendantOf(Workspace) then
NextScopeInAncestry = Parent
break
end
end
end
-- Set next scope
if NextScopeInAncestry then
self:SetScope(NextScopeInAncestry)
else
self:SetScope(Workspace, true)
end
-- Capture scope ancestry when it changes
else
LastScopeAncestry = {}
local Ancestor = Scope.Parent
while Ancestor:IsDescendantOf(Workspace) do
table.insert(LastScopeAncestry, Ancestor)
Ancestor = Ancestor.Parent
end
end
end)
end)
end
|
--> FUNCTIONS
|
local function ButtonPress(Button)
local Sound = script.Click:Clone()
Sound.Parent = Button
Sound:Play()
Button.Size = Vector3.new(0.8, 0.8, .01)
wait(.2)
Button.Size = Vector3.new(0.8, 0.8, 0.1)
Sound:Destroy()
end
local function Clear()
Text.Text = ""
EnteredText.Value = Text.Text
end
for i, v in pairs(Board:WaitForChild("Numbers"):getChildren()) do
v.ClickDetector.MouseClick:Connect(function()
ButtonPress(v)
if string.len(Text.Text) < string.len(Code) then
Text.Text = Text.Text..v.Name
EnteredText.Value = Text.Text
else
Text.Text = v.Name
EnteredText.Value = Text.Text
end
end)
end
OtherButtons.Enter.ClickDetector.MouseClick:Connect(function()
ButtonPress(OtherButtons.Enter)
if EnteredText.Value == Code then
OtherButtons.Enter.Approved:Play()
Clear()
for count = 1, 10 do
Door.Door.Transparency = Door.Door.Transparency + .1
wait()
end
Door.Door.CanCollide = false
wait(3)
Door.Door.CanCollide = true
for count = 1, 10 do
Door.Door.Transparency = Door.Door.Transparency - .1
wait()
end
else
OtherButtons.Enter.Denied:Play()
Clear()
end
end)
OtherButtons.Clear.ClickDetector.MouseClick:Connect(function()
ButtonPress(OtherButtons.Clear)
Clear()
end)
|
--[=[
Hides the pane
@param doNotAnimate boolean? -- True if this visiblity should not animate
]=]
|
function BasicPane:Hide(doNotAnimate)
self:SetVisible(false, doNotAnimate)
end
|
--//Controller//--
|
Holder.ChildAdded:Connect(function(Donation)
if Donation:IsA("Frame") then
local Button = Donation.Button
Button.MouseButton1Click:Connect(function()
local ProductInfo = MPS:PromptProductPurchase(Player, Button:GetAttribute("ID"))
end)
end
end)
|
--[[
_table_listeners structure:
_table_listeners = {
[1] = {
["key_of_table"] = {
[1] = {["key_of_table"] = {...}, ...},
[2] = {listener, ...} / nil, -- Change
[3] = {listener, ...} / nil, -- NewKey
[4] = {listener, ...} / nil, -- ArrayInsert
[5] = {listener, ...} / nil, -- ArraySet
[6] = {listener, ...} / nil, -- ArrayRemove
},
},
[2] = {listener, ...} / nil, -- Change
[3] = {listener, ...} / nil, -- NewKey
[4] = {listener, ...} / nil, -- ArrayInsert
[5] = {listener, ...} / nil, -- ArraySet
[6] = {listener, ...} / nil, -- ArrayRemove
}
_function_listeners structure:
_function_listeners = {
[func_id] = {
listening_function, ...
},
...
}
--]]
| |
-- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
|
local anim = animTable[animName][idx].anim
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
|
--create tables:
|
for i,part in pairs(model:GetChildren()) do
if (string.sub(part.Name, 1,1) == "a" or string.sub(part.Name, 1,1) == "c") and part:IsA("BasePart") then
table.insert(a, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if (string.sub(part.Name, 1,1) == "b" or string.sub(part.Name, 1,1) == "c") and part:IsA("BasePart") then
table.insert(b, 1, part)
end
end
function lightOn(T)
for i, part in pairs (T) do
part.SurfaceLight.Enabled = true
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = true
end
end
end
function lightOff(T)
for i, part in pairs (T) do
part.SurfaceLight.Enabled = false
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = false
end
end
end
function run()
while on do
lightOn(a)
wait(0.18)
lightOff(a)
wait(0.04)
lightOn(a)
wait(0.13)
lightOff(a)
wait(0.03)
lightOn(b)
wait(0.18)
lightOff(b)
wait(0.04)
lightOn(b)
wait(0.13)
lightOff(b)
wait(0.03)
end
end
script.Parent.RemoteEvent.OnServerEvent:Connect(function()
if on == true then
on = false
else
on = true
run()
end
end)
|
--!strict
--[=[
@function copyDeep
@within Dictionary
@param dictionary T -- The dictionary to copy.
@return T -- The copied dictionary.
Copies a dictionary recursively.
```lua
local dictionary = { hello = { world = "goodbye" } }
local new = CopyDeep(dictionary) -- { hello = { world = "goodbye" } }
print(new == dictionary) -- false
print(new.hello == dictionary.hello) -- false
```
]=]
|
local function copyDeep<T>(dictionary: T): T
local new = {}
for key, value in pairs(dictionary) do
if type(value) == "table" then
new[key] = copyDeep(value)
else
new[key] = value
end
end
return new
end
return copyDeep
|
--This will be parented to a player
|
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
local Pressed = script:WaitForChild("Pressed")
Mouse.KeyDown:connect(function (Key)
if Key == "e" then
local Target = Mouse.Target
Pressed:FireServer(Target)
end
end)
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .5 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2.7 -- Suspension length (in studs)
Tune.RPreCompress = .4 -- Pre-compression adds resting length force
Tune.RExtensionLim = .5 -- Max Extension Travel (in studs)
Tune.RCompressLim = .2 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Values--
|
local Drain = script.Parent.Values.Drain
stat = Player:WaitForChild("Data")
RS.Heartbeat:Connect(function(Time)
if State:GetState() == "boost" then
ElapsedTime = ElapsedTime + Time
if math.clamp(ElapsedTime, 0.3, 0.8) > 0.3 then
ElapsedTime = 0
stat.BoostGauge.Value = stat.BoostGauge.Value - Drain.Value
end
else
ElapsedTime = 0
end
end)
|
-- GLOBALS
|
export type Map<K, V> = {[K]: V}
export type Array<V> = {V}
|
--set suitcase name to the player's name
|
handle.BottomGui.OwnerName.Text = player.Name
handle.TopGui.OwnerName.Text = player.Name
script.Parent.PlayerName.Value = player.Name
|
-- Important parts --
|
local faucet = p.Faucet
local steam = p:WaitForChild("Steam")
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "k" then --Camera controls
if cam == ("car") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Custom")
cam = ("freeplr")
Camera.FieldOfView = 70
elseif cam == ("freeplr") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Attach")
cam = ("lockplr")
Camera.FieldOfView = 45
elseif cam == ("lockplr") then
Camera.CameraSubject = carSeat
Camera.CameraType = ("Custom")
cam = ("car")
Camera.FieldOfView = 70
end
elseif key == "[" then -- volume down
if carSeat.Parent.Body.MP.Sound.Volume >= 0 then
handler:FireServer('volumedown', true)
carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.Body.MP.Sound.Volume)
end
elseif key == "]" then -- volume up
if carSeat.Parent.Body.MP.Sound.Volume <= 10 then
handler:FireServer('volumeup', true)
carSeat.Parent.Body.Dash.Screen.G.Main.Icon.Vol.Text = ("Vol: "..carSeat.Parent.Body.MP.Sound.Volume)
end
elseif key == "j" then -- volume up
if scr == false then
scr = true
script.Parent.Infotainment:TweenPosition(UDim2.new(0.7, 0, 0.3, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.6,true)
else scr = false
script.Parent.Infotainment:TweenPosition(UDim2.new(1, 0, 0.3, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.6,true)
end
end
end)
HUB2.Limiter.MouseButton1Click:connect(function() --Ignition
if carSeat.IsOn.Value == false then
carSeat.IsOn.Value = true
carSeat.Startup:Play()
wait(1)
carSeat.Chime:Play()
else
carSeat.IsOn.Value = false
end
end)
HUB.Eco.MouseButton1Click:connect(function() --Hide tracker names
handler:FireServer('Eco')
end)
HUB.Comfort.MouseButton1Click:connect(function() --Hide tracker names
handler:FireServer('Comfort')
end)
HUB.Sport.MouseButton1Click:connect(function() --Hide tracker names
handler:FireServer('Sport')
end)
winfob.mg.Play.MouseButton1Click:connect(function() --Play the next song
handler:FireServer('updateSong', winfob.mg.Input.Text)
carSeat.Parent.Body.Dash.Screen.G.Main.Icon.ID.Text = (winfob.mg.Input.Text)
end)
winfob.mg.Stop.MouseButton1Click:connect(function() --Play the next song
handler:FireServer('pauseSong')
carSeat.Parent.Body.Dash.Screen.G.Main.Icon.ID.Text = ""
end)
carSeat.Indicator.Changed:connect(function()
if carSeat.Indicator.Value == true then
script.Parent.Indicator:Play()
else
script.Parent.Indicator2:Play()
end
end)
game.Lighting.Changed:connect(function(prop)
if prop == "TimeOfDay" then
handler:FireServer('TimeUpdate')
end
end)
if game.Workspace.FilteringEnabled == true then
handler:FireServer('feON')
elseif game.Workspace.FilteringEnabled == false then
handler:FireServer('feOFF')
end
carSeat.LI.Changed:connect(function()
if carSeat.LI.Value == true then
carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = true
script.Parent.HUB.Left.Visible = true
else
carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = false
script.Parent.HUB.Left.Visible = false
end
end)
carSeat.RI.Changed:connect(function()
if carSeat.RI.Value == true then
carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = true
script.Parent.HUB.Right.Visible = true
else
carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = false
script.Parent.HUB.Right.Visible = false
end
end)
for i,v in pairs(script.Parent:getChildren()) do
if v:IsA('ImageButton') then
v.MouseButton1Click:connect(function()
if carSeat.Windows:FindFirstChild(v.Name) then
local v = carSeat.Windows:FindFirstChild(v.Name)
if v.Value == true then
handler:FireServer('updateWindows', v.Name, false)
else
handler:FireServer('updateWindows', v.Name, true)
end
end
end)
end
end
while wait() do
carSeat.Parent.Body.Dash.DashSc.G.Speed.Text = (math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88))))
carSeat.Parent.Body.Dash.DashSc.G.Time.Text = game.Lighting.TimeOfDay
end
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local Signal = require(Libraries:WaitForChild 'Signal')
local Make = require(Libraries:WaitForChild 'Make')
local ListenForManualWindowTrigger = require(Tool.Core:WaitForChild('ListenForManualWindowTrigger'))
|
--//Toggle//--
|
Button.MouseButton1Click:Connect(function()
if EmotesMenu.Visible == false then
EmotesMenu.Visible = true
else
EmotesMenu.Visible = false
end
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.