prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[
Init function that creates all the windows
]]
|
function WindowManager.init()
local windowModels = CollectionService:GetTagged(Constants.Tag.Window)
for _, model in pairs(windowModels) do
registry:add(model)
end
end
|
--[[
function trv(search,query)
for _,i in pairs(search:GetChildren()) do
if i:IsA(query) then if i.Name == "Screen" then if i.Name == "StockSplash" then i:remove() end local bb = script.ClutchManagment.StockSplash:Clone() bb.Parent = i end end
trv(i,query)
end
end
trv(game.Workspace,"ScreenGui")]]
|
--
script.ClutchToThrottle.Value = VR
if th == 12 then
if script.Parent.CarSeat.Gear.Value == 4 then
if GEAR.Value == 4 then
if Wrpm.Value*(Gear4/FinalDrive)*100 < Idle then
rpm.Value = Idle
else
rpm.Value = Wrpm.Value*(Gear4/FinalDrive)*100
end
if Wrpm.Value*(Gear4/FinalDrive)*100 >= RPMLimiter then
rwd.Torque = 0
else
if script.Parent.Control.Throttle.Computer.Value == 0 and script.Parent.CarSeat.CC.Value == false then
rwd.Torque = 0.2
else
if (((rpm.Value/10000)-((sconfig*rpm.Value)/10000)^4.8)*hp/(config*size)) < ((Gear4/FinalDrive)*(hp/650))*scale then
rwd.Torque = (((Gear4/FinalDrive)*(hp/650))*scale)*th.Value
else
rwd.Torque =
(((rpm.Value/10000)-((sconfig*rpm.Value)/10000)^4.8)*hp/(config*size))*th.Value
end
end
end
end
end end
|
-- Create and load an animation
|
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=14090986990" -- Roblox dance emote
local animationTrack = animationController:LoadAnimation(animation)
|
--Lamp Off
|
Model.Configuration.LampStatus.Value = 0
|
-- DO NOT CHANGE ANYTHING BELOW. I'm not going to help you solve issues with this script if you have changed any of the code below. --
------------------------------------------------------------------------
-- variables
|
local player
local character
local humanoid
local isR15
local rightHand
|
--|| SERVICES ||--
|
local RunService = game:GetService("RunService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Database = require(script.SoundsData)
local soundConnection
local stepInterval = 0.1
local lastStep = tick()
local Sound = Instance.new("Sound")
Sound.MaxDistance = 150
Sound.Looped = true
Sound.Name = "Material Walking Sound"
Sound.Parent = Character.HumanoidRootPart
Humanoid.Running:Connect(function(Speed)
if Speed > 0 then
if not Sound.IsPlaying then
Sound:Play()
end
else
Sound:Stop()
end
end)
Humanoid:GetPropertyChangedSignal("FloorMaterial"):Connect(function()
if Database[Humanoid.FloorMaterial] then
Sound.SoundId = Database[Humanoid.FloorMaterial]
end
end)
|
-- CONSTANTS
|
local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local Defaults = GuiLib:WaitForChild("Defaults")
local UIS = game:GetService("UserInputService")
local RUNSERVICE = game:GetService("RunService")
local SLIDER_FRAMEX = Defaults:WaitForChild("SliderFrameX")
local SLIDER_FRAMEY = Defaults:WaitForChild("SliderFrameY")
local XBOX_STEP = 0.01
local DEBOUNCE_TICK = 0.1
local XBOX_DEADZONE = 0.35
local THUMBSTICK = Enum.KeyCode.Thumbstick2
|
--[[
ProjectileReplication
Description: Projectile replication is a library that allows for projectiles to be created by weapons without
an exploiter leveraging the remote events. Sanity checks are done on the servers end. This library just helps
get that message across.
]]
|
local ProjectileReplication = {}
ProjectileReplication.__index = ProjectileReplication
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare on soundscript, Truenus on script
]]
|
wait(0.4)
local car = script.Parent.Car.Value
local revon = car.DriveSeat.Rev
local revoff = car.DriveSeat.RevOFF
local throttle = script.Parent.Values.Throttle
throttle.Changed:connect(function()
if throttle.Value == 1 then
revon.Volume=6.50
revoff.Volume=5.75
wait(0.025)
revon.Volume=6.50
revoff.Volume=5.50
wait(0.025)
revon.Volume=6.75
revoff.Volume=5.25
wait(0.025)
revon.Volume=7
revoff.Volume=0
else
revon.Volume=6.75
revoff.Volume=5.25
wait(0.025)
revon.Volume=6.50
revoff.Volume=5.50
wait(0.025)
revon.Volume=6.25
revoff.Volume=5.75
wait(0.025)
revon.Volume=0
revoff.Volume=6
end
end)
|
-- Events
|
local play = game.ReplicatedStorage.RadioEvents.Play
local pause = game.ReplicatedStorage.RadioEvents.Pause
local resume = game.ReplicatedStorage.RadioEvents.Resume
local stop = game.ReplicatedStorage.RadioEvents.Stop
local changeID = game.ReplicatedStorage.RadioEvents.ChangeID
|
--Client -> Server
|
-- Player
local RF_getPlayerData = remoteFunctions.Client.GetPlayerData
-- Player Vehicle
local RF_vehicleSpawnRequest = remoteFunctions.Client.Vehicle.VehicleSpawnRequest
local RF_vehicleRemoveRequest = remoteFunctions.Client.Vehicle.VehicleRemoveRequest
-- Weapon
local RF_GetUnlockedWeapons = remoteFunctions.Client.Weapon.GetUnlockedWeapons
local RF_GetEquipedWeapon = remoteFunctions.Client.Weapon.GetEquipedWeapon
local RF_GetWeaponInfo = remoteFunctions.Client.Weapon.GetWeaponInfo
local RF_EquipWeapon = remoteFunctions.Client.Weapon.EquipWeapon
local RF_UnEquipWeapon = remoteFunctions.Client.Weapon.UnEquipWeapon
local RF_BuyWeapon = remoteFunctions.Client.Weapon.BuyWeapon
-- Bullet
local RF_DamageVehicle = remoteFunctions.Client.Bullet.DamageVehicle
-- Twitter
local RF_redeemCode = remoteFunctions.Client.Twitter.RedeemCode
|
--if Player.Character.Humanoid.Health == 0 then
-- Player.Holster:Destroy()
--end
| |
-- [ BASIC ] --
|
local LookAtPlayerRange = 30 -- Distance away that NPC can looks
local LookAtNonPlayer = true -- Looks at other humanoid that isn't player
|
--[[
Function called upon entering the state
]]
|
function PlayerPostGame.onEnter(stateMachine, serverPlayer, event, from, to)
local character = serverPlayer.player.Character
if character then
character:Destroy()
end
end
|
--[[
Adds specified door model to door collision group
]]
|
function CollisionGroupsController.addDoor(door)
PhysicsService:SetPartCollisionGroup(door, Constants.CollisionGroup.Door)
end
|
--//Character//--
|
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local HRP = Character:WaitForChild("HumanoidRootPart")
|
-- REQUIRED PARTS -----------------------------------------------
-- Include all of these, or things will break!
|
local headlights = {
model.Headlight_Left,
model.Headlight_Right,
model.frontlight_Left_top,
model.frontlight_Left_top2,
model.frontlight_Right_top,
model.frontlight_Right_top2
}
local brakelights = {
model.Brakelight_Left,
model.Brakelight_Right,
model.Brakelight_Left_top,
model.Brakelight_Left_top2,
model.Brakelight_Right_top,
model.Brakelight_Right_top2
}
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
|
--[[Weld functions]]
|
local JS = game:GetService("JointsService")
local PGS_ON = workspace:PGSIsEnabled()
if not PGS_ON then
error("A-Chassis no longer supports Legacy physics solving, sorry!")
end
function MakeWeld(x,y,type,s)
if type==nil then type="Weld" end
local W=Instance.new(type,JS)
W.Part0=x W.Part1=y
W.C0=x.CFrame:inverse()*x.CFrame
W.C1=y.CFrame:inverse()*x.CFrame
if type=="Motor" and s~=nil then
W.MaxVelocity=s
end
return W
end
function ModelWeld(a,b)
if a:IsA("BasePart") then
MakeWeld(b,a,"Weld")
elseif a:IsA("Model") or a:IsA("Folder") then
for i,v in pairs(a:GetChildren()) do
ModelWeld(v,b)
end
end
end
function UnAnchor(a)
if a:IsA("BasePart") then a.Anchored=false end for i,v in pairs(a:GetChildren()) do UnAnchor(v) end
end
|
-- Returns all objects under instance with Transparency
|
local function GetTransparentsRecursive(instance, partsTable)
local partsTable = partsTable or {}
for _, child in pairs(instance:GetChildren()) do
if child:IsA('BasePart') or child:IsA('Decal') then
table.insert(partsTable, child)
end
GetTransparentsRecursive(child, partsTable)
end
return partsTable
end
local function SelectionBoxify(instance)
local selectionBox = Instance.new('SelectionBox')
selectionBox.Adornee = instance
selectionBox.Color = BrickColor.new('Toothpaste')
selectionBox.Parent = instance
return selectionBox
end
local function Light(instance)
local light = PointLight:Clone()
light.Range = light.Range + 2
light.Parent = instance
end
local function FadeOutObjects(objectsWithTransparency, fadeIncrement)
repeat
local lastObject = nil
for _, object in pairs(objectsWithTransparency) do
object.Transparency = object.Transparency + fadeIncrement
lastObject = object
end
wait()
until lastObject.Transparency >= 1 or not lastObject
end
local function Dematerialize(character, humanoid, firstPart)
humanoid.WalkSpeed = 0
local parts = {}
for _, child in pairs(character:GetChildren()) do
if child:IsA('BasePart') then
child.Anchored = true
table.insert(parts, child)
elseif child:IsA('LocalScript') or child:IsA('Script') then
child:Destroy()
end
end
local selectionBoxes = {}
local firstSelectionBox = SelectionBoxify(firstPart)
Light(firstPart)
wait(0.05)
for _, part in pairs(parts) do
if part ~= firstPart then
table.insert(selectionBoxes, SelectionBoxify(part))
Light(part)
end
end
local objectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(objectsWithTransparency, 0.1)
wait(0.5)
humanoid.Health = 0
DebrisService:AddItem(character, 2)
local fadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({firstSelectionBox}, fadeIncrement)
if character then
character:Destroy()
end
end)
FadeOutObjects(selectionBoxes, fadeIncrement)
end
local function OnTouched(shot, otherPart)
local character, humanoid = FindCharacterAncestor(otherPart)
if character and humanoid and character ~= Character then
ApplyTags(humanoid)
if shot then
local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name)
if hitFadeSound then
hitFadeSound.Parent = humanoid.Torso
hitFadeSound:Play()
end
shot:Destroy()
end
Dematerialize(character, humanoid, otherPart)
end
end
local function OnEquipped()
Character = Tool.Parent
Humanoid = Character:WaitForChild('Humanoid')
Player = PlayersService:GetPlayerFromCharacter(Character)
end
local function OnActivated()
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
FireSound:Play()
local handleCFrame = Handle.CFrame
local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET)
local shotCFrame = CFrame.new(firingPoint, Humanoid.TargetPoint)
local laserShotClone = BaseShot:Clone()
laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2))
local bodyVelocity = Instance.new('BodyVelocity')
bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED
bodyVelocity.Parent = laserShotClone
laserShotClone.Touched:connect(function(otherPart)
OnTouched(laserShotClone, otherPart)
end)
DebrisService:AddItem(laserShotClone, SHOT_TIME)
laserShotClone.Parent = Tool
wait(0.6) -- FireSound length
ReloadSound:Play()
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
local function OnUnequipped()
end
|
-- assume we are in the character, let's check
|
function sepuku()
script.Parent = nil
end
function grapeMe(character)
local shirt = character:FindFirstChild("Shirt")
local pants = character:FindFirstChild("Pants")
if (shirt ~= nil) then shirt:Remove() end
if (pants ~= nil) then pants:Remove() end
local c = character:GetChildren()
for i=1,#c do
if (c[i].className == "Part") then
c[i].Material = Enum.Material.Ice
c[i].BrickColor = BrickColor.new("Magenta")
end
end
end
function UpdateUI(timeleft)
local player = game.Players:GetPlayerFromCharacter(script.Parent)
player.PlayerGui.GrapeGUI.Frame.Frame.Time.Text = timeleft .. " seconds"
if (timeleft < 10) then
player.PlayerGui.GrapeGUI.Frame.Frame.Warning.TextColor = BrickColor.new("Really red")
if (timeleft % 2 == 1) then
player.PlayerGui.GrapeGUI.Frame.Frame.Warning.Text = "WARNING"
else
player.PlayerGui.GrapeGUI.Frame.Frame.Warning.Text = "Mindgrapes on FIRE!!!"
end
else
player.PlayerGui.GrapeGUI.Frame.Frame.Warning.TextColor = BrickColor.new("Hot pink")
player.PlayerGui.GrapeGUI.Frame.Frame.Warning.Text = "Mindgrapes Ok..."
end
end
local h = script.Parent:FindFirstChild("Humanoid")
if (h == nil) then sepuku() end
local oldSpeed = h.WalkSpeed
h.WalkSpeed = h.WalkSpeed * 2
h.MaxHealth = h.MaxHealth * .25
if (h.Health > h.MaxHealth) then h.Health = h.MaxHealth end
local torso = script.Parent:FindFirstChild("Torso")
if (torso == nil) then sepuku() end
local head = script.Parent:FindFirstChild("Head")
if (head == nil) then head = torso end
local Hyper = Instance.new("Sound")
Hyper.SoundId = "http://www.roblox.com/asset/?id=16950418"
Hyper.Parent = head
Hyper.Volume = .5
grapeMe(h.Parent)
local played = false
while true do
local count = script:FindFirstChild("GrapeTroubleCountdown")
if (count == nil) then
count = Instance.new("IntValue")
count.Name = "GrapeTroubleCountdown"
count.Value = 30
count.Parent = h
else
count.Value = count.Value - 1
if (count.Value < 0) then
local sound = Instance.new("Sound")
sound.SoundId = "rbxasset://sounds\\Rocket shot.wav"
sound.Parent = head
sound.Volume = 1
sound:play()
local e = Instance.new("Explosion")
e.BlastRadius = 4
e.Position = head.Position
e.Parent = head
else
if (Hyper.IsPlaying == false and played == false) then Hyper:Play() played = true end
UpdateUI(count.Value)
end
end
wait(1)
end
|
--Listen to seat enter/exit
|
print("Add seat")
local Enter,Exit = SeatingModule.AddSeat(driverSeat)
print("Seat added")
Enter.Name = "EnterEvent"
Enter.Parent = driverSeat
Exit.Name = "ExitEvent"
Exit.Parent = driverSeat
for i,v in pairs(AdditionalSeats) do
if v then
SeatingModule.AddSeat(v)
end
end
local driverScriptClone = nil
local enterEvent = driverSeat:WaitForChild("EnterEvent")
local exitEvent = driverSeat:WaitForChild("ExitEvent")
enterEvent.Event:Connect(function(player)
print("CAR SEAT ENTERED")
driverScriptClone = driverScript:Clone()
driverScriptClone.Name = "CurrentDriver"
driverScriptClone.CarValue.Value = root
driverScriptClone.Parent = player.Backpack
driverScriptClone.Disabled = false
driverScriptClone.RedressController.Disabled = false
driverSeat:SetNetworkOwner(player)
end)
exitEvent.Event:Connect(function(player)
if driverScriptClone then
driverScriptClone:Destroy()
driverSeat:SetNetworkOwner()
end
end)
|
--CHEDSAPP!!!!!!
--rccbay.com ON TOP
|
script.Parent.OnServerEvent:Connect(function(player,rpm,main)
main.HingeConstraint.AngularVelocity = rpm
end)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["InputType"]["InputType"])
return Package
|
--[[ Public API ]]
|
--
function TouchJump:Enable()
JumpButton.Visible = true
end
function TouchJump:Disable()
JumpButton.Visible = false
OnInputEnded()
end
function TouchJump:Create(parentFrame)
if JumpButton then
JumpButton:Destroy()
JumpButton = nil
end
local isSmallScreen = parentFrame.AbsoluteSize.y <= 500
local jumpButtonSize = isSmallScreen and 70 or 90
JumpButton = Instance.new('ImageButton')
JumpButton.Name = "JumpButton"
JumpButton.Visible = false
JumpButton.BackgroundTransparency = 1
JumpButton.Image = TOUCH_CONTROL_SHEET
JumpButton.ImageRectOffset = Vector2.new(176, 222)
JumpButton.ImageRectSize = Vector2.new(174, 174)
JumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)
JumpButton.Position = isSmallScreen and UDim2.new(1, jumpButtonSize * -2.25, 1, -jumpButtonSize - 20) or
UDim2.new(1, jumpButtonSize * -2.75, 1, -jumpButtonSize - 120)
local touchObject = nil
local function doJumpLoop()
local character = LocalPlayer.Character
if character then
local humanoid = getHumanoid()
if humanoid then
while touchObject do
humanoid.Jump = true
wait(1/60)
end
end
end
end
JumpButton.InputBegan:connect(function(inputObject)
if touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
return
end
touchObject = inputObject
JumpButton.ImageRectOffset = Vector2.new(0, 222)
doJumpLoop()
end)
OnInputEnded = function()
touchObject = nil
JumpButton.ImageRectOffset = Vector2.new(176, 222)
end
JumpButton.InputEnded:connect(function(inputObject)
if inputObject == touchObject then
OnInputEnded()
end
end)
JumpButton.Parent = parentFrame
end
return TouchJump
|
--Weld stuff here
|
MakeWeld(car.Misc.Wheel.A,car.DriveSeat,"Motor",.5).Name="W"
ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.A)
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
-- RemoteSignal
-- Stephen Leitnick
-- December 20, 2021
|
local Players = game:GetService("Players")
local Signal = require(script.Parent.Parent.Parent.Signal)
local Types = require(script.Parent.Parent.Types)
|
--[[ INSTRUCTIONS
- Place in the model you want to auto weld all contents to.
- That's it. It will weld the model and all children.
--]]
-- This script is designed to be used is a regular script. In a local script it will not handle ancestory changes!!
| |
--------------| SYSTEM SETTINGS |--------------
|
Prefix = ";"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Blue"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 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 = false; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = false; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = false; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = 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;
};
|
--// Remote(s)
|
local remoteFold = rp.remoteFold
local module = {}
module.db = function(db, plr)
if Players:FindFirstChild(plr) then
plr.CharacterAdded:Connect(function(char)
db = false
end)
plr.CharacterRemoving:Connect(function(char)
db = false
--remoteFold['CharRemoving']:FireClient(Players:GetPlayerFromCharacter(char), {plr = Players:GetPlayerFromCharacter(char)})
end)
end
return db
end
return module
|
--Makes the cat randomly walk every 1 second--
|
while true do
wait(1)
Goal = Vector3.new(math.random(-255, 255), math.random(-255, 255), math.random(-255, 255))
print("Cat is walking to: " .. tostring(Goal))
script.Parent.Humanoid:MoveTo(Goal)
end
|
-- An object which stores a piece of reactive state.
|
export type StateObject<T> = Dependency & {
type: string, -- replace with "State" when Luau supports singleton types
kind: string,
get: (StateObject<T>, asDependency: boolean?) -> T
}
|
--[=[
@within TableUtil
@function SwapRemoveFirstValue
@param tbl table -- Array
@param v any -- Value to find
@return number?
Performs `table.find(tbl, v)` to find the index of the given
value, and then performs `TableUtil.SwapRemove` on that index.
```lua
local t = {"A", "B", "C", "D", "E"}
TableUtil.SwapRemoveFirstValue(t, "C")
print(t) --> {"A", "B", "E", "D"}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=]
|
local function SwapRemoveFirstValue(t: Table, v: any): number?
local index: number? = table.find(t, v)
if index then
SwapRemove(t, index)
end
return index
end
|
-- Set up the mouse enter and leave event handlers for each button
|
local function onButtonEnter(button)
local sizeTweenInfo = TweenInfo.new(tweenDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local sizeTween = game:GetService("TweenService"):Create(button, sizeTweenInfo, {
Size = UDim2.new(button.Size.X.Scale * magnificationScale, button.Size.X.Offset,
button.Size.Y.Scale * magnificationScale, button.Size.Y.Offset)
})
click:Play()
sizeTween:Play()
local positionTweenInfo = TweenInfo.new(tweenDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local positionTween = game:GetService("TweenService"):Create(button, positionTweenInfo, {
Position = UDim2.new(button.Position.X.Scale - ((magnificationScale - 1) / 2),
button.Position.X.Offset, button.Position.Y.Scale - ((magnificationScale - 1) / 2),
button.Position.Y.Offset)
})
positionTween:Play()
end
local function onButtonLeave(button)
local sizeTweenInfo = TweenInfo.new(tweenDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local sizeTween = game:GetService("TweenService"):Create(button, sizeTweenInfo, {
Size = originalSizes[button]
})
sizeTween:Play()
local positionTweenInfo = TweenInfo.new(tweenDuration, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
local positionTween = game:GetService("TweenService"):Create(button, positionTweenInfo, {
Position = originalPositions[button]
})
positionTween:Play()
end
|
--[[
Setup all canvases and initialize all spots within a canvas. We perform the following:
1. Create a new Canvas object for each tagged model
2. Create Spot objects, set event callbacks, and register them with the canvas object
3. Set associated attributes on models so clients can easily initialize UI to listen to
the correct IDs
]]
|
return function(contexts, services, remoteEvents)
local CollectionService = services.CollectionService
local canvases = contexts.canvases
-- TODO: This should be injected instead for testability purposes,
-- handle this in another PR
local config = configuration.getValues()
-- Initialize all objects to keep track of canvases in the world
local spotsPerCanvas = config.rowsPerCanvas * config.colsPerCanvas
for _, model in ipairs(CollectionService:GetTagged(constants.Tags.SurfaceCanvas)) do
local canvas = Canvas.new()
-- Register spots with the canvas
local spots = {}
for i = 1, spotsPerCanvas do
local spot = Spot.new()
spot.onArtChanged = function(artId, ownerUserId)
remoteEvents.SpotChanged:FireAllClients(canvas.id, spot.id, artId, ownerUserId)
end
model:SetAttribute(constants.Attributes.SpotIdPrefix .. i, spot.id)
table.insert(spots, spot)
end
canvas:registerSpots(spots)
model:SetAttribute(constants.Attributes.SurfaceCanvasId, canvas.id)
canvases[canvas.id] = canvas
end
end
|
--Made by Luckymaxer
|
Tool = script.Parent
Players = game:GetService("Players")
Player = Players.LocalPlayer
Icons = {
Normal = "rbxasset://textures/GunCursor.png",
Reloading = "rbxasset://textures/GunWaitCursor.png"
}
ToolEquipped = false
function UpdateIcon()
if Mouse and ToolEquipped then
Mouse.Icon = (((Tool.Enabled and (Mouse.Icon == Icons.Reloading or Mouse.Icon == "")) and Icons.Normal) or ((not Tool.Enabled and (Mouse.Icon == Icons.Normal or Mouse.Icon == "")) and Icons.Reloading) or Mouse.Icon)
end
end
function Equipped()
ToolEquipped = true
Mouse = Player:GetMouse()
MouseChanged = Mouse.Changed:connect(Changed)
UpdateIcon()
end
function Unequipped()
ToolEquipped = false
Mouse.Icon = ""
if MouseChanged then
MouseChanged:disconnect()
end
end
function Changed(Property)
if Property == "Enabled" or (Property == "Icon" and Mouse.Icon == "") then
UpdateIcon()
end
end
Tool.Changed:connect(Changed)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill
--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill
--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill
| |
-- Do not touch unless you know what you're doing.
|
game.Workspace.Test1.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr then
game.ReplicatedStorage.Cutscene:FireClient(plr)
end
end)
|
--script.Parent.Menu.Visible=false
|
while not player.newPlayer do
print('wait')
wait()
end
wait(0.5)
if player.newPlayer.Value then
-- новый
script.Parent.History.Visible=true
|
--|| VARIABLES ||--
|
local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Torso = Character:WaitForChild("Torso")
local RootJoint = HumanoidRootPart.RootJoint
local LeftHipJoint = Torso["Left Hip"]
local RightHipJoint = Torso["Right Hip"]
local function Lerp(a, b, c)
return a + (b - a) * c
end
local Force = nil
local Direction = nil
local Value1 = 0
local Value2 = 0
local RootJointC0 = RootJoint.C0
local LeftHipJointC0 = LeftHipJoint.C0
local RightHipJointC0 = RightHipJoint.C0
RunService.RenderStepped:Connect(function()
Force = HumanoidRootPart.Velocity * Vector3.new(1/16,0,1/16)
Direction = Force
Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 5), math.rad(-Value1 * 5), 0), 0.2)
end)
|
-- скрипт по выравниванию кнопок
|
me = script.Parent -- форма кнопок
wnd = me.Parent -- главное окно
ui=me.Frame.UI
sample=script.Sample:Clone()
local tmp = me:GetChildren()
local button=0 -- количество кнопок
for i,img in pairs(tmp) do
str=string.sub(img.Name,1,3)
if str =="img" then
button=button+1
end
end
sizeX=me.AbsoluteSize.X --script.Sample.AbsoluteSize.X
sizeY=script.Sample.AbsoluteSize.Y
if sizeX>sizeY then
sizeY=sizeX
else
sizeX=sizeY
end
anchor=Vector2.new(0.5,0.5)
for i,img in pairs(tmp) do
str=string.sub(img.Name,1,3)
if str =="img" then
smp=sample:Clone()
smp.Size=UDim2.new(0,sizeX,0,sizeY)
local btn=img
btn.AnchorPoint=anchor
btn.Position=UDim2.new(0.5,0,0.5,0)
btn.Size=UDim2.new(0.7,0,0.8,0)
btn.Parent=smp
smp.Parent=me.Frame
end
end
|
-- Connections --
|
Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(OnCharacterAdded)
end)
Players.LocalPlayer.CharacterAdded:Connect(OnCharacterAdded)
for Index, Player in pairs(Players:GetPlayers()) do
if (Player ~= Players.LocalPlayer) then
OnCharacterAdded(Player.Character)
Player.CharacterAdded:Connect(OnCharacterAdded)
end
end
|
-- 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 = {};
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, CFrame = Change.Part.CFrame };
ChangeSet[Change.Part] = Change;
end;
end;
-- Preserve joints
for Part, Change in pairs(ChangeSet) do
Change.Joints = PreserveJoints(Part, ChangeSet);
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 CFrame
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.CFrame = Change.InitialState.CFrame;
end;
end;
-- Restore the parts' original states
for Part, Change in pairs(ChangeSet) 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 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, CFrame = Change.Part.CFrame };
ChangeSet[Change.Part] = Change;
end;
end;
-- Preserve joints
for Part, Change in pairs(ChangeSet) do
Change.Joints = PreserveJoints(Part, ChangeSet);
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 CFrame
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.CFrame = Change.InitialState.CFrame;
end;
end;
-- Restore the parts' original states
for Part, Change in pairs(ChangeSet) 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
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 689 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 120 -- 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)
|
-- [[ Update ]]--
|
function OrbitalCamera:Update(dt: number): (CFrame, CFrame)
local now = tick()
local timeDelta = (now - self.lastUpdate)
local userPanningTheCamera = CameraInput.getRotation() ~= Vector2.new()
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local player = PlayersService.LocalPlayer
local cameraSubject = camera and camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform')
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
-- Reset tween speed if user is panning
if userPanningTheCamera then
self.lastUserPanCamera = tick()
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
-- Process any dollying being done by gamepad
-- TODO: Move this
if self.gamepadDollySpeedMultiplier ~= 1 then
self:SetCameraToSubjectDistance(self.currentSubjectDistance * self.gamepadDollySpeedMultiplier)
end
local VREnabled = VRService.VREnabled
newCameraFocus = VREnabled and self:GetVRFocus(subjectPosition, timeDelta) or CFrame.new(subjectPosition)
local flaggedRotateInput = CameraInput.getRotation()
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject: Vector3 = (subjectPosition - camera.CFrame.p)
local distToSubject: number = vecToSubject.magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > self.currentSubjectDistance or flaggedRotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, self.currentSubjectDistance)
-- Note that CalculateNewLookVector is overridden from BaseCamera
vecToSubject = self:CalculateNewLookVector(vecToSubject.unit * X1_Y0_Z1, Vector2.new(flaggedRotateInput.x, 0)) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if flaggedRotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
-- rotateInput is a Vector2 of mouse movement deltas since last update
self.curAzimuthRad = self.curAzimuthRad - flaggedRotateInput.x
if self.useAzimuthLimits then
self.curAzimuthRad = math.clamp(self.curAzimuthRad, self.minAzimuthAbsoluteRad, self.maxAzimuthAbsoluteRad)
else
self.curAzimuthRad = (self.curAzimuthRad ~= 0) and (math.sign(self.curAzimuthRad) * (math.abs(self.curAzimuthRad) % TAU)) or 0
end
self.curElevationRad = math.clamp(self.curElevationRad + flaggedRotateInput.y, self.minElevationRad, self.maxElevationRad)
local cameraPosVector = self.currentSubjectDistance * ( CFrame.fromEulerAnglesYXZ( -self.curElevationRad, self.curAzimuthRad, 0 ) * UNIT_Z )
local camPos = subjectPosition + cameraPosVector
newCameraCFrame = CFrame.new(camPos, subjectPosition)
end
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
return OrbitalCamera
|
-- Experimental Scope support.
|
exports.enableScopeAPI = false
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, 0, -0.1) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--!strict
--[=[
@function reduce
@within Array
@param array {T} -- The array to reduce.
@param reducer (accumulator: U, value: T, index: number, array: {T}) -> U -- The reducer to use.
@param initialReduction? U = {T}[1] -- The initial accumulator value.
@return U -- The final accumulator value.
Reduces the array using the given reducer and initial accumulator value.
If no `initialReduction` value is given, the first item in the array is used.
```lua
local array = { 1, 2, 3 }
local value = Reduce(array, function(accumulator, item, index)
return accumulator - item
end) -- -4
local value = Reduce(array, function(accumulator, item, index)
table.insert(accumulator, item)
return accumulator
end, {}) -- { 1, 2, 3 }
```
]=]
|
local function reduce<T, U>(
array: { T },
reducer: (accumulator: U, value: T, index: number, array: { T }) -> U,
initReduction: U?
): U
local result = initReduction
local start = 1
if not result then
result = array[1]
start = 2
end
for index = start, #array do
result = reducer(result, array[index], index, array)
end
return result
end
return reduce
|
-----------------------------------------------
|
function findAllFlagStands(root)
local c = root:children()
for i=1,#c do
if (c[i].className == "Model" or c[i].className == "Part") then
findAllFlagStands(c[i])
end
if (c[i].className == "FlagStand") then
table.insert(stands, c[i])
end
end
end
function hookUpListeners()
for i=1,#stands do
stands[i].FlagCaptured:connect(onCaptureScored)
end
end
function onPlayerEntered(newPlayer)
if CTF_mode == true then
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local captures = Instance.new("IntValue")
captures.Name = "Captures"
captures.Value = 0
captures.Parent = stats
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
stats.Parent = newPlayer
else
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local deaths = Instance.new("IntValue")
deaths.Name = "Wipeouts"
deaths.Value = 0
deaths.Parent = stats
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
local humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
stats.Parent = newPlayer
end
end
function onCaptureScored(player)
local ls = player:findFirstChild("leaderstats")
if ls == nil then return end
local caps = ls:findFirstChild("Captures")
if caps == nil then return end
caps.Value = caps.Value + 1
end
findAllFlagStands(game.Workspace)
hookUpListeners()
if (#stands > 0) then CTF_mode = true end
game.Players.ChildAdded:connect(onPlayerEntered)
|
--NOTE: We create the rocket once and then clone it when the player fires
|
local Rocket = Instance.new('Part') do
-- Set up the rocket part
Rocket.Name = 'Rocket'
Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
Rocket.Size = ROCKET_PART_SIZE
Rocket.CanCollide = false
-- Add the mesh
local mesh = Instance.new('SpecialMesh', Rocket)
mesh.MeshId = MISSILE_MESH_ID
mesh.Scale = MISSILE_MESH_SCALE
-- Add fire
local fire = Instance.new('Fire', Rocket)
fire.Heat = 100
fire.Size = 200
-- Add smoke
if ROCKET_TRAIL == true then
local trail = script.TrailEffect.TrailEffect:Clone()
trail.Enabled = true
trail.Parent = Rocket
end
-- Add a force to counteract gravity
local bodyForce = Instance.new('BodyForce', Rocket)
bodyForce.Name = 'Antigravity'
bodyForce.Force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)
-- Clone the sounds and set Boom to PlayOnRemove
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = Rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.PlayOnRemove = true
boomSoundClone.Parent = Rocket
-- Attach creator tags to the rocket early on
local creatorTag = Instance.new('ObjectValue', Rocket)
creatorTag.Value = MyPlayer
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Value = Tool.TextureId
iconTag.Name = 'icon'
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = Rocket
rocketScriptClone.Disabled = false
end
|
-- This function merges the Packages folder from a DevModule into a shared
-- location. Until we have an improved package implementation, we need to
-- manually dedupe our libraries to cut down on bloat
|
local function dedupePackages(packages: Folder)
local packageStorage = getPackageStorage()
for _, package in ipairs(packages:GetChildren()) do
if package ~= script then
local version = getPackageVersion(package)
local existingVersion
for _, otherPackage in ipairs(packageStorage:GetChildren()) do
if otherPackage.Name:match(("^%s_"):format(package.Name)) then
if version == getPackageVersion(otherPackage) then
existingVersion = otherPackage
break
end
end
end
if not existingVersion then
local clone = package:Clone()
clone.Parent = packageStorage
clone.Name = ("%s_%s"):format(clone.Name, version)
existingVersion = clone
end
-- Link the package with the existing version (which was either
-- there previously, or is the one we just generated)
local packageRef = script.PackageRef:Clone()
packageRef.Name = package.Name
packageRef.Package.Value = existingVersion
packageRef.Parent = package.Parent
package:Destroy()
log("link", ('%s <-> %s'):format(package.Name, existingVersion:GetFullName()))
end
end
end
|
-- Returns module (possibly nil) and success code to differentiate returning nil due to error vs Scriptable
|
function ControlModule:SelectComputerMovementModule()
if not (UserInputService.KeyboardEnabled or UserInputService.GamepadEnabled) then
return nil, false
end
local computerModule = nil
local DevMovementMode = Players.LocalPlayer.DevComputerMovementMode
if DevMovementMode == Enum.DevComputerMovementMode.UserChoice then
computerModule = computerInputTypeToModuleMap[lastInputType]
if UserGameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove and computerModule == Keyboard then
-- User has ClickToMove set in Settings, prefer ClickToMove controller for keyboard and mouse lastInputTypes
computerModule = ClickToMove
end
else
-- Developer has selected a mode that must be used.
computerModule = movementEnumToModuleMap[DevMovementMode]
-- computerModule is expected to be nil here only when developer has selected Scriptable
if (not computerModule) and DevMovementMode ~= Enum.DevComputerMovementMode.Scriptable then
warn("No character control module is associated with DevComputerMovementMode ", DevMovementMode)
end
end
if computerModule then
return computerModule, true
elseif DevMovementMode == Enum.DevComputerMovementMode.Scriptable then
-- Special case where nil is returned and we actually want to set self.activeController to nil for Scriptable
return nil, true
else
-- This case is for when computerModule is nil because of an error and no suitable control module could
-- be found.
return nil, false
end
end
|
-- GlobalUpdates object:
|
local GlobalUpdates = {
--[[
_updates_latest = {}, -- [table] {update_index, {{update_id, version_id, update_locked, update_data}, ...}}
_pending_update_lock = {update_id, ...} / nil, -- [table / nil]
_pending_update_clear = {update_id, ...} / nil, -- [table / nil]
_new_active_update_listeners = [ScriptSignal] / nil, -- [table / nil]
_new_locked_update_listeners = [ScriptSignal] / nil, -- [table / nil]
_profile = Profile / nil, -- [Profile / nil]
_update_handler_mode = true / nil, -- [bool / nil]
--]]
}
GlobalUpdates.__index = GlobalUpdates
|
--[[Made by BINARYTESTLAB. This script is decoded
using BINARYTESTLAB V5.67. Originally script made by
UttermostExedra]]
| |
--[[**
ensures Roblox Ray type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.Ray = primitive("Ray")
|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
clicker = true
end
function DoorOpen()
while Shaft11.MetalDoor.Transparency < 1.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft11.MetalDoor.CanCollide = false
end
|
--GreenEgg--
|
EggEvent.Hitbox.Touched:Connect(function(hit)
if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired2 then
if game.ReplicatedStorage.ItemSwitching.Value == true then
hit.Parent:Destroy()
end
EggEvent.SoundPart.Insert:Play()
EggEvent.GreenEgg.Transparency = 0
EggEvent.LocksLeft.Value = EggEvent.LocksLeft.Value - 1
script.Disabled = true
EggEvent.Hitbox.GreenEggHint:Destroy()
end
end)
EggEvent.Hitbox.ClickDetector.MouseClick:Connect(function(plr)
if plr.Backpack:FindFirstChild(ToolRequired2) then
if game.ReplicatedStorage.ItemSwitching.Value == true then
plr.Backpack:FindFirstChild(ToolRequired2):Destroy()
end
EggEvent.SoundPart.Insert:Play()
EggEvent.GreenEgg.Transparency = 0
EggEvent.LocksLeft.Value = EggEvent.LocksLeft.Value - 1
script.Disabled = true
EggEvent.Hitbox.GreenEggHint:Destroy()
end
end)
|
-- Functions
|
local function sendItemToStorage(toolToTransfer)
-- Send item to the weapon storage
local iContainer = mFrame.Parent
local folder_prefabs = game.ReplicatedStorage.Prefabs
local prefab_itemSlot = folder_prefabs.ItemSlot
local itemSlot = prefab_itemSlot:Clone()
itemSlot.Parent = iContainer
itemSlot.equip.Text = toolToTransfer.Name
itemSlot.ItemName.Value = toolToTransfer.Name
toolToTransfer:Destroy()
end
local function equipItem()
-- Dequip current item in player
for i, obj in pairs(char:GetChildren()) do
if obj:IsA("Tool") then
sendItemToStorage(obj)
end
end
for i, obj in pairs(plr.Backpack:GetChildren()) do
if obj:IsA("Tool") then
sendItemToStorage(obj)
end
end
-- Equip item
local itemRegistry = game.ReplicatedStorage.ItemRegistry
local itemToEquip = itemRegistry:FindFirstChild(value_item.Value)
local itemClone = itemToEquip:Clone()
itemClone.Parent = plr.Backpack
mFrame:Destroy()
end
|
-- скрипт для установки фильтра
|
me = script.Parent
button = me.Parent.Name
filter = me.Parent.Parent.Parent.Parent.Filters
local function onButtonActivated()
if filter.Value == button then
filter.Value="" -- очистить если уже выбрано
else
filter.Value=button -- установить фильтр
end
|
--[=[
@param obj any
Throws an error if `obj` is not an Option.
]=]
|
function Option.Assert(obj)
assert(Option.Is(obj), "Result was not of type Option")
end
|
--!strict
|
local T = require(script.Parent.Parent.Types)
local toSet = require(script.Parent.toSet)
local toArray = require(script.Parent.Parent.Set.toArray)
local setDifferenceSymmetric = require(script.Parent.Parent.Set.differenceSymmetric)
|
--[[
Begins a Promise chain, turning synchronous errors into rejections.
]]
|
function Promise.try(...)
return Promise._try(debug.traceback(nil, 2), ...)
end
Promise.Try = Promise.try
|
--// Damage Settings
|
BaseDamage = 235; -- Torso Damage
LimbDamage = 164; -- Arms and Legs
ArmorDamage = 164; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 702; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--Destroy the holster if player drops this tool
--workspace.ChildAdded:Connect(function(item)
-- if item==Tool then
-- if Holster then
-- Holster:Destroy()
-- print("Destroying holster!!!")
-- end
-- end
--end)
| |
-- constants
|
local PLAYER = Players.LocalPlayer
return function(character)
local rootPart = character.UpperTorso
local emitter = script.TicketEmitter:Clone()
emitter.Parent = rootPart
emitter:Emit(40)
Debris:AddItem(emitter, 4)
end
|
--[=[
Returns a Service object which is a reflection of the remote objects
within the Client table of the given service. Throws an error if the
service is not found.
If a service's Client table contains RemoteSignals and/or RemoteProperties,
these values are reflected as
[ClientRemoteSignals](https://sleitnick.github.io/RbxUtil/api/ClientRemoteSignal) and
[ClientRemoteProperties](https://sleitnick.github.io/RbxUtil/api/ClientRemoteProperty).
```lua
-- Server-side service creation:
local MyService = Knit.CreateService {
Name = "MyService",
Client = {
MySignal = Knit.CreateSignal(),
MyProperty = Knit.CreateProperty("Hello"),
},
}
function MyService:AddOne(player, number)
return number + 1
end
-------------------------------------------------
-- Client-side service reflection:
local MyService = Knit.GetService("MyService")
-- Call a method:
local num = MyService:AddOne(5) --> 6
-- Fire a signal to the server:
MyService.MySignal:Fire("Hello")
-- Listen for signals from the server:
MyService.MySignal:Connect(function(message)
print(message)
end)
-- Observe the initial value and changes to properties:
MyService.MyProperty:Observe(function(value)
print(value)
end)
```
:::caution
Services are only exposed to the client if the service has remote-based
content in the Client table. If not, the service will not be visible
to the client. `KnitClient.GetService` will only work on services that
expose remote-based content on their Client tables.
:::
]=]
|
function KnitClient.GetService(serviceName: string): Service
local service = services[serviceName]
if service then
return service
end
assert(started, "Cannot call GetService until Knit has been started")
assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName))
return BuildService(serviceName)
end
|
--RedEgg--
|
Event.Hitbox.Touched:Connect(function(hit)
if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired1 then
if game.ReplicatedStorage.ItemSwitching.Value == true then
hit.Parent:Destroy()
end
Event.RedGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
Event.Hitbox.ClickDetector.MouseClick:Connect(function(plr)
if plr.Backpack:FindFirstChild(ToolRequired1) then
if game.ReplicatedStorage.ItemSwitching.Value == true then
plr.Backpack:FindFirstChild(ToolRequired1):Destroy()
end
Event.RedGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
|
-- when a player clicks on the vending machine, ask if they want to buy bloxy cola
|
script.Parent.ClickDetector.MouseClick:connect(function(player)
game:GetService("InsertService"):LoadAsset(10472779):WaitForChild("BloxyCola").Parent = player.Backpack
end)
|
-- Start the server-side sync module
--[[SyncModule = require(SyncAPI:WaitForChild 'SyncModule');
-- Provide functionality to the server API endpoint instance
ServerEndpoint.OnServerInvoke = function (Client, ...)
return SyncModule.PerformAction(Client, ...);
end;--]]
| |
--[[
A show of two tracks begins on every hour.
When there is not a show going on, the PreShowVenue will be active.
]]
|
local replicatedStorage = game:GetService("ReplicatedStorage")
local EventSequencer = require(replicatedStorage:WaitForChild("EventSequencer"))
local scenesFolder = replicatedStorage:WaitForChild("SequencerScenes")
local PSV_SCENE = scenesFolder:WaitForChild("PreShowVenue")
local SHOW_SCENES = {
scenesFolder:WaitForChild("Track1"),
scenesFolder:WaitForChild("Track2"),
}
local year = 2022
local month = 6
local day = 1
local hour = 0
local minute = 0
local second = 0
local millisecond = 0
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 840 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 950 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 7500 -- Use sliders to manipulate values
Tune.Redline = 9400
Tune.EqPoint = 9400
Tune.PeakSharpness = 9.4
Tune.CurveMult = 0.13
--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)
|
--//Server Animations
|
RightHighReady = CFrame.new(-1, -1, -1.4) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0));
LeftHighReady = CFrame.new(.85,-0.35,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15));
RightLowReady = CFrame.new(-1, 0.5, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0));
LeftLowReady = CFrame.new(1.25,1.15,-1.35) * CFrame.Angles(math.rad(-60),math.rad(35),math.rad(-25));
RightPatrol = CFrame.new(-1, -.35, -1.5) * CFrame.Angles(math.rad(-80), math.rad(-80), math.rad(0));
LeftPatrol = CFrame.new(1,1.25,-.75) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25));
RightAim = CFrame.new(-.575, 0.1, -1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0));
LeftAim = CFrame.new(1.4,0.25,-1.45) * CFrame.Angles(math.rad(-120),math.rad(35),math.rad(-25));
RightSprint = CFrame.new(-1, 0.5, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0));
LeftSprint = CFrame.new(1.25,1.15,-1.35) * CFrame.Angles(math.rad(-60),math.rad(35),math.rad(-25));
ShootPos = CFrame.new(0,0,.25);
}
return module
|
-- constants
|
local PLAYER_DATA = ReplicatedStorage.PlayerData
local TIER_SKIP_ID = 0
local CURRENCY_IDS = {
[0] = 100;
[0] = 250;
[0] = 500;
[0] = 1000;
[0] = 5000;
[0] = 10000;
}
|
--!strict
|
local INDENT = " "
local inspect = require(script.Parent.Parent.util).inspect
return function()
local console = {}
local indentDepth = 0
local function indent()
return string.rep(INDENT, indentDepth)
end
function console.log(content, ...)
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
print(indent() .. message)
end
function console.debug(content, ...)
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
print(indent() .. message)
end
function console.info(content, ...)
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
print(indent() .. message)
end
function console.warn(content, ...)
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
warn(indent() .. message)
end
function console.error(content, ...)
-- JS' `console.error` doesn't interrupt execution like Lua's `error`,
-- which is more similar to throwing an exception in JS.
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
warn(indent() .. message)
end
function console.group(content, ...)
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
print(indent() .. message)
indentDepth = indentDepth + 1
end
function console.groupCollapsed(content, ...)
-- There's no smart console, so this is equivalent to `console.group`
local message
if typeof(content) == "string" then
message = string.format(content, ...)
else
message = inspect(content)
end
print(indent() .. message)
indentDepth = indentDepth + 1
end
function console.groupEnd()
if indentDepth > 0 then
indentDepth = indentDepth - 1
end
end
return console
end
|
-- Detect mode
|
Mode = Plugin and 'Plugin' or 'Tool';
|
--> VARIABLES
|
local Player = nil
local Touched = false
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function openInfoGui()
InfoFrame.Visible = true
if not (blurEffect) then
blurEffect = Instance.new("BlurEffect")
blurEffect.Size = 12
blurEffect.Parent = game.Lighting
end
end -- openInfoGui()
local function exitInfoGui()
if blurEffect then
blurEffect:Destroy()
blurEffect = false
end
InfoFrame.Visible = false
end -- exitInfoGui
local function moveModelForViewport(model)
-- Performed only to reset model orientation, position does not matter
model:MoveTo(MODEL_POSITION)
-- Set position so that all models have the same orientation and position
model.PrimaryPart = model:FindFirstChild("Body")
if model.PrimaryPart then
model:SetPrimaryPartCFrame(MODEL_CFRAME)
end
end -- moveModelForViewport()
local function highlightViewport(viewport)
for _, child in ipairs(Container:GetChildren()) do
if child:IsA("ViewportFrame") then
if child == viewport then
child.BorderColor3 = Color3.new(15/255, 128/255, 255/255)
else
child.BorderColor3 = Color3.new(1, 1, 1)
end
end
end
end
local function unselectButtons()
local viewports = Container:GetChildren()
for _, viewport in ipairs(viewports) do
if viewport:IsA("ViewportFrame") then
local button = viewport:FindFirstChild("Button")
if button ~= nil then
button.Image = "rbxassetid://4079511969"
end
end
end
end -- unselectButton()
local function clearSelected()
highlightViewport(nil)
Selected:FindFirstChild("Garage").Value = nil
local selectedModels = Selected:GetChildren()
for _, child in ipairs(selectedModels) do
if child:IsA("Model") then
child:Destroy()
end
end
SelectedName.Text = ""
end -- clearSelected()
local function exit()
if InfoFrame.Visible == true then return end
SelectionFrame.Visible = false
unselectButtons()
highlightViewport(nil)
clearSelected()
SelectedMode.Value = ""
end -- exit()
local function exitSpeeder()
ContextActionService:UnbindAction("ExitSpeeder")
RemoveActivePlayer:FireServer()
local raceStatus = RaceManager:GetRaceStatus()
if not TopBar.Enabled or (raceStatus ~= RaceManager.Status.WaitingForPlayers and
raceStatus ~= RaceManager.Status.WaitingForRaceToStart) then
PlayerConverter:SpeederToPlayer()
end
end -- exit()
local function makeSelection()
-- Get selection
local selection = Selected:FindFirstChild("Garage").Value
if not selection then return end
-- Act according to selected game mode
if SelectedMode.Value == "FreeFlight" then
PlayerConverter:PlayerToSpeeder(selection)
elseif SelectedMode.Value == "Racing" then
-- Add player to ActivePlayer of PlayerManager for the RaceModules
AddActivePlayer:FireServer(selection)
-- Show racing GUIs
local PlayerGui = player.PlayerGui
local TopBar = PlayerGui:FindFirstChild("TopBar")
TopBar.Enabled = true
end
-- Keybinding to exit
ContextActionService:BindAction("ExitSpeeder", exitSpeeder, false, KEY1)
-- Close window
exit()
end -- makeSelection()
local function populateList(folder)
local count = 0
for index, item in ipairs(folder:GetChildren()) do
if item:IsA("Model") then
count = count + 1
-- List is populated with ViewportFrames displaying the folder's models
local viewport = Instance.new("ViewportFrame")
viewport.Name = tostring(count)
viewport.Parent = Container
viewport.LayoutOrder = 5
viewport.ZIndex = 2
viewport.BackgroundTransparency = 1
viewport.ClipsDescendants = true
-- Create camera for ViewportFrame
local camera = Instance.new("Camera")
camera.Parent = viewport
camera.FieldOfView = 30
viewport.CurrentCamera = camera
-- Point to (server-side) model
local newGarageModel = Instance.new("ObjectValue")
newGarageModel.Parent = viewport
newGarageModel.Name = "Garage"
newGarageModel.Value = item
-- Clone model and part it to the ViewportFrame
local newItem = item:clone()
newItem.Parent = viewport
-- Move model so that all model viewports are from the same angle
moveModelForViewport(newItem)
local primary = newItem.PrimaryPart
local primarySize = primary.Size
-- Adjust camera to look at the model
local cameraPosition = primary.Position + Vector3.new(0, primarySize.Y + 10, -primarySize.Z*1.8)
camera.CFrame = CFrame.new(cameraPosition, newItem.PrimaryPart.Position)
-- Overlay viewport with a button
local button = Instance.new("ImageButton")
button.Name = "Button"
button.Parent = viewport
button.Size = UDim2.new(1,0,1,0)
button.BackgroundTransparency = 1
button.Image = "rbxassetid://4079511969"
button.HoverImage = "rbxassetid://4079512099"
button.PressedImage = "rbxassetid://4079512099"
button.Activated:Connect(function()
local selection = Selected:FindFirstChild(SelectedName.Text)
local garageModel = Selected:FindFirstChild("Garage")
clearSelected()
unselectButtons()
button.Image = "rbxassetid://4079512099"
garageModel.Value = newGarageModel.Value
local selectedItem = newItem:clone()
selectedItem.Parent = Selected
SelectedName.Text = string.upper(selectedItem.Name)
local primary = selectedItem.PrimaryPart
local primarySize = primary.Size
local cameraPosition = newItem.PrimaryPart.Position + Vector3.new(0, primarySize.Y + 15, -primarySize.Z*1.8)
SelectedCamera.CFrame = CFrame.new(cameraPosition, newItem.PrimaryPart.Position)
end)
end
-- Scale ScrollingFrame to fit list
Container.CanvasSize = UDim2.new(1*math.ceil(count/6), 0, 0, 0)
UIGridLayout.CellSize = UDim2.new((1/3)/math.ceil(count/6), -4, 0.5, -2)
end
end -- populateList()
|
-- Expanding the blood part size function
|
local expandBlood = function(part)
local randomIncrement = math.random(5, 10) / 10
local tween = tweenPartSize(part, 5, Enum.EasingDirection.Out, Vector3.new(part.Size.X + randomIncrement, 0.1, part.Size.Z + randomIncrement))
spawn(function()
tween.Completed:Wait()
tween:Destroy()
end)
end
|
-- Função para mover o NPC para uma posição aleatória
|
function moveToRandomPosition()
local x = math.random(-100, 100)
local y = 0
local z = math.random(-100, 100)
local position = Vector3.new(x, y, z)
humanoid:MoveTo(position)
end
|
-- [[ Dummiez's Data Store Score Board ]]
-- This script updates the Data store with the values from the remote function.
|
wait(1)
local score = game:GetService("DataStoreService"):GetOrderedDataStore(script.DataStore.Value)
function script.UploadScore.OnServerInvoke(player)
print("working")
local inv = player:FindFirstChild(script.Original.Value)
local storedValue = inv:FindFirstChild(script.Score.Value).Value ~= 0 and math.floor(math.log(inv:FindFirstChild(script.Score.Value).Value) / math.log(1.0000001)) or 0
score:SetAsync(player.Name,storedValue)
--score:SetAsync(player.Name, inv:FindFirstChild(script.Score.Value).Value)
print("worked")
end
|
-- local hit, position = workspace:FindPartOnRayWithIgnoreList(ray, ignoreList)
|
local hit, position = workspace:FindPartOnRay(ray, parts.Parent);
if hit then -- Leaderboard Supported
if hit.Parent:IsA("Model") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent);
local DriverKOs = script.Parent.Parent.Parent.leaderstats:findFirstChild("KOs")
local humanoid = hit.Parent:findFirstChild("Humanoid");
print("XD")
if player and humanoid then
if player.TeamColor ~= parts.Parent.Tank.Value then --Not a teammate
if humanoid.Health >0 then
humanoid:takeDamage(MGDamage);
if humanoid.Health <=0 then
DriverKOs.Value = DriverKOs.Value + 1
end
end
end
end
end
end
local distance = (position - machineGun.Position).magnitude;
local rayPart = rayPart:clone();
rayPart.Size = Vector3.new(.2, distance, .2);
rayPart.CFrame = CFrame.new(position, machineGun.Position)
* CFrame.new(0, 0, -distance/2)
* CFrame.Angles(math.rad(90),0,0);
rayPart.Parent = workspace;
game.Debris:AddItem(rayPart, .03)
game.Debris:AddItem(PL, .03)
local MGFlash = parts.Parent.Gun.Coax.GUI:clone()
MGFlash.Flash.Rotation = math.random(0,360)
MGFlash.Parent = parts.Parent.Gun.Coax
MGFlash.Enabled = true
game.Debris:AddItem(MGFlash,.01)
wait();
wait();
return true;
end
|
--------END RIGHT DOOR --------
|
game.Workspace.audiencebackleft1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackleft1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part1.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part2.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part4.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part5.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part7.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part8.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.post1.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.post2.Light.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
end
wait(0.25)
until game.Workspace.DoorFlashing.Value == false
end
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Map storing Player -> Blocked user Ids.
|
local BlockedUserIdsMap = {}
PlayersService.PlayerAdded:connect(function(newPlayer)
for player, blockedUsers in pairs(BlockedUserIdsMap) do
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUsers do
local blockedUserId = blockedUsers[i]
if blockedUserId == newPlayer.UserId then
speaker:AddMutedSpeaker(newPlayer.Name)
end
end
end
end
end)
PlayersService.PlayerRemoving:connect(function(removingPlayer)
BlockedUserIdsMap[removingPlayer] = nil
end)
EventFolder.SetBlockedUserIdsRequest.OnServerEvent:connect(function(player, blockedUserIdsList)
BlockedUserIdsMap[player] = blockedUserIdsList
local speaker = ChatService:GetSpeaker(player.Name)
if speaker then
for i = 1, #blockedUserIdsList do
local blockedPlayer = PlayersService:GetPlayerByUserId(blockedUserIdsList[i])
if blockedPlayer then
speaker:AddMutedSpeaker(blockedPlayer.Name)
end
end
end
end)
EventFolder.GetInitDataRequest.OnServerInvoke = (function(playerObj)
local speaker = ChatService:GetSpeaker(playerObj.Name)
if not (speaker and speaker:GetPlayer()) then
CreatePlayerSpeakerObject(playerObj)
speaker = ChatService:GetSpeaker(playerObj.Name)
end
local data = {}
data.Channels = {}
data.SpeakerExtraData = {}
for i, channelName in pairs(speaker:GetChannelList()) do
local channelObj = ChatService:GetChannel(channelName)
if (channelObj) then
local channelData =
{
channelName,
channelObj:GetWelcomeMessageForSpeaker(speaker),
channelObj:GetHistoryLogForSpeaker(speaker),
channelObj.ChannelNameColor,
}
table.insert(data.Channels, channelData)
end
end
for i, oSpeakerName in pairs(ChatService:GetSpeakerList()) do
local oSpeaker = ChatService:GetSpeaker(oSpeakerName)
data.SpeakerExtraData[oSpeakerName] = oSpeaker.ExtraData
end
return data
end)
local function DoJoinCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (channel) then
if (channel.Joinable) then
if (not speaker:IsInChannel(channel.Name)) then
speaker:JoinChannel(channel.Name)
else
speaker:SetMainChannel(channel.Name)
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_SwitchChannel_NowInChannel",
string.format("You are now chatting in channel: '%s'", channel.Name)
),
"{RBX_NAME}",channel.Name),
channel.Name
)
end
else
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatServiceRunner_YouCannotJoinChannel",
("You cannot join channel '" .. channelName .. "'.")
),
"{RBX_NAME}",channelName),
fromChannelName
)
end
else
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatServiceRunner_ChannelDoesNotExist",
("Channel '" .. channelName .. "' does not exist.")
),
"{RBX_NAME}",channelName),
fromChannelName
)
end
end
end
local function DoLeaveCommand(speakerName, channelName, fromChannelName)
local speaker = ChatService:GetSpeaker(speakerName)
local channel = ChatService:GetChannel(channelName)
if (speaker) then
if (speaker:IsInChannel(channelName)) then
if (channel.Leavable) then
speaker:LeaveChannel(channel.Name)
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatService_YouHaveLeftChannel",
string.format("You have left channel '%s'", channelName)
),
"{RBX_NAME}",channel.Name),
"System"
)
else
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatServiceRunner_YouCannotLeaveChannel",
("You cannot leave channel '" .. channelName .. "'.")
),
"{RBX_NAME}",channelName),
fromChannelName
)
end
else
speaker:SendSystemMessage(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatServiceRunner_YouAreNotInChannel",
("You are not in channel '" .. channelName .. "'.")
),
"{RBX_NAME}",channelName),
fromChannelName
)
end
end
end
ChatService:RegisterProcessCommandsFunction("default_commands", function(fromSpeaker, message, channel)
if (string.sub(message, 1, 6):lower() == "/join ") then
DoJoinCommand(fromSpeaker, string.sub(message, 7), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/j ") then
DoJoinCommand(fromSpeaker, string.sub(message, 4), channel)
return true
elseif (string.sub(message, 1, 7):lower() == "/leave ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 8), channel)
return true
elseif (string.sub(message, 1, 3):lower() == "/l ") then
DoLeaveCommand(fromSpeaker, string.sub(message, 4), channel)
return true
elseif (string.sub(message, 1, 3) == "/e " or string.sub(message, 1, 7) == "/emote ") then
-- Just don't show these in the chatlog. The animation script listens on these.
return true
end
return false
end)
if ChatSettings.GeneralChannelName and ChatSettings.GeneralChannelName ~= "" then
local allChannel = ChatService:AddChannel(ChatSettings.GeneralChannelName)
allChannel.Leavable = false
allChannel.AutoJoin = true
allChannel:RegisterGetWelcomeMessageFunction(function(speaker)
if RunService:IsStudio() then
return nil
end
local player = speaker:GetPlayer()
if player then
local success, canChat = pcall(function()
return Chat:CanUserChatAsync(player.UserId)
end)
if success and not canChat then
return ""
end
end
end)
end
local systemChannel = ChatService:AddChannel("System")
systemChannel.Leavable = false
systemChannel.AutoJoin = true
systemChannel.WelcomeMessage = ChatLocalization:Get("GameChat_ChatServiceRunner_SystemChannelWelcomeMessage","This channel is for system and game notifications.")
systemChannel.SpeakerJoined:connect(function(speakerName)
systemChannel:MuteSpeaker(speakerName)
end)
local function TryRunModule(module)
if module:IsA("ModuleScript") then
local ret = require(module)
if (type(ret) == "function") then
ret(ChatService)
end
end
end
local modules = game:GetService("Chat"):WaitForChild("ChatModules")
modules.ChildAdded:connect(function(child)
local success, returnval = pcall(TryRunModule, child)
if not success and returnval then
print("Error running module " ..child.Name.. ": " ..returnval)
end
end)
for i, module in pairs(modules:GetChildren()) do
local success, returnval = pcall(TryRunModule, module)
if not success and returnval then
print("Error running module " ..module.Name.. ": " ..returnval)
end
end
local Players = game:GetService("Players")
Players.PlayerRemoving:connect(function(playerObj)
if (ChatService:GetSpeaker(playerObj.Name)) then
ChatService:RemoveSpeaker(playerObj.Name)
end
end)
|
---- Initialization ----
|
Wave.Enable(true)
Wave.SetSetting("Debug", true)
|
-- local PIPE = "|"
-- local REPEATABLE_HEADING = ("(%s%s)*"):format(PIPE, HEADING)
-- local HEADINGS_FORMAT = START_OF_LINE .. NEWLINE .. HEADING .. REPEATABLE_HEADING .. NEWLIN
|
local END_OF_LINE = "$"
local HEADINGS_FORMAT = START_OF_LINE .. HEADING .. END_OF_LINE
|
-- Create and configure the fire
|
local function createFire()
local fire = Instance.new("Fire")
fire.Enabled = false
fire.Size = 10
return fire
end
|
--[[Weight and CG]]
|
Tune.Weight = 2780 -- 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
|
--[[Sword Part Class]]
|
--
local SwordPart =
{
Damage = 15,
AttackTime = 1,
CoolDown = 1,
LastSwing = 0,
LastHit = 0,
Part= nil,
Owner = nil,--player object that owns this sword
OnHit = nil,
OnHitHumanoid = nil,
OnAttackReady = nil,
OnAttack = nil,
SwingSound = nil,
HitSound = nil,
SwingAnimation = nil, --animation track!
ActiveConnections = {},
}
do
UTIL.MakeClass(SwordPart)
function SwordPart.New(npart,nowner)
local init= UTIL.DeepCopy(SwordPart)
init.Part= npart
init.Owner = nowner
table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
init.OnHit = InternalEvent.New()
init.OnHitHumanoid = InternalEvent.New()
init.OnAttackReady = InternalEvent.New()
init.OnAttack = InternalEvent.New()
return init
end
function SwordPart:SwordTouch(hit)
if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
self.OnHit:Fire(hit)
local character,humanoid = UTIL.FindCharacterAncestor(hit)
if character and character ~= self.Owner.Character then
humanoid:TakeDamage(self.Damage)
self.OnHitHumanoid:Fire(humanoid,hit)
self.LastHit = tick()
if self.HitSound then
self.HitSound:Play()
end
end
end
function SwordPart:DoSwing()
if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
return
end
if self.SwingAnimation then
self.SwingAnimation:Play()
end
if self.SwingSound then
self.SwingSound:Play()
end
self.LastSwing = tick()
self.OnAttack:Fire()
end
function SwordPart:Destroy()
for _,i in pairs(self.ActiveConnections) do
i:disconnect()
end
end
end
do
local Handle = script.Parent
local Tool = Handle.Parent
local Player = game.Players.LocalPlayer
local Character = UTIL.WaitForValidCharacter(Player)
local SwingAni = UTIL.Instantiate"Animation"
{AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
local HitSound = Handle:WaitForChild('Hit')
local SwingSound = Handle:WaitForChild('Swing')
local SwingAniTrack
local Sword
Tool.Equipped:connect(function(mouse)
Sword = SwordPart.New(Handle,Player)
Sword.Damage = 15
Sword.HitSound = HitSound
Sword.SwingSound = SwingSound
Character = UTIL.WaitForValidCharacter(Player)
local Humanoid = Character:FindFirstChild('Humanoid')
SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
Sword.SwingAnimation = SwingAniTrack
Sword.OnHitHumanoid:Connect(function(humanoid,hit)
local myTorso = Character:FindFirstChild('Torso')
local torso = humanoid.Parent:FindFirstChild('Torso')
if not torso or not myTorso then return end
if hit.Name=='Right Arm' or hit.Name=='Left Arm' or hit.Name=='Right Leg' or hit.Name=='Left Leg' then
hit:WeldJoints()
WeldUtil.WeldBetween(hit, Handle)
delay(1,function() hit:WeldJoints() end )
end
end)
mouse.Button1Down:connect(function()
Sword:DoSwing()
end)
end)
Tool.Unequipped:connect(function()
Sword:Destroy()
end)
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.CatAgility -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/pretty-format/src/plugins/lib/escapeHTML.ts
--[[*
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]]
|
local exports = {}
local function escapeHTML(str: string): string
return str:gsub("<", "<"):gsub(">", ">")
end
exports.default = escapeHTML
return exports
|
-----1-----
|
script.Sound:Play()
print("BOOM!!")
game.Lighting.Brightness = 2
wait(2.2)
game.Lighting.Brightness = 1
wait(0.3)
game.Lighting.Brightness = 2
wait(2)
game.Lighting.Brightness = 1
wait(10)
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Character.Stats.Lives.Value > 0
end
|
-- / Functions / --
|
local function CreateNoise(GridX, GridZ, Seed)
local GridY = math.noise(
(GridX * Configuration.Frequency.Value) / 10,
(GridZ * Configuration.Frequency.Value) / 10,
Seed
) * Random.new():NextNumber(19.5, 20)
return (GridY)
end
local function CreateNewGrass(Size, Position, Parent)
local ExistingBlock = Parent:FindFirstChild(Position.X..", "..Position.Z)
if ExistingBlock then
print("existing")
else
local Block = Instance.new("Part")
Block.Parent = Parent
-- / Properties / --
Block.Name = Position.X..", "..Position.Z
Block.Anchored = true
Block.Size = Size
Block.Position = Position
-- / Visuals / --
if Block.Position.Y <= -1 then
Block.Color = Color3.fromRGB(255, 220, 114)
Block.Material = Enum.Material.Sand
elseif Block.Position.Y > -1 and Block.Position.Y <= 1.25 then
Block.Color = Color3.fromRGB(100, 100, 100)
Block.Material = Enum.Material.Rock
else
Block.Color = Color3.fromRGB(0, 85, 0)
Block.Material = Enum.Material.Grass
end
end
---game.Workspace.Terrain:FillBlock(CFrame.new(Position), Size, Enum.Material.Grass)
end
local function CreateNewChunk(ChunkPositionX, ChunkPositionZ)
if not Chunks:FindFirstChild(ChunkPositionX..", "..ChunkPositionZ) then
print(ChunkPositionX..", "..ChunkPositionZ)
local NewChunk = Instance.new("StringValue")
NewChunk.Parent = Chunks
NewChunk.Name = ChunkPositionX..", "..ChunkPositionZ
local Water = game.Workspace.Terrain:FillBlock(CFrame.new(ChunkPositionX, -10, ChunkPositionZ), Vector3.new(Configuration.ChunkSize.Value, 16, Configuration.ChunkSize.Value), Enum.Material.Water)
for iX = ChunkPositionX + (Configuration.ChunkSize.Value / 2), (ChunkPositionX - (Configuration.ChunkSize.Value / 2)) + 4, -Configuration.Grid.Value do
for iZ = ChunkPositionZ + (Configuration.ChunkSize.Value / 2), (ChunkPositionZ - (Configuration.ChunkSize.Value / 2)) + 4, -Configuration.Grid.Value do
local GridY = CreateNoise(iX, iZ)
CreateNewGrass(Configuration.GrassSize.Value, Vector3.new(iX, GridY, iZ), NewChunk)
end
task.wait()
end
end
end
if not Chunks:FindFirstChild("0, 0") then
CreateNewChunk(0, 0)
end
|
---vars
|
local Template = script.Template
local Plr = script.Parent.Parent.Parent
local CarStorage = game.ReplicatedStorage.Vehicles
local ScrollFrame = script.Parent.MainFrame.ScrollingFrame
|
--------END RIGHT DOOR --------
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(21)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(21)
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- AI.Head:BreakJoints()
|
if Hit.Name ~= "Torso" and Hit.Name ~= "Head" then
else
Hit.Parent.Humanoid:TakeDamage(0)
end -- kill
Logic = 0
Hit = nil
elseif Hit.Parent.Name == AIName then
|
-- тут надо бы проверить, нет ли параметра таймера?!
| |
--Beta SpeedAI June 2012 -- Still has logic bugs - Look for updates..
-- Kill added.
-- co-operate/other "AI"s
-- Climb "Truss" Parts
-- Offset Ray
-- Swim - Does not work. Don't know why.
-- Adjusted Jump Ray
-- Ray Graphics On/Off - flip line 90
-- Delay next cycle, if Falling.
-- Diagonal movement - I should add right-hand logic as well...
|
local number = 1 + math.random()
local BRAINWave = .6 -- AND line 38: Wait() between cycles of main loop
local hum = nil -- Will be a pointer to the Humanoid of our AI.
wait(number) -- hold on a sec. and spread multiple instances.
|
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Song.Text = "PRESET 2"
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Title.Text = ""
|
elseif carSeat.Stations.mood.Value == 2 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 3
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
else
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
-- A stack of sets where newly created dependencies should be stored.
|
local initialisedStack: {Set<PubTypes.Dependency>} = {}
local initialisedStackSize = 0
return {
dependencySet = dependencySet,
initialisedStack = initialisedStack,
initialisedStackSize = initialisedStackSize
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.