prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-----------------------
|
function warpPlayer(player, location)
local HRP = player:WaitForChild("HumanoidRootPart")
HRP.Position = Vector3.new(location.X, location.Y + 3, location.Z)
end
pad1.Touched:Connect(function(hit)
if hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and bounce then
bounce = false
pad2.PointLight.Enabled = true
warpPlayer(hit.Parent, pad2.Position)
task.wait(2)
bounce = true
pad2.PointLight.Enabled = false
end
end)
pad2.Touched:Connect(function(hit)
if hit.Parent and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and bounce and padIsOneDirectional.Value == false then
bounce = false
pad1.PointLight.Enabled = true
warpPlayer(hit.Parent, pad1.Position)
task.wait(2)
bounce = true
pad1.PointLight.Enabled = false
end
end)
|
--[=[
Sets the ray data to write
@param data table
]=]
|
function DataStoreWriter:SetRawData(data)
self._rawSetData = Table.deepCopy(data)
end
|
--------------------[ ADS FUNCTIONS ]-------------------------------------------------
|
function AimGun()
if (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude > 1 or Reloading or Knifing or ThrowingGrenade then return end
local Scope = Gui_Clone:WaitForChild("Scope"):WaitForChild("Img")
local Steady = Gui_Clone:WaitForChild("Scope"):WaitForChild("Steady")
Aimed = true
Aiming = true
CurrentRecoil = S.Recoil.Aimed
CurrentSpread = S.Spread.Aimed
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(),
UDim2.new(),
Enum.EasingDirection.Out,
Enum.EasingStyle.Sine,
S.AimAnimation and S.AimSpeed or 0,
true
)
if S.AimAnimation then
local CurrentFOV = Camera.FieldOfView
local CurrentCameraOffset = Humanoid.CameraOffset
local CurrentTrans = Scope.BackgroundTransparency
TweenJoint(LWeld, ArmC0[1], S.ArmC1_Aimed.Left, Sine, S.AimSpeed)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_Aimed.Right, Sine, S.AimSpeed)
TweenJoint(AnimWeld, CF(0, 1, 0), CF(), Sine, S.AimSpeed)
TweenJoint(Grip, Grip.C0, Aimed_GripCF, Sine, S.AimSpeed)
TweenJoint(LWeld2, CF(), CF(), Sine, S.AimSpeed)
TweenJoint(RWeld2, CF(), CF(), Sine, S.AimSpeed)
local X = 0
while true do
local NewX = X + 1.5 / S.AimSpeed
X = (NewX > 90 and 90 or NewX)
if (not Aimed) then break end
if (not Selected) then break end
local Alpha = 1 - COS(RAD(X))
Camera.FieldOfView = NumLerp(CurrentFOV, S.MaxZoom, Alpha)
if S.GuiScope then
Scope.BackgroundTransparency = NumLerp(CurrentTrans, 0, Alpha)
end
if X == 90 then break end
RS:wait()
end
else
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_Aimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_Aimed.Right
AnimWeld.C0 = CF(0, 1, 0)
Grip.C1 = Aimed_GripCF
LWeld2.C1, RWeld2.C1 = CF(), CF()
Camera.FieldOfView = S.MaxZoom
end
Aiming = (not Aimed)
if (not Aiming) and S.GuiScope then
spawn(function()
Steady.Visible = true
Scope.BackgroundTransparency = 1
Scope.ImageTransparency = 0
local Gun_Model = Instance.new("Model")
Gun_Model.Name = "Gun_Model"
for _, Obj in pairs(Gun:GetChildren()) do
if Obj:IsA("BasePart") then
local ObjClone = Obj:Clone()
ObjClone.Parent = Gun_Model
local W = Instance.new("Weld")
W.Part0 = ObjClone
W.Part1 = Obj
W.Parent = ObjClone
local PrevTrans = Instance.new("NumberValue")
PrevTrans.Name = "PrevTrans"
PrevTrans.Value = Obj.Transparency
PrevTrans.Parent = Obj
Obj.Transparency = 1
end
end
Gun_Model.Parent = Character
end)
spawn(function()
while Aimed do
local Ang = (CameraSteady and 0 or (Idleing and AnimAng[2] or AnimAng[4]))
if CameraSway ~= 0 then
local OffsetX, OffsetY = 0, 0
if Idleing then
OffsetX = (RAD(COS(Ang * 5 * (CameraSway ^ 0.4))) / 40) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
OffsetY = (RAD(COS(Ang * 2 * (CameraSway ^ 0.4))) / 40) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
else
OffsetX = (RAD(COS(Ang * 3/2 * (CameraSway ^ 0.4))) / 25) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
OffsetY = (RAD(COS(Ang * 3/5 * (CameraSway ^ 0.4))) / 25) * (CameraSway ^ 1.2) * StanceSway * S.ScopeSway
end
RotCamera(OffsetX, OffsetY)
end
RS:wait()
end
end)
end
end
function UnAimGun(Exception)
local Scope = Gui_Clone:WaitForChild("Scope"):WaitForChild("Img")
local Steady = Gui_Clone:WaitForChild("Scope"):WaitForChild("Steady")
if (not Exception) then
if (not Aimed) then return end
if (Reloading and Exception) or Knifing and (not ThrowingGrenade) then return end
CurrentRecoil = S.Recoil.Hipfire
CurrentSpread = ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
if Walking and Aimed then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 150, 0, 150),
UDim2.new(0, -75, 0, -75),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.AimAnimation and S.AimSpeed or 0,
true
)
elseif Idleing then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 70, 0, 70),
UDim2.new(0, -35, 0, -35),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.AimAnimation and S.AimSpeed or 0,
true
)
end
Aimed = false
Aiming = true
if S.GuiScope then
spawn(function()
local Gun_Model = Character:FindFirstChild("Gun_Model")
if Gun_Model then
Gun_Model:Destroy()
end
for _, Obj in pairs(Gun:GetChildren()) do
if Obj:IsA("BasePart") then
local PrevTrans = Obj:FindFirstChild("PrevTrans")
Obj.Transparency = PrevTrans.Value
PrevTrans:Destroy()
end
end
end)
end
if S.AimAnimation then
local CurrentFOV = Camera.FieldOfView
local CurrentCameraOffset = Humanoid.CameraOffset
local CurrentTrans = (Scope.BackgroundTransparency == 1 and (S.GuiScope and 0 or 1) or Scope.BackgroundTransparency)
Scope.ImageTransparency = 1
Steady.Visible = false
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Sine, S.AimSpeed)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Sine, S.AimSpeed)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(20), 0), Sine, S.AimSpeed)
if S.PlayerAnimations then
TweenJoint(LWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, S.AimSpeed)
TweenJoint(RWeld2, CF(), CFANG(0, RAD(ArmTilt), 0), Sine, S.AimSpeed)
end
local X = 0
while true do
local NewX = X + 1.5 / S.AimSpeed
X = (NewX > 90 and 90 or NewX)
if Aimed then break end
if (not Selected) then break end
local Alpha = 1 - COS(RAD(X))
Camera.FieldOfView = NumLerp(CurrentFOV, 90, Alpha)
Scope.BackgroundTransparency = NumLerp(CurrentTrans, 1, Alpha)
if X == 90 then break end
RS:wait()
end
else
Scope.BackgroundTransparency = 1
Scope.ImageTransparency = 1
Steady.Visible = false
LWeld.C0, LWeld.C1 = ArmC0[1], S.ArmC1_UnAimed.Left
RWeld.C0, RWeld.C1 = ArmC0[2], S.ArmC1_UnAimed.Right
Grip.C1 = CFANG(0, RAD(20), 0)
LWeld2.C1, RWeld2.C1 = CFANG(0, RAD(ArmTilt), 0), CFANG(0, RAD(ArmTilt), 0)
Camera.FieldOfView = 90
end
Aiming = Aimed
else
if S.GuiScope then
spawn(function()
local Gun_Model = Character:FindFirstChild("Gun_Model")
if Gun_Model then
Gun_Model:Destroy()
end
for _, Obj in pairs(Gun:GetChildren()) do
if Obj:IsA("BasePart") then
local PrevTrans = Obj:FindFirstChild("PrevTrans")
Obj.Transparency = PrevTrans.Value
PrevTrans:Destroy()
end
end
end)
end
spawn(function()
Aimed = false
Aiming = false
CurrentRecoil = S.Recoil.Hipfire
CurrentSpread = ((Idleing and (not Walking)) and S.Spread.Hipfire or S.Spread.Walking)
if (not Walking) then
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 70, 0, 70),
UDim2.new(0, -35, 0, -35),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.AimAnimation and S.AimSpeed or 0,
true
)
else
Gui_Clone.CrossHair.Box:TweenSizeAndPosition(
UDim2.new(0, 150, 0, 150),
UDim2.new(0, -75, 0, -75),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
S.AimAnimation and S.AimSpeed or 0,
true
)
end
local CurrentFOV = Camera.FieldOfView
local CurrentCameraOffset = Humanoid.CameraOffset
local CurrentTrans = (Scope.BackgroundTransparency == 1 and (S.GuiScope and 0 or 1) or Scope.BackgroundTransparency)
Scope.ImageTransparency = 1
Steady.Visible = false
if LWeld:FindFirstChild("TweenCode") then LWeld.TweenCode:Destroy() end
if RWeld:FindFirstChild("TweenCode") then RWeld.TweenCode:Destroy() end
if Grip:FindFirstChild("TweenCode") then Grip.TweenCode:Destroy() end
if LWeld2:FindFirstChild("TweenCode") then LWeld2.TweenCode:Destroy() end
if RWeld2:FindFirstChild("TweenCode") then RWeld2.TweenCode:Destroy() end
if S.AimAnimation then
local X = 0
while true do
local NewX = X + 1.5 / S.AimSpeed
X = (NewX > 90 and 90 or NewX)
if Aimed then break end
if (not Selected) then break end
local Alpha = 1 - COS(RAD(X))
Camera.FieldOfView = NumLerp(CurrentFOV, 90, Alpha)
Scope.BackgroundTransparency = NumLerp(CurrentTrans, 1, Alpha)
if X == 90 then break end
RS:wait()
end
else
Scope.BackgroundTransparency = 1
Scope.ImageTransparency = 1
Steady.Visible = false
Camera.FieldOfView = 90
end
end)
end
end
|
-- PopperCam Version 16
-- OnlyTwentyCharacters
|
local PopperCam = {} -- Guarantees your players won't see outside the bounds of your map!
|
--[=[
Ensures only the last brio survives.
@return (source Observable<Brio<T>>) -> Observable<Brio<T>>
]=]
|
function RxBrioUtils.onlyLastBrioSurvives()
return function(source)
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(source:Subscribe(function(brio)
if not Brio.isBrio(brio) then
warn(("[RxBrioUtils.onlyLastBrioSurvives] - Not a brio, %q"):format(tostring(brio)))
maid._lastBrio = nil
sub:Fail("Not a brio")
return
end
local wrapperBrio = BrioUtils.clone(brio)
maid._lastBrio = wrapperBrio
sub:Fire(wrapperBrio)
end, sub:GetFailComplete()))
return maid
end)
end
end
|
------------------------------------
|
modelname="Imperial Army" -- Put the EXACT name of the team here
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
math.randomseed(tick())
function findExistingAnimationInSet(set, anim)
if set == nil or anim == nil then
return 0
end
for idx = 1, set.count, 1 do
if set[idx].anim.AnimationId == anim.AnimationId then
return idx
end
end
return 0
end
local function destroyWalkAnimations()
for _,v in pairs(strafingLocomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
for _,v in pairs(fallbackLocomotionMap) do
if v.track then
v.track:Stop()
v.track:Destroy()
v.track = nil
end
end
cachedRunningSpeed = 0
end
local maxVeloX, minVeloX, maxVeloY, minVeloY
local function resetVelocityBounds(velo)
minVeloX = 0
maxVeloX = 0
minVeloY = 0
maxVeloY = 0
end
local function updateVelocityBounds(velo)
if velo then
if velo.x > maxVeloX then maxVeloX = velo.x end
if velo.y > maxVeloY then maxVeloY = velo.y end
if velo.x < minVeloX then minVeloX = velo.x end
if velo.y < minVeloY then minVeloY = velo.y end
end
end
local function checkStrafingEnabled(velo)
if maxVeloX == 0 or minVeloX == 0 or maxVeloY == 0 or minVeloY == 0 then
if locomotionMap == strafingLocomotionMap then
warn("Strafe blending disabled. Not all quadrants of motion represented.")
end
locomotionMap = fallbackLocomotionMap
elseif not strafingLocomotionMap["run"] or not strafingLocomotionMap["walk"] then
if locomotionMap == strafingLocomotionMap then
warn("Strafe blending disabled. Run and walk must be strafing-friendly.")
end
locomotionMap = fallbackLocomotionMap
else
if locomotionMap ~= strafingLocomotionMap then
locomotionMap = strafingLocomotionMap
warn("Strafing reenabled")
end
end
end
local function setupWalkAnimations()
resetVelocityBounds()
-- check to see if we need to blend a walk/run animation
for n,v in pairs(strafingLocomotionMap) do
updateVelocityBounds(v.lv)
end
checkStrafingEnabled()
for n,v in pairs(locomotionMap) do
v.track = Humanoid:LoadAnimation(animTable[n][1].anim)
v.track.Priority = Enum.AnimationPriority.Core
end
end
local function replaceLocomotionTrack(name, lv)
local restartWalks = false
if currentAnim == "walk" and locomotionMap[name] then
-- Need to tear down and startup locomotion
destroyWalkAnimations()
restartWalks = true
end
if lv then
strafingLocomotionMap[name] = {lv=lv, speed = lv.Magnitude}
else
strafingLocomotionMap[name] = nil
end
if name == "run" or name == "walk" then
if lv then
fallbackLocomotionMap[name] = strafingLocomotionMap[name]
else
local speed = name == "run" and RUN_SPEED or WALK_SPEED
fallbackLocomotionMap[name] = {lv=Vector2.new(0.0, speed), speed = speed}
strafingLocomotionMap[name] = nil
end
end
if restartWalks then
setupWalkAnimations()
lastBlendTime = 0
end
end
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
-- check for config values
local config = script:FindFirstChild(name)
if (config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 0
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
local newWeight = 1
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject ~= nil) then
newWeight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
idx = animTable[name].count
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
animTable[name][idx].weight = newWeight
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end))
local lv = childPart:GetAttribute("LinearVelocity")
replaceLocomotionTrack(name, lv)
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
end
end
-- preload anims
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
if PreloadedAnims[animType[idx].anim.AnimationId] == nil then
Humanoid:LoadAnimation(animType[idx].anim)
PreloadedAnims[animType[idx].anim.AnimationId] = true
end
end
end
end
|
--// Recoil Settings
|
gunrecoil = -0.32; -- How much the gun recoils backwards when not aiming
camrecoil = 0.056; -- How much the camera flicks when not aiming
AimGunRecoil = -0.14; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.023; -- How much the camera flicks when aiming
Kickback = 0.10; -- Upward gun rotation when not aiming
AimKickback = 0.10; -- Upward gun rotation when aiming
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 300 -- Spring Dampening
Tune.FSusStiffness = 4000 -- Spring Force
Tune.FSusLength = 2.5 -- Suspension length (in studs)
Tune.FSusMaxExt = .5 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .5 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 8 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.5 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 300 -- Spring Dampening
Tune.RSusStiffness = 4000 -- Spring Force
Tune.RSusLength = 2.5 -- Suspension length (in studs)
Tune.RSusMaxExt = .5 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .5 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 8 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.5 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- Connections
|
game.Players.PlayerAdded:Connect(onPlayerJoin)
|
-- ATTENTION
-- When adding new symbols to this file,
-- Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
| |
-- Simulate a raycast by one tick.
|
local function SimulateCast(cast: ActiveCast, delta: number, expectingShortCall: boolean)
assert(cast.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
PrintDebug("Casting for frame.")
local latestTrajectory = cast.StateInfo.Trajectories[#cast.StateInfo.Trajectories]
local origin = latestTrajectory.Origin
local totalDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
local initialVelocity = latestTrajectory.InitialVelocity
local acceleration = latestTrajectory.Acceleration
local lastPoint = GetPositionAtTime(totalDelta, origin, initialVelocity, acceleration)
local lastVelocity = GetVelocityAtTime(totalDelta, initialVelocity, acceleration)
local lastDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
cast.StateInfo.TotalRuntime += delta
-- Recalculate this.
totalDelta = cast.StateInfo.TotalRuntime - latestTrajectory.StartTime
local currentTarget = GetPositionAtTime(totalDelta, origin, initialVelocity, acceleration)
local segmentVelocity = GetVelocityAtTime(totalDelta, initialVelocity, acceleration)
local totalDisplacement = currentTarget - lastPoint -- This is the displacement from where the ray was on the last from to where the ray is now.
local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta
local targetWorldRoot = cast.RayInfo.WorldRoot
local resultOfCast = targetWorldRoot:Raycast(lastPoint, rayDir, cast.RayInfo.Parameters)
local point = currentTarget
local part: Instance? = nil
local material = Enum.Material.Air
local normal = Vector3.new()
if (resultOfCast ~= nil) then
point = resultOfCast.Position
part = resultOfCast.Instance
material = resultOfCast.Material
normal = resultOfCast.Normal
end
local rayDisplacement = (point - lastPoint).Magnitude
-- For clarity -- totalDisplacement is how far the ray would have traveled if it hit nothing,
-- and rayDisplacement is how far the ray really traveled (which will be identical to totalDisplacement if it did indeed hit nothing)
SendLengthChanged(cast, lastPoint, rayDir.Unit, rayDisplacement, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast.StateInfo.DistanceCovered += rayDisplacement
local rayVisualization: ConeHandleAdornment? = nil
if (delta > 0) then
rayVisualization = DbgVisualizeSegment(CFrame.new(lastPoint, lastPoint + rayDir), rayDisplacement)
end
-- HIT DETECTED. Handle all that garbage, and also handle behaviors 1 and 2 (default behavior, go high res when hit) if applicable.
-- CAST BEHAVIOR 2 IS HANDLED IN THE CODE THAT CALLS THIS FUNCTION.
if part and part ~= cast.RayInfo.CosmeticBulletObject then
local start = tick()
PrintDebug("Hit something, testing now.")
-- SANITY CHECK: Don't allow the user to yield or run otherwise extensive code that takes longer than one frame/heartbeat to execute.
if (cast.RayInfo.CanPierceCallback ~= nil) then
if expectingShortCall == false then
if (cast.StateInfo.IsActivelySimulatingPierce) then
cast:Terminate()
error("ERROR: The latest call to CanPierceCallback took too long to complete! This cast is going to suffer desyncs which WILL cause unexpected behavior and errors. Please fix your performance problems, or remove statements that yield (e.g. wait() calls)")
-- Use error. This should absolutely abort the cast.
end
end
-- expectingShortCall is used to determine if we are doing a forced resolution increase, in which case this will be called several times in a single frame, which throws this error.
cast.StateInfo.IsActivelySimulatingPierce = true
end
------------------------------
if cast.RayInfo.CanPierceCallback == nil or (cast.RayInfo.CanPierceCallback ~= nil and cast.RayInfo.CanPierceCallback(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject) == false) then
PrintDebug("Piercing function is nil or it returned FALSE to not pierce this hit.")
cast.StateInfo.IsActivelySimulatingPierce = false
if (cast.StateInfo.HighFidelityBehavior == 2 and latestTrajectory.Acceleration ~= Vector3.new() and cast.StateInfo.HighFidelitySegmentSize ~= 0) then
cast.StateInfo.CancelHighResCast = false -- Reset this here.
if cast.StateInfo.IsActivelyResimulating then
cast:Terminate()
error("Cascading cast lag encountered! The caster attempted to perform a high fidelity cast before the previous one completed, resulting in exponential cast lag. Consider increasing HighFidelitySegmentSize.")
end
cast.StateInfo.IsActivelyResimulating = true
-- This is a physics based cast and it needs to be recalculated.
PrintDebug("Hit was registered, but recalculation is on for physics based casts. Recalculating to verify a real hit...")
-- Split this ray segment into smaller segments of a given size.
-- In 99% of cases, it won't divide evently (e.g. I have a distance of 1.25 and I want to divide into 0.1 -- that won't work)
-- To fix this, the segments need to be stretched slightly to fill the space (rather than having a single shorter segment at the end)
local numSegmentsDecimal = rayDisplacement / cast.StateInfo.HighFidelitySegmentSize -- say rayDisplacement is 5.1, segment size is 0.5 -- 10.2 segments
local numSegmentsReal = math.floor(numSegmentsDecimal) -- 10 segments + 0.2 extra segments
local realSegmentLength = rayDisplacement / numSegmentsReal -- this spits out 0.51, which isn't exact to the defined 0.5, but it's close
-- Now the real hard part is converting this to time.
local timeIncrement = delta / numSegmentsReal
for segmentIndex = 1, numSegmentsReal do
if cast.StateInfo.CancelHighResCast then
cast.StateInfo.CancelHighResCast = false
break
end
local subPosition = GetPositionAtTime(lastDelta + (timeIncrement * segmentIndex), origin, initialVelocity, acceleration)
local subVelocity = GetVelocityAtTime(lastDelta + (timeIncrement * segmentIndex), initialVelocity, acceleration)
local subRayDir = subVelocity * delta
local subResult = targetWorldRoot:Raycast(subPosition, subRayDir, cast.RayInfo.Parameters)
local subDisplacement = (subPosition - (subPosition + subVelocity)).Magnitude
if (subResult ~= nil) then
local subDisplacement = (subPosition - subResult.Position).Magnitude
local dbgSeg = DbgVisualizeSegment(CFrame.new(subPosition, subPosition + subVelocity), subDisplacement)
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.286275, 0.329412, 0.247059) end
if cast.RayInfo.CanPierceCallback == nil or (cast.RayInfo.CanPierceCallback ~= nil and cast.RayInfo.CanPierceCallback(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject) == false) then
-- Still hit even at high res
cast.StateInfo.IsActivelyResimulating = false
SendRayHit(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
local vis = DbgVisualizeHit(CFrame.new(point), false)
if (vis ~= nil) then vis.Color3 = Color3.new(0.0588235, 0.87451, 1) end
return
else
-- Recalculating hit something pierceable instead.
SendRayPierced(cast, subResult, subVelocity, cast.RayInfo.CosmeticBulletObject) -- This may result in CancelHighResCast being set to true.
local vis = DbgVisualizeHit(CFrame.new(point), true)
if (vis ~= nil) then vis.Color3 = Color3.new(1, 0.113725, 0.588235) end
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.305882, 0.243137, 0.329412) end
end
else
local dbgSeg = DbgVisualizeSegment(CFrame.new(subPosition, subPosition + subVelocity), subDisplacement)
if (dbgSeg ~= nil) then dbgSeg.Color3 = Color3.new(0.286275, 0.329412, 0.247059) end
end
end
-- If the script makes it here, then it wasn't a real hit (higher resolution revealed that the low-res hit was faulty)
-- Just let it keep going.
cast.StateInfo.IsActivelyResimulating = false
elseif (cast.StateInfo.HighFidelityBehavior ~= 1 and cast.StateInfo.HighFidelityBehavior ~= 3) then
cast:Terminate()
error("Invalid value " .. (cast.StateInfo.HighFidelityBehavior) .. " for HighFidelityBehavior.")
else
-- This is not a physics cast, or recalculation is off.
PrintDebug("Hit was successful. Terminating.")
SendRayHit(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
DbgVisualizeHit(CFrame.new(point), false)
return
end
else
PrintDebug("Piercing function returned TRUE to pierce this part.")
if rayVisualization ~= nil then
rayVisualization.Color3 = Color3.new(0.4, 0.05, 0.05) -- Turn it red to signify that the cast was scrapped.
end
DbgVisualizeHit(CFrame.new(point), true)
local params = cast.RayInfo.Parameters
local alteredParts = {}
local currentPierceTestCount = 0
local originalFilter = params.FilterDescendantsInstances
local brokeFromSolidObject = false
while true do
-- So now what I need to do is redo this entire cast, just with the new filter list
-- Catch case: Is it terrain?
if resultOfCast.Instance:IsA("Terrain") then
if material == Enum.Material.Water then
-- Special case: Pierced on water?
cast:Terminate()
error("Do not add Water as a piercable material. If you need to pierce water, set cast.RayInfo.Parameters.IgnoreWater = true instead", 0)
end
warn("WARNING: The pierce callback for this cast returned TRUE on Terrain! This can cause severely adverse effects.")
end
if params.FilterType == Enum.RaycastFilterType.Blacklist then
-- blacklist
-- DO NOT DIRECTLY TABLE.INSERT ON THE PROPERTY
local filter = params.FilterDescendantsInstances
table.insert(filter, resultOfCast.Instance)
table.insert(alteredParts, resultOfCast.Instance)
params.FilterDescendantsInstances = filter
else
-- whitelist
-- method implemeneted by custom table system
-- DO NOT DIRECTLY TABLE.REMOVEOBJECT ON THE PROPERTY
local filter = params.FilterDescendantsInstances
table.removeObject(filter, resultOfCast.Instance)
table.insert(alteredParts, resultOfCast.Instance)
params.FilterDescendantsInstances = filter
end
SendRayPierced(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
-- List has been updated, so let's cast again.
resultOfCast = targetWorldRoot:Raycast(lastPoint, rayDir, params)
-- No hit? No simulation. Break.
if resultOfCast == nil then
break
end
if currentPierceTestCount >= MAX_PIERCE_TEST_COUNT then
warn("WARNING: Exceeded maximum pierce test budget for a single ray segment (attempted to test the same segment " .. MAX_PIERCE_TEST_COUNT .. " times!)")
break
end
currentPierceTestCount = currentPierceTestCount + 1;
if cast.RayInfo.CanPierceCallback(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject) == false then
brokeFromSolidObject = true
break
end
end
-- Restore the filter to its default state.
cast.RayInfo.Parameters.FilterDescendantsInstances = originalFilter
cast.StateInfo.IsActivelySimulatingPierce = false
if brokeFromSolidObject then
-- We actually hit something while testing.
PrintDebug("Broke because the ray hit something solid (" .. tostring(resultOfCast.Instance) .. ") while testing for a pierce. Terminating the cast.")
SendRayHit(cast, resultOfCast, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
DbgVisualizeHit(CFrame.new(resultOfCast.Position), false)
return
end
-- And exit the function here too.
end
end
if (cast.StateInfo.DistanceCovered >= cast.RayInfo.MaxDistance) then
-- SendRayHit(cast, nil, segmentVelocity, cast.RayInfo.CosmeticBulletObject)
cast:Terminate()
DbgVisualizeHit(CFrame.new(currentTarget), false)
end
end
|
-------------------------------------------
|
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(0.5,0.495,1.25) * CFrame.fromEulerAnglesXYZ(math.rad(90),0,0)
arms[2].Name = "Right Leg"
arms[2].CanCollide = true
welds[2] = weld2
|
--[=[
@within TableUtil
@function Shuffle
@param tbl table
@param rngOverride Random?
@return table
Shuffles the table.
```lua
local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
local shuffled = TableUtil.Shuffle(t)
print(shuffled) --> e.g. {9, 4, 6, 7, 3, 1, 5, 8, 2}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=]
|
local function Shuffle(tbl: Table, rngOverride: Random?): Table
assert(type(tbl) == "table", "First argument must be a table")
local shuffled = Copy(tbl)
local random = if typeof(rngOverride) == "Random" then rngOverride else rng
for i = #tbl, 2, -1 do
local j = random:NextInteger(1, i)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
return shuffled
end
|
----------------------------------------------------
|
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid~=nil then
tagHumanoid(humanoid)
humanoid.Health = humanoid.Health - damage
wait(0.00000001)
untagHumanoid(humanoid)
connection:disconnect()
else
damage = damage / 2
if damage < 2 then
connection:disconnect()
ball.Parent = nil
end
end
if math.random(1,1) == 1 then
explosion = Instance.new("Explosion")
explosion.BlastRadius = Radius
explosion.BlastPressure = Force -- these are really wussy units
explosion.Position = script.Parent.Position
explosion.Parent = game.Workspace
connection:disconnect()
ball.Parent = nil
cancollide = true
end
end
function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
connection = ball.Touched:connect(onTouched)
r = game:service("RunService")
t, s = r.Stepped:wait()
d = t + 5.0 - s
while t < d do
t = r.Stepped:wait()
end
ball.Parent = nil
|
-- tween the sound to the speed
|
local tween = game:GetService("TweenService"):Create(waterSound,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In),{["Volume"] = math.clamp(speed/maxSpeed,0,1)}) -- end of tweencreate
tween:Play()
if speed > 0.01 and not swim.IsPlaying then
print("play swim")
swim:Play()
elseif speed <0.01 and swim.IsPlaying then
print("stop swim")
swim:Stop()
end
end
|
-- Listen to current and all future characters of our player
|
Player.CharacterAdded:Connect(OnCharacterAdded)
if Player.Character then
OnCharacterAdded(Player.Character)
end
do -- Hotkey stuff
-- Listen to key down
UserInputService.InputBegan:Connect(OnInputBegan)
-- Listen to ANY TextBox gaining or losing focus, for disabling all hotkeys
UserInputService.TextBoxFocused:Connect(function() TextBoxFocused = true end)
UserInputService.TextBoxFocusReleased:Connect(function() TextBoxFocused = false end)
-- Manual unequip for HopperBins on drop button pressed
HotkeyFns[DROP_HOTKEY_VALUE] = function() --NOTE: HopperBin
UnequipAllTools()
end
-- Listen to keyboard status, for showing/hiding hotkey labels
UserInputService.Changed:Connect(OnUISChanged)
OnUISChanged('KeyboardEnabled')
-- Listen to gamepad status, for allowing gamepad style selection/equip
if UserInputService:GetGamepadConnected(Enum.UserInputType.Gamepad1) then
gamepadConnected()
end
UserInputService.GamepadConnected:Connect(function(gamepadEnum)
if gamepadEnum == Enum.UserInputType.Gamepad1 then
gamepadConnected()
end
end)
UserInputService.GamepadDisconnected:Connect(function(gamepadEnum)
if gamepadEnum == Enum.UserInputType.Gamepad1 then
gamepadDisconnected()
end
end)
end
function BackpackScript:SetBackpackEnabled(Enabled)
BackpackEnabled = Enabled
end
function BackpackScript:IsOpened()
return BackpackScript.IsOpen
end
function BackpackScript:GetBackpackEnabled()
return BackpackEnabled
end
function BackpackScript:GetStateChangedEvent()
return Backpack.StateChanged
end
RunService.Heartbeat:Connect(function()
OnIconChanged(BackpackEnabled)
end)
return BackpackScript
|
--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
--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
| |
--[ Constants ]:
|
local Cam = Wrks.CurrentCamera;
local Plr = Plrs.LocalPlayer;
local Mouse = Plr:GetMouse();
local Body = Wrks:WaitForChild(Plr.Name);
local Head = Body:WaitForChild("Head");
local Hum = Body:WaitForChild("Humanoid");
local Core = Body:WaitForChild("HumanoidRootPart");
local IsR6 = (Hum.RigType.Value==0); --[ Checking if the player is using the new Rig or the original. ]
local Trso = (IsR6 and Body:WaitForChild("Torso")) or Body:WaitForChild("UpperTorso");
local Neck = (IsR6 and Trso:WaitForChild("Neck")) or Head:WaitForChild("Neck"); --[ Once we know the Rig, we know what to find. ]
local MseGuide = false; --[ Useful with tools if true; camera tracking runs smoother however. ]
local Fctor = 1; --[ 0: Negates tracking, 1: Relatively normal tracking, 2: Looks a little weird, just sayin'. ]
local OrgnC0 = Neck.C0; --[ Get the base C0 to manipulate off of. ]
|
--[[Brakes]]
|
Tune.ABSEnabled = false -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2500 -- Front brake force
Tune.RBrakeForce = 2000 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
-- RCM Settings V
|
self.WeaponWeight = 0 -- Weapon weight must be enabled in the Config module
self.ShellEjectionMod = true
self.Holster = true
self.HolsterPoint = "Right Leg"
self.HolsterCFrame = CFrame.new(0.65,0.8,0.2) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
self.FlashChance = 3 -- 0 = no muzzle flash, 10 = Always muzzle flash
self.ADSEnabled = { -- Ignore this setting if not using an ADS Mesh
true, -- Enabled for primary sight
false} -- Enabled for secondary sight (T)
self.ExplosiveAmmo = false -- Enables explosive ammo
self.ExplosionRadius = 70 -- Radius of explosion damage in studs
self.ExplosionType = "Default" -- Which explosion effect is used from the HITFX Explosion folder
self.IsLauncher = true -- For RPG style rocket launchers
self.EjectionOverride = nil -- Don't touch unless you know what you're doing with Vector3s
return self
|
-- Gradually regenerates the Humanoid's Health over time.
|
local REGEN_RATE = 1/125 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.5 -- Wait this long between each regeneration step.
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 641 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Door parts flashing function
|
function Flash(Colour)
if Colour == nil then return end
for i = 1,2 do
wait(0.3)
DoorLogo.BrickColor = BrickColor.new(Colour)
wait(0.3)
DoorLogo.BrickColor = BrickColor.new("Medium stone grey")
end
end
|
--!strict
|
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
local indexOf = require(script.Parent.indexOf)
return function<T>(array: Array<T>, searchElement: T, fromIndex: number?): boolean
return indexOf(array, searchElement, fromIndex) ~= -1
end
|
--Left Leg
|
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.Y,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.Z,car.Misc.Anims.R15.LeftLeg.Foot.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.X,car.Misc.Anims.R15.LeftLeg.Foot.Z,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.Foot.Parts,car.Misc.Anims.R15.LeftLeg.Foot.X)
MakeWeld(car.Misc.Anims.R15.LeftLeg.LowerLeg.X,car.Misc.Anims.R15.LeftLeg.Foot.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.LowerLeg.Parts,car.Misc.Anims.R15.LeftLeg.LowerLeg.X)
MakeWeld(car.Misc.Anims.R15.LeftLeg.UpperLeg.X,car.Misc.Anims.R15.LeftLeg.LowerLeg.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.UpperLeg.Parts,car.Misc.Anims.R15.LeftLeg.UpperLeg.X)
function animPose(seat,pose)
local C
local S=seat
local WS={}
local HW={}
local seatOffset = CFrame.new(0,0,0)
S.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(WS) do
if v~=0 then
if v[4]~=nil then
v[4]:Destroy()
v[1].Part1=v[5]
else
if v[2]~=nil then
v[1].C0=v[2] v[1].C1=v[3]
else
v[1]:Destroy()
end
end
end
end
for i,v in pairs(HW) do
v[1]:Destroy()
v[2]:Destroy()
v[3].Transparency=0
end
C=nil
WS = {}
HW = {}
end
end)
S.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
C = child.Part1.Parent
S.SeatWeld.C0 = seatOffset
S.SeatWeld.C1 = CFrame.new()
local pkTor = false
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.Torso then
pkTor=true
break
end
end
local function MW(x,y)
local WW=Instance.new("Weld",x) WW.Part0=x WW.Part1=y return WW
end
if C:FindFirstChild("HumanoidRootPart")~=nil and C:FindFirstChild("Torso")~=nil then
S.SeatWeld.C0=seatOffset
S.SeatWeld.C1=CFrame.new()
C.HumanoidRootPart.RootJoint.Part1=nil
table.insert(WS,{C.HumanoidRootPart.RootJoint,C.HumanoidRootPart.RootJoint.C0,C.HumanoidRootPart.RootJoint.C1,MW(C.HumanoidRootPart,C.Torso),C.Torso})
if C.Torso:FindFirstChild("Neck")~=nil then
local H=C.Head:Clone()
H.Name="Part"
H.Parent=C
local WH=MW(C.Torso,H)
WH.C0=C.Torso.Neck.C0
WH.C1=C.Torso.Neck.C0
C.Head.Transparency=1
table.insert(HW,{H,WH,C.Head})
table.insert(WS,{WH,nil,nil,nil,nil})
for i,v in pairs(C.Head:GetChildren()) do
if v:IsA("Weld") then
local pp=v.Part1:Clone()
pp.Parent=C
v.Part1.Transparency=1
local ww=MW(H,pp)
ww.C0=v.C0
ww.C1=v.C1
table.insert(HW,{pp,ww,v.Part1})
end
end
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Left Shoulder")~=nil then
C.Torso:FindFirstChild("Left Shoulder").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Left Shoulder"),C.Torso:FindFirstChild("Left Shoulder").C0,C.Torso:FindFirstChild("Left Shoulder").C1,MW(C.Torso,C:FindFirstChild("Left Arm")),C:FindFirstChild("Left Arm")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Right Shoulder")~=nil then
C.Torso:FindFirstChild("Right Shoulder").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Right Shoulder"),C.Torso:FindFirstChild("Right Shoulder").C0,C.Torso:FindFirstChild("Right Shoulder").C1,MW(C.Torso,C:FindFirstChild("Right Arm")),C:FindFirstChild("Right Arm")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Left Hip")~=nil then
C.Torso:FindFirstChild("Left Hip").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Left Hip"),C.Torso:FindFirstChild("Left Hip").C0,C.Torso:FindFirstChild("Left Hip").C1,MW(C.Torso,C:FindFirstChild("Left Leg")),C:FindFirstChild("Left Leg")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Right Hip")~=nil then
C.Torso:FindFirstChild("Right Hip").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Right Hip"),C.Torso:FindFirstChild("Right Hip").C0,C.Torso:FindFirstChild("Right Hip").C1,MW(C.Torso,C:FindFirstChild("Right Leg")),C:FindFirstChild("Right Leg")})
else
table.insert(WS,0)
end
end
for i,v in pairs(WS) do
local cfp = pose[i]
if i==3 then
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.LeftArm then
cfp = pose[7]
break
end
end
elseif i==4 then
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.RightArm then
cfp = pose[8]
break
end
end
end
if v[4]~=nil then
v[4].C0=cfp
v[4].C1=CFrame.new()
else
v[1].C0=cfp
v[1].C1=CFrame.new()
end
end
end
end)
end
local Passenger={
CFrame.new(0.00701141357, 1.09911013, 0.0404243469, 1, 3.80970855e-09, -4.35450502e-08, 0, 0.996194661, 0.087155968, 4.37113883e-08, -0.087155968, 0.996194661), --Torso
CFrame.new(0, 1.50000381, 0, 1, 0, 0, 0, 0.996194661, -0.087155968, 0, 0.087155968, 0.996194661), --Head
CFrame.new(-0.876424789, -0.214377403, -0.478406906, 0.819151819, -0.573576868, 7.37368282e-07, 0.519837081, 0.742402971, -0.422619611, 0.242404267, 0.346189946, 0.906307161), --Larm
CFrame.new(0.876424789, -0.214377403, -0.478406906, 0.819151819, 0.573576868, -7.37368282e-07, -0.519837081, 0.742402971, -0.422619611, -0.242404267, 0.346189946, 0.906307161), --Rarm
CFrame.new(-1.27365112, -1.25288582, -1.13527107, 0.98480773, -0.173648179, 0, 0.171010077, 0.969846308, 0.173647881, -0.0301536396, -0.171009779, 0.984807789), --Lleg
CFrame.new(1.27365112, -1.25288582, -1.13527298, 0.98480773, 0.173648179, 0, -0.171010077, 0.969846308, 0.173647881, 0.0301536396, -0.171009779, 0.984807789) --Rleg
}
|
-- // Functions
|
if rootPart:FindFirstChild("Running") then
rootPart.Running.Volume = 0
end
|
--/////////////////////////////////////////////////////////--
|
local dZIndex = 2
local dScrollBar = 4
local dBackground = Color3.new(31/255, 31/255, 31/255)
local dSecondaryBackground = dBackground:lerp(Color3.new(1,1,1), 0.1);
local dTransparency = 0
local dPixelSize = 0
local dBorder = Color3.new(27/255,42/255,53/255)
local dPosition = UDim2.new(0,5,0,5)
local dCanvasSize = UDim2.new(0, 0, 0, 0)
local dScrollImage = "http://roblox.com/asset?id=158348114"
local dTextColor = Color3.new(1,1,1)
local dSize = UDim2.new(1,-10,1,-10)
local dFont = "SourceSans"
local dTextSize = 16
local dPlaceholderColor = Color3.fromRGB(178, 178, 178)
local MouseIcons = {
Horizontal = "rbxassetid://1243146213";
Vertical = "rbxassetid://1243145985";
LeftCorner = "rbxassetid://1243145459";
RightCorner = "rbxassetid://1243145350";
TopRight = "rbxassetid://1243145459";
TopLeft = "rbxassetid://1243145350";
}
|
--Tune
|
OverheatSpeed = .5 --How fast the car will overheat
CoolingEfficiency = .2 --How fast the car will cool down
RunningTemp = 60 --In degrees
Fan = false --Cooling fan
FanTemp = 110 --At what temperature the cooling fan will activate
FanTempAlpha = 130 --At what temperature the cooling fan will deactivate
FanSpeed = .08 --How fast the car will cool down
FanVolume = .5 --Sound volume
BlowupTemp = 130 --At what temperature the engine will blow up
GUI = true --GUI temperature gauge
|
--// Wrap
|
log("Wrap")
local service_Wrap = service.Wrap
local service_UnWrap = service.UnWrap
for i, val in service do
if type(val) == "userdata" then
service[i] = service_Wrap(val, true)
end
end
|
-- if Input.KeyCode == Enum.KeyCode.Z then
-- if Holding.Value == "Z" then
-- isHolding = false
-- SkillsHandler:FireServer("Skill", "Release", "Z", Mouse:GetHit().Position, Char.HumanoidRootPart.CFrame)
-- Animations.Z:AdjustSpeed(1)
-- end
-- end
--end)
| |
--[[
Server init file
]]
|
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local PlayerManager = require(ServerStorage.Source.Managers.PlayerManager)
local ServerStateMachine = require(ServerStorage.Source.GameStates.ServerStateMachine)
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local Logger = require(ReplicatedStorage.Dependencies.GameUtils.Logger)
local ProfessorController = require(ServerStorage.Source.Controllers.ProfessorController)
local SetupLobby = require(ServerStorage.Source.SetupLobby)
Logger.setCutoff(Constants.LoggerLevel.Warn)
PlayerManager.init()
ServerStateMachine.init()
ProfessorController.init()
SetupLobby()
|
---Settings---
|
local Time_Before_Disappearing = 3.4
local Fade_Out_Enabled = true---fade out effect
local Fade_Out_Smoothness = 0.1----smaller number = smoother it fades
|
--//# Terrain Setup
|
function SetupTerrain()
local Terrain = game.Workspace.Terrain;
Terrain.WaterTransparency = 1
Terrain.WaterReflectance = 1
end
if Enabled then
if TerrainPlusEnabled then
SetupTerrain()
warn("Loaded Better Terrain")
end
if BetterLightingEnabled then
SetupLighting_()
warn("Loaded Lighting+")
end
elseif not Enabled then
error("Script Disabled.")
return false
end
|
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- Explorer panel
|
Create(explorerPanel,{
BackgroundColor3 = GuiColor.Field;
BorderColor3 = GuiColor.Border;
Active = true;
})
local SettingsRemote = explorerPanel.Parent:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local GetApiRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetApi")
local GetAwaitRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetAwaiting")
local bindSetAwaiting = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("SetAwaiting")
local CautionWindow = explorerPanel.Parent:WaitForChild("Caution")
local TableCautionWindow = explorerPanel.Parent:WaitForChild("TableCaution")
local RemoteWindow = explorerPanel.Parent:WaitForChild("CallRemote")
local CurrentRemoteWindow
local lastSelectedNode
local listFrame = Create('Frame',{
Name = "List";
BackgroundTransparency = 1;
ClipsDescendants = true;
Position = UDim2_new(0,0,0,HEADER_SIZE);
Size = UDim2_new(1,-GUI_SIZE,1,-HEADER_SIZE);
Parent = explorerPanel;
})
local scrollBar = ScrollBar(false)
scrollBar.PageIncrement = 1
Create(scrollBar.GUI,{
Position = UDim2_new(1,-GUI_SIZE,0,HEADER_SIZE);
Size = UDim2_new(0,GUI_SIZE,1,-HEADER_SIZE);
Parent = explorerPanel;
})
local scrollBarH = ScrollBar(true)
scrollBarH.PageIncrement = GUI_SIZE
Create(scrollBarH.GUI,{
Position = UDim2_new(0,0,1,-GUI_SIZE);
Size = UDim2_new(1,-GUI_SIZE,0,GUI_SIZE);
Visible = false;
Parent = explorerPanel;
})
local headerFrame = Create('Frame',{
Name = "Header";
BackgroundColor3 = GuiColor.Background;
BorderSizePixel = 0;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,0,HEADER_SIZE);
Parent = explorerPanel;
Create('TextLabel',{
Text = "Explorer";
BackgroundTransparency = 1;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
Font = FONT;
FontSize = FONT_SIZE;
Position = UDim2_new(0,4,0,0);
Size = UDim2_new(1,-4,0.5,0);
});
})
local explorerFilter = Create('TextBox',{
PlaceholderText = "Filter workspace...";
PlaceholderColor3 = Color3_fromRGB(153, 153, 153);
Text = "";
BackgroundTransparency = 0.8;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
Font = FONT;
FontSize = FONT_SIZE;
Position = UDim2_new(0,4,0.5,0);
Size = UDim2_new(1,-8,0.5,-2);
Create('UIPadding',{
PaddingLeft = UDim.new(0, 4)
})
});
explorerFilter.Parent = headerFrame
SetZIndexOnChanged(explorerPanel)
local function CreateColor3(r, g, b) return Color3_new(r/255,g/255,b/255) end
local Styles = {
Font = Enum.Font.Arial,
Margin = 5,
Black = Color3_fromRGB(0,0,5),
Black2 = Color3_fromRGB(24, 24, 29),
White = Color3_fromRGB(244,244,249),
WhiteOver = Color3_fromRGB(200,200,205),
Hover = Color3_fromRGB(2, 128, 149),
Hover2 = Color3_fromRGB(5, 102, 146)
}
local Row = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size14,
TextXAlignment = Enum.TextXAlignment.Left,
TextColor = Styles.White,
TextColorOver = Styles.WhiteOver,
TextLockedColor = Color3_fromRGB(155,155,160),
Height = 24,
BorderColor = Color3_fromRGB(54,54,55),
BackgroundColor = Styles.Black2,
BackgroundColorAlternate = Color3_fromRGB(32, 32, 37),
BackgroundColorMouseover = Color3_fromRGB(40, 40, 45),
TitleMarginLeft = 15
}
local DropDown = {
Font = Styles.Font,
FontSize = Enum.FontSize.Size14,
TextColor = Color3_fromRGB(255,255,260),
TextColorOver = Row.TextColorOver,
TextXAlignment = Enum.TextXAlignment.Left,
Height = 20,
BackColor = Styles.Black2,
BackColorOver = Styles.Hover2,
BorderColor = Color3_fromRGB(45,45,50),
BorderSizePixel = 0,
ArrowColor = Color3_fromRGB(80,80,83),
ArrowColorOver = Styles.Hover
}
local BrickColors = {
BoxSize = 13,
BorderSizePixel = 0,
BorderColor = Color3_fromRGB(53,53,55),
FrameColor = Color3_fromRGB(53,53,55),
Size = 20,
Padding = 4,
ColorsPerRow = 8,
OuterBorder = 1,
OuterBorderColor = Styles.Black
}
local currentRightClickMenu
local CurrentInsertObjectWindow
local CurrentFunctionCallerWindow
local RbxApi
function ClassCanCreate(IName)
local success,err = pcall(function() Instance_new(IName) end)
if err then
return false
else
return true
end
end
function GetClasses()
if RbxApi == nil then return {} end
local classTable = {}
for i,v in pairs(RbxApi.Classes) do
if ClassCanCreate(v.Name) then
table.insert(classTable,v.Name)
end
end
return classTable
end
local function sortAlphabetic(t, property)
table.sort(t,
function(x,y) return x[property] < y[property]
end)
end
local function FunctionIsHidden(functionData)
local tags = functionData["Tags"]
if tags then
for _,name in pairs(tags) do
if name == "Deprecated"
or name == "Hidden"
or name == "ReadOnly"
or name == "NotScriptable" then
return true
end
end
end
return false
end
local function GetAllFunctions(className)
local class = RbxApi.Classes[className]
local functions = {}
if not class then return functions end
while class do
if class.Name == "Instance" then break end
for _,nextFunction in pairs(class.Members) do
if nextFunction.MemberType == "Function" and not FunctionIsHidden(nextFunction) then
table.insert(functions, nextFunction)
end
end
class = RbxApi.Classes[class.Superclass]
end
sortAlphabetic(functions, "Name")
return functions
end
function GetFunctions()
if RbxApi == nil then return {} end
local List = SelectionVar():Get()
if #List == 0 then return end
local MyObject = List[1]
local functionTable = {}
for i,v in pairs(GetAllFunctions(MyObject.ClassName)) do
table.insert(functionTable,v)
end
return functionTable
end
function CreateInsertObjectMenu(choices, currentChoice, readOnly, onClick)
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
local totalSize = explorerPanel.Parent.AbsoluteSize.y
if #choices == 0 then return end
table.sort(choices, function(a,b) return a < b end)
local frame = Instance_new("Frame")
frame.Name = "InsertObject"
frame.Size = UDim2_new(0, 200, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
--[[
local button = Instance_new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
button.TextColor3 = Row.TextColor
if readOnly then
button.TextColor3 = Row.TextLockedColor
end
button.Text = currentChoice
button.Size = UDim2_new(1, -2 * Styles.Margin, 1, 0)
button.Position = UDim2_new(0, Styles.Margin, 0, 0)
button.Parent = frame
--]]
local function hideMenu()
expanded = false
--showArrow(DropDown.ArrowColor)
if frame then
--frame:Destroy()
CurrentInsertObjectWindow.Visible = false
end
end
local function showMenu()
expanded = true
menu = Instance_new("ScrollingFrame")
menu.Size = UDim2_new(0,200,1,0)
menu.CanvasSize = UDim2_new(0, 200, 0, #choices * DropDown.Height)
menu.Position = UDim2_new(0, margin, 0, 0)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.TopImage = "rbxasset://textures/blackBkg_square.png"
menu.MidImage = "rbxasset://textures/blackBkg_square.png"
menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
--local parentFrameHeight = script.Parent.List.Size.Y.Offset
--local rowHeight = mouse.Y
--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
-- menu.Position = UDim2_new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
--end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name, function()
choice(name)
end,1)
option.Size = UDim2_new(1, 0, 0, 20)
option.Position = UDim2_new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showMenu()
return frame
end
function CreateFunctionCallerMenu(choices, currentChoice, readOnly, onClick)
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
local totalSize = explorerPanel.Parent.AbsoluteSize.y
if #choices == 0 then return end
table.sort(choices, function(a,b) return a.Name < b.Name end)
local frame = Instance_new("Frame")
frame.Name = "InsertObject"
frame.Size = UDim2_new(0, 200, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
local function hideMenu()
expanded = false
--showArrow(DropDown.ArrowColor)
if frame then
--frame:Destroy()
CurrentInsertObjectWindow.Visible = false
end
end
local function showMenu()
expanded = true
menu = Instance_new("ScrollingFrame")
menu.Size = UDim2_new(0,300,1,0)
menu.CanvasSize = UDim2_new(0, 300, 0, #choices * DropDown.Height)
menu.Position = UDim2_new(0, margin, 0, 0)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.TopImage = "rbxasset://textures/blackBkg_square.png"
menu.MidImage = "rbxasset://textures/blackBkg_square.png"
menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
--local parentFrameHeight = script.Parent.List.Size.Y.Offset
--local rowHeight = mouse.Y
--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
-- menu.Position = UDim2_new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
--end
local function GetParameters(functionData)
local paraString = ""
paraString = paraString.."("
for i,v in pairs(functionData.Parameters) do
paraString = paraString..v.Type.Name.." "..v.Name
if i < #functionData.Parameters then
paraString = paraString..", "
end
end
paraString = paraString..")"
return paraString
end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name.ReturnType.Name.." "..name.Name..GetParameters(name), function()
choice(name)
end,2)
option.Size = UDim2_new(1, 0, 0, 20)
option.Position = UDim2_new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showMenu()
return frame
end
function CreateInsertObject()
if not CurrentInsertObjectWindow then return end
CurrentInsertObjectWindow.Visible = true
if currentRightClickMenu and CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Position = UDim2_new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset,0,0)
end
if CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Parent = explorerPanel.Parent
end
end
function CreateFunctionCaller(oh)
if CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
end
CurrentFunctionCallerWindow = CreateFunctionCallerMenu(
GetFunctions(),
"",
false,
function(option)
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
local list = SelectionVar():Get()
for i,v in pairs(list) do
local rets = RemoteEvent:InvokeServer("CallFunction",v,option.Name)
print(rets)
pcall(function() print("Function", option.Name, "on", v, ":", unpack(rets)) end)
end
DestroyRightClick()
end
)
if currentRightClickMenu and CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow.Position = UDim2_new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset*1.5,0,0)
end
if CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow.Parent = explorerPanel.Parent
end
end
function CreateRightClickMenuItem(text, onClick, insObj)
local button = Instance_new("TextButton")
button.Font = DropDown.Font
button.FontSize = DropDown.FontSize
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
button.AutoButtonColor = false
button.BorderSizePixel = 0
button.TextTransparency = 1
button.Active = true
if text then
local label = Instance_new("TextLabel")
label.Size = UDim2_new(1, 0, 1, 0)
label.Font = DropDown.Font
label.FontSize = Enum.FontSize.Size11
label.TextColor3 = DropDown.TextColor
label.TextXAlignment = DropDown.TextXAlignment
label.BackgroundTransparency = 1
label.BorderSizePixel = 0
label.ZIndex = 5
label.Text = text
button.Text = text
label.Parent = button
if insObj == 2 then
label.FontSize = Enum.FontSize.Size11
label.Size = UDim2_new(1, -16, 1, 0)
label.Position = UDim2_new(0, 16, 0, 0)
else
if insObj == 1 or ExplorerIndex[text] then
if ExplorerIndex[text] then
local newIcon = Icon(nil,ExplorerIndex[text] or 0)
newIcon.Position = UDim2_new(0,2,0,2)
newIcon.Size = UDim2_new(0,16,0,16)
newIcon.IconMap.ZIndex = 5
newIcon.Parent = button
else
local newIcon = ClassIcon(nil,ClassIndex[text] or 0)
newIcon.Position = UDim2_new(0,2,0,2)
newIcon.Size = UDim2_new(0,16,0,16)
newIcon.IconMap.ZIndex = 5
newIcon.Parent = button
end
end
label.Size = UDim2_new(1, -32, 1, 0)
label.Position = UDim2_new(0, 32, 0, 0)
end
button.MouseEnter:connect(function()
button.TextColor3 = DropDown.TextColorOver
button.BackgroundColor3 = DropDown.BackColorOver
if not insObj and CurrentInsertObjectWindow then
if CurrentInsertObjectWindow.Visible == false and button.Text == "Insert Object" then
CreateInsertObject()
elseif CurrentInsertObjectWindow.Visible and button.Text ~= "Insert Object" then
CurrentInsertObjectWindow.Visible = false
end
end
if not insObj then
if CurrentFunctionCallerWindow and button.Text ~= "Call Function" then
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
elseif button.Text == "Call Function" then
CreateFunctionCaller()
end
end
end)
button.MouseLeave:connect(function()
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
end)
button.MouseButton1Click:connect(function()
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
onClick(text)
end)
else
local sep = Instance_new("Frame", button)
sep.Size = UDim2_new(1, -20, 0, 1)
sep.Position = UDim2_new(0, 16, 0, 2)
sep.BackgroundColor3 = DropDown.BorderColor
sep.BorderSizePixel = 0
sep.ZIndex = 5
end
return button
end
function CreateRightClickMenu(choices, currentChoice, readOnly, onClick)
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
local frame = Instance_new("TextButton")
frame.Name = "DropDown"
frame.Size = UDim2_new(0, 200, 0, 0)
frame.BackgroundTransparency = 1
frame.AutoButtonColor = false
frame.Active = false
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
local function hideMenu()
expanded = false
if frame then
frame:Destroy()
DestroyRightClick()
end
end
local function showMenu()
expanded = true
menu = Instance_new("Frame")
menu.Size = UDim2_new(0, 200, 0, 0)
for i,name in pairs(choices) do
if name then
menu.Size = menu.Size + UDim2_new(0, 0, 0, 20)
else
menu.Size = menu.Size + UDim2_new(0, 0, 0, 7)
end
end
frame.Size = menu.Size + UDim2_new(0, 0, 0, 6)
menu.Position = UDim2_new(0, 0, 0, 0)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
local function choice(name)
onClick(name)
hideMenu()
end
local previous
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name, function()
choice(name)
end)
if name then
option.Size = UDim2_new(1, 0, 0, 20)
else
option.Size = UDim2_new(1, 0, 0, 7)
end
if previous then
option.Position = UDim2_new(0, 0, 0, previous.Position.Height.Offset + previous.Size.Height.Offset)
end
option.ZIndex = menu.ZIndex
option.Parent = menu
previous = option
end
end
showMenu()
return frame
end
function checkMouseInGui(gui)
if gui == nil then return false end
local plrMouse = game:GetService("Players").LocalPlayer:GetMouse()
local guiPosition = gui.AbsolutePosition
local guiSize = gui.AbsoluteSize
if plrMouse.X >= guiPosition.x and plrMouse.X <= guiPosition.x + guiSize.x and plrMouse.Y >= guiPosition.y and plrMouse.Y <= guiPosition.y + guiSize.y then
return true
else
return false
end
end
local clipboard = {}
local function delete(o)
o.Parent = nil
RemoteEvent:InvokeServer("Delete", o)
end
local getTextWidth do
local text = Create('TextLabel',{
Name = "TextWidth";
TextXAlignment = 'Left';
TextYAlignment = 'Center';
Font = FONT;
FontSize = FONT_SIZE;
Text = "";
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,1,0);
Visible = false;
Parent = explorerPanel;
})
function getTextWidth(s)
text.Text = s
return text.TextBounds.x
end
end
local nameScanned = false
|
--[[
Removes a Tween from the scheduler.
]]
|
function TweenScheduler.remove(tween: Tween)
allTweens[tween] = nil
end
|
----------------------------------------------------------------------------------------------------
--------------------=[ CFRAME ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,EnableHolster = false
,HolsterTo = 'Torso' -- Put the name of the body part you wanna holster to
,HolsterPos = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0))
,RightArmPos = CFrame.new(-0.85, -0.2, -1.2) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Server
,LeftArmPos = CFrame.new(1.05,1,-1.4) * CFrame.Angles(math.rad(-100),math.rad(25),math.rad(-20)) --server
,ServerGunPos = CFrame.new(-.3, -1, -0.4) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))
,GunPos = CFrame.new(0.15, -0.15, 1) * CFrame.Angles(math.rad(90), math.rad(0), math.rad(0))
,RightPos = CFrame.new(-.65, -0.2, -1) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0)) --Client
,LeftPos = CFrame.new(1.2,0.15,-1.6) * CFrame.Angles(math.rad(-120),math.rad(35),math.rad(-20)) --Client
}
return Config
|
-- register what control scripts we are using
|
do
local PlayerScripts = LocalPlayer:WaitForChild("PlayerScripts")
local canRegisterControls = pcall(function() PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Default) end)
if canRegisterControls then
PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Thumbstick)
PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.DPad)
PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.Thumbpad)
PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.ClickToMove)
PlayerScripts:RegisterTouchMovementMode(Enum.TouchMovementMode.DynamicThumbstick)
PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.Default)
PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.KeyboardMouse)
PlayerScripts:RegisterComputerMovementMode(Enum.ComputerMovementMode.ClickToMove)
end
end
local DynamicThumbstickAvailable = pcall(function()
return Enum.DevTouchMovementMode.DynamicThumbstick and Enum.TouchMovementMode.DynamicThumbstick
end)
local ControlState = {}
ControlState.Current = nil
function ControlState:SwitchTo(newControl)
if ControlState.Current == newControl then return end
if ControlState.Current then
ControlState.Current:Disable()
end
ControlState.Current = newControl
if ControlState.Current then
ControlState.Current:Enable()
end
end
function ControlState:IsTouchJumpModuleUsed()
return isJumpEnabled
end
|
--[[ <<DO NOT DELETE THIS MODULE>>
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/ Build 6T, Version 6.72
SecondLogic @ Inspare
Avxnturador @ Novena
RikOne2 @ Enjin
Special thanks to Zyori and JustinianCode for some included things.
>>Manual
Basically, everything you can and would ever want to touch is in the tuning module. EVERYTHING
Torque Curve Tune Visualizer (Boost Included):
https://www.desmos.com/calculator/nap6stpjqf
Basic Tips:
--Installation
>Everything is built-in (assembly, welding, suspension, gyros), so all you have to worry about is placing the wheels and the seat.
>Body parts go in the "Body" section.
>Wheel parts such as 3D rims and brake disks go in the "Parts" section of the wheel.
>Suspension-Anchored parts such as suspension wishbones and linkages go in the "SuspensionFixed" section.
>Axle-Anchored parts such as calipers go in the "WheelFixed" section.
>You can add or remove wheels. To add a wheel, simply copy one of the wheels and make sure it's named one of the following: "F","FL","FR","R","RL","RR".
>Wheels need to be aligned with the axes of the seat. Don't rotate the seat relative to the wheels as it may cause welding problems.
>All wheel offsets are applied in the tuning module. Do NOT manually add offset to the wheels. Steering axis is centered on the wheel part by default.
>Seat offset can be adjusted in the "MiscWeld" module under "Initialize".
>Use the "Misc" section for scripted/moving parts and apply welding using the "MiscWeld" module under "Initialize".
--Tuning
>Reduce weight(density) if setup is lacking torque. Increase density if setup has too much torque.
>Add downforce manually if setup is lacking grip or use a downforce plugin.
>Dialing in ratios used in real cars is an easy way to have a realisticly tuned transmission.
>Modifying the "Drive" script may affect the integrity of the system.
>Custom scripts should be put in the "Plugins" folder. Using plugins made by other users is encouraged.
>When writing custom plugins, you can reference the values within the "Values" folder inside the A-Chassis Interface.
>It is a good practice to make plugins compatible with any setup and providing a usage manual if a plugin is released.
>You can remove/change the default plugins that come with the kit. The drive system will still work perfectly with or without them.
--Updates
>To update, simply just replace the entire "A-Chassis Tune" module of an existing car with a newer version of the module if the car already has AC6T installed. Otherwise it's preferred you copy the new values over.
>You may want to copy the tune values and plugins from the old module, but dont simply overwrite the tune module as new values may be added.
>>AC6 T Changelog
[05/05/18 : A-Chassis T Build 6.72] - The Final Bugfixes
[Tune Changes]
-"RAntiRoll" is fixed and an actual value, beforehand it only had 2 FAntiRolls and no RAntiRolls.
[Transmission Changes]
-Automatic transmission has been properly fixed and works flawlessly.
[Thanks]
-Thanks for using this chassis, I'll see ya in the bike chassis. -Avxnturador
Install by changing the Drive script, and by changing "FAntiRoll" in line 70 to "RAntiRoll" in the Tune.
[04/11/18 : A-Chassis T Build 6.7] - The Final Update
[IMPORTANT]
-A whole re-write of the chassis has been done. Taking AC6.52S2 and re-writing everything, most bugs from other versions should be removed
[Drive Changes]
-Curve caching is mandatory and always on, CurveCache and CacheInc is removed
-Wheel RPM is now fixed and gets the rotation velocity from ALL driven wheels
[Boost Changes]
-The turbo properly spools up and keeps its spool once changing gears or engaging and disengaging the clutch
[Transmission Changes]
-Disabled the wait time in Manual transmission mode
-Shifting between Reverse, Neutral and Drive is possible in Automatic transmission mode, credit to JustinianCode for this
[New Values]
-FCaster, only in the front, credit to Zyori for this
[Thanks]
-Thanks for using this chassis, I'll see ya in the next ones to come. -Avxnturador
-Credits to RikOne2, Zyori, and JustinianCode for helping me out with special features.
Install by changing the initialize, A-Chassis Interface, and by adding "FCaster" in the tune.
[03/25/18 : A-Chassis T Build 6.62] - The Small Bugfixing Update
[Fixes]
-Turbo stays spooled up while shifting
-If you throttle up while shifting, power will stay instead of staying at 0.
Install by changing the Drive script.
[02/15/18 : A-Chassis T Build 6.6] - The Realism Update
[Curves]
-Curves are now fixed due to a re-write of the Horsepower and Torque curves.
-Instead of the HP and Torque being insanely off, it's now perfected.
-Example: A naturally aspirated car with the horsepower at 180 will have its max HP be 180, not 360.
[New Car Values]
-TCSAmt (The amount of cutoff TCS has on the throttle)
[New Tune Values]
[EDITABLE]
-ShiftTime (The time delay in which you initiate a shift and the car changes gear)
[STANDARDIZED] (Highly recommended you don't touch these in the tune)
-CurveCache (The time delay in which you initiate a shift and the car changes gear)
-CacheInc (The time delay in which you initiate a shift and the car changes gear)
[12/2/17 : A-Chassis T Build 6.5] - The Turbocharged Update
[Turbocharger]
-Utilizing IMeanBiz's turbo scripts, the car now has turbo.
[New Car Values]
-HpNatural (Horsepower made by the engine naturally aspirated)
-TqNatural (Torque made by the engine naturally aspirated)
-HpBoosted (Horsepower made by the turbocharger[s], NOT including HpNatural HP)
-TqBoosted (Torque made by the turbocharger[s], NOT including TqNatural Torque)
-Boost (Total boost [in PSI])
[New Tune Values]
-Should all be self explanatory in the tune.
[New Plugins]
-AC6T Stock Gauges, includes a turbo thing in the middle (when car is turbocharged), can easily be swapped with AC6 default gauges if not wanted.
-Turbocharger sounds, which works regularly
[Rewritten Values]
-Horsepower (Horsepower combined from the engine and turbocharger[s])
-Torque (Torque combined from the engine and turbocharger[s])
--]]
|
return "6.72"
|
------------------------------------------------------------------------
|
for i=1,math.random(100,10000) do
wait()
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
local ignoreList = {}
local ray = Ray.new(script.Parent.Part8.Position, missile.CFrame.lookVector * 999)
local hit game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList, false)
local pos = script.Parent.Bool.Position
local line = Instance.new("Part")
line.Name = "Line"
line.FormFactor = "Symmetric"
line.Size = Vector3.new(1, 1, 1)
line.BrickColor = BrickColor.new("White")
line.Transparency = 0
line.CanCollide = false
line.Anchored = true
line.Locked = true
line.TopSurface, line.BottomSurface = 0, 0
line.CFrame = CFrame.new(script.Parent.Part8.Position:lerp(pos, 0.5), pos)
local mesh = Instance.new("BlockMesh", line)
mesh.Scale = Vector3.new(0.03, 0.03, (script.Parent.Part8.Position - pos).magnitude)
game.Debris:AddItem(line,0.08)
line.Parent = script.Parent
wait(0.001)
else
print("No bool")
break
end
end
|
--Fade tween
|
local fadeInfo = TweenInfo.new(Fade, Enum.EasingStyle.Sine, Enum.EasingDirection.In)
local strechInfo = TweenInfo.new(Fade / 1.05, Enum.EasingStyle.Quint, Enum.EasingDirection.In)
local fadeGoal = {Transparency = 1}
local accumulatedChance = 0
|
--[[**
ensures Roblox UDim type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.UDim = t.typeof("UDim")
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 900 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 2000 -- Use sliders to manipulate values
Tune.Redline = 10000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--// Event Connections
|
L_14_.OnClientEvent:connect(function(L_22_arg1)
if L_22_arg1.TeamColor == L_1_.TeamColor and L_22_arg1.Character and L_22_arg1.Character:FindFirstChild('Head') then
if L_22_arg1.Character:WaitForChild("Saude"):WaitForChild("FireTeam").SquadName.Value ~= '' then
spawnTag(L_22_arg1.Character, L_22_arg1.Character:WaitForChild("Saude"):WaitForChild("FireTeam").SquadColor.Value)
else
spawnTag(L_22_arg1.Character, Color3.fromRGB(255,255,255))
end
end;
if L_22_arg1.TeamColor ~= L_1_.TeamColor then
if L_22_arg1.Character and L_22_arg1.Character:FindFirstChild('Head') and L_22_arg1.Character:FindFirstChild('Head'):FindFirstChild('TeamTag') then
L_22_arg1.Character:FindFirstChild('Head').TeamTag:Destroy()
end
end;
end)
|
-- ROBLOX FIXME: can't express void when defined outside of a function type
|
type void = nil
|
-- Event Bindings
|
DisplayVictory.OnClientEvent:connect(OnDisplayVictory)
DisplayScore.OnClientEvent:connect(OnScoreChange)
ResetMouseIcon.OnClientEvent:connect(OnResetMouseIcon)
return NotificationManager
|
--For Omega Rainbow Katana thumbnail to display a lot of particles.
|
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return false
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(5)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
--[[
if CheckIfAlive() then
local Force = Instance.new("BodyVelocity")
Force.velocity = Vector3.new(0, 10, 0)
Force.maxForce = Vector3.new(0, 4000, 0)
Debris:AddItem(Force, 0.4)
Force.Parent = Torso
end
]]
wait(0.2)
Tool.Grip = Grips.Out
wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
--The "tele1" brick takes you to "tele2".
|
debounce = false
function onTouched(hit)
if debounce then return else debounce = true end
if hit.Parent:FindFirstChild("Humanoid") then
local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
if player then
local gui = Instance.new("ScreenGui", player.PlayerGui)
local label = Instance.new("TextLabel", gui)
label.Size = UDim2.new(2, 0, 2, 0)
label.Position = UDim2.new(-0.5, 0, -0.5, 0)
label.BackgroundColor3 = Color3.new(0,0,0)
label.BackgroundTransparency = 1
label.Text = ""
while gui and label and label.BackgroundTransparency > 0 do
wait()
label.BackgroundTransparency = label.BackgroundTransparency - 0.1
end
if hit then
hit.Parent:MoveTo(script.Parent.tele2.Position)
end
wait (0)
while gui and label and label.BackgroundTransparency < 1 do
wait()
label.BackgroundTransparency = label.BackgroundTransparency + 0.1
end
if gui then
gui:Remove()
end
end
end
debounce = false
end
script.Parent.tele1.Touched:connect(onTouched)
|
--[[
-- превращаем блоки в ландшафт
game.Workspace.Terrain:FillBlock(game.Workspace.Part1.CFrame, game.Workspace.Part1.Size, Enum.Material.Metal)
game.Workspace.Terrain:FillBlock(game.Workspace.Part2.CFrame, game.Workspace.Part2.Size, Enum.Material.Water)
game.Workspace.Terrain:FillBlock(game.Workspace.Part3.CFrame, game.Workspace.Part3.Size, Enum.Material.Grass)
-- убираем блоки
game.Workspace.Part1.Parent=nil
game.Workspace.Part2.Parent=nil
game.Workspace.Part3.Parent=nil
-- производим замену ландшафта
local region = Region3.new(Vector3.new(-20,-20,-80), Vector3.new(20,10,-60))
region = region:ExpandToGrid(4)
-- чтение
local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
print("Material at (", x, y, z, "): ", material[x][y][z])
material[x][y][z] = Enum.Material.Water
print("Occupancy at (", x, y, z, "): ", occupancy[x][y][z])
end
end
end
-- запись
game.Workspace.Terrain:WriteVoxels(region, 4, material, occupancy)
]]
|
--
|
-- DRIVE LOOP
----------------------------------------
|
while true do
-- Input values taken from the VehicleSeat
local steerFloat = vehicleSeat.SteerFloat -- Forward and backward direction, between -1 and 1
local throttle = vehicleSeat.ThrottleFloat -- Left and right direction, between -1 and 1
-- Convert "steerFloat" to an angle for the HingeConstraint servos
local turnAngle = steerFloat * MAX_TURN_ANGLE
wheelHingeR.TargetAngle = turnAngle
wheelHingeL.TargetAngle = turnAngle
-- Apply torque to the CylindricalConstraint motors depending on our throttle input and the current speed of the car
local currentVel = getAverageVelocity()
local targetVel = 0
local motorTorque = 0
-- Idling
if math.abs(throttle) < 0.1 then
motorTorque = 100
-- Accelerating
elseif math.abs(throttle * currentVel) > 0 then
-- Reduce torque with speed (if torque was constant, there would be a jerk reaching the target velocity)
-- This also produces a reduction in speed when turning
local r = math.abs(currentVel) / MAX_SPEED
-- Torque should be more sensitive to input at low throttle than high, so square the "throttle" value
motorTorque = math.exp( - 3 * r * r ) * TORQUE * throttle * throttle
targetVel = math.sign(throttle) * 10000 -- Arbitrary large number
-- Braking
else
motorTorque = BRAKING_TORQUE * throttle * throttle
end
-- Use helper functions to apply torque and target velocity to all motors
setMotorTorque(motorTorque)
setMotorVelocity(targetVel)
wait()
end
|
--[[ This HelpButton Theme displays by default the headshot of the LocalPlayer.
Modes: {
"HEADSHOT" -- LocalPlayer Headshot Thumb
"CUSTOM" -- Loads from Settings
}
--]]
|
return function(data)
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local gui = service.New("ScreenGui")
local toggle = service.New("ImageButton", gui)
local toggle1 = service.New("Frame", gui)
local round = Instance.new("UICorner")
round.CornerRadius = UDim.new(0.2, 0)
round.Parent = toggle1
local round1 = Instance.new("UICorner")
round1.CornerRadius = UDim.new(0.2, 0)
round1.Parent = toggle
local gTable = client.UI.Register(gui)
if client.UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = false
toggle.Name = "Toggle"
toggle1.Name = "RoundFrame"
toggle1.BackgroundColor3 = Color3.fromRGB(17, 17, 17)
toggle.BackgroundTransparency = 1
toggle1.Position = UDim2.new(1, -45, 1, -45)
toggle.Position = UDim2.new(1, -42, 1, -38)
toggle.Size = UDim2.new(0, 33, 0, 33) --33
toggle.ZIndex = 67
toggle1.Size = UDim2.new(0, 40, 0, 40)
toggle.Image =
"https://www.roblox.com/headshot-thumbnail/image?userId=" ..
localplayer.UserId .. "&width=420&height=420&format=png"
toggle.ImageTransparency = 0
--if client.UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(
function()
local found = client.UI.Get("UserPanel", nil, true)
if found then
found.Object:Destroy()
else
client.UI.Make("UserPanel", {})
end
end
)
gTable:Ready()
end
|
-- Return empty string if keys is empty.
|
function printProps(
keys: Array<string>,
props: Record<string, unknown>,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer
): string
local indentationNext = indentation .. config.indent
-- ROBLOX deviation: adding default value as we don't support colors
local colors = config.colors or DEFAULT_COLORS
return Array.join(
Array.map(keys, function(key: string)
local value = props[key]
local printed = printer(value, config, indentationNext, depth, refs)
if typeof(value) ~= "string" then
if string.find(printed, "\n") ~= nil then
printed = config.spacingOuter .. indentationNext .. printed .. config.spacingOuter .. indentation
end
printed = "{" .. printed .. "}"
end
-- ROBLOX deviation: keys can be of type table. eg. when using ReactRoblox.Change
local key_ = if typeof(key) == "table"
then (if key.name then key.name else printer(key, config, indentationNext, depth, refs))
else key
return config.spacingInner
.. indentation
.. colors.prop.open
.. colors.prop.open
.. key_
.. colors.prop.close
.. "="
.. colors.value.open
.. printed
.. colors.value.close
.. colors.value.close
end),
""
)
end
exports.printProps = printProps
|
-- PLAYERSTATES
|
export type PlayerstatesType = {
}
|
-- ROBLOX deviation: this is a class export upstream, so optional overrides are nil-able, and it's extensible by default
|
export type React_Component<Props, State = nil> = {
-- fields
props: Props,
state: State,
-- action methods
setState: (
self: React_Component<Props, State>,
partialState: State | ((State, Props) -> State?),
callback: (() -> any)?
) -> (),
forceUpdate: (callback: ((() -> ())?)) -> (),
-- lifecycle methods
init: ((props: Props?, context: any?) -> ())?,
render: (self: React_Component<Props, State>) -> React_Node,
componentWillMount: ((self: React_Component<Props, State>) -> any)?,
UNSAFE_componentWillMount: ((self: React_Component<Props, State>) -> any)?,
componentDidMount: ((self: React_Component<Props, State>) -> any)?,
componentWillReceiveProps: ((
self: React_Component<Props, State>,
nextProps: Props,
nextContext: any
) -> any)?,
UNSAFE_componentWillReceiveProps: ((
self: React_Component<Props, State>,
nextProps: Props,
nextContext: any
) -> any)?,
shouldComponentUpdate: ((
self: React_Component<Props, State>,
nextProps: Props,
nextState: State,
nextContext: any
) -> boolean)?,
componentWillUpdate: ((
self: React_Component<Props, State>,
nextProps: Props,
nextState: State,
nextContext: any
) -> any)?,
UNSAFE_componentWillUpdate: ((
self: React_Component<Props, State>,
nextProps: Props,
nextState: State,
nextContext: any
) -> any)?,
componentDidUpdate: ((
self: React_Component<Props, State>,
prevProps: Props,
prevState: State,
prevContext: any
) -> any)?,
componentWillUnmount: ((self: React_Component<Props, State>) -> any)?,
componentDidCatch: ((
self: React_Component<Props, State>,
error: Error,
info: {
componentStack: string,
}
) -> any)?,
getDerivedStateFromProps: ((props: Props, state: State) -> any)?,
getDerivedStateFromError: ((error: Error) -> any)?,
-- long tail of other stuff not modeled very well
-- ROBLOX deviation: this field is only used in relation to string refs, which we do not support
-- refs: any,
-- context: any,
getChildContext: (self: React_Component<Props, State>) -> any,
-- statics
__componentName: string,
displayName: string?,
childContextTypes: any?,
contextTypes: any?,
propTypes: any?,
-- ROBLOX FIXME: this is a legacy Roact field and should be removed in React 18 Lua
validateProps: (Props) -> (boolean, string?)?,
-- We don't add a type for `defaultProps` so that its type may be entirely
-- inferred when we diff the type for `defaultProps` with `Props`. Otherwise
-- the user would need to define a type (which would be redundant) to override
-- the type we provide here in the base class.
-- ROBLOX deviation: Luau doesn't do the inference above
defaultProps: Props?,
-- ROBLOX deviation: class export allows assigning additional custom instance fields
[string]: any,
}
|
--mobile--
|
local Buttons = script.Parent:WaitForChild("Buttons")
local Left = Buttons:WaitForChild("Left")
local Right = Buttons:WaitForChild("Right")
local Brake = Buttons:WaitForChild("Brake")
local Gas = Buttons:WaitForChild("Gas")
local Handbrake = Buttons:WaitForChild("Handbrake")
if UserInputService.TouchEnabled and not UserInputService.MouseEnabled then
Buttons.Visible = true
end
local function LeftTurn(Touch, GPE)
if Touch.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
Left.InputBegan:Connect(LeftTurn)
Left.InputEnded:Connect(LeftTurn)
|
--[[
Returns a snapshot of this component given the current props and state. Must
be overridden by consumers of Roact and should be a pure function with
regards to props and state.
TODO (#199): Accept props and state as arguments.
]]
|
function Component:render()
local internalData = self[InternalData]
local message = componentMissingRenderMessage:format(tostring(internalData.componentClass))
error(message, 0)
end
|
--/Other
|
module.EnableLaser = false
module.EnableFlashlight = false
module.InfraRed = false
|
-- Touching this Battle Armor doubles you MaxHealth and heals you to full power
|
local debounce = false
function getPlayer(humanoid)
-- find the owning player of a humanoid.
local players = game.Players:children()
for i = 1, #players do
if players[i].Character ~= nil then
if players[i].Character.Humanoid == humanoid then return players[i] end
end
end
return nil
end
function putOnArmor(humanoid)
local torso = humanoid.Parent.Torso
torso.Reflectance = 0
humanoid.MaxHealth = 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
local player = getPlayer(humanoid)
if player ~= nil then
local message = Instance.new("Message")
message.Text = "You are God"
message.Parent = player
wait(2)
message.Text = "Live Free!"
wait(2)
message.Parent = nil
end
end
function hasArmor(humanoid)
return (humanoid.MaxHealth > 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)
end
function onTouched(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid~=nil and debounce == false then
if (hasArmor(humanoid)) then return end
debounce = true
script.Parent.Parent = nil
putOnArmor(humanoid)
debounce = false
end
end
script.Parent.Touched:connect(onTouched)
|
--------| Setting |--------
|
local blacklist = {"Chat"}
local bestResolution = 1200 --- anything below this resolution magnitude will change the slice ratio
local maxDownscale = 0.2 --- the lowest 9slices will be downscales to (by mult)
local differenceToScan = 200 --- minimum resolution magnitude offset to re-scan and scale (higher = performance)
|
--// SS3.33T Police Edit originally for 2017 Mercedes-Benz E300 by Itzt and MASERATl, base SS by Inspare
|
wait(0.1)
local player = game.Players.LocalPlayer
local HUB = script.Parent.HUB
local limitButton = HUB.Name
local lightOn = false
local Camera = game.Workspace.CurrentCamera
local cam = script.Parent.nxtcam.Value
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()
|
--[[
Converts an event into a Promise with an optional predicate
]]
|
function Promise.fromEvent(event, predicate)
predicate = predicate or function()
return true
end
return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
local connection
local shouldDisconnect = false
local function disconnect()
connection:Disconnect()
connection = nil
end
-- We use shouldDisconnect because if the callback given to Connect is called before
-- Connect returns, connection will still be nil. This happens with events that queue up
-- events when there's nothing connected, such as RemoteEvents
connection = event:Connect(function(...)
local callbackValue = predicate(...)
if callbackValue == true then
resolve(...)
if connection then
disconnect()
else
shouldDisconnect = true
end
elseif type(callbackValue) ~= "boolean" then
error("Promise.fromEvent predicate should always return a boolean")
end
end)
if shouldDisconnect and connection then
return disconnect()
end
onCancel(function()
disconnect()
end)
end)
end
return Promise
|
--Make the collision group for parts of characters not collide with itself
|
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)
|
--Functions
|
if not bloodCache then
bloodCache = Instance.new("Folder", workspace)
bloodCache.Name = "BloodCache"
end
|
-- Confetti Defaults.
|
local shapes = {script:WaitForChild("CircularConfetti"), script:WaitForChild("SquareConfetti")};
|
-- services
|
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
|
--delay(0,function()
|
--while sprinting==false or Humanoid.MoveDirection.Magnitude <= 0 do
-- --if runninganim ~= nil then
-- -- runninganim:Stop()
-- --end
-- runninganim:Stop()
-- wait()
--end
|
--// # key, Priority
|
mouse.KeyDown:connect(function(key)
if key=="g" then
if veh.Lightbar.middle.Priority.IsPlaying == true then
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.WAIL.Transparency = 1
veh.Lightbar.YELP.Transparency = 1
veh.Lightbar.PIER.Transparency = 1
veh.Lightbar.STBY.Transparency = 0
else
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Play()
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
veh.Lightbar.WAIL.Transparency = 1
veh.Lightbar.YELP.Transparency = 1
veh.Lightbar.PIER.Transparency = 0
veh.Lightbar.STBY.Transparency = 1
end
end
end)
|
-- functions
|
function onRunning(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
|
--Apply Power
|
function Engine()
--Get Torque
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
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/HPInc)]
_HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
_OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
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]*fFDr,_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(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 20 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 242 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Put your code down here and don't delete this entire text.
|
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage.GameModules.GameMechanicsCore["Network"])
|
--Services
|
tweenService = game:GetService("TweenService")
repeat wait() until game.Players.LocalPlayer.tempStage
game.Players.LocalPlayer.tempStage.Value = game.Players.LocalPlayer.leaderstats.Stage.Value
script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)
game.Players.LocalPlayer.leaderstats.Stage.Changed:Connect(function()
game.Players.LocalPlayer.tempStage.Value = game.Players.LocalPlayer.leaderstats.Stage.Value
script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)
script.Parent.Sound:Play()
end)
game.Players.LocalPlayer.tempStage.Changed:Connect(function()
script.Parent.Text = tostring(game.Players.LocalPlayer.tempStage.Value)
end)
|
-- Basic settings
|
local COOLDOWN_TIME = 25
local RUNTIME = 10
local plr = game.Players.LocalPlayer
local inputService = game:GetService("UserInputService")
game.ReplicatedStorage.Interactions.Client.Perks.UseInvisibility.OnClientEvent:connect(function()
-- Make sure character is alive
if plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") then
-- Show tip
plr.PlayerGui.MainGui.Tip.Text = "Press Q to turn invisible"
-- Set map object
local map = workspace:FindFirstChild("Map")
-- Listen for keypress
local debounce = false
local event
local done = false
event = inputService.InputBegan:connect(function(inputObj)
-- Check if states are correct
if inputObj.KeyCode == Enum.KeyCode.Q and not debounce and not done and workspace:FindFirstChild("Map") == map then
debounce = true
-- Tell server to make invisible
game.ReplicatedStorage.Interactions.Server.Perks.MakeInvisible:FireServer()
-- Update text to match state
for i=1, RUNTIME do
if done or workspace:FindFirstChild("Map") == nil then
break
end
plr.PlayerGui.MainGui.Tip.Text = "Invisible for " .. (RUNTIME - i + 1) .. " seconds"
wait(1)
end
if not done and workspace:FindFirstChild("Map") then
for i=1, COOLDOWN_TIME do
if done or workspace:FindFirstChild("Map") == nil then
break
end
plr.PlayerGui.MainGui.Tip.Text = "Can use again in " .. (COOLDOWN_TIME - i + 1) .. " seconds"
wait(1)
end
if not done and workspace:FindFirstChild("Map") then
plr.PlayerGui.MainGui.Tip.Text = "Press Q to turn invisible"
end
end
if done or workspace:FindFirstChild("Map") == nil then
if event ~= nil then
event:disconnect()
event = nil
end
done = true
plr.PlayerGui.MainGui.Tip.Text = ""
end
debounce = false
elseif workspace:FindFirstChild("Map") ~= map then
if event ~= nil then
event:disconnect()
event = nil
end
done = true
plr.PlayerGui.MainGui.Tip.Text = ""
end
end)
-- Connect character death
plr.Character.Humanoid.Died:connect(function()
if not done then
event:disconnect()
event = nil
done = true
plr.PlayerGui.MainGui.Tip.Text = ""
end
end)
end
end)
|
-- From TransparencyController
|
function CameraUtils.Round(num: number, places: number): number
local decimalPivot = 10^places
return math.floor(num * decimalPivot + 0.5) / decimalPivot
end
function CameraUtils.IsFinite(val: number): boolean
return val == val and val ~= math.huge and val ~= -math.huge
end
function CameraUtils.IsFiniteVector3(vec3: Vector3): boolean
return CameraUtils.IsFinite(vec3.X) and CameraUtils.IsFinite(vec3.Y) and CameraUtils.IsFinite(vec3.Z)
end
|
--[[
Removes a Spring from the scheduler.
]]
|
function SpringScheduler.remove(spring: Spring)
local damping = spring._damping
local speed = spring._speed
local dampingBucket = springBuckets[damping]
if dampingBucket == nil then
return
end
local speedBucket = dampingBucket[speed]
if speedBucket == nil then
return
end
speedBucket[spring] = nil
end
|
--//Jumping
|
local jumps = 0
local function ToggleFlying()
if hum.FloorMaterial == Enum.Material.Air then --Is double jumping
if jumps >= settings.ExtraJumps then return end
jumps += 1
hum:ChangeState(Enum.HumanoidStateType.Jumping) --Jump
event:FireServer() --Tell other players that we are double jumping
JumpEffect(char) --Visual Effect
end
end
hum.StateChanged:connect(function(old, new) --Player landed
if new == Enum.HumanoidStateType.Landed then
jumps = 0
end
end)
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onRunning(speed)
if speed > 0.01 then
local scale = 15.0
playAnimation("walk", 0.1, Enemy)
setAnimationSpeed(speed / scale)
pose = "Running"
else
playAnimation("idle", 0.1, Enemy)
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Enemy)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Enemy)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Enemy)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Enemy)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Enemy)
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Enemy)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Enemy)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Enemy)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Enemy)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Enemy)
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Enemy)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- Thourough check to see if a character is sitting
|
local function amISitting(character)
local r = character.HumanoidRootPart
for _, part in pairs(r:GetConnectedParts(true)) do
if part:IsA("Seat") or part:IsA("VehicleSeat") then
return true
end
end
end
|
-- main program
|
local RunService = game:GetService("RunService")
|
--!nolint UnknownGlobal
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerChatted will get chats from the custom chat and nil players.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.HookEvent('PlayerChatted',function(msg,plr)
print(msg..' from '..plr.Name..' Example Plugin')
end)
service.HookEvent('PlayerJoined',function(p)
print(p.Name..' Joined! Example Plugin')
end)
service.HookEvent('CharacterAdded',function(plr)
server.RunCommand('name',plr.Name,'BobTest Example Plugin')
end)
--]]
|
return function()
server.Commands.ExampleCommand = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"example"}; -- Commands
Args = {"arg1"}; -- Command arguments
Description = "Example command"; -- Command Description
Hidden = true; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
print("Player supplied args[1] "..tostring(args[1]))
end
}
end
|
--- Get signal instance
|
Signal.Get = function(eventName)
--- Variables
eventName = string.lower(eventName)
--
return GetEvent(eventName)
end
|
--Apply Vehicle Weight
|
if mass<_Tune.Weight*weightScaling then
--Calculate Weight Distribution
local center = rWheel.CFrame.p:Lerp(fWheel.CFrame.p, _Tune.WeightDistribution/100)
--Create Weight Brick
weightB = Instance.new("Part",bike.Body)
weightB.Name = "Weight"
weightB.Anchored = true
weightB.CanCollide = false
weightB.BrickColor = BrickColor.new("Really black")
weightB.TopSurface = Enum.SurfaceType.Smooth
weightB.BottomSurface = Enum.SurfaceType.Smooth
if _Tune.WBVisible or _Tune.Debug then
weightB.Transparency = .75
else
weightB.Transparency = 1
end
weightB.Size = Vector3.new(_Tune.WeightBrickSize[1],_Tune.WeightBrickSize[2],_Tune.WeightBrickSize[3])
weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0)
weightB.CFrame=(bike.DriveSeat.CFrame-bike.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0)
else
--Existing Weight Is Too Massive
warn( "\n\t [NCT: M] Mass too high for specified weight."
.."\n\t Target Mass:\t"..(math.ceil(_Tune.Weight*weightScaling*100)/100)
.."\n\t Current Mass:\t"..(math.ceil(mass*100)/100))
end
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]]
|
local autoscaling = true --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 230 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 400 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
-- Folders to parse into databases
|
for _, databaseFolder in ipairs(ReplicatedStorage.Common.Databases:GetChildren()) do
Database.ParseFolder(databaseFolder)
end
|
--------------------- TEMPLATE BLADE WEAPON ---------------------------
-- Waits for the child of the specified parent
|
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local SLASH_DAMAGE = 150
local DOWNSTAB_DAMAGE = 150
local THROWING_DAMAGE = 150
local HOLD_TO_THROW_TIME = 0.38
local Damage = 20
local MyHumanoid = nil
local MyTorso = nil
local MyCharacter = nil
local MyPlayer = nil
local Tool = script.Parent
local Handle = WaitForChild(Tool, 'Handle')
local BlowConnection
local Button1DownConnection
local Button1UpConnection
local PlayStabPunch
local PlayDownStab
local PlayThrow
local PlayThrowCharge
local IconUrl = Tool.TextureId -- URL to the weapon knife icon asset
local DebrisService = Game:GetService('Debris')
local PlayersService = Game:GetService('Players')
local SlashSound
local HitPlayers = {}
local LeftButtonDownTime = nil
local Attacking = false
function Blow(hit)
if Attacking then
BlowDamage(hit, Damage)
end
end
function BlowDamage(hit, damage)
local humanoid = hit.Parent:FindFirstChild('Humanoid')
local player = PlayersService:GetPlayerFromCharacter(hit.Parent)
if humanoid == nil then
Handle.WallHit:Play()
wait(0.1)
if game.Workspace.Handle == nil then
else
game.Workspace.Handle:Destroy()
end
else
if humanoid.Health == 0 then
else
Handle.Ragdoll:clone().Parent = hit.Parent
humanoid.Health = 0
Handle.DeadPlayer:Play()
Handle.DeadSound:Play()
end
wait(0.1)
if game.Workspace.Handle == nil then
else
game.Workspace.Handle:Destroy()
end
end
if humanoid ~= nil and MyHumanoid ~= nil and humanoid ~= MyHumanoid then
if not MyPlayer.Neutral then
-- Ignore teammates hit
if player and player ~= MyPlayer and player.TeamColor == MyPlayer.TeamColor then
return
end
end
-- final check, make sure weapon is in-hand
local rightArm = MyCharacter:FindFirstChild('Right Arm')
if (rightArm ~= nil) then
-- Check if the weld exists between the hand and the weapon
local joint = rightArm:FindFirstChild('RightGrip')
if (joint ~= nil and (joint.Part0 == Handle or joint.Part1 == Handle)) then
-- Make sure you only hit them once per swing
if player and not HitPlayers[player] then
TagHumanoid(humanoid, MyPlayer)
print("Sending " .. damage)
humanoid:TakeDamage(damage)
Handle.Splat.Volume = 1
Handle.Splat:Play()
HitPlayers[player] = true
end
end
end
end
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new('ObjectValue')
creatorTag.Value = player
creatorTag.Name = 'creator'
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new('StringValue')
weaponIconTag.Value = IconUrl
weaponIconTag.Name = 'icon'
weaponIconTag.Parent = creatorTag
DebrisService:AddItem(weaponIconTag, 1.5)
end
function HardAttack()
Handle.Attack:Play()
if PlayStabPunch then
PlayStabPunch.Value = true
wait(1.0)
PlayStabPunch.Value = false
end
end
function NormalAttack()
Damage = DOWNSTAB_DAMAGE
KnifeDown()
Handle.Attack:Play()
if PlayDownStab then
PlayDownStab.Value = true
wait(1.0)
PlayDownStab.Value = false
end
KnifeUp()
end
function ThrowAttack()
KnifeOut()
if PlayThrow then
PlayThrow.Value = true
wait(0.3)
if not Handle then return end
local throwingHandle = Handle:Clone()
DebrisService:AddItem(throwingHandle, 5)
throwingHandle.Parent = Workspace
Handle.Throw:Play()
if MyCharacter and MyHumanoid then
throwingHandle.Velocity = (MyHumanoid.TargetPoint - throwingHandle.CFrame.p).unit * 300
-- set the orientation to the direction it is being thrown in
throwingHandle.CFrame = CFrame.new(throwingHandle.CFrame.p, throwingHandle.CFrame.p + throwingHandle.Velocity) * CFrame.Angles(0, 0, math.rad(-90))
local floatingForce = Instance.new('BodyForce', throwingHandle)
floatingForce.force = Vector3.new(0, 196.2 * throwingHandle:GetMass() * 0.98, 0)
local spin = Instance.new('BodyAngularVelocity', throwingHandle)
spin.angularvelocity = throwingHandle.CFrame:vectorToWorldSpace(Vector3.new(0, -400, 0))
end
Handle.Transparency = 1
-- Wait so that the knife has left the thrower's general area
wait(0.08)
if throwingHandle then
local touchedConn = throwingHandle.Touched:connect(function(hit) print("hit throw") BlowDamage(hit, THROWING_DAMAGE) end)
end
-- must check if it still exists since we waited
if throwingHandle then
throwingHandle.CanCollide = true
end
wait(0.6)
if Handle and PlayThrow then
Handle.Transparency = 0
PlayThrow.Value = false
end
end
KnifeUp()
end
function KnifeUp()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, 1, 0)
end
function KnifeDown()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, -1, 0)
end
function KnifeOut()
Tool.GripForward = Vector3.new(0, 0, -1)
Tool.GripRight = Vector3.new(1, 0, 0)
Tool.GripUp = Vector3.new(0, 1, 0)
end
Tool.Enabled = true
function OnLeftButtonDown()
LeftButtonDownTime = time()
end
function OnLeftButtonUp()
if not Tool.Enabled then return end
-- Reset the list of hit players every time we start a new attack
HitPlayers = {}
if PlayThrowCharge then
PlayThrowCharge.Value = false
end
if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
Tool.Enabled = false
local currTime = time()
if LeftButtonDownTime and currTime - LeftButtonDownTime > HOLD_TO_THROW_TIME and
currTime - LeftButtonDownTime < 1.15 then
else
Attacking = true
if math.random(1, 2) == 1 then
HardAttack()
else
NormalAttack()
end
Attacking = false
end
Tool.Enabled = true
end
end
function OnRightButtonDown()
RightButtonDownTime = time()
if PlayThrowCharge then
PlayThrowCharge.Value = true
end
end
function OnRightButtonUp()
if not Tool.Enabled then return end
-- Reset the list of hit players every time we start a new attack
HitPlayers = {}
if PlayThrowCharge then
PlayThrowCharge.Value = false
end
if Tool.Enabled and MyHumanoid and MyHumanoid.Health > 0 then
Tool.Enabled = false
local currTime = time()
if RightButtonDownTime and currTime - RightButtonDownTime > HOLD_TO_THROW_TIME and
currTime - RightButtonDownTime < 1.15 then
ThrowAttack()
else
Attacking = true
if math.random(1, 2) == 1 then
else
end
Attacking = false
end
Tool.Enabled = true
end
end
function OnEquipped(mouse)
PlayStabPunch = WaitForChild(Tool, 'PlayStabPunch')
PlayDownStab = WaitForChild(Tool, 'PlayDownStab')
PlayThrow = WaitForChild(Tool, 'PlayThrow')
PlayThrowCharge = WaitForChild(Tool, 'PlayThrowCharge')
Handle.Equip:Play()
BlowConnection = Handle.Touched:connect(Blow)
MyCharacter = Tool.Parent
MyTorso = MyCharacter:FindFirstChild('Torso')
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyPlayer = PlayersService.LocalPlayer
if mouse then
Button1DownConnection = mouse.Button1Down:connect(OnLeftButtonDown)
Button1UpConnection = mouse.Button1Up:connect(OnLeftButtonUp)
Button2DownConnection = mouse.Button2Down:connect(OnRightButtonDown)
Button2UpConnection = mouse.Button2Up:connect(OnRightButtonUp)
end
KnifeUp()
end
function OnUnequipped()
-- Unequip logic here
if BlowConnection then
BlowConnection:disconnect()
BlowConnection = nil
end
if Button1DownConnection then
Button1DownConnection:disconnect()
Button1DownConnection = nil
end
if Button1UpConnection then
Button1UpConnection:disconnect()
Button1UpConnection = nil
end
if Button2UpConnection then
Button2UpConnection:disconnect()
Button2UpConnection = nil
end
if Button2DownConnection then
Button2DownConnection:disconnect()
Button2DownConnection = nil
end
MyHumanoid = nil
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
-- waitChildren/EventFolder does not contain all the remote events, because the server version could be older than the client version.
-- In that case it would not create the new events.
-- These events are accessed directly from DefaultChatSystemChatEvents
|
local useEvents = {}
local FoundAllEventsEvent = Instance.new("BindableEvent")
function TryRemoveChildWithVerifyingIsCorrectType(child)
if (waitChildren[child.Name] and child:IsA(waitChildren[child.Name])) then
waitChildren[child.Name] = nil
useEvents[child.Name] = child
numChildrenRemaining = numChildrenRemaining - 1
end
end
for i, child in pairs(EventFolder:GetChildren()) do
TryRemoveChildWithVerifyingIsCorrectType(child)
end
if (numChildrenRemaining > 0) then
local con = EventFolder.ChildAdded:connect(function(child)
TryRemoveChildWithVerifyingIsCorrectType(child)
if (numChildrenRemaining < 1) then
FoundAllEventsEvent:Fire()
end
end)
FoundAllEventsEvent.Event:wait()
con:disconnect()
FoundAllEventsEvent:Destroy()
end
EventFolder = useEvents
|
--[[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,0,0)
arm.TopSurface=Enum.SurfaceType.Smooth
arm.BottomSurface=Enum.SurfaceType.Smooth
arm.Transparency=1
if PGS_ON then
--PGS Assembly---------------------------------------------------------------------------------------------------------------------------
--Suspension Offsets
local fAnchorOffset = Vector3.new(_Tune.FAnchorOffset[1],_Tune.FAnchorOffset[2],_Tune.FAnchorOffset[3])
local rAnchorOffset = Vector3.new(_Tune.RAnchorOffset[1],_Tune.RAnchorOffset[2],_Tune.RAnchorOffset[3])
--Create Wheel Suspsension Anchor
local anchor2=arm:Clone()
anchor2.Parent=v
anchor2.Name="Base"
if v.Name == "FL" or v.Name == "FR" or v.Name=="F" then
anchor2.CFrame=anchor2.CFrame*CFrame.new(fAnchorOffset)
else
anchor2.CFrame=anchor2.CFrame*CFrame.new(rAnchorOffset)
end
--Create Body Suspsension Anchor
local anchor1=anchor2:Clone()
anchor1.Parent=v
anchor1.Name="Anchor"
if v.Name == "FL" or v.Name == "FR" or v.Name=="F" then
anchor1.CFrame=anchor1.CFrame*CFrame.new(-_Tune.FSusLength*math.cos(math.rad(_Tune.FSusAngle)),_Tune.FSusLength*math.sin(math.rad(_Tune.FSusAngle)),0)
else
anchor1.CFrame=anchor1.CFrame*CFrame.new(-_Tune.RSusLength*math.cos(math.rad(_Tune.RSusAngle)),_Tune.RSusLength*math.sin(math.rad(_Tune.RSusAngle)),0)
end
--Create Attachments
local s0=Instance.new("Attachment",anchor1)
local s1=Instance.new("Attachment",anchor2)
local p0=Instance.new("Attachment",anchor1)
local r0=Instance.new("Attachment",car.DriveSeat)
local h0=Instance.new("Attachment",car.DriveSeat)
local a0=Instance.new("Attachment",anchor2)
local a1=Instance.new("Attachment",arm)
local a2=Instance.new("Attachment",arm)
local a3=Instance.new("Attachment",v)
s0.Name="S0"
s1.Name="S1"
p0.Name="P0"
r0.Name="R0"
h0.Name="H0"
a0.Name="A0"
a1.Name="A1"
a2.Name="A2"
a3.Name="A3"
--Calculate Wishbone Anchor Point
local rAnc0=(arm.CFrame*CFrame.new(fAnchorOffset+Vector3.new(-math.cos(math.rad(_Tune.FWsBoneAngle))*_Tune.FWsBoneLen,math.sin(math.rad(_Tune.FWsBoneAngle))*_Tune.FWsBoneLen,0))).p
if v.Name == "RL" or v.Name == "RR" or v.Name=="R" then
rAnc0=(arm.CFrame*CFrame.new(rAnchorOffset+Vector3.new(-math.cos(math.rad(_Tune.RWsBoneAngle))*_Tune.RWsBoneLen,math.sin(math.rad(_Tune.RWsBoneAngle))*_Tune.RWsBoneLen,0))).p
end
--Apply Attachment Alignment
p0.Position=anchor1.CFrame:toObjectSpace(CFrame.new(anchor2.Position)).p
r0.Position=car.DriveSeat.CFrame:toObjectSpace(CFrame.new(rAnc0)).p
h0.Position=car.DriveSeat.CFrame:toObjectSpace(CFrame.new(anchor1.Position)).p
a0.Position=anchor2.CFrame:toObjectSpace(CFrame.new(arm.Position)).p
if v.Name == "FL" or v.Name == "FR" or v.Name=="F" then
p0.Rotation=Vector3.new(0,0,-_Tune.FSusAngle)
s1.Rotation=Vector3.new(0,0,-_Tune.FSusAngle)
else
p0.Rotation=Vector3.new(0,0,-_Tune.RSusAngle)
s1.Rotation=Vector3.new(0,0,-_Tune.RSusAngle)
end
if v.Name=="FL" then
s0.Rotation=Vector3.new(0,90+_Tune.FToe,0)
elseif v.Name=="FR" then
s0.Rotation=Vector3.new(0,90-_Tune.FToe,0)
elseif v.Name=="RL" then
s0.Rotation=Vector3.new(0,90+_Tune.RToe,0)
elseif v.Name=="RR" then
s0.Rotation=Vector3.new(0,90-_Tune.RToe,0)
end
h0.Rotation=Vector3.new(0,-90,0)
a0.Rotation=Vector3.new(90,90,0)
a1.Rotation=Vector3.new(90,90,0)
a2.Rotation=Vector3.new(0,0,0)
a3.Rotation=Vector3.new(0,0,90)
if v.Name=="FR" or v.Name=="RR" then
h0.Rotation=Vector3.new(0,90,0)
a2.Rotation=Vector3.new(-180,00,0)
end
if v.Name == "RL" or v.Name == "RR" or v.Name=="R" then
--Lock Rear Steering Axle
MakeWeld(anchor2,arm)
else
--Create Steering Hinge
local h2=Instance.new("HingeConstraint",v)
h2.Attachment0=a0
h2.Attachment1=a1
end
--Create Wheel Spindle
local h3=Instance.new("HingeConstraint",v)
h3.Attachment0=a2
h3.Attachment1=a3
--Apply Suspension
if _Tune.SusEnabled then
--Suspension Enabled
local h1=Instance.new("HingeConstraint",v)
h1.Attachment0=h0
h1.Attachment1=s0
local sus=Instance.new("SpringConstraint",v)
sus.Attachment0=s0
sus.Attachment1=s1
sus.Visible=_Tune.SusVisible
sus.Radius=_Tune.SusRadius
sus.Thickness=_Tune.SusThickness
sus.Color=BrickColor.new(_Tune.SusColor)
sus.Coils=_Tune.SusCoilCount
sus.LimitsEnabled=true
if v.Name == "FL" or v.Name == "FR" or v.Name=="F" then
sus.MinLength=_Tune.FSusLength-math.abs(_Tune.FSusMaxComp)
sus.MaxLength=_Tune.FSusLength+math.abs(_Tune.FSusMaxExt)
sus.FreeLength=_Tune.FSusLength+math.abs(_Tune.FSusMaxExt)
sus.Damping=_Tune.FSusDamping
sus.Stiffness=_Tune.FSusStiffness
else
sus.MinLength=_Tune.RSusLength-math.abs(_Tune.RSusMaxComp)
sus.MaxLength=_Tune.RSusLength+math.abs(_Tune.RSusMaxExt)
sus.FreeLength=_Tune.RSusLength+math.abs(_Tune.RSusMaxExt)
sus.Damping=_Tune.RSusDamping
sus.Stiffness=_Tune.RSusStiffness
end
local rod=Instance.new("RodConstraint",v)
rod.Attachment0=r0
rod.Attachment1=s1
rod.Length=rod.CurrentDistance
rod.Visible=_Tune.WsBVisible
rod.Color=BrickColor.new(_Tune.WsColor)
rod.Thickness=_Tune.WsThickness
local prm=Instance.new("PrismaticConstraint",v)
prm.Attachment0=p0
prm.Attachment1=s1
else
--Suspension Disabled
anchor1:Destroy()
MakeWeld(car.DriveSeat,anchor2)
end
--Weld Miscelaneous Parts
if v:FindFirstChild("SuspensionFixed")~=nil then
ModelWeld(v.SuspensionFixed,anchor2)
end
if v:FindFirstChild("WheelFixed")~=nil then
ModelWeld(v.WheelFixed,arm)
end
if v:FindFirstChild("Fixed")~=nil then
ModelWeld(v.Fixed,arm)
end
else
--Legacy Assembly---------------------------------------------------------------------------------------------------------------------------
--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
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
--Lock Rear Steering Axle
if v.Name == "RL" or v.Name == "RR" or v.Name=="R" then
MakeWeld(base,axle)
end
--Weld Assembly
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()
--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
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=="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=v.CFrame*CFrame.Angles(0,-math.pi/2,0)
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 Rotational BodyMover
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
|
-- Explicit dependencies are dependencies that are are explicitly listed.
-- These dependencies are available to this package and ANY dependent packages below
|
function PackageInfoUtils.fillExplicitPackageDependencySet(
explicitDependencySet, packageFolder, packageInfoMap, defaultReplicationType)
assert(type(explicitDependencySet) == "table", "Bad explicitDependencySet")
assert(typeof(packageFolder) == "Instance", "Bad packageFolder")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(defaultReplicationType, "No defaultReplicationType")
for _, item in pairs(packageFolder:GetChildren()) do
if item:IsA("Folder") and item.Name == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
local packageInfoList = PackageInfoUtils.getPackageInfoListFromDependencyFolder(
item,
packageInfoMap,
defaultReplicationType)
for _, packageInfo in pairs(packageInfoList) do
explicitDependencySet[packageInfo] = true
end
end
end
end
return PackageInfoUtils
|
-- New VR System Modules
|
local VRCamera = require(script:WaitForChild("VRCamera"))
local VRVehicleCamera = require(script:WaitForChild("VRVehicleCamera"))
|
-- Class
|
local Portal = {}
Portal.__index = Portal
function Portal.new(humanoid, windowA, windowB, cameraModule)
local self = setmetatable({}, Portal)
self.Humanoid = humanoid
self.HRP = humanoid.RootPart
self.LastPosition = self.HRP.Position
self.TeleportTick = tick()
self.WindowA = windowA
self.WindowB = windowB
self.World = nil
self.WorldLookupA = {}
self.WorldLookupB = {}
self.CharacterLookups = {}
self.Sky = nil
self.SkyA = nil
self.SkyB = nil
self.CameraModule = cameraModule
self.LastCameraCFrame = workspace.CurrentCamera.CFrame
self.LastCameraFocus = workspace.CurrentCamera.Focus
RUNSERVICE:BindToRenderStep("PortalBeforeInput", Enum.RenderPriority.Input.Value - 1, function(dt)
workspace.CurrentCamera.CFrame = self.LastCameraCFrame
workspace.CurrentCamera.Focus = self.LastCameraFocus
end)
RUNSERVICE:BindToRenderStep("PortalAfterCamera", Enum.RenderPriority.Camera.Value + 1, function(dt)
self:OnAfterCameraStep(dt)
end)
return self
end
|
--Scripted by DermonDarble
|
local character = script.Parent.Parent
local humanoid = character:WaitForChild("Humanoid")
local animations = {}
for i, animation in pairs(character:WaitForChild("Animations"):GetChildren()) do
animations[animation.Name] = humanoid:LoadAnimation(animation)
end
local state = "None"
local function Grounded()
local ray = Ray.new(character.HumanoidRootPart.Position + Vector3.new(0, -4.3, 0), Vector3.new(0, -1, 0))
local hit, position = game.Workspace:FindPartOnRay(ray, character)
if hit and hit.CanCollide then
return(true)
else
return(false)
end
end
local function StopAll()
for i, animation in pairs(animations) do
animation:Stop()
end
end
local function ChangeState(newState)
if state ~= newState then
StopAll()
state = newState
if animations[state] then
animations[state]:Play()
end
end
end
while true do
game:GetService("RunService").Stepped:wait()
if humanoid.Health > 0 then
if Grounded() then
local speed = Vector3.new(character.HumanoidRootPart.Velocity.X, 0, character.HumanoidRootPart.Velocity.Z).magnitude
if speed > 1 then
ChangeState("Walk")
else
ChangeState("Idle")
end
else
local ySpeed = character.HumanoidRootPart.Velocity.Y
if ySpeed > 0 then
ChangeState("Jump")
else
ChangeState("Fall")
end
end
else
ChangeState("Dead")
end
end
|
-- Initialize paint tool
|
local PaintTool = require(CoreTools:WaitForChild 'Paint')
Core.AssignHotkey('V', Core.Support.Call(Core.EquipTool, PaintTool));
Core.AddToolButton(Core.Assets.PaintIcon, 'V', PaintTool)
|
--[=[
Returns a promise that returns a remote event
@return Promise<RemoteEvent>
]=]
|
function PromiseRemoteEventMixin:PromiseRemoteEvent()
return self._maid:GivePromise(promiseChild(self._obj, self._remoteEventName))
end
return PromiseRemoteEventMixin
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
local exist = true
local soundplaying
local sounds = zombie.Sounds
local sr = {
sounds.Attacking, --1
sounds.Chasing, --2
sounds.Dying, --3
sounds.Walking --4
}
|
-- 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)
if not isStudio then
local ownerId = game.CreatorId
local groupService = game:GetService("GroupService")
if game.CreatorType == Enum.CreatorType.Group then
local success, ownerInfo = pcall(function() return groupService:GetGroupInfoAsync(game.CreatorId).Owner end)
if success then
ownerId = ownerInfo.Id
end
end
local version = require(iconModule.VERSION)
if localPlayer.UserId ~= ownerId then
local marketplaceService = game:GetService("MarketplaceService")
local success, placeInfo = pcall(function() return marketplaceService:GetProductInfo(game.PlaceId) end)
if success and placeInfo then
-- Required attrbute for using TopbarPlus
-- This is not printed within stuido and to the game owner to prevent mixing with debug prints
local gameName = placeInfo.Name
print(("\n\n\n⚽ %s uses TopbarPlus %s\n🍍 TopbarPlus was developed by ForeverHD and the Nanoblox Team\n🚀 You can learn more and take a free copy by searching for 'TopbarPlus' on the DevForum\n\n"):format(gameName, version))
end
end
end
end)()
|
-- *** PRIVATE METHODS *** --
-- Initialization
|
function Input:_init ()
self:_listenForEvents ();
end
|
--[[Wheel Stabilizer Gyro]]
|
Tune.FGyroDamp = 200 -- Front Wheel Non-Axial Dampening
Tune.RGyroDamp = 200 -- Rear Wheel Non-Axial Dampening
|
-- Basic settings
|
local ROTATION_SPEED = 0.1
local tweenService = game:GetService("TweenService")
while true do
-- Wait
local waitTime = wait()
-- Tween to rotate
local goal = {
CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, ROTATION_SPEED, 0)
}
tweenService:Create(script.Parent, TweenInfo.new(waitTime, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), goal):Play()
end
|
-- Split a filename into [root, dir, basename]
|
function Path:_splitPath(filename: string)
filename = self:normalizeSeparators(filename)
local root = ""
if self:isAbsolute(filename) or self:isDriveRelative(filename) then
root = self:getRoot(filename)
filename = filename:sub(root:len() + 1)
end
local trailing_slashes = filename:match("[" .. self.sep .. "]*$")
if trailing_slashes then
filename = filename:sub(1, -trailing_slashes:len() - 1)
end
local basename = filename:match("[^" .. self.sep .. "]+$") or ""
local dir = basename and filename:sub(1, -basename:len() - 1) or filename
return root, dir, basename
end
|
-- Main input to buffer.
|
function ChangeBuffer:align(diff: Diff): ()
local s = diff[2]
if s:match("\n") then
local substrings = s:split("\n")
-- ROBLOX deviation: 1-indexing
local iLast = #substrings
for i, substring in ipairs(substrings) do
if i < iLast then
-- The first substring completes the current change line.
-- A middle substring is a change line.
self:pushSubstring(substring)
self:pushLine()
elseif #substring ~= 0 then
-- The last substring starts a change line, if it is not empty.
-- Important: This non-empty condition also automatically omits
-- the newline appended to the end of expected and received strings.
self:pushSubstring(substring)
end
end
else
-- Append non-multiline string to current change line.
self:pushDiff(diff)
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.