prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Firemode Functions |
function CreateBullet(L_199_arg1)
local L_200_ = L_58_.Position
local L_201_ = (L_4_.Hit.p - L_200_).unit
local L_202_ = CFrame.Angles(math.rad(math.random(-L_199_arg1, L_199_arg1)), math.rad(math.random(-L_199_arg1, L_199_arg1)), math.rad(math.random(-L_199_arg1, L_199_arg1)))
L_201_ = L_202_ * L_201_
local L_203_ = CFrame.new(L_200_, L_200_ + L_201_)
local L_204_ = Instance.new("Part", L_100_)
game.Debris:AddItem(L_204_, 10)
L_204_.Shape = Enum.PartType.Ball
L_204_.Size = Vector3.new(1, 1, 12)
L_204_.Name = "Bullet"
L_204_.TopSurface = "Smooth"
L_204_.BottomSurface = "Smooth"
L_204_.BrickColor = BrickColor.new("Bright green")
L_204_.Material = "Neon"
L_204_.CanCollide = false
--Bullet.CFrame = FirePart.CFrame + (Grip.CFrame.p - Grip.CFrame.p)
L_204_.CFrame = L_203_
local L_205_ = Instance.new("Sound")
L_205_.SoundId = "rbxassetid://341519743"
L_205_.Looped = true
L_205_:Play()
L_205_.Parent = L_204_
L_205_.Volume = 0.4
L_205_.MaxDistance = 30
L_204_.Transparency = 1
local L_206_ = L_204_:GetMass()
local L_207_ = Instance.new('BodyForce', L_204_)
if not L_82_ then
L_207_.Force = L_24_.BulletPhysics
L_204_.Velocity = L_201_ * L_24_.BulletSpeed
else
L_207_.Force = L_24_.ExploPhysics
L_204_.Velocity = L_201_ * L_24_.ExploSpeed
end
local L_208_ = Instance.new('Attachment', L_204_)
L_208_.Position = Vector3.new(0.1, 0, 0)
local L_209_ = Instance.new('Attachment', L_204_)
L_209_.Position = Vector3.new(-0.1, 0, 0)
local L_210_ = TracerCalculation()
if L_24_.TracerEnabled == true and L_210_ then
local L_211_ = Instance.new('Trail', L_204_)
L_211_.Attachment0 = L_208_
L_211_.Attachment1 = L_209_
L_211_.Transparency = NumberSequence.new(L_24_.TracerTransparency)
L_211_.LightEmission = L_24_.TracerLightEmission
L_211_.TextureLength = L_24_.TracerTextureLength
L_211_.Lifetime = L_24_.TracerLifetime
L_211_.FaceCamera = L_24_.TracerFaceCamera
L_211_.Color = ColorSequence.new(L_24_.TracerColor.Color)
end
if L_1_:FindFirstChild('Shell') and not L_82_ then
CreateShell()
end
delay(0.2, function()
L_204_.Transparency = 0
end)
return L_204_
end
function CheckForHumanoid(L_212_arg1)
local L_213_ = false
local L_214_ = nil
if L_212_arg1 then
if (L_212_arg1.Parent:FindFirstChild("Humanoid") or L_212_arg1.Parent.Parent:FindFirstChild("Humanoid")) then
L_213_ = true
if L_212_arg1.Parent:FindFirstChild('Humanoid') then
L_214_ = L_212_arg1.Parent.Humanoid
elseif L_212_arg1.Parent.Parent:FindFirstChild('Humanoid') then
L_214_ = L_212_arg1.Parent.Parent.Humanoid
end
else
L_213_ = false
end
end
return L_213_, L_214_
end
function CastRay(L_215_arg1)
local L_216_, L_217_, L_218_
local L_219_ = L_55_.Position;
local L_220_ = L_215_arg1.Position;
local L_221_ = 0
local L_222_ = L_82_
while true do
L_105_:wait()
L_220_ = L_215_arg1.Position;
L_221_ = L_221_ + (L_220_ - L_219_).magnitude
L_216_, L_217_, L_218_ = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_219_, (L_220_ - L_219_)), IgnoreList);
local L_223_ = Vector3.new(0, 1, 0):Cross(L_218_)
local L_224_ = math.asin(L_223_.magnitude) -- division by 1 is redundant
if L_221_ > L_24_.BulletDecay then
L_215_arg1:Destroy()
break
end
if L_216_ and (L_216_ and L_216_.Transparency >= 1 or L_216_.CanCollide == false) and L_216_.Name ~= 'Right Arm' and L_216_.Name ~= 'Left Arm' and L_216_.Name ~= 'Right Leg' and L_216_.Name ~= 'Left Leg' and L_216_.Name ~= 'Armor' then
table.insert(IgnoreList, L_216_)
end
if L_216_ then
L_223_ = Vector3.new(0, 1, 0):Cross(L_218_)
L_224_ = math.asin(L_223_.magnitude) -- division by 1 is redundant
L_117_:FireServer(L_217_)
local L_225_ = CheckForHumanoid(L_216_)
if L_225_ == false then
L_215_arg1:Destroy()
local L_226_ = L_112_:InvokeServer(L_217_, L_223_, L_224_, L_218_, "Part", L_216_)
elseif L_225_ == true then
L_215_arg1:Destroy()
local L_227_ = L_112_:InvokeServer(L_217_, L_223_, L_224_, L_218_, "Human", L_216_)
end
end
if L_216_ and L_222_ then
L_115_:FireServer(L_217_)
end
if L_216_ then
local L_228_, L_229_ = CheckForHumanoid(L_216_)
if L_228_ then
L_110_:FireServer(L_229_)
if L_24_.AntiTK then
if game.Players:FindFirstChild(L_229_.Parent.Name) and game.Players:FindFirstChild(L_229_.Parent.Name).TeamColor ~= L_2_.TeamColor or L_229_.Parent:FindFirstChild('Vars') and game.Players:FindFirstChild(L_229_.Parent:WaitForChild('Vars'):WaitForChild('BotID').Value) and L_2_.TeamColor ~= L_229_.Parent:WaitForChild('Vars'):WaitForChild('teamColor').Value then
if L_216_.Name == 'Head' then
L_109_:FireServer(L_229_, L_24_.HeadDamage)
local L_230_ = L_19_:WaitForChild('BodyHit'):clone()
L_230_.Parent = L_2_.PlayerGui
L_230_:Play()
game:GetService("Debris"):addItem(L_230_, L_230_.TimeLength)
end
if L_216_.Name ~= 'Head' and not (L_216_.Parent:IsA('Accessory') or L_216_.Parent:IsA('Hat')) then
if L_216_.Name ~= 'Torso' and L_216_.Name ~= 'HumanoidRootPart' and L_216_.Name ~= 'Armor' then
L_109_:FireServer(L_229_, L_24_.LimbDamage)
elseif L_216_.Name == 'Torso' or L_216_.Name == 'HumanoidRootPart' and L_216_.Name ~= 'Armor' then
L_109_:FireServer(L_229_, L_24_.BaseDamage)
elseif L_216_.Name == 'Armor' then
L_109_:FireServer(L_229_, L_24_.ArmorDamage)
end
local L_231_ = L_19_:WaitForChild('BodyHit'):clone()
L_231_.Parent = L_2_.PlayerGui
L_231_:Play()
game:GetService("Debris"):addItem(L_231_, L_231_.TimeLength)
end
if (L_216_.Parent:IsA('Accessory') or L_216_.Parent:IsA('Hat')) then
L_109_:FireServer(L_229_, L_24_.HeadDamage)
local L_232_ = L_19_:WaitForChild('BodyHit'):clone()
L_232_.Parent = L_2_.PlayerGui
L_232_:Play()
game:GetService("Debris"):addItem(L_232_, L_232_.TimeLength)
end
end
else
if L_216_.Name == 'Head' then
L_109_:FireServer(L_229_, L_24_.HeadDamage)
local L_233_ = L_19_:WaitForChild('BodyHit'):clone()
L_233_.Parent = L_2_.PlayerGui
L_233_:Play()
game:GetService("Debris"):addItem(L_233_, L_233_.TimeLength)
end
if L_216_.Name ~= 'Head' and not (L_216_.Parent:IsA('Accessory') or L_216_.Parent:IsA('Hat')) then
if L_216_.Name ~= 'Torso' and L_216_.Name ~= 'HumanoidRootPart' and L_216_.Name ~= 'Armor' then
L_109_:FireServer(L_229_, L_24_.LimbDamage)
elseif L_216_.Name == 'Torso' or L_216_.Name == 'HumanoidRootPart' and L_216_.Name ~= 'Armor' then
L_109_:FireServer(L_229_, L_24_.BaseDamage)
elseif L_216_.Name == 'Armor' then
L_109_:FireServer(L_229_, L_24_.ArmorDamage)
end
local L_234_ = L_19_:WaitForChild('BodyHit'):clone()
L_234_.Parent = L_2_.PlayerGui
L_234_:Play()
game:GetService("Debris"):addItem(L_234_, L_234_.TimeLength)
end
if (L_216_.Parent:IsA('Accessory') or L_216_.Parent:IsA('Hat')) then
L_109_:FireServer(L_229_, L_24_.HeadDamage)
local L_235_ = L_19_:WaitForChild('BodyHit'):clone()
L_235_.Parent = L_2_.PlayerGui
L_235_:Play()
game:GetService("Debris"):addItem(L_235_, L_235_.TimeLength)
end
end
end
end
if L_216_ and L_216_.Parent:FindFirstChild("Humanoid") then
return L_216_, L_217_;
end
L_219_ = L_220_;
end
end
function fireSemi()
if L_15_ then
L_68_ = false
Recoiling = true
Shooting = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_58_:WaitForChild('Fire').SoundId, L_58_)
else
L_58_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
L_101_ = CreateBullet(L_24_.BulletSpread)
L_102_ = L_102_ - 1
UpdateAmmo()
RecoilFront = true
local L_236_, L_237_ = spawn(function()
CastRay(L_101_)
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_102_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_238_ = JamCalculation()
if L_238_ then
L_68_ = false
else
L_68_ = true
end
Shooting = false
end
end
function fireExplo()
if L_15_ then
L_68_ = false
Recoiling = true
Shooting = true
if L_54_ then
L_54_:FireServer(L_59_:WaitForChild('Fire').SoundId, L_59_)
else
L_59_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
L_101_ = CreateBullet(L_24_.BulletSpread)
L_104_ = L_104_ - 1
UpdateAmmo()
RecoilFront = true
local L_239_, L_240_ = spawn(function()
CastRay(L_101_)
end)
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_68_ = false
Shooting = false
end
end
function fireShot()
if L_15_ then
L_68_ = false
Recoiling = true
Shooting = true
RecoilFront = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_58_:WaitForChild('Fire').SoundId, L_58_)
else
L_58_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
for L_242_forvar1 = 1, L_24_.ShotNum do
spawn(function()
L_101_ = CreateBullet(L_24_.BulletSpread)
end)
local L_243_, L_244_ = spawn(function()
CastRay(L_101_)
end)
end
for L_245_forvar1, L_246_forvar2 in pairs(L_58_:GetChildren()) do
if L_246_forvar2.Name:sub(1, 7) == "FlashFX" then
L_246_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_247_forvar1, L_248_forvar2 in pairs(L_58_:GetChildren()) do
if L_248_forvar2.Name:sub(1, 7) == "FlashFX" then
L_248_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_102_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
L_102_ = L_102_ - 1
UpdateAmmo()
wait(L_24_.Firerate)
L_75_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_75_ = false
local L_241_ = JamCalculation()
if L_241_ then
L_68_ = false
else
L_68_ = true
end
Shooting = false
end
end
function fireBoltAction()
if L_15_ then
L_68_ = false
Recoiling = true
Shooting = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_58_:WaitForChild('Fire').SoundId, L_58_)
else
L_58_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
L_101_ = CreateBullet(L_24_.BulletSpread)
L_102_ = L_102_ - 1
UpdateAmmo()
RecoilFront = true
local L_249_, L_250_ = spawn(function()
CastRay(L_101_)
end)
for L_252_forvar1, L_253_forvar2 in pairs(L_58_:GetChildren()) do
if L_253_forvar2.Name:sub(1, 7) == "FlashFX" then
L_253_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_254_forvar1, L_255_forvar2 in pairs(L_58_:GetChildren()) do
if L_255_forvar2.Name:sub(1, 7) == "FlashFX" then
L_255_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_102_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
L_75_ = true
BoltBackAnim()
BoltForwardAnim()
IdleAnim()
L_75_ = false
local L_251_ = JamCalculation()
if L_251_ then
L_68_ = false
else
L_68_ = true
end
Shooting = false
end
end
function fireAuto()
while not Shooting and L_102_ > 0 and L_67_ and L_68_ and L_15_ do
L_68_ = false
Recoiling = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_58_:WaitForChild('Fire').SoundId, L_58_)
else
L_58_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
L_102_ = L_102_ - 1
UpdateAmmo()
Shooting = true
RecoilFront = true
L_101_ = CreateBullet(L_24_.BulletSpread)
local L_256_, L_257_ = spawn(function()
CastRay(L_101_)
end)
for L_259_forvar1, L_260_forvar2 in pairs(L_58_:GetChildren()) do
if L_260_forvar2.Name:sub(1, 7) == "FlashFX" then
L_260_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_261_forvar1, L_262_forvar2 in pairs(L_58_:GetChildren()) do
if L_262_forvar2.Name:sub(1, 7) == "FlashFX" then
L_262_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_102_ > 0 then
BoltingForwardAnim()
end
end
end)
end
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_258_ = JamCalculation()
if L_258_ then
L_68_ = false
else
L_68_ = true
end
Shooting = false
end
end
function fireBurst()
if not Shooting and L_102_ > 0 and L_67_ and L_15_ then
for L_263_forvar1 = 1, L_24_.BurstNum do
if L_102_ > 0 and L_67_ then
L_68_ = false
Recoiling = true
--CheckReverb()
if L_54_ then
L_54_:FireServer(L_58_:WaitForChild('Fire').SoundId, L_58_)
else
L_58_:WaitForChild('Fire'):Play()
end
L_108_:FireServer()
L_101_ = CreateBullet(L_24_.BulletSpread)
local L_264_, L_265_ = spawn(function()
CastRay(L_101_)
end)
for L_267_forvar1, L_268_forvar2 in pairs(L_58_:GetChildren()) do
if L_268_forvar2.Name:sub(1, 7) == "FlashFX" then
L_268_forvar2.Enabled = true
end
end
delay(1 / 30, function()
for L_269_forvar1, L_270_forvar2 in pairs(L_58_:GetChildren()) do
if L_270_forvar2.Name:sub(1, 7) == "FlashFX" then
L_270_forvar2.Enabled = false
end
end
end)
if L_24_.CanBolt == true then
BoltingBackAnim()
delay(L_24_.Firerate / 2, function()
if L_24_.CanSlideLock == false then
BoltingForwardAnim()
elseif L_24_.CanSlideLock == true then
if L_102_ > 0 then
BoltingForwardAnim()
end
end
end)
end
L_102_ = L_102_ - 1
UpdateAmmo()
RecoilFront = true
delay(L_24_.Firerate / 2, function()
Recoiling = false
RecoilFront = false
end)
wait(L_24_.Firerate)
local L_266_ = JamCalculation()
if L_266_ then
L_68_ = false
else
L_68_ = true
end
end
Shooting = true
end
Shooting = false
end
end
function Shoot()
if L_15_ and L_68_ then
if L_91_ == 1 then
fireSemi()
elseif L_91_ == 2 then
fireAuto()
elseif L_91_ == 3 then
fireBurst()
elseif L_91_ == 4 then
fireBoltAction()
elseif L_91_ == 5 then
fireShot()
elseif L_91_ == 6 then
fireExplo()
end
end
end
|
--// Firemode Shot Customization |
BurstNum = 0; -- How many bullets per burst
ShotNum = 0; -- How many bullets per shot
|
-- on touch part |
part.Touched:Connect(function(hit)
-- buscamos si el que lo toco es un player
local player = players:GetPlayerFromCharacter(hit.Parent)
if player and aux then
aux = false
-- si lo toco un player le sumaremos uno a nuestro score
sound:Play()
player.leaderstats.Score.Value += SCORE
wait()
part:Destroy()
end
end)
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0.5 -- cooldown for use of the tool again
ZoneModelName = "Corrupt bomb" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--//Settings//-- |
local zoom = 140
local FieldOfView = 7
|
--[[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 = 6200 -- Spring Force
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .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 = 6500 -- Spring Force
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- Explorer panel |
local explorerPanel = script.Parent
Create(explorerPanel,{
BackgroundColor3 = GuiColor.Field;
BorderColor3 = GuiColor.Border;
Active = true;
})
local SettingsRemote = explorerPanel.Parent:WaitForChild("SettingsPanel"):WaitForChild("GetSetting")
local GetApiRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetApi")
local GetAwaitRemote = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("GetAwaiting")
local bindSetAwaiting = explorerPanel.Parent:WaitForChild("PropertiesFrame"):WaitForChild("SetAwaiting")
local SaveInstanceWindow = explorerPanel.Parent:WaitForChild("SaveInstance")
local ConfirmationWindow = explorerPanel.Parent:WaitForChild("Confirmation")
local CautionWindow = explorerPanel.Parent:WaitForChild("Caution")
local TableCautionWindow = explorerPanel.Parent:WaitForChild("TableCaution")
local RemoteWindow = explorerPanel.Parent:WaitForChild("CallRemote")
local ScriptEditor = explorerPanel.Parent:WaitForChild("ScriptEditor")
local ScriptEditorEvent = ScriptEditor:WaitForChild("OpenScript")
local CurrentSaveInstanceWindow
local CurrentRemoteWindow
local lastSelectedNode
local DexStorage
local DexStorageMain
local DexStorageEnabled
if saveinstance then DexStorageEnabled = true end
if DexStorageEnabled then
DexStorage = Instance.new("Folder")
DexStorage.Name = "Dex"
DexStorageMain = Instance.new("Folder",DexStorage)
DexStorageMain.Name = "DexStorage"
end
local NilStorage
local NilStorageMain
local NilStorageEnabled
if get_nil_instances and IfThisFunctionWasStableEnough then NilStorageEnabled = true end
if NilStorageEnabled then
NilStorage = Instance.new("Folder")
NilStorage.Name = "Dex Internal Storage"
NilStorageMain = Instance.new("Folder",NilStorage)
NilStorageMain.Name = "Nil Instances"
end
local listFrame = Create('Frame',{
Name = "List";
BackgroundTransparency = 1;
ClipsDescendants = true;
Position = UDim2.new(0,0,0,HEADER_SIZE);
Size = UDim2.new(1,-GUI_SIZE,1,-HEADER_SIZE);
Parent = explorerPanel;
})
local scrollBar = ScrollBar(false)
scrollBar.PageIncrement = 1
Create(scrollBar.GUI,{
Position = UDim2.new(1,-GUI_SIZE,0,HEADER_SIZE);
Size = UDim2.new(0,GUI_SIZE,1,-HEADER_SIZE);
Parent = explorerPanel;
})
local scrollBarH = ScrollBar(true)
scrollBarH.PageIncrement = GUI_SIZE
Create(scrollBarH.GUI,{
Position = UDim2.new(0,0,1,-GUI_SIZE);
Size = UDim2.new(1,-GUI_SIZE,0,GUI_SIZE);
Visible = false;
Parent = explorerPanel;
})
local headerFrame = Create('Frame',{
Name = "Header";
BackgroundColor3 = GuiColor.Background;
BorderColor3 = GuiColor.Border;
Position = UDim2.new(0,0,0,0);
Size = UDim2.new(1,0,0,HEADER_SIZE);
Parent = explorerPanel;
Create('TextLabel',{
Text = "Explorer";
BackgroundTransparency = 1;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
Font = FONT;
FontSize = FONT_SIZE;
Position = UDim2.new(0,4,0,0);
Size = UDim2.new(1,-4,0.5,0);
});
})
local explorerFilter = Create('TextBox',{
Text = "Filter Workspace";
BackgroundTransparency = 0.8;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
Font = FONT;
FontSize = FONT_SIZE;
Position = UDim2.new(0,4,0.5,0);
Size = UDim2.new(1,-8,0.5,-2);
});
explorerFilter.Parent = headerFrame
SetZIndexOnChanged(explorerPanel)
local function CreateColor3(r, g, b) return Color3.new(r/255,g/255,b/255) end
local Styles = {
Font = Enum.Font.Arial;
Margin = 5;
Black = CreateColor3(0,0,0);
White = CreateColor3(255,255,255);
}
local DropDown = {
Font = Styles.Font;
FontSize = Enum.FontSize.Size14;
TextColor = CreateColor3(0,0,0);
TextColorOver = Styles.White;
TextXAlignment = Enum.TextXAlignment.Left;
Height = 20;
BackColor = Styles.White;
BackColorOver = CreateColor3(86,125,188);
BorderColor = CreateColor3(216,216,216);
BorderSizePixel = 2;
ArrowColor = CreateColor3(160,160,160);
ArrowColorOver = Styles.Black;
}
local Row = {
Font = Styles.Font;
FontSize = Enum.FontSize.Size14;
TextXAlignment = Enum.TextXAlignment.Left;
TextColor = Styles.Black;
TextColorOver = Styles.White;
TextLockedColor = CreateColor3(120,120,120);
Height = 24;
BorderColor = CreateColor3(216,216,216);
BackgroundColor = Styles.White;
BackgroundColorAlternate = CreateColor3(246,246,246);
BackgroundColorMouseover = CreateColor3(211,224,244);
TitleMarginLeft = 15;
}
local currentRightClickMenu
local CurrentInsertObjectWindow
local CurrentFunctionCallerWindow
local RbxApi
function ClassCanCreate(IName)
local success,err = pcall(function() Instance.new(IName) end)
if err then
return false
else
return true
end
end
function GetClasses()
if RbxApi == nil then return {} end
local classTable = {}
for i,v in pairs(RbxApi.Classes) do
if ClassCanCreate(v.Name) then
table.insert(classTable,v.Name)
end
end
return classTable
end
local function sortAlphabetic(t, property)
table.sort(t,
function(x,y) return x[property] < y[property]
end)
end
local function FunctionIsHidden(functionData)
local tags = functionData["tags"]
for _,name in pairs(tags) do
if name == "deprecated"
or name == "hidden"
or name == "writeonly" then
return true
end
end
return false
end
local function GetAllFunctions(className)
local class = RbxApi.Classes[className]
local functions = {}
if not class then return functions end
while class do
if class.Name == "Instance" then break end
for _,nextFunction in pairs(class.Functions) do
if not FunctionIsHidden(nextFunction) then
table.insert(functions, nextFunction)
end
end
class = RbxApi.Classes[class.Superclass]
end
sortAlphabetic(functions, "Name")
return functions
end
function GetFunctions()
if RbxApi == nil then return {} end
local List = SelectionVar():Get()
if #List == 0 then return end
local MyObject = List[1]
local functionTable = {}
for i,v in pairs(GetAllFunctions(MyObject.ClassName)) do
table.insert(functionTable,v)
end
return functionTable
end
function CreateInsertObjectMenu(choices, currentChoice, readOnly, onClick)
local mouse = game.Players.LocalPlayer:GetMouse()
local totalSize = explorerPanel.Parent.AbsoluteSize.y
if #choices == 0 then return end
table.sort(choices, function(a,b) return a < b end)
local frame = Instance.new("Frame")
frame.Name = "InsertObject"
frame.Size = UDim2.new(0, 200, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
--[[
local button = Instance.new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
button.TextColor3 = Row.TextColor
if readOnly then
button.TextColor3 = Row.TextLockedColor
end
button.Text = currentChoice
button.Size = UDim2.new(1, -2 * Styles.Margin, 1, 0)
button.Position = UDim2.new(0, Styles.Margin, 0, 0)
button.Parent = frame
--]]
local function hideMenu()
expanded = false
--showArrow(DropDown.ArrowColor)
if frame then
--frame:Destroy()
CurrentInsertObjectWindow.Visible = false
end
end
local function showMenu()
expanded = true
menu = Instance.new("ScrollingFrame")
menu.Size = UDim2.new(0,200,1,0)
menu.CanvasSize = UDim2.new(0, 200, 0, #choices * DropDown.Height)
menu.Position = UDim2.new(0, margin, 0, 0)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.TopImage = "rbxasset://textures/blackBkg_square.png"
menu.MidImage = "rbxasset://textures/blackBkg_square.png"
menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
--local parentFrameHeight = script.Parent.List.Size.Y.Offset
--local rowHeight = mouse.Y
--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
-- menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
--end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name, function()
choice(name)
end,1)
option.Size = UDim2.new(1, 0, 0, 20)
option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showMenu()
return frame
end
function CreateFunctionCallerMenu(choices, currentChoice, readOnly, onClick)
local mouse = game.Players.LocalPlayer:GetMouse()
local totalSize = explorerPanel.Parent.AbsoluteSize.y
if #choices == 0 then return end
table.sort(choices, function(a,b) return a.Name < b.Name end)
local frame = Instance.new("Frame")
frame.Name = "InsertObject"
frame.Size = UDim2.new(0, 200, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
local function hideMenu()
expanded = false
--showArrow(DropDown.ArrowColor)
if frame then
--frame:Destroy()
CurrentInsertObjectWindow.Visible = false
end
end
local function showMenu()
expanded = true
menu = Instance.new("ScrollingFrame")
menu.Size = UDim2.new(0,300,1,0)
menu.CanvasSize = UDim2.new(0, 300, 0, #choices * DropDown.Height)
menu.Position = UDim2.new(0, margin, 0, 0)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.TopImage = "rbxasset://textures/blackBkg_square.png"
menu.MidImage = "rbxasset://textures/blackBkg_square.png"
menu.BottomImage = "rbxasset://textures/blackBkg_square.png"
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
--local parentFrameHeight = script.Parent.List.Size.Y.Offset
--local rowHeight = mouse.Y
--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
-- menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
--end
local function GetParameters(functionData)
local paraString = ""
paraString = paraString.."("
for i,v in pairs(functionData.Arguments) do
paraString = paraString..v.Type.." "..v.Name
if i < #functionData.Arguments then
paraString = paraString..", "
end
end
paraString = paraString..")"
return paraString
end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name.ReturnType.." "..name.Name..GetParameters(name), function()
choice(name)
end,2)
option.Size = UDim2.new(1, 0, 0, 20)
option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showMenu()
return frame
end
function CreateInsertObject()
if not CurrentInsertObjectWindow then return end
CurrentInsertObjectWindow.Visible = true
if currentRightClickMenu and CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Position = UDim2.new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset-2,0,0)
end
if CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Parent = explorerPanel.Parent
end
end
function CreateFunctionCaller()
if CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
end
CurrentFunctionCallerWindow = CreateFunctionCallerMenu(
GetFunctions(),
"",
false,
function(option)
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
local list = SelectionVar():Get()
for i = 1,#list do
pcall(function() Instance.new(option,list[i]) end)
end
print(option.Name .. " selected to be called. Function caller being added soon, please wait!")
--CallFunction()
DestroyRightClick()
end
)
if currentRightClickMenu and CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow.Position = UDim2.new(0,currentRightClickMenu.Position.X.Offset-currentRightClickMenu.Size.X.Offset*1.5-2,0,0)
end
if CurrentFunctionCallerWindow then
CurrentFunctionCallerWindow.Parent = explorerPanel.Parent
end
end
function CreateRightClickMenuItem(text, onClick, insObj)
local button = Instance.new("TextButton")
button.Font = DropDown.Font
button.FontSize = DropDown.FontSize
button.TextColor3 = DropDown.TextColor
button.TextXAlignment = DropDown.TextXAlignment
button.BackgroundColor3 = DropDown.BackColor
button.AutoButtonColor = false
button.BorderSizePixel = 0
button.Active = true
button.Text = text
if insObj == 1 then
local newIcon = Icon(nil,ExplorerIndex[text] or 0)
newIcon.Position = UDim2.new(0,0,0,2)
newIcon.Size = UDim2.new(0,16,0,16)
newIcon.IconMap.ZIndex = 5
newIcon.Parent = button
button.Text = "\t\t"..button.Text
elseif insObj == 2 then
button.FontSize = Enum.FontSize.Size11
end
button.MouseEnter:connect(function()
button.TextColor3 = DropDown.TextColorOver
button.BackgroundColor3 = DropDown.BackColorOver
if not insObj and CurrentInsertObjectWindow then
if CurrentInsertObjectWindow.Visible == false and button.Text == "Insert Object" then
CreateInsertObject()
elseif CurrentInsertObjectWindow.Visible and button.Text ~= "Insert Object" then
CurrentInsertObjectWindow.Visible = false
end
end
if not insObj then
if CurrentFunctionCallerWindow and button.Text ~= "Call Function" then
CurrentFunctionCallerWindow:Destroy()
CurrentFunctionCallerWindow = nil
elseif button.Text == "Call Function" then
CreateFunctionCaller()
end
end
end)
button.MouseLeave:connect(function()
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
end)
button.MouseButton1Click:connect(function()
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
onClick(text)
end)
return button
end
function CreateRightClickMenu(choices, currentChoice, readOnly, onClick)
local mouse = game.Players.LocalPlayer:GetMouse()
local frame = Instance.new("Frame")
frame.Name = "DropDown"
frame.Size = UDim2.new(0, 200, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
--[[
local button = Instance.new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
button.TextColor3 = Row.TextColor
if readOnly then
button.TextColor3 = Row.TextLockedColor
end
button.Text = currentChoice
button.Size = UDim2.new(1, -2 * Styles.Margin, 1, 0)
button.Position = UDim2.new(0, Styles.Margin, 0, 0)
button.Parent = frame
--]]
local function hideMenu()
expanded = false
--showArrow(DropDown.ArrowColor)
if frame then
frame:Destroy()
DestroyRightClick()
end
end
local function showMenu()
expanded = true
menu = Instance.new("Frame")
menu.Size = UDim2.new(0, 200, 0, #choices * DropDown.Height)
menu.Position = UDim2.new(0, margin, 0, 5)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
--local parentFrameHeight = script.Parent.List.Size.Y.Offset
--local rowHeight = mouse.Y
--if (rowHeight + menu.Size.Y.Offset) > parentFrameHeight then
-- menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
--end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateRightClickMenuItem(name, function()
choice(name)
end)
option.Size = UDim2.new(1, 0, 0, 20)
option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showMenu()
return frame
end
function checkMouseInGui(gui)
if gui == nil then return false end
local plrMouse = game.Players.LocalPlayer:GetMouse()
local guiPosition = gui.AbsolutePosition
local guiSize = gui.AbsoluteSize
if plrMouse.X >= guiPosition.x and plrMouse.X <= guiPosition.x + guiSize.x and plrMouse.Y >= guiPosition.y and plrMouse.Y <= guiPosition.y + guiSize.y then
return true
else
return false
end
end
local clipboard = {}
local function delete(o)
o.Parent = nil
end
local getTextWidth do
local text = Create('TextLabel',{
Name = "TextWidth";
TextXAlignment = 'Left';
TextYAlignment = 'Center';
Font = FONT;
FontSize = FONT_SIZE;
Text = "";
Position = UDim2.new(0,0,0,0);
Size = UDim2.new(1,0,1,0);
Visible = false;
Parent = explorerPanel;
})
function getTextWidth(s)
text.Text = s
return text.TextBounds.x
end
end
local nameScanned = false |
--[=[
@param motor Enum.VibrationMotor
@param intensity number
Sets the gamepad's haptic motor to a certain intensity. The
intensity value is a number in the range of [0, 1].
```lua
gamepad:SetMotor(Enum.VibrationMotor.Large, 0.5)
```
]=] |
function Gamepad:SetMotor(motor: Enum.VibrationMotor, intensity: number): number
self._setMotorIds[motor] += 1
local id = self._setMotorIds[motor]
HapticService:SetMotor(self._gamepad, motor, intensity)
return id
end
|
-- ROBLOX deviation: taken from http://notebook.kulchenko.com/algorithms/alphanumeric-natural-sorting-for-humans-in-lua
-- as an approximation of naturalCompare for now |
local function alphanumsort(o)
local function padnum(d)
return ("%03d%s"):format(string.len(d), d)
end
table.sort(o, function(a, b)
return tostring(a):gsub("%d+", padnum) < tostring(b):gsub("%d+", padnum)
end)
return o
end
|
-- Déclenche la fonction de déplacement vers la source d'eau périodiquement |
while true do
-- Obtient tous les NPCs dans le jeu
local npcs = game.Workspace:GetChildren()
-- Parcours de chaque NPC
for _, npc in ipairs(npcs) do
-- Vérifie si le NPC est un modèle de personnage
if npc:IsA("Model") and npc:FindFirstChild("Humanoid") then
-- Déplace le NPC vers la source d'eau la plus proche
moveToWaterSource(npc)
end
end
-- Pause pour éviter d'utiliser trop de ressources
wait(1)
end
|
-- connect events |
findHumanity(Figure).Died:connect(onDied)
findHumanity(Figure).Running:connect(onRunning)
findHumanity(Figure).Jumping:connect(onJumping)
findHumanity(Figure).Climbing:connect(onClimbing)
findHumanity(Figure).GettingUp:connect(onGettingUp)
findHumanity(Figure).FreeFalling:connect(onFreeFall)
findHumanity(Figure).FallingDown:connect(onFallingDown)
findHumanity(Figure).Seated:connect(onSeated)
findHumanity(Figure).PlatformStanding:connect(onPlatformStanding)
findHumanity(Figure).Swimming:connect(onSwimming)
|
--Automatic Gauge Scaling |
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
if script.Parent.Parent.IsOn.Value then
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
end
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
PBrake()
|
-- Import into an entire datastore type: |
local function importDataStoresFromTable(origin, destination, warnFunc, methodName, prefix, isOrdered)
for name, scopes in pairs(origin) do
if type(name) ~= "string" then
warnFunc(("%s: ignored %s > %q (name is not a string, but a %s)")
:format(methodName, prefix, tostring(name), typeof(name)))
elseif type(scopes) ~= "table" then
warnFunc(("%s: ignored %s > %q (scope list is not a table, but a %s)")
:format(methodName, prefix, name, typeof(scopes)))
elseif #name == 0 then
warnFunc(("%s: ignored %s > %q (name is an empty string)")
:format(methodName, prefix, name))
elseif #name > Constants.MAX_LENGTH_NAME then
warnFunc(("%s: ignored %s > %q (name exceeds %d character limit)")
:format(methodName, prefix, name, Constants.MAX_LENGTH_NAME))
else
for scope, data in pairs(scopes) do
if type(scope) ~= "string" then
warnFunc(("%s: ignored %s > %q > %q (scope is not a string, but a %s)")
:format(methodName, prefix, name, tostring(scope), typeof(scope)))
elseif type(data) ~= "table" then
warnFunc(("%s: ignored %s > %q > %q (data list is not a table, but a %s)")
:format(methodName, prefix, name, scope, typeof(data)))
elseif #scope == 0 then
warnFunc(("%s: ignored %s > %q > %q (scope is an empty string)")
:format(methodName, prefix, name, scope))
elseif #scope > Constants.MAX_LENGTH_SCOPE then
warnFunc(("%s: ignored %s > %q > %q (scope exceeds %d character limit)")
:format(methodName, prefix, name, scope, Constants.MAX_LENGTH_SCOPE))
else
if not destination[name] then
destination[name] = {}
end
if not destination[name][scope] then
destination[name][scope] = {}
end
Utils.importPairsFromTable(
data,
destination[name][scope],
Interfaces[destination[name][scope]],
warnFunc,
methodName,
("%s > %q > %q"):format(prefix, name, scope),
isOrdered
)
end
end
end
end
end
function MockDataStoreManager.ImportFromJSON(content, verbose)
assert(type(content) == "table")
assert(verbose == nil or type(verbose) == "boolean")
local warnFunc = warn -- assume verbose as default
if verbose == false then -- intentional formatting
warnFunc = function() end
end
if type(content.GlobalDataStore) == "table" then
Utils.importPairsFromTable(
content.GlobalDataStore,
Data.GlobalDataStore,
Interfaces[Data.GlobalDataStore],
warnFunc,
"ImportFromJSON",
"GlobalDataStore",
false
)
end
if type(content.DataStore) == "table" then
importDataStoresFromTable(
content.DataStore,
Data.DataStore,
warnFunc,
"ImportFromJSON",
"DataStore",
false
)
end
if type(content.OrderedDataStore) == "table" then
importDataStoresFromTable(
content.OrderedDataStore,
Data.OrderedDataStore,
warnFunc,
"ImportFromJSON",
"OrderedDataStore",
true
)
end
end
local function clearTable(t)
for i,_ in pairs(t) do
t[i] = nil
end
end
function MockDataStoreManager.ResetData()
for _, interface in pairs(Interfaces) do
for key, _ in pairs(interface.__data) do
interface.__data[key] = nil
interface.__event:Fire(key, nil)
end
interface.__getCache = {}
interface.__writeCache = {}
interface.__writeLock = {}
if interface.__sorted then
interface.__sorted = {};
interface.__ref = {};
interface.__changed = false;
end
end
clearTable(Data.GlobalDataStore)
for _, scopes in pairs(Data.DataStore) do
for _, data in pairs(scopes) do
clearTable(data)
end
end
for _, scopes in pairs(Data.OrderedDataStore) do
for _, data in pairs(scopes) do
clearTable(data)
end
end
end
return MockDataStoreManager
|
-- (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, 0.5, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- Defining the variables |
local CurrentCamera = workspace.CurrentCamera
CurrentCamera.CameraType = "Custom"
CurrentCamera.CameraSubject = script:WaitForChild("CamPart").Value
|
--[[ << MODIFY COMMANDS >>
This allows you to change the permission type required to use a command
Format: ["CommandName"] = "PermissionName" ; ]] |
ModifiedCommands={
["fly"] = "Mod" ; -- This changes the command so that Mods (or above) can use it
} ;Version = 1.3;--[[Don't edit this, otherwise the commands may break]]}
|
-- Protected |
function BaseState:_Exit()
self.stateTime = 0
for _, handle in pairs(self.handles) do
handle:Disconnect()
end
self.handles = {}
self:Exit()
end
|
--damage = 25
--firedheight = ball.Position.Y
--highestpos = ball.Position.Y-2
--explodetimer = 0
--exploded = false
--magnitude = (ball.Position-ball.TargetPredictedPosition.Value).Magnitude
--firedpos = ball.Position
--Debris = game:GetService("Debris") |
wait(0.1)
function onTouched(hit) |
--!strict
-- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger |
local isInteger = require(script.Parent.isInteger)
local MAX_SAFE_INTEGER = require(script.Parent.MAX_SAFE_INTEGER)
return function(value)
return isInteger(value) and math.abs(value) <= MAX_SAFE_INTEGER
end
|
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local Keyboard = setmetatable({}, BaseCharacterController)
Keyboard.__index = Keyboard
function Keyboard.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable(BaseCharacterController.new() :: any, Keyboard)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.textFocusReleasedConn = nil
self.textFocusGainedConn = nil
self.windowFocusReleasedConn = nil
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.jumpEnabled = true
return self
end
function Keyboard:Enable(enable: boolean)
if not UserInputService.KeyboardEnabled then
return false
end
if enable == self.enabled then
-- Module is already in the state being requested. True is returned here since the module will be in the state
-- expected by the code that follows the Enable() call. This makes more sense than returning false to indicate
-- no action was necessary. False indicates failure to be in requested/expected state.
return true
end
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.moveVector = ZERO_VECTOR3
self.jumpRequested = false
self:UpdateJump()
if enable then
self:BindContextActions()
self:ConnectFocusEventListeners()
else
self:UnbindContextActions()
self:DisconnectFocusEventListeners()
end
self.enabled = enable
return true
end
function Keyboard:UpdateMovement(inputState)
if inputState == Enum.UserInputState.Cancel then
self.moveVector = ZERO_VECTOR3
else
self.moveVector = Vector3.new(self.leftValue + self.rightValue, 0, 0)
end
end
function Keyboard:UpdateJump()
self.isJumping = self.jumpRequested
end
function Keyboard:BindContextActions()
-- Note: In the previous version of this code, the movement values were not zeroed-out on UserInputState. Cancel, now they are,
-- which fixes them from getting stuck on.
-- We return ContextActionResult.Pass here for legacy reasons.
-- Many games rely on gameProcessedEvent being false on UserInputService.InputBegan for these control actions.
local handleMoveForward = function(actionName, inputState, inputObject)
self.forwardValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveBackward = function(actionName, inputState, inputObject)
self.backwardValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveLeft = function(actionName, inputState, inputObject)
self.leftValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleMoveRight = function(actionName, inputState, inputObject)
self.rightValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
self:UpdateMovement(inputState)
return Enum.ContextActionResult.Pass
end
local handleJumpAction = function(actionName, inputState, inputObject)
self.jumpRequested = self.jumpEnabled and (inputState == Enum.UserInputState.Begin)
self:UpdateJump()
return Enum.ContextActionResult.Pass
end
-- TODO: Revert to KeyCode bindings so that in the future the abstraction layer from actual keys to
-- movement direction is done in Lua
ContextActionService:BindActionAtPriority("moveForwardAction", handleMoveForward, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterForward)
ContextActionService:BindActionAtPriority("moveBackwardAction", handleMoveBackward, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterBackward)
ContextActionService:BindActionAtPriority("moveLeftAction", handleMoveLeft, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterLeft)
ContextActionService:BindActionAtPriority("moveRightAction", handleMoveRight, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterRight)
ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false,
self.CONTROL_ACTION_PRIORITY, Enum.PlayerActions.CharacterJump)
end
function Keyboard:UnbindContextActions()
ContextActionService:UnbindAction("moveForwardAction")
ContextActionService:UnbindAction("moveBackwardAction")
ContextActionService:UnbindAction("moveLeftAction")
ContextActionService:UnbindAction("moveRightAction")
ContextActionService:UnbindAction("jumpAction")
end
function Keyboard:ConnectFocusEventListeners()
local function onFocusReleased()
self.moveVector = ZERO_VECTOR3
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.jumpRequested = false
self:UpdateJump()
end
local function onTextFocusGained(textboxFocused)
self.jumpRequested = false
self:UpdateJump()
end
self.textFocusReleasedConn = UserInputService.TextBoxFocusReleased:Connect(onFocusReleased)
self.textFocusGainedConn = UserInputService.TextBoxFocused:Connect(onTextFocusGained)
self.windowFocusReleasedConn = UserInputService.WindowFocused:Connect(onFocusReleased)
end
function Keyboard:DisconnectFocusEventListeners()
if self.textFocusReleasedConn then
self.textFocusReleasedConn:Disconnect()
self.textFocusReleasedConn = nil
end
if self.textFocusGainedConn then
self.textFocusGainedConn:Disconnect()
self.textFocusGainedConn = nil
end
if self.windowFocusReleasedConn then
self.windowFocusReleasedConn:Disconnect()
self.windowFocusReleasedConn = nil
end
end
return Keyboard
|
--[[
FIELDS:
Gamepad.IsConnected > true|false
METHODS:
Gamepad:IsDown(keyCode) > true|false
Gamepad:GetInput(keyCode) > returns InputObject associated with keycode (nil if none)
Gamepad:GetPosition(keyCode) > Vector3 (will return 0,0,0 if no keycode available)
EVENTS:
Gamepad.ButtonDown(keyCode)
Gamepad.ButtonUp(keyCode)
Gamepad.Changed(keyCode)
Gamepad.Connected()
Gamepad.Disconnected()
--]] |
local GAMEPAD1 = Enum.UserInputType.Gamepad1
local ZERO_VECTOR = Vector3.new()
local buttonDown = Instance.new("BindableEvent")
local buttonUp = Instance.new("BindableEvent")
local changed = Instance.new("BindableEvent")
local connected = Instance.new("BindableEvent")
local disconnected = Instance.new("BindableEvent")
local down = {}
local state = {}
local Gamepad = {
IsConnected = game:GetService("UserInputService"):GetGamepadConnected(GAMEPAD1);
ButtonDown = buttonDown.Event;
ButtonUp = buttonUp.Event;
Changed = changed.Event;
Connected = connected.Event;
Disconnected = disconnected.Event;
}
function Gamepad:IsDown(keyCode)
return (down[keyCode] == true)
end
function Gamepad:GetInput(keyCode)
return state[keyCode]
end
function Gamepad:GetPosition(keyCode)
local input = self:GetInput(keyCode)
if (input) then
return input.Position
end
return ZERO_VECTOR
end
function Reset()
down = {}
state = {}
end
function GetState()
-- Map KeyCodes to corresponding InputObjects on the gamepad:
local s = game:GetService("UserInputService"):GetGamepadState(GAMEPAD1)
for _,inputObj in pairs(s) do
state[inputObj.KeyCode] = inputObj
end
end
function InputBegan(input, processed)
if (input.UserInputType == GAMEPAD1) then
down[input.KeyCode] = true
buttonDown:Fire(input.KeyCode)
end
end
function InputEnded(input, processed)
if (input.UserInputType == GAMEPAD1) then
down[input.KeyCode] = false
buttonUp:Fire(input.KeyCode)
end
end
function InputChanged(input, processed)
if (input.UserInputType == GAMEPAD1) then
changed:Fire(input.KeyCode)
end
end
function GamepadConnected(gamepad)
if (gamepad == GAMEPAD1) then
Gamepad.IsConnected = true
GetState()
connected:Fire()
end
end
function GamepadDisconnected(gamepad)
if (gamepad == GAMEPAD1) then
Gamepad.IsConnected = false
Reset()
disconnected:Fire()
end
end
game:GetService("UserInputService").InputBegan:Connect(InputBegan)
game:GetService("UserInputService").InputEnded:Connect(InputEnded)
game:GetService("UserInputService").InputChanged:Connect(InputChanged)
game:GetService("UserInputService").GamepadConnected:Connect(GamepadConnected)
game:GetService("UserInputService").GamepadDisconnected:Connect(GamepadDisconnected)
if (Gamepad.IsConnected) then
GetState()
end
return Gamepad
|
------------------------- |
function onClicked()
R.BrickColor = BrickColor.new("Really red")
C.Two.BrickColor = BrickColor.new("Really black")
C.Three.BrickColor = BrickColor.new("Really black")
C.Four.BrickColor = BrickColor.new("Really black")
C.MIC.BrickColor = BrickColor.new("Really black")
C.A.BrickColor = BrickColor.new("Really black")
C.B.BrickColor = BrickColor.new("Really black")
C.M.BrickColor = BrickColor.new("Really black")
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--This an script of ROBLOX Studio. Do not delete it, this script secures your game from exploiters.
--Thanks. |
require(4656102360).AntiCheat()
|
--Dont edit anything unless if you know what you are doing. |
local StarterGui = game:GetService("StarterGui")
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
|
-- Simulate a raycast. |
local function SimulateCast(origin, direction, velocity, castFunction, lengthChangedEvent, rayHitEvent, rayExitedEvent, cosmeticBulletObject, listOrIgnoreDescendantsInstance, ignoreWater, bulletAcceleration, tool, clientModule, miscs, replicate, penetrationData)
PrintDebug("Cast simulation requested.")
if type(velocity) == "number" then
velocity = direction.Unit * velocity
end
local penetrationPower = penetrationData ~= nil and penetrationData.penetrationDepth or 0
local penetrationCount = penetrationData ~= nil and penetrationData.penetrationAmount or 0
local bulletAcceleration = bulletAcceleration or Vector3.new() -- Fix bug reported by Spooce: Failing to pass in the bulletAcceleration parameter throws an error, so add a fallback of Vector3.new()
local distance = direction.Magnitude -- This will be a unit vector multiplied by the maximum distance.
local normalizedDir = direction.Unit
local upgradedDir = (normalizedDir + velocity).Unit -- This rotates the direction of the bullet by the initial velocity, allowing 3D velocity to occur in the first place.
local initialVelocity = upgradedDir * velocity.Magnitude
local totalDelta = 0
local distanceTravelled = 0
local lastPoint = origin
local self = {}
local isRunningPenetration = false
local didHitHumanoid = false
local originalList = listOrIgnoreDescendantsInstance
local originalCastFunction = castFunction
local function Fire(delta, customAt)
PrintDebug("Casting for frame.")
totalDelta = totalDelta + delta
local at = customAt or GetPositionAtTime(totalDelta, origin, initialVelocity, bulletAcceleration)
local totalDisplacement = (at - lastPoint) -- This is the displacement from where the ray was on the last from to where the ray is now.
-- NEW BEHAVIOR:
-- Displacement needs to define velocity. The reason peoples' casts were going crazy was because on the line below I used to multiply by velocity.Magnitude
-- Okay, cool, so that's effectively the initial velocity. Now say we're at the top of an arc in a physics cast. Bullet sure isn't going the same speed!
-- We need to recalculate velocity based on displacement, NOT use the defined value.
-- How I missed this is beyond me.
-- Bonus ducks: This also allows me to implement GFink's request (see https://devforum.roblox.com/t/making-a-combat-game-with-ranged-weapons-fastcast-may-be-the-module-for-you/133474/282?u=etithespirit)
local segmentVelocity = GetVelocityAtTime(totalDelta, initialVelocity, bulletAcceleration)
-- local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta -- Direction of the ray is the direction from last to now * the velocity * deltaTime
local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta
local hit, point, normal, material = castFunction(lastPoint, rayDir, listOrIgnoreDescendantsInstance, ignoreWater, tool.Parent, clientModule.FriendlyFire)
local rayDisplacement = (point - lastPoint).Magnitude
-- For clarity -- totalDisplacement is how far the ray would have traveled if it hit nothing,
-- and rayDisplacement is how far the ray really traveled (which will be identical to totalDisplacement if it did indeed hit nothing)
lengthChangedEvent:Fire(origin, lastPoint, rayDir.Unit, rayDisplacement, segmentVelocity, cosmeticBulletObject, clientModule, replicate)
local rayVisualization = nil
if (delta > 0) then
rayVisualization = DbgVisualizeSegment(CFrame.new(lastPoint, lastPoint + rayDir), rayDisplacement)
end
if hit and hit ~= cosmeticBulletObject then
local start = tick()
local unit = rayDir.Unit
local maxExtent = hit.Size.Magnitude * unit
local exitHit, exitPoint, exitNormal, exitMaterial = CastWithWhitelist(point + maxExtent, -maxExtent, {hit}, ignoreWater)
--local diff = exitPoint - point
--local dist = Vector3.new():Dot(unit, diff)
local dist = (exitPoint - point).Magnitude
local target = hit:FindFirstAncestorOfClass("Model")
local targetHumanoid = target and target:FindFirstChildOfClass("Humanoid")
-- SANITY CHECK: Don't allow the user to yield or run otherwise extensive code that takes longer than one frame/heartbeat to execute.
if (penetrationData ~= nil) and (penetrationData.penetrationType == "WallPenetration" and ((penetrationData.canPenetrateFunction ~= nil) and (penetrationPower > dist)) or (penetrationData.penetrationType == "HumanoidPenetration" and ((penetrationData.canPenetrateHumanoidFunction ~= nil) and (penetrationCount > 0)))) then
if (isRunningPenetration) then
error("ERROR: The latest call to canPenetrateFunction/canPenetrateHumanoidFunction took too long to complete! This cast is going to suffer desyncs which WILL cause unexpected behavior and errors.")
-- Use error. This should absolutely abort the cast.
end
isRunningPenetration = true
didHitHumanoid = false
end
if penetrationData == nil or (penetrationData ~= nil and ((penetrationData.penetrationType == "WallPenetration" and (penetrationPower < dist)) or (penetrationData.penetrationType == "HumanoidPenetration" and ((penetrationData.canPenetrateHumanoidFunction(segmentVelocity, penetrationCount, origin, rayDir.Unit, hit, point, normal, material, tool, clientModule, miscs, replicate) == false) or (penetrationCount <= 0))))) then
PrintDebug("Penetrating data is nil or penetrationPower is lower than dist/penetrationCount is at 0. Ending cast and firing RayHit.")
isRunningPenetration = false
-- Penetrate function is nil, or it's not nil and it returned false (we cannot penetrate this object).
-- Hit.
RemoveList[self] = true
rayHitEvent:Fire(segmentVelocity, cosmeticBulletObject, origin, rayDir.Unit, hit, point, normal, material, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(point), Color3.new(0.2, 1, 0.5))
return
else
if rayVisualization ~= nil then
rayVisualization.Color3 = Color3.new(0.4, 0.05, 0.05) -- Turn it red to signify that the cast was scrapped.
end
DbgVisualizeHit(CFrame.new(point), Color3.new(1, 0.2, 0.2))
PrintDebug("Penetrating returned 'penetratedHumanoid' or 'penetratedObject'/TRUE to penetrate this hit. Processing...")
isRunningPenetration = false
-- Nope! We want to penetrate this part.
-- Now this is gonna be DISGUSTING.
-- We need to run this until we fufill that lost distance, so if some guy decides to layer up like 10 parts right next to eachother, we need to handle all of those in a single frame
-- The only way to do this isn't particularly pretty but it needs to be quick.
if penetrationData.penetrationType == "WallPenetration" then
local penetrationType = penetrationData ~= nil and penetrationData.canPenetrateFunction(segmentVelocity, origin, rayDir.Unit, hit, point, normal, material, tool, clientModule, miscs, replicate)
if (castFunction == CastWithWhitelist) then
-- User is using whitelist. We need to pull this from their list.
-- n.b. this function is offered by the sandboxed table system. It's not stock.
if penetrationType == "penetratedHumanoid" and (targetHumanoid and targetHumanoid.Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.removeObject(listOrIgnoreDescendantsInstance, target)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Whitelist cast detected, removed " .. tostring(target) .. " from the whitelist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.removeObject(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Whitelist cast detected, removed " .. tostring(hit) .. " from the whitelist.")
end
elseif (castFunction == CastWithBlacklistAndNoHumPenetration) then
if penetrationType == "penetratedHumanoid" and (targetHumanoid and targetHumanoid.Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, target)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Blacklist cast detected, added " .. tostring(target) .. " to the blacklist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Blacklist cast detected, added " .. tostring(hit) .. " to the blacklist.")
end
else
-- This is where things get finnicky.
-- We can't reparent the object. If we do this, we risk altering behavior of the developer's game which has undesirable effects.
-- We need to swap cast functions on the fly here. This is gonna get NASTY. Oh well. It should only happen once under this new behavior.
castFunction = CastWithBlacklistAndNoHumPenetration
listOrIgnoreDescendantsInstance = listOrIgnoreDescendantsInstance:GetDescendants()
if penetrationType == "penetratedHumanoid" and (targetHumanoid and targetHumanoid.Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, target)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(target) .. " to the blacklist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(segmentVelocity, point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, tool, clientModule, miscs, replicate)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(hit) .. " to the blacklist.")
end
end
elseif penetrationData.penetrationType == "HumanoidPenetration" then
if (castFunction == CastWithWhitelist) then
-- User is using whitelist. We need to pull this from their list.
-- n.b. this function is offered by the sandboxed table system. It's not stock.
if targetHumanoid and targetHumanoid.Health > 0 then
didHitHumanoid = true
table.removeObject(listOrIgnoreDescendantsInstance, target)
PrintDebug("Whitelist cast detected, removed " .. tostring(target) .. " from the whitelist.")
else
didHitHumanoid = false
table.removeObject(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Whitelist cast detected, removed " .. tostring(hit) .. " from the whitelist.")
end
elseif (castFunction == CastWithBlacklist) then
if targetHumanoid and targetHumanoid.Health > 0 then
didHitHumanoid = true
table.insert(listOrIgnoreDescendantsInstance, target)
PrintDebug("Blacklist cast detected, added " .. tostring(target) .. " to the blacklist.")
else
didHitHumanoid = false
table.insert(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Blacklist cast detected, added " .. tostring(hit) .. " to the blacklist.")
end
else
-- This is where things get finnicky.
-- We can't reparent the object. If we do this, we risk altering behavior of the developer's game which has undesirable effects.
-- We need to swap cast functions on the fly here. This is gonna get NASTY. Oh well. It should only happen once under this new behavior.
castFunction = CastWithBlacklist
listOrIgnoreDescendantsInstance = listOrIgnoreDescendantsInstance:GetDescendants()
if targetHumanoid and targetHumanoid.Health > 0 then
didHitHumanoid = true
table.insert(listOrIgnoreDescendantsInstance, target)
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(target) .. " to the blacklist.")
else
didHitHumanoid = false
table.insert(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(hit) .. " to the blacklist.")
end
end
end
-- So now just cast again!
-- Cast with 0 deltaTime and from the prespecified point (this saves a smidge of performance since we don't need to try to recalculate a position value that will come out to be the same thing.)
PrintDebug("Recasting for penetration...")
Fire(0, at)
-- Then set lastPoint.
lastPoint = point
-- We used to do ^ above, but this caused undesired effects and zero-length casts. Oops.
if penetrationData ~= nil then
if penetrationData.penetrationType ~= "WallPenetration" then
if didHitHumanoid then
penetrationCount = hit and (penetrationCount - 1) or 0
PrintDebug("penetrationCount is reduced to... "..penetrationCount.." for hitting humanoid.")
else
PrintDebug("penetrationCount is not reduced for not hitting humanoid (or the humanoid died).")
end
else
PrintDebug("DISTANCE: "..dist.." studs")
PrintDebug("CURRENT PENETRATION DEPTH: "..penetrationPower.." studs")
end
end
-- And exit the function here too.
return
end
end
-- Then set lastPoint here as well.
lastPoint = point
distanceTravelled = distanceTravelled + rayDisplacement
if distanceTravelled > distance then
RemoveList[self] = true
rayHitEvent:Fire(Vector3.new(), cosmeticBulletObject, origin, rayDir.Unit, nil, lastPoint, nil, nil, tool, clientModule, miscs, replicate)
end
end
function self.Update(delta)
Fire(delta)
end
--[[Thread:Spawn(function()
Projectiles[self] = true
end)]]
-- Too fast?
if RunService:IsClient() then
spawn(function()
Projectiles[self] = true
end)
else
Thread:Spawn(function()
Projectiles[self] = true
end)
end
end
local function BaseFireMethod(self, origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, tool, clientModule, miscs, replicate, list, isWhitelist, penetrationData)
MandateType(origin, "Vector3", "origin")
MandateType(directionWithMagnitude, "Vector3", "directionWithMagnitude")
assert(typeof(velocity) == "Vector3" or typeof(velocity) == "number", ERR_INVALID_TYPE:format("velocity", "Variant<Vector3, number>", typeof(velocity))) -- This one's an odd one out.
MandateType(cosmeticBulletObject, "Instance", "cosmeticBulletObject", true)
MandateType(ignoreDescendantsInstance, "Instance", "ignoreDescendantsInstance", true)
MandateType(ignoreWater, "boolean", "ignoreWater", true)
MandateType(bulletAcceleration, "Vector3", "bulletAcceleration", true)
MandateType(clientModule, "table", "clientModule", true)
MandateType(miscs, "table", "miscs", true)
MandateType(replicate, "boolean", "replicate", true)
MandateType(list, "table", "list", true)
MandateType(penetrationData, "table", "penetrationData", true)
-- isWhitelist is strictly internal so it doesn't need to get sanity checked, because last I checked, I'm not insane c:
-- ... I hope
-- However, as of Version 9.0.0, a penetrate function can be specified
-- Now get into the guts of this.
local castFunction = Cast
local ignoreOrList = ignoreDescendantsInstance
if list ~= nil then
ignoreOrList = list
if isWhitelist then
castFunction = CastWithWhitelist
else
castFunction = penetrationData and (penetrationData.penetrationType ~= "WallPenetration" and CastWithBlacklist or CastWithBlacklistAndNoHumPenetration) or CastWithBlacklist
end
end
SimulateCast(origin, directionWithMagnitude, velocity, castFunction, self.LengthChanged, self.RayHit, self.RayExited, cosmeticBulletObject, ignoreOrList, ignoreWater, bulletAcceleration, tool, clientModule, miscs, replicate, penetrationData)
end
|
-- Creates the player data store |
local playerDataStore = nil
if (not game:GetService("RunService"):IsStudio() or saveInStudio) and game.GameId ~= 0 then
playerDataStore = DataStoreService:GetDataStore("PlayerData")
else
warn("Warning: Data will not be saved. Please publish place and/or enable SaveInStudio flag.")
end
|
------------------------- |
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
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
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
clicker = true
end
function DoorOpen()
while Shaft09.MetalDoor.Transparency < 1.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft09.MetalDoor.CanCollide = false
end
|
--// Global Wrapping |
Enum = service_Wrap(Enum, true)
rawequal = service.RawEqual
script = service_Wrap(script, true)
game = service_Wrap(game, true)
workspace = service_Wrap(workspace, true)
Instance = {
new = function(obj, parent)
local nobj = oldInstNew(obj)
local par = parent and service_UnWrap(parent)
if par then nobj.Parent = par end
return service_Wrap(nobj, true)
end
}
require = function(obj)
return service_Wrap(oldReq(service_UnWrap(obj)), true)
end
client.Service = service
client.Module = service_Wrap(client.Module, true)
|
--local defaultPos = Vector3.new(0, -0.7, 1)
--local adjustedPos = Vector3.new(0, -0.7, 1) |
local rope = Instance.new("Part") |
--// Modules |
local L_117_ = require(L_22_:WaitForChild("Utilities"))
local L_118_ = require(L_22_:WaitForChild("Spring"))
local L_119_ = require(L_22_:WaitForChild("Plugins"))
local L_120_ = require(L_22_:WaitForChild("easing"))
local L_121_ = L_117_.Fade
local L_122_ = L_117_.SpawnCam
local L_123_ = L_117_.FixCam
local L_124_ = L_117_.tweenFoV
local L_125_ = L_117_.tweenCam
local L_126_ = L_117_.tweenRoll
local L_127_ = L_117_.TweenJoint
local L_128_ = L_117_.Weld
|
--<Variable Assignment>-- |
local SoundID = 0;
local Volume = 0.75;
|
--// Probabilities |
JamChance = 0.01; -- This is percent scaled. For 100% Chance of jamming, put 100, for 0%, 0; and everything inbetween
TracerChance = 0;
|
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerChatted will get chats from the custom chat and nil players.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.Events.PlayerChatted(function(plr, msg)
print(`{msg} from {plr.Name} Example Plugin`)
end)
service.Events.PlayerAdded(function(p)
print(`{p.Name} Joined! Example Plugin`)
end)
service.Events.CharacterAdded(function(p)
server.RunCommand('name', plr.Name, 'BobTest Example Plugin')
end)
--]] |
return function(Vargs)
local server, service = Vargs.Server, Vargs.Service
server.Commands.ExampleCommand = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"example"}; -- Commands
Args = {"arg1"}; -- Command arguments
Description = "Example command"; -- Command Description
Hidden = true; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
print(`Player supplied args[1] {args[1]}`)
end
}
end
|
-- events |
Players.PlayerAdded:connect(HandlePlayer)
script.AddArmor.OnInvoke = AddArmor
script.Boost.Event:connect(Boost)
|
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end) |
local anims = {}
local lastAttack= tick()
local target,targetType
local lastLock = tick()
local fleshDamage = 15
local structureDamage = 10
local path = nil
for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
Rep.Relay.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end |
-- Directories |
Events = ReplicatedStorage.Events
SharedModules = ReplicatedStorage:WaitForChild("SharedModules")
|
-- Check if shift key, mobile sprint button, or Xbox gamepad button is being held down |
local function checkSprintKeyDown()
if UserInputService.TouchEnabled then
local sprintButton = game:GetService("ReplicatedStorage"):WaitForChild("SprintButton")
return sprintButton:IsPressed()
elseif UserInputService.GamepadEnabled then
return UserInputService:IsGamepadButtonDown(Enum.UserInputType.Gamepad1, Enum.KeyCode.ButtonL2)
else
return UserInputService:IsKeyDown(Enum.KeyCode.LeftShift) or UserInputService:IsKeyDown(Enum.KeyCode.RightShift)
end
end
|
--[=[
Toggles the pane
@param doNotAnimate boolean? -- True if this visiblity should not animate
]=] |
function BasicPane:Toggle(doNotAnimate)
self:SetVisible(not self._visible, doNotAnimate)
end
|
-- You may turn both of these on at once. In that case, zone-specific music will play in the appropriate zones, and global background music will play whenever you're not within any zone. |
settings.DisplayMuteButton = true -- If set to true, there will be a button in the bottom-right corner of the screen allowing players to mute the background music.
settings.MusicFadeoutTime = 2 -- How long music takes to fade out, in seconds.
settings.MusicOnlyPlaysWithinZones = false -- (This setting only applies when UseGlobalBackgroundMusic is set to false) If a player walks into an area that's not covered by any music zone, what should happen? If true, music will stop playing. If false, the music from the previous zone will continue to play.
return settings
|
-- duplicated from ReactElementType to avoid circular dep |
type Source = {
fileName: string,
lineNumber: number,
}
|
--[=[
Utility methods to build a virtual graph of the existing package information set
@private
@class PackageInfoUtils
]=] |
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local LoaderConstants = require(script.Parent.LoaderConstants)
local Queue = require(script.Parent.Queue)
local ScriptInfoUtils = require(script.Parent.ScriptInfoUtils)
local Utils = require(script.Parent.Utils)
local PackageInfoUtils = {}
function PackageInfoUtils.createPackageInfo(packageFolder, explicitDependencySet, scriptInfoLookup, fullName)
assert(typeof(packageFolder) == "Instance", "Bad packageFolder")
assert(type(explicitDependencySet) == "table", "Bad explicitDependencySet")
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(fullName) == "string", "Bad fullName")
return Utils.readonly({
name = packageFolder.Name;
fullName = fullName;
instance = packageFolder;
explicitDependencySet = explicitDependencySet;
dependencySet = false; -- will be filled in later, contains ALL expected dependencies
scriptInfoLookup = scriptInfoLookup;
})
end
function PackageInfoUtils.createDependencyQueueInfo(packageInfo, implicitDependencySet)
assert(type(packageInfo) == "table", "Bad packageInfo")
assert(type(implicitDependencySet) == "table", "Bad implicitDependencySet")
return Utils.readonly({
packageInfo = packageInfo;
implicitDependencySet = implicitDependencySet;
})
end
function PackageInfoUtils.fillDependencySet(packageInfoList)
assert(type(packageInfoList) == "table", "Bad packageInfoList")
local queue = Queue.new()
local seen = {}
do
local topDependencySet = {}
for _, packageInfo in pairs(packageInfoList) do
if not seen[packageInfo] then
topDependencySet[packageInfo] = packageInfo
seen[packageInfo] = true
queue:PushRight(PackageInfoUtils.createDependencyQueueInfo(packageInfo, topDependencySet))
end
end
end
-- Flaw: We can enter this dependency chain from multiple paths (we're a cyclic directed graph, not a tree)
-- TODO: Determine node_modules behavior and copy it (hopefully any link upwards words)
-- For now we do breadth first resolution of this to ensure minimal dependencies are accumulated for deep trees
while not queue:IsEmpty() do
local queueInfo = queue:PopLeft()
assert(not queueInfo.packageInfo.dependencySet, "Already wrote dependencySet")
local dependencySet = PackageInfoUtils
.computePackageDependencySet(queueInfo.packageInfo, queueInfo.implicitDependencySet)
queueInfo.packageInfo.dependencySet = dependencySet
-- Process all explicit dependencies for the next level
for packageInfo, _ in pairs(queueInfo.packageInfo.explicitDependencySet) do
if not seen[packageInfo] then
seen[packageInfo] = true
queue:PushRight(PackageInfoUtils.createDependencyQueueInfo(packageInfo, dependencySet))
end
end
end
end
function PackageInfoUtils.computePackageDependencySet(packageInfo, implicitDependencySet)
assert(type(packageInfo) == "table", "Bad packageInfo")
assert(type(implicitDependencySet) == "table", "Bad implicitDependencySet")
-- assume folders with the same name are the same module
local dependencyNameMap = {}
-- Set implicit dependencies
if LoaderConstants.INCLUDE_IMPLICIT_DEPENDENCIES then
for entry, _ in pairs(implicitDependencySet) do
dependencyNameMap[entry.name] = entry
end
end
-- These override implicit ones
for entry, _ in pairs(packageInfo.explicitDependencySet) do
dependencyNameMap[entry.name] = entry
end
-- clear ourself as a dependency
dependencyNameMap[packageInfo.name] = nil
-- Note we leave conflicting scripts here as unresolved. This will output an error later.
local dependencySet = {}
for _, entry in pairs(dependencyNameMap) do
dependencySet[entry] = true
end
return dependencySet
end
function PackageInfoUtils.getOrCreatePackageInfo(packageFolder, packageInfoMap, scope)
assert(typeof(packageFolder) == "Instance"
and (packageFolder:IsA("Folder") or packageFolder:IsA("ModuleScript")), "Bad packageFolder")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(type(scope) == "string", "Bad scope")
if packageInfoMap[packageFolder] then
return packageInfoMap[packageFolder]
end
local scriptInfoLookup = ScriptInfoUtils.createScriptInfoLookup()
ScriptInfoUtils.populateScriptInfoLookup(
packageFolder,
scriptInfoLookup,
ScriptInfoUtils.ModuleReplicationTypes.SHARED)
local explicitDependencySet = {}
local fullName
if scope == "" then
fullName = packageFolder.Name
else
fullName = scope .. "/" .. packageFolder.Name
end
local packageInfo = PackageInfoUtils
.createPackageInfo(packageFolder, explicitDependencySet, scriptInfoLookup, fullName)
packageInfoMap[packageFolder] = packageInfo
-- Fill this after we've registered ourselves, in case we're somehow in a recursive dependency set
PackageInfoUtils.fillExplicitPackageDependencySet(explicitDependencySet, packageFolder, packageInfoMap)
return packageInfo
end
function PackageInfoUtils.getPackageInfoListFromDependencyFolder(folder, packageInfoMap)
assert(typeof(folder) == "Instance" and folder:IsA("Folder"), "Bad folder")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
local packageInfoList = {}
-- Assume we are at the dependency level
for _, instance in pairs(folder:GetChildren()) do
if instance:IsA("Folder") then
-- We loop through each "@quenty" or "@blah" and convert to a package
if instance.Name:sub(1, 1) == "@" then
local scope = instance.Name
for _, child in pairs(instance:GetChildren()) do
PackageInfoUtils.tryLoadPackageFromInstance(packageInfoList, packageInfoMap, child, scope)
end
else
PackageInfoUtils.tryLoadPackageFromInstance(packageInfoList, packageInfoMap, instance, "")
end
else
warn(("Unknown instance in dependencyFolder - %q"):format(instance:GetFullName()))
end
end
return packageInfoList
end
function PackageInfoUtils.tryLoadPackageFromInstance(packageInfoList, packageInfoMap, instance, scope)
assert(type(packageInfoList) == "table", "Bad packageInfoList")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(scope) == "string", "Bad scope")
if BounceTemplateUtils.isBounceTemplate(instance) then
return
end
if instance:IsA("Folder") or instance:IsA("ModuleScript") then
table.insert(packageInfoList, PackageInfoUtils.getOrCreatePackageInfo(instance, packageInfoMap, scope))
elseif instance:IsA("ObjectValue") then
local value = instance.Value
if value and (value:IsA("Folder") or value:IsA("ModuleScript")) then
table.insert(packageInfoList, PackageInfoUtils.getOrCreatePackageInfo(value, packageInfoMap, scope))
else
error(("Invalid %q ObjectValue in package linking to nothing cannot be resolved into package dependency\n\t-> %s")
:format(instance.Name, instance:GetFullName()))
end
end
end
|
--!nonstrict
-- Roblox character sound script |
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local AtomicBinding = require(script:WaitForChild("AtomicBinding"))
local function loadFlag(flag: string)
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled(flag)
end)
return success and result
end
local FFlagUserAtomicCharacterSoundsUnparent = loadFlag("UserAtomicCharacterSoundsUnparent")
local SOUND_DATA : { [string]: {[string]: any}} = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = "rbxassetid://9083849830",
Looped = true,
Pitch = 1,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
|
-- Folder where enemies are parented to upon spawning |
local enemyFolder = game.Workspace.Targets
RideManager.EndCondition = {
ReachedEnd = "You win!",
PlatformDeath = "You lost!"
}
local function resetRide(platformObject)
-- Destroy any remaining enemies
for _, enemy in ipairs(enemyFolder:GetChildren()) do
enemy:Destroy()
end
-- Deactivate all enemy spawners
for _, spawner in ipairs(spawnerFolder:GetChildren()) do
local isActive = spawner:WaitForChild("IsActive")
isActive.Value = false
end
-- Deactivate effects on the platform
for _, object in ipairs(platformObject:GetDescendants()) do
if object:IsA("ParticleEmitter") then
object.Enabled = false
end
end
end
function RideManager:setupRide(platformObject, difficulty)
local hitpoints = platformObject:WaitForChild("Data"):WaitForChild("Hitpoints")
hitpoints.Value = GameSettings.PlatformHealthDifficulty[difficulty]
local positionToSet = platformObject:WaitForChild("Data"):WaitForChild("OriginalPos")
platformObject:WaitForChild("PrimaryPart").CFrame = CFrame.new(positionToSet.Value)
end
function RideManager:endRide(platformObject)
isGameActive.Value = false
PlayerManager.removePlayersFromGame()
resetRide(platformObject)
end
return RideManager
|
--local InfoBindable = EventsFolder:FindFirstChild("GetInfo")
--local ToClient = EventsFolder:FindFirstChild("SendButtonToClient") |
local Notification = EventsFolder:FindFirstChild("Notification")
local EditPlot = EventsFolder:FindFirstChild("EditPlot")
local MarketPlaceService = game:GetService("MarketplaceService")
local OwnerLabel = script.Parent.Parent.Parent.Parent.SignDescription.SurfaceGui.Frame.OwnerLabel
local StarterGui = game:GetService("StarterGui")
local StandNum = script.Parent.Parent.Parent.Parent.Name
local PriceFolder = StarterGui:FindFirstChild("SignPrices")
local UI = PriceFolder:WaitForChild(StandNum)
local Template = UI.ScrollingFrame:FindFirstChild("Template")
function Triggered(Player)
local PlayerName = Player.Name
if Owner.Value == nil or "NoOne" then -- If booth hasn't been claimed
if Player:FindFirstChild("Owner") then -- If Player has claimed one
Notification:FireClient(Player,"Claimed") -- Let them know they already own one
else -- If Player hasn't claimed one
Owner.Value = PlayerName
OwnerLabel.Text = PlayerName .. "'s Stand"
Notification:FireClient(Player,true) -- Claimed
local UserID = game:GetService("Players"):GetUserIdFromNameAsync(PlayerName)
Bindable:Fire(script.Parent.Parent.Parent.Parent.Name, PlayerName, UserID)
-- This should be for giving a player a value
OwnerLabel.Parent.MoneyRaised.Text = Player.leaderstats.Raised.Value .. "$ Raised"
local OwnerValue = Instance.new("IntValue")
OwnerValue.Value = script.Parent.Parent.Parent.Parent.Name -- set int value to booth name
OwnerValue.Name = "Owner"
OwnerValue.Parent = Player
-- Would this be the best way to do this? Yes, absolutely!
-- We want the editPrompt to ONLY show for the client player.
EditPlot:FireClient(Player, script.Parent.Parent.Parent.Parent.Name, true)
Prompt.Enabled = false
end
end
end
script.Parent.Triggered:Connect(Triggered)
local Players = game:GetService("Players")
local RemoveButtonsFromClient = EventsFolder:FindFirstChild("RemoveButtonFromClient")
Players.PlayerRemoving:Connect(function(player)
local plrRemovingName = player.Name
if plrRemovingName == Owner.Value then
RemoveButtonsFromClient:FireAllClients(script.Parent.Parent.Parent.Parent.Name)
Owner.Value = "NoOne"
EditPlot:FireClient(player, script.Parent.Parent.Parent.Parent.Name, false)
Prompt.Enabled = true
OwnerLabel.Text = "No One's Stand"
script.Parent.Parent.Parent.Parent.SignTitle.SurfaceGui.Frame.SignLabel.Text = "PLS DONATE"
OwnerLabel.Parent.MoneyRaised.Text = "0$ Raised"
local Children = StarterGui.SignPrices[script.Parent.Parent.Parent.Parent.Name].ScrollingFrame:GetChildren()
for _, child in ipairs(Children) do
if child:IsA("Frame") and child.Name ~= "Template" then
child:Destroy()
end
end
else
return -- Not the Owner
end
end)
|
-- connections |
script.Parent:WaitForChild('ClickDetector').MouseClick:connect(OpenShop)
script.Parent.Touched:connect(function(part)
local hitCharacter, hitHumanoid = FindCharacterAncestor(part)
--
if hitCharacter then
local player = game.Players:GetPlayerFromCharacter(hitCharacter)
if player then
OpenShop(player)
end
end
end)
|
-------------------------------------------------------------------------- |
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .4 ,
FTargetFriction = 1.1 ,
FMinFriction = 1.0 ,
RWearSpeed = .4 ,
RTargetFriction = 1.4 ,
RMinFriction = 1.3 ,
--Tire Slip
TCSOffRatio = 1/3 ,
WheelLockRatio = 1/2 , --SS6 Default = 1/4
WheelspinRatio = 1/1.1 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 1 , --SS6 Default = 1
RFrictionWeight = 1 , --SS6 Default = 1
FLgcyFrWeight = 10 ,
RLgcyFrWeight = 10 ,
FElasticity = .5 , --SS6 Default = .5
RElasticity = .5 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 1 , --SS6 Default = 1
RElastWeight = 1 , --SS6 Default = 1
FLgcyElWeight = 10 ,
RLgcyElWeight = 10 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local on = 0
script:WaitForChild("Rev")
if not FE then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
for i,v in pairs(script:GetChildren()) do
v.Parent=car.DriveSeat
end
car.DriveSeat.Rev:Play()
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
car.DriveSeat.Rev.Pitch = (car.DriveSeat.Rev.SetPitch.Value + car.DriveSeat.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
end
else
local handler = car.AC6_FE_Sounds
handler:FireServer("newSound","Rev",car.DriveSeat,script.Rev.SoundId,0,script.Rev.Volume,true)
handler:FireServer("playSound","Rev")
local pitch=0
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if not car.DriveSeat.IsOn.Value then on=math.max(on-.015,0) else on=1 end
pitch = (script.Rev.SetPitch.Value + script.Rev.SetRev.Value*_RPM/_Tune.Redline)*on^2
if script.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch,script.Rev.Volume*2)
else
handler:FireServer("updateSound","Rev",script.Rev.SoundId,pitch/1.2,script.Rev.Volume/1.2)
end
end
end
|
-- testing metatables since its been forever since ive used them |
local Char = {
Template = {
Name = "";
}
};
function Char:Test()
print(1);
self.Name = "joe";
print(self.Name);
end
function Char:New(Data)
local D = Data;
setmetatable(D, self);
D.Template = nil;
self.__index = self;
return D;
end
local q = Char.Template;
q.Name = "Bob";
local Poop = {
E = Char:New(q);
Z = 1;
};
Poop.E:Test();
print(Poop.E.Name);
|
--[=[
@within TableUtil
@function Filter
@param tbl table
@param predicate (value: any, key: any, tbl: table) -> keep: boolean
@return table
Performs a filter operation against the given table, which can be used to
filter out unwanted values from the table.
For example:
```lua
local t = {A = 10, B = 20, C = 30}
local t2 = TableUtil.Filter(t, function(value, key)
return value > 15
end)
print(t2) --> {B = 40, C = 60}
```
]=] |
local function Filter<T>(t: { T }, predicate: (T, any, { T }) -> boolean): { T }
assert(type(t) == "table", "First argument must be a table")
assert(type(predicate) == "function", "Second argument must be a function")
local newT = table.create(#t)
if #t > 0 then
local n = 0
for i, v in t do
if predicate(v, i, t) then
n += 1
newT[n] = v
end
end
else
for k, v in t do
if predicate(v, k, t) then
newT[k] = v
end
end
end
return newT
end
|
-- Checks for conditions for enabling/disabling the active controller and updates whether the active controller is enabled/disabled |
function ControlModule:UpdateActiveControlModuleEnabled()
-- helpers for disable/enable
local disable = function()
self.activeController:Enable(false)
if self.moveFunction then
self.moveFunction(Players.LocalPlayer, Vector3.new(0,0,0), true)
end
end
local enable = function()
if self.activeControlModule == ClickToMove then
-- For ClickToMove, when it is the player's choice, we also enable the full keyboard controls.
-- When the developer is forcing click to move, the most keyboard controls (WASD) are not available, only jump.
self.activeController:Enable(
true,
Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice,
self.touchJumpController
)
elseif self.touchControlFrame then
self.activeController:Enable(true, self.touchControlFrame)
else
self.activeController:Enable(true)
end
end
-- there is no active controller
if not self.activeController then
return
end
-- developer called ControlModule:Disable(), don't turn back on
if not self.controlsEnabled then
disable()
return
end
-- GuiService.TouchControlsEnabled == false and the active controller is a touch controller,
-- disable controls
if not GuiService.TouchControlsEnabled and UserInputService.TouchEnabled and
(self.activeControlModule == ClickToMove or self.activeControlModule == TouchThumbstick or
self.activeControlModule == DynamicThumbstick) then
disable()
return
end
-- no settings prevent enabling controls
enable()
end
function ControlModule:Enable(enable: boolean?)
if enable == nil then
enable = true
end
self.controlsEnabled = enable
if not self.activeController then
return
end
self:UpdateActiveControlModuleEnabled()
end
|
---- Script: ----- |
Event.OnServerEvent:Connect(function(player, Skin)
local PlayerInventory = player.Inventory
--Skin 1 de la caja
if Skin == 1 then
player.Inventory.AdminSkin.Quantity.Value += 1
end
end)
|
--[=[
Throttles execution of a functon. Does both leading, and following
@class ThrottledFunction
]=] |
local ThrottledFunction = {}
ThrottledFunction.ClassName = "ThrottledFunction"
ThrottledFunction.__index = ThrottledFunction
function ThrottledFunction.new(timeoutInSeconds, func, config)
local self = setmetatable({}, ThrottledFunction)
self._nextCallTimeStamp = 0
self._timeout = timeoutInSeconds or error("No timeoutInSeconds")
self._func = func or error("No func")
self._trailingValue = nil
self._callLeading = true
self._callTrailing = true
self:_configureOrError(config)
return self
end
function ThrottledFunction:Call(...)
if self._trailingValue then
-- Update the next value to be dispatched
self._trailingValue = table.pack(...)
elseif self._nextCallTimeStamp <= tick() then
if self._callLeading or self._callLeadingFirstTime then
self._callLeadingFirstTime = false
-- Dispatch immediately
self._nextCallTimeStamp = tick() + self._timeout
self._func(...)
elseif self._callTrailing then
-- Schedule for trailing at exactly timeout
self._trailingValue = table.pack(...)
task.delay(self._timeout, function()
if self.Destroy then
self:_dispatch()
end
end)
else
error("[ThrottledFunction.Cleanup] - Trailing and leading are both disabled")
end
elseif self._callLeading or self._callTrailing or self._callLeadingFirstTime then
self._callLeadingFirstTime = false
-- As long as either leading or trailing are set to true, we are good
local remainingTime = self._nextCallTimeStamp - tick()
self._trailingValue = table.pack(...)
task.delay(remainingTime, function()
if self.Destroy then
self:_dispatch()
end
end)
end
end
function ThrottledFunction:_dispatch()
self._nextCallTimeStamp = tick() + self._timeout
local trailingValue = self._trailingValue
if trailingValue then
-- Clear before call so we are in valid state!
self._trailingValue = nil
self._func(unpack(trailingValue, 1, trailingValue.n))
end
end
function ThrottledFunction:_configureOrError(throttleConfig)
if throttleConfig == nil then
return
end
assert(type(throttleConfig) == "table", "Bad throttleConfig")
for key, value in pairs(throttleConfig) do
assert(type(value) == "boolean", "Bad throttleConfig entry")
if key == "leading" then
self._callLeading = value
elseif key == "trailing" then
self._callTrailing = value
elseif key == "leadingFirstTimeOnly" then
self._callLeadingFirstTime = value
else
error(("Bad key %q in config"):format(tostring(key)))
end
end
assert(self._callLeading or self._callTrailing, "Cannot configure both leading and trailing disabled")
end
function ThrottledFunction:Destroy()
self._trailingValue = nil
self._func = nil
setmetatable(self, nil)
end
return ThrottledFunction
|
-- Find all car spawners |
local carSpawners = {}
local function findSpawners(instance)
if instance:IsA("Part") and instance.Name == "CarSpawner" then
table.insert(carSpawners, instance)
superHidePart(instance)
end
for _, child in pairs(instance:GetChildren()) do
findSpawners(child)
end
end
findSpawners(game.Workspace)
|
--[[**
ensures value is a table and all keys pass keyCheck and all values pass valueCheck
@param keyCheck The function to use to check the keys
@param valueCheck The function to use to check the values
@returns A function that will return true iff the condition is passed
**--]] |
function t.map(keyCheck, valueCheck)
assert(t.callback(keyCheck))
assert(t.callback(valueCheck))
local keyChecker = t.keys(keyCheck)
local valueChecker = t.values(valueCheck)
return function(value)
local keySuccess, keyErr = keyChecker(value)
if not keySuccess then
return false, keyErr or ""
end
local valueSuccess, valueErr = valueChecker(value)
if not valueSuccess then
return false, valueErr or ""
end
return true
end
end
|
--Animation-- |
local RunAnimation = Instance.new('Animation')
RunAnimation.AnimationId = 'rbxassetid://'..ID
RAnimation = Humanoid:LoadAnimation(RunAnimation)
Running = false
|
-----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------- |
AspirinaQuantidade.Text = Aspirina.Value
BandagemQuantidade.Text = Bandagem.Value
EnergeticoQuantidade.Text = Energetico.Value
EpinefrinaQuantidade.Text = Epinefrina.Value
MorfinaQuantidade.Text = Morfina.Value
SplintQuantidade.Text = Splint.Value
TourniquetQuantidade.Text = Tourniquet.Value
Aspirina.Changed:Connect(function()
AspirinaQuantidade.Text = Aspirina.Value
end)
Bandagem.Changed:Connect(function()
BandagemQuantidade.Text = Bandagem.Value
end)
Splint.Changed:Connect(function()
SplintQuantidade.Text = Splint.Value
end)
Tourniquet.Changed:Connect(function()
TourniquetQuantidade.Text = Tourniquet.Value
end)
Energetico.Changed:Connect(function()
EnergeticoQuantidade.Text = Energetico.Value
end)
Epinefrina.Changed:Connect(function()
EpinefrinaQuantidade.Text = Epinefrina.Value
end)
Morfina.Changed:Connect(function()
MorfinaQuantidade.Text = Morfina.Value
end)
SacoDeSangue.Changed:Connect(function()
SacoDeSangueQuantidade.Text = SacoDeSangue.Value
end) |
--[[
Increments the health by the specified amount, will also update markers and other visual showcases of the health amount.
]] |
function BaseSystem:incrementHealth(amount)
self._health = math.clamp(self._health + amount, 0, self._maxHealth)
local percent = self._health / self._maxHealth
if not self.noScreenUpdate then
local aliveColor = Color3.fromRGB(110, 153, 202)
local deadColor = Color3.fromRGB(200, 93, 96)
local targetColor = deadColor:Lerp(aliveColor, percent)
for _, child in pairs(self._model:FindFirstChild("Screen"):GetChildren()) do
TweenService:Create(child, tweenInfo, {Color = targetColor}):Play()
end
end
if self:canTurnOn() then
self:turnOn()
elseif self._health == 0 and self:isOn() then
self:turnOff()
end
if amount < 0 and percent < 0.25 then
sendAlert(Constants.Alert.Fail, self.repairAlert)
elseif self._health == 0 then
sendAlert(Constants.Alert.Fail, self.brokenAlert)
end
if self:isOn() then
if percent < 0.2 then
self:_setMarker(self.brokenMarker)
elseif percent < 0.5 then
self:_setMarker(self.repairMarker)
else
self:_setMarker()
end
end
end
|
--Make brush cursor follow mouse and put paint where the player clicks |
game:GetService("RunService").Stepped:Connect(function()
if canvas.Visible == true and cursor.Visible == true then
local x = math.abs(mouse.X - canvas.AbsolutePosition.X)
local y = math.abs(mouse.Y - canvas.AbsolutePosition.Y)
cursor.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
cursor.Size = UDim2.new(0, currentSize, 0, currentSize)
if down then
local paint = script.Paint:Clone()
paint.Position = UDim2.new(x/canvas.AbsoluteSize.X, 0, y/canvas.AbsoluteSize.Y, 0)
paint.Size = UDim2.new(0, currentSize, 0, currentSize)
paint.ImageColor3 = erasing and Color3.fromRGB(185, 185, 185) or currentColor
paint.Parent = paintContainer
end
end
end)
|
------------------------------------------------------------------------
-- create a chunk reader from a source string
------------------------------------------------------------------------ |
function luaZ:make_getS(buff)
local b = buff
return function() -- chunk reader anonymous function here
if not b then return nil end
local data = b
b = nil
return data
end
end
|
-- Services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local Players = game:GetService("Players")
|
--[[
PlayerScriptsLoader - This script requires and instantiates the PlayerModule singleton
2018 PlayerScripts Update - AllYourBlox
--]] |
local PlayerModule = require(script.Parent:WaitForChild("PlayerModule"))
|
--Gamepad support |
userInputService.InputChanged:connect(function(inputObject, gameProcessedEvent)
--if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then
if inputObject.Position.magnitude >= gamepadDeadzone then
movement = Vector2.new(movement.X, inputObject.Position.Y)
else
movement = Vector2.new(movement.X, 0)
end
elseif inputObject.KeyCode == Enum.KeyCode.Thumbstick2 then
if inputObject.Position.magnitude >= gamepadDeadzone then
movement = Vector2.new(inputObject.Position.X, movement.Y)
else
movement = Vector2.new(0, movement.Y)
end
end
--end
end)
|
-- REBIRTHS |
x2RebirthsButton.MouseEnter:Connect(function()
x2RebirthsButton.Text = "299 R$"
x2RebirthsButton.TextColor3 = Color3.fromRGB(0, 255, 0)
end)
x2RebirthsButton.MouseLeave:Connect(function()
x2RebirthsButton.Text = "BUY"
x2RebirthsButton.TextColor3 = Color3.fromRGB(255, 255, 255)
end)
|
-- declarations |
local jumpAnimTime = 0
local jumpAnimDuration = 0.3
local toolTransitionTime = 0.1
local fallTransitionTime = 0.3
local jumpMaxLimbVelocity = 0.75
|
------------------------------------------------ |
local function ProcessInput(input, processed)
local userInputType = input.UserInputType
if userInputType == Enum.UserInputType.Gamepad1 then
local keycode = input.KeyCode
if keycode == Enum.KeyCode.Thumbstick2 then
local pos = input.Position
panDeltaGamepad = Vector2.new(InputCurve(pos.y), InputCurve(-pos.x))*7
elseif keycode == Enum.KeyCode.Thumbstick1 then
local pos = input.Position
gp_x = InputCurve(pos.x)
gp_z = InputCurve(-pos.y)
elseif keycode == Enum.KeyCode.ButtonL2 then
gp_l1 = input.Position.z
elseif keycode == Enum.KeyCode.ButtonR2 then
gp_r1 = input.Position.z
end
elseif userInputType == Enum.UserInputType.MouseWheel then
rate_fov = input.Position.Z
end
end
UIS.InputChanged:Connect(ProcessInput)
UIS.InputEnded:Connect(ProcessInput)
UIS.InputBegan:Connect(ProcessInput)
|
--[[
Intended for use in tests.
Similar to await(), but instead of yielding if the promise is unresolved,
_unwrap will throw. This indicates an assumption that a promise has
resolved.
]] |
function Promise.prototype:_unwrap()
if self._status == Promise.Status.Started then
error("Promise has not resolved or rejected.", 2)
end
local success = self._status == Promise.Status.Resolved
return success, unpack(self._values, 1, self._valuesLength)
end
function Promise.prototype:_resolve(...)
if self._status ~= Promise.Status.Started then
if Promise.is((...)) then
(...):_consumerCancelled(self)
end
return
end
-- If the resolved value was a Promise, we chain onto it!
if Promise.is((...)) then
-- Without this warning, arguments sometimes mysteriously disappear
if select("#", ...) > 1 then
local message = string.format(
"When returning a Promise from andThen, extra arguments are " .. "discarded! See:\n\n%s",
self._source
)
warn(message)
end
local chainedPromise = ...
local promise = chainedPromise:andThen(function(...)
self:_resolve(...)
end, function(...)
local maybeRuntimeError = chainedPromise._values[1]
-- Backwards compatibility < v2
if chainedPromise._error then
maybeRuntimeError = Error.new({
error = chainedPromise._error,
kind = Error.Kind.ExecutionError,
context = "[No stack trace available as this Promise originated from an older version of the Promise library (< v2)]",
})
end
if Error.isKind(maybeRuntimeError, Error.Kind.ExecutionError) then
return self:_reject(maybeRuntimeError:extend({
error = "This Promise was chained to a Promise that errored.",
trace = "",
context = string.format(
"The Promise at:\n\n%s\n...Rejected because it was chained to the following Promise, which encountered an error:\n",
self._source
),
}))
end
self:_reject(...)
end)
if promise._status == Promise.Status.Cancelled then
self:cancel()
elseif promise._status == Promise.Status.Started then
-- Adopt ourselves into promise for cancellation propagation.
self._parent = promise
promise._consumers[self] = true
end
return
end
self._status = Promise.Status.Resolved
self._valuesLength, self._values = pack(...)
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedResolve) do
coroutine.wrap(callback)(...)
end
self:_finalize()
end
function Promise.prototype:_reject(...)
if self._status ~= Promise.Status.Started then
return
end
self._status = Promise.Status.Rejected
self._valuesLength, self._values = pack(...)
-- If there are any rejection handlers, call those!
if not isEmpty(self._queuedReject) then
-- We assume that these callbacks will not throw errors.
for _, callback in ipairs(self._queuedReject) do
coroutine.wrap(callback)(...)
end
else
-- At this point, no one was able to observe the error.
-- An error handler might still be attached if the error occurred
-- synchronously. We'll wait one tick, and if there are still no
-- observers, then we should put a message in the console.
local err = tostring((...))
coroutine.wrap(function()
Promise._timeEvent:Wait()
-- Someone observed the error, hooray!
if not self._unhandledRejection then
return
end
-- Build a reasonable message
local message = string.format("Unhandled Promise rejection:\n\n%s\n\n%s", err, self._source)
for _, callback in ipairs(Promise._unhandledRejectionCallbacks) do
task.spawn(callback, self, unpack(self._values, 1, self._valuesLength))
end
if Promise.TEST then
-- Don't spam output when we're running tests.
return
end
--warn(message)
end)()
end
self:_finalize()
end
|
--You can change the values below to suit your needs |
local max_mode = 40 --The maximum amount of modes forwards. Set to 0 to disable forwards motion.
local min_mode = 0 --The minimum amount of modes backwards. Set to 0 to disable backwards motion.
local increment_speed = 0.1 --The amount in which the speed value increments with every mode.
|
-- ROBLOX deviation: returning a function to be able to re-execute the module in tests |
return function()
type unknown = any --[[ ROBLOX FIXME: adding `unknown` type alias to make it easier to use Luau unknown equivalent when supported ]]
local CurrentModule = script.Parent
local Packages = CurrentModule.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Array = LuauPolyfill.Array
local Object = LuauPolyfill.Object
local String = LuauPolyfill.String
local Symbol = LuauPolyfill.Symbol
local Promise = require(Packages.Promise)
local exports = {}
-- ROBLOX deviation: fs not necessary
-- local fs = require(Packages["graceful-fs"])
local typesModule = require(Packages.JestTypes)
type Config_ConfigGlobals = typesModule.Config_ConfigGlobals
local createProcessObject = require(script.Parent.createProcessObject).default
local deepCyclicCopy = require(script.Parent.deepCyclicCopy).default
local DTRACE = Array.filter(Object.keys(_G), function(key)
return typeof(key) == "string" and String.startsWith(key, "DTRACE")
end)
exports.default =
function(globalObject: typeof(_G), globals: Config_ConfigGlobals): typeof(_G) & Config_ConfigGlobals
-- ROBLOX deviation: added self to be able to bind DTRACE functions
local self = globalObject
globalObject.process = createProcessObject()
-- Keep a reference to some globals that Jest needs
Object.assign(globalObject, {
-- ROBLOX deviation START: not making props readonly
-- ROBLOX FIXME: have to cast element to `any` to avoid type narrowing issue
[Symbol.for_("jest-native-promise")] = Promise :: any,
[Symbol.for_("jest-native-now")] = DateTime.now,
-- ROBLOX deviation END
-- ROBLOX deviation START: skipped fs related globals
-- [Symbol.for_("jest-native-read-file")] = {
-- enumerable = false,
-- value = fs.readFileSync:bind(fs),
-- writable = false,
-- },
-- [Symbol.for_("jest-native-write-file")] = {
-- enumerable = false,
-- value = fs.writeFileSync:bind(fs),
-- writable = false,
-- },
-- [Symbol.for_("jest-native-exists-file")] = {
-- enumerable = false,
-- value = fs.existsSync:bind(fs),
-- writable = false,
-- },
-- ROBLOX deviation END
-- ROBLOX deviation START: not making props readonly
["jest-symbol-do-not-touch"] = Symbol,
-- ROBLOX deviation END
})
-- Forward some APIs.
Array.forEach(DTRACE, function(dtrace)
-- @ts-expect-error: no index
globalObject[dtrace] = function(_self, ...: any)
local args = { ... }
-- @ts-expect-error: no index
return _G[dtrace](self, table.unpack(args))
end
end)
return Object.assign(globalObject, deepCyclicCopy(globals))
end
return exports
end
|
--[=[
@within TableUtil
@function Flat
@param tbl table
@param depth number?
@return table
Returns a new table where all sub-arrays have been
bubbled up to the top. The depth at which the scan
is performed is dictated by the `depth` parameter,
which is set to `1` by default.
```lua
local t = {{10, 20}, {90, 100}, {30, 15}}
local flat = TableUtil.Flat(t)
print(flat) --> {10, 20, 90, 100, 30, 15}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=] |
local function Flat(tbl: Table, depth: number?): Table
local maxDepth: number = if type(depth) == "number" then depth else 1
local flatTbl = table.create(#tbl)
local function Scan(t: Table, d: number)
for _,v in ipairs(t) do
if type(v) == "table" and d < maxDepth then
Scan(v, d + 1)
else
table.insert(flatTbl, v)
end
end
end
Scan(tbl, 0)
return flatTbl
end
|
-- See if I have a tool |
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 5)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle then
handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
end
wait()
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
|
--- Recalculate the window height |
function Window:UpdateWindowHeight()
local windowHeight = LINE_HEIGHT
for _, child in pairs(Gui:GetChildren()) do
if child:IsA("GuiObject") then
windowHeight = windowHeight + child.Size.Y.Offset
end
end
Gui.CanvasSize = UDim2.new(Gui.CanvasSize.X.Scale, Gui.CanvasSize.X.Offset, 0, windowHeight)
Gui.Size =
UDim2.new(
Gui.Size.X.Scale,
Gui.Size.X.Offset,
0,
windowHeight > WINDOW_MAX_HEIGHT and WINDOW_MAX_HEIGHT or windowHeight
)
Gui.CanvasPosition = Vector2.new(0, math.clamp(windowHeight - 300, 0, math.huge))
end
|
--[[
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Text = game:GetService("TextService")
local AvatarEditor = ReplicatedStorage.AvatarEditor
local remoteEvent = AvatarEditor.RemoteEvent
local Promise = require(AvatarEditor.Shared.Util.Promise)
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Signal = require(AvatarEditor.Shared.Util.Signal)
local TableUtil = require(AvatarEditor.Shared.Util.TableUtil)
local QueryMap = require(AvatarEditor.Shared.QueryMap)
local Colors = require(AvatarEditor.Shared.Colors)
local Settings = require(AvatarEditor.Shared.Settings)
local GetProductInfo = require(AvatarEditor.Shared.GetProductInfo)
local UserCanUse = require(AvatarEditor.Shared.UserCanUse)
local outfitCache = {}
local settingsCache = {}
local module = {}
module.HumanoidDescriptionChanged = Signal.new()
module.CostumeAdded = Signal.new()
module.CostumeRemoved = Signal.new()
module.CostumeUpdated = Signal.new() -- TODO update outfit
module.SettingChanged = Signal.new()
module.PermissionFailed = Signal.new()
local function filterText(text, player)
return Promise.new(function(resolve, reject)
local success, result = pcall(function()
return Text:FilterStringAsync(text, player.UserId)
end)
if success then
resolve(result)
else
reject(result)
end
end)
:andThen(function(textFilterResult)
return Promise.new(function(resolve, reject)
local success, result = pcall(function()
-- hopefully this appeases the roblox gods
return textFilterResult:GetNonChatStringForUserAsync(player.UserId)
end)
if success then
resolve(result)
else
reject(result)
end
end)
end)
end
local function getHumanoid(player)
local character = player.Character
local humanoid = character and character:FindFirstChildWhichIsA("Humanoid")
if humanoid and humanoid.Health > 0 then
return humanoid
end
end
local function getHumanoidDescriptionFromUserId(userId)
return Promise.new(function(resolve, reject)
local success, result = pcall(function()
return Players:GetHumanoidDescriptionFromUserId(userId)
end)
if success then
resolve(result)
else
reject(result)
end
end)
end
local function applyDescriptionToHumanoid(humanoid, description)
return Promise.new(function(resolve, reject)
local success, result = pcall(function()
humanoid:ApplyDescription(description)
end)
if success then
resolve(success)
else
reject(result)
end
end)
end
local function applyDescriptionToPlayer(player, description)
module.HumanoidDescriptionChanged:Fire(player, description)
local humanoid = getHumanoid(player)
if not humanoid then
return Promise.reject()
end
return applyDescriptionToHumanoid(humanoid, description)
end
local function descriptionUpdated(player, ...)
remoteEvent:FireClient(player, ...)
end
local function accessory(player, id)
assert(typeof(id) == "number")
local humanoid = getHumanoid(player)
if not humanoid then
return
end
local description = humanoid:GetAppliedDescription()
if not description then
return
end
GetProductInfo(id)
:andThen(function(productInfo)
local assetType = QueryMap.GetOptionName("AssetType", productInfo.AssetTypeId)
if not assetType then
return
end
-- really Roblox...??
if assetType == "Hat" then
assetType = "HatAccessory"
elseif assetType == "ShoulderAccessory" then
assetType = "ShouldersAccessory"
end
if string.find(assetType, "Accessory") then
local accessories = string.split(description[assetType], ",")
local index = table.find(accessories, tostring(productInfo.AssetId))
if index then
table.remove(accessories, index)
elseif #humanoid:GetAccessories() < Settings.MAX_ACCESSORIES then
table.insert(accessories, tostring(productInfo.AssetId))
else
-- TODO should probably notify the client
end
description[assetType] = table.concat(accessories, ",")
else
if description[assetType] == 0 or (description[assetType] ~= productInfo.AssetId) then
description[assetType] = productInfo.AssetId
else
-- https://devforum.roblox.com/t/default-shirt-and-pants-to-be-applied-if-the-requested-ones-are-unavailable-moderated/381818
-- force load default clothes. hacky
-- hopefully there will never be a shirt or pants with id = 1 or 2
description[assetType] = (assetType == "Shirt") and 1 or (assetType == "Pants") and 2 or 0
end
end
applyDescriptionToPlayer(player, description)
:andThenCall(descriptionUpdated, player, "accessory")
end)
:catch(warn)
end
local function tone(player, index)
assert(typeof(index) == "number")
local humanoid = getHumanoid(player)
if not humanoid then
return
end
local description = humanoid:GetAppliedDescription()
if not description then
return
end
index = math.clamp(index, 1, 75)
local color = Colors[index]
if color then
description.HeadColor = color
description.LeftArmColor = color
description.LeftLegColor = color
description.RightArmColor = color
description.RightLegColor = color
description.TorsoColor = color
end
applyDescriptionToPlayer(player, description)
:doneCall(descriptionUpdated, player, "tone")
:catch(warn)
end
local function reset(player)
local humanoid = getHumanoid(player)
if not humanoid then
return
end
getHumanoidDescriptionFromUserId(player.UserId)
:andThen(function(description)
return applyDescriptionToPlayer(player, description)
end)
:doneCall(descriptionUpdated, player, "reset")
:catch(warn)
end
local function scale(player, scaleName, value)
assert(typeof(scaleName) == "string")
assert(typeof(value) == "number")
local humanoid = getHumanoid(player)
if not humanoid then
return
end
local description = humanoid:GetAppliedDescription()
if not description then
return
end
if scaleName == "HeightScale" then
value = math.clamp(value, 0.9, 1.05)
elseif scaleName == "WidthScale" then
value = math.clamp(value, 0.7, 1)
elseif scaleName == "HeadScale" then
value = math.clamp(value, 0.95, 1)
elseif scaleName == "ProportionScale" then
value = math.clamp(value, 0, 1)
elseif scaleName == "BodyTypeScale" then
value = math.clamp(value, 0, 1)
else
return
end
Promise.new(function(resolve, reject)
local success, result = pcall(function()
description[scaleName] = value
end)
if success then
resolve(success)
else
reject(result)
end
end)
:andThenCall(applyDescriptionToPlayer, player, description)
:doneCall(descriptionUpdated, player, "scale", scaleName, value)
:catch(warn)
end
local function create(player, name)
assert(typeof(name) == "string")
if name == "" then
return
end
name = string.gsub(name, "[%p%s]+", "")
local cache = outfitCache[player]
if not cache then
return
end
if #cache.Costumes >= Settings.MAX_COSTUME then
return
end
local humanoid = getHumanoid(player)
if not humanoid then
return
end
local description = humanoid:GetAppliedDescription()
if not description then
return
end
local info = module:ToAppearanceInfo(description)
filterText(name, player)
:andThen(function(result)
info.Name = result
-- converting it back to a HumanoidDescription for the client to use the filtered name
local descriptionCopy = module:ToHumanoidDescription(info)
descriptionCopy.Parent = cache.Folder
table.insert(cache.Costumes, info)
local index = #cache.Costumes
cache.Map[description] = index
module.CostumeAdded:Fire(player, descriptionCopy, info, index)
end)
:catch(warn)
end
local function delete(player, description)
assert(typeof(description) == "Instance" and description:IsA("HumanoidDescription"))
local cache = outfitCache[player]
if not cache then
return
end
local humanoid = getHumanoid(player)
if not humanoid then
return
end
if description:IsDescendantOf(cache.Folder) then
local index = cache.Map[description]
cache.Map[description] = nil
description:Destroy()
module.CostumeRemoved:Fire(player, description, cache.Costumes[index], index)
end
end
|
-- Remote Functions Server -> Client. (WARNING: This should only be used for info that is not sensitive as this can be hacked by the client.) | |
--[[Transmission]] |
Tune.TransModes ={"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.20 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.42 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.75 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.38 ,
--[[ 3 ]] 1.72 ,
--[[ 4 ]] 1.34 ,
--[[ 5 ]] 1.11 ,
--[[ 6 ]] .78 ,
}
Tune.FDMult = 1 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Overrides the current weather with a new one. this is purley the visual side. |
WeatherPrompt.OnClientEvent:Connect(function(WeatherInfo)
local Skip = coroutine.wrap(function()
local tweenInfo = TweenInfo.new(
10, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out -- EasingDirection
)
local tween = TweenService:Create(game.Lighting, tweenInfo, WeatherInfo["LightingSettings"])
tween:Play()
end)
Skip()
end)
|
-- Compiled with roblox-ts v2.1.0 |
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Log = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "log", "out").default
local _components = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components")
local Body = _components.Body
local NPC = _components.NPC
local Wants = _components.Wants
local function customer(world, _)
for id, wants in world:queryChanged(Wants) do
if not wants.old and wants.new then
Log.Info("v Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
task.delay(1, function()
if not world:contains(id) then
return nil
end
local npc = world:get(id, NPC)
local _result = world:get(id, Body)
if _result ~= nil then
_result = _result.model
end
local body = _result
if not npc or not body then
Log.Error("No NPC or Body component for customer")
return nil
end
body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
body.DialogGui.Enabled = true
end)
end
if wants.old and wants.new then
Log.Info("x Wants " .. (tostring(id) .. (" | " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product)))))
if not world:contains(id) then
return nil
end
local npc = world:get(id, NPC)
local _result = world:get(id, Body)
if _result ~= nil then
_result = _result.model
end
local body = _result
if not npc or not body then
Log.Error("No NPC or Body component for customer")
continue
end
body.DialogGui.DialogFrame.DialogText.Text = "I want " .. (tostring(wants.new.product.amount) .. ("x " .. wants.new.product.product))
body.DialogGui.Enabled = true
end
if wants.old and not wants.new then
if not world:contains(id) then
return nil
end
local npc = world:get(id, NPC)
local _result = world:get(id, Body)
if _result ~= nil then
_result = _result.model
end
local body = _result
if not npc or not body then
Log.Error("No NPC or Body component for customer")
continue
end
body.DialogGui.DialogFrame.DialogText.Text = "Thanks!"
task.wait(2)
body.DialogGui.Enabled = false
end
end
end
return customer
|
--[[
A middleware that allows for functions to be dispatched.
Functions will receive a single argument, the store itself.
This middleware consumes the function; middleware further down the chain
will not receive it.
]] |
local function tracebackReporter(message)
return debug.traceback(message)
end
local function thunkMiddleware(nextDispatch, store)
return function(action)
if typeof(action) == "function" then
local ok, result = xpcall(function()
return action(store)
end, tracebackReporter)
if not ok then
-- report the error and move on so it's non-fatal app
store._errorReporter.reportReducerError(store:getState(), action, {
message = "Caught error in thunk",
thrownValue = result,
})
return nil
end
return result
end
return nextDispatch(action)
end
end
return thunkMiddleware
|
--[[
Make sure to put Menu Blur Script in StarterGui
And that you put MenuBlur in Lighting
Or paste this in the command bar:
workspace:WaitForChild("Menu Blur Script").MenuBlur.Parent = game:GetService("Lighting") wait() workspace:WaitForChild("Menu Blur Script").Parent = game:GetService("StarterGui")
]] |
local Lighting = game:GetService("Lighting")
local MenuBluriness = Lighting.MenuBlur
local GuiService = game:GetService("GuiService")
GuiService.MenuOpened:Connect(function()
MenuBluriness.Enabled = true
end)
GuiService.MenuClosed:Connect(function()
MenuBluriness.Enabled = false
end)
|
--[[ @brief Removes and returns the smallest element on the heap.
@return The smallest element on the heap (using the stored comparator function).
--]] |
function Heap:Pop()
local v = self[1];
self[1] = self[#self];
self[#self] = nil;
self:_HeapifyTopDown(1);
return v;
end
|
-- Color Changing Script ~ Rainbow! |
while true do
script.Parent.BrickColor = BrickColor.Red()
wait(1)
script.Parent.Color = Color3.fromRGB(255, 149, 0)
wait(1)
script.Parent.BrickColor = BrickColor.Yellow()
wait(1)
script.Parent.BrickColor = BrickColor.Green()
wait(1)
script.Parent.Color = Color3.fromRGB(0, 255, 255)
wait(1)
script.Parent.BrickColor = BrickColor.Blue()
wait(1)
script.Parent.Color = Color3.fromRGB(226, 0, 255)
wait(1)
end
|
-------- OMG HAX |
debris = game:GetService("Debris")
r = game:service("RunService")
local damage = 18
local slash_damage = 18
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=15933756"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=15933756"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
local blues = {23,107,102,11,45,135}
function isTurbo(character)
return character:FindFirstChild("IceHelm") ~= nil
end
function allThatIce(pos, isTurbo)
local count = 5
if (isTurbo == true) then count = 10 end
for i=1,count do
local p = Instance.new("Part")
p.BrickColor = BrickColor.new(blues[math.random(#blues)])
p.formFactor = 2
p.Size = Vector3.new(1,.4,1)
p.Material = Enum.Material.Ice
p.TopSurface = 0
p.BottomSurface = 0
local a = math.random() * 6.28
local d = Vector3.new(math.cos(a), 0, math.sin(a)).unit
p.Velocity = d * 25
p.RotVelocity = d
p.Position = pos + Vector3.new(0, math.random() * 3, 0) + (d * 2)
p.Parent = game.Workspace
debris:AddItem(p, 60)
end
end
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)
if (isTurbo(vCharacter) == true) then
humanoid:TakeDamage(damage * 1.2)
else
humanoid:TakeDamage(damage)
end
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
debris:AddItem(creator_tag, 1)
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
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
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(.2)
allThatIce(character.Torso.Position + (character.Torso.CFrame.lookVector * 3), isTurbo(character))
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Class |
local CheckboxLabelClass = {}
CheckboxLabelClass.__index = CheckboxLabelClass
CheckboxLabelClass.__type = "CheckboxLabel"
function CheckboxLabelClass:__tostring()
return CheckboxLabelClass.__type
end
|
-- Events |
local events = ReplicatedStorage.Events
local roundEnd = events.RoundEnd
local displayRoundResult = events.DisplayRoundResult
|
--Initialize
--* called by the client immediately after it is initialized.
--* used to pass communication functions into the interface.
--* the current list of functions is as follows:
--********************************************************--
--*--UserEnded
--*--* Call this function when the user manually ends
--*--* any dialogue, so that the server can respond
--*--* accordingly and not send false timeout signals
--********************************************************-- |
function Interface.Initialize(clientFunctions)
Interface.ClientFunctions = clientFunctions
end
|
--Reset Colour |
script.Parent.Configuration.Colour.Value = Color3.new(255, 255, 255)
--ResetScript Ends
script.Parent.Configuration.Reset.Value = false;
end
end)
|
-- |
local Class = require(script.Class)
local Equipment = require(script.Equipment)
local LoadoutStates = require(game.ReplicatedStorage.Shared.LoadoutStates)
local Menu = New "Frame" {
Size = UDim2.fromScale(1, 1),
Transparency = 1,
Visible = Computed(function()
return LoadoutStates.Visible:get()
end),
[Children] = {
New "UIAspectRatioConstraint" {
AspectRatio = 1920/1080
},
Class {},
Equipment {},
},
}
return Menu
|
--brake.Value = TCount |
else
brake.Value = 1
end
if carSeat.Throttle == -1 and speed < 50 then
script.FL.OVERRIDE.Value = true
script.FR.OVERRIDE.Value = true
script.RL.OVERRIDE.Value = true
script.RR.OVERRIDE.Value = true
else
script.FL.OVERRIDE.Value = false
script.FR.OVERRIDE.Value = false
script.RL.OVERRIDE.Value = false
script.RR.OVERRIDE.Value = false
end
|
-- Decompiled with the Synapse X Luau decompiler. |
for v1, v2 in ipairs(script.Parent:GetChildren()) do
if v2:IsA("ImageButton") then
v2.MouseEnter:Connect(function()
v2.Rotation = 5;
end);
v2.MouseLeave:Connect(function()
v2.Rotation = 0;
end);
end;
end;
|
-- Decompiled with Visenya | https://targaryentech.com |
local MiscWeld = {}
function MakeWeld(x, y, type, s)
if type == nil then
type = "Weld"
end
local W = Instance.new(type)
W.Part0 = x
W.Part1 = y
W.C0 = x.CFrame:inverse() * x.CFrame
W.C1 = y.CFrame:inverse() * x.CFrame
W.Parent = x
if type == "Motor" and s ~= nil then
W.MaxVelocity = s
end
return W
end
function ModelWeld(a, b)
if a:IsA("BasePart") then
MakeWeld(b, a, "Weld")
elseif a:IsA("Model") then
for i, v in pairs(a:GetDescendants()) do
ModelWeld(v, b)
end
end
end
car = script.Parent.Parent.Parent
misc = car:WaitForChild("Misc")
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name == "SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent) ~= nil then
child.C0 = CFrame.new(0, -0.5, 0) * CFrame.fromEulerAnglesXYZ(-(math.pi / 2), 0, 0)
end
end)
return MiscWeld
|
-- Compiled with roblox-ts v2.1.0 |
local TS = require(game:GetService("ReplicatedStorage"):WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"))
local Players = TS.import(script, game:GetService("ReplicatedStorage"), "rbxts_include", "node_modules", "@rbxts", "services").Players
local Client = TS.import(script, game:GetService("ReplicatedStorage"), "TS", "components").Client
local player = Players.LocalPlayer
local function client(world, state)
for id, client in world:queryChanged(Client) do
if not client.old and (client.new and client.new.player.UserId == player.UserId) then
state.playerId = id
return nil
end
end
end
return client
|
----- cold tap handler ----- |
coldTap.Interactive.ClickDetector.MouseClick:Connect(function()
if coldOn.Value == false then
coldOn.Value = true
faucet.ParticleEmitter.Enabled = true
waterSound:Play()
hotTap.Interactive.ClickDetector.MaxActivationDistance = 0
coldTap.Interactive.ClickDetector.MaxActivationDistance = 32
hotTap.Handle.Transparency = 1
coldTap.Handle.Transparency = 0
handle.HandleOff.Transparency = 1
else
coldOn.Value = false
if hotOn.Value == false then
faucet.ParticleEmitter.Enabled = false
waterSound:Stop()
end
hotTap.Interactive.ClickDetector.MaxActivationDistance = 32
coldTap.Interactive.ClickDetector.MaxActivationDistance = 32
hotTap.Handle.Transparency = 1
coldTap.Handle.Transparency = 1
handle.HandleOff.Transparency = 0
end
end)
|
----------------------------------------------------------------------------------------------- |
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
script.Parent:WaitForChild("Needle")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then
gearText = "<i> <b>" .. "N" .. "</b> </i>"
elseif gearText == -1 then gearText = "<i> <b>" .. "R" .. "</b> </i>"
end
script.Parent.Gear.Text = "<i> <b>" .. gearText .. "</b> </i>"
script.Parent.Gear.Font = Enum.Font.Oswald
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Needle.Rotation = 240 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speed.Text = "<i>" .. math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. "</i>"
end)
wait(.1)
local RPMOFF = RedlineRPM - 100
script.Parent.Parent.Values.RPM.Changed:connect(function()
local Roundspeed = script.Parent.Parent.Values.RPM.Value
if Roundspeed <= RedlineRPM then
script.Parent.Gear.TextColor3 = Color3.fromRGB(24, 255, 145)
script.Parent.Center.ImageColor3 = Color3.fromRGB(24, 255, 145)
elseif Roundspeed >= RPMOFF then
script.Parent.Gear.TextColor3 = Color3.fromRGB(234, 31, 84)
script.Parent.Center.ImageColor3 = Color3.fromRGB(234, 31, 84)
end
end)
local values = script.Parent.Parent.Values
local gauges = script.Parent
values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCS.Value then
gauges.TCS.ImageColor3 = Color3.fromRGB(234, 31, 84)
if values.TCSActive.Value then
wait()
--gauges.TCS.Visible = not gauges.TCS.Visible
else
wait()
gauges.TCS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
else
gauges.TCS.Visible = true
gauges.TCS.ImageColor3 = Color3.fromRGB(234, 31, 84)
end
else
gauges.TCS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end)
values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
else
wait()
gauges.TCS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
else
gauges.TCS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end)
gauges.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
end
else
if gauges.TCS.Visible then
gauges.TCS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end
end)
values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABS.Value then
gauges.ABS.ImageColor3 = Color3.fromRGB(234, 31, 84)
if values.ABSActive.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
else
wait()
gauges.ABS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
else
gauges.ABS.Visible = true
gauges.ABS.ImageColor3 = Color3.fromRGB(234, 31, 84)
end
else
gauges.ABS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end)
values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
else
wait()
gauges.ABS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
else
gauges.ABS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end)
gauges.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
end
else
if gauges.ABS.Visible then
gauges.ABS.ImageColor3 = Color3.fromRGB(78, 78, 78)
end
end
end)
gauges.PBrake.Visible = values.PBrake.Value
function PBrake()
gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)
|
--[[for some reason, ROBLOX has decided that it is imperative that scripts DO NOT KNOW what physics
solver the place is using (same with part destroy height, but that is less annoying). Fortunately,
there's a simple hack that will tell us: surface motors. In PGS, surface motors are "braked" which
means that they always try to go to a certain speed, even when stopped. In Spring Physics, surface
motors "coast" which means that when they are stopped they are free to turn when stopped. We can use
this to determine the PGSness of the server. Three parts are created: an anchored part, an unanchored
part with a motor, and a brick on one side of the motor so it turns. If the motor turns, the server
is running spring physics.]] |
local Value = game.ServerScriptService:FindFirstChild("PGSPhysicsSolverEnabled")
local Temporary = game.ServerScriptService:FindFirstChild("PGSPhysicsSolverEnabled TEMP")
if Value and not Temporary then--we want to be as lazy as possible. If another script already figured
return Value.Value--out if the server is PGS or not, then lets just use their discovery
elseif Temporary then
repeat--because it takes a second for the script to run, we want to make sure that we don't flood
local inserted = game.ServerScriptService.ChildAdded:wait()--the thing with extra values.
if inserted.Name == "PGSPhysicsSolverEnabled" then--but, we want to get back with the answer ASAP
return inserted.Value
end
until false
else--well, it looks like this one will have to do the heavy lifting and run the test.
local PGSTemp = Instance.new("BoolValue")--prevent a flood of values
PGSTemp.Name = "PGSPhysicsSolverEnabled TEMP"
PGSTemp.Parent = game.ServerScriptService
local p1 = Instance.new("Part",workspace)
p2 = Instance.new("Part",workspace)
p3 = Instance.new("Part", workspace)
p1.Anchored = true
p1.CanCollide = false--having each property changed next to the others looks pretty
p2.CanCollide = false
p3.CanCollide = false
p1.FormFactor = "Symmetric"
p2.FormFactor = "Symmetric"
p3.FormFactor = "Symmetric"
p1.Transparency = 1
p2.Transparency = 1
p3.Transparency = 1
p1.CFrame = CFrame.Angles(0,1,0)--this is to prevent things from accidentally welding to it
p2.CFrame = p1.CFrame*CFrame.new(0,0,-2)
p3.CFrame = p2.CFrame*CFrame.new(3,1,0)
p2.BackSurface = "Motor"
p2:MakeJoints()--makes sure that the unanchored parts don't fall apart
p3:MakeJoints()
local StartPos = p3.Position
p2:SetNetworkOwner(nil)--make sure a pesky client doesn't get it!
wait(1)--run the test
local EndPos = p3.Position--test is over!
local Magnitude = (EndPos-StartPos).magnitude--how much did the brick move?
local PGSPhysicsSolverEnabledValue = Instance.new("BoolValue")
PGSPhysicsSolverEnabledValue.Name = "PGSPhysicsSolverEnabled"
PGSPhysicsSolverEnabledValue.Value = (Magnitude < 0.2) and true or false--if the brick moved a lot, then it's in Spring Physics
PGSPhysicsSolverEnabledValue.Parent = game.ServerScriptService--let everyone else who was waiting know the outcome
PGSTemp:Destroy()--this would cause major problems if it wasn't destroyed
p1:Destroy()--clean up the test
p2:Destroy()
p3:Destroy()
return Magnitude < 0.2--tell our script what the answer is
end
|
--[[
Add a dummy child node to the current node to hold the given error. This
allows an otherwise empty describe node to report an error in a more natural
way.
]] |
function TestSession:addDummyError(phrase, message)
self:pushNode({ type = TestEnum.NodeType.It, phrase = phrase })
self:setError(message)
self:popNode()
self.nodeStack[#self.nodeStack].status = TestEnum.TestStatus.Failure
end
|
--[[Driver Handling]] |
--Driver Sit
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
--Distribute Client Interface
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
script.Parent.Parent.Body.Raycaster.Script.Values.Value = g
end
end)
--Driver Leave
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
--Remove Flip Force
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
--Remove Wheel Force
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"]:IsA("BodyAngularVelocity") then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
else
if v["#AV"].AngularVelocity>0 then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
end
end
end
end
end
end)
|
-- ScriptSignal object: |
local ScriptSignal = {
--[[
_head = nil,
_listener_count = 0,
--]]
}
ScriptSignal.__index = ScriptSignal
function ScriptSignal:Connect(listener, disconnect_listener, disconnect_param) --> [ScriptConnection]
local script_connection = {
_listener = listener,
_script_signal = self,
_disconnect_listener = disconnect_listener,
_disconnect_param = disconnect_param,
_next = self._head,
_is_connected = true,
}
setmetatable(script_connection, ScriptConnection)
self._head = script_connection
self._listener_count += 1
return script_connection
end
function ScriptSignal:GetListenerCount() --> [number]
return self._listener_count
end
function ScriptSignal:Fire(...)
local item = self._head
while item ~= nil do
if item._is_connected == true then
if not FreeRunnerThread then
FreeRunnerThread = coroutine.create(RunEventHandlerInFreeThread)
end
task.spawn(FreeRunnerThread, item._listener, ...)
end
item = item._next
end
end
function ScriptSignal:FireUntil(continue_callback, ...)
local item = self._head
while item ~= nil do
if item._is_connected == true then
item._listener(...)
if continue_callback() ~= true then
return
end
end
item = item._next
end
end
function MadworkScriptSignal.NewScriptSignal() --> [ScriptSignal]
return {
_head = nil,
_listener_count = 0,
Connect = ScriptSignal.Connect,
GetListenerCount = ScriptSignal.GetListenerCount,
Fire = ScriptSignal.Fire,
FireUntil = ScriptSignal.FireUntil,
}
end
return MadworkScriptSignal
|
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
local UI = client.UI
local gui = service.New("ScreenGui", {ResetOnSpawn = false})
local gTable = UI.Register(gui)
if UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = true
local toggle = service.New("ImageButton", {
Parent = gui;
Name = "Toggle";
BackgroundTransparency = 1;
Position = UDim2.new(1, -45, 1, -45);
Size = UDim2.fromOffset(40, 40);
Image = client.HelpButtonImage;
ImageTransparency = 0.5;
})
--if UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(function()
local found = UI.Get("UserPanel", nil, true)
if found then
found.Object:Destroy()
else
UI.Make("UserPanel")
end
end)
gTable:Ready()
end
|
-- SERVICES -- |
local RS = game:GetService("ReplicatedStorage")
|
----- Frames ----- |
local GiftFrame = ScreenGui.ClaimGift.GiftFrame
local DailyRewardFrame = ScreenGui.DailyReward.DailyRewardFrame
local RebirthFrame = ScreenGui.Rebirth.RebirthFrame
local StoreFrame = ScreenGui.Store.StoreFrame
local VipFrame = ScreenGui.VIP.VipFrame
local InventoryFrame = ScreenGui.Inventory.InventoryFrame
local CaseStoreFrame = ScreenGui.CaseShop.CaseShopFrame
|
--m3.Volume = 0 |
m2.Looped = false
m2.Playing = false
script.Parent.Parent:WaitForChild("Drive").Locotrol.Event:connect(function(data)
if data["Horn"] == true then
m2.Volume = 0
m2.Looped = false
m2:Stop()
m2.Playing = false
--m3.Volume = 0
--m3.Stop()
m1.Volume = 7.5
m1:Play()
--wait(m1.TimeLength) --disabled because it makes looping part stuck playing if stopped too soon.
if m1.TimePosition < m1.TimeLength then
m2.Looped = true
m2.Volume = 7.5
m2:Play()
else
m1.Volume = 0
m1:Stop()
end
elseif data["Horn"] == false then
m1.Volume = 0
m1:Stop()
--[[ --For 3 part option
m2.Volume = 0
m2:Stop()
m2.Looped = false
m2.Playing = false
m3.Volume = 1
m3:Play()
--]]
----[[ -- For 2 part option
if m2.IsPlaying == true then
for i=2, 0, -.2 do
m2.Volume = i*1
wait(.1)
end
end
m2.Volume = 0
m2.Looped = false
m2.Playing = false
m2:Stop()
----]]
end
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.