prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
end
end
function onClicked()
DoorClose()
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0) --Change 10 to change the speed.
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors.F00
then StopE() DoorOpen()
end
end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors.F00.Position
clicker = true
end
function DoorOpen()
while Shaft00.MetalDoor.Transparency < 1.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft00.MetalDoor.CanCollide = false
end
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = true
module.WindowResizable = true
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
--Obj
|
local Frame
local SpawnNPC = {}
function SpawnNPC:Setup(UI)
Frame = UI
Frame.Button.MouseButton1Down:Connect(function()
self.Services.AnimalService.SpawnNPC:Fire()
end)
end
return SpawnNPC
|
--script.Parent.XX.Velocity = script.Parent.XX.CFrame.lookVector *script.Parent.Speed.Value
|
script.Parent.XXX.Velocity = script.Parent.XXX.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.Y.Velocity = script.Parent.Y.CFrame.lookVector *script.Parent.Speed.Value
|
--[[
--[Create a table containing some percentages, example table:
local GuitarChances = {["Red"] = 50, ["Blue"] = 25, ["Green"] = 10}
--you don't have to make the addition of the chances equal to 100, the script will auto-convert the chances.
]
--[Next Step, call the function and get the result! Example =
local GuitarChances = {["Red"] = 50, ["Blue"] = 25, ["Green"] = 10}
local SelectedGuitarColor = Roll(GuitarChances)
print(SelectedGuitarColor)
(this script will print a random guitar color with the chances In the table.)
]
pls leave a like if you don't mind :D
]]
|
function Roll(Chances)
local summary = 0
for index, chance in pairs(Chances) do
summary += chance
end
local NewChances = table.clone(Chances)
for index, Chance in pairs(NewChances) do
NewChances[index] = summary / (100 / Chance)
end
task.wait()
local RandomNumber = math.random(summary)
for index, chance in pairs(NewChances) do
local Result = index
local StartPoint, EndPoint = chance, 0
for NextIndex, NextChance in pairs(NewChances) do
if NextChance < chance then
StartPoint += NextChance; EndPoint += NextChance
elseif NextChance == chance and NextIndex ~= index then
StartPoint += NextChance
local Set = math.random(1,2)
if Set > 1 then
Result = NextIndex
end
end
end
if RandomNumber > EndPoint and RandomNumber <= StartPoint then
return Result
end
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2)
return u1.Functions.DegDeltaUnsafe(u1.Functions.DegNorm(p1), u1.Functions.DegNorm(p2));
end;
|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 20 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 30 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 40 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 60 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 70 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 1000 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = true -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Hot pink" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Top Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(2, 1, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, .38, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--[[ The Module ]]
|
--
local MouseLockController = {}
MouseLockController.__index = MouseLockController
function MouseLockController.new()
local self = setmetatable({}, MouseLockController)
self.isMouseLocked = false
self.savedMouseCursor = nil
self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift} -- defaults
self.mouseLockToggledEvent = Instance.new("BindableEvent")
local boundKeysObj = script:FindFirstChild("BoundKeys")
if (not boundKeysObj) or (not boundKeysObj:IsA("StringValue")) then
-- If object with correct name was found, but it's not a StringValue, destroy and replace
if boundKeysObj then
boundKeysObj:Destroy()
end
boundKeysObj = Instance.new("StringValue")
boundKeysObj.Name = "BoundKeys"
boundKeysObj.Value = "LeftShift,RightShift"
boundKeysObj.Parent = script
end
if boundKeysObj then
boundKeysObj.Changed:Connect(function(value)
self:OnBoundKeysObjectChanged(value)
end)
self:OnBoundKeysObjectChanged(boundKeysObj.Value) -- Initial setup call
end
-- Watch for changes to user's ControlMode and ComputerMovementMode settings and update the feature availability accordingly
GameSettings.Changed:Connect(function(property)
if property == "ControlMode" or property == "ComputerMovementMode" then
self:UpdateMouseLockAvailability()
end
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevEnableMouseLock"):Connect(function()
self:UpdateMouseLockAvailability()
end)
-- Watch for changes to DevEnableMouseLock and update the feature availability accordingly
PlayersService.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
self:UpdateMouseLockAvailability()
end)
self:UpdateMouseLockAvailability()
return self
end
function MouseLockController:GetIsMouseLocked()
return self.isMouseLocked
end
function MouseLockController:GetBindableToggleEvent()
return self.mouseLockToggledEvent.Event
end
function MouseLockController:GetMouseLockOffset()
local offsetValueObj = script:FindFirstChild("CameraOffset")
if offsetValueObj and offsetValueObj:IsA("Vector3Value") then
return offsetValueObj.Value
else
-- If CameraOffset object was found but not correct type, destroy
if offsetValueObj then
offsetValueObj:Destroy()
end
offsetValueObj = Instance.new("Vector3Value")
offsetValueObj.Name = "CameraOffset"
offsetValueObj.Value = Vector3.new(1.75,0,0) -- Legacy Default Value
offsetValueObj.Parent = script
end
if offsetValueObj and offsetValueObj.Value then
return offsetValueObj.Value
end
return Vector3.new(1.75,0,0)
end
function MouseLockController:UpdateMouseLockAvailability()
local devAllowsMouseLock = PlayersService.LocalPlayer.DevEnableMouseLock
local devMovementModeIsScriptable = PlayersService.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable
local userHasMouseLockModeEnabled = GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch
local userHasClickToMoveEnabled = GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove
local MouseLockAvailable = devAllowsMouseLock and userHasMouseLockModeEnabled and not userHasClickToMoveEnabled and not devMovementModeIsScriptable
if MouseLockAvailable~=self.enabled then
self:EnableMouseLock(MouseLockAvailable)
end
end
function MouseLockController:OnBoundKeysObjectChanged(newValue)
self.boundKeys = {} -- Overriding defaults, note: possibly with nothing at all if boundKeysObj.Value is "" or contains invalid values
for token in string.gmatch(newValue,"[^%s,]+") do
for _, keyEnum in pairs(Enum.KeyCode:GetEnumItems()) do
if token == keyEnum.Name then
self.boundKeys[#self.boundKeys+1] = keyEnum
break
end
end
end
self:UnbindContextActions()
self:BindContextActions()
end
|
--[[
Called when the watched state changes value.
]]
|
function class:update(): boolean
for callback in pairs(self._changeListeners) do
coroutine.wrap(callback)()
end
return false
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5
local slash_damage = 8
local lunge_damage = 17
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.1)
swordOut()
wait(.1)
force.Parent = nil
wait(.2)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--Main body parts
|
local myRoot = script.Parent:WaitForChild("HumanoidRootPart")
local myHuman = script.Parent:WaitForChild("Humanoid")
local upperTorso = script.Parent:WaitForChild("UpperTorso")
|
-- When supplied, legacyCameraType is used and cameraMovementMode is ignored (should be nil anyways)
-- Next, if userCameraCreator is passed in, that is used as the cameraCreator
|
function CameraModule:ActivateCameraController( cameraMovementMode, legacyCameraType )
local newCameraCreator = nil
if legacyCameraType~=nil then
--[[
This function has been passed a CameraType enum value. Some of these map to the use of
the LegacyCamera module, the value "Custom" will be translated to a movementMode enum
value based on Dev and User settings, and "Scriptable" will disable the camera controller.
--]]
if legacyCameraType == Enum.CameraType.Scriptable then
if self.activeCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = nil
return
end
elseif legacyCameraType == Enum.CameraType.Custom then
cameraMovementMode = self:GetCameraMovementModeFromSettings()
elseif legacyCameraType == Enum.CameraType.Track then
-- Note: The TrackCamera module was basically an older, less fully-featured
-- version of ClassicCamera, no longer actively maintained, but it is re-implemented in
-- case a game was dependent on its lack of ClassicCamera's extra functionality.
cameraMovementMode = Enum.ComputerCameraMovementMode.Classic
elseif legacyCameraType == Enum.CameraType.Follow then
cameraMovementMode = Enum.ComputerCameraMovementMode.Follow
elseif legacyCameraType == Enum.CameraType.Orbital then
cameraMovementMode = Enum.ComputerCameraMovementMode.Orbital
elseif legacyCameraType == Enum.CameraType.Attach or
legacyCameraType == Enum.CameraType.Watch or
legacyCameraType == Enum.CameraType.Fixed then
newCameraCreator = LegacyCamera
else
warn("CameraScript encountered an unhandled Camera.CameraType value: ",legacyCameraType)
end
end
if not newCameraCreator then
if cameraMovementMode == Enum.ComputerCameraMovementMode.Classic or
cameraMovementMode == Enum.ComputerCameraMovementMode.Follow or
cameraMovementMode == Enum.ComputerCameraMovementMode.Default then
newCameraCreator = ClassicCamera
elseif cameraMovementMode == Enum.ComputerCameraMovementMode.Orbital then
newCameraCreator = OrbitalCamera
else
warn("ActivateCameraController did not select a module.")
return
end
end
-- Create the camera control module we need if it does not already exist in instantiatedCameraControllers
local newCameraController = nil
if not instantiatedCameraControllers[newCameraCreator] then
newCameraController = newCameraCreator.new()
instantiatedCameraControllers[newCameraCreator] = newCameraController
else
newCameraController = instantiatedCameraControllers[newCameraCreator]
end
-- If there is a controller active and it's not the one we need, disable it,
-- if it is the one we need, make sure it's enabled
if self.activeCameraController then
if self.activeCameraController ~= newCameraController then
self.activeCameraController:Enable(false)
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
elseif not self.activeCameraController:GetEnabled() then
self.activeCameraController:Enable(true)
end
elseif newCameraController ~= nil then
self.activeCameraController = newCameraController
self.activeCameraController:Enable(true)
end
if self.activeCameraController then
if cameraMovementMode~=nil then
self.activeCameraController:SetCameraMovementMode(cameraMovementMode)
elseif legacyCameraType~=nil then
-- Note that this is only called when legacyCameraType is not a type that
-- was convertible to a ComputerCameraMovementMode value, i.e. really only applies to LegacyCamera
self.activeCameraController:SetCameraType(legacyCameraType)
end
end
end
|
--------------------------------------------
|
local Signal = {}
Signal.__index = Signal
function Signal.new()
local self = setmetatable({
_bindable = Instance.new("BindableEvent");
_connections = {};
_args = {};
_threads = 0;
_id = 0;
}, Signal)
return self
end
function Signal.Is(obj)
return (type(obj) == "table" and getmetatable(obj) == Signal)
end
function Signal:Fire(...)
local id = self._id
self._id = self._id + 1
self._args[id] = {#self._connections + self._threads, {n = select("#", ...), ...}}
self._threads = 0
self._bindable:Fire(id)
end
function Signal:Wait()
self._threads = self._threads + 1
local id = self._bindable.Event:Wait()
local args = self._args[id]
args[1] = args[1] - 1
if (args[1] <= 0) then
self._args[id] = nil
end
return table.unpack(args[2], 1, args[2].n)
end
function Signal:WaitPromise()
return Promise.new(function(resolve)
resolve(self:Wait())
end)
end
function Signal:Connect(handler)
local connection = Connection.new(self, self._bindable.Event:Connect(function(id)
local args = self._args[id]
args[1] = args[1] - 1
if (args[1] <= 0) then
self._args[id] = nil
end
handler(table.unpack(args[2], 1, args[2].n))
end))
table.insert(self._connections, connection)
return connection
end
function Signal:DisconnectAll()
for _,c in ipairs(self._connections) do
if (c._conn) then
c._conn:Disconnect()
end
end
self._connections = {}
self._args = {}
end
function Signal:Destroy()
self:DisconnectAll()
self._bindable:Destroy()
end
function Signal:Init()
Promise = self.Shared.Promise
end
return Signal
|
--("found vehicle gui - deleting")
|
pl.PlayerGui:findFirstChild("VehicleGui").Parent=nil
|
--Internal Settings--
|
local fullMag = 30
local spread = 1.1 -- in degrees
local fullauto = true -- shoots all bullets as long as the player is visible (boolean)
local burstamount = 3 -- (only works if full auto is off) amount of times gun fires in burst fire mode
local firerate = 0.08 -- in seconds
local shotgunpellets = 1 -- setting this above 1 turns the gun into a shotgun (MIGHT LAG WITH FULL AUTO ON)
local delaybeforereloading = 0.3 -- to delay reload (prevents the marine from shooting the last shot of the mag at the ground)
local MinimumDamage,MaximumDamage = 9, 13 -- the amount of damage each bullet does (RANDOMIZED) first value is minimum, second value is maximum
local headshotmultiplier = 2 -- self explanitory (set this value to 1 if you dont want a multiplier)
local HitWallSounds = {"rbxassetid://6962153997","rbxassetid://6962154328","rbxassetid://6962154691","rbxassetid://6962155018","rbxassetid://6962155378"} -- basically sounds for hitting walls
local HitFleshSound = "rbxassetid://4988621968" -- plays when a creature gets shot
local bulletacceleration = Vector3.new(0,0,0) -- very similar to how acceleration works in particle emitters (setting the y value to a negative number will give the bullet bulletdrop)
local maxdistance = 300
local bulletspeed = 400
|
-- Model name
|
print("Blackeyei's Arc Window Loaded")
|
-----------------
--| Variables |--
-----------------
|
local Tool = script.Parent
local ScytheEquipAnimation = WaitForChild(script, 'ScytheEquip2')
local ScytheIdleAnimation = WaitForChild(script, 'ScytheIdle2')
local ScytheSlashAnimation = WaitForChild(script, 'ScytheSlash')
local ScytheEquipTrack = nil
local ScytheIdleTrack = nil
local ScytheSlashTrack = nil
|
--local busy = false
--Shield.Touched:connect(function(Hit)
-- if Hit == nil then return end
-- if Hit.Parent == nil then return end
-- if busy == true then return end
--
-- busy = true
--
-- local Item = Hit.Parent
--
-- if Item:IsA("Tool") == true then return end
-- if Hit.Name == "Torso" then return end
-- if Hit.Name == "HumanoidRootPart" then return end
-- if Hit.Name == "Left Leg" then return end
-- if Hit.Name == "Right Leg" then return end
-- if Hit.Name == "Head" then return end
-- if Hit.Name == "Left Arm" then return end
-- if Hit.Name == "Right Arm" then return end
--
-- if Game:GetService("Players"):GetPlayerFromCharacter(Item) ~= nil then return end
--
-- local touch = false
-- for _, x in ipairs(Hit:GetChildren()) do
-- if x:IsA("TouchTransmitter") == true then touch = true x:Destroy() break end
-- end
--
-- local owner, dmg = GetOwnerAndDamage(Hit)
-- if owner ~= nil and dmg ~= nil then
-- if Health > 0 then
-- if Health >= dmg then
-- Health = Health - dmg
--
-- if Health < 0 then Health = 0 end
--
-- HealthBar.Shield.Bar:TweenSize(UDim2.new((Health / MaxHealth), 0, 1, 0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 0.5, true)
--
-- if Health > 0 then
-- -- yay, still alive.
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
--
-- Hit:Destroy()
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
-- else
-- HealthBar.Parent.Parent:Destroy()
-- end
-- else
-- if touch == true then
-- --Hit:Destroy()
-- end
-- end
--
-- busy = false
--end)
| |
--local springStiffness = gravityChange * strutSpring.Stiffness
--local springDamping = math.sqrt( gravityChange ) * strutSpring.Damping
|
local breakingTorque = 70000 * gravityChange
local steerMax
|
-- Setup animation objects
|
function scriptChildModified(child)
local fileList = animNames[child.Name]
if (fileList ~= nil) then
configureAnimationSet(child.Name, fileList)
else
if child:isA("StringValue") then
animNames[child.Name] = {}
configureAnimationSet(child.Name, animNames[child.Name])
end
end
end
script.ChildAdded:connect(scriptChildModified)
script.ChildRemoved:connect(scriptChildModified)
|
--- TagHumanoid
|
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
|
--RedEgg--
|
Event.Hitbox.Touched:Connect(function(hit)
if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired1 then
if game.ReplicatedStorage.ItemSwitching.Value == true then
hit.Parent:Destroy()
end
Event.Hitbox.RedGearHint:Destroy()
Event.RedGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
Event.Hitbox.ClickDetector.MouseClick:Connect(function(plr)
if plr.Backpack:FindFirstChild(ToolRequired1) then
if game.ReplicatedStorage.ItemSwitching.Value == true then
plr.Backpack:FindFirstChild(ToolRequired1):Destroy()
end
Event.Hitbox.RedGearHint:Destroy()
Event.RedGear.Transparency = 0
Event.Glass.Insert:Play()
Event.LocksLeft.Value = Event.LocksLeft.Value - 1
script.Disabled = true
end
end)
|
--Changes the size of the part----------
|
local function ModifyScale(Scale, Plot, Grid, Model)
X, Y, Z = unpack(Scale)
if X == "" or Y == "" or Z == "" then
X = random:NextInteger(1, Plot.Size.X/5)
Y = random:NextInteger(1, 20)
Z = random:NextInteger(1, Plot.Size.Z/5)
end
X = math.clamp(tonumber(X), 1, 78)
Y = math.clamp(tonumber(Y), 1, 512)
Z = math.clamp(tonumber(Z), 1, 78)
Confirm(Grid, Plot)
Model.PrimaryPart.Size = Vector3.new(X, Y, Z)
Model.Hull.Size = Model.PrimaryPart.Size
return true
end
|
--[=[
Returns a tuple of fail and complete functions which
can be chained into the the next subscription.
```lua
return function(source)
return Observable.new(function(sub)
return source:Subscribe(function(result)
sub:Fire(tostring(result))
end, sub:GetFailComplete()) -- Reuse is easy here!
end)
end
```
@return function
@return function
]=]
|
function Subscription:GetFailComplete()
return function(...)
self:Fail(...)
end, function(...)
self:Complete(...)
end
end
|
--[=[
Converts the string to _privateCamelCase
@param str string
@return string
]=]
|
function String.toPrivateCase(str: string): string
return "_" .. str:sub(1, 1):lower() .. str:sub(2, #str)
end
|
--game.Players.PlayerAdded:Connect(function(p)
-- phs:CreateCollisionGroup(p.Name)
-- phs:CollisionGroupSetCollidable(p.Name,p.Name,true)
-- for i,v in pairs(game.Players:GetChildren()) do
-- if v ~= p then
-- phs:CollisionGroupSetCollidable(p.Name,v.Name,false)
-- end
-- end
-- p.CharacterAdded:connect(function(c)
-- for i,v in pairs(c:GetChildren()) do
-- if v:IsA("BasePart") then
-- phs:SetPartCollisionGroup(v,p.Name)
-- end
-- end
-- c.ChildAdded:connect(function(v)
-- if v:IsA("BasePart") then
-- phs:SetPartCollisionGroup(v,p.Name)
-- end
-- end)
-- end)
--end)
--
--game.Players.PlayerRemoving:Connect(function(p)
-- phs:RemoveCollisionGroup(p.Name)
--end)
| |
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -0.95, 0) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--[[
TouchThumbstick
--]]
|
local Players = game:GetService("Players")
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
|
--// Input Connections
|
L_71_.InputBegan:connect(function(L_229_arg1, L_230_arg2)
if not L_230_arg2 and L_14_ then
if L_229_arg1.UserInputType == Enum.UserInputType.MouseButton2 and L_21_.CanAim and not L_51_ and L_14_ and not L_43_ and not L_44_ then
if not L_41_ then
if not L_42_ then
L_3_.Humanoid.WalkSpeed = 10
L_109_ = 10
L_108_ = 0.008
end
L_64_ = L_31_
L_91_.target = L_34_.CFrame:toObjectSpace(L_25_.CFrame).p
L_41_ = true
end
end;
if L_229_arg1.UserInputType == Enum.UserInputType.MouseButton1 and L_46_ and L_14_ and not L_43_ and not L_44_ and not L_51_ then
L_45_ = true
if not Shooting and L_14_ and L_68_ > 0 then
Shoot()
end
end;
if L_229_arg1.KeyCode == L_21_.LaserKey and L_14_ and L_21_.LaserAttached then
local L_231_ = L_1_:FindFirstChild("LaserLight")
L_80_.KeyDown[1].Plugin()
end;
if L_229_arg1.KeyCode == L_21_.LightKey and L_14_ and L_21_.LightAttached then
local L_232_ = L_1_:FindFirstChild("FlashLight"):FindFirstChild('Light')
local L_233_ = false
L_232_.Enabled = not L_232_.Enabled
end;
if L_14_ and L_229_arg1.KeyCode == L_21_.FireSelectKey and not L_47_ then
L_47_ = true
if L_59_ == 1 then
if Shooting then
Shooting = false
end
if L_21_.AutoEnabled then
L_59_ = 2
elseif not L_21_.AutoEnabled and L_21_.BurstEnabled then
L_59_ = 3
elseif not L_21_.AutoEnabled and not L_21_.BurstEnabled and L_21_.BoltAction then
L_59_ = 4
elseif not L_21_.AutoEnabled and not L_21_.BurstEnabled and not L_21_.BoltAction then
L_59_ = 1
end
elseif L_59_ == 2 then
if Shooting then
Shooting = false
end
if L_21_.BurstEnabled then
L_59_ = 3
elseif not L_21_.BurstEnabled and L_21_.BoltAction then
L_59_ = 4
elseif not L_21_.BurstEnabled and not L_21_.BoltAction and L_21_.SemiEnabled then
L_59_ = 1
elseif not L_21_.BurstEnabled and not L_21_.BoltAction and not L_21_.SemiEnabled then
L_59_ = 2
end
elseif L_59_ == 3 then
if Shooting then
Shooting = false
end
if L_21_.BoltAction then
L_59_ = 4
elseif not L_21_.BoltAction and L_21_.SemiEnabled then
L_59_ = 1
elseif not L_21_.BoltAction and not L_21_.SemiEnabled and L_21_.AutoEnabled then
L_59_ = 2
elseif not L_21_.BoltAction and not L_21_.SemiEnabled and not L_21_.AutoEnabled then
L_59_ = 3
end
elseif L_59_ == 4 then
if Shooting then
Shooting = false
end
if L_21_.SemiEnabled then
L_59_ = 1
elseif not L_21_.SemiEnabled and L_21_.AutoEnabled then
L_59_ = 2
elseif not L_21_.SemiEnabled and not L_21_.AutoEnabled then
L_59_ = 3
elseif not L_21_.SemiEnabled and not L_21_.AutoEnabled and not L_21_.BurstEnabled then
L_59_ = 4
end
end
L_47_ = false
end;
if L_229_arg1.KeyCode == Enum.KeyCode.F and not L_44_ and not L_47_ and not L_41_ and not L_43_ and not Shooting then
if not L_50_ and not L_51_ then
L_51_ = true
Shooting = false
L_46_ = false
L_93_ = time()
delay(0.6, function()
if L_68_ ~= L_21_.Ammo and L_68_ > 0 then
CreateShell()
end
end)
BoltBackAnim()
L_50_ = true
elseif L_50_ and L_51_ then
BoltForwardAnim()
Shooting = false
L_46_ = true
if L_68_ ~= L_21_.Ammo and L_68_ > 0 then
L_68_ = L_68_ - 1
elseif L_68_ >= L_21_.Ammo then
L_46_ = true
end
L_50_ = false
L_51_ = false
IdleAnim()
L_52_ = false
end
end;
if L_229_arg1.KeyCode == Enum.KeyCode.LeftShift and L_104_ then
L_48_ = true
if L_14_ and not L_47_ and not L_44_ and L_48_ and not L_42_ and not L_51_ then
Shooting = false
L_41_ = false
L_44_ = true
delay(0, function()
if L_44_ and not L_43_ then
L_41_ = false
L_49_ = true
end
end)
L_64_ = 80
L_3_.Humanoid.WalkSpeed = 21
L_109_ = 21
L_108_ = 0.4
end
end;
if L_229_arg1.KeyCode == Enum.KeyCode.R and L_14_ and not L_43_ and not L_41_ and not Shooting and not L_44_ and not L_51_ then
if L_69_ > 0 and L_68_ < L_21_.Ammo then
Shooting = false
L_43_ = true
ReloadAnim()
if L_68_ <= 0 then
BoltBackAnim()
BoltForwardAnim()
L_46_ = true
end
IdleAnim()
if L_68_ <= 0 then
if (L_69_ - (L_21_.Ammo - L_68_)) < 0 then
L_68_ = L_68_ + L_69_
L_69_ = 0
else
L_69_ = L_69_ - (L_21_.Ammo - L_68_)
L_68_ = L_21_.Ammo
end
elseif L_68_ > 0 then
if (L_69_ - (L_21_.Ammo - L_68_)) < 0 then
L_68_ = L_68_ + L_69_ + 1
L_69_ = 0
else
L_69_ = L_69_ - (L_21_.Ammo - L_68_)
L_68_ = L_21_.Ammo + 1
end
end
L_43_ = false
if not L_52_ then
L_46_ = true
end
end
end;
if L_229_arg1.KeyCode == Enum.KeyCode.RightBracket then
if (L_32_ < 1) then
L_32_ = L_32_ + L_21_.SensitivityIncrement
end
end
if L_229_arg1.KeyCode == Enum.KeyCode.LeftBracket then
if (L_32_ > 0.1) then
L_32_ = L_32_ - L_21_.SensitivityIncrement
end
end
if L_229_arg1.KeyCode == Enum.KeyCode.T and L_1_:FindFirstChild("AimPart2") then
if not L_53_ then
L_34_ = L_1_:WaitForChild("AimPart2")
L_31_ = L_21_.CycleAimZoom
if L_41_ then
L_64_ = L_21_.CycleAimZoom
end
L_53_ = true
else
L_34_ = L_1_:FindFirstChild("AimPart")
L_31_ = L_21_.AimZoom
if L_41_ then
L_64_ = L_21_.AimZoom
end
L_53_ = false
end;
end;
end
end)
L_71_.InputEnded:connect(function(L_234_arg1, L_235_arg2)
if not L_235_arg2 and L_14_ then
if L_234_arg1.UserInputType == Enum.UserInputType.MouseButton2 and L_21_.CanAim then
if L_41_ then
if not L_42_ then
L_3_.Humanoid.WalkSpeed = 16
L_109_ = 17
L_108_ = .25
end
L_64_ = 70
L_91_.target = Vector3.new()
L_41_ = false
end
end;
if L_234_arg1.UserInputType == Enum.UserInputType.MouseButton1 then
L_45_ = false
if Shooting then
Shooting = false
end
end;
if L_234_arg1.KeyCode == Enum.KeyCode.LeftShift and not L_47_ and not L_42_ then -- SPRINT
L_48_ = false
if L_44_ and not L_41_ and not Shooting and not L_48_ then
L_44_ = false
L_49_ = false
L_64_ = 70
L_3_.Humanoid.WalkSpeed = 16
L_109_ = 17
L_108_ = .25
end
end;
end
end)
L_71_.InputChanged:connect(function(L_236_arg1, L_237_arg2)
if not L_237_arg2 and L_14_ and L_21_.FirstPersonOnly then
if L_236_arg1.UserInputType == Enum.UserInputType.MouseWheel then
if L_236_arg1.Position.Z == 1 and (L_32_ < 1) then
L_32_ = L_32_ + L_21_.SensitivityIncrement
elseif L_236_arg1.Position.Z == -1 and (L_32_ > 0.1) then
L_32_ = L_32_ - L_21_.SensitivityIncrement
end
end
end
end)
|
--[[
local TypeDefs = require(script.TypeDefinitions)
type CanPierceFunction = TypeDefs.CanPierceFunction
type GenericTable = TypeDefs.GenericTable
type Caster = TypeDefs.Caster
type FastCastBehavior = TypeDefs.FastCastBehavior
type CastTrajectory = TypeDefs.CastTrajectory
type CastStateInfo = TypeDefs.CastStateInfo
type CastRayInfo = TypeDefs.CastRayInfo
type ActiveCast = TypeDefs.ActiveCast
--]]
| |
--[[
CameraUtils - Math utility functions shared by multiple camera scripts
2018 Camera Update - AllYourBlox
--]]
|
local CameraUtils = {}
local function round(num)
return math.floor(num + 0.5)
end
|
--local part2 = Instance.new("Part")
--if Instance.Lock(part2) then
-- Instance.Unlock(part2)
--end
|
Tool.Equipped:connect(onEquippedLocal)
Tool.Unequipped:connect(onUnequippedLocal)
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 2 -- cooldown for use of the tool again
ZoneModelName = "Bullet 3" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--[[
NVNA Constraint Type: Motorcycle
The Bike Chassis | Build: 1
Version: 1
Avxnturador | NVNA
HAYASHl | Enjin
You're advised not to touch anything below.
]]
|
--
|
--vars
|
local state = "unequipped"
local adsing = sefal
local rstepgun
local savedfov
local currentlyfps = false
offset = CFrame.new()
|
-- perform the update loop
-- do the R6 update loop
|
stepped_con = game:GetService("RunService").RenderStepped:Connect(function()
debug.profilebegin("FPS")
swaysize = script.WalkSwayMultiplier.Value
-- checkfirstperson() checks if camera is first person and enables/disables the viewmodel accordingly
checkfirstperson()
-- update loop
if isfirstperson == true then
local modifierr = 0
local statething = player:GetAttribute('State')
-- make arms visible
if larm.LocalTransparencyModifier ~= 0 then
visiblearms(true)
end
-- update walk sway if we are walking
if isrunning == true and includewalksway and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and humanoid:GetState() ~= Enum.HumanoidStateType.Landed then
walksway = walksway:lerp(
CFrame.new(
(0.07*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4)),
(0.07*swaysize) * math.cos(tick() * (4 * humanoid.WalkSpeed/4)),
0
)*
CFrame.Angles(
0,
0,
(-.03*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4))
)
,0.2*sensitivity)
else
walksway = walksway:Lerp(CFrame.new(), 0.05*sensitivity)
end
--
local delta = uis:GetMouseDelta()
--
if includecamerasway then
sway = sway:Lerp(Vector3.new(delta.X,delta.Y,delta.X/2), 0.1*sensitivity)
end
--
if includestrafe then
strafesway = strafesway:Lerp(CFrame.Angles(0,0,-rootpart.CFrame.rightVector:Dot(humanoid.MoveDirection)/(20/swaysize)), 0.1*sensitivity)
end
--
if includejumpsway == true then
jumpsway = jumpswaygoal.Value
end
-- update animation transform for viewmodel
rightshoulderclone.Transform = rightshoulder.Transform
leftshoulderclone.Transform = leftshoulder.Transform
-- cframe the viewmodel
if statething ~= nil and statething == "Crouching" and player.Character:FindFirstChildWhichIsA("Tool") then
modifierr = 20
end
if statething ~= nil and statething == "Crawling" and player.Character:FindFirstChildWhichIsA("Tool") then
modifierr = 80
end
local CamY, CamX, CamZ = camera.CFrame:ToEulerAnglesYXZ()
local direction = Vector2.new(
math.rad(player.Character.HumanoidRootPart.CFrame.RightVector:Dot((-player.Character.HumanoidRootPart.Velocity * Vector3.new(1,0,1)).Unit) * 200),
math.rad(player.Character.HumanoidRootPart.CFrame.LookVector:Dot((-player.Character.HumanoidRootPart.Velocity * Vector3.new(1,0,1)).Unit) * 200)
)
local tilt = direction.Unit * math.clamp((player.Character.HumanoidRootPart.Velocity.Magnitude / 14), 0, 2)
local firstframe = CFrame.new( Vector3.new(camera.CFrame.Position.X,camera.CFrame.Position.Y,camera.CFrame.Position.Z) ) * CFrame.fromEulerAnglesXYZ(CamY + math.rad(modifierr),0,0)
local TorsX,TorsY,TorsZ = player.Character.Torso.CFrame.Rotation:ToEulerAnglesXYZ()
local torsoframe = CFrame.Angles(TorsX,TorsY,TorsZ)
local countercf = CFrame.new()
if script.CFrameAimOffset.Value.Position.X ~= 0 or not (script.CFrameAimOffset.Value.Position.X <= 0.1) then
--countercf = CFrame.Angles(math.rad(-tilt.Y * 3),math.rad(-tilt.X * 4),math.rad(-tilt.X * 6))
end
local finalcf = (CFrame.new(firstframe.Position)*torsoframe*firstframe.Rotation*walksway*jumpsway*strafesway*countercf*CFrame.Angles(math.rad(sway.Y*swaysize),math.rad(sway.X*swaysize)/10,math.rad(sway.Z*swaysize)/2))+(camera.CFrame.UpVector*(-1.7-(headoffset.Y+(aimoffset.Value.Y))))+(camera.CFrame.LookVector*(headoffset.Z+(aimoffset.Value.Z)))+(camera.CFrame.RightVector*(-headoffset.X-(aimoffset.Value.X)+(-(sway.X*swaysize)/75)))
local builtcf = finalcf * script.CFrameAimOffset.Value:Inverse()
viewmodel:SetPrimaryPartCFrame(builtcf)
end
debug.profileend()
end)
|
--!strict
|
local Types = require(script.Parent.Parent.Parent.Types)
return function(excludedPlayers: Types.Array<Player>): Types.PlayerContainer
return { kind = "except", value = excludedPlayers }
end
|
-- ROBLOX deviation START: Polyfill Math.trunc
|
local function mathTrunc(value: number): number
return if value > 0 then math.floor(value) else math.ceil(value)
end
|
-- To change the sound ID of a material, change the 'id' variable.
-- To change the volume, change the volume variable.
-- To change the playback speed of a sound, change the speed variable.
|
local IDList = {
Air = {id = "rbxassetid://329997777", volume = 0, speed = 1.00},
Asphalt = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Basalt = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Brick = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Cobblestone = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Concrete = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
CorrodedMetal = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
CrackedLava = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
DiamondPlate = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Fabric = {id = "rbxassetid://4416041299", volume = 0.40, speed = 1.00},
Foil = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Forcefield = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Glass = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Granite = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Grass = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Glacier = {id = "rbxassetid://4416041299", volume = 0.40, speed = 1.00},
Ground = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Ice = {id = "rbxassetid://4416041299", volume = 0.40, speed = 1.00},
Limestone = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
LeafyGrass = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Marble = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Metal = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Mud = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Neon = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Pebble = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Plastic = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Pavement = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Rock = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Sand = {id = "rbxassetid://4416041299", volume = 0.40, speed = 1.00},
Slate = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Snow = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Salt = {id = "rbxassetid://4416041299", volume = 0.40, speed = 1.00},
Sandstone = {id = "rbxassetid://4416041299", volume = 0.60, speed = 0.75},
SmoothPlastic = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
Wood = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00},
WoodPlanks = {id = "rbxassetid://4416041299", volume = 0.60, speed = 1.00}
}
return IDList
|
--------AUDIENCE BACK RIGHT--------
|
game.Workspace.audiencebackright1.Part3.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part6.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.audiencebackright1.Part9.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
|
--- Skill
|
repeat wait() until game.Players.LocalPlayer.Character
local plr = game.Players.LocalPlayer
local char = plr.Character
local hum = char:WaitForChild("Humanoid")
local Torso = char:WaitForChild("LowerTorso")
local Mouse = plr:GetMouse()
local toggle = false
local Debounce = true
Mouse.KeyDown:Connect(function(key)
if key == "f" and Tool.Equip.Value == true and Tool.Active.Value == "None" or Tool.Active.Value == "FireFlight" then
if toggle == false and Debounce == true then
toggle = true
local Anim = Instance.new("Animation")
Anim.AnimationId = "rbxassetid://4598627471"
local PlayAnim = hum:LoadAnimation(Anim)
PlayAnim:Play()
Debounce = false
Tool.Active.Value = "FireFlight"
script.Fire:FireServer(plr)
local BV = Instance.new("BodyVelocity",Torso)
BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
while toggle == true do
wait()
plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Vector3.new(Mouse.Hit.p.x,plr.Character.HumanoidRootPart.Position.y,Mouse.Hit.p.z))
BV.Velocity = Mouse.Hit.lookVector * 40
end
end
if toggle == true and Debounce == false then
toggle = false
Tool.Active.Value = "None"
script.UnFire:FireServer(plr)
Torso:FindFirstChildOfClass("BodyVelocity"):Destroy()
local tracks = hum:GetPlayingAnimationTracks()
for i, stoptracks in pairs(tracks) do
stoptracks:Stop()
end
local Anim = Instance.new("Animation")
Anim.AnimationId = "http://www.roblox.com/asset/?id=507767968"
local PlayAnim = hum:LoadAnimation(Anim)
PlayAnim:Play()
wait(3.5)
Debounce = true
end
end
end)
|
-- deviation: Lua objects don't have any special properties the way that JS
-- Objects do; this has been modified from the JS, which uses
-- `Object.defineProperties` to ensure that properties are modifiable. In Lua,
-- these operations are as simple as assigning to functions.
-- ROBLOX: use patched console from shared
|
local console = require(script.Parent.console)
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.L.Value == true then --because you can't get in a locked car
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
script.Parent.Occupied.Value = true
script.Parent.Parent.Body.Dash.Spd.Interface.Enabled = true
script.Parent.Parent.Body.Dash.Tac.Interface.Enabled = true
script.Parent.Parent.Body.Lights.Runner.Material = "Neon"
script.Parent.Parent.Body.Dash.Screen.G.Enabled = true
script.Parent.Parent.Body.Dash.Screen.G.Startup.Visible = true
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Visible = true
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Info.Value = true
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Speed.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.Version.Value = false
script.Parent.Parent.DriveSeat.SS3.DashInfoSpeed.MPG.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMOne.Value = true
script.Parent.Parent.DriveSeat.SS3.Radios.FMTwo.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMThree.Value = false
script.Parent.Parent.DriveSeat.SS3.Radios.FMFour.Value = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.Info.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Modes.Stats.Visible = false
script.Parent.Parent.Body.Dash.DashSc.G.Frame.Position = UDim2.new(0, 0, 0, -5)
script.Parent.Parent.Body.Dash.DashSc.G.Select.Position = UDim2.new(0, 0, 0, -5)
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Text = "Welcome"
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.9
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.8
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.7
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.6
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.4
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.3
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 1.5
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 1.5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0.7
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.2
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 1
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 1
script.Parent.Parent.Body.Dash.DashSc.G.Select:TweenPosition(UDim2.new(0, 0, 0, 20), "InOut", "Quint", 1, true)
script.Parent.Parent.Body.Dash.DashSc.G.Frame:TweenPosition(UDim2.new(0, 0, 0, 20), "InOut", "Quint", 1, true)
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0.4
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0.1
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = .5
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = .5
wait(0.2)
script.Parent.Parent.Body.Dash.DashSc.G.Car.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Speed.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Info1.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.Gas.ImageTransparency = 0
script.Parent.Parent.Body.Dash.DashSc.G.ImageLabel.ImageTransparency = 0
script.Parent.Parent.Body.Dash.Spd.Interface.LightInfluence = 0
script.Parent.Parent.Body.Dash.Tac.Interface.LightInfluence = 0
wait(2.2)
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Position = UDim2.new(0, 0, 0, 0)
script.Parent.Parent.Body.Dash.DashSc.G.Modes.SpeedStats.Visible = true
script.Parent.Parent.Body.Dash.DashSc.G.Unit.Visible = false
script.Parent.Parent.Body.Dash.Screen.G.Startup.Visible = false
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = true
wait(6)
script.Parent.Parent.Body.Dash.Screen.G.Caution.Visible = false
|
--load settings
|
local sp,amt,max,def = script.RegenSpeed.Value, script.RegenAmt.Value, script.MaxAmt.Value, script.DefaultAmt.Value
|
--[[
These messages are used by Component to help users diagnose when they're
calling setState in inappropriate places.
The indentation may seem odd, but it's necessary to avoid introducing extra
whitespace into the error messages themselves.
]]
|
local ComponentLifecyclePhase = require(script.Parent.ComponentLifecyclePhase)
local invalidSetStateMessages = {}
invalidSetStateMessages[ComponentLifecyclePhase.WillUpdate] = [[
setState cannot be used in the willUpdate lifecycle method.
Consider using the didUpdate method instead, or using getDerivedStateFromProps.
Check the definition of willUpdate in the component %q.]]
invalidSetStateMessages[ComponentLifecyclePhase.ShouldUpdate] = [[
setState cannot be used in the shouldUpdate lifecycle method.
shouldUpdate must be a pure function that only depends on props and state.
Check the definition of shouldUpdate in the component %q.]]
invalidSetStateMessages[ComponentLifecyclePhase.Render] = [[
setState cannot be used in the render method.
render must be a pure function that only depends on props and state.
Check the definition of render in the component %q.]]
invalidSetStateMessages["default"] = [[
setState can not be used in the current situation, because Roact doesn't know
which part of the lifecycle this component is in.
This is a bug in Roact.
It was triggered by the component %q.
]]
return invalidSetStateMessages
|
-- Scenes
|
while true do
for i, v in pairs(scenes:GetChildren()) do
if looping == false then return end
cam.CFrame = v["1"].CFrame
currentTween = tween:Create(cam, TweenInfo.new(10), {CFrame = v["2"].CFrame})
currentTween:Play()
wait(10)
end
end
|
-----------------------------------PATHER--------------------------------------
|
local popupAdornee
local function getPopupAdorneePart()
--Handle the case of the adornee part getting deleted (camera changed, maybe)
if popupAdornee and not popupAdornee.Parent then
popupAdornee = nil
end
--If the adornee doesn't exist yet, create it
if not popupAdornee then
popupAdornee = Instance.new("Part")
popupAdornee.Name = "ClickToMovePopupAdornee"
popupAdornee.Transparency = 1
popupAdornee.CanCollide = false
popupAdornee.Anchored = true
popupAdornee.Size = Vector3.new(2, 2, 2)
popupAdornee.CFrame = CFrame.new()
popupAdornee.Parent = workspace.CurrentCamera
end
return popupAdornee
end
local activePopups = {}
local function createNewPopup(popupType)
local newModel = Instance.new("ImageHandleAdornment")
newModel.AlwaysOnTop = false
newModel.Transparency = 1
newModel.Size = ZERO_VECTOR2
newModel.SizeRelativeOffset = ZERO_VECTOR3
newModel.Image = "rbxasset://textures/ui/move.png"
newModel.ZIndex = 20
local radius = 0
if popupType == "DestinationPopup" then
newModel.Color3 = Color3.fromRGB(0, 175, 255)
radius = 1.25
elseif popupType == "DirectWalkPopup" then
newModel.Color3 = Color3.fromRGB(0, 175, 255)
radius = 1.25
elseif popupType == "FailurePopup" then
newModel.Color3 = Color3.fromRGB(255, 100, 100)
radius = 1.25
elseif popupType == "PatherPopup" then
newModel.Color3 = Color3.fromRGB(255, 255, 255)
radius = 1
newModel.ZIndex = 10
end
newModel.Size = Vector2.new(5, 0.1) * radius
local dataStructure = {}
dataStructure.Model = newModel
activePopups[#activePopups + 1] = newModel
function dataStructure:TweenIn()
local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Elastic, Enum.EasingDirection.Out)
local tween1 = TweenService:Create(newModel, tweenInfo, { Size = Vector2.new(2,2) * radius })
tween1:Play()
TweenService:Create(newModel, TweenInfo.new(0.25, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0, false, 0.1), { Transparency = 0, SizeRelativeOffset = Vector3.new(0, radius * 1.5, 0) }):Play()
return tween1
end
function dataStructure:TweenOut()
local tweenInfo = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.In)
local tween1 = TweenService:Create(newModel, tweenInfo, { Size = ZERO_VECTOR2 })
tween1:Play()
coroutine.wrap(function()
tween1.Completed:Wait()
for i = 1, #activePopups do
if activePopups[i] == newModel then
table.remove(activePopups, i)
break
end
end
end)()
return tween1
end
function dataStructure:Place(position, dest)
-- place the model at position
if not self.Model.Parent then
local popupAdorneePart = getPopupAdorneePart()
self.Model.Parent = popupAdorneePart
self.Model.Adornee = popupAdorneePart
--Start the 10-stud long ray 2.5 studs above where the tap happened and point straight down to try to find
--the actual ground position.
local ray = Ray.new(position + Vector3.new(0, 2.5, 0), Vector3.new(0, -10, 0))
local hitPart, hitPoint, hitNormal = workspace:FindPartOnRayWithIgnoreList(ray, { workspace.CurrentCamera, Player.Character })
self.Model.CFrame = CFrame.new(hitPoint) + Vector3.new(0, -radius,0)
end
end
return dataStructure
end
local function createPopupPath(points, numCircles)
-- creates a path with the provided points, using the path and number of circles provided
local popups = {}
local stopTraversing = false
local function killPopup(i)
-- kill all popups before and at i
for iter, v in pairs(popups) do
if iter <= i then
local tween = v:TweenOut()
spawn(function()
tween.Completed:Wait()
v.Model:Destroy()
end)
popups[iter] = nil
end
end
end
local function stopFunction()
stopTraversing = true
killPopup(#points)
end
spawn(function()
for i = 1, #points do
if stopTraversing then
break
end
local includeWaypoint = i % numCircles == 0
and i < #points
and (points[#points].Position - points[i].Position).magnitude > 4
if includeWaypoint then
local popup = createNewPopup("PatherPopup")
popups[i] = popup
local nextPopup = points[i+1]
popup:Place(points[i].Position, nextPopup and nextPopup.Position or points[#points].Position)
local tween = popup:TweenIn()
wait(0.2)
end
end
end)
return stopFunction, killPopup
end
local function Pather(character, endPoint, surfaceNormal)
local this = {}
this.Cancelled = false
this.Started = false
this.Finished = Instance.new("BindableEvent")
this.PathFailed = Instance.new("BindableEvent")
this.PathComputing = false
this.PathComputed = false
this.TargetPoint = endPoint
this.TargetSurfaceNormal = surfaceNormal
this.DiedConn = nil
this.SeatedConn = nil
this.MoveToConn = nil
this.BlockedConn = nil
this.CurrentPoint = 0
function this:Cleanup()
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
if this.MoveToConn then
this.MoveToConn:Disconnect()
this.MoveToConn = nil
end
if this.BlockedConn then
this.BlockedConn:Disconnect()
this.BlockedConn = nil
end
if this.DiedConn then
this.DiedConn:Disconnect()
this.DiedConn = nil
end
if this.SeatedConn then
this.SeatedConn:Disconnect()
this.SeatedConn = nil
end
this.humanoid = nil
end
function this:Cancel()
this.Cancelled = true
this:Cleanup()
end
function this:OnPathInterrupted()
-- Stop moving
this.Cancelled = true
this:OnPointReached(false)
end
function this:ComputePath()
local humanoid = findPlayerHumanoid(Player)
local torso = humanoid and humanoid.Torso
local success = false
if torso then
if this.PathComputed or this.PathComputing then return end
this.PathComputing = true
success = pcall(function()
this.pathResult = PathfindingService:FindPathAsync(torso.CFrame.p, this.TargetPoint)
end)
this.pointList = this.pathResult and this.pathResult:GetWaypoints()
if this.pathResult then
this.BlockedConn = this.pathResult.Blocked:Connect(function(blockedIdx) this:OnPathBlocked(blockedIdx) end)
end
this.PathComputing = false
this.PathComputed = this.pathResult and this.pathResult.Status == Enum.PathStatus.Success or false
end
return true
end
function this:IsValidPath()
if not this.pathResult then
this:ComputePath()
end
return this.pathResult.Status == Enum.PathStatus.Success
end
this.Recomputing = false
function this:OnPathBlocked(blockedWaypointIdx)
local pathBlocked = blockedWaypointIdx >= this.CurrentPoint
if not pathBlocked or this.Recomputing then
return
end
this.Recomputing = true
if this.stopTraverseFunc then
this.stopTraverseFunc()
this.stopTraverseFunc = nil
end
this.pathResult:ComputeAsync(this.humanoid.Torso.CFrame.p, this.TargetPoint)
this.pointList = this.pathResult:GetWaypoints()
this.PathComputed = this.pathResult and this.pathResult.Status == Enum.PathStatus.Success or false
if SHOW_PATH then
this.stopTraverseFunc, this.setPointFunc = createPopupPath(this.pointList, 4, true)
end
if this.PathComputed then
this.humanoid = findPlayerHumanoid(Player)
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
this:Cleanup()
end
this.Recomputing = false
end
function this:OnPointReached(reached)
if reached and not this.Cancelled then
local nextWaypointIdx = this.CurrentPoint + 1
if nextWaypointIdx > #this.pointList then
-- End of path reached
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
this.Finished:Fire()
this:Cleanup()
else
local currentWaypoint = this.pointList[this.CurrentPoint]
local nextWaypoint = this.pointList[nextWaypointIdx]
-- If airborne, only allow to keep moving
-- if nextWaypoint.Action ~= Jump, or path mantains a direction
-- Otherwise, wait until the humanoid gets to the ground
local currentState = this.humanoid:GetState()
local isInAir = currentState == Enum.HumanoidStateType.FallingDown
or currentState == Enum.HumanoidStateType.Freefall
or currentState == Enum.HumanoidStateType.Jumping
if isInAir then
local shouldWaitForGround = nextWaypoint.Action == Enum.PathWaypointAction.Jump
if not shouldWaitForGround and this.CurrentPoint > 1 then
local prevWaypoint = this.pointList[this.CurrentPoint - 1]
local prevDir = currentWaypoint.Position - prevWaypoint.Position
local currDir = nextWaypoint.Position - currentWaypoint.Position
local prevDirXZ = Vector2.new(prevDir.x, prevDir.z).Unit
local currDirXZ = Vector2.new(currDir.x, currDir.z).Unit
local THRESHOLD_COS = 0.996 -- ~cos(5 degrees)
shouldWaitForGround = prevDirXZ:Dot(currDirXZ) < THRESHOLD_COS
end
if shouldWaitForGround then
this.humanoid.FreeFalling:Wait()
-- Give time to the humanoid's state to change
-- Otherwise, the jump flag in Humanoid
-- will be reset by the state change
wait(0.1)
end
end
-- Move to the next point
if this.setPointFunc then
this.setPointFunc(nextWaypointIdx)
end
if nextWaypoint.Action == Enum.PathWaypointAction.Jump then
this.humanoid.Jump = true
end
this.humanoid:MoveTo(nextWaypoint.Position)
this.CurrentPoint = nextWaypointIdx
end
else
this.PathFailed:Fire()
this:Cleanup()
end
end
function this:Start()
if CurrentSeatPart then
return
end
this.humanoid = findPlayerHumanoid(Player)
if not this.humanoid then
this.PathFailed:Fire()
return
end
if this.Started then return end
this.Started = true
if SHOW_PATH then
-- choose whichever one Mike likes best
this.stopTraverseFunc, this.setPointFunc = createPopupPath(this.pointList, 4)
end
if #this.pointList > 0 then
this.SeatedConn = this.humanoid.Seated:Connect(function(reached) this:OnPathInterrupted() end)
this.DiedConn = this.humanoid.Died:Connect(function(reached) this:OnPathInterrupted() end)
this.MoveToConn = this.humanoid.MoveToFinished:Connect(function(reached) this:OnPointReached(reached) end)
this.CurrentPoint = 1 -- The first waypoint is always the start location. Skip it.
this:OnPointReached(true) -- Move to first point
else
this.PathFailed:Fire()
if this.stopTraverseFunc then
this.stopTraverseFunc()
end
end
end
this:ComputePath()
if not this.PathComputed then
-- set the end point towards the camera and raycasted towards the ground in case we hit a wall
local offsetPoint = this.TargetPoint + this.TargetSurfaceNormal*1.5
local ray = Ray.new(offsetPoint, Vector3.new(0,-1,0)*50)
local newHitPart, newHitPos = RayCastIgnoreList(workspace, ray, getIgnoreList())
if newHitPart then
this.TargetPoint = newHitPos
end
-- try again
this:ComputePath()
end
return this
end
|
------------------------------------------------------------------------
--
-- * used in luaK:patchlistaux(), luaK:concat()
------------------------------------------------------------------------
|
function luaK:fixjump(fs, pc, dest)
local jmp = fs.f.code[pc]
local offset = dest - (pc + 1)
assert(dest ~= self.NO_JUMP)
if math.abs(offset) > luaP.MAXARG_sBx then
luaX:syntaxerror(fs.ls, "control structure too long")
end
luaP:SETARG_sBx(jmp, offset)
end
|
-- Client exposed signals:
|
PointsService.Client.PointsChanged = RemoteSignal.new()
PointsService.Client.GiveMePoints = RemoteSignal.new()
|
-- CHARACTER SETTINGS
|
settings.AntiNoclip = true
settings.AntiSpeed = true
settings.AntiJump = true
settings.AntiNoHRP = true
settings.AntiTeleportation = true
|
--[=[
@param obj any
@return boolean
Returns `true` if the given object is a Timer.
]=]
|
function Timer.Is(obj: any): boolean
return type(obj) == "table" and getmetatable(obj) == Timer
end
function Timer:_startTimer()
local t = self.TimeFunction
local nextTick = t() + self.Interval
self._runHandle = self.UpdateSignal:Connect(function()
local now = t()
if now >= nextTick then
nextTick = now + self.Interval
self.Tick:Fire()
end
end)
end
function Timer:_startTimerNoDrift()
assert(self.Interval > 0, "Interval must be greater than 0 when AllowDrift is set to false")
local t = self.TimeFunction
local n = 1
local start = t()
local nextTick = start + self.Interval
self._runHandle = self.UpdateSignal:Connect(function()
local now = t()
while now >= nextTick do
n += 1
nextTick = start + (self.Interval * n)
self.Tick:Fire()
end
end)
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 700 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 1400 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 7500 -- Use sliders to manipulate values
Tune.Redline = 8500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6000
Tune.PeakSharpness = 10.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)
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", true)
else
warn("qWeld - Unable to weld part")
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
--[[
Applies camera effects while in Dead mode
]]
|
function CameraStateDead.applyEffects(cameraObjects, targetPart)
TweenService:Create(cameraObjects.blur, TweenInfo.new(2), {Size = cameraObjects.blur.Size + 10}):Play()
end
return CameraStateDead
|
--!strict
|
local startAngle = -60
local endAngle = 60
local function Map(n: number, oldMin: number, oldMax: number, min: number, max: number): number
return (min + ((max - min) * ((n - oldMin) / (oldMax - oldMin))))
end
local function run(LightChanger)
local lights = LightChanger:GetLights("Numbered")
LightChanger:Tilt(60)
for groupNumber, lightGroup in lights do
local percent = (groupNumber - 1) / (#lights - 1)
local angle = Map(percent, 0, 1, startAngle, endAngle)
LightChanger:Pan(angle, lightGroup)
end
end
return function(LightChangerA, LightChangerB)
run(LightChangerA)
run(LightChangerB)
end
|
--{{NUMBERS}} : FADE TIMES AND MORE.
|
Settings.RandomOffset = {-4, 4}
Settings.FadeOutTime = 1;
Settings.FadeInTime = 1;
Settings.IndicatorLength = 0.8;
|
--AUTO
|
function autoSwitchFlaps()
if flaps.Value.Value == true then
if wings.Value.Value == true then
local c = flaps_flex:GetChildren()
local d = flaps_straight:GetChildren()
for i = 1, #c do
c[i].Transparency = 0
end
for i = 1, #d do
d[i].Transparency = 1
end
elseif wings.Value.Value == false then
local c = flaps_flex:GetChildren()
local d = flaps_straight:GetChildren()
for i = 1, #c do
c[i].Transparency = 1
end
for i = 1, #d do
d[i].Transparency = 0
end
end
end
end
function autoSwitchGear()
if gears.Value.Value == true then
if wings.Value.Value == true then
local c = gears_flex:GetChildren()
local d = gears_straight:GetChildren()
for i = 1, #c do
c[i].Transparency = 0
end
for i = 1, #d do
d[i].Transparency = 1
end
elseif wings.Value.Value == false then
local c = gears_flex:GetChildren()
local d = gears_straight:GetChildren()
for i = 1, #c do
c[i].Transparency = 1
end
for i = 1, #d do
d[i].Transparency = 0
end
end
end
end
wings.Value.Changed:connect(autoSwitchFlaps)
wings.Value.Changed:connect(autoSwitchGear)
|
-- RocketPropulsion Fields
|
local TARGET_RADIUS = 150
local MAX_SPEED = 9001
local MAX_TORQUE = Vector3.new(4e6, 4e6, 0)
local MAX_THRUST = 50000
local THRUST_P = 500
local THRUST_D = 50000
local TARGET_OVERSHOOT_DISTANCE = 10000000
local ROCKET_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local ROCKET_MESH_SCALE = Vector3.new(2.5, 2.5, 2)
local ROCKET_PART_SIZE = Vector3.new(2, 2, 2)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__ImageLabel__1 = script.Parent.ImageLabel;
local v2 = Random.new();
local l__SizeValue__3 = script.Parent.SizeValue;
script.Parent.AnimatedImage.Disabled = false;
l__SizeValue__3.Value = -0.05;
script.Parent.Jumpscare:Play();
for v4 = 1, 22 do
local v5 = math.random(1, 3);
if v5 == 1 then
script.Parent.BackgroundColor3 = Color3.new(0, 0, 0);
l__ImageLabel__1.ImageColor3 = Color3.new(1, 1, 1);
end;
if v5 == 2 then
script.Parent.BackgroundColor3 = Color3.new(0, 1, 0.498039);
l__ImageLabel__1.ImageColor3 = Color3.new(1, 1, 1);
end;
if v5 == 3 then
script.Parent.BackgroundColor3 = Color3.new(0, 0.666667, 0.498039);
l__ImageLabel__1.ImageColor3 = Color3.new(0, 0, 0);
end;
l__ImageLabel__1.Position = UDim2.new(v2:NextNumber(0.4, 0.6), 0, v2:NextNumber(0.4, 0.6), 0);
l__ImageLabel__1.Size = l__ImageLabel__1.Size + UDim2.new(l__SizeValue__3.Value, 0, l__SizeValue__3.Value, 0);
l__ImageLabel__1.Rotation = math.random(-20, 20);
l__SizeValue__3.Value = l__SizeValue__3.Value + 0.01;
wait(0);
end;
l__ImageLabel__1.ImageColor3 = Color3.new(1, 1, 1);
script.Parent.BackgroundColor3 = Color3.new(0, 0, 0);
script.Parent.Visible = false;
script.Parent.AnimatedImage.Disabled = true;
script.Disabled = true;
|
-- setting up the correct animation --
|
local eatingAnimation
if hum.RigType == Enum.HumanoidRigType.R6 then
eatingAnimation = script.Parent.TakeABiteR6
else
eatingAnimation = script.Parent.TakeABiteR15
end
local eatingAnim = hum:LoadAnimation(eatingAnimation)
script.Parent.Activated:connect(function()
if not eating then
eating = true
eatingAnim:Play()
eatingAnim.KeyframeReached:Connect(function(keyFrame)
if keyFrame == "Bite" then
sound.TimePosition = 0.3
sound:Play()
wait(0.5)
script.Parent.BiteTaken:FireServer()
end
end)
end
end)
eatingAnim.Stopped:Connect(function()
script.Parent.AppleFinished:FireServer()
end)
|
--- Runs all pending auto exec commands in Registry.AutoExecBuffer
|
function Registry:FlushAutoExecBuffer()
for _, commandGroup in ipairs(self.AutoExecBuffer) do
for _, command in ipairs(commandGroup) do
self.Cmdr.Dispatcher:EvaluateAndRun(command)
end
end
end
return function (cmdr)
Registry.Cmdr = cmdr
return Registry
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 160 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 260 ,
spInc = 40 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 280 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
--wait()
|
local creator = script.Parent:findFirstChild("creator")
local move = script.Parent:findFirstChild("Move")
local active = true
function tagHumanoid(humanoid, creator)
if creator ~= nil then
local new_tag = creator:clone()
new_tag.Parent = humanoid
end
end
function onPlayerBlownUp(part, distance, creator)
if part.Name == "Head" then
local humanoid = part.Parent.Humanoid
tagHumanoid(humanoid, creator)
end
end
function set_Off(hit)
if active == true then
active = false
explosion = Instance.new("Explosion")
explosion.BlastRadius = 25
explosion.BlastPressure = 50000
local creator = script.Parent:findFirstChild("creator")
if creator ~= nil then
explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
end
explosion.Position = script.Parent.Position
explosion.Parent = game.Workspace
wait()
script.Parent:remove()
end
end
script.Parent.Touched:connect(set_Off)
for i = 1,100 do
wait()
local desired = Instance.new("Vector3Value")
desired.Value = script.Parent.CFrame.lookVector * 2100
local difference = desired.Value - move.velocity
if difference.magnitude >= move.velocity.magnitude then
move.velocity = move.velocity + (difference*(0.01*i))
end
end
|
--[=[
Check if the given key is down.
```lua
local w = keyboard:IsKeyDown(Enum.KeyCode.W)
if w then ... end
```
]=]
|
function Keyboard:IsKeyDown(keyCode: Enum.KeyCode): boolean
return UserInputService:IsKeyDown(keyCode)
end
|
------------------------------------------------------------------------
|
ltime = math.random(400,5000)
print (ltime)
for i=1,ltime do
wait()
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
local ignoreList = {}
local ray = Ray.new(script.Parent.Part8.Position, missile.CFrame.lookVector * 999)
local hit game.Workspace:FindPartOnRayWithIgnoreList(ray, ignoreList, false)
local pos = script.Parent.Bool.Position
local line = Instance.new("Part")
line.Name = "Line"
line.FormFactor = "Symmetric"
line.Size = Vector3.new(1, 1, 1)
line.BrickColor = BrickColor.new("White")
line.Transparency = 0
line.CanCollide = false
line.Anchored = true
line.Locked = true
line.TopSurface, line.BottomSurface = 0, 0
line.CFrame = CFrame.new(script.Parent.Part8.Position:lerp(pos, 0.5), pos)
local mesh = Instance.new("BlockMesh", line)
mesh.Scale = Vector3.new(0.03, 0.03, (script.Parent.Part8.Position - pos).magnitude)
game.Debris:AddItem(line,0.08)
line.Parent = script.Parent
wait(0.001)
else
print("No bool")
break
end
end
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
local character = script.Parent.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
script.Parent.Handle.Sound:Play()
local ItemDirectory = game.ServerStorage.Assets.MobDrops.Fishing
local FRAP = ItemDirectory:GetChildren()[math.random(1,#ItemDirectory:GetChildren())]:clone()
FRAP.Parent = player.Backpack
FRAP.Handle.CFrame =script.Parent.Handle.CFrame + Vector3.new(math.random(-5, 5), 3, math.random(-5, 5))
end
end
|
--// bolekinds
|
if game.ServerStorage.ServerData.HasKeys.Value == true then
workspace.Door:Destroy()
end
game.ServerStorage.ServerData.HasKeys.Changed:Connect(function()
if game.ServerStorage.ServerData.HasKeys.Value == true then
if workspace:FindFirstChild("Door") then
workspace.Door:Destroy()
end
end
end)
|
--Make the part when touched enable the "ParticleEmitter" inside of it ad then disable it after 1 second
|
part.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local emitter = part.ParticleEmitter
emitter.Enabled = true
wait(0.1)
emitter.Enabled = false
end
end)script.Parent.Transparency = 0
|
-- Profile object:
|
local Profile = {
--[[
Data = {}, -- [table] -- Loaded once after ProfileStore:LoadProfileAsync() finishes
MetaData = {}, -- [table] -- Updated with every auto-save
GlobalUpdates = GlobalUpdates, -- [GlobalUpdates]
_profile_store = ProfileStore, -- [ProfileStore]
_profile_key = "", -- [string]
_release_listeners = [ScriptSignal] / nil, -- [table / nil]
_hop_ready_listeners = [ScriptSignal] / nil, -- [table / nil]
_hop_ready = false,
_view_mode = true / nil, -- [bool] or nil
_load_timestamp = os.clock(),
_is_user_mock = false, -- ProfileStore.Mock
_mock_key_info = {},
--]]
}
Profile.__index = Profile
function Profile:IsActive() --> [bool]
local loaded_profiles = self._is_user_mock == true and self._profile_store._mock_loaded_profiles or self._profile_store._loaded_profiles
return loaded_profiles[self._profile_key] == self
end
function Profile:GetMetaTag(tag_name) --> value
local meta_data = self.MetaData
if meta_data == nil then
return nil
-- error("[ProfileService]: This Profile hasn't been loaded before - MetaData not available")
end
return self.MetaData.MetaTags[tag_name]
end
function Profile:SetMetaTag(tag_name, value)
if type(tag_name) ~= "string" then
error("[ProfileService]: tag_name must be a string")
elseif string.len(tag_name) == 0 then
error("[ProfileService]: Invalid tag_name")
end
self.MetaData.MetaTags[tag_name] = value
end
function Profile:Reconcile()
ReconcileTable(self.Data, self._profile_store._profile_template)
end
function Profile:ListenToRelease(listener) --> [ScriptConnection] (place_id / nil, game_job_id / nil)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in Profile:ListenToRelease()")
end
if self._view_mode == true then
return {Disconnect = function() end}
end
if self:IsActive() == false then
-- Call release listener immediately if profile is expired
local place_id
local game_job_id
local active_session = self.MetaData.ActiveSession
if active_session ~= nil then
place_id = active_session[1]
game_job_id = active_session[2]
end
listener(place_id, game_job_id)
return {Disconnect = function() end}
else
return self._release_listeners:Connect(listener)
end
end
function Profile:Save()
if self._view_mode == true then
error("[ProfileService]: Can't save Profile in view mode - Should you be calling :OverwriteAsync() instead?")
end
if self:IsActive() == false then
warn("[ProfileService]: Attempted saving an inactive profile "
.. self:Identify() .. "; Traceback:\n" .. debug.traceback())
return
end
-- Reject save request if a save is already pending in the queue - this will prevent the user from
-- unecessary API request spam which we could not meaningfully execute anyways!
if IsCustomWriteQueueEmptyFor(self._profile_store._profile_store_lookup, self._profile_key) == true then
-- We don't want auto save to trigger too soon after manual saving - this will reset the auto save timer:
RemoveProfileFromAutoSave(self)
AddProfileToAutoSave(self)
-- Call save function in a new thread:
task.spawn(SaveProfileAsync, self)
end
end
function Profile:Release()
if self._view_mode == true then
return
end
if self:IsActive() == true then
task.spawn(SaveProfileAsync, self, true) -- Call save function in a new thread with release_from_session = true
end
end
function Profile:ListenToHopReady(listener) --> [ScriptConnection] ()
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in Profile:ListenToHopReady()")
end
if self._view_mode == true then
return {Disconnect = function() end}
end
if self._hop_ready == true then
task.spawn(listener)
return {Disconnect = function() end}
else
return self._hop_ready_listeners:Connect(listener)
end
end
function Profile:AddUserId(user_id) -- Associates user_id with profile (GDPR compliance)
if type(user_id) ~= "number" or user_id % 1 ~= 0 then
warn("[ProfileService]: Invalid UserId argument for :AddUserId() ("
.. tostring(user_id) .. "); Traceback:\n" .. debug.traceback())
return
end
if user_id < 0 and self._is_user_mock ~= true and UseMockDataStore ~= true then
return -- Avoid giving real Roblox APIs negative UserId's
end
if table.find(self.UserIds, user_id) == nil then
table.insert(self.UserIds, user_id)
end
end
function Profile:RemoveUserId(user_id) -- Unassociates user_id with profile (safe function)
if type(user_id) ~= "number" or user_id % 1 ~= 0 then
warn("[ProfileService]: Invalid UserId argument for :RemoveUserId() ("
.. tostring(user_id) .. "); Traceback:\n" .. debug.traceback())
return
end
local index = table.find(self.UserIds, user_id)
if index ~= nil then
table.remove(self.UserIds, index)
end
end
function Profile:Identify() --> [string]
return IdentifyProfile(
self._profile_store._profile_store_name,
self._profile_store._profile_store_scope,
self._profile_key
)
end
function Profile:ClearGlobalUpdates() -- Clears all global updates data from a profile payload
if self._view_mode ~= true then
error("[ProfileService]: :ClearGlobalUpdates() can only be used in view mode")
end
local global_updates_object = {
_updates_latest = {0, {}},
_profile = self,
}
setmetatable(global_updates_object, GlobalUpdates)
self.GlobalUpdates = global_updates_object
end
function Profile:OverwriteAsync() -- Saves the profile to the DataStore and removes the session lock
if self._view_mode ~= true then
error("[ProfileService]: :OverwriteAsync() can only be used in view mode")
end
SaveProfileAsync(self, nil, true)
end
|
-- // CastVisualiser Class
|
local CastVisualiser = {}
|
-- Event that fires when new point comes into focus while snapping
|
local PointSnapped = Core.RbxUtility.CreateSignal();
function StartSnapping()
-- Starts tracking snap points nearest to the mouse
-- Hide any handles or bounding boxes
AttachHandles(nil, true);
BoundingBox.ClearBoundingBox();
-- Avoid targeting snap points in selected parts while dragging
if Dragging then
SnapTracking.TargetBlacklist = Selection.Items;
end;
-- Start tracking the closest snapping point
SnapTracking.StartTracking(function (NewPoint)
-- Fire `SnappedPoint` and update `SnappedPoint` when there is a new snap point in focus
if NewPoint then
SnappedPoint = NewPoint.p;
PointSnapped:fire(SnappedPoint);
end;
end);
end;
function SetAxisPosition(Axis, Position)
-- Sets the selection's position on axis `Axis` to `Position`
-- Track this change
TrackChange();
-- Prepare parts to be moved
local InitialStates = PreparePartsForDragging();
-- Update each part
for Part in pairs(InitialStates) do
-- Set the part's new CFrame
Part.CFrame = CFrame.new(
Axis == 'X' and Position or Part.Position.X,
Axis == 'Y' and Position or Part.Position.Y,
Axis == 'Z' and Position or Part.Position.Z
) * (Part.CFrame - Part.CFrame.p);
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
-- Revert changes if player is not authorized to move parts to target destination
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialStates) do
Part.CFrame = State.CFrame;
end;
end;
-- Restore the parts' original states
for Part, State in pairs(InitialStates) do
Part:MakeJoints();
Core.RestoreJoints(State.Joints);
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
end;
function NudgeSelectionByFace(Face)
-- Nudges the selection along the current axes mode in the direction of the focused part's face
-- Get amount to nudge by
local NudgeAmount = MoveTool.Increment;
-- Reverse nudge amount if shift key is held while nudging
local PressedKeys = Support.FlipTable(Support.GetListMembers(UserInputService:GetKeysPressed(), 'KeyCode'));
if PressedKeys[Enum.KeyCode.LeftShift] or PressedKeys[Enum.KeyCode.RightShift] then
NudgeAmount = -NudgeAmount;
end;
-- Track this change
TrackChange();
-- Prepare parts to be moved
local InitialState = PreparePartsForDragging();
-- Perform the movement
MovePartsAlongAxesByFace(Face, NudgeAmount, MoveTool.Axes, Selection.Focus, InitialState);
-- Update the "distance moved" indicator
if MoveTool.UI then
MoveTool.UI.Changes.Text.Text = 'moved ' .. math.abs(NudgeAmount) .. ' studs';
end;
-- Cache up permissions for all private areas
local AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
-- Revert changes if player is not authorized to move parts to target destination
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
for Part, State in pairs(InitialState) do
Part.CFrame = State.CFrame;
end;
end;
-- Restore the parts' original states
for Part, State in pairs(InitialState) do
Part:MakeJoints();
Core.RestoreJoints(State.Joints);
Part.CanCollide = State.CanCollide;
Part.Anchored = State.Anchored;
end;
-- Register the change
RegisterChange();
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Parts = Support.CloneTable(Selection.Items);
BeforeCFrame = {};
AfterCFrame = {};
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, CFrame = Record.BeforeCFrame[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncMove', Changes);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, CFrame = Record.AfterCFrame[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncMove', Changes);
end;
};
-- Collect the selection's initial state
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.BeforeCFrame[Part] = Part.CFrame;
end;
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Collect the selection's final state
local Changes = {};
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.AfterCFrame[Part] = Part.CFrame;
table.insert(Changes, { Part = Part, CFrame = Part.CFrame });
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncMove', Changes);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
function EnableDragging()
-- Enables part dragging
-- Pay attention to when the user intends to start dragging
Connections.DragStart = Core.Mouse.Button1Down:connect(function ()
-- Get mouse target
local TargetPart = Core.Mouse.Target;
-- Make sure this click was not to select
if Selection.Multiselecting then
return;
end;
-- Check whether the user is snapping
local IsSnapping = UserInputService:IsKeyDown(Enum.KeyCode.R) and #Selection.Items > 0;
-- Make sure target is draggable, unless snapping is ongoing
if not Core.IsSelectable(TargetPart) and not IsSnapping then
return;
end;
-- Initialize dragging detection data
DragStartTarget = IsSnapping and Selection.Focus or TargetPart;
DragStart = Vector2.new(Core.Mouse.X, Core.Mouse.Y);
-- Select the target if it's not selected, and snapping is not ongoing
if not Selection.IsSelected(TargetPart) and not IsSnapping then
Selection.Replace({ TargetPart }, true);
end;
-- Watch for potential dragging
Connections.WatchForDrag = Core.Mouse.Move:connect(function ()
-- Trigger dragging if the mouse is moved over 2 pixels
if DragStart and (Vector2.new(Core.Mouse.X, Core.Mouse.Y) - DragStart).magnitude >= 2 then
-- Prepare for dragging
BoundingBox.ClearBoundingBox();
SetUpDragging(DragStartTarget, SnapTracking.Enabled and SnappedPoint or nil);
-- Disable watching for potential dragging
ClearConnection 'WatchForDrag';
end;
end);
end);
end;
|
----------------------------------------------------------------
--\\DOORS & BREACHING SYSTEM
----------------------------------------------------------------
|
local DoorsFolder = ACS_Workspace:FindFirstChild("Doors")
local DoorsFolderClone = DoorsFolder:Clone()
local BreachClone = ACS_Workspace.Breach:Clone()
BreachClone.Parent = ServerStorage
DoorsFolderClone.Parent = ServerStorage
function ToggleDoor(Door)
local Hinge = Door.Door:FindFirstChild("Hinge")
if not Hinge then return end
local HingeConstraint = Hinge.HingeConstraint
if HingeConstraint.TargetAngle == 0 then
HingeConstraint.TargetAngle = -90
elseif HingeConstraint.TargetAngle == -90 then
HingeConstraint.TargetAngle = 0
end
end
Evt.DoorEvent.OnServerEvent:Connect(function(Player,Door,Mode,Key)
if Door ~= nil then
if Mode == 1 then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
if Door:FindFirstChild("RequiresKey") then
local Character = Player.Character
if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
if Door.Locked.Value == true then
Door.Locked.Value = false
end
ToggleDoor(Door)
end
end
else
ToggleDoor(Door)
end
elseif Mode == 2 then
if Door:FindFirstChild("Locked") == nil or (Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == false) then
ToggleDoor(Door)
end
elseif Mode == 3 then
if Door:FindFirstChild("RequiresKey") then
local Character = Player.Character
Key = Door.RequiresKey.Value
if Character:FindFirstChild(Key) ~= nil or Player.Backpack:FindFirstChild(Key) ~= nil then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
Door.Locked.Value = false
else
Door.Locked.Value = true
end
end
end
elseif Mode == 4 then
if Door:FindFirstChild("Locked") ~= nil and Door.Locked.Value == true then
Door.Locked.Value = false
end
end
end
end)
Evt.MedSys.Collapse.OnServerEvent:Connect(function(Player)
if not Player or not Player.Character then return; end;
local Human = Player.Character:FindFirstChild("Humanoid")
local PClient = Player.Character:FindFirstChild("ACS_Client")
if not Human or not PClient then return; end;
local Dor = PClient.Variaveis.Dor
local Sangue = PClient.Variaveis.Sangue
if (Sangue.Value <= 3500) or (Dor.Value >= 200) or PClient:GetAttribute("Collapsed") then -- Man this Guy's Really wounded,
Human.PlatformStand = true
Human.AutoRotate = false
PClient:SetAttribute("Collapsed",true)
elseif (Sangue.Value > 3500) and (Dor.Value < 200) and not PClient:GetAttribute("Collapsed") then -- YAY A MEDIC ARRIVED! =D
Human.PlatformStand = false
Human.AutoRotate = true
PClient:SetAttribute("Collapsed",false)
end
end)
Evt.MedSys.MedHandler.OnServerEvent:Connect(function(Player, Victim, Mode)
if not Player or not Player.Character then return; end;
if not Player.Character:FindFirstChild("Humanoid") or Player.Character.Humanoid.Health <= 0 then return; end;
local P1_Client = Player.Character:FindFirstChild("ACS_Client")
if not P1_Client then warn(Player.Name.."'s Action Failed: Missing ACS_Client"); return; end;
if P1_Client:GetAttribute("Collapsed") then return; end;
if Victim then --Multiplayer functions
if not Victim.Character or not Victim.Character:FindFirstChild("HumanoidRootPart") or not Player.Character:FindFirstChild("HumanoidRootPart") then return; end;
if (Player.Character.HumanoidRootPart.Position - Victim.Character.HumanoidRootPart.Position).Magnitude > 15 then warn(Player.Name.." is too far to treat "..Victim.Name); return; end;
local P2_Client = Victim.Character:FindFirstChild("ACS_Client")
if not P2_Client then warn(Player.Name.."'s Action Failed: Missing "..Victim.Name.."'s ACS_Client"); return; end;
if Mode == 1 and P1_Client.Kit.Bandage.Value > 0 and P2_Client:GetAttribute("Bleeding") then
P1_Client.Kit.Bandage.Value = P1_Client.Kit.Bandage.Value - 1
P2_Client:SetAttribute("Bleeding",false)
return;
elseif Mode == 2 and P1_Client.Kit.Splint.Value > 0 and P2_Client:GetAttribute("Injured") then
P1_Client.Kit.Splint.Value = P1_Client.Kit.Splint.Value - 1
P2_Client:SetAttribute("Injured",false)
return;
elseif Mode == 3 and (P2_Client:GetAttribute("Bleeding") == true or P2_Client:GetAttribute("Tourniquet")) then --Tourniquet works a little different :T
if P2_Client:GetAttribute("Tourniquet")then
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value + 1
P2_Client:SetAttribute("Tourniquet",false)
return;
end
if P1_Client.Kit.Tourniquet.Value <= 0 then return; end;
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value - 1
P2_Client:SetAttribute("Tourniquet",true)
return;
elseif Mode == 4 and P1_Client.Kit.PainKiller.Value > 0 and P2_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.PainKiller.Value = P1_Client.Kit.PainKiller.Value - 1
P2_Client.Variaveis.Dor.Value = math.clamp(P2_Client.Variaveis.Dor.Value - math.random(35,65),0,300)
Evt.MedSys.MedHandler:FireClient(Victim,4)
return;
elseif Mode == 5 and P1_Client.Kit.EnergyShot.Value > 0 and Victim.Character.Humanoid.Health < Victim.Character.Humanoid.MaxHealth then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(15,25)
if Victim.Character.Humanoid.Health + HealValue < Victim.Character.Humanoid.MaxHealth then
Victim.Character.Humanoid:TakeDamage(-HealValue)
else
Victim.Character.Humanoid.Health = Victim.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Victim,5)
return;
elseif Mode == 6 and P1_Client.Kit.Morphine.Value > 0 and P2_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.Morphine.Value = P1_Client.Kit.Morphine.Value - 1
P2_Client.Variaveis.Dor.Value = 0
Evt.MedSys.MedHandler:FireClient(Victim,6)
return;
elseif Mode == 7 and P1_Client.Kit.Epinephrine.Value > 0 and P2_Client:GetAttribute("Collapsed")then
P1_Client.Kit.Epinephrine.Value = P1_Client.Kit.Epinephrine.Value - 1
local HealValue = math.random(45,55)
if Victim.Character.Humanoid.Health + HealValue < Victim.Character.Humanoid.MaxHealth then
Victim.Character.Humanoid:TakeDamage(-HealValue)
else
Victim.Character.Humanoid.Health = Victim.Character.Humanoid.MaxHealth
end
P2_Client:SetAttribute("Collapsed",false)
Evt.MedSys.MedHandler:FireClient(Victim,7)
return;
elseif Mode == 8 and P1_Client.Kit.BloodBag.Value > 0 and P2_Client.Variaveis.Sangue.Value < P2_Client.Variaveis.Sangue.MaxValue then
P1_Client.Kit.BloodBag.Value = P1_Client.Kit.BloodBag.Value - 1
P2_Client.Variaveis.Sangue.Value = P2_Client.Variaveis.Sangue.Value + 2000
return;
else
warn(Player.Name.."'s Action Failed: Unknow Method")
end
return;
end
--Self treat
if Mode == 1 and P1_Client.Kit.Bandage.Value > 0 and P1_Client:GetAttribute("Bleeding") then
P1_Client.Kit.Bandage.Value = P1_Client.Kit.Bandage.Value - 1
P1_Client:SetAttribute("Bleeding",false)
return;
elseif Mode == 2 and P1_Client.Kit.Splint.Value > 0 and P1_Client:GetAttribute("Injured") then
P1_Client.Kit.Splint.Value = P1_Client.Kit.Splint.Value - 1
P1_Client:SetAttribute("Injured",false)
return;
elseif Mode == 3 and (P1_Client:GetAttribute("Bleeding") or P1_Client:GetAttribute("Tourniquet")) then --Tourniquet works a little diferent :T
if P1_Client:GetAttribute("Tourniquet") then
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value + 1
P1_Client:SetAttribute("Tourniquet",false)
return;
end
if P1_Client.Kit.Tourniquet.Value <= 0 then return; end;
P1_Client.Kit.Tourniquet.Value = P1_Client.Kit.Tourniquet.Value - 1
P1_Client:SetAttribute("Tourniquet",true)
return;
elseif Mode == 4 and P1_Client.Kit.PainKiller.Value > 0 and P1_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.PainKiller.Value = P1_Client.Kit.PainKiller.Value - 1
P1_Client.Variaveis.Dor.Value = math.clamp(P1_Client.Variaveis.Dor.Value - math.random(35,65),0,300)
Evt.MedSys.MedHandler:FireClient(Player,4)
return;
elseif Mode == 5 and P1_Client.Kit.EnergyShot.Value > 0 and Player.Character.Humanoid.Health < Player.Character.Humanoid.MaxHealth then
P1_Client.Kit.EnergyShot.Value = P1_Client.Kit.EnergyShot.Value - 1
local HealValue = math.random(15,25)
if Player.Character.Humanoid.Health + HealValue < Player.Character.Humanoid.MaxHealth then
Player.Character.Humanoid:TakeDamage(-HealValue)
else
Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Player,5)
return;
elseif Mode == 6 and P1_Client.Kit.Morphine.Value > 0 and P1_Client.Variaveis.Dor.Value > 0 then
P1_Client.Kit.Morphine.Value = P1_Client.Kit.Morphine.Value - 1
P1_Client.Variaveis.Dor.Value = math.clamp(P1_Client.Variaveis.Dor.Value - math.random(125,175),0,300)
Evt.MedSys.MedHandler:FireClient(Player,6)
return;
elseif Mode == 7 and P1_Client.Kit.Epinephrine.Value > 0 and Player.Character.Humanoid.Health < Player.Character.Humanoid.MaxHealth then
P1_Client.Kit.Epinephrine.Value = P1_Client.Kit.Epinephrine.Value - 1
local HealValue = math.random(45,55)
if Player.Character.Humanoid.Health + HealValue < Player.Character.Humanoid.MaxHealth then
Player.Character.Humanoid:TakeDamage(-HealValue)
else
Player.Character.Humanoid.Health = Player.Character.Humanoid.MaxHealth
end
Evt.MedSys.MedHandler:FireClient(Player,7)
return;
elseif Mode == 8 and P1_Client.Kit.BloodBag.Value > 0 and P1_Client.Variaveis.Sangue.Value < P1_Client.Variaveis.Sangue.MaxValue then
P1_Client.Kit.BloodBag.Value = P1_Client.Kit.BloodBag.Value - 1
P1_Client.Variaveis.Sangue.Value = P1_Client.Variaveis.Sangue.Value + 2000
return;
else
warn(Player.Name.."'s Action Failed: Unknow Method")
end
return;
end)
Evt.Drag.OnServerEvent:Connect(function(player,Victim)
if not player or not player.Character then return; end;
local P1_Client = player.Character:FindFirstChild("ACS_Client")
local Human = player.Character:FindFirstChild("Humanoid")
if not P1_Client then return; end;
if Victim then
P1_Client:SetAttribute("DragPlayer",Victim.Name)
else
P1_Client:SetAttribute("DragPlayer","")
P1_Client:SetAttribute("Dragging",false)
end
local target = P1_Client:GetAttribute("DragPlayer")
if P1_Client:GetAttribute("Collapsed") or target == "" then return; end;
local player2 = game.Players:FindFirstChild(target)
if not player2 or not player2.Character then return; end;
local PlHuman = player2.Character:FindFirstChild("Humanoid")
local P2_Client = player2.Character:FindFirstChild("ACS_Client")
if not PlHuman or not P2_Client then return; end;
if P1_Client:GetAttribute("Dragging") then return; end;
if not P2_Client:GetAttribute("Collapsed") then return; end;
P1_Client:SetAttribute("Dragging",true)
while P1_Client:GetAttribute("Dragging") and target ~= "" and P2_Client:GetAttribute("Collapsed") and PlHuman.Health > 0 and Human.Health > 0 and not P1_Client:GetAttribute("Collapsed") do wait()
player2.Character.Torso.Anchored = true
player2.Character.Torso.CFrame = Human.Parent.Torso.CFrame*CFrame.new(0,0.75,1.5)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
end
player2.Character.Torso.Anchored = false
end)
function BreachFunction(Player,Mode,BreachPlace,Pos,Norm,Hit)
if Mode == 1 then
if Player.Character.ACS_Client.Kit.BreachCharges.Value > 0 then
Player.Character.ACS_Client.Kit.BreachCharges.Value = Player.Character.ACS_Client.Kit.BreachCharges.Value - 1
BreachPlace.Destroyed.Value = true
local C4 = Engine.FX.BreachCharge:Clone()
C4.Parent = BreachPlace.Destroyable
C4.Center.CFrame = CFrame.new(Pos, Pos + Norm) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0))
C4.Center.Place:play()
local weld = Instance.new("WeldConstraint")
weld.Parent = C4
weld.Part0 = BreachPlace.Destroyable.Charge
weld.Part1 = C4.Center
wait(1)
C4.Center.Beep:play()
wait(4)
if C4 and C4:FindFirstChild("Center") then
local att = Instance.new("Attachment")
att.CFrame = C4.Center.CFrame
att.Parent = workspace.Terrain
local aw = Engine.FX.ExpEffect:Clone()
aw.Parent = att
aw.Enabled = false
aw:Emit(35)
Debris:AddItem(aw,aw.Lifetime.Max)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = 0
Exp.DestroyJointRadiusPercent = 0
Exp.Position = C4.Center.Position
Exp.Parent = workspace
local S = Instance.new("Sound")
S.EmitterSize = 10
S.MaxDistance = 1000
S.SoundId = "rbxassetid://"..Explosion[math.random(1, 7)]
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 2
S.Parent = att
S.PlayOnRemove = true
S:Destroy()
for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002.Character and SKP_002.Character:FindFirstChild('Head') and (SKP_002.Character.Head.Position - C4.Center.Position).magnitude <= 15 then
local DistanceMultiplier = (((SKP_002.Character.Head.Position - C4.Center.Position).magnitude/35) - 1) * -1
local intensidade = DistanceMultiplier
local Tempo = 15 * DistanceMultiplier
Evt.Suppression:FireClient(SKP_002,2,intensidade,Tempo)
end
end
Debris:AddItem(BreachPlace.Destroyable,0)
end
end
elseif Mode == 2 then
local aw = Engine.FX.DoorBreachFX:Clone()
aw.Parent = BreachPlace.Door.Door
aw.RollOffMaxDistance = 100
aw.RollOffMinDistance = 5
aw:Play()
BreachPlace.Destroyed.Value = true
if BreachPlace.Door:FindFirstChild("Hinge") ~= nil then
BreachPlace.Door.Hinge:Destroy()
end
if BreachPlace.Door:FindFirstChild("Knob") ~= nil then
BreachPlace.Door.Knob:Destroy()
end
local forca = Instance.new("BodyForce")
forca.Force = -Norm * BreachPlace.Door.Door:GetMass() * Vector3.new(50,0,50)
forca.Parent = BreachPlace.Door.Door
Debris:AddItem(BreachPlace,3)
elseif Mode == 3 then
if Player.Character.ACS_Client.Kit.Fortifications.Value > 0 then
Player.Character.ACS_Client.Kit.Fortifications.Value = Player.Character.ACS_Client.Kit.Fortifications.Value - 1
BreachPlace.Fortified.Value = true
local C4 = Instance.new('Part')
C4.Parent = BreachPlace.Destroyable
C4.Size = Vector3.new(Hit.Size.X + .05,Hit.Size.Y + .05,Hit.Size.Z + 0.5)
C4.Material = Enum.Material.DiamondPlate
C4.Anchored = true
C4.CFrame = Hit.CFrame
local S = Engine.FX.FortFX:Clone()
S.PlaybackSpeed = math.random(30,55)/40
S.Volume = 1
S.Parent = C4
S.PlayOnRemove = true
S:Destroy()
end
end
end
Evt.Breach.OnServerInvoke = BreachFunction
function UpdateLog(Player,humanoid)
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
local hours = os.date("*t")["hour"]
local mins = os.date("*t")["min"]
local sec = os.date("*t")["sec"]
local TagType = tag:findFirstChild("type")
if tag.Value.Name == Player.Name then
local String = Player.Name.." Died | "..hours..":"..mins..":"..sec
table.insert(CombatLog,String)
else
local String = tag.Value.Name.." Killed "..Player.Name.." | "..hours..":"..mins..":"..sec
table.insert(CombatLog,String)
end
if #CombatLog > 50 then
Backup = Backup + 1
warn("ACS: Cleaning Combat Log | Backup: "..Backup)
warn(CombatLog)
CombatLog = {}
end
end
end
plr.PlayerAdded:Connect(function(player)
for i,v in ipairs(_G.TempBannedPlayers) do
if v == player.Name then
player:Kick('Blacklisted')
warn(player.Name.." (Temporary Banned) tried to join to server")
break
end
end
for i,v in ipairs(gameRules.Blacklist) do
if v == player.UserId then
player:Kick('Blacklisted')
warn(player.Name.." (Blacklisted) tried to join to server")
break
end
end
if gameRules.AgeRestrictEnabled and not Run:IsStudio() then
if player.AccountAge < gameRules.AgeLimit then
player:Kick('Age restricted server! Please wait: '..(gameRules.AgeLimit - player.AccountAge)..' Days')
end
end
if game.CreatorType == Enum.CreatorType.User then
if player.UserId == game.CreatorId or Run:IsStudio() then
player.Chatted:Connect(function(Message)
if string.lower(Message) == "/acslog" then
Evt.CombatLog:FireClient(player,CombatLog)
end
end)
end
elseif game.CreatorType == Enum.CreatorType.Group then
if player:IsInGroup(game.CreatorId) or Run:IsStudio() then
player.Chatted:Connect(function(Message)
if string.lower(Message) == "/acslog" then
Evt.CombatLog:FireClient(player,CombatLog)
end
end)
end
end
player.CharacterAdded:Connect(function(char)
if gameRules.TeamTags then
local L_17_ = HUDs:WaitForChild('TeamTagUI'):clone()
L_17_.Parent = char
L_17_.Adornee = char.Head
end
char.Humanoid.BreakJointsOnDeath = false
char.Humanoid.Died:Connect(function()
UpdateLog(player,char.Humanoid)
pcall(function()
Ragdoll(char)
end)
end)
end)
end)
print(gameRules.Version)
|
-- ANimation
|
local Sound = script:WaitForChild("Sound")
local Sound1 = script:WaitForChild("Sound1")
local Sound2 = script:WaitForChild("wind")
UIS.InputBegan:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 2
local Track1 = plr.Character.Humanoid:LoadAnimation(script.A1)
Track1:Play()
for i = 1,math.huge do
if Debounce == 2 then
plr.Character.HumanoidRootPart.Anchored = true
else
break
end
wait()
end
Track1:Stop()
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.UserInputType == Enum.UserInputType.MouseButton1 and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 3
local mousepos = Mouse.Hit
local Track2 = plr.Character.Humanoid:LoadAnimation(script.A2)
Track2:Play()
wait(0)
script.RemoteEvent:FireServer()
Sound:Play()
Sound1:Play()
wait(3)
Sound2:Play()
wait(3)
Sound2:Stop()
wait()
plr.Character.HumanoidRootPart.Anchored = false
wait(.5)
Tool.Active.Value = "None"
wait(3)
Sound:Stop()
Debounce = 1
end
end)
|
-- 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 = math.clamp(t, -1, 1)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
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
function CameraUtils.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 math.clamp(point, -1, 1)
end
return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
|
--[[~-Fixico-~]]
|
--
print("Fixico's Scripts")
local isOn = true
function on()
isOn = true
script.Parent.Transparency = 0
script.Parent.CanCollide = true
end
function off()
isOn = false
script.Parent.Transparency = .5
script.Parent.CanCollide = true
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
on()
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed codeName..gui.Name
|
return function(data)
local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local gui = script.Parent.Parent
local frame = gui.Frame
local text = gui.Frame.TextBox
local scroll = gui.Frame.ScrollingFrame
local players = gui.Frame.PlayerList
local entry = gui.Entry
local BindEvent = gTable.BindEvent
local opened = false
local scrolling = false
local debounce = false
local settings = client.Remote.Get("Setting",{"SplitKey","ConsoleKeyCode","BatchKey","Prefix"})
local splitKey = settings.SplitKey
local consoleKey = settings.ConsoleKeyCode
local batchKey = settings.BatchKey
local prefix = settings.Prefix
local commands = client.Remote.Get('FormattedCommands') or {}
local scrollOpenSize = UDim2.new(0.36, 0, 0, 200)
local scrollCloseSize = UDim2.new(0.36, 0, 0, 47)
local openPos = UDim2.new(0.32, 0, 0.353, 0)
local closePos = UDim2.new(0.32, 0, 0, -200)
local tweenInfo = TweenInfo.new(0.15)----service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
local scrollOpenTween = service.TweenService:Create(frame, tweenInfo, {
Size = scrollOpenSize;
})
local scrollCloseTween = service.TweenService:Create(frame, tweenInfo, {
Size = scrollCloseSize;
})
local consoleOpenTween = service.TweenService:Create(frame, tweenInfo, {
Position = openPos;
})
local consoleCloseTween = service.TweenService:Create(frame, tweenInfo, {
Position = closePos;
})
frame.Position = closePos
frame.Visible = false
frame.Size = scrollCloseSize
scroll.Visible = false
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
local function close()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
scroll.ScrollingEnabled = false
frame.Size = scrollCloseSize
scroll.Visible = false
players.Visible = false
scrollOpen = false
consoleCloseTween:Play();
debounce = false
opened = false
end
end
local function open()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll.ScrollingEnabled = true
players.ScrollingEnabled = true
consoleOpenTween:Play();
frame.Size = scrollCloseSize
scroll.Visible = false
players.Visible = false
scrollOpen = false
text.Text = ''
frame.Visible = true
frame.Position = openPos;
text:CaptureFocus()
text.Text = ''
wait()
text.Text = ''
debounce = false
opened = true
end
end
text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
client.Remote.Send('ProcessCommand',text.Text)
end
end
close()
end)
text.Changed:Connect(function(c)
if c == 'Text' and text.Text ~= '' and open then
if string.sub(text.Text, string.len(text.Text)) == " " then
if players:FindFirstChild("Entry 0") then
text.Text = (string.sub(text.Text, 1, (string.len(text.Text) - 1))..players["Entry 0"].Text).." "
elseif scroll:FindFirstChild("Entry 0") then
text.Text = string.split(scroll["Entry 0"].Text, "<")[1]
else
text.Text = text.Text..prefix
end
text.CursorPosition = string.len(text.Text) + 1
text.Text = string.gsub(text.Text, " ", "")
end
scroll:ClearAllChildren()
players:ClearAllChildren()
local nText = text.Text
if string.match(nText,".*"..batchKey.."([^']+)") then
nText = string.match(nText,".*"..batchKey.."([^']+)")
nText = string.match(nText,"^%s*(.-)%s*$")
end
local pNum = 0
local pMatch = string.match(nText,".+"..splitKey.."(.*)$")
for i,v in next,service.Players:GetPlayers() do
if (pMatch and string.sub(string.lower(tostring(v)),1,#pMatch) == string.lower(pMatch)) or string.match(nText,splitKey.."$") then
local new = entry:Clone()
new.Text = tostring(v)
new.Name = "Entry "..pNum
new.TextXAlignment = "Right"
new.Visible = true
new.Parent = players
new.Position = UDim2.new(0,0,0,20*pNum)
new.MouseButton1Down:Connect(function()
text.Text = text.Text..tostring(v)
text:CaptureFocus()
end)
pNum = pNum+1
end
end
players.CanvasSize = UDim2.new(0,0,0,pNum*20)
local num = 0
for i,v in next,commands do
if string.sub(string.lower(v),1,#nText) == string.lower(nText) or string.find(string.lower(v), string.match(string.lower(nText),"^(.-)"..splitKey) or string.lower(nText), 1, true) then
if not scrollOpen then
scrollOpenTween:Play();
--frame.Size = UDim2.new(1,0,0,140)
scroll.Visible = true
players.Visible = true
scrollOpen = true
end
local b = entry:Clone()
b.Visible = true
b.Parent = scroll
b.Text = v
b.Name = "Entry "..num
b.Position = UDim2.new(0,0,0,20*num)
b.MouseButton1Down:Connect(function()
text.Text = b.Text
text:CaptureFocus()
end)
num = num+1
end
end
if num > 0 then
frame.Size = UDim2.new(0.36, 0, 0, math.clamp((math.max(num, pNum)*20)+53, 47, 200))
else
players.Visible = false
frame.Size = scrollCloseSize
end
scroll.CanvasSize = UDim2.new(0,0,0,num*20)
elseif c == 'Text' and text.Text == '' and opened then
scrollCloseTween:Play();
--service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
scroll.Visible = false
players.Visible = false
scrollOpen = false
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
end
end)
BindEvent(service.UserInputService.InputBegan, function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
if opened then
close()
else
open()
end
client.Variables.ConsoleOpen = opened
end
end)
gTable:Ready()
end
|
-- check if Camera is zoomed into first person
|
local function checkFirstPerson()
toggleViewmodel(((Camera.Focus.Position - Camera.CFrame.Position).magnitude <= 1) and not Character:GetAttribute("Ragdoll"))
end
local function checkPlayerRunning()
return Humanoid.MoveDirection.Magnitude > 0.1 and IncludeWalkSway and Humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and Humanoid:GetState() ~= Enum.HumanoidStateType.Landed
end
|
--Made by Luckymaxer
|
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
BaseColor = BrickColor.new("Bright yellow")
Color = BaseColor.Color
Duration = 15
Classes = {
BasePart = {
BrickColor = BaseColor,
Material = Enum.Material.Plastic,
Reflectance = 0.5,
Anchored = true,
},
FileMesh = {
TextureId = "",
},
DataModelMesh = {
VertexColor = Vector3.new(Color.r, Color.g, Color.b),
},
CharacterMesh = {
BaseTextureId = 0,
OverlayTextureId = 0,
},
Shirt = {
ShirtTemplate = "",
},
Pants = {
PantsTemplate = "",
},
FaceInstance = {
Texture = "",
},
Sparkles = {
SparkleColor = Color,
},
Fire = {
Color = Color,
SecondaryColor = Color,
},
Smoke = {
Color = Color,
}
}
Objects = {}
RemovedObjects = {}
FakeParts = {}
Hats = {}
Tools = {}
function Decorate(Object)
local ObjectData = {
Object = nil,
Properties = {},
}
for i, v in pairs(Classes) do
if Object:IsA(i) then
if Object:IsA("CharacterMesh") then
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.MeshId = ("http://www.roblox.com/asset/?id=" .. Object.MeshId)
for ii, vv in pairs(Character:GetChildren()) do
if vv:IsA("BasePart") and Object.BodyPart.Name == string.gsub(vv.Name, " ", "") then
Mesh.Parent = vv
table.insert(RemovedObjects, {Object = Object, NewObject = Mesh, Parent = Object.Parent})
Object.Parent = nil
end
end
else
ObjectData.Object = Object
for ii, vv in pairs(v) do
local PropertyValue = nil
local PropertyValueSet = false
pcall(function()
PropertyValue = Object[ii]
PropertyValueSet = true
Object[ii] = vv
end)
if PropertyValueSet then
ObjectData.Properties[ii] = PropertyValue
end
end
end
end
end
table.insert(Objects, ObjectData)
end
function Redesign(Parent)
for i, v in pairs(Parent:GetChildren()) do
Decorate(v)
Redesign(v)
end
end
for i, v in pairs(Character:GetChildren()) do --Create fake hats and tools, and goldify them
if v:IsA("Hat") or v:IsA("Tool") then
local FakeObject = v:Clone()
Decorate(FakeObject)
table.insert(((v:IsA("Hat") and Hats) or Tools), v)
for ii, vv in pairs(FakeObject:GetChildren()) do
if vv:IsA("BasePart") then
local FakePart = vv:Clone()
FakePart.Name = v.Name
table.insert(FakeParts, FakePart)
FakePart.Parent = Character
FakePart.CFrame = vv.CFrame
end
end
end
end
if Humanoid and Humanoid.Parent then
Humanoid:UnequipTools()
end
for i, v in pairs({Hats, Tools}) do
for ii, vv in pairs(v) do
vv.Parent = nil
end
end
Redesign(Character) --Goldify the player
wait(Duration)
for i, v in pairs(Objects) do --Ungoldify the player
for ii, vv in pairs(v.Properties) do
v.Object[ii] = vv
end
end
for i, v in pairs(RemovedObjects) do
if v.NewObject and v.NewObject.Parent then
v.NewObject:Destroy()
end
v.Object.Parent = v.Parent
end
for i, v in pairs(FakeParts) do
if v and v.Parent then
v:Destroy()
end
end
for i, v in pairs(Hats) do
v.Parent = Character
end
for i, v in pairs(Tools) do
if Humanoid and Humanoid.Parent then
Humanoid:EquipTool(v)
else
v.Parent = Character
end
end
script:Destroy()
|
-- REMOTE HANDLER --
|
Replicate.OnClientEvent:Connect(function(Action,Hotkey, ...) -- Using ... Allows you to send as many variables as you want
--print(Action)
if script:FindFirstChild(Action) and script:FindFirstChild(Action):IsA("ModuleScript") then -- If the name of a ModuleScript inside this script fits the Action parameter,
require(script[Action])(Hotkey,...) -- it'll require it
elseif script:FindFirstChild(Action) and script:FindFirstChild(Action):IsA("Folder") then
require(script[Action][Hotkey])(...)
end
end)
|
-- ROBLOX deviation: Makes urls clickable in the terminal. Not able to support
-- local terminalLink = require(Packages["terminal-link"])
|
local testResultModule = require(Packages.JestTestResult)
type TestResult = testResultModule.TestResult
local jestTypesModule = require(Packages.JestTypes)
type Config_GlobalConfig = jestTypesModule.Config_GlobalConfig
type Config_ProjectConfig = jestTypesModule.Config_ProjectConfig
local formatTime = require(Packages.JestUtil).formatTime
local utilsModule = require(CurrentModule.utils)
local formatTestPath = utilsModule.formatTestPath
local printDisplayName = utilsModule.printDisplayName
|
--local FireSound
|
local OnFireConnection = nil
local OnReloadConnection = nil
local DecreasedAimLastShot = false
local LastSpreadUpdate = time()
local flare = script.Parent:WaitForChild("Flare")
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
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = BrickColor.new("Black")
bullet.Shape = Enum.PartType.Block
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
local shell = Instance.new("Part")
shell.CFrame = Tool.Handle.CFrame * CFrame.fromEulerAnglesXYZ(1.5,0,0)
shell.Size = Vector3.new(1,1,1)
shell.BrickColor = BrickColor.new(226)
shell.Parent = game.Workspace
shell.CFrame = script.Parent.Handle.CFrame
shell.CanCollide = false
shell.Transparency = 0
shell.BottomSurface = 0
shell.TopSurface = 0
shell.Name = "Shell"
shell.Velocity = Tool.Handle.CFrame.lookVector * 35 + Vector3.new(math.random(-10,10),20,math.random(-10,20))
shell.RotVelocity = Vector3.new(0,200,0)
DebrisService:AddItem(shell, 1)
local shellmesh = Instance.new("SpecialMesh")
shellmesh.Scale = Vector3.new(.15,.4,.15)
shellmesh.Parent = shell
return bullet
end
local function Reload()
if not Reloading then
Reloading = true
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
if ReloadTrack then
ReloadTrack:Play()
end
--script.Parent.Handle.Reload:Play()
wait(ReloadTime)
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
if ReloadTrack then
ReloadTrack:Stop()
end
end
Reloading = false
end
end
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
RecoilTrack:Play()
end
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading do
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
--Pitch.Pitch = .8 + (math.random() * .5)
--Handle.FireSound:Play()
--Handle.Flash.Enabled = true
flare.MuzzleFlash.Enabled = true
end
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
TagHumanoid(hitHumanoid, MyPlayer)
script.Parent.Damager:FireServer(hitHumanoid, Damage)
--hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
WeaponGui.Crosshair.Hit:Play()
end
Spawn(UpdateTargetHit)
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
Handle.Flash.Enabled = false
IsShooting = false
flare.MuzzleFlash.Enabled = false
if AmmoInClip == 0 then
--Handle.Tick:Play()
Reload()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
function OnEquipped(mouse)
--Handle.EquipSound:Play()
--Handle.EquipSound2:Play()
--Handle.UnequipSound:Stop()
RecoilAnim = WaitForChild(Tool, 'Recoil')
ReloadAnim = WaitForChild(Tool, 'Reload')
--FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if ReloadAnim then
ReloadTrack = MyHumanoid:LoadAnimation(ReloadAnim)
end
if MyMouse then
MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
function OnUnequipped()
--Handle.UnequipSound:Play()
--Handle.EquipSound:Stop()
--Handle.EquipSound2:Stop()
LeftButtonDown = false
flare.MuzzleFlash.Enabled = false
Reloading = false
MyCharacter = nil
MyHumanoid = nil
MyTorso = nil
MyPlayer = nil
MyMouse = nil
if OnFireConnection then
OnFireConnection:disconnect()
end
if OnReloadConnection then
OnReloadConnection:disconnect()
end
if FlashHolder then
FlashHolder = nil
end
if WeaponGui then
WeaponGui.Parent = nil
WeaponGui = nil
end
if RecoilTrack then
RecoilTrack:Stop()
end
--if ReloadTrack then
--ReloadTrack:Stop()
--end
end
local function SetReticleColor(color)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
for _, line in pairs(WeaponGui.Crosshair:GetChildren()) do
if line:IsA('Frame') then
line.BorderColor3 = color
end
end
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
while true do
wait(0.033)
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and MyMouse then
WeaponGui.Crosshair.Position = UDim2.new(0, MyMouse.X, 0, MyMouse.Y)
SetReticleColor(NeutralReticleColor)
local target = MyMouse.Target
if target and target.Parent then
local player = PlayersService:GetPlayerFromCharacter(target.Parent)
if player then
if MyPlayer.Neutral or player.TeamColor ~= MyPlayer.TeamColor then
SetReticleColor(EnemyReticleColor)
else
SetReticleColor(FriendlyReticleColor)
end
end
end
end
if Spread and not IsShooting then
local currTime = time()
if currTime - LastSpreadUpdate > FireRate * 2 then
LastSpreadUpdate = currTime
Spread = math.max(MinSpread, Spread - AimInaccuracyStepAmount)
UpdateCrosshair(Spread, MyMouse)
end
end
end
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local frame = script.Parent.Parent
local close = frame.Frame.Close
local main = frame.Frame.Main
local title = frame.Frame.Title
local timer = frame.Frame.Timer
local gTable = data.gTable
local clickfunc = data.OnClick
local closefunc = data.OnClose
local ignorefunc = data.OnIgnore
local name = data.Title
local text = data.Message or data.Text or ""
local time = data.Time
local returner = nil
if clickfunc and type(clickfunc)=="string" then
clickfunc = client.Core.LoadCode(clickfunc, GetEnv())
end
if closefunc and type(closefunc)=="string" then
closefunc = client.Core.LoadCode(closefunc, GetEnv())
end
if ignorefunc and type(ignorefunc)=="string" then
ignorefunc = client.Core.LoadCode(ignorefunc, GetEnv())
end
--client.UI.Make("NotificationHolder")
local holder = client.UI.Get("NotificationHolder",nil,true)
if not holder then
local hold = service.New("ScreenGui")
local hTable = client.UI.Register(hold)
local frame = service.New("ScrollingFrame", hold)
client.UI.Prepare(hold)
hTable.Name = "NotificationHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(0, 200, 0.5, 0)
frame.Position = UDim2.new(1, -210, 0.5, -10)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
holder = hTable
hTable:Ready()
end
local function moveGuis(holder,mod)
local holdstuff = {}
for i,v in pairs(holder:children()) do
table.insert(holdstuff,1,v)
end
for i,v in pairs(holdstuff) do
v.Position = UDim2.new(0,0,1,-75*(i+mod))
end
holder.CanvasSize=UDim2.new(0,0,0,(#holder:children()*75))
local pos = (((#holder:children())*75) - holder.AbsoluteWindowSize.Y)
if pos<0 then pos = 0 end
holder.CanvasPosition = Vector2.new(0,pos)
end
holder = holder.Object.Frame
title.Text = name
frame.Name = name
main.Text = text
main.MouseButton1Click:connect(function()
if frame and frame.Parent then
if clickfunc then
returner = clickfunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
close.MouseButton1Click:connect(function()
if frame and frame.Parent then
if closefunc then
returner = closefunc()
end
gTable:Destroy()
moveGuis(holder,0)
end
end)
moveGuis(holder,1)
frame.Parent = holder
frame:TweenPosition(UDim2.new(0,0,1,-75),'Out','Linear',0.2)
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
sound.SoundId = 'http://www.roblox.com/asset/?id='.."203785584"--client.NotificationSound
sound.Volume = 0.2
wait(0.1)
sound:Play()
wait(0.5)
sound:Destroy()
end)
if time then
timer.Visible = true
spawn(function()
repeat
timer.Text = time
--timer.Size=UDim2.new(0,timer.TextBounds.X,0,10)
wait(1)
time = time-1
until time<=0 or not frame or not frame.Parent
if frame and frame.Parent then
if ignorefunc then
returner = ignorefunc()
end
frame:Destroy()
moveGuis(holder,0)
end
end)
end
repeat wait() until returner ~= nil or not frame or not frame.Parent
return returner
end
|
--end
|
if speed > 15 then
--if carSeat.Steer ~= 0 then
if FLP > (FRP) then
if carSeat.Storage.FrontStiffness.Value*((1290)*(standard*((RollF+1)/10))) < carSeat.Storage.FrontStiffness.Value*((1290)) then
SFL.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRL.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
SFR.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
else
SFR.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290)*(standard*((RollF+1)/10)))
SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290)*(standard*((RollR+1)/10)))
SFL.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRL.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
end
elseif FRP > (FLP) then
if carSeat.Storage.FrontStiffness.Value*((1290)*(standard*((RollF+1)/10))) < carSeat.Storage.FrontStiffness.Value*((1290)) then
SFL.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRL.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
SFR.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
else
SFL.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290)*(standard*((RollF+1)/10)))
SRL.Stiffness = carSeat.Storage.RearStiffness.Value*((1290)*(standard*((RollR+1)/10)))
SFR.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
SRR.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
end
end
--else
--SFL.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
--SRL.Stiffness = carSeat.Storage.RearStiffness.Value*((1290))
--SFR.Stiffness = carSeat.Storage.FrontStiffness.Value*((1290))
|
--local prolene = Functions.prolene
--local Compress = Functions.Compress
--local defib = Functions.defib
--local o2 = Functions.o2
|
local Compress_Multi = FunctionsMulti.Compress
local Bandage_Multi = FunctionsMulti.Bandage
local Splint_Multi = FunctionsMulti.Splint
local Epinephrine_Multi = FunctionsMulti.Epinephrine
local anesthetic_Multi = FunctionsMulti.anesthetic
local Morphine_Multi = FunctionsMulti.Morphine
local BloodBag_Multi = FunctionsMulti.BloodBag
local Tourniquet_Multi = FunctionsMulti.Tourniquet
local prolene_Multi = FunctionsMulti.prolene
local o2_Multi = FunctionsMulti.o2
local defib_Multi = FunctionsMulti.defib
local npa_Multi = FunctionsMulti.npa
local catheter_Multi = FunctionsMulti.catheter
local etube_Multi = FunctionsMulti.etube
local nylon_Multi = FunctionsMulti.nylon
local balloon_Multi = FunctionsMulti.balloon
local skit_Multi = FunctionsMulti.skit
local bvm_Multi = FunctionsMulti.bvm
local nrb_Multi = FunctionsMulti.nrb
local scalpel_Multi = FunctionsMulti.scalpel
local suction_Multi = FunctionsMulti.suction
local clamp_Multi = FunctionsMulti.clamp
local prolene5_Multi = FunctionsMulti.prolene5
local drawblood_Multi = FunctionsMulti.drawblood
local Algemar = Functions.Algemar
local Fome = Functions.Fome
local Stance = Evt.MedSys.Stance
local Collapse = Functions.Collapse
local rodeath = Functions.rodeath
local Reset = Functions.Reset
local TS = game:GetService("TweenService")
Bandage.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 Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local bbleeding = Human.Parent.Saude.Stances.bbleeding
local Bandagens = Human.Parent.Saude.Kit.Bandagem
if enabled.Value == false and Caido.Value == false then
if Bandagens.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
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
end
end)
|
---[[ Fade Out and In Settings ]]
|
module.ChatWindowBackgroundFadeOutTime = 0 --Chat background will fade out after this many seconds.
module.ChatWindowTextFadeOutTime = 30 --Chat text will fade out after this many seconds.
module.ChatDefaultFadeDuration = 0.8
module.ChatShouldFadeInFromNewInformation = false
module.ChatAnimationFPS = 20.0
|
--[[
RecoilSimulator
Description: RecoilSimulator is a component of WeaponRuntimeData.
its purpose is to simulate recoil based on the weapons stats.
]]
|
local RecoilSimulator = {}
RecoilSimulator.__index = RecoilSimulator
|
--RegisterDialogue
--* called when the client discovers a Dialogue. The Interface
--* should provide some way for the user to interact with the
--* dialogue in question. When they interact with it, call the
--* callback and the client will initialize the dialogue
|
function Interface.RegisterDialogue(dialogue, startDialogueCallback)
end
|
--
|
local function toPolar(v)
return math.atan2(v.y, v.x), v.magnitude;
end
local function radToDeg(x)
return ((x + math.pi) / (2 * math.pi)) * 360;
end
|
--s.Pitch = 0.7
|
while s.Pitch<1 do
s.Pitch=s.Pitch+0.02
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.001)
end
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2800 -- Front brake force
Tune.RBrakeForce = 2200 -- Rear brake force
Tune.PBrakeForce = 4000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--[[
Fired when state is left
]]
|
function Transitions.onLeaveFinished(stateMachine, event, from, to, playerComponent)
PlayerFinished.leave(stateMachine, playerComponent)
end
|
-- Find the device's rotation via gyroscope and apply to the segway
|
UserInputService.DeviceRotationChanged:connect(function(rotation, rotCFrame)
local x,y = rotCFrame:toEulerAnglesXYZ()
local Sensitivity = 1.9
-- Direction
if -x*Sensitivity > -1 and -x*Sensitivity < 1 then -- Makes sure the device isn't tilted too much
Direction = -x*Sensitivity+0.4
elseif -x*Sensitivity > 0 then -- Otherwise we'll go to the max speed
Direction = 1
elseif -x*Sensitivity < 0 then -- Otherwise we'll go to the max speed
Direction = -1
end
-- Steering
if -y*Sensitivity > -1 and -y*Sensitivity < 1 then -- Makes sure the device isn't tilted too much
Steer = -y*Sensitivity
elseif -y*Sensitivity > 0 then -- Otherwise we'll go to the max speed
Steer = 1
elseif -y*Sensitivity < 0 then -- Otherwise we'll go to the max speed
Steer = -1
end
end)
end
|
-- n0opimdumb3 says hi
|
local function createJointData(attach0, attach1, limits)
assert(attach0)
assert(attach1)
assert(limits)
assert(limits.UpperAngle >= 0)
assert(limits.TwistLowerAngle <= limits.TwistUpperAngle)
return {
attachment0 = attach0,
attachment1 = attach1,
limits = limits
}
end
local function find(model)
return function(first, second, limits)
local part0 = model:FindFirstChild(first[1])
local part1 = model:FindFirstChild(second[1])
if part0 and part1 then
local attach0 = part0:FindFirstChild(first[2])
local attach1 = part1:FindFirstChild(second[2])
if attach0 and attach1 and attach0:IsA("Attachment") and attach1:IsA("Attachment") then
return createJointData(attach0, attach1, limits)
end
end
end
end
function RigTypes.getNoCollisions(model, rigType)
if rigType == Enum.HumanoidRigType.R6 then
return RigTypes.getR6NoCollisions(model)
elseif rigType == Enum.HumanoidRigType.R15 then
return RigTypes.getR15NoCollisions(model)
else
return {}
end
end
|
-- Define the magnification scale for the buttons
|
local magnificationScale = 1.2
|
-- (VR) Screen effects --------------
|
function VRBaseCamera:StartFadeFromBlack()
if UserGameSettings.VignetteEnabled == false then
return
end
local VRFade = Lighting:FindFirstChild("VRFade")
if not VRFade then
VRFade = Instance.new("ColorCorrectionEffect")
VRFade.Name = "VRFade"
VRFade.Parent = Lighting
end
VRFade.Brightness = -1
self.VRFadeResetTimer = 0.1
end
function VRBaseCamera:UpdateFadeFromBlack(timeDelta: number)
local VRFade = Lighting:FindFirstChild("VRFade")
if self.VRFadeResetTimer > 0 then
self.VRFadeResetTimer = math.max(self.VRFadeResetTimer - timeDelta, 0)
local VRFade = Lighting:FindFirstChild("VRFade")
if VRFade and VRFade.Brightness < 0 then
VRFade.Brightness = math.min(VRFade.Brightness + timeDelta * VR_FADE_SPEED, 0)
end
else
if VRFade then -- sanity check, VRFade off
VRFade.Brightness = 0
end
end
end
function VRBaseCamera:StartVREdgeBlur(player)
if UserGameSettings.VignetteEnabled == false then
return
end
local blurPart = nil
blurPart = (workspace.CurrentCamera :: Camera):FindFirstChild("VRBlurPart")
if not blurPart then
blurPart = Instance.new("Part")
blurPart.Name = "VRBlurPart"
blurPart.Parent = workspace.CurrentCamera
blurPart.CanTouch = false
blurPart.CanCollide = false
blurPart.CanQuery = false
blurPart.Anchored = true
blurPart.Size = Vector3.new(0.44,0.47,1)
blurPart.Transparency = 1
blurPart.CastShadow = false
RunService.RenderStepped:Connect(function(step)
local userHeadCF = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrCF = (workspace :: any).Camera.CFrame * userHeadCF
blurPart.CFrame = (vrCF * CFrame.Angles(0, math.rad(180), 0)) + vrCF.LookVector * 1.05
end)
end
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if not VRBlur then
if not VRScreen then
VRScreen = Instance.new("SurfaceGui") or Instance.new("ScreenGui")
end
VRScreen.Name = "VRBlurScreen"
VRScreen.Parent = player.PlayerGui
VRScreen.Adornee = blurPart
VRBlur = Instance.new("ImageLabel")
VRBlur.Name = "VRBlur"
VRBlur.Parent = VRScreen
VRBlur.Image = "rbxasset://textures/ui/VR/edgeBlur.png"
VRBlur.AnchorPoint = Vector2.new(0.5, 0.5)
VRBlur.Position = UDim2.new(0.5, 0, 0.5, 0)
-- this computes the ratio between the GUI 3D panel and the VR viewport
-- adding 15% overshoot for edges on 2 screen headsets
local ratioX = (workspace.CurrentCamera :: Camera).ViewportSize.X * 2.3 / VR_PANEL_SIZE
local ratioY = (workspace.CurrentCamera :: Camera).ViewportSize.Y * 2.3 / VR_PANEL_SIZE
VRBlur.Size = UDim2.fromScale(ratioX, ratioY)
VRBlur.BackgroundTransparency = 1
VRBlur.Active = true
VRBlur.ScaleType = Enum.ScaleType.Stretch
end
VRBlur.Visible = true
VRBlur.ImageTransparency = 0
self.VREdgeBlurTimer = VR_SCREEN_EGDE_BLEND_TIME
end
function VRBaseCamera:UpdateEdgeBlur(player, timeDelta)
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if VRBlur then
if self.VREdgeBlurTimer > 0 then
self.VREdgeBlurTimer = self.VREdgeBlurTimer - timeDelta
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
if VRScreen then
local VRBlur = VRScreen:FindFirstChild("VRBlur")
if VRBlur then
VRBlur.ImageTransparency = 1.0 - math.clamp(self.VREdgeBlurTimer, 0.01,
VR_SCREEN_EGDE_BLEND_TIME) * (1/VR_SCREEN_EGDE_BLEND_TIME)
end
end
else
VRBlur.Visible = false
end
end
end
function VRBaseCamera:GetCameraHeight()
if not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
function VRBaseCamera:GetSubjectCFrame(): CFrame
local result = BaseCamera.GetSubjectCFrame(self)
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if not cameraSubject then
return result
end
-- new VR system overrides
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectCFrame
end
end
if result then
self.lastSubjectCFrame = result
end
return result
end
function VRBaseCamera:GetSubjectPosition(): Vector3?
local result = BaseCamera.GetSubjectPosition(self)
-- new VR system overrides
local camera = game.Workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = VR_SEAT_OFFSET
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
end
else
return nil
end
self.lastSubjectPosition = result
return result
end
|
-- Streamable
-- Stephen Leitnick
-- March 03, 2021
| |
--// J Key Or ButtonY, Lights
|
uis.InputBegan:connect(function(input)
if input.KeyCode==Enum.KeyCode.J or input.KeyCode==Enum.KeyCode.DPadUp then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
uis.InputBegan:connect(function(input)
if input.KeyCode==Enum.KeyCode.N then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.DirectorRemoteEvent:FireServer(true)
end
end)
|
-- Tips
|
local tipFrame = Instance.new("Frame")
tipFrame.Name = "TipFrame"
tipFrame.BorderSizePixel = 0
tipFrame.AnchorPoint = Vector2.new(0, 0)
tipFrame.Position = UDim2.new(0,50,0,50)
tipFrame.Size = UDim2.new(1,0,1,-8)
tipFrame.ZIndex = 40
tipFrame.Parent = iconContainer
tipFrame.Active = false
local tipCorner = Instance.new("UICorner")
tipCorner.Name = "TipCorner"
tipCorner.CornerRadius = UDim.new(0.25,0)
tipCorner.Parent = tipFrame
local tipLabel = Instance.new("TextLabel")
tipLabel.Name = "TipLabel"
tipLabel.BackgroundTransparency = 1
tipLabel.TextScaled = false
tipLabel.TextSize = 12
tipLabel.Position = UDim2.new(0,3,0,3)
tipLabel.Size = UDim2.new(1,-6,1,-6)
tipLabel.ZIndex = 41
tipLabel.Parent = tipFrame
tipLabel.Active = false
|
-- functions
|
local function EquipHat(character, hat)
if CUSTOMIZATION.Hats:FindFirstChild(hat) then
local hat = CUSTOMIZATION.Hats[hat]:Clone()
local attach = hat.PrimaryPart
local charAttach = character[attach.Name]
for _, v in pairs(hat:GetChildren()) do
if v:IsA("BasePart") and v ~= attach then
local offset = attach.CFrame:ToObjectSpace(v.CFrame)
local weld = Instance.new("Weld")
weld.Part0 = charAttach
weld.Part1 = v
weld.C0 = offset
weld.Parent = v
v.Anchored = false
v.CanCollide = false
v.Massless = true
end
end
attach:Destroy()
hat.Parent = character.Attachments
end
end
local function EquipOutfit(character, outfit)
if CUSTOMIZATION.Outfits:FindFirstChild(outfit) then
local shirt = CUSTOMIZATION.Outfits[outfit]:FindFirstChild("Shirt")
if shirt then
shirt = shirt:Clone()
shirt.Parent = character
end
local pants = CUSTOMIZATION.Outfits[outfit]:FindFirstChild("Pants")
if pants then
pants = pants:Clone()
pants.Parent = character
end
end
end
local function EquipFace(character, face)
if CUSTOMIZATION.Faces:FindFirstChild(face) then
local face = CUSTOMIZATION.Faces[face]:Clone()
face.Parent = character.Head
end
end
local function EquipSkinColor(character, skinColor)
if CUSTOMIZATION.SkinColors:FindFirstChild(skinColor) then
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Color = CUSTOMIZATION.SkinColors[skinColor].Value
end
end
end
end
local function EquipBackpack(character, backpack)
if CUSTOMIZATION.Backpacks:FindFirstChild(backpack) then
local backpack = CUSTOMIZATION.Backpacks[backpack]:Clone()
local attach = backpack.PrimaryPart
local charAttach = character[attach.Name]
for _, v in pairs(backpack:GetChildren()) do
if v:IsA("BasePart") and v ~= attach then
local offset = attach.CFrame:ToObjectSpace(v.CFrame)
local weld = Instance.new("Weld")
weld.Part0 = charAttach
weld.Part1 = v
weld.C0 = offset
weld.Parent = v
v.Anchored = false
v.CanCollide = false
v.Massless = true
end
end
attach:Destroy()
backpack.Parent = character.Attachments
end
end
local function EquipEmote(character, emote)
if CUSTOMIZATION.Emotes:FindFirstChild(emote) then
emote = CUSTOMIZATION.Emotes[emote]:Clone()
emote.Parent = character.Animate.Animations.Emotes
end
end
local function HandleCharacter(character)
if character then
local playerData = PLAYER_DATA:WaitForChild(character.Name)
EquipHat(character, playerData.Equipped.Hat.Value)
EquipHat(character, playerData.Equipped.Hat2.Value)
EquipOutfit(character, playerData.Equipped.Outfit.Value)
EquipFace(character, playerData.Equipped.Face.Value)
EquipSkinColor(character, playerData.Equipped.SkinColor.Value)
EquipBackpack(character, playerData.Equipped.Backpack.Value)
EquipEmote(character, playerData.Equipped.Emote.Value)
end
end
local function HandlePlayer(player)
player.CharacterAdded:connect(HandleCharacter)
HandleCharacter(player.Character)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.