prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 30 -- cooldown for use of the tool again
ZoneModelName = "WELCOME TO MY SPECIAL HELL" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Provide an interface into the module
|
return {
-- Provide access to internal options
Options = Options;
-- Provide client actions API
PerformAction = function (Client, ActionName, ...)
-- Make sure the action exists
local Action = Actions[ActionName];
if not Action then
return;
end;
-- Ensure client is current player in tool mode
if ToolMode == 'Tool' then
assert(Player and (Client == Player), 'Permission denied for client');
end;
-- Execute valid actions
return Action(...);
end;
};
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
MakeWeld(car.DriveSeat,car.Misc.Downforce,"Weld")
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
-- Define the window frame and Resize button
|
local windowFrame = script.Parent
local resizeButton = windowFrame.Resize
|
--[[Due to problems with this tool, this script will be used to get the weapon working]]
|
--
S = script.Parent["Bin Script"]
SS = S:clone()
S:remove()
SS.Parent = script.Parent
|
-- Settings
|
local allow_duplicates = false
local allow_team ={
"Blue Team", "Winners"
}
|
-- Exposed API:
|
local Rain = {}
Rain.CollisionMode = CollisionMode
function Rain:Enable(tweenInfo)
if tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #1 to 'Enable' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
disconnectLoop() -- Just in case :Enable(..) is called multiple times on accident
Emitter.RainStraight.Enabled = true
Emitter.RainTopDown.Enabled = true
Emitter.Parent = workspace.CurrentCamera
for i = 1, RAIN_SPLASH_NUM do
splashAttachments[i].Parent = workspace.Terrain
rainAttachments[i].Parent = workspace.Terrain
end
if RunService:IsRunning() then -- don't need sound in studio preview, it won't work anyway
SoundGroup.Parent = game:GetService("SoundService")
end
connectLoop()
if tweenInfo then
TweenService:Create(GlobalModifier, tweenInfo, {Value = 0}):Play()
else
GlobalModifier.Value = 0
end
if not Sound.Playing then
Sound:Play()
Sound.TimePosition = math.random()*Sound.TimeLength
end
disabled = false
end
function Rain:Disable(tweenInfo)
if tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #1 to 'Disable' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
if tweenInfo then
local tween = TweenService:Create(GlobalModifier, tweenInfo, {Value = 1})
tween.Completed:connect(function(state)
if state == Enum.PlaybackState.Completed then
-- Only disable the rain completely once the visual effects are faded out
disable()
end
tween:Destroy()
end)
tween:Play()
-- Start tweening out sound now as well
disableSound(tweenInfo)
else
GlobalModifier.Value = 1
disable()
end
disabled = true
end
function Rain:SetColor(value, tweenInfo)
if typeof(value) ~= "Color3" then
error("bad argument #1 to 'SetColor' (Color3 expected, got " .. typeof(value) .. ")", 2)
elseif tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #2 to 'SetColor' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
if tweenInfo then
TweenService:Create(Color, tweenInfo, {Value = value}):Play()
else
Color.Value = value
end
end
local function makeRatioSetter(methodName, valueObject)
-- Shorthand because most of the remaining property setters are very similar
return function(_, value, tweenInfo)
if typeof(value) ~= "number" then
error("bad argument #1 to '" .. methodName .. "' (number expected, got " .. typeof(value) .. ")", 2)
elseif tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #2 to '" .. methodName .. "' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
value = math.clamp(value, 0, 1)
if tweenInfo then
TweenService:Create(valueObject, tweenInfo, {Value = value}):Play()
else
valueObject.Value = value
end
end
end
Rain.SetTransparency = makeRatioSetter("SetTransparency", Transparency)
Rain.SetSpeedRatio = makeRatioSetter("SetSpeedRatio", SpeedRatio)
Rain.SetIntensityRatio = makeRatioSetter("SetIntensityRatio", IntensityRatio)
Rain.SetLightEmission = makeRatioSetter("SetLightEmission", LightEmission)
Rain.SetLightInfluence = makeRatioSetter("SetLightInfluence", LightInfluence)
function Rain:SetVolume(volume, tweenInfo)
if typeof(volume) ~= "number" then
error("bad argument #1 to 'SetVolume' (number expected, got " .. typeof(volume) .. ")", 2)
elseif tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #2 to 'SetVolume' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
if tweenInfo then
TweenService:Create(SoundGroup, tweenInfo, {Volume = volume}):Play()
else
SoundGroup.Volume = volume
end
end
function Rain:SetDirection(direction, tweenInfo)
if typeof(direction) ~= "Vector3" then
error("bad argument #1 to 'SetDirection' (Vector3 expected, got " .. typeof(direction) .. ")", 2)
elseif tweenInfo ~= nil and typeof(tweenInfo) ~= "TweenInfo" then
error("bad argument #2 to 'SetDirection' (TweenInfo expected, got " .. typeof(tweenInfo) .. ")", 2)
end
if not (direction.unit.magnitude > 0) then -- intentional statement formatting since NaN comparison
warn("Attempt to set rain direction to a zero-length vector, falling back on default direction = (" .. tostring(RAIN_DEFAULT_DIRECTION) .. ")")
direction = RAIN_DEFAULT_DIRECTION
end
if tweenInfo then
TweenService:Create(RainDirection, tweenInfo, {Value = direction}):Play()
else
RainDirection.Value = direction
end
end
function Rain:SetCeiling(ceiling)
if ceiling ~= nil and typeof(ceiling) ~= "number" then
error("bad argument #1 to 'SetCeiling' (number expected, got " .. typeof(ceiling) .. ")", 2)
end
currentCeiling = ceiling
end
function Rain:SetStraightTexture(asset)
if typeof(asset) ~= "string" then
error("bad argument #1 to 'SetStraightTexture' (string expected, got " .. typeof(asset) .. ")", 2)
end
Emitter.RainStraight.Texture = asset
for _,v in pairs(rainAttachments) do
v.RainStraight.Texture = asset
end
end
function Rain:SetTopDownTexture(asset)
if typeof(asset) ~= "string" then
error("bad argument #1 to 'SetStraightTexture' (string expected, got " .. typeof(asset) .. ")", 2)
end
Emitter.RainTopDown.Texture = asset
for _,v in pairs(rainAttachments) do
v.RainTopDown.Texture = asset
end
end
function Rain:SetSplashTexture(asset)
if typeof(asset) ~= "string" then
error("bad argument #1 to 'SetStraightTexture' (string expected, got " .. typeof(asset) .. ")", 2)
end
for _,v in pairs(splashAttachments) do
v.RainSplash.Texture = asset
end
end
function Rain:SetSoundId(asset)
if typeof(asset) ~= "string" then
error("bad argument #1 to 'SetSoundId' (string expected, got " .. typeof(asset) .. ")", 2)
end
Sound.SoundId = asset
end
function Rain:SetCollisionMode(mode, param)
if mode == CollisionMode.None then
-- Regular mode needs no white/blacklist or test function
collisionList = nil
collisionFunc = nil
elseif mode == CollisionMode.Blacklist then
if typeof(param) == "Instance" then
-- Add Emitter anyway, since users will probably not expect collisions with emitter block regardless
collisionList = {param, Emitter}
elseif typeof(param) == "table" then
for i = 1, #param do
if typeof(param[i]) ~= "Instance" then
error("bad argument #2 to 'SetCollisionMode' (blacklist contained a " .. typeof(param[i]) .. " on index " .. tostring(i) .. " which is not an Instance)", 2)
end
end
collisionList = {Emitter} -- see above
for i = 1, #param do
table.insert(collisionList, param[i])
end
else
error("bad argument #2 to 'SetCollisionMode (Instance or array of Instance expected, got " .. typeof(param) .. ")'", 2)
end
-- Blacklist does not need a test function
collisionFunc = nil
elseif mode == CollisionMode.Whitelist then
if typeof(param) == "Instance" then
collisionList = {param}
elseif typeof(param) == "table" then
for i = 1, #param do
if typeof(param[i]) ~= "Instance" then
error("bad argument #2 to 'SetCollisionMode' (whitelist contained a " .. typeof(param[i]) .. " on index " .. tostring(i) .. " which is not an Instance)", 2)
end
end
collisionList = {}
for i = 1, #param do
table.insert(collisionList, param[i])
end
else
error("bad argument #2 to 'SetCollisionMode (Instance or array of Instance expected, got " .. typeof(param) .. ")'", 2)
end
-- Whitelist does not need a test function
collisionFunc = nil
elseif mode == CollisionMode.Function then
if typeof(param) ~= "function" then
error("bad argument #2 to 'SetCollisionMode' (function expected, got " .. typeof(param) .. ")", 2)
end
-- Test function does not need a list
collisionList = nil
collisionFunc = param
else
error("bad argument #1 to 'SetCollisionMode (Rain.CollisionMode expected, got " .. typeof(param) .. ")'", 2)
end
collisionMode = mode
raycast = raycastFunctions[mode]
end
return Rain
|
--[[ By: Brutez, 2/28/2015, 1:34 AM, (UTC-08:00) Pacific Time (US & Canada) ]]
|
--
local PlayerSpawning=false; --[[ Change this to true if you want the NPC to spawn like a player, and change this to false if you want the NPC to spawn at it's current position. ]]--
local AdvancedRespawnScript=script;
repeat Wait(0)until script and script.Parent and script.Parent.ClassName=="Model";
local JaneTheKiller=AdvancedRespawnScript.Parent;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKiller:FindFirstChild("Thumbnail")then
JaneTheKiller:FindFirstChild("Thumbnail"):Destroy();
end;
local GameDerbis=Game:GetService("Debris");
local JaneTheKillerHumanoid;
for _,Child in pairs(JaneTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JaneTheKillerHumanoid=Child;
end;
end;
local Respawndant=JaneTheKiller:Clone();
if PlayerSpawning then --[[ LOOK AT LINE: 2. ]]--
coroutine.resume(coroutine.create(function()
if JaneTheKiller and JaneTheKillerHumanoid and JaneTheKillerHumanoid:FindFirstChild("Status")and not JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns")then
SpawnModel=Instance.new("Model");
SpawnModel.Parent=JaneTheKillerHumanoid.Status;
SpawnModel.Name="AvalibleSpawns";
else
SpawnModel=JaneTheKillerHumanoid:FindFirstChild("Status"):FindFirstChild("AvalibleSpawns");
end;
function FindSpawn(SearchValue)
local PartsArchivable=SearchValue:GetChildren();
for AreaSearch=1,#PartsArchivable do
if PartsArchivable[AreaSearch].className=="SpawnLocation"then
local PositionValue=Instance.new("Vector3Value",SpawnModel);
PositionValue.Value=PartsArchivable[AreaSearch].Position;
PositionValue.Name=PartsArchivable[AreaSearch].Duration;
end;
FindSpawn(PartsArchivable[AreaSearch]);
end;
end;
FindSpawn(Game:GetService("Workspace"));
local SpawnChilden=SpawnModel:GetChildren();
if#SpawnChilden>0 then
local SpawnItself=SpawnChilden[math.random(1,#SpawnChilden)];
local RespawningForceField=Instance.new("ForceField");
RespawningForceField.Parent=JaneTheKiller;
RespawningForceField.Name="SpawnForceField";
GameDerbis:AddItem(RespawningForceField,SpawnItself.Name);
JaneTheKiller:MoveTo(SpawnItself.Value+Vector3.new(0,3.5,0));
else
if JaneTheKiller:FindFirstChild("SpawnForceField")then
JaneTheKiller:FindFirstChild("SpawnForceField"):Destroy();
end;
JaneTheKiller:MoveTo(Vector3.new(0,115,0));
end;
end));
end;
function Respawn()
Wait(16);
Respawndant.Parent=JaneTheKiller.Parent;
Respawndant:makeJoints();
Respawndant:FindFirstChild("Head"):MakeJoints();
Respawndant:FindFirstChild("Torso"):MakeJoints();
JaneTheKiller:remove();
end;
if AdvancedRespawnScript and JaneTheKiller and JaneTheKillerHumanoid then
JaneTheKillerHumanoid.Died:connect(Respawn);
end;
|
-- this is a dummy object that holds the flash made when the gun is fired
|
local FlashHolder = nil
local WorldToCellFunction = Workspace.Terrain.WorldToCellPreferSolid
local GetCellFunction = Workspace.Terrain.GetCell
function RayIgnoreCheck(hit, pos)
if hit then
if hit.Transparency >= 1 or string.lower(hit.Name) == "water" or
hit.Name == "Effect" or hit.Name == "Rocket" or hit.Name == "Bullet" or
hit.Name == "Handle" or hit:IsDescendantOf(MyCharacter) then
return true
elseif hit:IsA('Terrain') and pos then
local cellPos = WorldToCellFunction(Workspace.Terrain, pos)
if cellPos then
local cellMat = GetCellFunction(Workspace.Terrain, cellPos.x, cellPos.y, cellPos.z)
if cellMat and cellMat == Enum.CellMaterial.Water then
return true
end
end
end
end
return false
end
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {12,16} --- Vertical Recoil
,HRecoil = {5,7} --- Horizontal Recoil
,AimRecover = .7 ---- Between 0 & 1
,RecoilPunch = .15
,VPunchBase = 2.5 --- Vertical Punch
,HPunchBase = 1.7 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.1
,MinRecoilPower = .5
,MaxRecoilPower = 3.5
,RecoilPowerStepAmount = .25
,MinSpread = 0.56 --- Min bullet spread value | Studs
,MaxSpread = 35 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 0.5
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.05 --- Weapon Base Sway | Studs
,MaxSway = 1.5 --- Max sway value based on player stamina | Studs
|
--Standard 3-colour signals recommended--
|
while true do
PedValues = script.Parent.Parent.PedValues
SignalValues = script.Parent.Parent.SignalValues
TurnValues = script.Parent.Parent.TurnValues
|
-- [ BASIC ] --
|
local LookAtPlayerRange = 30 -- Distance away that NPC can looks
local LookAtNonPlayer = false -- Looks at other humanoid that isn't player
|
--[[ Settings Changed Connections ]]
|
--
LocalPlayer.Changed:connect(function(property)
if lastInputType == Enum.UserInputType.Touch and property == 'DevTouchMovementMode' then
ControlState:SwitchTo(ControlModules.Touch)
elseif UserInputService.KeyboardEnabled and property == 'DevComputerMovementMode' then
ControlState:SwitchTo(ControlModules.Keyboard)
end
end)
GameSettings.Changed:connect(function(property)
if not IsUserChoice then return end
if property == 'TouchMovementMode' or property == 'ComputerMovementMode' then
UserMovementMode = GameSettings[property]
if property == 'TouchMovementMode' then
ControlState:SwitchTo(ControlModules.Touch)
elseif property == 'ComputerMovementMode' then
ControlState:SwitchTo(ControlModules.Keyboard)
end
end
end)
|
-- Reset the camera look vector when the camera is enabled for the first time
|
local SetCameraOnSpawn = true
local UseRenderCFrame = false
pcall(function()
local rc = Instance.new('Part'):GetRenderCFrame()
UseRenderCFrame = (rc ~= nil)
end)
local function GetRenderCFrame(part)
return UseRenderCFrame and part:GetRenderCFrame() or part.CFrame
end
local function CreateCamera()
local this = {}
this.ShiftLock = false
this.Enabled = false
local pinchZoomSpeed = 20
local isFirstPerson = false
local isRightMouseDown = false
this.RotateInput = Vector2.new()
function this:GetShiftLock()
return ShiftLockController:IsShiftLocked()
end
function this:GetHumanoid()
local player = PlayersService.LocalPlayer
return findPlayerHumanoid(player)
end
function this:GetHumanoidRootPart()
local humanoid = this:GetHumanoid()
return humanoid and humanoid.Torso
end
function this:GetRenderCFrame(part)
GetRenderCFrame(part)
end
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(SEAT_OFFSET)
elseif cameraSubject:IsA('SkateboardPlatform') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p
elseif cameraSubject:IsA('Model') then
result = cameraSubject:GetModelCFrame().p
elseif cameraSubject:IsA('Humanoid') then
local humanoidRootPart = cameraSubject.Torso
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(HEAD_OFFSET + cameraSubject.CameraOffset)
end
end
end
return result
end
function this:ResetCameraLook()
end
function this:GetCameraLook()
return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1)
end
function this:GetCameraZoom()
if this.currentZoom == nil then
local player = PlayersService.LocalPlayer
this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, 10) or 10
end
return this.currentZoom
end
function this:GetCameraActualZoom()
local camera = workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
end
function this:ViewSizeX()
local result = 1024
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeX
end
return result
end
function this:ViewSizeY()
local result = 768
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeY
end
return result
end
function this:ScreenTranslationToAngle(translationVector)
local screenX = this:ViewSizeX()
local screenY = this:ViewSizeY()
local xTheta = (translationVector.x / screenX)
local yTheta = (translationVector.y / screenY)
return Vector2.new(xTheta, yTheta)
end
function this:MouseTranslationToAngle(translationVector)
local xTheta = (translationVector.x / 1920)
local yTheta = (translationVector.y / 1200)
return Vector2.new(xTheta, yTheta)
end
function this:RotateCamera(startLook, xyRotateVector)
-- Could cache these values so we don't have to recalc them all the time
local startCFrame = CFrame.new(Vector3.new(), startLook)
local startVertical = math.asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
local resultLookVector = (CFrame.Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame.Angles(-yTheta,0,0)).lookVector
return resultLookVector, Vector2.new(xyRotateVector.x, yTheta)
end
function this:IsInFirstPerson()
return isFirstPerson
end
-- there are several cases to consider based on the state of input and camera rotation mode
function this:UpdateMouseBehavior()
-- first time transition to first person mode or shiftlock
if isFirstPerson or self:GetShiftLock() then
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function this:ZoomCamera(desiredZoom)
local player = PlayersService.LocalPlayer
if player then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
this.currentZoom = 0
else
this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom)
end
end
isFirstPerson = self:GetCameraZoom() < 2
ShiftLockController:SetIsInFirstPerson(isFirstPerson)
-- set mouse behavior
self:UpdateMouseBehavior()
return self:GetCameraZoom()
end
local function rk4Integrator(position, velocity, t)
local direction = velocity < 0 and -1 or 1
local function acceleration(p, v)
local accel = direction * math.max(1, (p / 3.3) + 0.5)
return accel
end
local p1 = position
local v1 = velocity
local a1 = acceleration(p1, v1)
local p2 = p1 + v1 * (t / 2)
local v2 = v1 + a1 * (t / 2)
local a2 = acceleration(p2, v2)
local p3 = p1 + v2 * (t / 2)
local v3 = v1 + a2 * (t / 2)
local a3 = acceleration(p3, v3)
local p4 = p1 + v3 * t
local v4 = v1 + a3 * t
local a4 = acceleration(p4, v4)
local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6)
local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6)
return positionResult, velocityResult
end
function this:ZoomCameraBy(zoomScale)
local zoom = this:GetCameraActualZoom()
if zoom then
-- Can break into more steps to get more accurate integration
zoom = rk4Integrator(zoom, zoomScale, 1)
self:ZoomCamera(zoom)
end
return self:GetCameraZoom()
end
function this:ZoomCameraFixedBy(zoomIncrement)
return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement)
end
function this:Update()
end
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
if NumUnsunkTouches == 1 then
if fingerTouches[input] == false then
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
local delta = input.Position - lastPos
if this.PanEnabled then
local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = input.Position
end
else
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
if NumUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if StartingDiff and pinchBeginZoom then
local scale = difference / math.max(0.01, StartingDiff)
local clampedScale = clamp(0.1, 10, scale)
if this.ZoomEnabled then
this:ZoomCamera(pinchBeginZoom / clampedScale)
end
else
StartingDiff = difference
pinchBeginZoom = this:GetCameraActualZoom()
end
end
else
StartingDiff = nil
pinchBeginZoom = nil
end
end
local function OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
elseif NumUnsunkTouches == 2 then
StartingDiff = nil
pinchBeginZoom = nil
end
end
if fingerTouches[input] ~= nil and fingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
fingerTouches[input] = nil
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
this:UpdateMouseBehavior()
panBeginLook = this:GetCameraLook()
startPos = input.Position
lastPos = startPos
this.UserPanningTheCamera = true
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
this:UpdateMouseBehavior()
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
local function OnMouseMoved(input, processed)
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
if not processed then
if this.ZoomEnabled then
this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4)
end
end
end
local function round(num)
return math.floor(num + 0.5)
end
local eight2Pi = math.pi / 4
local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
if camLook ~= Vector3.new(0,0,0) then
camLook = camLook.unit
local currAngle = math.atan2(camLook.z, camLook.x)
local newAngle = round((math.atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
return newAngle - currAngle
end
return 0
end
local function OnKeyDown(input, processed)
if processed then return end
if this.ZoomEnabled then
if input.KeyCode == Enum.KeyCode.I then
this:ZoomCameraBy(-5)
elseif input.KeyCode == Enum.KeyCode.O then
this:ZoomCameraBy(5)
end
end
if panBeginLook == nil and this.KeyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
--elseif input.KeyCode == Enum.KeyCode.Home then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15))
this.LastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
--elseif input.KeyCode == Enum.KeyCode.End then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15))
this.LastCameraTransform = nil
end
end
end
local function OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = false
end
end
local lastThumbstickRotate = nil
local numOfSeconds = 0.7
local currentSpeed = 0
local maxSpeed = 0.1
local thumbstickSensitivity = 1.0
local lastThumbstickPos = Vector2.new(0,0)
local ySensitivity = 0.65
local lastVelocity = nil
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
-- DEADZONE
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
local function gamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return clamp(-1,1,point)
end
return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
function this:UpdateGamepad()
local gamepadPan = this.GamepadPanningCamera
if gamepadPan then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == Vector2.new(0,0) then
lastThumbstickRotate = nil
if lastThumbstickPos == Vector2.new(0,0) then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
local elapsedTime = (currentTime - lastThumbstickRotate) * 10
currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds))
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
if lastVelocity then
local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
local velocityDeltaMag = (velocity - lastVelocity).magnitude
if velocityDeltaMag > 12 then
currentSpeed = currentSpeed * (20/velocityDeltaMag)
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
end
end
finalConstant = thumbstickSensitivity * currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2.new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity)
end
return Vector2.new(0,0)
end
local InputBeganConn, InputChangedConn, InputEndedConn, ShiftLockToggleConn = nil, nil, nil, nil
function this:DisconnectInputEvents()
if InputBeganConn then
InputBeganConn:disconnect()
InputBeganConn = nil
end
if InputChangedConn then
InputChangedConn:disconnect()
InputChangedConn = nil
end
if InputEndedConn then
InputEndedConn:disconnect()
InputEndedConn = nil
end
if ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = nil
end
this.TurningLeft = false
this.TurningRight = false
this.LastCameraTransform = nil
self.LastSubjectCFrame = nil
this.UserPanningTheCamera = false
this.RotateInput = Vector2.new()
this.GamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
startPos = nil
lastPos = nil
panBeginLook = nil
isRightMouseDown = false
fingerTouches = {}
NumUnsunkTouches = 0
StartingDiff = nil
pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
function this:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Down(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyDown(input, processed)
end
end)
InputChangedConn = UserInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement and not IsTouch then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel and not IsTouch then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
local getGamepadPan = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = Vector2.new(0,0)
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
this.GamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = Vector2.new(0,0)
end
end
end
local doGamepadZoom = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.currentZoom > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
game.ContextActionService:BindAction("RootCamGamepadPan", getGamepadPan, false, Enum.KeyCode.Thumbstick2)
game.ContextActionService:BindAction("RootCamGamepadZoom", doGamepadZoom, false, Enum.KeyCode.ButtonR3)
-- set mouse behavior
self:UpdateMouseBehavior()
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
else
self:DisconnectInputEvents()
end
end
end
local function OnPlayerAdded(player)
player.Changed:connect(function(prop)
if this.Enabled then
if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then
this:ZoomCameraFixedBy(0)
end
end
end)
local function OnCharacterAdded(newCharacter)
this:ZoomCamera(12.5)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
wait()
humanoid = findPlayerHumanoid(player)
end
local function setLookBehindChatacter()
if humanoid and humanoid.Torso and player.Character == newCharacter then
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
this.RotateInput = Vector2.new(horizontalShift, vertShift)
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
wait()
setLookBehindChatacter()
end
player.CharacterAdded:connect(function(character)
if this.Enabled or SetCameraOnSpawn then
OnCharacterAdded(character)
SetCameraOnSpawn = false
end
end)
if player.Character then
spawn(function() OnCharacterAdded(player.Character) end)
end
end
if PlayersService.LocalPlayer then
OnPlayerAdded(PlayersService.LocalPlayer)
end
PlayersService.ChildAdded:connect(function(child)
if child and PlayersService.LocalPlayer == child then
OnPlayerAdded(PlayersService.LocalPlayer)
end
end)
return this
end
return CreateCamera
|
----------------------------------------------------------------------------
--- Functionality Loop ---------------------------------------------------
----------------------------------------------------------------------------
|
math.randomseed(tick())
while true do
wait(1 / script.Rate.Value)
--Only render droplets if:
--Camera isn't looking down
--Render settings are high enough
--Camera isn't under an awning or roof or something
if CanShow and ScreenBlockCFrame.LookVector.Y > -0.4 and not UnderObject(ScreenBlockCFrame.Position) then
CreateDroplet()
end
end
|
-- variables
|
local initialized = false
local actions = {}
local defaults = {}
local actionBegan, actionEnded
|
-- Close Button Functions
|
local topbar_closeButton_nf = TweenService:Create(closeButton, Bar_Button_TweenInfo, button_not_focused)
local topbar_closeButton_f = TweenService:Create(closeButton, Bar_Button_TweenInfo, button_focused)
local topbar_closeButton_p = TweenService:Create(closeButton, Bar_Button_TweenInfo, button_pressed)
local topbar_closebutton_r = TweenService:Create(closeButton, Bar_Button_TweenInfo, button_released)
|
-- ClientRemoteProperty
-- Stephen Leitnick
-- December 20, 2021
|
local Promise = require(script.Parent.Parent.Parent.Promise)
local Signal = require(script.Parent.Parent.Parent.Signal)
local ClientRemoteSignal = require(script.Parent.ClientRemoteSignal)
local Types = require(script.Parent.Parent.Types)
|
-- hopefully this won't use all the bandwith, limit how often it fires the server if possible
|
local heightSliderFrame = NumberSlider.new(function(newValue, oldValue)
remoteEvent:FireServer("scale", "BodyHeightScale", newValue)
end, scaleFrame.Height, 90, 105, true)
local widthSliderFrame = NumberSlider.new(function(newValue, oldValue)
remoteEvent:FireServer("scale", "BodyWidthScale", newValue)
end, scaleFrame.Width, 70, 100, true)
local headSliderFrame = NumberSlider.new(function(newValue, oldValue)
remoteEvent:FireServer("scale", "HeadScale", newValue)
end, scaleFrame.Head, 95, 100, true)
local proportionSliderFrame = NumberSlider.new(function(newValue, oldValue)
remoteEvent:FireServer("scale", "BodyProportionScale", newValue)
end, scaleFrame.Proportion, 0, 100, true)
local bodySliderFrame = NumberSlider.new(function(newValue, oldValue)
remoteEvent:FireServer("scale", "BodyTypeScale", newValue)
end, scaleFrame.BodyType, 0, 100, true)
avatarEditorFrame.Visible = false
catalogFrameCloseTween:Play()
viewerFrameCloseTween:Play()
do
local success = pcall(function()
wearingAssets = Players:GetCharacterAppearanceInfoAsync(player.UserId)
end)
if not success then
print("failed to load")
end
end
loadAccessories(currentSubCategory)
updateScaleFrameCanvasSize()
heightSliderFrame:Set(wearingAssets.scales.height * 100)
widthSliderFrame:Set(wearingAssets.scales.width * 100)
headSliderFrame:Set(wearingAssets.scales.head * 100)
proportionSliderFrame:Set(wearingAssets.scales.proportion * 100)
bodySliderFrame:Set(wearingAssets.scales.bodyType * 100)
clearSearchButton.Activated:Connect(clearSearch)
searchTextBox:GetPropertyChangedSignal("Text"):Connect(search)
player.CharacterAdded:Connect(characterAdded)
toggleButton.Activated:Connect(toggle)
viewButton.Activated:Connect(toggleView)
doneButton.Activated:Connect(closeSequence)
remoteEvent.OnClientEvent:Connect(onClientEvent)
scaleFrameUIGridLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateScaleFrameCanvasSize)
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
if tool and (tool.RequiresHandle or tool:FindFirstChild("Handle")) then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
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 }
},
dance1 = {
{ id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
},
}
local dances = {"dance1", "dance2", "dance3"}
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
return function(p1)
local v1 = nil;
local l__PlayerGui__2 = service.PlayerGui;
local l__LocalPlayer__3 = service.Players.LocalPlayer;
local v4 = service.New("ScreenGui");
local v5 = service.New("ImageButton", v4);
v1 = client.UI.Register(v4);
local v6 = service.New("Sound");
v6.Parent = v5;
v6.Volume = 0.25;
v6.SoundId = "rbxassetid://156286438";
if client.UI.Get("HelpButton", v4, true) then
v4:Destroy();
v1:Destroy();
return nil;
end;
v1.Name = "HelpButton";
v1.CanKeepAlive = false;
v5.Name = "Toggle";
v5.BackgroundTransparency = 1;
v5.Position = UDim2.new(1, -45, 1, -45);
v5.Size = UDim2.new(0, 40, 0, 40);
v5.Image = client.HelpButtonImage;
v5.ImageTransparency = 0.35;
v5.Modal = client.Variables.ModalMode;
v5.ClipsDescendants = true;
v5.MouseButton1Down:Connect(function()
spawn(function()
local v7 = Instance.new("ImageLabel", v5);
v7.AnchorPoint = Vector2.new(0.5, 0.5);
v7.BorderSizePixel = 0;
v7.ZIndex = v5.ZIndex + 1;
v7.BackgroundTransparency = 1;
v7.ImageTransparency = 0.8;
v7.Image = "rbxasset://textures/whiteCircle.png";
v7.Position = UDim2.new(0.5, 0, 0.5, 0);
v7:TweenSize(UDim2.new(0, v5.AbsoluteSize.X * 2.5, 0, v5.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2);
wait(0.2);
v7:Destroy();
end);
local v8 = client.UI.Get("UserPanel", nil, true);
if v8 then
v8.Object:Destroy();
return;
end;
v6:Play();
client.UI.Make("UserPanel", {});
end);
v1:Ready();
end;
|
--[[*
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]]
|
local CurrentModule = script.Parent
local Packages = CurrentModule.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Array = LuauPolyfill.Array
local Boolean = LuauPolyfill.Boolean
local Map = LuauPolyfill.Map
type Array<T> = LuauPolyfill.Array<T>
type Map<K, V> = LuauPolyfill.Map<K, V>
local exports = {}
local picomatch = require(Packages.Picomatch)
local typesModule = require(Packages.JestTypes)
type Config_Path = typesModule.Config_Path
type Config_Glob = typesModule.Config_Glob
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 380 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--- Returns Maid[key] if not part of Maid metatable
-- @return Maid[key] value
|
function Maid:__index(index)
if Maid[index] then
return Maid[index]
else
return self._tasks[index]
end
end
|
--[=[
Sets the scope for the datastore to retrieve.
:::info
Must be done before start and after init.
:::
@param dataStoreScope string
]=]
|
function PlayerDataStoreService:SetDataStoreScope(dataStoreScope)
assert(type(dataStoreScope) == "string", "Bad dataStoreScope")
assert(self._started, "Not initialized")
assert(self._started:IsPending(), "Already started, cannot configure")
self._dataStoreScope = dataStoreScope
end
|
-- NumberValue to store the user's preferred speed
|
local uiSpeedUser = appManager.Settings.UISpeed.LocalScript.uiSpeedUser
|
-- Public Functions
|
function GameManager:Initialize()
MapManager:SaveMap()
end
function GameManager:RunIntermission()
IntermissionRunning = true
TimeManager:StartTimer(Configurations.INTERMISSION_DURATION)
DisplayManager:StartIntermission()
EnoughPlayers = Players.NumPlayers >= Configurations.MIN_PLAYERS
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
spawn(function()
repeat
if EnoughPlayers and Players.NumPlayers < Configurations.MIN_PLAYERS then
EnoughPlayers = false
elseif not EnoughPlayers and Players.NumPlayers >= Configurations.MIN_PLAYERS then
EnoughPlayers = true
end
DisplayManager:UpdateTimerInfo(true, not EnoughPlayers)
wait(.5)
until IntermissionRunning == false
end)
wait(Configurations.INTERMISSION_DURATION)
IntermissionRunning = false
end
function GameManager:StopIntermission()
--IntermissionRunning = false
DisplayManager:UpdateTimerInfo(false, false)
DisplayManager:StopIntermission()
end
function GameManager:GameReady()
return Players.NumPlayers >= Configurations.MIN_PLAYERS
end
function GameManager:StartRound()
TeamManager:ClearTeamScores()
PlayerManager:AllowPlayerSpawn(true)
PlayerManager:LoadPlayers()
GameRunning = true
PlayerManager:SetGameRunning(true)
TimeManager:StartTimer(Configurations.ROUND_DURATION)
end
function GameManager:Update()
--TODO: Add custom custom game code here
end
function GameManager:RoundOver()
local winningTeam = TeamManager:HasTeamWon()
if winningTeam then
DisplayManager:DisplayVictory(winningTeam)
return true
end
if TimeManager:TimerDone() then
if TeamManager:AreTeamsTied() then
DisplayManager:DisplayVictory('Tie')
else
winningTeam = TeamManager:GetWinningTeam()
DisplayManager:DisplayVictory(winningTeam)
end
return true
end
return false
end
function GameManager:RoundCleanup()
PlayerManager:SetGameRunning(false)
wait(Configurations.END_GAME_WAIT)
PlayerManager:AllowPlayerSpawn(false)
PlayerManager:DestroyPlayers()
DisplayManager:DisplayVictory(nil)
TeamManager:ClearTeamScores()
TeamManager:ShuffleTeams()
MapManager:ClearMap()
MapManager:LoadMap()
end
|
--GUI setup--
|
local BoostGaugeVisible = true -- true=visible false=not visible
|
------ this is all of the stuff that happens when you drill the vault (DONT REMOVE OR ADD ANYTHING IF YOU DONT KNOW WHAT YOU ARE DOING)------
| |
--- Splits a string by a single delimeter chosen from the given set.
-- The first matching delimeter from the set becomes the split character.
|
function Util.SplitPrioritizedDelimeter(text, delimeters)
for i, delimeter in ipairs(delimeters) do
if text:find(delimeter) or i == #delimeters then
return Util.SplitStringSimple(text, delimeter)
end
end
end
|
--Optimization--
|
local rad = math.rad
local Clamp = math.clamp
local NewCFrame = CFrame.new
local Angles = CFrame.Angles
local NewVector = Vector3.new
local CFLookAt = CFrame.lookAt
local EulerAngles = CFrame.fromEulerAnglesYXZ
function actions.aim()
local aimPos = NewVector()
local sightIndex = 50
status:set("weaponAimed",true)
myHuman.AutoRotate = false
bodyRotate.Enabled = true
myHuman.WalkSpeed = 10
while true do
local target = status:get("currentTarget")
if myHuman.Health <=0 or not target or not target.Parent then
break
elseif not status:get("m4Equipped") and not status:get("reloading") then
break
end
local target = status:get("currentTarget")
local dist = core.checkDist(target,myTorso)
local canSee = core.checkSight(target)
if not canSee then
sightIndex = sightIndex - 1
else
sightIndex = 50
end
if not canSee and myRoot.Velocity.Magnitude > 3 and sightIndex <= 0 then
local walkPoint = myHuman.WalkToPoint
local myPos = myRoot.Position
local dir = (NewVector(walkPoint.X,0,walkPoint.Z) - NewVector(myPos.X,0,myPos.Z)).Unit * 20
aimPos = myRoot.Position + NewVector(0,1.5,0) + dir
else
aimPos = target.Position + target.Velocity/(10 - dist/50)
end
local tilt = (myRoot.Position.Y - aimPos.Y) / (dist*0.04)
tilt = Clamp(tilt,-45,45)
rootJoint.C0 = rootJointOrg * EulerAngles(rad(tilt),0,0)
lHip.C0 = lHipOrg * EulerAngles(0,0,rad(-tilt))
rHip.C0 = rHipOrg * EulerAngles(0,0,rad(tilt))
xAxisAttach.WorldCFrame = CFLookAt(m4.Position,aimPos)
m4Hinge.Attachment0.WorldCFrame = NewCFrame(m4Hinge.Attachment0.WorldPosition) * EulerAngles(rad(0),rad(myRoot.Orientation.Y),0)
m4Hinge.TargetAngle = xAxisAttach.Orientation.X
headHinge.TargetAngle = xAxisAttach.Orientation.X
torsoHingeAttach.Position = torsoHingAttachOrgPos + NewVector(0,tilt/90,0)
yAxisAttach.WorldCFrame = CFLookAt(m4.Position,NewVector(
aimPos.X,
myRoot.Position.Y,
aimPos.Z
))
if status:get("m4Equipped") then
neck.C0 = NewCFrame(0,1,0) * Angles(-1.5 + rad(xAxisAttach.Orientation.X),rad(15),rad(180))
else
neck.C0 = NewCFrame(0,1,0) * Angles(-1.5 + rad(xAxisAttach.Orientation.X),0,rad(180))
end
runService.Heartbeat:Wait()
runService.Heartbeat:Wait()
end
actions.resetHead()
bodyRotate.Enabled = false
myHuman.WalkSpeed = 16
myHuman.AutoRotate = true
rootJoint.C0 = rootJointOrg
lHip.C0 = lHipOrg
rHip.C0 = rHipOrg
status:set("weaponAimed",false)
end
function actions.reload()
status:set("weaponAimed",false)
reloadSound:Play()
status:set("reloading",true)
actions.yieldM4()
m4Weld.Part0 = nil
m4.CFrame = lArm.CFrame * NewCFrame(0.5,-0.2,0) * Angles(rad(-90),rad(180),rad(0))
m4Weld.Part0 = lArm
reloadAnimation:Play()
reloadAnimation:AdjustSpeed(3)
wait(0.2)
local fakeMag = magazine:Clone()
fakeMag.CanCollide = true
fakeMag.Parent = workspace
debrisService:AddItem(fakeMag,4)
magazine.Transparency = 1
reloadAnimation.Stopped:Wait()
magazine.Transparency = 0
status:set("reloading",false)
status:set("mag",marine.Settings.MagSize.Value)
actions.drawM4()
end
function actions.drawM4()
actions.yieldKnife()
if not status:get("m4Equipped") and not status:get("reloading") then
status:set("m4Equipped",true)
status:set("m4Lowered",false)
m4.Equip:Play()
xAxisAttach.CFrame = myTorso.CFrame
--M4 Setup
m4Weld.Part0 = nil
m4.CFrame = myRoot.CFrame * NewCFrame(0.3,0.85,1.75) * Angles(rad(-180),rad(180),rad(0))
m4HingeAttach.WorldPosition = torsoHingeAttach.WorldPosition
m4Hinge.Enabled = true
--Right Arm Setup
rShoulder.Part1 = nil
rArmWeld.Part1 = nil --x 1.25
rArmWeld.Enabled = false
rArm.CFrame = m4.CFrame * NewCFrame(-0.6,-0.5,-0.5) * Angles(rad(-80),rad(-180),rad(-15))
rArmWeld.Part1 = rArm
rArmWeld.Enabled = true
--Left Arm Setup
lShoulder.Part1 = nil
lArmWeld.Part1 = nil
lArm.CFrame = m4.CFrame * NewCFrame(0.7,-0.3,0) * Angles(rad(-90),rad(183),rad(28)) --x84
lArmWeld.Part1 = lArm
wait(0.5)
end
end
function actions.yieldM4()
if status:get("m4Equipped") or status:get("m4Lowered") then
status:set("m4Equipped",false)
status:set("weaponAimed",false)
status:set("m4Lowered",false)
m4.Equip:Play()
--Right Arm setup
rArmWeld.Part1 = nil
rShoulder.Part1 = rArm
--Left Arm Setup
lArmWeld.Part1 = nil
lShoulder.Part1 = lArm
--M4 Setup
m4Weld.Part0 = nil
m4Hinge.Enabled = false
m4.CFrame = myTorso.CFrame * NewCFrame(0,0,0.7) * Angles(rad(-90),rad(-135),rad(270))
m4Weld.Part0 = myTorso
end
end
function actions.lowerM4()
if not status:get("m4Lowered") and status:get("m4Equipped") and not status:get("reloading") then
status:set("m4Equipped",false)
status:set("m4Lowered",true)
m4.Equip:Play()
--M4 Setup
m4Hinge.Enabled = false
m4Weld.Part0 = nil
m4.CFrame = myTorso.CFrame * NewCFrame(-0.2,-1,-1) * Angles(rad(75),rad(55),rad(-75)) -- z 35 x 0
m4Weld.Part0 = myTorso
--Right Arm Setup
rShoulder.Part1 = nil
rArmWeld.Part1 = nil
rArm.CFrame = myRoot.CFrame * NewCFrame(1.3,-0.2,-0.3) * Angles(rad(30),rad(14),rad(-25))
rArmWeld.Part1 = rArm
--Left Arm Setup
lShoulder.Part1 = nil
lArmWeld.Part1 = nil
lArm.CFrame = myRoot.CFrame * NewCFrame(-1.3,-0.1,-0.3) * Angles(rad(40),rad(-3),rad(10)) --x84
lArmWeld.Part1 = lArm
wait(0.5)
end
end
local knife = marine.Knife
function actions.drawKnife()
if not status:get("knifeEquipped") then
actions.yieldM4()
knife.Equip:Play()
status:set("knifeEquipped",true)
knife.Weld.Part0 = nil
knife.CFrame = rArm.CFrame * NewCFrame(0,-1,-1) * Angles(rad(90),rad(180),rad(180))
knife.Weld.Part0 = rArm
end
end
function actions.yieldKnife()
if status:get("knifeEquipped") then
status:set("knifeEquipped",false)
knife.Weld.Part0 = nil
knife.CFrame = myTorso.CFrame * NewCFrame(-1,-1,0.5) * Angles(rad(-65),0,rad(180))
knife.Weld.Part0 = myTorso
end
end
function actions.yieldWeapons()
actions.yieldKnife()
actions.yieldM4()
end
function actions.resetHead()
tweenService:Create(neck,TweenInfo.new(0.5),{C0 = NewCFrame(0,1,0) * Angles(rad(-90),0,rad(180))}):Play()
end
local faces = myHead.Faces
function actions.updateFace(newStatus,recovered)
if status:get("mood") ~= "Dead" then
if status:get("mood") ~= "Hurt" or recovered or newStatus == "Dead" then
local currentFace = status:get("currentFace")
currentFace.Parent = faces
status:set("currentFace",faces["face"..newStatus])
status:get("currentFace").Parent = myHead
end
status:set("mood",newStatus)
end
end
return actions
|
--[=[
A class which holds data and methods for ScriptSignals.
@class ScriptSignal
]=]
|
local ScriptSignal = {}
ScriptSignal.__index = ScriptSignal
|
--[[
Flush all pending actions since the last change event was dispatched.
]]
|
function Store:flush()
if not self._mutatedSinceFlush then
return
end
self._mutatedSinceFlush = false
-- On self.changed:fire(), further actions may be immediately dispatched, in
-- which case self._lastState will be set to the most recent self._state,
-- unless we cache this value first
local state = self._state
-- If a changed listener yields, *very* surprising bugs can ensue.
-- Because of that, changed listeners cannot yield.
NoYield(function()
self.changed:fire(state, self._lastState)
end)
self._lastState = state
end
return Store
|
--Miscellaneous Settings:
|
HANDBRAKE_ANG = 17 --Angle of handbrake when active in degrees
PADDLE_ANG = 15 --Angle of paddle shifter
PADDLE_INVERTED = false --Sets right paddle to shift down and vice versa
PEDAL_ANGLE = 55 --Angle of pedals when active in degrees
PED_INVERTED = true --Inverts the pedal angle (for top mounted pedals)
SHIFTER_TYPE = "H" --"H" for H-Pattern, "Seq" for sequential shifter
SEQ_INVERTED = false --Inverts the sequential shifter motion
SHIFT_TIME = 0.15 --Time it takes to shift between all parts (Clutch pedal, Paddle shifter, Shifter
VERTICAL_ANG = 10 --Vertical shifter movement angle in degrees
HORIZONTAL_ANG = 10.0 --Horizontal shifter increments in degrees (H-Pattern only)
STEER_MULT = 7.0 --Steering multiplier angle (Arbitrary)
|
-- Player specific convenience variables
|
local MyPlayer = nil
local MyCharacter = nil
local MyHumanoid = nil
local MyTorso = nil
local MyMouse = nil
local RecoilAnim
local RecoilTrack = nil
local ReloadAnim
local ReloadTrack = nil
local IconURL = Tool.TextureId
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local FireSound
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
local flare = script.Parent:WaitForChild("Flare")
|
---It's a while wait() because of how badly it interacts with framerate changes
|
while wait(0.2) do
---Activating/Dezactivating the mobile controls
if script.Parent.Parent.Parent:FindFirstChild("TouchGui") then
script.Parent.Parent.Parent["TouchGui"].Enabled = false
script.Parent.Parent.MobileControls.Visible = true
script.Parent.Parent.PCHandbrake.Visible = false
else
script.Parent.Parent.MobileControls.Visible = false
script.Parent.Parent.PCHandbrake.Visible = true
end
if Humanoid.SeatPart ~= nil and Humanoid.SeatPart.Parent:FindFirstChild("Stats") then
local Cached_Magnitude = Char.Head.Velocity.magnitude
---Camera shake on collision
--if Old_Magnitude ~= nil then
-- print(Cached_Magnitude)
-- print(Old_Magnitude)
-- print(Cached_Magnitude - Old_Magnitude)
-- print("__")
--end
if Old_Magnitude ~= nil and Cached_Magnitude - Old_Magnitude < -70 then
--print("Collision")
--Sound
--game.SoundService.CrashSound:Play(0.1)
-- Explosion shake:
--camShake:Shake(CameraShaker.Presets.Explosion)
end
Old_Magnitude = Cached_Magnitude
end
end
|
--------------------[ GUI SETUP FUNCTION ]--------------------------------------------
|
function convertKey(Key)
if Key == string.char(8) then
return "BKSPCE"
elseif Key == string.char(9) then
return "TAB"
elseif Key == string.char(13) then
return "ENTER"
elseif Key == string.char(17) then
return "UP"
elseif Key == string.char(18) then
return "DOWN"
elseif Key == string.char(19) then
return "RIGHT"
elseif Key == string.char(20) then
return "LEFT"
elseif Key == string.char(22) then
return "HOME"
elseif Key == string.char(23) then
return "END"
elseif Key == string.char(27) then
return "F2"
elseif Key == string.char(29) then
return "F4"
elseif Key == string.char(30) then
return "F5"
elseif Key == string.char(32) or Key == " " then
return "F7"
elseif Key == string.char(33) or Key == "!" then
return "F8"
elseif Key == string.char(34) or Key == '"' then
return "F9"
elseif Key == string.char(35) or Key == "#" then
return "F10"
elseif Key == string.char(37) or Key == "%" then
return "F12"
elseif Key == string.char(47) or Key == "/" then
return "R-SHIFT"
elseif Key == string.char(48) or Key == "0" then
return "L-SHIFT"
elseif Key == string.char(49) or Key == "1" then
return "R-CTRL"
elseif Key == string.char(50) or Key == "2" then
return "L-CTRL"
elseif Key == string.char(51) or Key == "3" then
return "R-ALT"
elseif Key == string.char(52) or Key == "4" then
return "L-ALT"
else
return string.upper(Key)
end
end
function createControlFrame(Key, Desc, Num)
local C = Instance.new("Frame")
C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
C.BorderSizePixel = 0
C.Name = "C"..Num
C.Position = UDim2.new(0, 0, 0, Num * 20)
C.Size = UDim2.new(1, 0, 0, 20)
C.ZIndex = 10
local K = Instance.new("TextLabel")
K.BackgroundTransparency = 1
K.Name = "Key"
K.Size = UDim2.new(0, 45, 1, 0)
K.ZIndex = 10
K.Font = Enum.Font.ArialBold
K.FontSize = Enum.FontSize.Size14
K.Text = Key
K.TextColor3 = Color3.new(1, 1, 1)
K.TextScaled = (string.len(Key) > 5)
K.TextWrapped = (string.len(Key) > 5)
K.Parent = C
local D = Instance.new("TextLabel")
D.BackgroundTransparency = 1
D.Name = "Desc"
D.Position = UDim2.new(0, 50, 0, 0)
D.Size = UDim2.new(1, -50, 1, 0)
D.ZIndex = 10
D.Font = Enum.Font.SourceSansBold
D.FontSize = Enum.FontSize.Size14
D.Text = "- "..Desc
D.TextColor3 = Color3.new(1, 1, 1)
D.TextXAlignment = Enum.TextXAlignment.Left
D.Parent = C
C.Parent = Controls
end
function createModes()
numModes = 0
for i, v in pairs(S.selectFireSettings.Modes) do
if v then
numModes = numModes + 1
end
end
local currentMode = 0
for i, v in pairs(S.selectFireSettings.Modes) do
if v then
local Frame = Instance.new("Frame")
Frame.BackgroundTransparency = 1
Frame.Name = currentMode
Frame.Position = UDim2.new()
Frame.Size = UDim2.new()
Frame.Parent = fireModes
local modeLabel = Instance.new("TextLabel")
modeLabel.BackgroundTransparency = 1
modeLabel.Name = "Label"
modeLabel.Position = UDim2.new(0, -20, 0, 0)
modeLabel.Size = UDim2.new(0, 40, 0, 20)
modeLabel.Font = Enum.Font.SourceSansBold
modeLabel.FontSize = Enum.FontSize.Size18
modeLabel.Text = string.upper(i)
modeLabel.TextColor3 = Color3.new(1, 1, 1)
modeLabel.TextScaled = true
modeLabel.TextStrokeTransparency = 0
modeLabel.TextTransparency = 0.5
modeLabel.TextWrapped = true
modeLabel.Parent = Frame
table.insert(Modes, string.upper(i))
currentMode = currentMode + 1
end
end
guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
end
function setUpGUI()
local currentNum = 1
for _, v in pairs(Controls:GetChildren()) do
if v.Name ~= "Title" then
v:Destroy()
end
end
for _, PTable in pairs(Plugins.KeyDown) do
createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
currentNum = currentNum + 1
end
if S.canChangeStance then
local Dive = (S.dolphinDive and " / Dive" or "")
createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
currentNum = currentNum + 1
createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
currentNum = currentNum + 1
end
if S.selectFire then
createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
currentNum = currentNum + 1
end
createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
currentNum = currentNum + 1
createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
currentNum = currentNum + 1
if S.canADS then
local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
if S.Keys.ADS ~= "" then
createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
else
createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
end
currentNum = currentNum + 1
end
Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
if S.guiScope then
scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
end
if mainGUI:FindFirstChild("Co") then
mainGUI.Co:Destroy()
end
local Co = Instance.new("TextLabel")
Co.BackgroundTransparency = 1
Co.Name = "Co"
Co.Visible = true
Co.Position = UDim2.new(0, 0, 0, 0)
Co.Size = UDim2.new(1, 0, 0, 20)
Co.Font = Enum.Font.ArialBold
Co.FontSize = Enum.FontSize.Size14
Co.Text = ("~ soidutS s'tEhYuM morf srepoleved yb ekameR // tik nug noisuFobruT ~"):reverse()
Co.TextColor3 = Color3.new(1, 1, 1)
Co.TextStrokeColor3 = Color3.new(1, 1, 1)
Co.TextStrokeTransparency = 0.9
Co.TextTransparency = 0.9
Co.TextXAlignment = Enum.TextXAlignment.Center
Co.Parent = mainGUI
gunNameTitle.Text = Gun.Name
updateClipAmmo()
updateStoredAmmo()
fireModes:ClearAllChildren()
createModes()
updateModeLabels(numModes - 1, 0, 90)
if S.selectFire then
modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
else
modeGUI.Text = (
S.gunType.Semi and "SEMI" or
S.gunType.Auto and "AUTO" or
S.gunType.Burst and "BURST" or
"SAFETY"
)
end
end
|
-- wait for local player PlayerGui
|
local LocalPlayer = Players.LocalPlayer
local playerGui = LocalPlayer:WaitForChild("PlayerGui")
|
--Original script by Luckymaxer
|
Model = script.Parent
local SoundLoop
local Whinny
sound = false
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
Humanoid = Model:WaitForChild("Humanoid")
Humanoid.Health = Humanoid.MaxHealth
Seat = Model:WaitForChild("Seat")
Torso = Model:WaitForChild("Torso")
InteractiveControl = script:WaitForChild("InteractiveControl")
Animations = {
Walk = {Animation = script:WaitForChild("Walk"), FadeTime = nil, Weight = nil, Speed = 0.5},
Idle = {Animation = script:WaitForChild("Idle"), FadeTime = nil, Weight = nil, Speed = 1},
Ride = {Animation = script:WaitForChild("Ride"), FadeTime = 0.25, Weight = nil, Speed = nil},
Rear = {Animation = script:WaitForChild("Rearing"), FadeTime = 0.25, Weight = nil, Speed = 2},
Jump = {Animation = script:WaitForChild("Jump"), FadeTime = nil, Weight = nil, Speed = 1},
}
Walking = false
Rider = nil
AngularVelocity = (Torso:FindFirstChild("BodyAngularVelocity") or Instance.new("BodyAngularVelocity"))
AngularVelocity.Name = "BodyAngularVelocity"
AngularVelocity.P = 1250
AngularVelocity.AngularVelocity = Vector3.new(0, 0, 0)
AngularVelocity.maxTorque = Vector3.new(0, math.huge, 0)
AngularVelocity.Parent = Torso
Velocity = (Torso:FindFirstChild("BodyVelocity") or Instance.new("BodyVelocity"))
Velocity.Name = "BodyVelocity"
Velocity.maxForce = Vector3.new(math.huge, 0, math.huge)
Velocity.Parent = Torso
WalkTrack = Humanoid:LoadAnimation(Animations.Walk.Animation)
IdleTrack = Humanoid:LoadAnimation(Animations.Idle.Animation)
RearTrack = Humanoid:LoadAnimation(Animations.Rear.Animation)
JumpTrack = Humanoid:LoadAnimation(Animations.Jump.Animation)
Remotes = script:WaitForChild("Remotes")
Remotes:ClearAllChildren()
LastJump = 0
Disabled = false
ServerControl = (Remotes:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Remotes
ClientControl = (Remotes:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Remotes
function OnServerInvoke(player, Mode, Value)
if player ~= Rider or not Mode then
return
end
if Mode == "Jump" then
local Now = tick()
if (Now - LastJump) >= 1 then
LastJump = Now
Humanoid.Jump = true
local Animation = Animations.Jump
JumpTrack:Play(Animation.FadeTime, Animation.Weight, Animation.Speed)
end
elseif Mode == "Dismount" then
Dismount()
end
end
ServerControl.OnServerInvoke = OnServerInvoke
Humanoid.Changed:connect(function(Property)
if Property == "Sit" and Humanoid.Sit then
Humanoid.Sit = false
end
end)
Humanoid.Died:connect(function()
Disabled = true
Debris:AddItem(Model, 3)
Model:BreakJoints()
end)
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Rider, Mode, Value)
end)
return ClientReturn
end
function Audio(ID, Location, Looped, Volume, Duration)
local Sound = Instance.new("Sound", Location)
Sound.SoundId = "http://www.roblox.com/asset/?id=" .. ID
Sound.Volume = Volume
Sound.Looped = Looped
if Duration then
game:GetService("Debris"):AddItem(Sound, Duration)
end
return Sound -- use as Audio(134973578, FrontTorso, true, 2)
end
function Animate(Time)
if Humanoid.Health == 0 or Disabled then
return
end
--Walking
if not Walking and Torso.Velocity.magnitude > 1 then
IdleTrack:Stop()
local Animation = Animations.Walk
WalkTrack:Play(Animation.FadeTime, Animation.Weight, Animation.Speed)
Walking = true
end
if Walking and Torso.Velocity.magnitude < 1 then
WalkTrack:Stop()
local Animation = Animations.Idle
IdleTrack:Play(Animation.FadeTime, Animation.Weight, Animation.Speed)
Walking = false
end
--Motion
if Seat.Throttle ~= 10 then
Velocity.velocity = (Torso.CFrame.lookVector * Seat.Throttle * Humanoid.WalkSpeed*1)
AngularVelocity.AngularVelocity = Vector3.new(3, (2 * -Seat.Steer), 0)--steer speed
else
Velocity.velocity = Vector3.new(0,0, 0) --Erase for moonwalk
Whinny = Audio(178645076, Torso, false, 3)
if sound==false then
sound = true
local Animation = Animations.Rear
RearTrack:Play(Animation.FadeTime, Animation.Weight, Animation.Speed)
Whinny:Play()
Whinny.Volume = 10
Whinny.Pitch = 1
wait(2)
sound = false
end
end
--Sound
if not SoundLoop then
SoundLoop = Audio(134973578, Torso, true, 0)
elseif Torso.Velocity.magnitude > 1 then
if not SoundLoop.IsPlaying then
SoundLoop:Play()
end
SoundLoop.Volume = 10
SoundLoop.Pitch = ((1.2 - .55) * (Torso.Velocity.Magnitude / script.Parent.MaxSpeed.Value)) + .55
else
SoundLoop:Stop()
end
if JumpTrack.IsPlaying then
SoundLoop:Stop()
end
end
function Dismount()
if Rider and Rider.Parent then
local Character = Rider.Character
if Character then
local Humanoid = nil
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Humanoid") then
Humanoid = v
break
end
end
Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
Humanoid.Jump = true
end
end
end
function PlayerSeated(Child)
local function BreakWeld()
Debris:AddItem(Child, 0.5)
if Child and Child.Parent then
Child:Destroy()
end
end
if not Child:IsA("Weld") or not Child.Name == "SeatWeld" then
return
end
if Child.Part0 ~= Seat or not Child.Part1 or not Child.Part1.Parent then
return
end
Child.C1 = (Child.C1 * CFrame.new(0, 0.5, 0.375))
local character = Child.Part1.Parent
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
local Animation = Animations.Ride
RideTrack = humanoid:LoadAnimation(Animation.Animation)
RideTrack:Play(Animation.FadeTime, Animation.Weight, Animation.Speed)
end
local Player = Players:GetPlayerFromCharacter(character)
if not Player then
BreakWeld()
return
end
local PlayerGui = Player:FindFirstChild("PlayerGui")
if not PlayerGui then
BreakWeld()
return
end
InteractiveControlCopy = InteractiveControl:Clone()
local ServerCommunication = Instance.new("ObjectValue")
ServerCommunication.Name = "ServerControl"
ServerCommunication.Value = ServerControl
ServerCommunication.Parent = InteractiveControlCopy
InteractiveControlCopy.Disabled = false
InteractiveControlCopy.Parent = PlayerGui
Rider = Player
end
function PlayerDismounted(Child)
if not Child:IsA("Weld") or not Child.Name == "SeatWeld" then
return
end
if not Child.Part1 or not Child.Part1.Parent then
return
end
local Player = Players:GetPlayerFromCharacter(Child.Part1.Parent)
if not Player or Player ~= Rider then
return
end
if InteractiveControlCopy and InteractiveControlCopy.Parent then
InteractiveControlCopy:Destroy()
end
if RideTrack then
RideTrack:Stop()
end
Rider = nil
end
RunService.Heartbeat:connect(Animate)
Seat.ChildAdded:connect(PlayerSeated)
Seat.ChildRemoved:connect(PlayerDismounted)
|
--[[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
local fDistX=_Tune.FWsBoneLen*math.cos(math.rad(_Tune.FWsBoneAngle))
local fDistY=_Tune.FWsBoneLen*math.sin(math.rad(_Tune.FWsBoneAngle))
local rDistX=_Tune.RWsBoneLen*math.cos(math.rad(_Tune.RWsBoneAngle))
local rDistY=_Tune.RWsBoneLen*math.sin(math.rad(_Tune.RWsBoneAngle))
local fSLX=_Tune.FSusLength*math.cos(math.rad(_Tune.FSusAngle))
local fSLY=_Tune.FSusLength*math.sin(math.rad(_Tune.FSusAngle))
local rSLX=_Tune.RSusLength*math.cos(math.rad(_Tune.RSusAngle))
local rSLY=_Tune.RSusLength*math.sin(math.rad(_Tune.RSusAngle))
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,math.rad(-_Tune.FCaster),0) end
if v.Name=="FR" then v.CFrame = v.CFrame*CFrame.Angles(0,math.rad(_Tune.FCaster),0) end
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
|
-- Data Type Handling
|
local function ToString(value, type)
if type == "float" then
return tostring(Round(value,2))
elseif type == "Content" then
if string.find(value,"/asset") then
local match = string.find(value, "=") + 1
local id = string.sub(value, match)
return id
else
return tostring(value)
end
elseif type == "Vector2" then
local x = value.x
local y = value.y
return string.format("%g, %g", x,y)
elseif type == "Vector3" then
local x = value.x
local y = value.y
local z = value.z
return string.format("%g, %g, %g", x,y,z)
elseif type == "Color3" then
local r = value.r
local g = value.g
local b = value.b
return string.format("%d, %d, %d", r*255,g*255,b*255)
elseif type == "UDim2" then
local xScale = value.X.Scale
local xOffset = value.X.Offset
local yScale = value.Y.Scale
local yOffset = value.Y.Offset
return string.format("{%d, %d}, {%d, %d}", xScale, xOffset, yScale, yOffset)
else
return tostring(value)
end
end
local function ToValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2_new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3_new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3_new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2_new(xScale, xOffset, yScale, yOffset)
elseif type == "Content" then
if tonumber(value) ~= nil then
value = ContentUrl .. value
end
return value
elseif type == "float" or type == "int" or type == "double" then
return tonumber(value)
elseif type == "string" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
elseif type == "UserName" then
return Players:FindFirstChild(value)
else
return nil
end
end
|
--welds
|
RW, LW = Instance.new("Weld"), Instance.new("Weld")
|
--[=[
Returns the magnitude of the linear value.
@return number -- The magnitude of the linear value.
]=]
|
function LinearValue:GetMagnitude()
local dot = 0
for i=1, #self._values do
local value = self._values[i]
dot = dot + value*value
end
return math.sqrt(dot)
end
|
--[[Steering]]
|
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 45 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = 1000 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = 1000 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 1 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 20000 -- Steering Aggressiveness
|
-- functions
|
local function wait(t)
local start = tick()
repeat
RunService.Stepped:Wait()
until tick() - start >= t
end
local function Raycast(position, direction, ignore)
local ray = Ray.new(position, direction)
local success = false
local h, p, n, humanoid
table.insert(ignore, Workspace.Effects)
repeat
h, p, n = Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
if h then
humanoid = h.Parent:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Health <= 0 then
humanoid = nil
end
if humanoid then
success = true
else
if h.CanCollide and h.Transparency < 1 then
success = true
else
table.insert(ignore, h)
success = false
end
end
else
success = true
end
until success
return h, p, n, humanoid
end
|
-- Main Work --
|
myaccbtn.MouseButton1Click:Connect(function()
myaccpage:TweenPosition(openState, 'Out', 'Sine', '1')
deppage:TweenPosition(closeState, 'Out', 'Sine', '1')
wthpage:TweenPosition(closeState, 'Out', 'Sine', '1')
trnpage:TweenPosition(closeState, 'Out', 'Sine', '1')
cshpage:TweenPosition(closeState, 'Out', 'Sine', '1')
end)
depbtn.MouseButton1Click:Connect(function()
myaccpage:TweenPosition(closeState, 'Out', 'Sine', '1')
deppage:TweenPosition(openState, 'Out', 'Sine', '1')
wthpage:TweenPosition(closeState, 'Out', 'Sine', '1')
trnpage:TweenPosition(closeState, 'Out', 'Sine', '1')
cshpage:TweenPosition(closeState, 'Out', 'Sine', '1')
end)
wthbtn.MouseButton1Click:Connect(function()
myaccpage:TweenPosition(closeState, 'Out', 'Sine', '1')
deppage:TweenPosition(closeState, 'Out', 'Sine', '1')
wthpage:TweenPosition(openState, 'Out', 'Sine', '1')
trnpage:TweenPosition(closeState, 'Out', 'Sine', '1')
cshpage:TweenPosition(closeState, 'Out', 'Sine', '1')
end)
trnbtn.MouseButton1Click:Connect(function()
myaccpage:TweenPosition(closeState, 'Out', 'Sine', '1')
deppage:TweenPosition(closeState, 'Out', 'Sine', '1')
wthpage:TweenPosition(closeState, 'Out', 'Sine', '1')
trnpage:TweenPosition(openState, 'Out', 'Sine', '1')
cshpage:TweenPosition(closeState, 'Out', 'Sine', '1')
end)
cshbtn.MouseButton1Click:Connect(function()
myaccpage:TweenPosition(closeState, 'Out', 'Sine', '1')
deppage:TweenPosition(closeState, 'Out', 'Sine', '1')
wthpage:TweenPosition(closeState, 'Out', 'Sine', '1')
trnpage:TweenPosition(closeState, 'Out', 'Sine', '1')
cshpage:TweenPosition(openState, 'Out', 'Sine', '1')
end)
|
--------------------------------------------------------------------------
|
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .1 ,
FTargetFriction = .75 ,
FMinFriction = .1 ,
RWearSpeed = .1 ,
RTargetFriction = .75 ,
RMinFriction = .1 ,
--Tire Slip
TCSOffRatio = 1 ,
WheelLockRatio = 1/4 , --SS6 Default = 1/4
WheelspinRatio = 1/1.2 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 1 , --SS6 Default = 1
RFrictionWeight = 1 , --SS6 Default = 1
FLgcyFrWeight = 10 ,
RLgcyFrWeight = 10 ,
FElasticity = .5 , --SS6 Default = .5
RElasticity = .5 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 1 , --SS6 Default = 1
RElastWeight = 1 , --SS6 Default = 1
FLgcyElWeight = 10 ,
RLgcyElWeight = 10 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
--Brake.InputChanged:Connect(TouchBrake)
|
local function TouchHandbrake(input, GPE)
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
end
Handbrake.InputBegan:Connect(TouchHandbrake)
Handbrake.InputEnded:Connect(TouchHandbrake)
|
------------------------------------------------------------------------------
|
while true do
wait(3)
--UpdateEveryone() commented out by David. OtherStats isn't currently being used anywhere
end
|
-- Moves a tree node to a new parent. Called when an existing object's parent
-- changes.
|
local function moveObject(object,parent)
local objectNode = NodeLookup[object]
if not objectNode then
return
end
local parentNode = NodeLookup[parent]
if not parentNode then
return
end
local visible = nodeIsVisible(objectNode)
remove(objectNode.Parent,objectNode.Index)
objectNode.Parent = parentNode
objectNode.Depth = depth(object)
local function r(node,d)
for i = 1,#node do
node[i].Depth = d
r(node[i],d+1)
end
end
r(objectNode,objectNode.Depth+1)
insert(parentNode,#parentNode+1,objectNode)
if visible or nodeIsVisible(objectNode) then
updateList()
elseif nodeIsVisible(objectNode.Parent) then
updateScroll()
end
end
|
--// Animations
|
local L_171_
function IdleAnim(L_342_arg1)
L_24_.IdleAnim(L_3_, L_171_, {
L_45_,
L_46_,
L_47_
});
end;
function EquipAnim(L_343_arg1)
L_24_.EquipAnim(L_3_, L_171_, {
L_45_
});
end;
function UnequipAnim(L_344_arg1)
L_24_.UnequipAnim(L_3_, L_171_, {
L_45_
});
end;
function FireModeAnim(L_345_arg1)
L_24_.FireModeAnim(L_3_, L_171_, {
L_45_,
L_47_,
L_46_,
L_58_
});
end
function ReloadAnim(L_346_arg1)
L_24_.ReloadAnim(L_3_, L_171_, {
L_45_,
L_46_,
L_47_,
L_61_,
L_3_:WaitForChild('Left Arm'),
L_58_,
L_49_,
L_3_:WaitForChild('Right Arm'),
L_43_
});
end;
function BoltingBackAnim(L_347_arg1)
L_24_.BoltingBackAnim(L_3_, L_171_, {
L_49_
});
end
function BoltingForwardAnim(L_348_arg1)
L_24_.BoltingForwardAnim(L_3_, L_171_, {
L_49_
});
end
function BoltingForwardAnim(L_349_arg1)
L_24_.BoltingForwardAnim(L_3_, L_171_, {
L_49_
});
end
function BoltBackAnim(L_350_arg1)
L_24_.BoltBackAnim(L_3_, L_171_, {
L_49_,
L_47_,
L_46_,
L_45_,
L_62_
});
end
function BoltForwardAnim(L_351_arg1)
L_24_.BoltForwardAnim(L_3_, L_171_, {
L_49_,
L_47_,
L_46_,
L_45_,
L_62_
});
end
function InspectAnim(L_352_arg1)
L_24_.InspectAnim(L_3_, L_171_, {
L_47_,
L_46_
});
end
function nadeReload(L_353_arg1)
L_24_.nadeReload(L_3_, L_171_, {
L_46_,
L_47_
});
end
function AttachAnim(L_354_arg1)
L_24_.AttachAnim(L_3_, L_171_, {
L_46_,
L_47_
});
end
function PatrolAnim(L_355_arg1)
L_24_.PatrolAnim(L_3_, L_171_, {
L_46_,
L_47_
});
end
|
-- Decompiled with Visenya | https://targaryentech.com
|
local car = script.Parent.Car.Value
local cam = workspace.CurrentCamera
local RS = game:GetService("RunService")
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name == "SeatWeld" then
RS:UnbindFromRenderStep("MCam")
cam.CameraType = Enum.CameraType.Custom
end
end)
script.Parent.Values.MouseSteerOn.Changed:connect(function(property)
if script.Parent.Values.MouseSteerOn.Value then
RS:BindToRenderStep("MCam", Enum.RenderPriority.Camera.Value, function()
cam.CameraType = Enum.CameraType.Scriptable
local pspeed = math.min(1, car.DriveSeat.Velocity.Magnitude / 500)
local cc = car.DriveSeat.Position + Vector3.new(0, 8 + pspeed * 2, 0) - car.DriveSeat.CFrame.lookVector * 17 + car.DriveSeat.Velocity.Unit * -7 * pspeed
cam.CoordinateFrame = CFrame.new(cc, car.DriveSeat.Position)
end)
else
RS:UnbindFromRenderStep("MCam")
cam.CameraType = Enum.CameraType.Custom
end
end)
|
--[[
Adds a Spring to be updated every render step.
]]
|
function SpringScheduler.add(spring: Spring)
local damping = spring._damping
local speed = spring._speed
local dampingBucket = springBuckets[damping]
if dampingBucket == nil then
springBuckets[damping] = {
[speed] = setmetatable({[spring] = true}, WEAK_KEYS_METATABLE)
}
return
end
local speedBucket = dampingBucket[speed]
if speedBucket == nil then
dampingBucket[speed] = setmetatable({[spring] = true}, WEAK_KEYS_METATABLE)
return
end
speedBucket[spring] = true
end
|
--[[
automatically assings an ID for the user
--]]
|
game.Players.PlayerAdded:Connect(function(plr)
Network:assign_id(plr)
end)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__Character__1 = game.Players.LocalPlayer.Character;
local l__Humanoid__2 = l__Character__1:WaitForChild("Humanoid");
local l__StarterGui__3 = game:GetService("StarterGui");
local l__HumanoidRootPart__4 = l__Character__1:WaitForChild("HumanoidRootPart");
l__StarterGui__3:SetCore("ResetButtonCallback", true);
l__HumanoidRootPart__4:GetPropertyChangedSignal("Anchored"):Connect(function()
print("god");
if l__HumanoidRootPart__4.Anchored == true then
print("lol");
l__StarterGui__3:SetCore("ResetButtonCallback", false);
return;
end;
if l__HumanoidRootPart__4.Anchored == false then
l__StarterGui__3:SetCore("ResetButtonCallback", true);
end;
end);
|
--If not admin, delete admin panel
|
if not table.find(admins, plrId) then
panel:Destroy()
|
--[[
= DigitalSwirl =
Source: CommonModules/Switch.lua
Purpose: Switch case implementation
Author(s): Regan "CD/TheGreenDeveloper" Green
--]]
|
return function(v, a, cases)
if cases[v] ~= nil then
return cases[v](unpack(a))
end
end
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l31.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(21)
|
--[[Remotes.Main1.OnServerEvent:Connect(function(plr,firingtype)
end)]]
| |
--- Creates a listable type from a singlular type
|
function Util.MakeListableType(type, override)
local listableType = {
Listable = true,
Transform = type.Transform,
Validate = type.Validate,
ValidateOnce = type.ValidateOnce,
Autocomplete = type.Autocomplete,
Default = type.Default,
Parse = function(...)
return {type.Parse(...)}
end
}
if override then
for key, value in pairs(override) do
listableType[key] = value
end
end
return listableType
end
local function encodeCommandEscape(text)
return (text:gsub("\\%$", "___!CMDR_DOLLAR!___"))
end
local function decodeCommandEscape(text)
return (text:gsub("___!CMDR_DOLLAR!___", "$"))
end
function Util.RunCommandString(dispatcher, commandString)
commandString = Util.ParseEscapeSequences(commandString)
commandString = Util.EncodeEscapedOperators(commandString)
local commands = commandString:split("&&")
local output = ""
for i, command in ipairs(commands) do
local outputEncoded = output:gsub("%$", "\\x24"):gsub("%%","%%%%")
command = command:gsub("||", output:find("%s") and ("%q"):format(outputEncoded) or outputEncoded)
output = tostring(
dispatcher:EvaluateAndRun(
(
Util.RunEmbeddedCommands(dispatcher, command)
)
)
)
if i == #commands then
return output
end
end
end
|
--// Holstering
|
HolsteringEnabled = false;
HolsterPos = CFrame.new(0.340751064, 0.1, 0.616261482, -4.10752676e-08, -0.342020065, 0.939692616, -1.49501727e-08, 0.939692557, 0.342020094, -0.99999994, 0, -4.37113847e-08);
|
--local url = "https://40-percent-updates.smktd.repl.co/get_updates"
--local current_version = script.Parent.Connector:InvokeServer(url)
--local main = script.Parent.Parent.Parent
--local version = main.Properties.Version
--local update_notifier = main.Popups.UpdateNotifier
| |
-- ROBLOX Services
|
local Players = game.Players
local Debris = game.Debris
|
--Controls
|
Tune.Peripherals = {
MSteerWidth = 67 , -- 0 - 100% of screen width
MSteerDZone = 20 , -- 0 - 100%
ControlLDZone = 5 , -- 0 - 100%
ControlRDZone = 5 , -- 0 - 100%
}
Tune.Controls = {
ToggleTCS = Enum.KeyCode.T ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
PBrake = Enum.KeyCode.P ,
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
}
return Tune
|
-- -- -- -- -- -- --
--DIRECTION SCROLL--
-- -- -- -- -- -- --
|
while true do
wait()
if Elevator:WaitForChild("Direction").Value ~= 0 then
for S=0,7 do
wait(0.4)
if Elevator:WaitForChild("Direction").Value == 0 then break end
SetDisplay(1,(Elevator:WaitForChild("Direction").Value == 1 and "U" or "D")..S)
end
else
SetDisplay(1,"NIL")
end
end
|
--------STAGE LIGHTS--------
|
game.Workspace.sb1.BrickColor = BrickColor.new(194)
game.Workspace.sb2.BrickColor = BrickColor.new(194)
game.Workspace.sb3.BrickColor = BrickColor.new(194)
game.Workspace.sb4.BrickColor = BrickColor.new(194)
game.Workspace.sb5.BrickColor = BrickColor.new(194)
game.Workspace.sb6.BrickColor = BrickColor.new(194)
game.Workspace.post1.Light.BrickColor = BrickColor.new(194)
game.Workspace.post2.Light.BrickColor = BrickColor.new(194)
game.Workspace.post3.Light.BrickColor = BrickColor.new(194)
game.Workspace.post4.Light.BrickColor = BrickColor.new(194)
|
-- Other
|
local CurrentOccupant = nil
local Vector3New,CFrameNew,CFrameAngles,MathRad,MathAbs = Vector3.new,CFrame.new,CFrame.Angles,math.rad,math.abs
|
-- [[ 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 = self.GamepadPanningCamera or 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
if self.turningLeft then
if delayExpired or not self.vrRotateKeyCooldown[Enum.KeyCode.Left] then
vrRotateSum = vrRotateSum - self:GetRotateAmountValue(vrRotationIntensity)
self.vrRotateKeyCooldown[Enum.KeyCode.Left] = true
end
else
self.vrRotateKeyCooldown[Enum.KeyCode.Left] = nil
end
if self.turningRight then
if (delayExpired or not self.vrRotateKeyCooldown[Enum.KeyCode.Right]) then
vrRotateSum = vrRotateSum + self:GetRotateAmountValue(vrRotationIntensity)
self.vrRotateKeyCooldown[Enum.KeyCode.Right] = true
end
else
self.vrRotateKeyCooldown[Enum.KeyCode.Right] = nil
end
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
|
-- Create a loop that updates the timer
|
while true do
wait(1)
updateTimerLabel()
end
|
-- Disable the backpack
|
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
|
--[[Weight and CG]]
|
Tune.Weight = 1800 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 8.2 ,
--[[Height]] 3.6 ,
--[[Length]] 50 }
Tune.WeightDist = 0 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = 0.2 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- Decompiled with the Synapse X Luau decompiler.
|
return {
Name = "resolve",
Aliases = {},
Description = "Resolves Argument Value Operators into lists. E.g., resolve players * gives you a list of all players.",
Group = "DefaultUtil",
AutoExec = { "alias \"me|Displays your username\" resolve players ." },
Args = { {
Type = "type",
Name = "Type",
Description = "The type for which to resolve"
}, function(p1)
if p1:GetArgument(1):Validate() == false then
return;
end;
return {
Type = p1:GetArgument(1):GetValue(),
Name = "Argument Value Operator",
Description = "The value operator to resolve. One of: * ** . ? ?N",
Optional = true
};
end },
Run = function(p2)
return table.concat(p2:GetArgument(2).RawSegments, ",");
end
};
|
--[[Steering]]
|
Tune.SteeringType = 'New' -- New = Precise steering calculations based on real life steering assembly (LuaInt)
-- Old = Previous steering calculations
-- New Options
Tune.SteerRatio = 15/1 -- Steering ratio of your steering rack, google it for your car
Tune.LockToLock = 2.6 -- Number of turns of the steering wheel lock to lock, google it for your car
Tune.Ackerman = .9 -- If you don't know what it is don't touch it, ranges from .7 to 1.2
-- Old Options
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 38 -- Outer wheel steering angle (in degrees)
-- General Steering
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
-- Steer Gyro Tuning, avoid changing these
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
--Four Wheel Steering (LuaInt)
Tune.FWSteer = 'None' -- Static, Speed, Both, or None
Tune.RSteerOuter = 10 -- Outer rear wheel steering angle (in degrees)
Tune.RSteerInner = 10 -- Inner rear wheel steering angle (in degrees)
Tune.RSteerSpeed = 60 -- Speed at which 4WS fully activates (Speed), deactivates (Static), or transition begins (Both) (SPS)
Tune.RSteerDecay = 330 -- Speed of gradient cutoff (in SPS)
-- Rear Steer Gyro Tuning, avoid changing these
Tune.RSteerD = 1000 -- Steering Dampening
Tune.RSteerMaxTorque = 50000 -- Steering Force
Tune.RSteerP = 100000 -- Steering Aggressiveness
|
-- R6 only!
|
repeat game:GetService("RunService").Stepped:Wait() until game.Players.LocalPlayer
local player = script.Parent.Parent
local mouse = player:GetMouse()
local selecting = false
local valve
local enabled = false
mouse.Button1Up:Connect(function()
if selecting == true then
valve = mouse.Target
if valve.Name == 'paper' then
if enabled == false then
script.Parent.Image.image.ImageLabel.Image = valve.Decal.Texture
enabled = true
elseif enabled == true then
enabled = false
end
script.Parent.Image.Enabled = enabled
end
end
end)
mouse.Button1Up:Connect(function()
if enabled == true then
enabled = false
script.Parent.Image.Enabled = enabled
end
end)
while wait() do
if mouse.Target then
if mouse.Target.Name == 'paper' then
if not mouse.Target:FindFirstChild('selection') and script.Parent.IsUsingValve.Value == false then
box = script.Parent.ValveUI.selection:clone()
box.Parent = mouse.Target
selecting = true
box.Adornee = mouse.Target
end
else
selecting = false
if box then
box:Destroy()
end
end
end
end
|
--- Constructs a new signal.
-- @constructor Signal.new()
-- @treturn Signal
|
function Signal.new()
local self = setmetatable({}, Signal)
self._bindableEvent = Instance.new("BindableEvent")
self._argData = nil
self._argCount = nil -- Prevent edge case of :Fire("A", nil) --> "A" instead of "A", nil
return self
end
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 100 -- TODO track for dissertation
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
ClassInformationTable:GetClassFolder(player,"Mage").Fireball.Value = true
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
return function(p1)
local l__PlayerGui__1 = service.PlayerGui;
client.Variables.PlayerListEnabled = false;
service.StarterGui:SetCoreGuiEnabled("PlayerList", false);
local l__Parent__2 = script.Parent.Parent;
local l__Drag__3 = l__Parent__2.Drag;
local l__Frame__4 = l__Parent__2.Drag.Frame;
gTable:Ready();
local l__mouse__5 = service.Players.LocalPlayer:GetMouse();
local l__X__6 = l__Drag__3.AbsoluteSize.X;
local l__Y__7 = l__Frame__4.AbsoluteSize.Y;
local l__LocalPlayer__1 = service.Players.LocalPlayer;
local u2 = false;
local u3 = l__X__6;
local u4 = l__X__6;
local l__List__5 = l__Parent__2.Drag.Frame.List;
local l__FakeDragger__6 = l__Parent__2.Drag.Frame.FakeDragger;
local function v8()
l__Frame__4.BackgroundTransparency = 0.7;
l__List__5.BackgroundTransparency = 1;
l__FakeDragger__6.Visible = false;
end;
local function u7()
local l__leaderstats__9 = l__LocalPlayer__1:FindFirstChild("leaderstats");
if l__leaderstats__9 and not u2 then
u3 = (#l__leaderstats__9:GetChildren() - 1) * 70 + 210;
u4 = u3;
l__Drag__3.Size = UDim2.new(0, u3, 0, 30);
l__Drag__3.Position = UDim2.new(1, -u3, 0, 0);
end;
if l__leaderstats__9 then
return true;
end;
return false;
end;
local u8 = nil;
local l__Entry__9 = l__Parent__2.Entry;
local u10 = {
["1237666"] = 355277187,
["39958537"] = 116524268,
["66136675"] = 355858707,
["102761590"] = 355858707,
["6087802"] = 355858707,
["33869774"] = 355858707,
["60557514"] = 355858707,
["28606349"] = 99727663,
["64362264"] = 48094325,
["39259729"] = 356709818,
["68591528"] = 397876352
};
local u11 = l__Y__7;
local u12 = l__Y__7;
local function v10()
l__List__5:ClearAllChildren();
u7();
local v11 = {
Neutral = {
Color = BrickColor.White(),
Players = {},
Stats = {},
StatNames = {}
}
};
local v12 = 0;
local v13 = 0;
local v14 = {};
local v15 = {};
for v16, v17 in pairs(service.Teams:GetChildren()) do
v11[v17.Name] = {
Color = v17.TeamColor,
Players = {},
Stats = {},
StatNames = {}
};
end;
local v18, v19, v20 = pairs(service.Players:GetPlayers());
while true do
local v21, v22 = v18(v19, v20);
if not v21 then
break;
end;
local v23 = false;
local v24 = nil;
if not v22.Neutral then
for v25, v26 in pairs(v11) do
if v26.Color == v22.TeamColor then
v23 = true;
v24 = v26;
table.insert(v26.Players, v22);
end;
end;
end;
if not v23 then
v24 = v11.Neutral;
table.insert(v11.Neutral.Players, v22);
end;
local l__leaderstats__27 = v22:FindFirstChild("leaderstats");
if l__leaderstats__27 then
local v28, v29, v30 = pairs(l__leaderstats__27:GetChildren());
while true do
local v31, v32 = v28(v29, v30);
if not v31 then
break;
end;
if v24.Stats[v32.Name] and tonumber(v24.Stats[v32.Name]) and v32:IsA("IntValue") and tonumber(v32.Value) then
v24.Stats[v32.Name] = v24.Stats[v32.Name] + tonumber(v32.Value);
elseif not v24.Stats[v32.Name] and v32:IsA("IntValue") then
table.insert(v24.Stats, v32.Value);
v24.Stats[v32.Name] = v32.Value;
else
v24.Stats[v32.Name] = "";
end;
table.insert(v24.StatNames, v32.Name);
if not v15[v32.Name] then
table.insert(v14, v32.Name);
v15[v32.Name] = true;
end;
end;
end;
v12 = v12 + 1;
end;
if u8 then
u8:Destroy();
end;
u8 = l__Entry__9:Clone();
u8.Visible = true;
u8.Position = UDim2.new(0, 0, 0, 0);
local l__Nameb__33 = u8:FindFirstChild("Nameb");
if l__Nameb__33 then
l__Nameb__33.Text = l__LocalPlayer__1.Name;
end;
local l__ImageLabel__34 = u8:FindFirstChild("ImageLabel");
if l__ImageLabel__34 then
l__ImageLabel__34.Visible = false;
end;
local l__Stats__35 = u8:FindFirstChild("Stats");
if l__Stats__35 then
l__Stats__35.Visible = true;
local l__Stat__36 = u8.Stat;
for v37, v38 in pairs(v14) do
local v39 = l__Stat__36:Clone();
v39.Visible = true;
v39.Parent = l__Stats__35;
v39.Text = v38;
v39.Position = UDim2.new(0, (v37 - 1) * 70, 0, 0);
end;
end;
u8.Parent = l__Drag__3;
if #v11.Neutral.Players == 0 then
v11.Neutral = nil;
end;
local v40, v41, v42 = pairs(v11);
while true do
local v43, v44 = v40(v41, v42);
if not v43 then
break;
end;
if #v11 > 1 then
local v45 = l__Entry__9:Clone();
v45.Visible = true;
v45.Position = UDim2.new(0, 0, 0, v13 * 25);
v45.Nameb.Text = v43;
v45.BackgroundTransparency = 0.5;
v45.BackgroundColor3 = v44.Color.Color;
v45.ImageLabel.Visible = false;
v45.Parent = l__List__5;
if string.len(v43) > 15 then
v45.Nameb.TextScaled = true;
end;
if #v44.StatNames > 0 then
v45.Stats.Visible = true;
v45.Stats.Size = UDim2.new(0, 70 * (#v44.Stats - 1), 1, 0);
local l__Stat__46 = v45.Stat;
for v47, v48 in pairs(v44.StatNames) do
local v49 = l__Stat__46:Clone();
v49.Parent = v45.Stats;
v49.Visible = true;
local v50 = v44.Stats[v48];
if v50 and type(v50) == "number" then
v49.Text = v50;
else
v49.Text = "";
end;
v49.Position = UDim2.new(0, (#v45.Stats:GetChildren() - 1) * 70, 0, 0);
end;
else
v45.Stats.Visible = false;
end;
v13 = v13 + 1;
end;
local v51, v52, v53 = pairs(v44.Players);
while true do
local v54, v55 = v51(v52, v53);
if not v54 then
break;
end;
local v56 = l__Entry__9:Clone();
v56.Visible = true;
v56.Position = UDim2.new(0, 0, 0, v13 * 25);
local l__ImageLabel__57 = v56:FindFirstChild("ImageLabel");
local l__Stats__58 = v56:FindFirstChild("Stats");
local l__Nameb__59 = v56:FindFirstChild("Nameb");
local l__Stat__60 = v56:FindFirstChild("Stat");
if l__Nameb__59 then
l__Nameb__59.Text = v55.Name;
end;
v56.Parent = l__List__5;
if string.len(v55.Name) > 15 then
l__Nameb__59.TextScaled = true;
end;
local v61 = u10[tostring(v55.UserId)];
if l__ImageLabel__57 then
if v61 then
l__ImageLabel__57.Image = "http://www.roblox.com/asset/?id=" .. v61;
l__ImageLabel__57.Visible = true;
elseif v55.UserId == game.CreatorId then
l__ImageLabel__57.Image = "rbxasset://textures/ui/icon_placeowner.png";
l__ImageLabel__57.Visible = true;
elseif v55:IsInGroup(1200769) then
l__ImageLabel__57.Image = "http://www.roblox.com/asset/?id=99727663";
l__ImageLabel__57.Visible = true;
elseif l__LocalPlayer__1:IsFriendsWith(v55.UserId) and v55 ~= l__LocalPlayer__1 then
l__ImageLabel__57.Image = "http://www.roblox.com/asset/?id=99749771";
l__ImageLabel__57.Visible = true;
elseif v55.MembershipType == Enum.MembershipType.BuildersClub then
l__ImageLabel__57.Image = "rbxasset://textures/ui/TinyBcIcon.png";
l__ImageLabel__57.Visible = true;
elseif v55.MembershipType == Enum.MembershipType.TurboBuildersClub then
l__ImageLabel__57.Image = "rbxasset://textures/ui/TinyTbcIcon.png";
l__ImageLabel__57.Visible = true;
elseif v55.MembershipType == Enum.MembershipType.OutrageousBuildersClub then
l__ImageLabel__57.Image = "rbxasset://textures/ui/TinyObcIcon.png";
l__ImageLabel__57.Visible = true;
else
l__ImageLabel__57.Visible = false;
end;
end;
local l__leaderstats__62 = v55:FindFirstChild("leaderstats");
if l__leaderstats__62 and l__Stats__58 and l__Stat__60 then
l__Stats__58.Visible = true;
for v63, v64 in pairs((l__leaderstats__62:GetChildren())) do
local v65 = l__Stat__60:Clone();
v65.Visible = true;
v65.Parent = l__Stats__58;
v65.Text = v64.Value;
v65.Position = UDim2.new(0, (#l__Stats__58:GetChildren() - 1) * 70, 0, 0);
end;
elseif l__Stats__58 then
l__Stats__58.Visible = false;
end;
v13 = v13 + 1;
end;
end;
if not u2 then
local v66 = v13;
if v66 > 10 then
v66 = 10;
end;
local v67 = v66 * 25 + 30;
u11 = v67;
u12 = v67;
l__Frame__4.Size = UDim2.new(0, u3, 0, v67);
end;
l__List__5.CanvasSize = UDim2.new(0, 0, 0, v13 * 20);
end;
l__Drag__3.Position = UDim2.new(1, -u3, 0, 0);
v8();
local function u13()
l__Frame__4.BackgroundTransparency = 0;
l__List__5.BackgroundTransparency = 0;
l__FakeDragger__6.Visible = true;
end;
l__Frame__4.MouseEnter:Connect(function()
u13();
end);
l__Frame__4.MouseLeave:Connect(function()
v8();
end);
service.UserInputService.InputBegan:Connect(function(p2)
if not service.UserInputService:GetFocusedTextBox() and p2.UserInputType == Enum.UserInputType.Keyboard and p2.KeyCode == Enum.KeyCode.Tab then
if l__Drag__3.Visible then
l__Drag__3.Visible = false;
return;
end;
l__Drag__3.Visible = true;
end;
end);
local u14 = false;
local u15 = nil;
local u16 = l__Drag__3.Position.X.Offset;
local l__Dragger__17 = l__Parent__2.Drag.Frame.Dragger;
l__mouse__5.Move:Connect(function(p3, p4)
if u14 then
u15 = u16 + l__Dragger__17.Position.X.Offset;
u3 = u4 - l__Dragger__17.Position.X.Offset;
u11 = u12 + (l__Dragger__17.Position.Y.Offset + 20);
if u3 < 100 then
u3 = 100;
end;
if u11 < 50 then
u11 = 50;
end;
l__Frame__4.Size = UDim2.new(1, 0, 0, u11);
l__Drag__3.Size = UDim2.new(0, u3, 0, 30);
if u3 > 100 then
l__Drag__3.Position = UDim2.new(l__Drag__3.Position.X.Scale, u15, l__Drag__3.Position.Y.Scale, l__Drag__3.Position.Y.Offset);
end;
end;
end);
l__Dragger__17.DragBegin:Connect(function(p5)
u16 = l__Drag__3.Position.X.Offset;
u14 = true;
u2 = true;
end);
l__Dragger__17.DragStopped:Connect(function(p6, p7)
u14 = false;
u3 = l__Drag__3.AbsoluteSize.X;
u11 = l__Frame__4.AbsoluteSize.Y;
u15 = nil;
u4 = u3;
u12 = u11;
u16 = l__Drag__3.Position.X.Offset;
l__Dragger__17.Position = UDim2.new(0, 0, 1, -20);
end);
while wait(0.5) do
v10();
end;
end;
|
--[[
Implementation
]]
|
local function isAlive()
return maid.humanoid.Health > 0 and maid.humanoid:GetState() ~= Enum.HumanoidStateType.Dead
end
local function destroy()
maid:destroy()
end
local function patrol()
while isAlive() do
if not attacking then
local position = getRandomPointInCircle(startPosition, PATROL_RADIUS)
maid.humanoid.WalkSpeed = PATROL_WALKSPEED
maid.humanoid:MoveTo(position)
end
wait(random:NextInteger(MIN_REPOSITION_TIME, MAX_REPOSITION_TIME))
end
end
local function isInstaceAttackable(targetInstance)
local isAttackable = false
local targetHumanoid = targetInstance and targetInstance.Parent and targetInstance.Parent:FindFirstChild("Humanoid")
if not targetHumanoid then
return false
end
-- Determine if they are attackable, depening on the attack mode
local isEnemy = false
if ATTACK_MODE == 1 then
-- Attack characters with the SoldierEnemy tag
if
CollectionService:HasTag(targetInstance.Parent, "SoldierEnemy") and
not CollectionService:HasTag(targetInstance.Parent, "SoldierFriend") then
isEnemy = true
end
elseif ATTACK_MODE == 2 then
-- Attack all humanoids without the SoldierFriend tag
if not CollectionService:HasTag(targetInstance.Parent, "SoldierFriend") then
isEnemy = true
end
elseif ATTACK_MODE == 3 then
-- Attack all humanoids
isEnemy = true
end
if isEnemy then
local distance = (maid.humanoidRootPart.Position - targetInstance.Position).Magnitude
if distance <= ATTACK_RADIUS then
local ray = Ray.new(
maid.humanoidRootPart.Position,
(targetInstance.Parent.HumanoidRootPart.Position - maid.humanoidRootPart.Position).Unit * distance
)
local part = Workspace:FindPartOnRayWithIgnoreList(ray, {
targetInstance.Parent, maid.instance,
}, false, true)
if
targetInstance ~= maid.instance and
targetInstance:IsDescendantOf(Workspace) and
targetHumanoid.Health > 0 and
targetHumanoid:GetState() ~= Enum.HumanoidStateType.Dead and
not part
then
isAttackable = true
end
end
end
return isAttackable
end
local function fireGun()
-- Do damage to the target
local targetHunanoid = target.Parent:FindFirstChild("Humanoid")
targetHunanoid:TakeDamage(ATTACK_DAMAGE)
-- Play the firing animation
maid.attackAnimation:Play()
-- Play the firing sound effect
maid.gunFireSound:Play()
-- Muzzle flash
local firingPositionAttachment = maid.instance.Weapon.Handle.FiringPositionAttachment
firingPositionAttachment.FireEffect:Emit(10)
firingPositionAttachment.PointLight.Enabled = true
wait(0)
firingPositionAttachment.PointLight.Enabled = false
end
local function findTargets()
-- Do a new search region if we are not already searching through an existing search region
if not searchingForTargets and tick() - timeSearchEnded >= SEARCH_DELAY then
searchingForTargets = true
-- Create a new region
local centerPosition = maid.humanoidRootPart.Position
local topCornerPosition = centerPosition + Vector3.new(ATTACK_RADIUS, ATTACK_RADIUS, ATTACK_RADIUS)
local bottomCornerPosition = centerPosition + Vector3.new(-ATTACK_RADIUS, -ATTACK_RADIUS, -ATTACK_RADIUS)
searchRegion = Region3.new(bottomCornerPosition, topCornerPosition)
searchParts = Workspace:FindPartsInRegion3(searchRegion, maid.instance, math.huge)
newTarget = nil
newTargetDistance = nil
-- Reset to defaults
searchIndex = 1
end
if searchingForTargets then
-- Search through our list of parts and find attackable humanoids
local checkedParts = 0
while searchingForTargets and searchIndex <= #searchParts and checkedParts < MAX_PARTS_PER_HEARTBEAT do
local currentPart = searchParts[searchIndex]
if currentPart and isInstaceAttackable(currentPart) then
local character = currentPart.Parent
local distance = (character.HumanoidRootPart.Position - maid.humanoidRootPart.Position).magnitude
-- Determine if the charater is the closest
if not newTargetDistance or distance < newTargetDistance then
newTarget = character.HumanoidRootPart
newTargetDistance = distance
end
end
searchIndex = searchIndex + 1
checkedParts = checkedParts + 1
end
if searchIndex >= #searchParts then
target = newTarget
searchingForTargets = false
timeSearchEnded = tick()
end
end
end
local function attack()
attacking = true
local originalWalkSpeed = maid.humanoid.WalkSpeed
maid.humanoid.WalkSpeed = 18
maid.attackIdleAnimation:Play()
local shotsFired = 0
while attacking and isInstaceAttackable(target) and isAlive() do
fireGun()
shotsFired = (shotsFired + 1) % CLIP_CAPACITY
if shotsFired == CLIP_CAPACITY - 1 then
wait(RELOAD_DELAY)
else
wait()
end
end
maid.humanoid.WalkSpeed = originalWalkSpeed
maid.attackIdleAnimation:Stop()
attacking = false
end
|
--[[
o2.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Dor = Human.Parent.Saude.Variaveis.Dor
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.o2
if Human.Parent.Saude.Stances.o2.Value == false then
if enabled.Value == false and Sangrando.Value == false and Bandagens.Value > 0 then
enabled.Value = true
wait(.3)
Human.Parent.Saude.Stances.o2.Value = true
Bandagens.Value = Bandagens.Value - 1
Human.Health = Human.Health + 50
wait(2)
enabled.Value = false
end
else
if enabled.Value == false then
enabled.Value = true
wait(.3)
Human.Parent.Saude.Stances.o2.Value = false
Bandagens.Value = Bandagens.Value + 1
wait(2)
enabled.Value = false
end
end
end)
]]--
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
|
Compress_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local isdead = Human.Parent.Saude.Stances.rodeath
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local cpr = PlHuman.Parent.Saude.Stances.cpr
local isdead = PlHuman.Parent.Saude.Stances.rodeath
if enabled.Value == false then
if isdead.Value == true and (Sangrando.Value == false or Human.Parent.Saude.Stances.Tourniquet.Value == true) then
enabled.Value = true
PlHuman.Health = PlHuman.Health + 5
wait(0.5)
enabled.Value = false
end
end
end
end)
Bandage_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Bandagem
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if enabled.Value == false then
if Item.Value >= 1 and Sangrando.Value == true then
enabled.Value = true
wait(.3)
local number = math.random(1, 2)
if number == 1 then
Sangrando.Value = false
end
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
scalpel_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.scalpel
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local cutopen = PlHuman.Parent.Saude.Stances.cutopen
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local o2 = PlHuman.Parent.Saude.Stances.o2
local caido = PlHuman.Parent.Saude.Stances.Caido
if enabled.Value == false and cutopen.Value == false and caido.Value == true and o2.Value == true then
if Item.Value >= 1 then
enabled.Value = true
wait(.3)
cutopen.Value = true
wait(2)
enabled.Value = false
end
end
end
end)
suction_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.suction
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local npa = PlHuman.Parent.Saude.Stances.npa
local etube = PlHuman.Parent.Saude.Stances.etube
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.cutopen.Value == true and PlHuman.Parent.Saude.Stances.o2.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
if enabled.Value == false then
if Item.Value > 0 then
--if Item.Value > 0 then
enabled.Value = true
wait(.1)
PlHuman.Parent.Saude.Stances.suction.Value = true
wait(3.5)
PlHuman.Parent.Saude.Stances.suction.Value = false
wait(0.1)
enabled.Value = false
end
end
end
end
end)
clamp_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.clamp
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local npa = PlHuman.Parent.Saude.Stances.npa
local etube = PlHuman.Parent.Saude.Stances.etube
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.cutopen.Value == true and PlHuman.Parent.Saude.Stances.o2.Value == true and PlHuman.Parent.Saude.Stances.suction.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
if enabled.Value == false then
if Item.Value > 0 then
--if Item.Value > 0 then
enabled.Value = true
wait(.1)
PlHuman.Parent.Saude.Stances.clamped.Value = true
wait(5.5)
PlHuman.Parent.Saude.Stances.clamped.Value = false
wait(0.1)
enabled.Value = false
end
end
end
end
end)
catheter_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.catheter
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local balloonbleed = PlHuman.Parent.Saude.Stances.balloonbleed
local balloon = PlHuman.Parent.Saude.Stances.balloon
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local cutopen = PlHuman.Parent.Saude.Stances.cutopen
local suction = PlHuman.Parent.Saude.Stances.suction
if PlHuman.Parent.Saude.Stances.catheter.Value == false and PlHuman.Parent.Saude.Stances.o2.Value == true and cutopen.Value == true and suction.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
if enabled.Value == false then
if Item.Value > 0 and (Sangrando.Value == true or bbleeding.Value == true) then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.catheter.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.balloon.Value == false then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.catheter.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
balloon_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.catheter
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local balloonbleed = PlHuman.Parent.Saude.Stances.balloonbleed
local repaired = PlHuman.Parent.Saude.Stances.repaired
local catheter = PlHuman.Parent.Saude.Stances.catheter
local o2l = PlHuman.Parent.Saude.Stances.o2
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.balloon.Value == false then
if enabled.Value == false then
if Item.Value > 0 and (Sangrando.Value == true or bbleeding.Value == true) and o2l.Value == true and catheter.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.balloon.Value = true
Sangrando.Value = false
bbleeding.Value = false
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.balloon.Value == true and repaired.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.balloon.Value = false
wait(2)
enabled.Value = false
end
end
end
end
end)
prolene_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.prolene
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local o2l = PlHuman.Parent.Saude.Stances.o2
local balloonbleed = PlHuman.Parent.Saude.Stances.balloonbleed
local repaired = PlHuman.Parent.Saude.Stances.repaired
local balloon = PlHuman.Parent.Saude.Stances.balloon
if enabled.Value == false then
if Item.Value > 0 and o2l.Value == true and balloon.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
enabled.Value = true
wait(2)
Sangrando.Value = false
bbleeding.Value = false
balloonbleed.Value = false
repaired.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
prolene5_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.prolene5
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local o2l = PlHuman.Parent.Saude.Stances.o2
local balloonbleed = PlHuman.Parent.Saude.Stances.balloonbleed
local repaired = PlHuman.Parent.Saude.Stances.repaired
local balloon = PlHuman.Parent.Saude.Stances.balloon
local clamped = PlHuman.Parent.Saude.Stances.clamped
local surg2 = PlHuman.Parent.Saude.Stances.surg2
if enabled.Value == false then
if Item.Value > 0 and o2l.Value == true and clamped.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
enabled.Value = true
wait(2)
surg2.Value = false
repaired.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
nylon_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.nylon
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local o2l = PlHuman.Parent.Saude.Stances.o2
local balloonbleed = PlHuman.Parent.Saude.Stances.balloonbleed
local repaired = PlHuman.Parent.Saude.Stances.repaired
local balloon = PlHuman.Parent.Saude.Stances.balloon
local catheter = PlHuman.Parent.Saude.Stances.catheter
local cutopen = PlHuman.Parent.Saude.Stances.cutopen
if enabled.Value == false then
if Item.Value >= 1 and o2l.Value == true and repaired.Value == true and catheter.Value == false and cutopen.Value == true and PlHuman.Parent.Saude.Stances.Caido.Value == true then
enabled.Value = true
wait(2)
repaired.Value = false
cutopen.Value = false
wait(2)
Item.Value = Item.Value - 1
enabled.Value = false
end
end
end
end)
defib_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.defib
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local bbleeding = PlHuman.Parent.Saude.Stances.bbleeding
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local o2p = PlHuman.Parent.Saude.Stances.o2
local isdead = PlHuman.Parent.Saude.Stances.rodeath
local cpr = PlHuman.Parent.Saude.Stances.cpr
local life = PlHuman.Parent.Saude.Stances.life
if enabled.Value == false then
if Item.Value >= 1 and o2p.Value == true and isdead.Value == true then
enabled.Value = true
wait(1)
isdead.Value = false
life.Value = true
PlHuman.Health = PlHuman.Health + 100
wait(1)
enabled.Value = false
end
end
end
end)
Splint_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Splint
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if enabled.Value == false then
if Item.Value >= 1 and Ferido.Value == true then
enabled.Value = true
wait(.3)
Ferido.Value = false
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
Tourniquet_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Tourniquet
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.Tourniquet.Value == false then
if enabled.Value == false then
if Item.Value > 0 then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.Tourniquet.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.Tourniquet.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.Tourniquet.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
skit_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.skit
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.skit.Value == false then
if enabled.Value == false then
if Item.Value > 0 then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.skit.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.skit.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.skit.Value = false
wait(2)
enabled.Value = false
end
end
end
end
end)
npa_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.npa
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local faido = PlHuman.Parent.Saude.Stances.Caido
local o2p = PlHuman.Parent.Saude.Stances.o2
local nrb = PlHuman.Parent.Saude.Stances.nrb
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.npa.Value == false then
if enabled.Value == false then
if Item.Value > 0 and faido.Value == false then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.npa.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.npa.Value == true and nrb.Value == false then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.npa.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
etube_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.etube
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local faido = PlHuman.Parent.Saude.Stances.Caido
local o2p = PlHuman.Parent.Saude.Stances.o2
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.etube.Value == false then
if enabled.Value == false then
if Item.Value > 0 and faido.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.etube.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.etube.Value == true and o2p.Value == false then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.etube.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
nrb_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.nrb
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local faido = PlHuman.Parent.Saude.Stances.Caido
local o2p = PlHuman.Parent.Saude.Stances.o2
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.nrb.Value == false and PlHuman.Parent.Saude.Stances.npa.Value == true then
if enabled.Value == false then
if Item.Value > 0 then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.nrb.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.nrb.Value == true and o2p.Value == false then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.nrb.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
o2_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.o2
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local npa = PlHuman.Parent.Saude.Stances.npa
local nrb = PlHuman.Parent.Saude.Stances.nrb
local etube = PlHuman.Parent.Saude.Stances.etube
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.o2.Value == false then
if enabled.Value == false then
if Item.Value > 0 and (nrb.Value == true or etube.Value == true) then
--if Item.Value > 0 then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.o2.Value = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
else
if enabled.Value == false then
if PlHuman.Parent.Saude.Stances.o2.Value == true then
enabled.Value = true
wait(.3)
PlHuman.Parent.Saude.Stances.o2.Value = false
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end
end)
bvm_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.bvm
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local npa = PlHuman.Parent.Saude.Stances.npa
local etube = PlHuman.Parent.Saude.Stances.etube
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
if PlHuman.Parent.Saude.Stances.o2.Value == false then
if enabled.Value == false then
if Item.Value > 0 and (npa.Value == true or etube.Value == true) then
--if Item.Value > 0 then
enabled.Value = true
wait(.2)
PlHuman.Parent.Saude.Stances.o2.Value = true
wait(4.5)
PlHuman.Parent.Saude.Stances.o2.Value = false
wait(0.2)
enabled.Value = false
end
end
end
end
end)
Epinephrine_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Epinefrina
local bbleeding = Human.Parent.Saude.Stances.bbleeding
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local isdead = PlHuman.Parent.Saude.Stances.rodeath
local skit = PlHuman.Parent.Saude.Stances.skit
if enabled.Value == false then
--if enabled.Value == false and bbleeding.Value == false then
if Item.Value >= 1 and PlCaido.Value == true and skit.Value == true then
enabled.Value = true
wait(.3)
if Dor.Value > 0 then
Dor.Value = Dor.Value + math.random(10,20)
end
if Sangrando.Value == true then
MLs.Value = MLs.Value + math.random(10,35)
end
isdead.Value = false
PlCaido.Value = false
PlHuman.PlatformStand = false
PlHuman.AutoRotate = true
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
anesthetic_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.anesthetic
local bbleeding = Human.Parent.Saude.Stances.bbleeding
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local skit = PlHuman.Parent.Saude.Stances.skit
if enabled.Value == false then
--if enabled.Value == false and bbleeding.Value == false then
if Item.Value >= 1 and PlCaido.Value == false and skit.Value == true then
enabled.Value = true
wait(.3)
PlCaido.Value = true
PlHuman.PlatformStand = true
PlHuman.AutoRotate = false
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
Morphine_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Morfina
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local skit = PlHuman.Parent.Saude.Stances.skit
if enabled.Value == false then
if Item.Value >= 1 and Dor.Value >= 1 and skit.Value == true then
enabled.Value = true
wait(.3)
Dor.Value = Dor.Value - math.random(100,150)
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
BloodBag_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.SacoDeSangue
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local blood = PlHuman.Parent.Saude.Variaveis.Sangue
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local skit = PlHuman.Parent.Saude.Stances.skit
if enabled.Value == false then
if Item.Value >= 1 and skit.Value == true then
enabled.Value = true
wait(.3)
blood.Value = blood.Value + 2000
Item.Value = Item.Value - 1
wait(2)
enabled.Value = false
end
end
end
end)
drawblood_Multi.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.SacoDeSangue
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local blood = PlHuman.Parent.Saude.Variaveis.Sangue
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local skit = PlHuman.Parent.Saude.Stances.skit
if enabled.Value == false then
if Item.Value < 10 and skit.Value == true then
enabled.Value = true
wait(.3)
blood.Value = blood.Value - 2000
Item.Value = Item.Value + 1
wait(2)
enabled.Value = false
end
end
end
end)
|
--Body parts
|
rArm = char:findFirstChild("Right Arm")
lArm = char:findFirstChild("Left Arm")
rLeg = char:findFirstChild("Right Leg")
lLeg = char:findFirstChild("Left Leg")
tors = char:findFirstChild("Torso")
head = char:findFirstChild("Head")
|
-- ROBLOX deviation START: chalk doesn't support chaining methods. Using nested calls instead
|
local FAIL_COLOR = function(...)
return chalk.bold(chalk.red(...))
end
local SNAPSHOT_ADDED = function(...)
return chalk.bold(chalk.green(...))
end
local SNAPSHOT_UPDATED = function(...)
return chalk.bold(chalk.green(...))
end
local SNAPSHOT_OUTDATED = function(...)
return chalk.bold(chalk.yellow(...))
end
|
--TextStuff
|
local Text = script.Parent
local RebirthFormule = game:GetService("ReplicatedStorage").GameProperties.RebirthFormule
local MultiplierFormule = game:GetService("ReplicatedStorage").GameProperties.MultiplierFormule
local Formula = RebirthLevel.Value + 1
Text.Text = Formula
RebirthLevel.Changed:Connect(function()
local FormulaUpdate = RebirthLevel.Value + 1
Text.Text = FormulaUpdate
end)
|
--[=[
Attaches an `andThen` handler to this Promise that calls the given callback with the predefined arguments. The resolved value is discarded.
```lua
promise:andThenCall(someFunction, "some", "arguments")
```
This is sugar for
```lua
promise:andThen(function()
return someFunction("some", "arguments")
end)
```
@param callback (...: any) -> any
@param ...? any -- Additional arguments which will be passed to `callback`
@return Promise
]=]
|
function Promise.prototype:andThenCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:andThenCall"))
local length, values = pack(...)
return self:_andThen(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end)
end
|
-- Let the server know our walkspeed has changed
|
humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
updateWalkspeedRemote:FireServer(humanoid.WalkSpeed)
end)
|
--[=[
An enum value used to represent the Promise's status.
@interface Status
@tag enum
@within Promise
.Started "Started" -- The Promise is executing, and not settled yet.
.Resolved "Resolved" -- The Promise finished successfully.
.Rejected "Rejected" -- The Promise was rejected.
.Cancelled "Cancelled" -- The Promise was cancelled before it finished.
]=]
--[=[
@prop Status Status
@within Promise
@readonly
@tag enums
A table containing all members of the `Status` enum, e.g., `Promise.Status.Resolved`.
]=]
--[=[
A Promise is an object that represents a value that will exist in the future, but doesn't right now.
Promises allow you to then attach callbacks that can run once the value becomes available (known as *resolving*),
or if an error has occurred (known as *rejecting*).
@class Promise
@__index prototype
]=]
|
local Promise = {
Error = Error,
Status = makeEnum("Promise.Status", {"Started", "Resolved", "Rejected", "Cancelled"}),
_getTime = os.clock,
_timeEvent = game:GetService("RunService").Heartbeat,
}
Promise.prototype = {}
Promise.__index = Promise.prototype
function Promise._new(traceback, callback, parent)
if parent ~= nil and not Promise.is(parent) then
error("Argument #2 to Promise.new must be a promise or nil", 2)
end
local self = {
-- Used to locate where a promise was created
_source = traceback,
_status = Promise.Status.Started,
-- A table containing a list of all results, whether success or failure.
-- Only valid if _status is set to something besides Started
_values = nil,
-- Lua doesn't like sparse arrays very much, so we explicitly store the
-- length of _values to handle middle nils.
_valuesLength = -1,
-- Tracks if this Promise has no error observers..
_unhandledRejection = true,
-- Queues representing functions we should invoke when we update!
_queuedResolve = {},
_queuedReject = {},
_queuedFinally = {},
-- The function to run when/if this promise is cancelled.
_cancellationHook = nil,
-- The "parent" of this promise in a promise chain. Required for
-- cancellation propagation upstream.
_parent = parent,
-- Consumers are Promises that have chained onto this one.
-- We track them for cancellation propagation downstream.
_consumers = setmetatable({}, MODE_KEY_METATABLE),
}
if parent and parent._status == Promise.Status.Started then
parent._consumers[self] = true
end
setmetatable(self, Promise)
local function resolve(...)
self:_resolve(...)
end
local function reject(...)
self:_reject(...)
end
local function onCancel(cancellationHook)
if cancellationHook then
if self._status == Promise.Status.Cancelled then
cancellationHook()
else
self._cancellationHook = cancellationHook
end
end
return self._status == Promise.Status.Cancelled
end
coroutine.wrap(function()
local ok, _, result = runExecutor(
self._source,
callback,
resolve,
reject,
onCancel
)
if not ok then
reject(result[1])
end
end)()
return self
end
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
--DO NOT REMOVE THIS. Chat must be filtered or your game will face
--moderation.
|
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName)
if (RunService:IsServer() and not RunService:IsStudio()) then
local fromSpeaker = self:GetSpeaker(speakerName)
local toSpeaker = toSpeakerName and self:GetSpeaker(toSpeakerName)
if fromSpeaker == nil then
return nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
local toPlayerObj = toSpeaker and toSpeaker:GetPlayer()
if fromPlayerObj == nil then
return message
end
local filterStartTime = tick()
local filterRetries = 0
while true do
local success, message = pcall(function()
if toPlayerObj then
return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
else
return Chat:FilterStringForBroadcast(message, fromPlayerObj)
end
end)
if success then
return message
else
warn("Error filtering message:", message)
end
filterRetries = filterRetries + 1
if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then
self:InternalNotifyFilterIssue()
return nil
end
local backoffInterval = FILTER_BACKOFF_INTERVALS[math.min(#FILTER_BACKOFF_INTERVALS, filterRetries)]
-- backoffWait = backoffInterval +/- (0 -> backoffInterval)
local backoffWait = backoffInterval + ((math.random()*2 - 1) * backoffInterval)
wait(backoffWait)
end
else
--// Simulate filtering latency.
--// There is only latency the first time the message is filtered, all following calls will be instant.
if not StudioMessageFilteredCache[message] then
StudioMessageFilteredCache[message] = true
wait(0.2)
end
return message
end
return nil
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
--s.Pitch = 0.7
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.20 1.900
s:play()
wait(0.001)
end]]
--[[Chopper level 5=1.2, Chopper level 4=1.04]]
|
s.Volume=0
while s.Pitch<1 do
s.Pitch=s.Pitch+0.009
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local function ShallowCopy(table)
local copy = {}
for i, v in pairs(table) do
copy[i] = v
end
return copy
end
local methods = {}
local lazyEventNames =
{
eDestroyed = true,
eSaidMessage = true,
eReceivedMessage = true,
eReceivedUnfilteredMessage = true,
eMessageDoneFiltering = true,
eReceivedSystemMessage = true,
eChannelJoined = true,
eChannelLeft = true,
eMuted = true,
eUnmuted = true,
eExtraDataUpdated = true,
eMainChannelSet = true,
eChannelNameColorUpdated = true,
}
local lazySignalNames =
{
Destroyed = "eDestroyed",
SaidMessage = "eSaidMessage",
ReceivedMessage = "eReceivedMessage",
ReceivedUnfilteredMessage = "eReceivedUnfilteredMessage",
RecievedUnfilteredMessage = "eReceivedUnfilteredMessage", -- legacy mispelling
MessageDoneFiltering = "eMessageDoneFiltering",
ReceivedSystemMessage = "eReceivedSystemMessage",
ChannelJoined = "eChannelJoined",
ChannelLeft = "eChannelLeft",
Muted = "eMuted",
Unmuted = "eUnmuted",
ExtraDataUpdated = "eExtraDataUpdated",
MainChannelSet = "eMainChannelSet",
ChannelNameColorUpdated = "eChannelNameColorUpdated"
}
methods.__index = function (self, k)
local fromMethods = rawget(methods, k)
if fromMethods then return fromMethods end
if lazyEventNames[k] and not rawget(self, k) then
rawset(self, k, Instance.new("BindableEvent"))
end
local lazySignalEventName = lazySignalNames[k]
if lazySignalEventName and not rawget(self, k) then
if not rawget(self, lazySignalEventName) then
rawset(self, lazySignalEventName, Instance.new("BindableEvent"))
end
rawset(self, k, rawget(self, lazySignalEventName).Event)
end
return rawget(self, k)
end
function methods:LazyFire(eventName, ...)
local createdEvent = rawget(self, eventName)
if createdEvent then
createdEvent:Fire(...)
end
end
function methods:SayMessage(message, channelName, extraData)
if (self.ChatService:InternalDoProcessCommands(self.Name, message, channelName)) then return end
if (not channelName) then return end
local channel = self.Channels[channelName:lower()]
if (not channel) then
error("Speaker is not in channel \"" .. channelName .. "\"")
end
local messageObj = channel:InternalPostMessage(self, message, extraData)
if (messageObj) then
local success, err = pcall(function() self:LazyFire("eSaidMessage", messageObj, channelName) end)
if not success and err then
print("Error saying message: " ..err)
end
end
return messageObj
end
function methods:JoinChannel(channelName)
if (self.Channels[channelName:lower()]) then
warn("Speaker is already in channel \"" .. channelName .. "\"")
return
end
local channel = self.ChatService:GetChannel(channelName)
if (not channel) then
error("Channel \"" .. channelName .. "\" does not exist!")
end
self.Channels[channelName:lower()] = channel
channel:InternalAddSpeaker(self)
local success, err = pcall(function()
self.eChannelJoined:Fire(channel.Name, channel:GetWelcomeMessageForSpeaker(self))
end)
if not success and err then
print("Error joining channel: " ..err)
end
end
function methods:LeaveChannel(channelName)
if (not self.Channels[channelName:lower()]) then
warn("Speaker is not in channel \"" .. channelName .. "\"")
return
end
local channel = self.Channels[channelName:lower()]
self.Channels[channelName:lower()] = nil
channel:InternalRemoveSpeaker(self)
local success, err = pcall(function()
self:LazyFire("eChannelLeft", channel.Name)
if self.PlayerObj then
self.EventFolder.OnChannelLeft:FireClient(self.PlayerObj, channel.Name)
end
end)
if not success and err then
print("Error leaving channel: " ..err)
end
end
function methods:IsInChannel(channelName)
return (self.Channels[channelName:lower()] ~= nil)
end
function methods:GetChannelList()
local list = {}
for i, channel in pairs(self.Channels) do
table.insert(list, channel.Name)
end
return list
end
function methods:SendMessage(message, channelName, fromSpeaker, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendMessageToSpeaker(message, self.Name, fromSpeaker, extraData)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a message in it.", self.Name, channelName))
end
end
function methods:SendSystemMessage(message, channelName, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendSystemMessageToSpeaker(message, self.Name, extraData)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a system message in it.", self.Name, channelName))
end
end
function methods:GetPlayer()
return self.PlayerObj
end
function methods:SetExtraData(key, value)
self.ExtraData[key] = value
self:LazyFire("eExtraDataUpdated", key, value)
end
function methods:GetExtraData(key)
return self.ExtraData[key]
end
function methods:SetMainChannel(channelName)
local success, err = pcall(function()
self:LazyFire("eMainChannelSet", channelName)
if self.PlayerObj then
self.EventFolder.OnMainChannelSet:FireClient(self.PlayerObj, channelName)
end
end)
if not success and err then
print("Error setting main channel: " ..err)
end
end
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
if currentlyPlayingEmote then
oldAnim = "idle"
currentlyPlayingEmote = false
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
-- clean up walk if there is one
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop()
runAnimTrack:Destroy()
runAnimTrack = nil
end
return oldAnim
end
function getHeightScale()
if Humanoid then
if not Humanoid.AutomaticScalingEnabled then
return 1
end
local scale = Humanoid.HipHeight / HumanoidHipHeight
if AnimationSpeedDampeningObject == nil then
AnimationSpeedDampeningObject = script:FindFirstChild("ScaleDampeningPercent")
end
if AnimationSpeedDampeningObject ~= nil then
scale = 1 + (Humanoid.HipHeight - HumanoidHipHeight) * AnimationSpeedDampeningObject.Value / HumanoidHipHeight
end
return scale
end
return 1
end
local function rootMotionCompensation(speed)
local speedScaled = speed * 1.25
local heightScale = getHeightScale()
local runSpeed = speedScaled / heightScale
return runSpeed
end
local smallButNotZero = 0.0001
local function setRunSpeed(speed)
local normalizedWalkSpeed = 0.5 -- established empirically using current `913402848` walk animation
local normalizedRunSpeed = 1
local runSpeed = rootMotionCompensation(speed)
local walkAnimationWeight = smallButNotZero
local runAnimationWeight = smallButNotZero
local walkAnimationTimewarp = runSpeed/normalizedWalkSpeed
local runAnimationTimerwarp = runSpeed/normalizedRunSpeed
if runSpeed <= normalizedWalkSpeed then
walkAnimationWeight = 1
elseif runSpeed < normalizedRunSpeed then
local fadeInRun = (runSpeed - normalizedWalkSpeed)/(normalizedRunSpeed - normalizedWalkSpeed)
walkAnimationWeight = 1 - fadeInRun
runAnimationWeight = fadeInRun
walkAnimationTimewarp = 1
runAnimationTimerwarp = 1
else
runAnimationWeight = 1
end
currentAnimTrack:AdjustWeight(walkAnimationWeight)
runAnimTrack:AdjustWeight(runAnimationWeight)
currentAnimTrack:AdjustSpeed(walkAnimationTimewarp)
runAnimTrack:AdjustSpeed(runAnimationTimerwarp)
end
function setAnimationSpeed(speed)
if currentAnim == "walk" then
setRunSpeed(speed)
else
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
if currentAnim == "walk" then
if userNoUpdateOnLoop == true then
if runAnimTrack.Looped ~= true then
runAnimTrack.TimePosition = 0.0
end
if currentAnimTrack.Looped ~= true then
currentAnimTrack.TimePosition = 0.0
end
else
runAnimTrack.TimePosition = 0.0
currentAnimTrack.TimePosition = 0.0
end
else
local repeatAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[repeatAnim] ~= nil and emoteNames[repeatAnim] == false) then
repeatAnim = "idle"
end
if currentlyPlayingEmote then
if currentAnimTrack.Looped then
-- Allow the emote to loop
return
end
repeatAnim = "idle"
currentlyPlayingEmote = false
end
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.15, Humanoid)
setAnimationSpeed(animSpeed)
end
end
end
function rollAnimation(animName)
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
return idx
end
local function switchToAnim(anim, animName, transitionTime, humanoid)
-- switch animation
if (anim ~= currentAnimInstance) then
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
if (runAnimTrack ~= nil) then
runAnimTrack:Stop(transitionTime)
runAnimTrack:Destroy()
if userNoUpdateOnLoop == true then
runAnimTrack = nil
end
end
currentAnimSpeed = 1.0
-- load it to the humanoid; get AnimationTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
currentAnimTrack.Priority = Enum.AnimationPriority.Core
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
currentAnimInstance = anim
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
-- check to see if we need to blend a walk/run animation
if animName == "walk" then
local runAnimName = "run"
local runIdx = rollAnimation(runAnimName)
runAnimTrack = humanoid:LoadAnimation(animTable[runAnimName][runIdx].anim)
runAnimTrack.Priority = Enum.AnimationPriority.Core
runAnimTrack:Play(transitionTime)
if (runAnimKeyframeHandler ~= nil) then
runAnimKeyframeHandler:disconnect()
end
runAnimKeyframeHandler = runAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
end
function playAnimation(animName, transitionTime, humanoid)
local idx = rollAnimation(animName)
local anim = animTable[animName][idx].anim
switchToAnim(anim, animName, transitionTime, humanoid)
currentlyPlayingEmote = false
end
function playEmote(emoteAnim, transitionTime, humanoid)
switchToAnim(emoteAnim, emoteAnim.Name, transitionTime, humanoid)
currentlyPlayingEmote = true
end
|
--// All global vars will be wiped/replaced except script
|
return function(data, env)
if env then
setfenv(1, env)
end
script.Parent.Parent:Destroy()
end
|
--Aesthetics
|
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .5 -- Suspension Coil Radius
Tune.SusThickness = .2 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 7 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .3 -- Wishbone Rod Thickness
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
--// Be sure to update the console gui's code if you change stuff
|
return function(data, env)
if env then
setfenv(1, env)
end
local client, cPcall, Pcall, Routine, service, gTable =
client, cPcall, Pcall, Routine, service, gTable
local gui = script.Parent.Parent
local localplayer = service.Player
local mouse = localplayer:GetMouse()
local playergui = service.PlayerGui
local storedChats = client.Variables.StoredChats
local desc = gui.Desc
local nohide = data.KeepChat
local function Expand(ent, point)
ent.MouseLeave:Connect(function(x, y)
point.Visible = false
end)
ent.MouseMoved:Connect(function(x, y)
point.Text = ent.Desc.Value
point.Size = UDim2.new(0, 10000, 0, 10000)
local bounds = point.TextBounds.X
local rows = math.floor(bounds / 500)
rows = rows + 1
if rows < 1 then
rows = 1
end
local newx = 500
if bounds < 500 then
newx = bounds
end
point.Visible = true
point.Size = UDim2.new(0, newx + 10, 0, rows * 20)
point.Position = UDim2.new(0, x, 0, y - 40 - (rows * 20))
end)
end
local function UpdateChat()
if gui then
local globalTab = gui.Drag.Frame.Frame.Global
local teamTab = gui.Drag.Frame.Frame.Team
local localTab = gui.Drag.Frame.Frame.Local
local adminsTab = gui.Drag.Frame.Frame.Admins
local crossTab = gui.Drag.Frame.Frame.Cross
local entry = gui.Entry
local tester = gui.BoundTest
globalTab:ClearAllChildren()
teamTab:ClearAllChildren()
localTab:ClearAllChildren()
adminsTab:ClearAllChildren()
crossTab:ClearAllChildren()
local globalNum = 0
local teamNum = 0
local localNum = 0
local adminsNum = 0
local crossNum = 0
for i, v in pairs(storedChats) do
local clone = entry:Clone()
clone.Message.Text = service.MaxLen(v.Message, 100)
clone.Desc.Value = v.Message
Expand(clone, desc)
if not string.match(v.Player, "%S") then
clone.Nameb.Text = v.Player
else
clone.Nameb.Text = `[{v.Player}]: `
end
clone.Visible = true
clone.Nameb.Font = "SourceSansBold"
local color = v.Color or BrickColor.White()
clone.Nameb.TextColor3 = color.Color
tester.Text = `[{v.Player}]: `
local naml = tester.TextBounds.X + 5
if naml > 100 then
naml = 100
end
tester.Text = v.Message
local mesl = tester.TextBounds.X
clone.Message.Position = UDim2.new(0, naml, 0, 0)
clone.Message.Size = UDim2.new(1, -(naml + 10), 1, 0)
clone.Nameb.Size = UDim2.new(0, naml, 0, 20)
clone.Visible = false
clone.Parent = globalTab
local rows = math.floor((mesl + naml) / clone.AbsoluteSize.X)
rows = rows + 1
if rows < 1 then
rows = 1
end
if rows > 3 then
rows = 3
end
--rows = rows+1
clone.Parent = nil
clone.Visible = true
clone.Size = UDim2.new(1, 0, 0, rows * 20)
if v.Private then
clone.Nameb.TextColor3 = Color3.new(0.58823529411765, 0.22352941176471, 0.69019607843137)
end
if v.Mode == "Global" then
clone.Position = UDim2.new(0, 0, 0, globalNum * 20)
globalNum = globalNum + 1
if rows > 1 then
globalNum = globalNum + rows - 1
end
clone.Parent = globalTab
elseif v.Mode == "Team" then
clone.Position = UDim2.new(0, 0, 0, teamNum * 20)
teamNum = teamNum + 1
if rows > 1 then
teamNum = teamNum + rows - 1
end
clone.Parent = teamTab
elseif v.Mode == "Local" then
clone.Position = UDim2.new(0, 0, 0, localNum * 20)
localNum = localNum + 1
if rows > 1 then
localNum = localNum + rows - 1
end
clone.Parent = localTab
elseif v.Mode == "Admins" then
clone.Position = UDim2.new(0, 0, 0, adminsNum * 20)
adminsNum = adminsNum + 1
if rows > 1 then
adminsNum = adminsNum + rows - 1
end
clone.Parent = adminsTab
elseif v.Mode == "Cross" then
clone.Position = UDim2.new(0, 0, 0, crossNum * 20)
crossNum = crossNum + 1
if rows > 1 then
crossNum = crossNum + rows - 1
end
clone.Parent = crossTab
end
end
globalTab.CanvasSize = UDim2.new(0, 0, 0, ((globalNum) * 20))
teamTab.CanvasSize = UDim2.new(0, 0, 0, ((teamNum) * 20))
localTab.CanvasSize = UDim2.new(0, 0, 0, ((localNum) * 20))
adminsTab.CanvasSize = UDim2.new(0, 0, 0, ((adminsNum) * 20))
crossTab.CanvasSize = UDim2.new(0, 0, 0, ((crossNum) * 20))
local glob = (((globalNum) * 20) - globalTab.AbsoluteWindowSize.Y)
local tea = (((teamNum) * 20) - teamTab.AbsoluteWindowSize.Y)
local loc = (((localNum) * 20) - localTab.AbsoluteWindowSize.Y)
local adm = (((adminsNum) * 20) - adminsTab.AbsoluteWindowSize.Y)
local cro = (((crossNum) * 20) - crossTab.AbsoluteWindowSize.Y)
if glob < 0 then
glob = 0
end
if tea < 0 then
tea = 0
end
if loc < 0 then
loc = 0
end
if adm < 0 then
adm = 0
end
if cro < 0 then
cro = 0
end
globalTab.CanvasPosition = Vector2.new(0, glob)
teamTab.CanvasPosition = Vector2.new(0, tea)
localTab.CanvasPosition = Vector2.new(0, loc)
adminsTab.CanvasPosition = Vector2.new(0, adm)
crossTab.CanvasPosition = Vector2.new(0, cro)
end
end
if not storedChats then
client.Variables.StoredChats = {}
storedChats = client.Variables.StoredChats
end
gTable:Ready()
local bubble = gui.Bubble
local toggle = gui.Toggle
local drag = gui.Drag
local frame = gui.Drag.Frame
local frame2 = gui.Drag.Frame.Frame
local box = gui.Drag.Frame.Chat
local globalTab = gui.Drag.Frame.Frame.Global
local teamTab = gui.Drag.Frame.Frame.Team
local localTab = gui.Drag.Frame.Frame.Local
local adminsTab = gui.Drag.Frame.Frame.Admins
local crossTab = gui.Drag.Frame.Frame.Cross
local global = gui.Drag.Frame.Global
local team = gui.Drag.Frame.Team
local localb = gui.Drag.Frame.Local
local admins = gui.Drag.Frame.Admins
local cross = gui.Drag.Frame.Cross
if not nohide then
client.Variables.CustomChat = true
client.Variables.ChatEnabled = false
service.StarterGui:SetCoreGuiEnabled('Chat', false)
else
drag.Position = UDim2.new(0, 10, 1, -180)
end
local dragger = gui.Drag.Frame.Dragger
local fakeDrag = gui.Drag.Frame.FakeDragger
local boxFocused = false
local mode = "Global"
local lastChat = 0
local lastClick = 0
local isAdmin = client.Remote.Get("CheckAdmin")
if not isAdmin then
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
if client.UI.Get("HelpButton") then
toggle.Position = UDim2.new(1, -90, 1, -45)
end
local function openGlobal()
globalTab.Visible = true
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = false
global.Text = "Global"
mode = "Global"
global.BackgroundTransparency = 0
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openTeam()
globalTab.Visible = false
teamTab.Visible = true
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = false
team.Text = "Team"
mode = "Team"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0
localb.BackgroundTransparency = 0.5
admins.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openLocal()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = true
adminsTab.Visible = false
crossTab.Visible = false
localb.Text = "Local"
mode = "Local"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0
admins.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openAdmins()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = true
crossTab.Visible = false
admins.Text = "Admins"
mode = "Admins"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openCross()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = true
cross.Text = "Cross"
mode = "Cross"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function fadeIn()
--[[
frame.BackgroundTransparency = 0.5
frame2.BackgroundTransparency = 0.5
box.BackgroundTransparency = 0.5
for i=0.1,0.5,0.1 do
--wait(0.1)
frame.BackgroundTransparency = 0.5-i
frame2.BackgroundTransparency = 0.5-i
box.BackgroundTransparency = 0.5-i
end-- Disabled ]]
frame.BackgroundTransparency = 0
frame2.BackgroundTransparency = 0
box.BackgroundTransparency = 0
fakeDrag.Visible = true
end
local function fadeOut()
--[[
frame.BackgroundTransparency = 0
frame2.BackgroundTransparency = 0
box.BackgroundTransparency = 0
for i=0.1,0.5,0.1 do
--wait(0.1)
frame.BackgroundTransparency = i
frame2.BackgroundTransparency = i
box.BackgroundTransparency = i
end-- Disabled ]]
frame.BackgroundTransparency = 0.7
frame2.BackgroundTransparency = 1
box.BackgroundTransparency = 1
fakeDrag.Visible = false
end
fadeOut()
frame.MouseEnter:Connect(function()
fadeIn()
end)
frame.MouseLeave:Connect(function()
if not boxFocused then
fadeOut()
end
end)
toggle.MouseButton1Click:Connect(function()
if drag.Visible then
drag.Visible = false
toggle.Image = "rbxassetid://417301749"--417285299"
else
drag.Visible = true
toggle.Image = "rbxassetid://417301773"--417285351"
end
end)
global.MouseButton1Click:Connect(function()
openGlobal()
end)
team.MouseButton1Click:Connect(function()
openTeam()
end)
localb.MouseButton1Click:Connect(function()
openLocal()
end)
admins.MouseButton1Click:Connect(function()
if isAdmin or tick() - lastClick > 5 then
isAdmin = client.Remote.Get("CheckAdmin")
if isAdmin then
openAdmins()
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
end
lastClick = tick()
end
end)
cross.MouseButton1Click:Connect(function()
if isAdmin or tick() - lastClick > 5 then
isAdmin = client.Remote.Get("CheckAdmin")
if isAdmin then
openCross()
else
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
lastClick = tick()
end
end)
box.FocusLost:Connect(function(enterPressed)
boxFocused = false
if enterPressed and not client.Variables.Muted then
if box.Text ~= '' and ((mode ~= "Cross" and tick() - lastChat >= 0.5) or (mode == "Cross" and tick() - lastChat >= 10)) then
if not client.Variables.Muted then
client.Remote.Send('ProcessCustomChat', box.Text, mode)
lastChat = tick()
end
elseif not ((mode ~= "Cross" and tick() - lastChat >= 0.5) or (mode == "Cross" and tick() - lastChat >= 10)) then
local tim
if mode == "Cross" then
tim = 10 - (tick() - lastChat)
else
tim = 0.5 - (tick() - lastChat)
end
tim = string.sub(tostring(tim), 1, 3)
client.Handlers.ChatHandler("SpamBot", `Sending too fast! Please wait {tim} seconds.`, "System")
end
box.Text = "Click here or press the '/' key to chat"
fadeOut()
if mode ~= "Cross" then
lastChat = tick()
end
end
end)
box.Focused:Connect(function()
boxFocused = true
if box.Text == "Click here or press the '/' key to chat" then
box.Text = ''
end
fadeIn()
end)
if not nohide then
service.UserInputService.InputBegan:Connect(function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and InputObject.UserInputType == Enum.UserInputType.Keyboard and InputObject.KeyCode == Enum.KeyCode.Slash then
if box.Text == "Click here or press the '/' key to chat" then
box.Text = ''
end
service.RunService.RenderStepped:Wait()
box:CaptureFocus()
end
end)
end
local dragging = false
local nx, ny = drag.AbsoluteSize.X, frame.AbsoluteSize.Y --450,200
local defx, defy = nx, ny
mouse.Move:Connect(function(x, y)
if dragging then
nx = math.clamp(defx + (dragger.Position.X.Offset + 20), 1, 260)
ny = math.clamp(defy + (dragger.Position.Y.Offset + 20), 1, 100)
frame.Size = UDim2.new(1, 0, 0, ny)
drag.Size = UDim2.new(0, nx, 0, 30)
end
end)
dragger.DragBegin:Connect(function(init)
dragging = true
end)
dragger.DragStopped:Connect(function(x, y)
dragging = false
defx = nx
defy = ny
dragger.Position = UDim2.new(1, -20, 1, -20)
UpdateChat()
end)
UpdateChat()
|
-- Local Variables
|
local Storage
local RocketTemplate
local Buffer = {}
local Tool = script.Parent
local Owner = nil
local Configurations = Tool.Configuration
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]]
|
function Promise.prototype:_andThen(traceback, successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise._new(traceback, function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(
traceback,
successHandler,
resolve,
reject
)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(
traceback,
failureHandler,
resolve,
reject
)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = "Promise created at\n\n" .. traceback,
}))
end
end, self)
end
function Promise.prototype:andThen(successHandler, failureHandler)
assert(
successHandler == nil or type(successHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
assert(
failureHandler == nil or type(failureHandler) == "function",
string.format(ERROR_NON_FUNCTION, "Promise:andThen")
)
return self:_andThen(debug.traceback(nil, 2), successHandler, failureHandler)
end
Promise.prototype.AndThen = Promise.prototype.andThen
Promise.prototype.Then = Promise.prototype.andThen
|
-- Returns how deep `o` is in the tree.
|
local function depth(o)
local d = -1
while o do
o = o.Parent
d = d + 1
end
return d
end
local connLookup = {}
|
-- Make the chat work when the top bar is off
|
module.ChatOnWithTopBarOff = true
module.ScreenGuiDisplayOrder = 6 -- The DisplayOrder value for the ScreenGui containing the chat.
module.ShowFriendJoinNotification = true -- Show a notification in the chat when a players friend joins the game.
|
--[[
Updates the emote configuration to add default and paid emotes that
the user owns to it. Also adds these emotes to the user's
HumanoidDescription so that they can be used by the function
Humanoid:PlayEmote
Parameters:
- player - The Player whose HumanoidDescription is being updated
- humanoidDescription - The humanoid description to used for getting and
setting emotes
]]
|
function EmoteManager:updateEmotes(player, humanoidDescription)
local ownedEmotes = self.playerOwnedEmotes[player.UserId] or {}
-- Find emotes set by setEmotes
local configuredEmotes = emotes.getValues()
local externalEmotes = {}
for emoteName, emoteInfo in pairs(configuredEmotes) do
-- Filter out default and paid emotes from the configuredEmotes
if defaultEmotes[emoteName] and defaultEmotes[emoteName].emote == emoteInfo.emote then
continue
elseif paidEmotes[emoteName] and paidEmotes[emoteName].emote == emoteInfo.emote then
continue
end
externalEmotes[emoteName] = emoteInfo
end
local newEmoteConfig
if serverConfig.getValues().useDefaultEmotes then
-- Combine default emotes, paid emotes, and any emotes set via setEmotes
newEmoteConfig = Cryo.Dictionary.join(defaultEmotes, ownedEmotes, externalEmotes)
else
-- Only send emotes configured by setEmotes
newEmoteConfig = externalEmotes
end
-- Add default and owned emotes to the player's humanoid
-- description so that they can be played using the PlayEmote function
local humanoidEmotes = {}
for emoteName, emote in pairs(newEmoteConfig) do
-- Only add Emotes that use emote asset ids. Ignore Emotes that use
-- animation asset ids.
if emote.emote then
humanoidEmotes[emoteName] = { emote.emote }
end
end
humanoidDescription:SetEmotes(humanoidEmotes)
self.playerEmoteConfig[player.UserId] = newEmoteConfig
self.remotes.sendUpdatedEmotes:FireClient(player, newEmoteConfig)
end
|
------------------------------------------------------------------------
--
-- * used in luaK:infix(), (lparser) luaY:cond()
------------------------------------------------------------------------
|
function luaK:goiftrue(fs, e)
local pc -- pc of last jump
self:dischargevars(fs, e)
local k = e.k
if k == "VK" or k == "VKNUM" or k == "VTRUE" then
pc = self.NO_JUMP -- always true; do nothing
elseif k == "VFALSE" then
pc = self:jump(fs) -- always jump
elseif k == "VJMP" then
self:invertjump(fs, e)
pc = e.info
else
pc = self:jumponcond(fs, e, false)
end
e.f = self:concat(fs, e.f, pc) -- insert last jump in `f' list
self:patchtohere(fs, e.t)
e.t = self.NO_JUMP
end
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, Connection in pairs(animTable[name].Connections) do
Connection:Disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].Connections = {}
-- check for config values
local config = script:FindFirstChild(name)
if (config ~= nil) then
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.