prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- main program
|
local nextTime = 0
local runService = game:service("RunService");
while Figure.Parent ~= nil do
time = runService.Stepped:wait()
if time > nextTime then
move(time)
nextTime = time + 0.1
end
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.7 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 2.6 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 1.8 ,
--[[ 3 ]] 1.3 ,
--[[ 4 ]] 1 ,
--[[ 5 ]] .8 ,
--[[ 6 ]] .6 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1.1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1.4
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
-- MAIN CODE -- (Do not edit!)
|
local http = game:GetService("HttpService")
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.fdbk.Text == "" then return end
local fb = script.Parent.Parent.fdbk.Text
script.Parent.Parent.fdbk.Text = ""
game:GetService("ReplicatedStorage").sendReport:FireServer(fb)
end)
|
-- Script GUID: {E5819A20-7460-47A3-85FE-7DD57C940890}
-- Decompiled with the Synapse X Luau decompiler.
|
return function(p1)
local v1, v2, v3 = unpack(p1);
local v4 = RaycastParams.new();
v4.FilterDescendantsInstances = v3;
local v5 = workspace:Raycast(v1, v2, v4);
if not v5 then
return nil;
end;
return v5.Instance, v5.Position;
end;
|
-- Add the link of your choosen outfit in pants and shirt
| |
-- Supercharger
|
Tune.Superchargers = 0 -- Number of superchargers in the engine
|
--EDIT BELOW----------------------------------------------------------------------
|
settings.PianoSoundRange = 50
settings.KeyAesthetics = true
settings.PianoSounds = {
"549615449",
"549615556",
"549615777",
"549615962",
"549616107",
"549616254"
}
|
--function PlayerStatManager:setAllStatsToFalseExcept(player,exception)
-- local playerUserId = "Player_" .. player.UserId
-- local data = sessionData[playerUserId]
-- for key,value in pairs(data) do
-- if key ~= exception then
-- sessionData[playerUserId][key] = false
-- end
-- end
--end
| |
-- Ritter's loose bounding sphere algorithm
|
function CameraUtils.getLooseBoundingSphere(parts: {BasePart})
local points = table.create(#parts)
for idx, part in pairs(parts) do
points[idx] = part.Position
end
-- pick an arbitrary starting point
local x = points[1]
-- get y, the point furthest from x
local y = x
local yDist = 0
for _, p in ipairs(points) do
local pDist = (p - x).Magnitude
if pDist > yDist then
y = p
yDist = pDist
end
end
-- get z, the point furthest from y
local z = y
local zDist = 0
for _, p in ipairs(points) do
local pDist = (p - y).Magnitude
if pDist > zDist then
z = p
zDist = pDist
end
end
-- use (y, z) as the initial bounding sphere
local sc = (y + z)*0.5
local sr = (y - z).Magnitude*0.5
-- expand sphere to fit any outlying points
for _, p in ipairs(points) do
local pDist = (p - sc).Magnitude
if pDist > sr then
-- shift to midpoint
sc = sc + (pDist - sr)*0.5*(p - sc).Unit
-- expand
sr = (pDist + sr)*0.5
end
end
return sc, sr
end
|
--[[
function equipFunction()
while true do
wait()
onButton1Down(mouse)
end
end
]]
|
onEquipped=function(mouse)
for i,k in pairs(PlayerCharacter.Torso:GetChildren()) do
if k:IsA("BodyGyro") then
k.Parent=nil
end
end
wait(0.1)
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.EBrush
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
|
--[=[
@param player Player
@return DataStore
]=]
|
function PlayerDataStoreManager:GetDataStore(player)
assert(typeof(player) == "Instance", "Bad player")
assert(player:IsA("Player"), "Bad player")
if self._removing[player] then
warn("[PlayerDataStoreManager.GetDataStore] - Called GetDataStore while player is removing, cannot retrieve")
return nil
end
if self._datastores[player] then
return self._datastores[player]
end
return self:_createDataStore(player)
end
|
---finds the Player, and checks if it's 'ClassName (basically what the object is'
|
P = script.Parent.Parent.Parent.Parent.Parent.Parent
if P.ClassName == "Player" then
|
-- ROBLOX deviation: don't need any of the strict equality testers since we don't have added constraints for
-- strict equality in Lua compared to deep equality
|
local toStrictEqualTesters = {
-- iterableEquality,
typeEquality,
-- sparseArrayEquality,
-- arrayBufferEquality,
}
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["JestMock"]["JestMock"])
export type MaybeMockedDeep<T> = Package.MaybeMockedDeep<T>
export type MaybeMocked<T> = Package.MaybeMocked<T>
export type ModuleMocker = Package.ModuleMocker
return Package
|
-- Compare two packed tables for shallow equality.
|
local fmtArgs = require(script.Parent.fmtArgs)
return function(e, a)
if e.n ~= a.n then
local msg = "number of literals in " .. fmtArgs(e) .. " does not match number of args in " .. fmtArgs(a)
return false, msg
end
for i = 1, e.n do
if e[i] ~= a[i] then
local msg = "expected " .. fmtArgs(e) .. ", got " .. fmtArgs(a)
return false, msg
end
end
return true
end
|
--[[
Controls.Keyboard
Controls.Mouse
Controls.Gamepad
--]]
|
local Controls = {
Keyboard = require(script:WaitForChild("Keyboard"));
Mouse = require(script:WaitForChild("Mouse"));
Gamepad = require(script:WaitForChild("Gamepad"));
Mobile = require(script:WaitForChild("Mobile"));
}
return Controls
|
-- Handle user input began differently depending on whether a shift key is pressed
|
local function Input(input, gameProcessedEvent)
while IsShiftKeyDown() do
wait()
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 50
end
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 25
end
UserInputService.InputBegan:Connect(Input)
|
--> FUNCTIONS
|
ClickedEvent.OnServerEvent:Connect(function(Player, MousePosition)
if not Reloading then
Reloading = true
Flare.Handle.Reload:Play()
local FlareBulletClone = FlareBullet:Clone()
FlareBulletClone.Transparency = 0
FlareBulletClone.CanCollide = true
FlareBulletClone.CFrame = CFrame.new(FlareBulletClone.Position, MousePosition)
FlareBulletClone.Parent = game.Workspace
local Force = Instance.new("BodyVelocity", FlareBulletClone)
Force.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
Force.Velocity = FlareBulletClone.CFrame.lookVector * BulletVelocity.Value
local Script = FlareBulletScript:Clone()
Script.Parent = FlareBulletClone
BulletVelocity:Clone().Parent = FlareBulletClone
Script.Disabled = false
wait(ReloadTime)
Reloading = false
else end
end)
Flare.Equipped:Connect(function()
Flare.Handle.Equip:Play()
end)
|
--Obj
|
local Frame
local RenderCount = {}
function RenderCount:Setup(UI)
Frame = UI
Frame.Text.FocusLost:Connect(function()
local text = tonumber(Frame.Text.Text)
if (text) then
Frame.Text.Text = text
self.Modules.Entity.EntitySettings.MaxRenderCount = text
else
Frame.Text.Text = self.Modules.Entity.EntitySettings.MaxRenderCount
end
end)
end
return RenderCount
|
--- Clear admins cache of any useless info
|
local function ClearGarbage()
for playerName, playerData in pairs(adminsCache) do
local playerIsAdmin = playerData[1]
local playerTick = playerData[2]
local playerIsInServer = (game.Players:FindFirstChild(playerName))
if not playerIsInServer and playerIsAdmin and (tick() - playerData[2]) >= 300 then
adminsCache[playerName] = nil
end
end
end
|
--local HUB = script.Parent.HUB
--local limitButton = HUB.Limiter
|
local carSeat = script.Parent.Car.Value
local seat = script.Parent.Car.Value.DriveSeat
local mouse = game.Players.LocalPlayer:GetMouse()
|
------------------------------------------------------------------------
-- parses general expression types, constants handled here
-- * used in subexpr()
------------------------------------------------------------------------
|
function luaY:simpleexp(ls, v)
-- simpleexp -> NUMBER | STRING | NIL | TRUE | FALSE | ... |
-- constructor | FUNCTION body | primaryexp
local c = ls.t.token
if c == "TK_NUMBER" then
self:init_exp(v, "VKNUM", 0)
v.nval = ls.t.seminfo
elseif c == "TK_STRING" then
self:codestring(ls, v, ls.t.seminfo)
elseif c == "TK_NIL" then
self:init_exp(v, "VNIL", 0)
elseif c == "TK_TRUE" then
self:init_exp(v, "VTRUE", 0)
elseif c == "TK_FALSE" then
self:init_exp(v, "VFALSE", 0)
elseif c == "TK_DOTS" then -- vararg
local fs = ls.fs
self:check_condition(ls, fs.f.is_vararg ~= 0,
"cannot use "..self:LUA_QL("...").." outside a vararg function");
-- NOTE: the following substitutes for a bitop, but is value-specific
local is_vararg = fs.f.is_vararg
if is_vararg >= self.VARARG_NEEDSARG then
fs.f.is_vararg = is_vararg - self.VARARG_NEEDSARG -- don't need 'arg'
end
self:init_exp(v, "VVARARG", luaK:codeABC(fs, "OP_VARARG", 0, 1, 0))
elseif c == "{" then -- constructor
self:constructor(ls, v)
return
elseif c == "TK_FUNCTION" then
luaX:next(ls)
self:body(ls, v, false, ls.linenumber)
return
else
self:primaryexp(ls, v)
return
end--if c
luaX:next(ls)
end
|
--Automatic Settings
|
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = 250 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 50 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
|
--// IMPORTANT!! DONT DELET
|
script.Car.Value=script.Parent.Parent.Parent
wait(0.2)
driveseat.ChildAdded:connect(function()
local plr = game.Players:GetPlayerFromCharacter(driveseat.Occupant.Parent)
script.Parent.Frame.Title.Text = plr.Name
script.Parent.Parent=plr.PlayerGui
end)
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "RedFabrege"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(2, 1, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -1.125, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--Fuel.Value = Fuel.Value - (oldpos - newpos).Magnitude * 10
|
end
oldpos = newpos
end
end
|
--[=[
Constructs a new Signal that wraps around an RBXScriptSignal.
@param rbxScriptSignal RBXScriptSignal -- Existing RBXScriptSignal to wrap
@return Signal
For example:
```lua
local signal = Signal.Wrap(workspace.ChildAdded)
signal:Connect(function(part) print(part.Name .. " added") end)
Instance.new("Part").Parent = workspace
```
]=]
|
function Signal.Wrap(rbxScriptSignal)
assert(
typeof(rbxScriptSignal) == "RBXScriptSignal",
"Argument #1 to Signal.Wrap must be a RBXScriptSignal; got " .. typeof(rbxScriptSignal)
)
local signal = Signal.new()
signal._proxyHandler = rbxScriptSignal:Connect(function(...)
signal:Fire(...)
end)
return signal
end
|
--[[
This will make the belt work automatically in the game.
P.S. If your belt is a SPINNER, do the following:
Connect the spinner to the Title w/ a HingeConstraint, and make sure the constraint is in the belt model.
Boom you're done.
MAKE SURE THE PRIMARY PART STAYS AS THE BELTCENTER.
WHEN CHANGING THE BELTCENTER/PLATE SIZES, MAKE SURE TO CHANGE IT THRU THE PROPERTIES AND NOT THE HANDLERS, ELSEWISE YOU WILL HAVE TO SET UP THE MOTOR6Ds
ON YOUR OWN.
YOU CAN SAFELY DELETE ANY EXTRA SIDEPLATES IF YOU DON'T NEED THEM.
]]
| |
--------LEFT DOOR --------
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--HeroThePianist
|
local barb = script.Parent
barb.Touched:connect(function(hit)
if hit == nil then return end
if hit.Parent == nil then return end
if hit.Parent:findFirstChild("Humanoid") or hit.Parent:findFirstChild("Zombie") ~= nil then
|
--local Sprinting =false
|
local L_148_ = L_124_.new(Vector3.new())
L_148_.s = 15
L_148_.d = 0.5
game:GetService("UserInputService").InputChanged:connect(function(L_273_arg1) --Get the mouse delta for the gun sway
if L_273_arg1.UserInputType == Enum.UserInputType.MouseMovement then
L_143_ = math.min(math.max(L_273_arg1.Delta.x, -L_145_), L_145_)
L_144_ = math.min(math.max(L_273_arg1.Delta.y, -L_145_), L_145_)
end
end)
L_4_.Idle:connect(function() --Reset the sway to 0 when the mouse is still
L_143_ = 0
L_144_ = 0
end)
local L_149_ = false
local L_150_ = CFrame.new()
local L_151_ = CFrame.new()
local L_152_
local L_153_
local L_154_
local L_155_
local L_156_
local L_157_
local L_158_
L_152_ = 0
L_153_ = CFrame.new()
L_154_ = 0.05
L_155_ = 2
L_156_ = 0
L_157_ = 0.09
L_158_ = 11
local L_159_ = 0
local L_160_ = 5
local L_161_ = .3
local L_162_, L_163_ = 0, 0
local L_164_ = nil
local L_165_ = nil
local L_166_ = nil
L_3_.Humanoid.Running:connect(function(L_274_arg1)
if L_274_arg1 > 1 then
L_149_ = true
else
L_149_ = false
end
end)
|
-- ROBLOX TODO: ADO-1552 Add stripAddedIndentation when we support inlineSnapshot testing
| |
-- Local Variables
|
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
local playerCollisionGroupName = "Players"
local previousCollisionGroups = {}
|
-- Disable the health UI
|
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, false)
|
--Remove with FFlagPlayerScriptsBindAtPriority
|
function BaseCamera:OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
self.turningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
self.turningRight = false
end
end
function BaseCamera:UpdateMouseBehavior()
-- first time transition to first person mode or mouse-locked third person
if self.inFirstPerson or self.inMouseLockedMode then
UserGameSettings.RotationType = Enum.RotationType.CameraRelative
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
else
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
if self.isRightMouseDown or self.isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function BaseCamera:UpdateForDistancePropertyChange()
-- Calling this setter with the current value will force checking that it is still
-- in range after a change to the min/max distance limits
self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end
function BaseCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
local player = Players.LocalPlayer
local lastSubjectDistance = self.currentSubjectDistance
-- By default, camera modules will respect LockFirstPerson and override the currentSubjectDistance with 0
-- regardless of what Player.CameraMinZoomDistance is set to, so that first person can be made
-- available by the developer without needing to allow players to mousewheel dolly into first person.
-- Some modules will override this function to remove or change first-person capability.
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
local newSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredSubjectDistance)
if newSubjectDistance < FIRST_PERSON_DISTANCE_THRESHOLD then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
self.currentSubjectDistance = newSubjectDistance
if self.inFirstPerson then
self:LeaveFirstPerson()
end
end
end
-- Pass target distance and zoom direction to the zoom controller
ZoomController.SetZoomParameters(self.currentSubjectDistance, math.sign(desiredSubjectDistance - lastSubjectDistance))
-- Returned only for convenience to the caller to know the outcome
return self.currentSubjectDistance
end
function BaseCamera:SetCameraType( cameraType )
--Used by derived classes
self.cameraType = cameraType
end
function BaseCamera:GetCameraType()
return self.cameraType
end
|
-- Public Functions
|
function GameManager:Initialize()
MapManager:SaveMap()
end
function GameManager:RunIntermission()
IntermissionRunning = true
TimeManager:StartTimer(Configurations.INTERMISSION_DURATION)
DisplayManager:StartIntermission()
EnoughPlayers = Players.NumPlayers >= Configurations.MIN_PLAYERS
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
spawn(function()
repeat
if EnoughPlayers and Players.NumPlayers < Configurations.MIN_PLAYERS then
EnoughPlayers = false
elseif not EnoughPlayers and Players.NumPlayers >= Configurations.MIN_PLAYERS then
EnoughPlayers = true
end
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
wait(.5)
until IntermissionRunning == false
end)
wait(Configurations.INTERMISSION_DURATION)
IntermissionRunning = false
end
function GameManager:StopIntermission()
--IntermissionRunning = false
DisplayManager:UpdateTimerInfo(false, false)
DisplayManager:StopIntermission()
end
function GameManager:GameReady()
return Players.NumPlayers >= Configurations.MIN_PLAYERS
end
function GameManager:StartRound()
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()
PlayerManager:AllowPlayerSpawn(true)
PlayerManager:LoadPlayers()
GameRunning = true
PlayerManager:SetGameRunning(true)
TimeManager:StartTimer(Configurations.ROUND_DURATION)
end
function GameManager:Update()
--TODO: Add custom custom game code here
end
function GameManager:RoundOver()
local winningTeam = TeamManager:HasTeamWon()
if winningTeam then
DisplayManager:DisplayVictory(winningTeam)
return true
end
if TimeManager:TimerDone() then
if TeamManager:AreTeamsTied() then
DisplayManager:DisplayVictory('Tie')
else
winningTeam = TeamManager:GetWinningTeam()
DisplayManager:DisplayVictory(winningTeam)
end
return true
end
return false
end
function GameManager:RoundCleanup()
PlayerManager:SetGameRunning(false)
wait(Configurations.END_GAME_WAIT)
PlayerManager:AllowPlayerSpawn(false)
PlayerManager:DestroyPlayers()
DisplayManager:DisplayVictory(nil)
TeamManager:ClearTeamScores()
PlayerManager:ClearPlayerScores()
TeamManager:ShuffleTeams()
MapManager:ClearMap()
MapManager:LoadMap()
end
|
--[[
Iterates over a Pages object for paginated web requests
Based on code sample from: https://create.roblox.com/docs/reference/engine/classes/Pages
--]]
|
local function iterateOverPagesAsync(pages: Pages)
return coroutine.wrap(function()
local pageNumber = 1
while true do
for _, item in ipairs(pages:GetCurrentPage()) do
coroutine.yield(item, pageNumber)
end
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
pageNumber += 1
end
end)
end
return iterateOverPagesAsync
|
-- Get the BanPlayer RemoteFunction from ReplicatedStorage
|
local banPlayerRemote = ReplicatedStorage:WaitForChild("BanPlayer")
|
--// # key, ManOn
|
mouse.KeyDown:connect(function(key)
if key=="u" then
veh.Lightbar.middle.Man:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
end
end)
|
-- print(AnimName .. " " .. Index .. " [" .. OrigRoll .. "]")
|
local Anim = AnimTable[AnimName][Index].Anim
-- load it to the humanoid; get AnimationTrack
CurrentAnimTrack = Humanoid:LoadAnimation(Anim)
-- play the animation
CurrentAnimTrack:Play(TransitionTime)
CurrentAnim = AnimName
-- set up Keyframe Name triggers
if CurrentAnimKeyframeHandler then
CurrentAnimKeyframeHandler:disconnect()
end
CurrentAnimKeyframeHandler = CurrentAnimTrack.KeyframeReached:connect(KeyframeReachedFunc)
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Parent.TeleportFrame.Visible ~= true then
game.Players.LocalPlayer.PlayerGui.HomeScreenGui.PaddingFrame.LayoutFrame.TeleportFrame.Active = true;
game.Players.LocalPlayer.PlayerGui.HomeScreenGui.PaddingFrame.LayoutFrame.TeleportFrame.Visible = true;
script.Parent.Parent.Parent.EmotesFrame.Visible = false
else
game.Players.LocalPlayer.PlayerGui.HomeScreenGui.PaddingFrame.LayoutFrame.TeleportFrame.Active = false;
game.Players.LocalPlayer.PlayerGui.HomeScreenGui.PaddingFrame.LayoutFrame.TeleportFrame.Visible = false;
end;
end);
|
-- RightShoulder.MaxVelocity = 0.5
-- LeftShoulder.MaxVelocity = 0.5
|
LimbAmplitude = 1
LimbFrequency = 9
NeckAmplitude = 0
NeckFrequency = 0
NeckDesiredAngle = 0
ClimbFudge = math.pi
else
LimbAmplitude = 0.1
LimbFrequency = 1
NeckAmplitude = 0.25
NeckFrequency = 1.25
end
local NeckDesiredAngle = ((not NeckDesiredAngle and (NeckAmplitude * math.sin(Time * NeckFrequency))) or NeckDesiredAngle)
local LimbDesiredAngle = (LimbAmplitude * math.sin(Time * LimbFrequency))
for _, motor in next, Limbs do
if string.match(motor.Name, "Left") or string.match(motor.Name, "Front") or string.match(motor.Name, "Right") or string.match(motor.Name, "Back") then
motor.MaxVelocity = (Pose == "Running" and 0.05) or (Pose == "Climbing" and 0.5) or 0.1
motor.DesiredAngle = LimbDesiredAngle
elseif string.match(motor.Name, "Neck") then
motor.DesiredAngle = NeckDesiredAngle
end
end
for _, motor in next, Joints do
motor.DesiredAngle = (LimbDesiredAngle + ClimbFudge)
end
--Neck.DesiredAngle = NeckDesiredAngle
|
--[=[
Wraps the :WaitForChild API with a promise
@function promiseChild
@param parent Instance
@param name string
@param timeOut number?
@return Promise<Instance>
@within promiseChild
]=]
|
return function(parent, name, timeOut)
local result = parent:FindFirstChild(name)
if result then
return Promise.resolved(result)
end
return Promise.spawn(function(resolve, reject)
local child = parent:WaitForChild(name, timeOut)
if child then
resolve(child)
else
reject("Timed out")
end
end)
end
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
if currentlyPlayingEmote then
oldAnim = "idle"
currentlyPlayingEmote = false
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
for _,v in pairs(locomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if not Humanoid.AutomaticScalingEnabled then
return 1
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
return scale
end
return 1
end
local function signedAngle(a, b)
return -math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y)
end
local angleWeight = 2.0
local function get2DWeight(px, p1, p2, sx, s1, s2)
local avgLength = 0.5 * (s1 + s2)
local p_1 = {x = (sx - s1)/avgLength, y = (angleWeight * signedAngle(p1, px))}
local p12 = {x = (s2 - s1)/avgLength, y = (angleWeight * signedAngle(p1, p2))}
local denom = smallButNotZero + (p12.x*p12.x + p12.y*p12.y)
local numer = p_1.x * p12.x + p_1.y * p12.y
local r = math.clamp(1.0 - numer/denom, 0.0, 1.0)
return r
end
local function blend2D(targetVelo, targetSpeed)
local h = {}
local sum = 0.0
for n,v1 in pairs(locomotionMap) do
if targetVelo.x * v1.lv.x < 0.0 or targetVelo.y * v1.lv.y < 0 then
-- Require same quadrant as target
h[n] = 0.0
continue
end
h[n] = math.huge
for j,v2 in pairs(locomotionMap) do
if targetVelo.x * v2.lv.x < 0.0 or targetVelo.y * v2.lv.y < 0 then
-- Require same quadrant as target
continue
end
h[n] = math.min(h[n], get2DWeight(targetVelo, v1.lv, v2.lv, targetSpeed, v1.speed, v2.speed))
end
sum += h[n]
end
--truncates below 10% contribution
local sum2 = 0.0
local weightedVeloX = 0
local weightedVeloY = 0
for n,v in pairs(locomotionMap) do
if (h[n] / sum > 0.1) then
sum2 += h[n]
weightedVeloX += h[n] * v.lv.x
weightedVeloY += h[n] * v.lv.y
else
h[n] = 0.0
end
end
local animSpeed
local weightedSpeedSquared = weightedVeloX * weightedVeloX + weightedVeloY * weightedVeloY
if weightedSpeedSquared > smallButNotZero then
animSpeed = math.sqrt(targetSpeed * targetSpeed / weightedSpeedSquared)
else
animSpeed = 0
end
animSpeed = animSpeed / getHeightScale()
local groupTimePosition = 0
for n,v in pairs(locomotionMap) do
if v.track.IsPlaying then
groupTimePosition = v.track.TimePosition
break
end
end
for n,v in pairs(locomotionMap) do
-- if not loco
if h[n] > 0.0 then
if not v.track.IsPlaying then
v.track:Play(runBlendtime)
v.track.TimePosition = groupTimePosition
end
local weight = math.max(smallButNotZero, h[n] / sum2)
v.track:AdjustWeight(weight, runBlendtime)
v.track:AdjustSpeed(animSpeed)
else
v.track:Stop(runBlendtime)
end
end
end
local function getWalkDirection()
local walkToPoint = Humanoid.WalkToPoint
local walkToPart = Humanoid.WalkToPart
if Humanoid.MoveDirection ~= Vector3.zero then
return Humanoid.MoveDirection
elseif walkToPart or walkToPoint ~= Vector3.zero then
local destination
if walkToPart then
destination = walkToPart.CFrame:PointToWorldSpace(walkToPoint)
else
destination = walkToPoint
end
local moveVector = Vector3.zero
if Humanoid.RootPart then
moveVector = destination - Humanoid.RootPart.CFrame.Position
moveVector = Vector3.new(moveVector.x, 0.0, moveVector.z)
local mag = moveVector.Magnitude
if mag > 0.01 then
moveVector /= mag
end
end
return moveVector
else
return Humanoid.MoveDirection
end
end
local function updateVelocity(currentTime)
local tempDir
if locomotionMap == strafingLocomotionMap then
local moveDirection = getWalkDirection()
if not Humanoid.RootPart then
return
end
local cframe = Humanoid.RootPart.CFrame
if math.abs(cframe.UpVector.Y) < smallButNotZero or pose ~= "Running" or humanoidSpeed < 0.001 then
-- We are horizontal! Do something (turn off locomotion)
for n,v in pairs(locomotionMap) do
if v.track then
v.track:AdjustWeight(smallButNotZero, runBlendtime)
end
end
return
end
local lookat = cframe.LookVector
local direction = Vector3.new(lookat.X, 0.0, lookat.Z)
direction = direction / direction.Magnitude --sensible upVector means this is non-zero.
local ly = moveDirection:Dot(direction)
if ly <= 0.0 and ly > -0.05 then
ly = smallButNotZero -- break quadrant ties in favor of forward-friendly strafes
end
local lx = direction.X*moveDirection.Z - direction.Z*moveDirection.X
local tempDir = Vector2.new(lx, ly) -- root space moveDirection
local delta = Vector2.new(tempDir.x-cachedLocalDirection.x, tempDir.y-cachedLocalDirection.y)
-- Time check serves the purpose of the old keyframeReached sync check, as it syncs anim timePosition
if delta:Dot(delta) > 0.001 or math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
cachedLocalDirection = tempDir
cachedRunningSpeed = humanoidSpeed
lastBlendTime = currentTime
blend2D(cachedLocalDirection, cachedRunningSpeed)
end
else
if math.abs(humanoidSpeed - cachedRunningSpeed) > 0.01 or currentTime - lastBlendTime > 1 then
cachedRunningSpeed = humanoidSpeed
lastBlendTime = currentTime
blend2D(Vector2.yAxis, cachedRunningSpeed)
end
end
end
function setAnimationSpeed(speed)
if currentAnim ~= "walk" then
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
if currentlyPlayingEmote then
if currentAnimTrack.Looped then
-- Allow the emote to loop
return
end
repeatAnim = "idle"
currentlyPlayingEmote = false
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
function rollAnimation(animName)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
return idx
end
local maxVeloX, minVeloX, maxVeloY, minVeloY
local function destroyRunAnimations()
for _,v in pairs(strafingLocomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
for _,v in pairs(fallbackLocomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
cachedRunningSpeed = 0
end
local function resetVelocityBounds(velo)
minVeloX = 0
maxVeloX = 0
minVeloY = 0
maxVeloY = 0
end
local function updateVelocityBounds(velo)
if velo then
if velo.x > maxVeloX then maxVeloX = velo.x end
if velo.y > maxVeloY then maxVeloY = velo.y end
if velo.x < minVeloX then minVeloX = velo.x end
if velo.y < minVeloY then minVeloY = velo.y end
end
end
local function checkVelocityBounds(velo)
if maxVeloX == 0 or minVeloX == 0 or maxVeloY == 0 or minVeloY == 0 then
if locomotionMap == strafingLocomotionMap then
warn("Strafe blending disabled. Not all quadrants of motion represented.")
end
locomotionMap = fallbackLocomotionMap
else
locomotionMap = strafingLocomotionMap
end
end
local function setupWalkAnimation(anim, animName, transitionTime, humanoid)
resetVelocityBounds()
-- check to see if we need to blend a walk/run animation
for n,v in pairs(locomotionMap) do
v.track = humanoid:LoadAnimation(animTable[n][1].anim)
v.track.Priority = Enum.AnimationPriority.Core
updateVelocityBounds(v.lv)
end
checkVelocityBounds()
end
local function switchToAnim(anim, animName, transitionTime, humanoid)
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimSpeed = 1.0
currentAnim = animName
currentAnimInstance = anim -- nil in the case of locomotion
if animName == "walk" then
setupWalkAnimation(anim, animName, transitionTime, humanoid)
else
destroyRunAnimations()
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
currentAnimTrack:Play(transitionTime)
-- set up keyframe name triggers
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
switchToAnim(anim, animName, transitionTime, humanoid)
currentlyPlayingEmote = false
end
function playEmote(emoteAnim, transitionTime, humanoid)
switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
currentlyPlayingEmote = true
end
|
--------| Reference |--------
|
local hostFolder = game.ReplicatedStorage:WaitForChild("Assets")
|
--Enter the name of the model you want to go to here.
------------------------------------
|
modelname="Exit"
|
--[[ The Module ]]
|
--
local BaseCamera = {}
BaseCamera.__index = BaseCamera
function BaseCamera.new()
local self = setmetatable({}, BaseCamera)
-- So that derived classes have access to this
self.FIRST_PERSON_DISTANCE_THRESHOLD = FIRST_PERSON_DISTANCE_THRESHOLD
self.cameraType = nil
self.cameraMovementMode = nil
local player = Players.LocalPlayer
self.lastCameraTransform = nil
self.rotateInput = ZERO_VECTOR2
self.userPanningCamera = false
self.lastUserPanCamera = tick()
self.humanoidRootPart = nil
self.humanoidCache = {}
-- Subject and position on last update call
self.lastSubject = nil
self.lastSubjectPosition = Vector3.new(0,5,0)
-- These subject distance members refer to the nominal camera-to-subject follow distance that the camera
-- is trying to maintain, not the actual measured value.
-- The default is updated when screen orientation or the min/max distances change,
-- to be sure the default is always in range and appropriate for the orientation.
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.currentSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.inFirstPerson = false
self.inMouseLockedMode = false
self.portraitMode = false
self.isSmallTouchScreen = false
-- Used by modules which want to reset the camera angle on respawn.
self.resetCameraAngle = true
self.enabled = false
-- Input Event Connections
self.inputBeganConn = nil
self.inputChangedConn = nil
self.inputEndedConn = nil
self.startPos = nil
self.lastPos = nil
self.panBeginLook = nil
self.panEnabled = true
self.keyPanEnabled = true
self.distanceChangeEnabled = true
self.PlayerGui = nil
self.cameraChangedConn = nil
self.viewportSizeChangedConn = nil
self.boundContextActions = {}
-- VR Support
self.shouldUseVRRotation = false
self.VRRotationIntensityAvailable = false
self.lastVRRotationIntensityCheckTime = 0
self.lastVRRotationTime = 0
self.vrRotateKeyCooldown = {}
self.cameraTranslationConstraints = Vector3.new(1, 1, 1)
self.humanoidJumpOrigin = nil
self.trackingHumanoid = nil
self.cameraFrozen = false
self.subjectStateChangedConn = nil
-- Gamepad support
self.activeGamepad = nil
self.gamepadPanningCamera = false
self.lastThumbstickRotate = nil
self.numOfSeconds = 0.7
self.currentSpeed = 0
self.maxSpeed = 6
self.vrMaxSpeed = 4
self.lastThumbstickPos = Vector2.new(0,0)
self.ySensitivity = 0.65
self.lastVelocity = nil
self.gamepadConnectedConn = nil
self.gamepadDisconnectedConn = nil
self.currentZoomSpeed = 1.0
self.L3ButtonDown = false
self.dpadLeftDown = false
self.dpadRightDown = false
-- Touch input support
self.isDynamicThumbstickEnabled = false
self.fingerTouches = {}
self.dynamicTouchInput = nil
self.numUnsunkTouches = 0
self.inputStartPositions = {}
self.inputStartTimes = {}
self.startingDiff = nil
self.pinchBeginZoom = nil
self.userPanningTheCamera = false
self.touchActivateConn = nil
-- Mouse locked formerly known as shift lock mode
self.mouseLockOffset = ZERO_VECTOR3
-- [[ NOTICE ]] --
-- Initialization things used to always execute at game load time, but now these camera modules are instantiated
-- when needed, so the code here may run well after the start of the game
if player.Character then
self:OnCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char)
end)
if self.cameraChangedConn then self.cameraChangedConn:Disconnect() end
self.cameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
self:OnCurrentCameraChanged()
if self.playerCameraModeChangeConn then self.playerCameraModeChangeConn:Disconnect() end
self.playerCameraModeChangeConn = player:GetPropertyChangedSignal("CameraMode"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.minDistanceChangeConn then self.minDistanceChangeConn:Disconnect() end
self.minDistanceChangeConn = player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.maxDistanceChangeConn then self.maxDistanceChangeConn:Disconnect() end
self.maxDistanceChangeConn = player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.playerDevTouchMoveModeChangeConn then self.playerDevTouchMoveModeChangeConn:Disconnect() end
self.playerDevTouchMoveModeChangeConn = player:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
self:OnDevTouchMovementModeChanged()
end)
self:OnDevTouchMovementModeChanged() -- Init
if self.gameSettingsTouchMoveMoveChangeConn then self.gameSettingsTouchMoveMoveChangeConn:Disconnect() end
self.gameSettingsTouchMoveMoveChangeConn = UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
self:OnGameSettingsTouchMovementModeChanged()
end)
self:OnGameSettingsTouchMovementModeChanged() -- Init
UserGameSettings:SetCameraYInvertVisible()
UserGameSettings:SetGamepadCameraSensitivityVisible()
self.hasGameLoaded = game:IsLoaded()
if not self.hasGameLoaded then
self.gameLoadedConn = game.Loaded:Connect(function()
self.hasGameLoaded = true
self.gameLoadedConn:Disconnect()
self.gameLoadedConn = nil
end)
end
self:OnPlayerCameraPropertyChange()
return self
end
function BaseCamera:GetModuleName()
return "BaseCamera"
end
function BaseCamera:OnCharacterAdded(char)
self.resetCameraAngle = self.resetCameraAngle or self:GetEnabled()
self.humanoidRootPart = nil
if UserInputService.TouchEnabled then
self.PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
for _, child in ipairs(char:GetChildren()) do
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end)
char.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = false
end
end)
end
end
function BaseCamera:GetHumanoidRootPart()
if not self.humanoidRootPart then
local player = Players.LocalPlayer
if player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
self.humanoidRootPart = humanoid.RootPart
end
end
end
return self.humanoidRootPart
end
function BaseCamera:GetBodyPartToFollow(humanoid, isDead)
-- If the humanoid is dead, prefer the head part if one still exists as a sibling of the humanoid
if humanoid:GetState() == Enum.HumanoidStateType.Dead then
local character = humanoid.Parent
if character and character:IsA("Model") then
return character:FindFirstChild("Head") or humanoid.RootPart
end
end
return humanoid.RootPart
end
function BaseCamera:GetSubjectPosition()
local result = self.lastSubjectPosition
local camera = game.Workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if VRService.VREnabled and humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
else
local bodyPartToFollow = humanoid.RootPart
-- If the humanoid is dead, prefer their head part as a follow target, if it exists
if humanoidIsDead then
if humanoid.Parent and humanoid.Parent:IsA("Model") then
bodyPartToFollow = humanoid.Parent:FindFirstChild("Head") or bodyPartToFollow
end
end
if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then
local heightOffset
if humanoid.RigType == Enum.HumanoidRigType.R15 then
if humanoid.AutomaticScalingEnabled then
heightOffset = R15_HEAD_OFFSET
if bodyPartToFollow == humanoid.RootPart then
local rootPartSizeOffset = (humanoid.RootPart.Size.Y/2) - (HUMANOID_ROOT_PART_SIZE.Y/2)
heightOffset = heightOffset + Vector3.new(0, rootPartSizeOffset, 0)
end
else
heightOffset = R15_HEAD_OFFSET_NO_SCALING
end
else
heightOffset = HEAD_OFFSET
end
if humanoidIsDead then
heightOffset = ZERO_VECTOR3
end
result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset)
end
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA("SkateboardPlatform") then
result = cameraSubject.CFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA("BasePart") then
result = cameraSubject.CFrame.p
elseif cameraSubject:IsA("Model") then
if cameraSubject.PrimaryPart then
result = cameraSubject:GetPrimaryPartCFrame().p
else
result = cameraSubject:GetModelCFrame().p
end
end
else
-- cameraSubject is nil
-- Note: Previous RootCamera did not have this else case and let self.lastSubject and self.lastSubjectPosition
-- both get set to nil in the case of cameraSubject being nil. This function now exits here to preserve the
-- last set valid values for these, as nil values are not handled cases
return
end
self.lastSubject = cameraSubject
self.lastSubjectPosition = result
return result
end
function BaseCamera:UpdateDefaultSubjectDistance()
local player = Players.LocalPlayer
if self.portraitMode then
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, PORTRAIT_DEFAULT_DISTANCE)
else
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
end
end
function BaseCamera:OnViewportSizeChanged()
local camera = game.Workspace.CurrentCamera
local size = camera.ViewportSize
self.portraitMode = size.X < size.Y
self.isSmallTouchScreen = UserInputService.TouchEnabled and (size.Y < 500 or size.X < 700)
self:UpdateDefaultSubjectDistance()
end
|
-- 16-18
|
module.Subcategory.Accessories = 19
module.Subcategory.HairAccessories = 20
module.Subcategory.FaceAccessories = 21
module.Subcategory.NeckAccessories = 22
module.Subcategory.ShoulderAccessories = 23
module.Subcategory.FrontAccessories = 24
module.Subcategory.BackAccessories = 25
module.Subcategory.WaistAccessories = 26
module.Subcategory.AvatarAnimations = 27
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function countdown()
-- Show GUI
TimerFrame.Visible = true
-- Set time remaining to countdown duration
local timeRemaining = DURATION
-- Countdown
repeat
Timer.Text = tostring(timeRemaining)
timeRemaining = timeRemaining - 1
CountdownBeep:Play()
wait(1)
until timeRemaining == 0
CountdownEndBeep:Play()
-- Hide GUI
TimerFrame.Visible = false
end
|
--local touched = weapon.Touched:connect(function(part)
-- if part.Parent and part.Parent:FindFirstChild("Humanoid") then
-- local humanoid = part.Parent.Humanoid
-- -- Damage your Humanoid taking away 10 Health
-- humanoid:TakeDamage(10)
-- end
--end)
| |
--returns the wielding player of this tool
|
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
local function setTransparency(object: Instance, transparency: number)
for i, v in ipairs(object:GetDescendants()) do
if v:IsA("BasePart") then
v.Transparency = transparency
end
end
end
local function setCollision(object: Instance, collision: boolean)
for i, v in ipairs(object:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = collision
end
end
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
local Object = Tool.Handle:Clone()
local PinClone = Object.Details.Top.Handle.Pin:Clone()
PinClone.CanCollide = true
PinClone.Archivable = false
PinClone.Parent = workspace
game:GetService("Debris"):AddItem(PinClone, 5)
Object.Details.Top.Handle.Pin.Transparency = 1
setTransparency(Tool.Handle.Details, 1)
setCollision(Object.Details, true)
Object.Parent = workspace
Object.Fuse:Play()
Object.Swing.Pitch = Random.new():NextInteger(90, 110) / 100
Object.Swing:Play()
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction * AttackVelocity) + Vector3.new(0, AttackVelocity / 7.5, 0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(
Random.new():NextNumber(-rand, rand),
Random.new():NextNumber(-rand, rand),
Random.new():NextNumber(-rand, rand)
)
Object:SetNetworkOwner(getPlayer())
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then
return
end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then
return
end
if Cooldown.Value == true then
return
end
Cooldown.Value = true
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
Tool:Destroy()
--task.wait(CooldownTime)
--setTransparency(Tool.Handle.Details, 0)
--Cooldown.Value = false
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- Events
|
local Events = ReplicatedStorage.Events
local BuyUpgradeEvent = Events.BuyUpgrade
local ChangeController = Events.ChangeController
local PlayerEnteredLobby = Events.PlayerEnteredLobby
|
--[[
Boolean Keyboard:IsDown(keyCode)
Boolean Keyboard:AreAllDown(keyCodes...)
Boolean Keyboard:AreAnyDown(keyCodes...)
Keyboard.KeyDown(keyCode)
Keyboard.KeyUp(keyCode)
--]]
|
local Keyboard = {}
local userInput = game:GetService("UserInputService")
function Keyboard:IsDown(keyCode)
return userInput:IsKeyDown(keyCode)
end
function Keyboard:AreAllDown(...)
for _,keyCode in pairs{...} do
if (not userInput:IsKeyDown(keyCode)) then
return false
end
end
return true
end
function Keyboard:AreAnyDown(...)
for _,keyCode in pairs{...} do
if (userInput:IsKeyDown(keyCode)) then
return true
end
end
return false
end
function Keyboard:Start()
end
function Keyboard:Init()
self.KeyDown = self.Shared.Event.new()
self.KeyUp = self.Shared.Event.new()
userInput.InputBegan:Connect(function(input, processed)
if (processed) then return end
if (input.UserInputType == Enum.UserInputType.Keyboard) then
self.KeyDown:Fire(input.KeyCode)
end
end)
userInput.InputEnded:Connect(function(input, processed)
if (input.UserInputType == Enum.UserInputType.Keyboard) then
self.KeyUp:Fire(input.KeyCode)
end
end)
end
return Keyboard
|
-- Services
|
local starterGui = game:GetService("StarterGui")
|
--// Commands
--// Highly recommended you disable Intellesense before editing this...
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, 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
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Commands = server.Commands;
Deps = server.Deps;
--// Automatic New Command Caching and Ability to do server.Commands[":ff"]
setmetatable(Commands, {
__index = function(self, ind)
local targInd = Admin.CommandCache[string.lower(ind)]
if targInd then
return rawget(Commands, targInd)
end
end;
__newindex = function(self, ind, val)
rawset(Commands, ind, val)
if val and type(val) == "table" and val.Commands and val.Prefix then
for i, cmd in pairs(val.Commands) do
Admin.PrefixCache[val.Prefix] = true
Admin.CommandCache[string.lower((val.Prefix..cmd))] = ind
end
end
end;
})
Logs:AddLog("Script", "Loading Command Modules...")
--// Load command modules
if server.CommandModules then
local env = GetEnv()
for i, module in ipairs(server.CommandModules:GetChildren()) do
local func = require(module)
local ran, tab = pcall(func, Vargs, env)
if ran and tab and type(tab) == "table" then
for ind, cmd in pairs(tab) do
Commands[ind] = cmd
end
Logs:AddLog("Script", "Loaded Command Module: ".. module.Name)
elseif not ran then
warn("CMDMODULE ".. module.Name .. " failed to load:")
warn(tostring(tab))
Logs:AddLog("Script", "Loading Command Module Failed: ".. module.Name)
end
end
end
--// Cache commands
Admin.CacheCommands()
Commands.Init = nil
Logs:AddLog("Script", "Commands Module Initialized")
end;
local function RunAfterPlugins()
--// Load custom user-supplied commands in settings.Commands
for ind, cmd in pairs(Settings.Commands or {}) do
if type(cmd) == "table" and cmd.Function then
setfenv(cmd.Function, getfenv())
Commands[ind] = cmd
end
end
--// Change command permissions based on settings
local Trim = service.Trim
for ind, cmd in pairs(Settings.Permissions or {}) do
local com, level = string.match(cmd, "^(.*):(.*)")
if com and level then
if string.find(level, ",") then
local newLevels = {}
for lvl in string.gmatch(level, "[^%s,]+") do
table.insert(newLevels, Trim(lvl))
end
Admin.SetPermission(com, newLevels)
else
Admin.SetPermission(com, level)
end
end
end
--// Update existing permissions to new levels
for i, cmd in pairs(Commands) do
if type(cmd) == "table" and cmd.AdminLevel then
local lvl = cmd.AdminLevel
if type(lvl) == "string" then
cmd.AdminLevel = Admin.StringToComLevel(lvl)
--print("Changed " .. tostring(lvl) .. " to " .. tostring(cmd.AdminLevel))
elseif type(lvl) == "table" then
for b, v in pairs(lvl) do
lvl[b] = Admin.StringToComLevel(v)
end
elseif type(lvl) == "nil" then
cmd.AdminLevel = 0
end
if not cmd.Prefix then
cmd.Prefix = Settings.Prefix
end
if not cmd.Args then
cmd.Args = {}
end
if not cmd.Function then
cmd.Function = function(plr)
Remote.MakeGui(plr, "Output", {Message = "No command implementation"})
end
end
if cmd.ListUpdater then
Logs.ListUpdaters[i] = function(plr, ...)
if not plr or Admin.CheckComLevel(Admin.GetLevel(plr), cmd.AdminLevel) then
if type(cmd.ListUpdater) == "function" then
return cmd.ListUpdater(plr, ...)
end
return Logs[cmd.ListUpdater]
end
end
end
end
end
Commands.RunAfterPlugins = nil
end;
server.Commands = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
};
end
|
-- Get references to the DockShelf and its children
|
local dockShelf = script.Parent.Parent.Parent.Parent.Parent.DockShelf
local aFinderButton = dockShelf.BMessages
local Minimalise = script.Parent
local window = script.Parent.Parent.Parent
local msgbar = window.MesgBar
|
--[[
\\\ Turn any number (even bigger than 2^47) into a number string w/ commas
Functions.Commas(
number, <-- |REQ| Any number.
)
--]]
|
return function(n)
--- Remove scientific notation
n = tostring(string.format("%18.0f", tonumber(n) or 0))
--- Convert to commas
n = (tostring(n):reverse():gsub("(%d%d%d)", "%1,"):reverse()..(tostring(n):match("%.%d+") or "")):gsub("^,", "")
--- Cleanup
n = string.gsub(n, "%s+", "")
n = string.sub(n, (string.sub(n, 0, 1) == "," and 2 or 0))
--
return n
end
|
--put on startercharacterscripts
--Made Actually like slap battles
--Use this while it lasts because roblox will take it down
|
local humanoid = script.Parent:WaitForChild("Humanoid")
humanoid.BreakJointsOnDeath = false
humanoid.Died:Connect(function()
for index,joint in pairs(script.Parent:GetDescendants()) do
if joint:IsA("Motor6D") then
local socket = Instance.new("BallSocketConstraint")
local a1 = Instance.new("Attachment")
local a2 = Instance.new("Attachment")
a1.Parent = joint.Part0
a2.Parent = joint.Part1
socket.Parent = joint.Parent
socket.Attachment0 = a1
socket.Attachment1 = a2
a1.CFrame = joint.C0
a2.CFrame = joint.C1
socket.LimitsEnabled = true
socket.TwistLimitsEnabled = true
joint.Enabled = false
end
end
end)
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
|
function methods:InternalDestroy()
for i, speaker in pairs(self.Speakers) do
speaker:LeaveChannel(self.Name)
end
self.eDestroyed:Fire()
self.eDestroyed:Destroy()
self.eMessagePosted:Destroy()
self.eSpeakerJoined:Destroy()
self.eSpeakerLeft:Destroy()
self.eSpeakerMuted:Destroy()
self.eSpeakerUnmuted:Destroy()
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalPostMessage(fromSpeaker, message, extraData)
if (self:InternalDoProcessCommands(fromSpeaker.Name, message, self.Name)) then return false end
if (self.Mutes[fromSpeaker.Name:lower()] ~= nil) then
local t = self.Mutes[fromSpeaker.Name:lower()]
if (t > 0 and os.time() > t) then
self:UnmuteSpeaker(fromSpeaker.Name)
else
self:SendSystemMessageToSpeaker(ChatLocalization:Get("GameChat_ChatChannel_MutedInChannel","You are muted and cannot talk in this channel"), fromSpeaker.Name)
return false
end
end
local messageObj = self:InternalCreateMessageObject(message, fromSpeaker.Name, false, extraData)
-- allow server to process the unfiltered message string
messageObj.Message = message
local processedMessage
pcall(function()
processedMessage = Chat:InvokeChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, messageObj)
end)
messageObj.Message = nil
if processedMessage then
-- developer server code's choice to mute the message
if processedMessage.ShouldDeliver == false then
return false
end
messageObj = processedMessage
end
message = self:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local sentToList = {}
for i, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
table.insert(sentToList, speaker.Name)
if speaker.Name == fromSpeaker.Name then
-- Send unfiltered message to speaker who sent the message.
local cMessageObj = ShallowCopy(messageObj)
cMessageObj.Message = message
cMessageObj.IsFiltered = true
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
speaker:InternalSendMessage(cMessageObj, self.Name)
else
speaker:InternalSendMessage(messageObj, self.Name)
end
end
end
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
local filteredMessages = {}
for i, speakerName in pairs(sentToList) do
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage then
filteredMessages[speakerName] = filteredMessage
else
return false
end
end
for i, speakerName in pairs(sentToList) do
local speaker = self.Speakers[speakerName]
if (speaker) then
local cMessageObj = ShallowCopy(messageObj)
cMessageObj.Message = filteredMessages[speakerName]
cMessageObj.IsFiltered = true
speaker:InternalSendFilteredMessage(cMessageObj, self.Name)
end
end
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message)
if filteredMessage then
messageObj.Message = filteredMessage
else
return false
end
messageObj.IsFiltered = true
self:InternalAddMessageToHistoryLog(messageObj)
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
local textFilterContext = self.Private and Enum.TextFilterContext.PrivateChat or Enum.TextFilterContext.PublicChat
local filterSuccess, isFilterResult, filteredMessage = self.ChatService:InternalApplyRobloxFilterNewAPI(
messageObj.FromSpeaker,
message,
textFilterContext
)
if (filterSuccess) then
messageObj.FilterResult = filteredMessage
messageObj.IsFilterResult = isFilterResult
else
return false
end
messageObj.IsFiltered = true
self:InternalAddMessageToHistoryLog(messageObj)
for _, speakerName in pairs(sentToList) do
local speaker = self.Speakers[speakerName]
if (speaker) then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
-- One more pass is needed to ensure that no speakers do not recieve the message.
-- Otherwise a user could join while the message is being filtered who had not originally been sent the message.
local speakersMissingMessage = {}
for _, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
local wasSentMessage = false
for _, sentSpeakerName in pairs(sentToList) do
if speaker.Name == sentSpeakerName then
wasSentMessage = true
break
end
end
if not wasSentMessage then
table.insert(speakersMissingMessage, speaker.Name)
end
end
end
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
for _, speakerName in pairs(speakersMissingMessage) do
local speaker = self.Speakers[speakerName]
if speaker then
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage == nil then
return false
end
local cMessageObj = ShallowCopy(messageObj)
cMessageObj.Message = filteredMessage
cMessageObj.IsFiltered = true
speaker:InternalSendFilteredMessage(cMessageObj, self.Name)
end
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
for _, speakerName in pairs(speakersMissingMessage) do
local speaker = self.Speakers[speakerName]
if speaker then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
return messageObj
end
function methods:InternalAddSpeaker(speaker)
if (self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is already in the channel!")
return
end
self.Speakers[speaker.Name] = speaker
local success, err = pcall(function() self.eSpeakerJoined:Fire(speaker.Name) end)
if not success and err then
print("Error removing channel: " ..err)
end
end
function methods:InternalRemoveSpeaker(speaker)
if (not self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is not in the channel!")
return
end
self.Speakers[speaker.Name] = nil
local success, err = pcall(function() self.eSpeakerLeft:Fire(speaker.Name) end)
if not success and err then
print("Error removing speaker: " ..err)
end
end
function methods:InternalRemoveExcessMessagesFromLog()
local remove = table.remove
while (#self.ChatHistory > self.MaxHistory) do
remove(self.ChatHistory, 1)
end
end
function methods:InternalAddMessageToHistoryLog(messageObj)
table.insert(self.ChatHistory, messageObj)
self:InternalRemoveExcessMessagesFromLog()
end
function methods:GetMessageType(message, fromSpeaker)
if fromSpeaker == nil then
return ChatConstants.MessageTypeSystem
end
return ChatConstants.MessageTypeDefault
end
function methods:InternalCreateMessageObject(message, fromSpeaker, isFiltered, extraData)
local messageType = self:GetMessageType(message, fromSpeaker)
local speakerUserId = -1
local speaker = nil
if fromSpeaker then
speaker = self.Speakers[fromSpeaker]
if speaker then
local player = speaker:GetPlayer()
if player then
speakerUserId = player.UserId
else
speakerUserId = 0
end
end
end
local messageObj =
{
ID = self.ChatService:InternalGetUniqueMessageId(),
FromSpeaker = fromSpeaker,
SpeakerUserId = speakerUserId,
OriginalChannel = self.Name,
MessageLength = string.len(message),
MessageType = messageType,
IsFiltered = isFiltered,
Message = isFiltered and message or nil,
--// These two get set by the new API. The comments are just here
--// to remind readers that they will exist so it's not super
--// confusing if they find them in the code but cannot find them
--// here.
--FilterResult = nil,
--IsFilterResult = false,
Time = os.time(),
ExtraData = {},
}
if speaker then
for k, v in pairs(speaker.ExtraData) do
messageObj.ExtraData[k] = v
end
end
if (extraData) then
for k, v in pairs(extraData) do
messageObj.ExtraData[k] = v
end
end
return messageObj
end
function methods:SetChannelNameColor(color)
self.ChannelNameColor = color
for i, speaker in pairs(self.Speakers) do
speaker:UpdateChannelNameColor(self.Name, color)
end
end
function methods:GetWelcomeMessageForSpeaker(speaker)
if self.GetWelcomeMessageFunction then
local welcomeMessage = self.GetWelcomeMessageFunction(speaker)
if welcomeMessage then
return welcomeMessage
end
end
return self.WelcomeMessage
end
function methods:RegisterGetWelcomeMessageFunction(func)
if type(func) ~= "function" then
error("RegisterGetWelcomeMessageFunction must be called with a function.")
end
self.GetWelcomeMessageFunction = func
end
function methods:UnRegisterGetWelcomeMessageFunction()
self.GetWelcomeMessageFunction = nil
end
|
--// SS3.33T Police Edit originally for 2017 Mercedes-Benz E300 by Itzt and MASERATl, base SS by Inspare
|
wait(0.1)
local player = game.Players.LocalPlayer
local HUB = script.Parent.HUB
local limitButton = HUB.Limiter
local lightOn = false
local Camera = game.Workspace.CurrentCamera
local cam = script.Parent.nxtcam.Value
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
|
-- FUNCTIONS --
|
return function(...)
local Args = {...}
local TargetPosition = Args[1]
local fxPos = Vector3.new(TargetPosition.X, TargetPosition.Y - 1.5, TargetPosition.Z)
local splashAttachment = Instance.new("Attachment")
splashAttachment.Parent = workspace.Terrain
splashAttachment.WorldPosition = fxPos
game.Debris:AddItem(splashAttachment, 5)
debrisModule.Shockwave(fxPos, 3, 13)
coroutine.wrap(function()
for i, v in pairs(script.FX:GetChildren()) do
if v:IsA("ParticleEmitter") then
local fx = v:Clone()
fx.Parent = splashAttachment
fx:Emit(fx:GetAttribute("EmitCount"))
end
end
end)()
end
|
--[=[
Starts the timer. Will do nothing if the timer is already running.
```lua
timer:Start()
```
]=]
|
function Timer:Start()
if self._runHandle then return end
if self.AllowDrift then
self:_startTimer()
else
self:_startTimerNoDrift()
end
end
|
-- Комбинации данных
|
DataStore2.Combine(DB, "stage")
local added=script.Parent.Parent.Diff.Value
|
-- the Tool, reffered to here as "Block." Do not change it!
|
Block = script.Parent.Parent.Bell1 -- You CAN change the name in the quotes "Example Tool"
|
-- Libraries
|
Region = require(Tool.Libraries.Region)
Signal = require(Tool.Libraries.Signal)
Support = require(Tool.Libraries.SupportLibrary)
Try = require(Tool.Libraries.Try)
Make = require(Tool.Libraries.Make)
local Roact = require(Tool.Vendor:WaitForChild 'Roact')
local Maid = require(Tool.Libraries:WaitForChild 'Maid')
local Cryo = require(Tool.Libraries:WaitForChild('Cryo'))
|
-- Sounds
|
local Soundscape = game.Soundscape
local ExplosionSound = Soundscape:FindFirstChild("ExplosionSound")
local PARTICLE_DURATION = 1
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.42 ,
--[[ 4 ]] 0.97 ,
--[[ 5 ]] 0.82 ,
--[[ 6 ]] 0.52 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--[[ @brief Add a function to be run when requested.
@param func The function to run.
@param args... The arguments to pass to the function.
--]]
|
function FunctionQueue:Add(func, ...)
local arguments = {...};
table.insert(self._Functions, {func, arguments});
end
|
--UI
|
local feedbackMain = script.Parent.MainFrame
|
--Enter the name of the model you want to go to here.
------------------------------------
|
modelname="tele2"
|
-- / GAs / --
|
local GAs = game.ReplicatedStorage.CGAs
local Buildings = GAs.Buildings
local Modules = GAs.Modules
|
--Copy public stuff
|
script.AdminPanelPartner:Clone().Parent = game.ReplicatedStorage
script.BroadcastReceiver:Clone().Parent = game.StarterPlayer.StarterPlayerScripts
wait()
|
--[[Read line 24 of the script. Just edit the word "D4Tide" to whatever the gun name you want. The gun must be in the lighting for this to work. I'd reccomend you add a regen.]]
|
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
game.Lighting.AK47:clone().Parent = player.Backpack
wait(5)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
|
--[[runservice.RenderStepped:Connect(function(dt : number)
local frame = 1/dt
local ratio = frame/64
print(ratio)
end)]]
|
runservice.RenderStepped:Connect(function(dt : number)
if not bool then
bool = true
local ct = os.clock()
local frame = 1/dt
local ratio = frame/64
task.wa(0.1 * ratio)
avgerror = (0.1 - (avgerror + (os.clock() - ct)))/2
bool = false
end
end)
task.spawn(function()
while task.wait(1) do
print("Average error is "..tostring(avgerror * 100).."%")
end
end)
|
-- remap for better lookup
|
local OPCODE_RM = {
-- level 1
[22] = 18, -- JMP
[31] = 8, -- FORLOOP
[33] = 28, -- TFORLOOP
-- level 2
[0] = 3, -- MOVE
[1] = 13, -- LOADK
[2] = 23, -- LOADBOOL
[26] = 33, -- TEST
-- level 3
[12] = 1, -- ADD
[13] = 6, -- SUB
[14] = 10, -- MUL
[15] = 16, -- DIV
[16] = 20, -- MOD
[17] = 26, -- POW
[18] = 30, -- UNM
[19] = 36, -- NOT
-- level 4
[3] = 0, -- LOADNIL
[4] = 2, -- GETUPVAL
[5] = 4, -- GETGLOBAL
[6] = 7, -- GETTABLE
[7] = 9, -- SETGLOBAL
[8] = 12, -- SETUPVAL
[9] = 14, -- SETTABLE
[10] = 17, -- NEWTABLE
[20] = 19, -- LEN
[21] = 22, -- CONCAT
[23] = 24, -- EQ
[24] = 27, -- LT
[25] = 29, -- LE
[27] = 32, -- TESTSET
[32] = 34, -- FORPREP
[34] = 37, -- SETLIST
-- level 5
[11] = 5, -- SELF
[28] = 11, -- CALL
[29] = 15, -- TAILCALL
[30] = 21, -- RETURN
[35] = 25, -- CLOSE
[36] = 31, -- CLOSURE
[37] = 35, -- VARARG
}
|
-- ROBLOX deviation START: added round function
|
local function round(num: number)
local mult = 10 ^ 0
return math.floor(num * mult + 0.5) / mult
end
|
--[=[
Observes children and ensures that the value is cleaned up
afterwards.
@param value any
@return Observable<Instance>
]=]
|
function Blend._observeChildren(value)
if typeof(value) == "Instance" then
-- Should be uncommon
return Observable.new(function(sub)
sub:Fire(value)
-- don't complete, as this would clean everything up
return value
end)
end
if ValueObject.isValueObject(value) then
return Observable.new(function(sub)
local maid = Maid.new()
-- Switch instead of emitting every value.
local function update()
local result = value.Value
if typeof(result) == "Instance" then
maid._current = result
sub:Fire(result)
return
end
local observe = Blend._observeChildren(result)
if observe then
maid._current = nil
local doCleanup = false
local cleanup
cleanup = observe:Subscribe(function(inst)
sub:Fire(inst)
end, function(...)
sub:Fail(...)
end, function()
-- incase of immediate execution
doCleanup = true
-- Do not pass complete through to the end
if maid._current == cleanup then
maid._current = nil
end
end)
-- TODO: Complete when valueobject cleans up
if doCleanup then
if cleanup then
MaidTaskUtils.doCleanup(cleanup)
end
else
maid._current = cleanup
end
return
end
maid._current = nil
end
maid:GiveTask(value.Changed:Connect(update))
update()
return maid
end)
end
if Brio.isBrio(value) then
return Observable.new(function(sub)
if value:IsDead() then
return nil
end
local result = value:GetValue()
if typeof(result) == "Instance" then
local maid = value:ToMaid()
maid:GiveTask(result)
sub:Fire(result)
return maid
end
local observe = Blend._observeChildren(result)
if observe then
local maid = value:ToMaid()
-- Subscription is for lifetime of brio, so we do
-- not need to specifically add these results to the maid, and
-- risk memory leak of the maid with a lot of items in it.
maid:GiveTask(observe:Subscribe(function(inst)
sub:Fire(inst)
end, function(...)
sub:Fail(...)
end, function()
-- completion should not result more than maid cleaning up
maid:DoCleaning()
end))
return maid
end
warn(("Unknown type in brio %q"):format(typeof(result)))
return nil
end)
end
-- Handle like observable
if Promise.isPromise(value) then
value = Rx.fromPromise(value)
end
-- Handle like observable
if Signal.isSignal(value) or typeof(value) == "RBXScriptSignal" then
value = Rx.fromSignal(value)
end
if Observable.isObservable(value) then
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(value:Subscribe(function(result)
if typeof(result) == "Instance" then
-- lifetime of subscription
maid:GiveTask(result)
sub:Fire(result)
return
end
local observe = Blend._observeChildren(result)
if observe then
local innerMaid = Maid.new()
-- Note: I think this still memory leaks
innerMaid:GiveTask(observe:Subscribe(function(inst)
sub:Fire(inst)
end, function(...)
innerMaid:DoCleaning()
sub:Fail(...)
end, function()
innerMaid:DoCleaning()
end))
innerMaid:GiveTask(function()
maid[innerMaid] = nil
end)
maid[innerMaid] = innerMaid
else
warn(("Failed to convert %q into children"):format(tostring(result)))
end
end, function(...)
sub:Fire(...)
end, function()
-- Drop completion, other inner components may have completed.
end))
return maid
end)
end
if type(value) == "table" and not getmetatable(value) then
local observables = {}
for key, item in pairs(value) do
local observe = Blend._observeChildren(item)
if observe then
table.insert(observables, observe)
else
warn(("Failed to convert [%s] %q into children"):format(tostring(key), tostring(item)))
end
end
if next(observables) then
return Rx.merge(observables)
else
return nil
end
end
return nil
end
|
-- find player's head pos
|
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local dir = mouse_pos - head.Position
dir = computeDirection(dir)
local launch = head.Position + 5 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
local missile = Pellet:clone()
Tool.Handle.Mesh:clone().Parent = missile
missile.Position = launch
missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
missile.PelletScript.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vCharacter
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
local Torso = Tool.Parent:FindFirstChild("Torso") or Tool.Parent:FindFirstChild("UpperTorso")
local RightArm = Tool.Parent:FindFirstChild("RightUpperArm")
local RightShoulder = Torso:FindFirstChild("Right Shoulder") or RightArm:FindFirstChild("RightShoulder")
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
if loaded==true then
loaded=false
local targetPos = humanoid.TargetPoint
fire(targetPos)
wait(.2)
Tool.Enabled = true
elseif loaded==false then
RightShoulder.MaxVelocity = 0.6
RightShoulder.DesiredAngle = -3.6
wait(.1)
Tool.Handle.Transparency=0
wait(.1)
loaded=true
end
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
--//VARIABLES\\--
|
local player = game:GetService("Players").LocalPlayer--This detects the player
local character = player.Character or player.CharacterAdded:Wait()
|
--[[Output Scaling Factor]]
|
local hpScaling = _Tune.WeightScaling*35
local FBrakeForce = _Tune.FBrakeForce
local RBrakeForce = _Tune.RBrakeForce
local PBrakeForce = _Tune.PBrakeForce
if not workspace:PGSIsEnabled() then
hpScaling = _Tune.LegacyScaling*10
FBrakeForce = _Tune.FLgcyBForce
RBrakeForce = _Tune.RLgcyBForce
PBrakeForce = _Tune.LgcyPBForce
end
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local gui = client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = title
msg.Text = message
local function fadeOut()
for i = 1,12 do
msg.TextTransparency = msg.TextTransparency+0.05
ttl.TextTransparency = ttl.TextTransparency+0.05
msg.TextStrokeTransparency = msg.TextStrokeTransparency+0.05
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+0.05
frame2.BackgroundTransparency = frame2.BackgroundTransparency+0.05
service.Wait("Stepped")
end
service.UnWrap(gui):Destroy()
end
gTable.CustomDestroy = function()
fadeOut()
end
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
sound.SoundId = "rbxassetid://7152561753"
sound.Volume = 0.3
wait(0.1)
sound:Play()
wait(1)
sound:Destroy()
end)
gTable.Ready()
frame:TweenSize(UDim2.new(0, 350, 0, 150), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.2)
if not tim then
local _,time = message:gsub(" ","")
time = math.clamp(time/2,4,11)+1
wait(time)
else
wait(tim)
end
fadeOut()
end
|
--//Const
|
local RS = game:GetService("RunService");
function ViewportInit:Init(VP, Selected, CamCFrame)
if (not VP) then return; end
local Obj = Selected:Clone();
if (not Obj.PrimaryPart) then
for i,v in pairs(Obj:GetChildren()) do
if (v:IsA("BasePart")) then
Obj.PrimaryPart = v;
break;
end
end
end
Obj:SetPrimaryPartCFrame(CFrame.new(Vector3.new(), CamCFrame.Position))
Obj.Parent = VP;
local Camera = Instance.new("Camera");
VP.CurrentCamera = Camera;
Camera.Parent = VP;
local cf = CamCFrame
Camera.CFrame = cf
return Obj, Camera;
end
return ViewportInit
|
-- end
|
if spd > 140 then
if carSeat.Steer == 0 then
if m == false then
m = true
local lockL = Instance.new("Motor")
lockL.Parent = carSeat.Parent.Parent.LW.ML
lockL.Part0 = carSeat.Parent.Parent.LW.ML
lockL.Part1 = carSeat.Parent.Parent.Suspension.ML
end
else
if m == true then
m = false
carSeat.Parent.Parent.LW.ML.Motor:remove()
end
end
else
if m == true and occ == false then
m = false
carSeat.Parent.Parent.LW.ML.Motor:remove()
end
end
end
|
--[=[
Declarative UI system inspired by Fusion.
@class Blend
]=]
|
local require = require(script.Parent.loader).load(script)
local AccelTween = require("AccelTween")
local BlendDefaultProps = require("BlendDefaultProps")
local Brio = require("Brio")
local Maid = require("Maid")
local MaidTaskUtils = require("MaidTaskUtils")
local Observable = require("Observable")
local Promise = require("Promise")
local Rx = require("Rx")
local BrioUtils = require("BrioUtils")
local RxInstanceUtils = require("RxInstanceUtils")
local RxValueBaseUtils = require("RxValueBaseUtils")
local Signal = require("Signal")
local Spring = require("Spring")
local SpringUtils = require("SpringUtils")
local StepUtils = require("StepUtils")
local ValueBaseUtils = require("ValueBaseUtils")
local ValueObject = require("ValueObject")
local ValueObjectUtils = require("ValueObjectUtils")
local Blend = {}
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Lightorange",Paint)
end)
|
-- goro7
|
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y - 14) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
--[[ Last synced 7/22/2022 04:44 --No backdoors. --[[ ]]
|
--
|
--// F key, HornOff
|
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Stop()
veh.Lightbar.middle.Wail.Volume = 2
veh.Lightbar.middle.Yelp.Volume = 2
veh.Lightbar.middle.Priority.Volume = 2
end
end)
|
-- LocalScript
|
local numValue = script.Parent.Parent.Trocar.Exp -- substitua "NumValue" pelo nome da sua NumberValue
local textLabel = script.Parent -- substitua "TextLabel" pelo nome do seu TextLabel
|
-- Apply some properties
|
player.CameraMaxZoomDistance = 0.5
c.FieldOfView = 100 -- Things get trippy if we don't do this.
humanoid.CameraOffset = Vector3.new(0,-0.25,-1.5)
function lock(part)
if part and part:IsA("BasePart") then
part.LocalTransparencyModifier = part.Transparency
part.Changed:connect(function (property)
part.LocalTransparencyModifier = part.Transparency
end)
end
end
for _,v in pairs(char:GetChildren()) do
lock(v)
end
char.ChildAdded:connect(lock)
c.Changed:connect(function (property)
if property == "CameraSubject" then
if c.CameraSubject and c.CameraSubject:IsA("DriveSeat") and humanoid then
-- Vehicle seats try to change the camera subject to the seat itself. This isn't what we wan't really.
c.CameraSubject = humanoid;
end
end
end)
|
-- Connections
|
AddUpgradeEvent.OnServerEvent:Connect(addPlayerUpgrade)
BuyUpgradeEvent.OnServerEvent:Connect(makeUpgradePurchase)
UpdatePointsEvent.OnServerEvent:Connect(updatePlayerPoints)
TouchCheckpointEvent.OnServerEvent:Connect(touchCheckpoint)
ChangeController.OnServerEvent:Connect(changeController)
ChangeController.OnServerEvent:Connect(changeController)
PlayerEnteredGame.OnServerEvent:Connect(onPlayerEnteredGame)
|
--[[ ALL LIGHTING FUNCTIONS ]]
|
--
local Lighting = game.Lighting
|
--------------------------------------------------------------------------------
-- MAIN FUNCTIONS
--------------------------------------------------------------------------------
|
local function sha256ext(width, message)
-- Create an instance (private objects for current calculation)
local Array256 = sha2_H_ext256[width] -- # == 8
local length, tail = 0, ""
local H = table.create(8)
H[1], H[2], H[3], H[4], H[5], H[6], H[7], H[8] = Array256[1], Array256[2], Array256[3], Array256[4], Array256[5], Array256[6], Array256[7], Array256[8]
local function partial(message_part)
if message_part then
local partLength = #message_part
if tail then
length = length + partLength
local offs = 0
local tailLength = #tail
if tail ~= "" and tailLength + partLength >= 64 then
offs = 64 - tailLength
sha256_feed_64(H, tail .. string.sub(message_part, 1, offs), 0, 64)
tail = ""
end
local size = partLength - offs
local size_tail = size % 64
sha256_feed_64(H, message_part, offs, size - size_tail)
tail = tail .. string.sub(message_part, partLength + 1 - size_tail)
return partial
else
error("Adding more chunks is not allowed after receiving the result", 2)
end
else
if tail then
local final_blocks = table.create(10) --{tail, "\128", string.rep("\0", (-9 - length) % 64 + 1)}
final_blocks[1] = tail
final_blocks[2] = "\128"
final_blocks[3] = string.rep("\0", (-9 - length) % 64 + 1)
tail = nil
-- Assuming user data length is shorter than (TWO_POW_53)-9 bytes
-- Anyway, it looks very unrealistic that someone would spend more than a year of calculations to process TWO_POW_53 bytes of data by using this Lua script :-)
-- TWO_POW_53 bytes = TWO_POW_56 bits, so "bit-counter" fits in 7 bytes
length = length * (8 / TWO56_POW_7) -- convert "byte-counter" to "bit-counter" and move decimal point to the left
for j = 4, 10 do
length = length % 1 * 256
final_blocks[j] = string.char(math.floor(length))
end
final_blocks = table.concat(final_blocks)
sha256_feed_64(H, final_blocks, 0, #final_blocks)
local max_reg = width / 32
for j = 1, max_reg do
H[j] = string.format("%08x", H[j] % 4294967296)
end
H = table.concat(H, "", 1, max_reg)
end
return H
end
end
if message then
-- Actually perform calculations and return the SHA256 digest of a message
return partial(message)()
else
-- Return function for chunk-by-chunk loading
-- User should feed every chunk of input data as single argument to this function and finally get SHA256 digest by invoking this function without an argument
return partial
end
end
local function sha512ext(width, message)
-- Create an instance (private objects for current calculation)
local length, tail, H_lo, H_hi = 0, "", table.pack(table.unpack(sha2_H_ext512_lo[width])), not HEX64 and table.pack(table.unpack(sha2_H_ext512_hi[width]))
local function partial(message_part)
if message_part then
local partLength = #message_part
if tail then
length = length + partLength
local offs = 0
if tail ~= "" and #tail + partLength >= 128 then
offs = 128 - #tail
sha512_feed_128(H_lo, H_hi, tail .. string.sub(message_part, 1, offs), 0, 128)
tail = ""
end
local size = partLength - offs
local size_tail = size % 128
sha512_feed_128(H_lo, H_hi, message_part, offs, size - size_tail)
tail = tail .. string.sub(message_part, partLength + 1 - size_tail)
return partial
else
error("Adding more chunks is not allowed after receiving the result", 2)
end
else
if tail then
local final_blocks = table.create(3) --{tail, "\128", string.rep("\0", (-17-length) % 128 + 9)}
final_blocks[1] = tail
final_blocks[2] = "\128"
final_blocks[3] = string.rep("\0", (-17 - length) % 128 + 9)
tail = nil
-- Assuming user data length is shorter than (TWO_POW_53)-17 bytes
-- TWO_POW_53 bytes = TWO_POW_56 bits, so "bit-counter" fits in 7 bytes
length = length * (8 / TWO56_POW_7) -- convert "byte-counter" to "bit-counter" and move floating point to the left
for j = 4, 10 do
length = length % 1 * 256
final_blocks[j] = string.char(math.floor(length))
end
final_blocks = table.concat(final_blocks)
sha512_feed_128(H_lo, H_hi, final_blocks, 0, #final_blocks)
local max_reg = math.ceil(width / 64)
if HEX64 then
for j = 1, max_reg do
H_lo[j] = HEX64(H_lo[j])
end
else
for j = 1, max_reg do
H_lo[j] = string.format("%08x", H_hi[j] % 4294967296) .. string.format("%08x", H_lo[j] % 4294967296)
end
H_hi = nil
end
H_lo = string.sub(table.concat(H_lo, "", 1, max_reg), 1, width / 4)
end
return H_lo
end
end
if message then
-- Actually perform calculations and return the SHA512 digest of a message
return partial(message)()
else
-- Return function for chunk-by-chunk loading
-- User should feed every chunk of input data as single argument to this function and finally get SHA512 digest by invoking this function without an argument
return partial
end
end
local function md5(message)
-- Create an instance (private objects for current calculation)
local H, length, tail = table.create(4), 0, ""
H[1], H[2], H[3], H[4] = md5_sha1_H[1], md5_sha1_H[2], md5_sha1_H[3], md5_sha1_H[4]
local function partial(message_part)
if message_part then
local partLength = #message_part
if tail then
length = length + partLength
local offs = 0
if tail ~= "" and #tail + partLength >= 64 then
offs = 64 - #tail
md5_feed_64(H, tail .. string.sub(message_part, 1, offs), 0, 64)
tail = ""
end
local size = partLength - offs
local size_tail = size % 64
md5_feed_64(H, message_part, offs, size - size_tail)
tail = tail .. string.sub(message_part, partLength + 1 - size_tail)
return partial
else
error("Adding more chunks is not allowed after receiving the result", 2)
end
else
if tail then
local final_blocks = table.create(3) --{tail, "\128", string.rep("\0", (-9 - length) % 64)}
final_blocks[1] = tail
final_blocks[2] = "\128"
final_blocks[3] = string.rep("\0", (-9 - length) % 64)
tail = nil
length = length * 8 -- convert "byte-counter" to "bit-counter"
for j = 4, 11 do
local low_byte = length % 256
final_blocks[j] = string.char(low_byte)
length = (length - low_byte) / 256
end
final_blocks = table.concat(final_blocks)
md5_feed_64(H, final_blocks, 0, #final_blocks)
for j = 1, 4 do
H[j] = string.format("%08x", H[j] % 4294967296)
end
H = string.gsub(table.concat(H), "(..)(..)(..)(..)", "%4%3%2%1")
end
return H
end
end
if message then
-- Actually perform calculations and return the MD5 digest of a message
return partial(message)()
else
-- Return function for chunk-by-chunk loading
-- User should feed every chunk of input data as single argument to this function and finally get MD5 digest by invoking this function without an argument
return partial
end
end
local function sha1(message)
-- Create an instance (private objects for current calculation)
local H, length, tail = table.pack(table.unpack(md5_sha1_H)), 0, ""
local function partial(message_part)
if message_part then
local partLength = #message_part
if tail then
length = length + partLength
local offs = 0
if tail ~= "" and #tail + partLength >= 64 then
offs = 64 - #tail
sha1_feed_64(H, tail .. string.sub(message_part, 1, offs), 0, 64)
tail = ""
end
local size = partLength - offs
local size_tail = size % 64
sha1_feed_64(H, message_part, offs, size - size_tail)
tail = tail .. string.sub(message_part, partLength + 1 - size_tail)
return partial
else
error("Adding more chunks is not allowed after receiving the result", 2)
end
else
if tail then
local final_blocks = table.create(10) --{tail, "\128", string.rep("\0", (-9 - length) % 64 + 1)}
final_blocks[1] = tail
final_blocks[2] = "\128"
final_blocks[3] = string.rep("\0", (-9 - length) % 64 + 1)
tail = nil
-- Assuming user data length is shorter than (TWO_POW_53)-9 bytes
-- TWO_POW_53 bytes = TWO_POW_56 bits, so "bit-counter" fits in 7 bytes
length = length * (8 / TWO56_POW_7) -- convert "byte-counter" to "bit-counter" and move decimal point to the left
for j = 4, 10 do
length = length % 1 * 256
final_blocks[j] = string.char(math.floor(length))
end
final_blocks = table.concat(final_blocks)
sha1_feed_64(H, final_blocks, 0, #final_blocks)
for j = 1, 5 do
H[j] = string.format("%08x", H[j] % 4294967296)
end
H = table.concat(H)
end
return H
end
end
if message then
-- Actually perform calculations and return the SHA-1 digest of a message
return partial(message)()
else
-- Return function for chunk-by-chunk loading
-- User should feed every chunk of input data as single argument to this function and finally get SHA-1 digest by invoking this function without an argument
return partial
end
end
local function keccak(block_size_in_bytes, digest_size_in_bytes, is_SHAKE, message)
-- "block_size_in_bytes" is multiple of 8
if type(digest_size_in_bytes) ~= "number" then
-- arguments in SHAKE are swapped:
-- NIST FIPS 202 defines SHAKE(message,num_bits)
-- this module defines SHAKE(num_bytes,message)
-- it's easy to forget about this swap, hence the check
error("Argument 'digest_size_in_bytes' must be a number", 2)
end
-- Create an instance (private objects for current calculation)
local tail, lanes_lo, lanes_hi = "", table.create(25, 0), hi_factor_keccak == 0 and table.create(25, 0)
local result
--~ pad the input N using the pad function, yielding a padded bit string P with a length divisible by r (such that n = len(P)/r is integer),
--~ break P into n consecutive r-bit pieces P0, ..., Pn-1 (last is zero-padded)
--~ initialize the state S to a string of b 0 bits.
--~ absorb the input into the state: For each block Pi,
--~ extend Pi at the end by a string of c 0 bits, yielding one of length b,
--~ XOR that with S and
--~ apply the block permutation f to the result, yielding a new state S
--~ initialize Z to be the empty string
--~ while the length of Z is less than d:
--~ append the first r bits of S to Z
--~ if Z is still less than d bits long, apply f to S, yielding a new state S.
--~ truncate Z to d bits
local function partial(message_part)
if message_part then
local partLength = #message_part
if tail then
local offs = 0
if tail ~= "" and #tail + partLength >= block_size_in_bytes then
offs = block_size_in_bytes - #tail
keccak_feed(lanes_lo, lanes_hi, tail .. string.sub(message_part, 1, offs), 0, block_size_in_bytes, block_size_in_bytes)
tail = ""
end
local size = partLength - offs
local size_tail = size % block_size_in_bytes
keccak_feed(lanes_lo, lanes_hi, message_part, offs, size - size_tail, block_size_in_bytes)
tail = tail .. string.sub(message_part, partLength + 1 - size_tail)
return partial
else
error("Adding more chunks is not allowed after receiving the result", 2)
end
else
if tail then
-- append the following bits to the message: for usual SHA3: 011(0*)1, for SHAKE: 11111(0*)1
local gap_start = is_SHAKE and 31 or 6
tail = tail .. (#tail + 1 == block_size_in_bytes and string.char(gap_start + 128) or string.char(gap_start) .. string.rep("\0", (-2 - #tail) % block_size_in_bytes) .. "\128")
keccak_feed(lanes_lo, lanes_hi, tail, 0, #tail, block_size_in_bytes)
tail = nil
local lanes_used = 0
local total_lanes = math.floor(block_size_in_bytes / 8)
local qwords = {}
local function get_next_qwords_of_digest(qwords_qty)
-- returns not more than 'qwords_qty' qwords ('qwords_qty' might be non-integer)
-- doesn't go across keccak-buffer boundary
-- block_size_in_bytes is a multiple of 8, so, keccak-buffer contains integer number of qwords
if lanes_used >= total_lanes then
keccak_feed(lanes_lo, lanes_hi, "\0\0\0\0\0\0\0\0", 0, 8, 8)
lanes_used = 0
end
qwords_qty = math.floor(math.min(qwords_qty, total_lanes - lanes_used))
if hi_factor_keccak ~= 0 then
for j = 1, qwords_qty do
qwords[j] = HEX64(lanes_lo[lanes_used + j - 1 + lanes_index_base])
end
else
for j = 1, qwords_qty do
qwords[j] = string.format("%08x", lanes_hi[lanes_used + j] % 4294967296) .. string.format("%08x", lanes_lo[lanes_used + j] % 4294967296)
end
end
lanes_used = lanes_used + qwords_qty
return string.gsub(table.concat(qwords, "", 1, qwords_qty), "(..)(..)(..)(..)(..)(..)(..)(..)", "%8%7%6%5%4%3%2%1"), qwords_qty * 8
end
local parts = {} -- digest parts
local last_part, last_part_size = "", 0
local function get_next_part_of_digest(bytes_needed)
-- returns 'bytes_needed' bytes, for arbitrary integer 'bytes_needed'
bytes_needed = bytes_needed or 1
if bytes_needed <= last_part_size then
last_part_size = last_part_size - bytes_needed
local part_size_in_nibbles = bytes_needed * 2
local result = string.sub(last_part, 1, part_size_in_nibbles)
last_part = string.sub(last_part, part_size_in_nibbles + 1)
return result
end
local parts_qty = 0
if last_part_size > 0 then
parts_qty = 1
parts[parts_qty] = last_part
bytes_needed = bytes_needed - last_part_size
end
-- repeats until the length is enough
while bytes_needed >= 8 do
local next_part, next_part_size = get_next_qwords_of_digest(bytes_needed / 8)
parts_qty = parts_qty + 1
parts[parts_qty] = next_part
bytes_needed = bytes_needed - next_part_size
end
if bytes_needed > 0 then
last_part, last_part_size = get_next_qwords_of_digest(1)
parts_qty = parts_qty + 1
parts[parts_qty] = get_next_part_of_digest(bytes_needed)
else
last_part, last_part_size = "", 0
end
return table.concat(parts, "", 1, parts_qty)
end
if digest_size_in_bytes < 0 then
result = get_next_part_of_digest
else
result = get_next_part_of_digest(digest_size_in_bytes)
end
end
return result
end
end
if message then
-- Actually perform calculations and return the SHA3 digest of a message
return partial(message)()
else
-- Return function for chunk-by-chunk loading
-- User should feed every chunk of input data as single argument to this function and finally get SHA3 digest by invoking this function without an argument
return partial
end
end
local function HexToBinFunction(hh)
return string.char(tonumber(hh, 16))
end
local function hex2bin(hex_string)
return (string.gsub(hex_string, "%x%x", HexToBinFunction))
end
local base64_symbols = {
["+"] = 62, ["-"] = 62, [62] = "+";
["/"] = 63, ["_"] = 63, [63] = "/";
["="] = -1, ["."] = -1, [-1] = "=";
}
local symbol_index = 0
for j, pair in ipairs{"AZ", "az", "09"} do
for ascii = string.byte(pair), string.byte(pair, 2) do
local ch = string.char(ascii)
base64_symbols[ch] = symbol_index
base64_symbols[symbol_index] = ch
symbol_index = symbol_index + 1
end
end
local function bin2base64(binary_string)
local stringLength = #binary_string
local result = table.create(math.ceil(stringLength / 3))
local length = 0
for pos = 1, #binary_string, 3 do
local c1, c2, c3, c4 = string.byte(string.sub(binary_string, pos, pos + 2) .. '\0', 1, -1)
length = length + 1
result[length] =
base64_symbols[math.floor(c1 / 4)] ..
base64_symbols[c1 % 4 * 16 + math.floor(c2 / 16)] ..
base64_symbols[c3 and c2 % 16 * 4 + math.floor(c3 / 64) or -1] ..
base64_symbols[c4 and c3 % 64 or -1]
end
return table.concat(result)
end
local function base642bin(base64_string)
local result, chars_qty = {}, 3
for pos, ch in string.gmatch(string.gsub(base64_string, "%s+", ""), "()(.)") do
local code = base64_symbols[ch]
if code < 0 then
chars_qty = chars_qty - 1
code = 0
end
local idx = pos % 4
if idx > 0 then
result[-idx] = code
else
local c1 = result[-1] * 4 + math.floor(result[-2] / 16)
local c2 = (result[-2] % 16) * 16 + math.floor(result[-3] / 4)
local c3 = (result[-3] % 4) * 64 + code
result[#result + 1] = string.sub(string.char(c1, c2, c3), 1, chars_qty)
end
end
return table.concat(result)
end
local block_size_for_HMAC -- this table will be initialized at the end of the module
|
-- Public Virtual
-- This function is called when the state is exited
|
function BaseState:Exit()
end
|
-- Variables (best not to touch these!)
|
local button = script.Parent
local car = script.Parent.Parent.Car.Value
local sound = script.Parent.Start
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
if script.Parent.Text == "Engine: Off" then -- If the text says it's off then..
sound:Play() -- Startup sound plays..
wait(1.1) -- For realism. Okay?
script.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
button.Text = "Engine: On" -- You don't really need this, but I would keep it.
else -- If it's on then when you click the button,
script.Parent.Parent.IsOn.Value = false -- The car is turned off.
button.Text = "Engine: Off"
end -- Don't touch this.
end) -- And don't touch this either.
|
-- constants for header of binary files (from lundump.h)
|
luaU.LUAC_VERSION = 0x51 -- this is Lua 5.1
luaU.LUAC_FORMAT = 0 -- this is the official format
luaU.LUAC_HEADERSIZE = 12 -- size of header of binary files
|
-- ROBLOX deviation: toBeDefined equivalent to never.toBeNil
|
local function toBeDefined(
-- ROBLOX deviation: self param in Lua needs to be explicitely defined
self: MatcherState,
received: any,
expected: nil
)
local matcherName = "toBeDefined"
local options: MatcherHintOptions = {
isNot = self.isNot,
promise = self.promise,
}
ensureNoExpected(expected, matcherName, options)
local pass = received ~= nil
local message = function()
return matcherHint(matcherName, nil, "", options)
.. "\n\n"
.. string.format("Received: %s", printReceived(received))
end
return { message = message, pass = pass }
end
|
-- Initialize collision tool
|
local CollisionTool = require(CoreTools:WaitForChild 'Collision')
Core.AssignHotkey('K', Core.Support.Call(Core.EquipTool, CollisionTool));
Core.AddToolButton(Core.Assets.CollisionIcon, 'K', CollisionTool)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.