prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[ By: Brutez. Script Fixed By Xcorrectgamermaster ]]
|
--
local JeffTheKillerScript=script;
repeat wait(0.1)until JeffTheKillerScript and JeffTheKillerScript.Parent and JeffTheKillerScript.Parent.ClassName=="Model"and JeffTheKillerScript.Parent:FindFirstChild("Head")and JeffTheKillerScript.Parent:FindFirstChild("Torso");
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;
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,-1,0,0,0,0,1,0,1,-0);
local OriginalC0=JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("HumanoidRootPart")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("HumanoidRootPart");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("HumaniodRootPart")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("AttackAnimation"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
wait(0.2);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(20);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
wait(1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while wait(0.1)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool" then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
wait(1)
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
wait(0.4);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
wait(0.15);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
wait(1)
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<99999999999999999999 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("")and not JeffTheKillerHead:FindFirstChild("").IsPlaying then
JeffTheKillerHead:FindFirstChild("").Volume=JeffTheKiller:FindFirstChild("Configuration"):FindFirstChild("RakeThemeVolume").Value;
JeffTheKillerHead:FindFirstChild(""):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>9999999999999999999 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("")and JeffTheKillerHead:FindFirstChild("").IsPlaying then
if not JeffLaughDebounce then
spawn(function()
JeffLaughDebounce=true;
repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("")then JeffTheKillerHead:FindFirstChild("").Volume=JeffTheKillerHead:FindFirstChild("").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("").Volume==0 or JeffTheKillerHead:FindFirstChild("").Volume<0;
JeffTheKillerHead:FindFirstChild("").Volume=0;
JeffTheKillerHead:FindFirstChild(""):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
spawn(function()
MusicDebounce=true;
repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
spawn(function()
JeffLaughDebounce=true;
repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("")then JeffTheKillerHead:FindFirstChild("").Volume=JeffTheKillerHead:FindFirstChild("").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("").Volume==0 or JeffTheKillerHead:FindFirstChild("").Volume<0;
JeffTheKillerHead:FindFirstChild("").Volume=0;
JeffTheKillerHead:FindFirstChild(""):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
spawn(function()
MusicDebounce=true;
repeat wait(0.1);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Found")then
JeffTheKiller.Target.Value = true;
JeffTheKillerHead:FindFirstChild("Found"):Play();
wait(0.4);
JeffTheKillerHead:FindFirstChild("RakeScream"):Play();
NoticeDebounce=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=JeffTheKiller.Configuration.BloodHourWalkSpeed.Value;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=1;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,game:GetService("Workspace"):FindFirstChild("Terrain"));
local NeckRotation=(JeffTheKiller:FindFirstChild("Torso").Position.Y-MainTarget.Parent:FindFirstChild("Head").Position.Y)/10;
if NeckRotation>-1.5 and NeckRotation<1.5 then
JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=OriginalC0*CFrame.fromEulerAnglesXYZ(NeckRotation,0,0);
end;
if NeckRotation<-1.5 then
JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,-1,0,0,0,-0.4,0.1,0,0.1,0.9);
elseif NeckRotation>1.5 then
JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,-1,0,0,0,0.1,0.08,0,0.08,-0.2);
end;
else
end;
else
Notice=false;
NoticeDebounce=false;
JeffTheKiller:FindFirstChild("Torso"):FindFirstChild("Neck").C0=CFrame.new(0,1,0,-1,0,0,0,0,1,0,1,-0);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=16;
JeffTheKiller.Target.Value=false;
end;
end;
spawn(function()
local AlreadyDo=false;
while wait(0.1) do
if JeffTheKiller.Target.Value==false and AlreadyDo==false then
JeffTheKiller.Wander.Disabled=false;
AlreadyDo=true;
wait(10);
AlreadyDo=false;
end;
if JeffTheKiller.Target.Value==true and AlreadyDo==false then
JeffTheKiller.Wander.Disabled=true;
AlreadyDo=true;
wait(10);
AlreadyDo=false;
end;
end;
end);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="NPC";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=2000;
JeffTheKillerHumanoid.JumpPower=100;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
function AddGamepass(player, gamepassId)
--- Variables
local playerId = player.UserId
local playerStats = _L.Saving.Get(player)
local playerCache = cache["u" .. playerId]
--- Sanity check
if playerStats == nil then
return
end
--- Create cache
if cache["u" .. playerId] == nil then
cache["u" .. playerId] = {}
playerCache = cache["u" .. playerId]
end
--- Check if gamepass is already written
if not _L.Functions.SearchArray(playerStats.Gamepasses, gamepassId) then
--- Write gamepass to save!
table.insert(playerStats.Gamepasses, gamepassId)
--- Analytics
pcall(function()
_L.Analytics.Purchase("Gamepass", player, gamepassId)
end)
end
--- Update cache
playerCache["g" .. gamepassId] = true
end
function CheckPlayer(player)
--- Variables
local playerId = player.UserId
local playerStats = _L.Saving.Get(player)
local playerCache = cache["u" .. playerId]
--- Sanity check
if playerStats == nil then
return
end
--- Create cache
if cache["u" .. playerId] == nil then
cache["u" .. playerId] = {}
playerCache = cache["u" .. playerId]
end
--- Iterate through all gamepasses to check if player owns them or not (bought on website)
for _, gamepassInfo in pairs(_L.Directory.Gamepasses) do
local gamepassId = gamepassInfo.ID
local gamepassOwned = playerCache["g" .. gamepassId] or false
--- Gamepass not owned already?
if gamepassOwned == false then
--- Check if player owns gamepass (new API)
local playerOwnsGamepass = false
pcall(function() playerOwnsGamepass = _L.MarketplaceService:UserOwnsGamePassAsync(playerId, gamepassId) end)
--- Player bought this gamepass and it's not added! ADD IT!
if playerOwnsGamepass == true then
AddGamepass(player, gamepassId)
end
end
end
end
function RemovePlayer(player)
--- Remove player from cache
local playerId = player.UserId
cache["u" .. playerId] = nil
end
|
--// All global vars will be wiped/replaced except script
|
return function(data, env)
if env then
setfenv(1, env)
end
--local client = service.GarbleTable(client)
local Player = service.Players.LocalPlayer
local Mouse = Player:GetMouse()
local InputService = service.UserInputService
local gIndex = data.gIndex
local gTable = data.gTable
local Event = gTable.BindEvent
local GUI = gTable.Object
local Name = data.Name
local Icon = data.Icon
local Size = data.Size
local Menu = data.Menu
local Title = data.Title
local Ready = data.Ready
local Walls = data.Walls
local noHide = data.NoHide
local noClose = data.NoClose
local onReady = data.OnReady
local onClose = data.OnClose
local onResize = data.OnResize
local onRefresh = data.OnRefresh
local onMinimize = data.OnMinimize
local ContextMenu = data.ContextMenu
local ResetOnSpawn = data.ResetOnSpawn
local CanKeepAlive = data.CanKeepAlive
local iconClicked = data.IconClicked
local SizeLocked = data.SizeLocked or data.SizeLock
local CanvasSize = data.CanvasSize
local Position = data.Position
local Content = data.Content or data.Children
local MinSize = data.MinSize or {150, 50}
local MaxSize = data.MaxSize or {math.huge, math.huge}
local curIcon = Mouse.Icon
local isClosed = false
local Resizing = false
local Refreshing = false
local DragEnabled = true
local checkProperty = service.CheckProperty
local specialInsts = {}
local inExpandable
local addTitleButton
local LoadChildren
local BringToFront
local functionify
local Drag = GUI.Drag
local Close = Drag.Close
local Hide = Drag.Hide
local Iconf = Drag.Icon
local Titlef = Drag.Title
local Refresh = Drag.Refresh
local rSpinner = Refresh.Spinner
local Main = Drag.Main
local Tooltip = GUI.Desc
local ScrollFrame = GUI.Drag.Main.ScrollingFrame
local LeftSizeIcon = Main.LeftResizeIcon
local RightSizeIcon = Main.RightResizeIcon
local RightCorner = Main.RightCorner
local LeftCorner = Main.LeftCorner
local RightSide = Main.RightSide
local LeftSide = Main.LeftSide
local TopRight = Main.TopRight
local TopLeft = Main.TopLeft
local Bottom = Main.Bottom
local Top = Main.Top
function Expand(ent, point, text, richText)
local label = point:FindFirstChild("Label")
if label then
ent.MouseLeave:Connect(function(x,y)
if inExpandable == ent then
point.Visible = false
end
end)
ent.MouseMoved:Connect(function(x,y)
inExpandable = ent
local text = text or ent.Desc.Value
label.Text = text
label.RichText = richText
label.TextScaled = richText
local sizeText = label.ContentText
local maxWidth = 400
local bounds = service.TextService:GetTextSize(sizeText, label.TextSize, label.Font, Vector2.new(maxWidth, math.huge))
local sizeX, sizeY = bounds.X + 10, bounds.Y + 10
local posX = (x + 6 + sizeX) < GUI.AbsoluteSize.X and (x + 6) or (x - 6 - sizeX)
local posY = (y - 6 - sizeY) > 0 and (y - 6 - sizeY) or (y)
point.Size = UDim2.new(0, sizeX, 0, sizeY)
point.Position = UDim2.new(0, posX, 0, posY)
point.Visible = true
end)
end
end
function getNextPos(frame)
local farXChild, farYChild
for i,v in next,frame:GetChildren() do
if checkProperty(v, "Size") then
if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
farXChild = v
end
if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
farYChild = v
end
end
end
return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
end
function LoadChildren(Obj, Children)
if Children then
local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
for class,data in next,Children do
if type(data) == "table" then
if not data.Parent then data.Parent = Obj end
create(data.Class or data.ClassName or class, data)
elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
runWhenDone = functionify(data, Obj)
end
end
if runWhenDone then
runWhenDone(Obj)
end
end
end
function BringToFront()
for i,v in ipairs(Player.PlayerGui:GetChildren()) do
if v:FindFirstChild("__ADONIS_WINDOW") then
v.DisplayOrder = 100
end
end
GUI.DisplayOrder = 101
end
function addTitleButton(data)
local startPos = 1
local realPos
local new
local original = Hide
local diff = (Hide.AbsolutePosition.X + Hide.AbsoluteSize.X) - Close.AbsolutePosition.X;
local far = Close;
for i,obj in ipairs(Drag:GetChildren()) do
if obj:IsA("TextButton") then
if obj.Visible and obj.AbsolutePosition.X < far.AbsolutePosition.X then
far = obj;
end
end
end;
local size = data.Size or original.Size;
local xPos = far.Position.X.Offset - (size.X.Offset - diff);
realPos = UDim2.new(far.Position.X.Scale, xPos, original.Position.Y.Scale, original.Position.Y.Offset)
data.Name = "__TITLEBUTTON"
data.Size = size
data.Parent = Drag
data.ZIndex = data.ZIndex or original.ZIndex
data.Position = data.Position or realPos
data.TextSize = data.TextSize or original.TextSize
data.TextColor3 = data.TextColor3 or original.TextColor3
data.TextScaled = data.TextScaled or original.TextScaled
data.TextScaled = data.TextScaled or original.TextScaled
data.TextWrapped = data.TextWrapped or original.TextWrapped
data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
data.TextTransparency = data.TextTransparency or original.TextTransparency
data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
data.Font = data.Font or original.Font
return create("TextButton", data)
end
function functionify(func, object)
if type(func) == "string" then
if object then
local env = GetEnv()
env.Object = object
return client.Core.LoadCode(func, env)
else
return client.Core.LoadCode(func)
end
else
return func
end
end
function create(class, dataFound, existing)
local data = dataFound or {}
local class = data.Class or data.ClassName or class
local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
local parent = data.Parent or new.Parent
if dataFound then
data.Parent = nil
if data.Class or data.ClassName then
data.Class = nil
data.ClassName = nil
end
if not data.BorderColor3 and checkProperty(new, "BorderColor3") then
new.BorderColor3 = dBorder
end
if not data.CanvasSize and checkProperty(new, "CanvasSize") then
new.CanvasSize = dCanvasSize
end
if not data.BorderSizePixel and checkProperty(new, "BorderSizePixel") then
new.BorderSizePixel = dPixelSize
end
if not data.BackgroundColor3 and checkProperty(new, "BackgroundColor3") then
new.BackgroundColor3 = dBackground
end
if not data.PlaceholderColor3 and checkProperty(new, "PlaceholderColor3") then
new.PlaceholderColor3 = dPlaceholderColor
end
if not data.Transparency and not data.BackgroundTransparency and checkProperty(new, "Transparency") and checkProperty(new, "BackgroundTransparency") then
new.BackgroundTransparency = dTransparency
elseif data.Transparency and checkProperty(new, "BackgroundTransparency") then
new.BackgroundTransparency = data.Transparency
end
if not data.TextColor3 and not data.TextColor and checkProperty(new, "TextColor3") then
new.TextColor3 = dTextColor
elseif data.TextColor then
new.TextColor3 = data.TextColor
end
if not data.Font and checkProperty(new, "Font") then
data.Font = dFont
end
if not data.TextSize and checkProperty(new, "TextSize") then
data.TextSize = dTextSize
end
if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
new.BottomImage = dScrollImage
new.MidImage = dScrollImage
new.TopImage = dScrollImage
end
if not data.Size and checkProperty(new, "Size") then
new.Size = dSize
end
if not data.Position and checkProperty(new, "Position") then
new.Position = dPosition
end
if not data.ZIndex and checkProperty(new, "ZIndex") then
new.ZIndex = dZIndex
if parent and checkProperty(parent, "ZIndex") then
new.ZIndex = parent.ZIndex
end
end
if data.TextChanged and class == "TextBox" then
local textChanged = functionify(data.TextChanged, new)
new.FocusLost:Connect(function(enterPressed)
textChanged(new.Text, enterPressed, new)
end)
end
if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") then
local debounce = false;
local doDebounce = data.Debounce;
local onClick = functionify((data.OnClicked or data.OnClick), new)
new.MouseButton1Down:Connect(function()
if not debounce then
if doDebounce then
debounce = true
end
onClick(new)
debounce = false
end
end)
end
if data.Events then
for event,func in pairs(data.Events) do
local realFunc = functionify(func, new)
Event(new[event], function(...)
realFunc(...)
end)
end
end
if data.Visible == nil then
data.Visible = true
end
if data.LabelProps then
data.LabelProperties = data.LabelProps
end
end
if class == "Entry" then
local label = new.Text
local dots = new.Dots
local desc = new.Desc
local richText = data.RichText or label.RichText
label.ZIndex = data.ZIndex or new.ZIndex
dots.ZIndex = data.ZIndex or new.ZIndex
if data.Text then
label.Text = data.Text
label.Visible = true
data.Text = nil
end
if data.Desc or data.ToolTip then
desc.Value = data.Desc or data.ToolTip
data.Desc = nil
end
Expand(new, Tooltip, nil, richText)
else
if data.ToolTip then
Expand(new, Tooltip, data.ToolTip, data.RichText)
end
end
if class == "ButtonEntry" then
local button = new.Button
local debounce = false
local onClicked = functionify(data.OnClicked, button)
new:SetSpecial("DoClick",function()
if not debounce then
debounce = true
if onClicked then
onClicked(button)
end
debounce = false
end
end)
new.Text = data.Text or new.Text
button.ZIndex = data.ZIndex or new.ZIndex
button.MouseButton1Down:Connect(new.DoClick)
end
if class == "Boolean" then
local enabled = data.Enabled
local debounce = false
local onToggle = functionify(data.OnToggle, new)
local function toggle(isEnabled)
if not debounce then
debounce = true
if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
enabled = false
new.Text = "Disabled"
elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
enabled = true
new.Text = "Enabled"
end
if onToggle then
onToggle(enabled, new)
end
debounce = false
end
end
--new.ZIndex = data.ZIndex
new.Text = (enabled and "Enabled") or "Disabled"
new.MouseButton1Down:Connect(function()
if onToggle then
toggle()
end
end)
new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
end
if class == "StringEntry" then
local box = new.Box
local ignore
new.Text = data.Text or new.Text
box.ZIndex = data.ZIndex or new.ZIndex
if data.BoxText then
box.Text = data.BoxText
end
if data.BoxProperties then
for i,v in next,data.BoxProperties do
if checkProperty(box, i) then
box[i] = v
end
end
end
if data.TextChanged then
local textChanged = functionify(data.TextChanged, box)
box.Changed:Connect(function(p)
if p == "Text" and not ignore then
textChanged(box.Text)
end
end)
box.FocusLost:Connect(function(enter)
local change = textChanged(box.Text, true, enter)
if change then
ignore = true
box.Text = change
ignore = false
end
end)
end
new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
end
if class == "Slider" then
local mouseIsIn = false
local posValue = new.Percentage
local slider = new.Slider
local bar = new.SliderBar
local drag = new.Drag
local moving = false
local value = 0
local onSlide = functionify(data.OnSlide, new)
bar.ZIndex = data.ZIndex or new.ZIndex
slider.ZIndex = bar.ZIndex+1
drag.ZIndex = slider.ZIndex+1
drag.Active = true
if data.Value then
slider.Position = UDim2.new(0.5, -10, 0.5, -10)
drag.Position = slider.Position
end
bar.InputBegan:Connect(function(input)
if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
drag.DragBegin:Connect(function()
moving = true
end)
drag.DragStopped:Connect(function()
moving = false
drag.Position = slider.Position
end)
drag.Changed:Connect(function()
if moving then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
new:SetSpecial("SetValue",function(ignore, newValue)
if newValue and tonumber(newValue) then
value = tonumber(newValue)
posValue.Value = value
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
end
end)
end
if class == "Dropdown" then
local menu = new.Menu
local downImg = new.Down
local selected = new.dSelected
local options = data.Options
local curSelected = data.Selected or data.Selection
local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
local textProps = data.TextProperties
local scroller = create("ScrollingFrame", {
Parent = menu;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 1;
ZIndex = 100;
})
menu.ZIndex = scroller.ZIndex
menu.Parent = GUI
menu.Visible = false
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
if data.TextAlignment then
selected.TextXAlignment = data.TextAlignment
selected.Position = UDim2.new(0, 30, 0, 0);
end
if data.NoArrow then
downImg.Visible = false
end
new:SetSpecial("MenuContainer", menu)
new.Changed:Connect(function(p)
if p == "AbsolutePosition" and menu.Visible then
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
elseif p == "AbsoluteSize" or p == "Parent" then
downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
if data.TextAlignment == "Right" then
downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
else
downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
end
selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
if options and #options <= 6 then
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
else
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
scroller:ResizeCanvas(false, true);
end
end
end)
selected.ZIndex = new.ZIndex
downImg.ZIndex = new.ZIndex
if textProps then
for i,v in next,textProps do
selected[i] = v
end
end
if options then
for i,v in next,options do
local button = scroller:Add("TextButton", {
Text = " ".. tostring(v);
Size = UDim2.new(1, -10, 0, 30);
Position = UDim2.new(0, 5, 0, 30*(i-1));
ZIndex = menu.ZIndex;
BackgroundTransparency = 1;
OnClick = function()
selected.Text = v;
onSelect(v, new);
menu.Visible = false
end
})
if textProps then
for i,v in next,textProps do
button[i] = v
end
end
end
if curSelected then
selected.Text = curSelected
else
selected.Text = "No Selection"
end
local function showMenu()
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end
selected.MouseButton1Down:Connect(showMenu)
downImg.MouseButton1Down:Connect(showMenu)
end
end
if class == "TabFrame" then
local buttonsTab = {};
local buttons = create("ScrollingFrame", nil, new.Buttons)
local frames = new.Frames
local numTabs = 0
local buttonSize = data.ButtonSize or 60
new.BackgroundTransparency = data.BackgroundTransparency or 1
buttons.ZIndex = data.ZIndex or new.ZIndex
frames.ZIndex = buttons.ZIndex
new:SetSpecial("GetTab", function(ignore, name)
return frames:FindFirstChild(name)
end)
new:SetSpecial("NewTab", function(ignore, name, data)
local data = data or {}
--local numChildren = #frames:GetChildren()
local nextPos = getNextPos(buttons);
local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
local oTextTrans = data.TextTransparency
local isOpen = false
local disabled = false
local tabFrame = create("ScrollingFrame",{
Name = name;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BorderSizePixel = 0;
BackgroundTransparency = data.FrameTransparency or data.Transparency;
BackgroundColor3 = data.Color or dSecondaryBackground;
ZIndex = buttons.ZIndex;
Visible = false;
})
local tabButton = create("TextButton",{
Name = name;
Text = data.Text or name;
Size = UDim2.new(0, textSize.X+20, 1, 0);
ZIndex = buttons.ZIndex;
Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
TextColor3 = data.TextColor;
BackgroundTransparency = 0.7;
TextTransparency = data.TextTransparency;
BackgroundColor3 = data.Color or dSecondaryBackground;
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in next,buttonsTab do
if isGui(v) then
v.BackgroundTransparency = (v:IsDisabled() and 0.9) or 0.7
v.TextTransparency = (v:IsDisabled() and 0.9) or 0.7
end
end
for i,v in next,frames:GetChildren() do
if isGui(v) then
v.Visible = false
end
end
tabButton.BackgroundTransparency = data.Transparency or 0
tabButton.TextTransparency = data.TextTransparency or 0
tabFrame.Visible = true
if data.OnFocus then
data.OnFocus(true)
end
end)
if numTabs == 0 then
tabFrame.Visible = true
tabButton.BackgroundTransparency = data.Transparency or 0
end
tabButton.MouseButton1Down:Connect(function()
if not disabled then
tabFrame:FocusTab()
end
end)
tabButton.Parent = buttons
tabFrame.Parent = frames
buttons:ResizeCanvas(true, false)
tabFrame:SetSpecial("Disable", function()
disabled = true;
tabButton.BackgroundTransparency = 0.9;
tabButton.TextTransparency = 0.9
end)
tabFrame:SetSpecial("Enable", function()
disabled = false;
tabButton.BackgroundTransparency = 0.7;
tabButton.TextTransparency = data.TextTransparency or 0;
end)
tabButton:SetSpecial("IsDisabled", function()
return disabled;
end)
table.insert(buttonsTab, tabButton);
numTabs = numTabs+1;
return tabFrame,tabButton
end)
end
if class == "ScrollingFrame" then
local genning = false
if not data.ScrollBarThickness then
data.ScrollBarThickness = dScrollBar
end
new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
local list = list or obj;
local genHold = {}
local entProps = labelProperties or {}
genning = genHold
new:ClearAllChildren()
new.AutomaticCanvasSize = "Y"
local layout = service.New("UIListLayout", {
Parent = new;
Name = "LayoutOrder";
FillDirection = data.Layout_FillDirection or "Vertical";
VerticalAlignment = data.Layout_VerticalAlignment or "Top";
HorizontalAlignment = data.Layout_HorizontalAlignment or "Left";
})
local num = 0
for i,v in next,list do
local text = v;
local desc;
local color
local richText;
if type(v) == "table" then
text = v.Text
desc = v.Desc
color = v.Color
if v.RichTextAllowed or entProps.RichTextAllowed then
richText = true
end
end
local label
if v.TextSelectable or entProps.TextSelectable then
label = create("TextBox",{
Text = " "..tostring(text);
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
TextEditable = false;
ClearTextOnFocus = false;
})
else
label = create("TextLabel",{
Text = " "..tostring(text);
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
})
end
if color then
label.TextColor3 = color
end
if labelProperties then
for i,v in pairs(entProps) do
if checkProperty(label, i) then
label[i] = v
end
end
end
if genning == genHold then
label.Parent = new;
else
label:Destroy()
break
end
num = num+1
if data.Delay then
if type(data.Delay) == "number" then
wait(data.Delay)
elseif i%100 == 0 then
wait(0.1)
end
end
end
--new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
if bottom then
new.CanvasPosition = Vector2.new(0, layout.AbsoluteContentSize.Y);
end
genning = nil
end)
new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
local newY, newX = 0,0
if not onX and not onY then onX = false onY = true end
for i,v in next,new:GetChildren() do
if v:IsA("GuiObject") then
if onY then
v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
end
if onX then
v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
end
local yLower = v.Position.Y.Offset + v.Size.Y.Offset
local xLower = v.Position.X.Offset + v.Size.X.Offset
newY = math.max(newY, yLower)
newX = math.max(newX, xLower)
if modBreak then
if i%modBreak == 0 then
wait(1/60)
end
end
end
end
if onY then
new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
end
if onX then
new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
end
if xMax then
new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
end
if yMax then
new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
end
end)
if data.List then new:GenerateList(data.List) data.List = nil end
end
LoadChildren(new, data.Content or data.Children)
data.Children = nil
data.Content = nil
for i,v in next,data do
if checkProperty(new, i) then
new[i] = v
end
end
new.Parent = parent
return apiIfy(new, data, class),data
end
function apiIfy(gui, data, class)
local newGui = service.Wrap(gui)
gui:SetSpecial("Object", gui)
gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
gui:SetSpecial("Add", function(ignore, class, data)
if not data then data = class class = ignore end
local new = create(class,data);
new.Parent = gui;
return apiIfy(new, data, class)
end)
gui:SetSpecial("Copy", function(ignore, class, gotData)
local newData = {}
local new
for i,v in next,data do
newData[i] = v
end
for i,v in next,gotData do
newData[i] = v
end
new = create(class or data.Class or gui.ClassName, newData);
new.Parent = gotData.Parent or gui.Parent;
return apiIfy(new, data, class)
end)
return newGui
end
function doClose()
if not isClosed then
isClosed = true
if onClose then
local r,e = pcall(onClose)
if e then
warn(e)
end
end
gTable:Destroy()
end
end
function isVisible()
return Main.Visible
end
local hideLabel = Hide:FindFirstChild("TextLabel")
function doHide(doHide)
local origLH = Hide.LineHeight
if doHide or (doHide == nil and Main.Visible) then
dragSize = Drag.Size
Main.Visible = false
Drag.BackgroundTransparency = Main.BackgroundTransparency
Drag.BackgroundColor3 = Main.BackgroundColor3
Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
if hideLabel then
hideLabel.Text = "+"
else
Hide.Text = "+"
end
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
if hideLabel then
hideLabel.Text = "-"
else
Hide.Text = "-"
end
Hide.LineHeight = origLH
gTable.Minimized = false
end
if onMinimize then
onMinimize(Main.Visible)
end
if Walls then
wallPosition()
end
end
function isInFrame(x, y, frame)
if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
return true
else
return false
end
end
function wallPosition()
if gTable.Active then
local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
if x < 0 then
Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y < 0 then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
end
if x + abx > gx then
Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y + ySize > gy then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
end
end
end
function setSize(newSize)
if newSize and type(newSize) == "table" then
if newSize[1] < 50 then newSize[1] = 50 end
if newSize[2] < 50 then newSize[2] = 50 end
Drag.Size = UDim2.new(0,newSize[1],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
Main.Size = UDim2.new(1,0,0,newSize[2])
end
end
function setPosition(newPos)
if newPos and typeof(newPos) == "UDim2" then
Drag.Position = newPos
elseif newPos and type(newPos) == "table" then
Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
elseif Size and not newPos then
Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
end
end
if Name then
gTable.Name = Name
if data.AllowMultiple ~= nil and data.AllowMultiple == false then
local found, num = client.UI.Get(Name, GUI, true)
if found then
doClose()
return nil
end
end
end
if Size then
setSize(Size)
end
if Position then
setPosition(Position)
end
if Title then
Titlef.Text = Title
end
if CanKeepAlive or not ResetOnSpawn then
gTable.CanKeepAlive = true
GUI.ResetOnSpawn = false
elseif ResetOnSpawn then
gTable.CanKeepAlive = false
GUI.ResetOnSpawn = true
end
if Icon then
Iconf.Visible = true
Iconf.Image = Icon
Iconf.Size = UDim2.new(0, 16, 0, 16)
Iconf.Position = UDim2.new(0, 6, 0, 5)
Iconf.ImageTransparency = 0
end
if CanvasSize then
ScrollFrame.CanvasSize = CanvasSize
end
if noClose then
Close.Visible = false
Refresh.Position = Hide.Position
Hide.Position = Close.Position
end
if noHide then
Hide.Visible = false
Refresh.Position = Hide.Position
end
if Walls then
Drag.DragStopped:Connect(function()
wallPosition()
end)
end
if onRefresh then
local debounce = false
function DoRefresh()
if not Refreshing then
local done = false
Refreshing = true
spawn(function()
while gTable.Active and not done do
for i = 0,180,10 do
rSpinner.Rotation = -i
wait(1/60)
end
end
end)
onRefresh()
wait(1)
done = true
Refreshing = false
end
end
Refresh.MouseButton1Down:Connect(function()
if not debounce then
debounce = true
DoRefresh()
debounce = false
end
end)
Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
else
Refresh.Visible = false
end
if iconClicked then
Iconf.MouseButton1Down(function()
iconClicked(data, GUI, Iconf)
end)
end
if Menu then
data.Menu.Text = ""
data.Menu.Parent = Main
data.Menu.Size = UDim2.new(1,-10,0,25)
data.Menu.Position = UDim2.new(0,5,0,25)
ScrollFrame.Size = UDim2.new(1,-10,1,-55)
ScrollFrame.Position = UDim2.new(0,5,0,50)
data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
data.Menu.BorderSizePixel = 0
create("TextLabel",data.Menu)
end
if not SizeLocked then
local startXPos = Drag.AbsolutePosition.X
local startYPos = Drag.AbsolutePosition.Y
local startXSize = Drag.AbsoluteSize.X
local startYSize = Drag.AbsoluteSize.Y
local vars = client.Variables
local newIcon
local inFrame
local ReallyInFrame
local function readify(obj)
obj.MouseEnter:Connect(function()
ReallyInFrame = obj
end)
obj.MouseLeave:Connect(function()
if ReallyInFrame == obj then
ReallyInFrame = nil
end
end)
end
--[[
readify(Drag)
readify(ScrollFrame)
readify(TopRight)
readify(TopLeft)
readify(RightCorner)
readify(LeftCorner)
readify(RightSide)
readify(LeftSide)
readify(Bottom)
readify(Top)
--]]
function checkMouse(x, y) --// Update later to remove frame by frame pos checking
if gTable.Active and Main.Visible then
if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
inFrame = nil
newIcon = nil
elseif isInFrame(x, y, TopRight) then
inFrame = "TopRight"
newIcon = MouseIcons.TopRight
elseif isInFrame(x, y, TopLeft) then
inFrame = "TopLeft"
newIcon = MouseIcons.TopLeft
elseif isInFrame(x, y, RightCorner) then
inFrame = "RightCorner"
newIcon = MouseIcons.RightCorner
elseif isInFrame(x, y, LeftCorner) then
inFrame = "LeftCorner"
newIcon = MouseIcons.LeftCorner
elseif isInFrame(x, y, RightSide) then
inFrame = "RightSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, LeftSide) then
inFrame = "LeftSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, Bottom) then
inFrame = "Bottom"
newIcon = MouseIcons.Vertical
elseif isInFrame(x, y, Top) then
inFrame = "Top"
newIcon = MouseIcons.Vertical
else
inFrame = nil
newIcon = nil
end
else
inFrame = nil
end
if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
if inFrame and newIcon then
Mouse.Icon = newIcon
client.Variables.MouseLockedBy = gTable
elseif client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
end
end
local function inputStart(x, y)
checkMouse(x, y)
if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
end
end
local function inputEnd()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--DragEnabled = true
--if Walls then
-- wallPosition()
--end
end
end
local function inputMoved(x, y)
if gTable.Active then
if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
curIcon = Mouse.Icon
end
if Resizing then
local moveX = false
local moveY = false
local newPos = Drag.Position
local xPos, yPos = x, y
local newX, newY = startXSize, startYSize
--DragEnabled = false
if Resizing == "TopRight" then
newX = (xPos - startXPos) + 3
newY = (startYPos - yPos) + startYSize -1
moveY = true
elseif Resizing == "TopLeft" then
newX = (startXPos - xPos) + startXSize -1
newY = (startYPos - yPos) + startYSize -1
moveY = true
moveX = true
elseif Resizing == "RightCorner" then
newX = (xPos - startXPos) + 3
newY = (yPos - startYPos) + 3
elseif Resizing == "LeftCorner" then
newX = (startXPos - xPos) + startXSize + 3
newY = (yPos - startYPos) + 3
moveX = true
elseif Resizing == "LeftSide" then
newX = (startXPos - xPos) + startXSize + 3
newY = startYSize
moveX = true
elseif Resizing == "RightSide" then
newX = (xPos - startXPos) + 3
newY = startYSize
elseif Resizing == "Bottom" then
newX = startXSize
newY = (yPos - startYPos) + 3
elseif Resizing == "Top" then
newX = startXSize
newY = (startYPos - yPos) + startYSize - 1
moveY = true
end
if newX < MinSize[1] then newX = MinSize[1] end
if newY < MinSize[2] then newY = MinSize[2] end
if newX > MaxSize[1] then newX = MaxSize[1] end
if newY > MaxSize[2] then newY = MaxSize[2] end
if moveX then
newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
end
if moveY then
newPos = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
end
Drag.Position = newPos
Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
if not Titlef.TextFits then
Titlef.Visible = false
else
Titlef.Visible = true
end
else
checkMouse(x, y)
end
end
end
Event(InputService.InputBegan, function(input, gameHandled)
if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
inputStart(Mouse.X, Mouse.Y)
end
end)
Event(InputService.InputChanged, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch then
inputMoved(input.Position.X, input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch then
inputEnd()
end
end)
--[[Event(Mouse.Button1Down, function()
if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
checkMouse()
end
end)
Event(Mouse.Button1Up, function()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--if Walls then
-- wallPosition()
--end
end
end)--]]
else
LeftSizeIcon.Visible = false
RightSizeIcon.Visible = false
end
Close.MouseButton1Down:Connect(doClose)
Hide.MouseButton1Down:Connect(function() doHide() end)
gTable.CustomDestroy = function()
if client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
if not isClosed then
isClosed = true
if onClose then
onClose()
end
end
service.UnWrap(GUI):Destroy()
end
for i,child in next,GUI:GetChildren() do
if child.Name ~= "Desc" and child.Name ~= "Drag" then
specialInsts[child.Name] = child
child.Parent = nil
end
end
--// Drag & DisplayOrder Handler
do
local windowValue = Instance.new("BoolValue", GUI)
local dragDragging = false
local dragOffset
local inFrame
windowValue.Name = "__ADONIS_WINDOW"
Event(Main.InputBegan, function(input)
if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end)
Event(Drag.InputBegan, function(input)
if gTable.Active then
inFrame = true
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
BringToFront()
end
end
end)
Event(Drag.InputChanged, function(input)
if gTable.Active then
inFrame = true
end
end)
Event(Drag.InputEnded, function(input)
inFrame = false
end)
Event(InputService.InputBegan, function(input)
if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
dragDragging = true
BringToFront()
dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
end
end)
Event(InputService.InputChanged, function(input)
if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragDragging = false
end
end)
end
--// Finishing up
local api = apiIfy(ScrollFrame, data)
local meta = api:GetMetatable()
local oldNewIndex = meta.__newindex
local oldIndex = meta.__index
create("ScrollingFrame", nil, ScrollFrame)
LoadChildren(api, Content)
api:SetSpecial("gTable", gTable)
api:SetSpecial("Window", GUI)
api:SetSpecial("Main", Main)
api:SetSpecial("Title", Titlef)
api:SetSpecial("Dragger", Drag)
api:SetSpecial("Destroy", doClose)
api:SetSpecial("Close", doClose)
api:SetSpecial("Object", ScrollFrame)
api:SetSpecial("Refresh", DoRefresh)
api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
api:SetSpecial("IsVisible", isVisible)
api:SetSpecial("IsClosed", isClosed)
meta.__index = function(tab, ind)
if ind == "IsVisible" then
return isVisible()
elseif ind == "Closed" then
return isClosed
else
return oldIndex(tab, ind)
end
end
setSize(Size)
setPosition(Position)
if Ready then
gTable:Ready()
BringToFront()
end
return api,GUI
end
|
--This module is for any client FX related to the Teleporter A's door
|
local DoorFX = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
function DoorFX.OPEN(door)
if not door then return end
tweenService:Create(door.Door.Main, tweenInfo, {CFrame = door.Door.Goal.CFrame}):Play()
door.Door.Main.DoorOpenFADEOUT:Play()
end
function DoorFX.CLOSE(door)
if not door then return end
door.Door.Main.CFrame = door.Door.Home.CFrame
end
return DoorFX
|
-- Increases the spread based on spread intensity
|
function SpreadSimulator:IncreaseSpread()
self.currentSpread = math.clamp(self.currentSpread + self.spreadIntensity, self.minSpread, self.maxSpread)
end
|
------//Low Ready Animations
|
self.RightLowReady = CFrame.new(-1, 1.1, -0.5) * CFrame.Angles(math.rad(-30), math.rad(0), math.rad(0));
self.LeftLowReady = CFrame.new(1,1,-0.9) * CFrame.Angles(math.rad(-30),math.rad(35),math.rad(-25));
self.RightElbowLowReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftElbowLowReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.RightWristLowReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
self.LeftWristLowReady = CFrame.new(0,0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0));
|
--[[ << BANLAND >> ]]
|
Banned = {"PlayerName1","PlayerName2",};
|
--- Send text as the local user to remote server to be evaluated there.
|
function Dispatcher:Send (text, data)
if RunService:IsClient() == false then
error("Dispatcher:Send can only be called from the client.")
end
return self.Cmdr.RemoteFunction:InvokeServer(text, {
Data = data
})
end
|
--if hood.Velocity.magnitude < 15 then return end -- must be going decently fast to break stuff... can add invisible "prebumpers" in the future to make collisions smoother
|
if hood.CFrame:vectorToObjectSpace(hood.Velocity):Dot(direction) < 35 then return end -- must be going fast in correct direction to break stuff
if hit and hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then
--hit.Parent:BreakJoints() let's not kill 'em... for now
hit.Parent.Humanoid.Sit = true -- but we do make 'em flyyyy! XD
elseif hit:FindFirstChild("RobloxModel") and not hit:FindFirstChild("RunOver") and isSmallerThanVehicle(hit) then
local newModel = hit:Clone()
local modelParent = hit.Parent
local newRunOverTag = Instance.new("BoolValue")
newRunOverTag.Name = "RunOver"
newRunOverTag.Parent = hit
hit:BreakJoints()
debris:AddItem(hit, timeToRespawn)
coroutine.resume(coroutine.create(respawnIt), newModel, modelParent)
elseif hit.Parent:FindFirstChild("RobloxModel") and not hit.Parent:FindFirstChild("RunOver") and isSmallerThanVehicle(hit.Parent) then
local newModel = hit.Parent:Clone()
local modelParent = hit.Parent.Parent
local newRunOverTag = Instance.new("BoolValue")
newRunOverTag.Name = "RunOver"
newRunOverTag.Parent = hit.Parent
hit.Parent:BreakJoints()
debris:AddItem(hit.Parent, timeToRespawn)
coroutine.resume(coroutine.create(respawnIt), newModel, modelParent)
end
end
end
|
--// UI Tween Info
|
local L_155_ = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out,
0,
false,
0
)
local L_156_ = {
TextTransparency = 1
}
|
--This is in order for the ingame clock to work
|
local dayLength = 35 --you can adjust this (24-34 recommended)
local cycleTime = dayLength*60
local minutesInADay = 24*60
local lighting = game:GetService("Lighting")
local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime
local timeRatio = minutesInADay / cycleTime
if dayLength == 0 then
dayLength = 1
end
repeat
local currentTime = tick()
if currentTime > endTime then
startTime = endTime
endTime = startTime + cycleTime
end
lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
wait(1/15)
until false
|
-- declarations
|
local Torso = waitForChild(Figure, "Torso")
local LeftArm = waitForChild(Figure, "Left Arm")
local LeftLeg = waitForChild(Figure, "Left Leg")
local RightArm = waitForChild(Figure, "Right Arm")
local RightLeg = waitForChild(Figure, "Right Leg")
local Joints = {
{"Right Shoulder", Torso, RightArm, CFrame.new(1, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(-0.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), 0.5},
{"Left Shoulder", Torso, LeftArm, CFrame.new(-1, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(0.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), 0.5},
{"Right Hip", Torso, RightLeg, CFrame.new(1, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), CFrame.new(0.5, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0), 0.10000000149012},
{"Left Hip", Torso, LeftLeg, CFrame.new(-1, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), CFrame.new(-0.5, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0), 0.10000000149012},
{"Neck", Torso, Head, CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), CFrame.new(0, -0.5, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0), 0.10000000149012}}
Torso:breakJoints()
for _, v in pairs(Joints) do
Joint(unpack(v))
end
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Humanoid")
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
|
-- Modules / Directories --
|
local Dependencies = script.Dependencies
local Maid = require(Dependencies.Maid)
local InverseKinematics = require(Dependencies.InverseKinematics)
local IK_Parts = Dependencies.IK_Parts
local LegController = {}
LegController.__index = LegController
function LegController.new(Character : Model, Configuration : any)
local self = setmetatable({}, LegController)
self.Maid = Maid.new()
local Humanoid = Character:WaitForChild("Humanoid")
local LeftHip_Joint = Character:FindFirstChild(Humanoid.RigType == Enum.HumanoidRigType.R6 and "Left Hip" or "LeftHip", true)
local RightHip_Joint = Character:FindFirstChild(Humanoid.RigType == Enum.HumanoidRigType.R6 and "Right Hip" or "RightHip", true)
local LeftHip_C0 = LeftHip_Joint.C0
local RightHip_C0 = RightHip_Joint.C0
local Char_IK = nil
if Humanoid.RigType == Enum.HumanoidRigType.R6 then
Char_IK = InverseKinematics.New(Character)
end
local IK_RayParams = RaycastParams.new()
IK_RayParams.FilterType = Enum.RaycastFilterType.Exclude
IK_RayParams.FilterDescendantsInstances = {Character}
local CurrentIK_Parts = {}
for Index, Attachment in pairs(IK_Parts:GetChildren()) do
local Attachment = Attachment:Clone()
Attachment.Parent = Humanoid.RootPart
CurrentIK_Parts[Attachment.Name] = Attachment
end
-- Connections --
self.Maid:GiveTask(RunService.RenderStepped:Connect(function(DeltaTime : number)
local Normalized_DeltaTime = DeltaTime * 60
local Root_Velocity = Vector3.new(1, 0, 1) * Humanoid.RootPart.Velocity
local LeftHip_C0, RightHip_C0 = LeftHip_C0, RightHip_C0
if Char_IK and CurrentIK_Parts.LeftHip and CurrentIK_Parts.LeftFoot and CurrentIK_Parts.RightHip and CurrentIK_Parts.RightFoot then
local LeftFoot_RayDir = CurrentIK_Parts.LeftFoot.WorldCFrame.Position - CurrentIK_Parts.LeftHip.WorldCFrame.Position
local LeftFoot_Raycast = workspace:Raycast(CurrentIK_Parts.LeftHip.WorldCFrame.Position, LeftFoot_RayDir, IK_RayParams)
local RightFoot_RayDir = CurrentIK_Parts.RightFoot.WorldCFrame.Position - CurrentIK_Parts.RightHip.WorldCFrame.Position
local RightFoot_Raycast = workspace:Raycast(CurrentIK_Parts.RightHip.WorldCFrame.Position, RightFoot_RayDir, IK_RayParams)
if LeftFoot_Raycast and LeftFoot_Raycast.Material ~= Enum.Material.Water and LeftFoot_Raycast.Instance.CanCollide then
LeftHip_C0 = Char_IK:LegIK("Left", LeftFoot_Raycast.Position)
end
if RightFoot_Raycast and RightFoot_Raycast.Material ~= Enum.Material.Water and RightFoot_Raycast.Instance.CanCollide then
RightHip_C0 = Char_IK:LegIK("Right", RightFoot_Raycast.Position)
end
end
local MinActivation_Speed, Max_TiltAngle = Configuration and Configuration.Tilt.MinActivation_Speed or 1.5, Configuration and Configuration.Tilt.MaxAngle or 35
local Tilt, TiltAngle = 0, 0
local Dont_Inverse = Humanoid.RootPart.CFrame.LookVector:Dot(Humanoid.MoveDirection) < -0.1
if Root_Velocity.Magnitude > MinActivation_Speed then --Checking if the Root_Velocity is above MinActivation_Speed
Tilt = Humanoid.RootPart.CFrame.RightVector:Dot(Root_Velocity.unit)
Tilt = Dont_Inverse and Tilt or -Tilt
end
TiltAngle = math.rad(Humanoid:GetState() == Enum.HumanoidStateType.Running and Tilt * Max_TiltAngle or 0)
-- Moving joints --
local Lerp = Root_Velocity.Magnitude < 2.5 and 0.285 or 0.1
LeftHip_Joint.C0 = LeftHip_Joint.C0:Lerp(LeftHip_C0 * CFrame.Angles(0, TiltAngle, 0), Lerp * Normalized_DeltaTime)
RightHip_Joint.C0 = RightHip_Joint.C0:Lerp(RightHip_C0 * CFrame.Angles(0, TiltAngle, 0), Lerp * Normalized_DeltaTime)
end))
return self
end
function LegController:Destroy()
self.Maid:DoCleaning()
table.clear(self)
setmetatable(self, nil)
return
end
return LegController
|
-- The maximum distance the can can shoot, this value should never go above 1000
|
local Range = 370
|
--Rescripted by Luckymaxer
|
Particle = script.Parent
Duration = Particle:WaitForChild("Duration")
wait(Duration.Value)
Particle.Enabled = false
|
-- Decompiled with the Synapse X Luau decompiler.
|
local u1 = nil;
local l__Parent__2 = script.Parent;
l__Parent__2.Equipped:Connect(function(p1)
print(p1);
u1 = game.Players.LocalPlayer.Character;
if u1 and u1.RightHand then
end;
end);
l__Parent__2.Unequipped:Connect(function()
u1 = game.Players.LocalPlayer.Character;
if u1 and u1.RightHand then
end;
end);
game:GetService("RunService").RenderStepped:Connect(function()
if not u1 then
return;
end;
local v1 = game.Workspace.CurrentCamera:GetRenderCFrame();
l__Parent__2.LightHandle.CFrame = v1 - v1.p + u1:GetPrimaryPartCFrame().p + Vector3.new(0, 2, 0);
end);
|
--[=[
Returns whether the object is a ValueObject class
@param value any
@return boolean
]=]
|
function ValueObject.isValueObject(value)
return type(value) == "table" and getmetatable(value) == ValueObject
end
|
-- Converts a Vector3 in CIELAB space to a Color3 in RGB space.
-- The Color3 will be clamped by default unless specified otherwise.
|
function Oklab.from(lab: Vector3, unclamped: boolean?): Color3
local lRoot = lab.X + lab.Y * 0.3963377774 + lab.Z * 0.2158037573
local mRoot = lab.X - lab.Y * 0.1055613458 - lab.Z * 0.0638541728
local sRoot = lab.X - lab.Y * 0.0894841775 - lab.Z * 1.2914855480
local l = lRoot ^ 3
local m = mRoot ^ 3
local s = sRoot ^ 3
local red = l * 4.0767416621 - m * 3.3077115913 + s * 0.2309699292
local green = l * -1.2684380046 + m * 2.6097574011 - s * 0.3413193965
local blue = l * -0.0041960863 - m * 0.7034186147 + s * 1.7076147010
if not unclamped then
red = math.clamp(red, 0, 1)
green = math.clamp(green, 0, 1)
blue = math.clamp(blue, 0, 1)
end
return Color3.new(red, green, blue)
end
return Oklab
|
-----------------
--| Variables |--
-----------------
|
local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')
local MyPlayer = script:FindFirstAncestorOfClass("Player")
local Tool = MyPlayer.Backpack:FindFirstChild("RocketLauncher")or MyPlayer.Character:FindFirstChild("RocketLauncher")
local ToolHandle = Tool:WaitForChild("Handle")
local MouseLoc = script.Parent:WaitForChild("MouseLoc",10)
local RocketScript = script:WaitForChild('Rocket')
local SwooshSound = script:WaitForChild('Swoosh')
local BoomSound = script:WaitForChild('Boom')
|
-- LOCALS --
|
local Camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
|
--[[
Assert that our functoid expectation value throws an error when called.
An optional error message can be passed to assert that the error message
contains the given value.
]]
|
function Expectation:throw(messageSubstring)
local ok, err = pcall(self.value)
local result = ok ~= self.successCondition
if messageSubstring and not ok then
if self.successCondition then
result = err:find(messageSubstring, 1, true) ~= nil
else
result = err:find(messageSubstring, 1, true) == nil
end
end
local message
if messageSubstring then
message = formatMessage(self.successCondition,
("Expected function to throw an error containing %q, but it %s"):format(
messageSubstring,
err and ("threw: %s"):format(err) or "did not throw."
),
("Expected function to never throw an error containing %q, but it threw: %s"):format(
messageSubstring,
tostring(err)
)
)
else
message = formatMessage(self.successCondition,
"Expected function to throw an error, but it did not throw.",
("Expected function to succeed, but it threw an error: %s"):format(
tostring(err)
)
)
end
assertLevel(result, message, 3)
self:_resetModifiers()
return self
end
return Expectation
|
--------------------[ MATH FUNCTIONS ]------------------------------------------------
|
function RAND(Min, Max, Accuracy)
local Inverse = 1 / (Accuracy or 1)
return (math.random(Min * Inverse, Max * Inverse) / Inverse)
end
|
--[[ FUNCTIONS ]]
|
local function lerpLength(msg, min, max)
return min + (max - min) * math.min(getMessageLength(msg) / 75.0, 1.0)
end
local function createFifo()
local this = {}
this.data = {}
local emptyEvent = Instance.new("BindableEvent")
this.Emptied = emptyEvent.Event
function this:Size()
return #this.data
end
function this:Empty()
return this:Size() <= 0
end
function this:PopFront()
table.remove(this.data, 1)
if this:Empty() then emptyEvent:Fire() end
end
function this:Front()
return this.data[1]
end
function this:Get(index)
return this.data[index]
end
function this:PushBack(value)
table.insert(this.data, value)
end
function this:GetData()
return this.data
end
return this
end
local function createCharacterChats()
local this = {}
this.Fifo = createFifo()
this.BillboardGui = nil
return this
end
local function createMap()
local this = {}
this.data = {}
local count = 0
function this:Size()
return count
end
function this:Erase(key)
if this.data[key] then count = count - 1 end
this.data[key] = nil
end
function this:Set(key, value)
this.data[key] = value
if value then count = count + 1 end
end
function this:Get(key)
if not key then return end
if not this.data[key] then
this.data[key] = createCharacterChats()
local emptiedCon = nil
emptiedCon = this.data[key].Fifo.Emptied:connect(function()
emptiedCon:disconnect()
this:Erase(key)
end)
end
return this.data[key]
end
function this:GetData()
return this.data
end
return this
end
local function createChatLine(message, bubbleColor, isLocalPlayer)
local this = {}
function this:ComputeBubbleLifetime(msg, isSelf)
if isSelf then
return lerpLength(msg, 8, 15)
else
return lerpLength(msg, 12, 20)
end
end
this.Origin = nil
this.RenderBubble = nil
this.Message = message
this.BubbleDieDelay = this:ComputeBubbleLifetime(message, isLocalPlayer)
this.BubbleColor = bubbleColor
this.IsLocalPlayer = isLocalPlayer
return this
end
local function createPlayerChatLine(player, message, isLocalPlayer)
local this = createChatLine(message, BubbleColor.WHITE, isLocalPlayer)
if player then
this.User = player.Name
this.Origin = player.Character
end
return this
end
local function createGameChatLine(origin, message, isLocalPlayer, bubbleColor)
local this = createChatLine(message, bubbleColor, isLocalPlayer)
this.Origin = origin
return this
end
function createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleMain = Instance.new("ImageLabel")
chatBubbleMain.Name = "ChatBubble"
chatBubbleMain.ScaleType = Enum.ScaleType.Slice
chatBubbleMain.SliceCenter = sliceRect
chatBubbleMain.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
chatBubbleMain.ImageColor3 = Color3.fromRGB(44,44,44)
chatBubbleMain.BackgroundTransparency = 1
chatBubbleMain.BorderSizePixel = 0
chatBubbleMain.Size = UDim2.new(1.0, 0, 1.0, 0)
chatBubbleMain.Position = UDim2.new(0, 0, 0, 0)
return chatBubbleMain
end
function createChatBubbleTail(position, size)
local chatBubbleTail = Instance.new("ImageLabel")
chatBubbleTail.Name = "ChatBubbleTail"
chatBubbleTail.Image = "rbxasset://textures/ui/dialog_tail.png"
chatBubbleTail.ImageColor3 = Color3.fromRGB(44,44,44)
chatBubbleTail.BackgroundTransparency = 1
chatBubbleTail.BorderSizePixel = 0
chatBubbleTail.Position = position
chatBubbleTail.Size = size
return chatBubbleTail
end
function createChatBubbleWithTail(filePrefix, position, size, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleTail = createChatBubbleTail(position, size)
chatBubbleTail.Parent = chatBubbleMain
return chatBubbleMain
end
function createScaledChatBubbleWithTail(filePrefix, frameScaleSize, position, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local frame = Instance.new("Frame")
frame.Name = "ChatBubbleTailFrame"
frame.BackgroundTransparency = 1
frame.SizeConstraint = Enum.SizeConstraint.RelativeXX
frame.Position = UDim2.new(0.5, 0, 1, 0)
frame.Size = UDim2.new(frameScaleSize, 0, frameScaleSize, 0)
frame.Parent = chatBubbleMain
local chatBubbleTail = createChatBubbleTail(position, UDim2.new(1, 0, 0.5, 0))
chatBubbleTail.Parent = frame
return chatBubbleMain
end
function createChatImposter(filePrefix, dotDotDot, yOffset)
local result = Instance.new("ImageLabel")
result.Name = "DialogPlaceholder"
result.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
result.BackgroundTransparency = 1
result.BorderSizePixel = 0
result.Position = UDim2.new(0, 0, -1.25, 0)
result.Size = UDim2.new(1, 0, 1, 0)
local image = Instance.new("ImageLabel")
image.Name = "DotDotDot"
image.Image = "rbxasset://textures/" .. tostring(dotDotDot) .. ".png"
image.BackgroundTransparency = 1
image.BorderSizePixel = 0
image.Position = UDim2.new(0.001, 0, yOffset, 0)
image.Size = UDim2.new(1, 0, 0.7, 0)
image.Parent = result
return result
end
local this = {}
this.ChatBubble = {}
this.ChatBubbleWithTail = {}
this.ScalingChatBubbleWithTail = {}
this.CharacterSortedMsg = createMap()
|
--
|
script.Parent.Handle3.Hinge1.Transparency = 0
script.Parent.Handle3.Interactive1.Transparency = 0
script.Parent.Handle3.Part1.Transparency = 0
script.Parent.Parent.Parent.Flushoo.FlushScript.Disabled = false
wait(0.06)
script.Parent.Handle1.Hinge1.Transparency = 1
script.Parent.Handle1.Interactive1.Transparency = 1
script.Parent.Handle1.Part1.Transparency = 1
|
-- FUNCTIONS --
|
return function(Action, ...)
local Args = {...}
if Action == "Splash" then
local TargetPosition = Args[1]
local WaterPart = Args[2]
local splashAttachment = Instance.new("Attachment")
splashAttachment.Parent = WaterPart
splashAttachment.WorldPosition = TargetPosition
game.Debris:AddItem(splashAttachment, 5)
coroutine.wrap(function()
for i, v in pairs(script.Splash:GetChildren()) do
if v:IsA("ParticleEmitter") then
local fx = v:Clone()
fx.Parent = splashAttachment
fx:Emit(fx:GetAttribute("EmitCount"))
end
end
end)()
end
end
|
--s.Pitch = 0.7
|
while s.Pitch<1 do
s.Pitch=s.Pitch+0.009
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.001)
end
|
--///////////////////////// Constructors
--//////////////////////////////////////
|
function module.new(vChatService, name)
local obj = setmetatable({}, methods)
obj.ChatService = vChatService
obj.PlayerObj = nil
obj.Name = name
obj.ExtraData = {}
obj.Channels = {}
obj.MutedSpeakers = {}
-- Make sure to destroy added binadable events in the InternalDestroy method.
obj.eDestroyed = Instance.new("BindableEvent")
obj.eSaidMessage = Instance.new("BindableEvent")
obj.eReceivedMessage = Instance.new("BindableEvent")
obj.eReceivedUnfilteredMessage = Instance.new("BindableEvent")
obj.eMessageDoneFiltering = Instance.new("BindableEvent")
obj.eReceivedSystemMessage = Instance.new("BindableEvent")
obj.eChannelJoined = Instance.new("BindableEvent")
obj.eChannelLeft = Instance.new("BindableEvent")
obj.eMuted = Instance.new("BindableEvent")
obj.eUnmuted = Instance.new("BindableEvent")
obj.eExtraDataUpdated = Instance.new("BindableEvent")
obj.eMainChannelSet = Instance.new("BindableEvent")
obj.eChannelNameColorUpdated = Instance.new("BindableEvent")
obj.Destroyed = obj.eDestroyed.Event
obj.SaidMessage = obj.eSaidMessage.Event
obj.ReceivedMessage = obj.eReceivedMessage.Event
obj.ReceivedUnfilteredMessage = obj.eReceivedUnfilteredMessage.Event
obj.MessageDoneFiltering = obj.eMessageDoneFiltering.Event
obj.ReceivedSystemMessage = obj.eReceivedSystemMessage.Event
obj.ChannelJoined = obj.eChannelJoined.Event
obj.ChannelLeft = obj.eChannelLeft.Event
obj.Muted = obj.eMuted.Event
obj.Unmuted = obj.eUnmuted.Event
obj.ExtraDataUpdated = obj.eExtraDataUpdated.Event
obj.MainChannelSet = obj.eMainChannelSet.Event
obj.ChannelNameColorUpdated = obj.eChannelNameColorUpdated.Event
--- DEPRECATED:
--- Mispelled version of ReceivedUnfilteredMessage, retained for compatibility with legacy versions.
obj.RecievedUnfilteredMessage = obj.eReceivedUnfilteredMessage.Event
return obj
end
return module
|
-- This backpack script doesn't support hopperbin because using :ToggleActive() will raise an error and its belong to corescript
| |
--{HPattern, Automatic, DualClutch, CVT}
|
tri = script.Trigger
if script.Parent.Functions.ShiftUpRequested.Value == true then
script.RPMManagement.Disabled = false
FL.MotorMaxTorque = 0
FR.MotorMaxTorque = 0
RL.MotorMaxTorque = 0
RR.MotorMaxTorque = 0
if script.Parent.Storage.TransmissionType.Value == "HPattern" then
end
if script.Parent.Storage.TransmissionType.Value == "Automatic" then
rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*xx1)*(tri.Value))
end
if script.Parent.Storage.TransmissionType.Value == "DualClutch" then
rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*xx1)*(tri.Value))
end
if script.Parent.Storage.TransmissionType.Value == "CVT" then
end
end
if currentgear.Value == 1 then
FL.MotorMaxTorque = (10000)*(carSeat.Storage.BrakeBias.Value/100)
FR.MotorMaxTorque = (10000)*(carSeat.Storage.BrakeBias.Value/100)
RL.MotorMaxTorque = (10000)*(1-(carSeat.Storage.BrakeBias.Value/100))
RR.MotorMaxTorque = (10000)*(1-(carSeat.Storage.BrakeBias.Value/100))
FL.AngularVelocity = 0
FR.AngularVelocity = 0
RL.AngularVelocity = 0
RR.AngularVelocity = 0
FL.MotorMaxAcceleration = 30
FR.MotorMaxAcceleration = 30
RL.MotorMaxAcceleration = 30
RR.MotorMaxAcceleration = 30
end
if script.Parent.Functions.ShiftDownRequested.Value == true then
script.RPMManagement.Disabled = false
if carSeat.Throttle ~= -1 and carSeat.Storage.Handbrake.Value ~= true then
FL.MotorMaxTorque = 0
FR.MotorMaxTorque = 0
RL.MotorMaxTorque = 0
RR.MotorMaxTorque = 0
end
if script.Parent.Storage.TransmissionType.Value == "HPattern" then
end
if script.Parent.Storage.TransmissionType.Value == "Automatic" then
rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*x1x)*(tri.Value))
end
if script.Parent.Storage.TransmissionType.Value == "DualClutch" then
rpm.Value = ((trans.Value*xxx)*(1-tri.Value)) + ((trans.Value*x1x)*(tri.Value))
end
if script.Parent.Storage.TransmissionType.Value == "CVT" then
end
end
if speed < 2 then
coast = 0
else
coast = 5
end
m = (hp.Value / 2155)
if rpm.Value < 950/(four/2) then
ch = 4
else
ch = 1
end
if carSeat.Storage.Mode.Value == "City" then
mode = 0.81
elseif carSeat.Storage.Mode.Value == "Sport" then
mode = 0.98
elseif carSeat.Storage.Mode.Value == "Snow" then
mode = 0.6
end
carSeat.Parent.Engine.Intake.Pitch = 1
|
--[[
deviation: the toStrictEqual matcher in Jest adds three features beyond
that of the toEqual matcher:
1) Checking for undefined properties
2) Checking array sparseness
3) Type checking
Of these, Jest-Roblox's version of the toStrictEqual matcher only
applies type checking
]]
|
local function toStrictEqual(
-- ROBLOX deviation: self param in Lua needs to be explicitely defined
self: MatcherState,
received: any,
expected: any
)
local matcherName = "toStrictEqual"
local options: MatcherHintOptions = {
comment = "deep equality",
isNot = self.isNot,
promise = self.promise,
}
local pass = equals(received, expected, toStrictEqualTesters, true)
local message
if pass then
message = function()
local retval = matcherHint(matcherName, nil, nil, options)
.. "\n\n"
.. string.format("Expected: not %s\n", printExpected(expected))
if stringify(expected) ~= stringify(received) then
retval = retval .. string.format("Received: %s", printReceived(received))
end
return retval
end
else
message = function()
return matcherHint(matcherName, nil, nil, options)
.. "\n\n"
.. printDiffOrStringify(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(self.expand))
end
end
-- Passing the actual and expected objects so that a custom reporter
-- could access them, for example in order to display a custom visual diff,
-- or create a different error message
return { actual = received, expected = expected, message = message, name = matcherName, pass = pass }
end
|
--Internal Settings--
|
local fullMag = 30
local spread = 1.1 -- in degrees
local fullauto = false -- shoots all bullets as long as the player is visible. turning this off reverts shooting mechanic back to the original marine mechanics (boolean)
local burstamount = 3 -- (only works if full auto is off) amount of times gun fires in burst fire mode
local firerate = 0.06 -- wait between shooting in seconds
local shotgunpellets = 1 -- setting this above 1 turns the gun into a shotgun (MIGHT LAG WITH FULL AUTO ON)
local delaybeforereloading = 0.3 -- to delay reload (prevents the marine from shooting the last shot of the mag at the ground)
local MinimumDamage,MaximumDamage = 9, 13 -- the amount of damage each bullet does (RANDOMIZED) first value is minimum, second value is maximum
local SemiAtLongRange = false -- restores the behaviour of the marine shooting in semi at long distances (i made this toggleable because i didnt like it)
local headshotmultiplier = 2 -- self explanitory (set this value to 1 if you dont want a multiplier)
local HitWallSounds = {"rbxassetid://6962153997","rbxassetid://6962154328","rbxassetid://6962154691","rbxassetid://6962155018","rbxassetid://6962155378"} -- basically sounds for hitting walls
local HitFleshSound = "rbxassetid://4988621968" -- plays when a creature gets shot
local bulletacceleration = Vector3.new(0,-12,0) -- very similar to how acceleration works in particle emitters (setting the y value to a negative number will give the bullet bulletdrop)
local maxdistance = 300
local bulletspeed = 400
|
--[[
Adds a Tween to be updated every render step.
]]
|
function TweenScheduler.add(tween: Tween)
allTweens[tween] = true
end
|
-- EasyConfiguration.lua
-- @author Quenty
-- Last Modified February 3rd, 2014
|
local Type = require(script.Parent:WaitForChild("Type"))
local lib = {}
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local AcceptableTypes = { -- Anything in here has a .Value property.
["StringValue"] = true;
["IntValue"] = true;
["NumberValue"] = true;
["BrickColorValue"] = true;
["BoolValue"] = true;
["Color3Value"] = true;
["Vector3Value"] = true;
["IntConstrainedValue"] = true;
}
local function TypeIsAcceptable(TypeName)
return AcceptableTypes[TypeName]
end
lib.TypeIsAcceptable = TypeIsAcceptable;
lib.typeIsAcceptable = TypeIsAcceptable
local function AddSubDataLayer(DataName, Parent)
-- For organization of data. Adds another configuration with the name "DataName", if one can't be found, and then returns it.
local DataContainer = Parent:FindFirstChild(DataName) or Make("Configuration", {
Name = DataName;
Parent = Parent;
Archivable = true;
})
return DataContainer
end
lib.AddSubDataLayer = AddSubDataLayer
lib.addSubDataLayer = AddSubDataLayer
local EasyConfigCache = {}
setmetatable(EasyConfigCache, {__mode = "k"})
local function MakeEasyConfiguration(Configuration)
if EasyConfigCache[Configuration] then
return EasyConfigCache[Configuration]
else
local NewConfiguration = {}
local function Get(ObjectName)
return Configuration:FindFirstChild(ObjectName)
end
setmetatable(NewConfiguration, {
__index = function(_, value)
if not type(value) == "string" then
error("Only Indexing with strings is supported with easyConfiguration", 2)
end
local loweredValue = value:lower()
if loweredValue == "add" or loweredValue == "addvalue" then
--[[
So they can do stuff like... Config.AddValue('IntValue', {
Name = "PizzaEaten"
Value = 0;
})
--]]
return function(valueType, values)
local Object
if values and values.Name and type(values.Name) == "string" then
Object = Get(values.Name)
if Object and Object.ClassName ~= valueType then
--print("[EasyConfiguration] - Invalid class '"..Object.ClassName.."' in configuration, being replaced by new data '"..valueType.."'");
Object:Destroy()
Object = nil;
end
else
error("[EasyConfiguration] - No values received in the add method of easy configuration. Please give a table of default properties including the name. ", 2)
end
if not Object then
local newInstance = Instance.new(valueType)
Modify(newInstance, values)
newInstance.Parent = Configuration
end
end
elseif loweredValue == "get" or loweredValue == "getvalue" then
return function(name)
return Get(name)
end
elseif loweredValue == "getcontainer" then
return function(name)
return Get(name)
end
else
local Object = Configuration:FindFirstChild(value)
if Object and AcceptableTypes[Object.ClassName] then
return Object.Value
else
error("[EasyConfiguration] - " .. (Object and "Object '"..value.."' was a "..Type.getType(Object).." value, and not acceptable, so no return was given" or "Could not find Object '"..value.."' in the configuration"), 2)
end
end
end;
__newindex = function(_, value, newValue)
if type(value) == "string" then
local Object = Get(value)
if Object and AcceptableTypes[Object.ClassName] then
Object.Value = newValue;
else
error("[EasyConfiguration] - Value '" .. value .. "' was not accepted, or wasn't in the configuration", 2);
end
else
error("[EasyConfiguration] - Index with a string")
end
end;
})
EasyConfigCache[Configuration] = NewConfiguration
return NewConfiguration;
end
end
lib.Make = MakeEasyConfiguration;
lib.MakeEasyConfiguration = MakeEasyConfiguration;
return lib
|
-- ROBLOX FIXME: Can we define ClientChatModules statically in the project config
|
pcall(function() ChatLocalization = require((game:GetService("Chat") :: any).ClientChatModules.ChatLocalization :: any) end)
if ChatLocalization == nil then ChatLocalization = {} end
if not ChatLocalization.FormatMessageToSend or not ChatLocalization.LocalizeFormattedMessage then
function ChatLocalization:FormatMessageToSend(key,default) return default end
end
local errorTextColor = ChatSettings.ErrorMessageTextColor or Color3.fromRGB(245, 50, 50)
local errorExtraData = {ChatColor = errorTextColor}
local function Run(ChatService)
local Players = game:GetService("Players")
local channel = ChatService:AddChannel("Team")
channel.WelcomeMessage = ChatLocalization:FormatMessageToSend("GameChat_TeamChat_WelcomeMessage","This is a private channel between you and your team members.")
channel.Joinable = false
channel.Leavable = false
channel.AutoJoin = false
channel.Private = true
local function TeamChatReplicationFunction(fromSpeaker, message, channelName)
local speakerObj = ChatService:GetSpeaker(fromSpeaker)
local channelObj = ChatService:GetChannel(channelName)
if (speakerObj and channelObj) then
local player = speakerObj:GetPlayer()
if (player) then
for i, speakerName in pairs(channelObj:GetSpeakerList()) do
local otherSpeaker = ChatService:GetSpeaker(speakerName)
if (otherSpeaker) then
local otherPlayer = otherSpeaker:GetPlayer()
if (otherPlayer) then
if (player.Team == otherPlayer.Team) then
local extraData = {
NameColor = player.TeamColor.Color,
ChatColor = player.TeamColor.Color,
ChannelColor = player.TeamColor.Color
}
otherSpeaker:SendMessage(message, channelName, fromSpeaker, extraData)
else
--// Could use this line to obfuscate message for cool effects
--otherSpeaker:SendMessage(message, channelName, fromSpeaker)
end
end
end
end
end
end
return true
end
channel:RegisterProcessCommandsFunction("replication_function", TeamChatReplicationFunction, ChatConstants.LowPriority)
local function DoTeamCommand(fromSpeaker, message, channel)
if message == nil then
message = ""
end
local speaker = ChatService:GetSpeaker(fromSpeaker)
if speaker then
local player = speaker:GetPlayer()
if player then
if player.Team == nil then
speaker:SendSystemMessage(ChatLocalization:FormatMessageToSend("GameChat_TeamChat_CannotTeamChatIfNotInTeam","You cannot team chat if you are not on a team!"), channel, errorExtraData)
return
end
local channelObj = ChatService:GetChannel("Team")
if channelObj then
if not speaker:IsInChannel(channelObj.Name) then
speaker:JoinChannel(channelObj.Name)
end
if message and string.len(message) > 0 then
speaker:SayMessage(message, channelObj.Name)
end
speaker:SetMainChannel(channelObj.Name)
end
end
end
end
local function TeamCommandsFunction(fromSpeaker, message, channel)
local processedCommand = false
if message == nil then
error("Message is nil")
end
if channel == "Team" then
return false
end
if string.sub(message, 1, 6):lower() == "/team " or message:lower() == "/team" then
DoTeamCommand(fromSpeaker, string.sub(message, 7), channel)
processedCommand = true
elseif string.sub(message, 1, 3):lower() == "/t " or message:lower() == "/t" then
DoTeamCommand(fromSpeaker, string.sub(message, 4), channel)
processedCommand = true
elseif string.sub(message, 1, 2):lower() == "% " or message:lower() == "%" then
DoTeamCommand(fromSpeaker, string.sub(message, 3), channel)
processedCommand = true
end
return processedCommand
end
ChatService:RegisterProcessCommandsFunction("team_commands", TeamCommandsFunction, ChatConstants.StandardPriority)
local function GetDefaultChannelNameColor()
if ChatSettings.DefaultChannelNameColor then
return ChatSettings.DefaultChannelNameColor
end
return Color3.fromRGB(35, 76, 142)
end
local function PutSpeakerInCorrectTeamChatState(speakerObj, playerObj)
if playerObj.Neutral or playerObj.Team == nil then
speakerObj:UpdateChannelNameColor(channel.Name, GetDefaultChannelNameColor())
if speakerObj:IsInChannel(channel.Name) then
speakerObj:LeaveChannel(channel.Name)
end
elseif not playerObj.Neutral and playerObj.Team then
speakerObj:UpdateChannelNameColor(channel.Name, playerObj.Team.TeamColor.Color)
if not speakerObj:IsInChannel(channel.Name) then
speakerObj:JoinChannel(channel.Name)
end
end
end
ChatService.SpeakerAdded:connect(function(speakerName)
local speakerObj = ChatService:GetSpeaker(speakerName)
if speakerObj then
local player = speakerObj:GetPlayer()
if player then
PutSpeakerInCorrectTeamChatState(speakerObj, player)
end
end
end)
local PlayerChangedConnections = {}
Players.PlayerAdded:connect(function(player)
local changedConn = player.Changed:connect(function(property)
local speakerObj = ChatService:GetSpeaker(player.Name)
if speakerObj then
if property == "Neutral" then
PutSpeakerInCorrectTeamChatState(speakerObj, player)
elseif property == "Team" then
PutSpeakerInCorrectTeamChatState(speakerObj, player)
if speakerObj:IsInChannel(channel.Name) then
local msg = ChatLocalization:FormatMessageToSend("GameChat_TeamChat_NowInTeam",
string.format("You are now on the '%s' team.", player.Team.Name),
"RBX_NAME",
player.Team.Name
)
speakerObj:SendSystemMessage(msg, channel.Name)
end
end
end
end)
PlayerChangedConnections[player] = changedConn
end)
Players.PlayerRemoving:connect(function(player)
local changedConn = PlayerChangedConnections[player]
if changedConn then
changedConn:Disconnect()
end
PlayerChangedConnections[player] = nil
end)
end
return Run
|
-- Represents the function to determine piercing and hitting.
|
export type CanPenetrateFunction = (ActiveCast, RaycastResult, Vector3) -> boolean
export type CanHitFunction = (ActiveCast, RaycastResult, Vector3) -> boolean
|
--[[Transmission]]
|
--
Tune.Clutch = true -- Implements a realistic clutch.
Tune.TransModes = {"Auto"} --[[
[Modes]
"Manual" ; Traditional clutch operated manual transmission
"DCT" ; Dual clutch transmission, where clutch is operated automatically
"Auto" ; Automatic transmission that shifts for you
>Include within brackets
eg: {"Manual"} or {"DCT", "Manual"}
>First mode is default mode ]]
--[[Transmission]]
Tune.ClutchType = "CVT" --[[
[Types]
"Clutch" : Standard clutch, recommended
"TorqueConverter" : Torque converter, keeps RPM up
"CVT" : CVT, found in scooters
]]
Tune.ClutchMode = "RPM" --[[
[Modes]
"Speed" : Speed controls clutch engagement
"RPM" : Speed and RPM control clutch engagement ]]
--Transmission Settings
Tune.Stall = true -- Stalling, enables the bike to stall. An ignition plugin would be necessary. Disables if Tune.Clutch is false.
Tune.ClutchEngage = 25 -- How fast engagement is (0 = instant, 99 = super slow)
--Torque Converter:
Tune.TQLock = true -- Torque converter starts locking at a certain RPM (see below if set to true)
--Torque Converter and CVT:
Tune.RPMEngage = 1500 -- Keeps RPMs to this level until passed
--Clutch:
Tune.SpeedEngage = 15 -- Speed the clutch fully engages at (Based on SPS)
--Clutch: "RPM" mode
Tune.ClutchRPMMult = 1.0 -- Clutch RPM multiplier, recommended to leave at 1.0
--Manual: Quick Shifter
Tune.QuickShifter = true -- To quickshift, cut off the throttle to upshift, and apply throttle to downshift, all without clutch.
Tune.QuickShiftTime = 0.25 -- Determines how much time you have to quick shift up or down before you need to use the clutch.
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoShiftType = "DCT" --[[
[Types]
"Rev" : Clutch engages fully once RPM reached
"DCT" : Clutch engages after a set time has passed ]]
Tune.AutoUpThresh = 200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Automatic: Revmatching
Tune.ShiftThrot = 100 -- Throttle level when shifting down to revmatch, 0 - 100%
--Automatic: DCT
Tune.ShiftUpTime = 0.25 -- Time required to shift into next gear, from a lower gear to a higher one.
Tune.ShiftDnTime = 0.125 -- Time required to shift into next gear, from a higher gear to a lower one.
Tune.FinalDrive = 0.81 -- (Final * Primary) -- Gearing determines top speed and wheel torque
-- for the final is recommended to divide the size of the rear sprocket to the one of the front sprocket
-- and multiply it to the primary drive ratio, if data is missing, you can also just use a single number
Tune.NeutralRev = true -- Enables you to back up manually in neutral
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 7.8 , -- Neutral and 1st gear are required
}
Tune.Limiter = true -- Enables a speed limiter
Tune.SpeedLimit = 140 -- At what speed (SPS) the limiter engages
|
-- Map Variables
|
local lobbySpawn = workspace:FindFirstChild("SpawnLocation")
|
-- ROBLOX deviation: Roblox Instance matchers
-- local instanceSubsetEquality = utils.instanceSubsetEquality
|
local makeThrowingMatcher, _validateResult
|
--[[Vehicle Weight]]
|
--Determine Current Mass
local mass=0
function getMass(p)
for i,v in pairs(p:GetChildren())do
if v:IsA("BasePart") then
mass=mass+v:GetMass()
end
getMass(v)
end
end
getMass(car)
--Apply Vehicle Weight
if mass<_Tune.Weight*weightScaling then
--Calculate Weight Distribution
local centerF = Vector3.new()
local centerR = Vector3.new()
local countF = 0
local countR = 0
for i,v in pairs(Drive) do
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
centerF = centerF+v.CFrame.p
countF = countF+1
else
centerR = centerR+v.CFrame.p
countR = countR+1
end
end
centerF = centerF/countF
centerR = centerR/countR
local center = centerR:Lerp(centerF, _Tune.WeightDist/100)
--Create Weight Brick
local weightB = Instance.new("Part",car.Body)
weightB.Name = "#Weight"
weightB.Anchored = true
weightB.CanCollide = false
weightB.BrickColor = BrickColor.new("Really black")
weightB.TopSurface = Enum.SurfaceType.Smooth
weightB.BottomSurface = Enum.SurfaceType.Smooth
if _Tune.WBVisible then
weightB.Transparency = .75
else
weightB.Transparency = 1
end
weightB.Size = Vector3.new(_Tune.WeightBSize[1],_Tune.WeightBSize[2],_Tune.WeightBSize[3])
weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0)
weightB.CFrame=(car.DriveSeat.CFrame-car.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0)
else
--Existing Weight Is Too Massive
end
local flipG = Instance.new("BodyGyro",car.DriveSeat)
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
|
------------------------------------------------------------------------
-- parses an expression in parentheses or a single variable
-- * used in primaryexp()
------------------------------------------------------------------------
|
function luaY:prefixexp(ls, v)
-- prefixexp -> NAME | '(' expr ')'
local c = ls.t.token
if c == "(" then
local line = ls.linenumber
luaX:next(ls)
self:expr(ls, v)
self:check_match(ls, ")", "(", line)
luaK:dischargevars(ls.fs, v)
elseif c == "TK_NAME" then
self:singlevar(ls, v)
else
luaX:syntaxerror(ls, "unexpected symbol")
end--if c
return
end
|
--muffins stuff
|
local DM = script.Parent:WaitForChild("DriveMode")
|
-- Calcule a velocidade linear média do carro com base na taxa em que todas as rodas estão girando
|
local function getAverageVelocity()
local vFR = -motorFR.Attachment1.WorldAxis:Dot(motorFR.Attachment1.Parent.RotVelocity)
local vRR = -motorBR.Attachment1.WorldAxis:Dot(motorBR.Attachment1.Parent.RotVelocity)
local vFL = motorFL.Attachment1.WorldAxis:Dot(motorFL.Attachment1.Parent.RotVelocity)
local vRL = motorBL.Attachment1.WorldAxis:Dot(motorBL.Attachment1.Parent.RotVelocity)
return 0.25 * ( vFR + vFL + vRR + vRL )
end
|
-- / Settings / --
|
local Settings = {
OnCD = false,
CDTime = 15
}
|
--PlayerClick
|
ClickDetector.MouseClick:Connect(function()
if Ready == true then
if Open == false then
Ready = false
Open = true
OpenSound:Play()
OpenTween:Play()
wait(.5)
Ready = true
elseif Open == true then
Ready = false
Open = false
CloseSound:Play()
CloseTween:Play()
wait(.5)
Ready = true
end
end
end)
|
--[[ icon_controller:header
## Functions
#### setGameTheme
```lua
IconController.setGameTheme(theme)
```
Sets the default theme which is applied to all existing and future icons.
----
#### setDisplayOrder
```lua
IconController.setDisplayOrder(number)
```
Changes the DisplayOrder of the TopbarPlus ScreenGui to the given value.
----
#### setTopbarEnabled
```lua
IconController.setTopbarEnabled(bool)
```
When set to ``false``, hides all icons created with TopbarPlus. This can also be achieved by calling ``starterGui:SetCore("TopbarEnabled", false)``.
----
#### setGap
```lua
IconController.setGap(integer, alignment)
```
Defines the offset width (i.e. gap) between each icon for the given alignment, ``left``, ``mid``, ``right``, or all alignments if not specified.
----
#### setLeftOffset
```lua
IconController.setLeftOffset(integer)
```
Defines the offset from the left side of the screen to the nearest left-set icon.
----
#### setRightOffset
```lua
IconController.setRightOffset(integer)
```
Defines the offset from the right side of the screen to the nearest right-set icon.
----
#### updateTopbar
```lua
IconController.updateTopbar()
```
Determines how icons should be positioned on the topbar and moves them accordingly.
----
#### clearIconOnSpawn
```lua
IconController.clearIconOnSpawn(icon)
```
Calls destroy on the given icon when the player respawns. This is useful for scenarious where you wish to cleanup icons that are constructed within a Gui with ``ResetOnSpawn`` set to ``true``. For example:
```lua
-- Place at the bottom of your icon creator localscript
local icons = IconController.getIcons()
for _, icon in pairs(icons) do
IconController.clearIconOnSpawn(icon)
end
```
----
#### getIcons
```lua
local arrayOfIcons = IconController.getIcons()
```
Returns all icons as an array.
----
#### getIcon
```lua
local icon = IconController.getIcon(name)
```
Returns the icon with the given name (or ``false`` if not found). If multiple icons have the same name, then one will be returned randomly.
----
## Properties
#### mimicCoreGui
```lua
local bool = IconController.mimicCoreGui --[default: 'true']
```
Set to ``false`` to have the topbar persist even when ``game:GetService("StarterGui"):SetCore("TopbarEnabled", false)`` is called.
----
#### controllerModeEnabled
{read-only}
```lua
local bool = IconController.controllerModeEnabled
```
----
#### leftGap
{read-only}
```lua
local gapNumber = IconController.leftGap --[default: '12']
```
----
#### midGap
{read-only}
```lua
local gapNumber = IconController.midGap --[default: '12']
```
----
#### rightGap
{read-only}
```lua
local gapNumber = IconController.rightGap --[default: '12']
```
----
#### leftOffset
{read-only}
```lua
local offset = IconController.leftGap --[default: '0']
```
----
#### rightOffset
{read-only}
```lua
local offset = IconController.rightGap --[default: '0']
```
--]]
| |
-- Torso
|
character.UpperTorso.Material = Material
character.LowerTorso.Material = Material
character.HumanoidRootPart.Material = Material
character.Head.Material = Material
|
-- Container for temporary connections (disconnected automatically)
|
local Connections = {};
function PaintTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
BindShortcutKeys();
EnableClickPainting();
end;
function PaintTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
ClearConnections();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if PaintTool.UI then
-- Reveal the UI
PaintTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
PaintTool.UI = Core.Tool.Interfaces.BTPaintToolGUI:Clone();
PaintTool.UI.Parent = Core.UI;
PaintTool.UI.Visible = true;
-- Track palette buttons
PaletteButtons = {};
-- Enable the palette
for _, Column in pairs(PaintTool.UI.Palette:GetChildren()) do
for _, Button in pairs(Column:GetChildren()) do
if Button.ClassName == 'TextButton' then
-- Recolor the selection when the button is clicked
Button.MouseButton1Click:connect(function ()
SetColor(BrickColor.new(Button.Name).Color);
end);
-- Register the button
PaletteButtons[Button.Name] = Button;
end;
end;
end;
-- Paint selection when current color indicator is clicked
PaintTool.UI.Controls.LastColorButton.MouseButton1Click:connect(PaintParts);
-- Enable color picker button
PaintTool.UI.Controls.ColorPickerButton.MouseButton1Click:connect(function ()
Core.Cheer(Core.Tool.Interfaces.BTHSVColorPicker, Core.UI).Start(
Support.IdentifyCommonProperty(Selection.Items, 'Color') or Color3.new(1, 1, 1),
SetColor,
Core.Targeting.CancelSelecting,
PreviewColor
);
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not PaintTool.UI then
return;
end;
-- Hide the UI
PaintTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not PaintTool.UI then
return;
end;
-----------------------------------------
-- Update the color information indicator
-----------------------------------------
-- Clear old color indicators
for Color, Button in pairs(PaletteButtons) do
Button.Text = '';
end;
-- Indicate the variety of colors in the selection
for _, Part in pairs(Selection.Items) do
if PaletteButtons[Part.BrickColor.Name] and Part.Color == Part.BrickColor.Color then
PaletteButtons[Part.BrickColor.Name].Text = '+';
end;
end;
-- Update the color picker button's background
local CommonColor = Support.IdentifyCommonProperty(Selection.Items, 'Color');
PaintTool.UI.Controls.ColorPickerButton.ImageColor3 = CommonColor or PaintTool.BrickColor or Color3.new(1, 0, 0);
end;
function SetColor(Color)
-- Changes the color option to `Color`
-- Set the color option
PaintTool.BrickColor = Color;
-- Use BrickColor name if color matches one
local EquivalentBrickColor = BrickColor.new(Color);
local RGBText = ('(%d, %d, %d)'):format(Color.r * 255, Color.g * 255, Color.b * 255);
local ColorText = (EquivalentBrickColor.Color == Color) and EquivalentBrickColor.Name or RGBText;
-- Shortcuts to color indicators
local ColorLabel = PaintTool.UI.Controls.LastColorButton.ColorName;
local ColorSquare = ColorLabel.ColorSquare;
-- Update the indicators
ColorLabel.Visible = true;
ColorLabel.Text = ColorText;
ColorSquare.BackgroundColor3 = Color;
ColorSquare.Position = UDim2.new(1, -ColorLabel.TextBounds.X - 18, 0.2, 1);
-- Paint currently selected parts
PaintParts();
end;
function PaintParts()
-- Recolors the selection with the selected color
-- Make sure a color has been selected
if not PaintTool.BrickColor then
return;
end;
-- Track changes
TrackChange();
-- Change the color of the parts locally
for _, Part in pairs(Selection.Items) do
Part.Color = PaintTool.BrickColor;
-- Allow part coloring for unions
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = true;
end;
end;
-- Register changes
RegisterChange();
end;
function PreviewColor(Color)
-- Previews the given color on the selection
-- Reset colors to initial state if previewing is over
if not Color and InitialState then
for Part, State in pairs(InitialState) do
-- Reset part color
Part.Color = State.Color;
-- Update union coloring options
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = State.UsePartColor;
end;
end;
-- Clear initial state
InitialState = nil;
-- Skip rest of function
return;
-- Ensure valid color is given
elseif not Color then
return;
-- Save initial state if first time previewing
elseif not InitialState then
InitialState = {};
for _, Part in pairs(Selection.Items) do
InitialState[Part] = { Color = Part.Color, UsePartColor = (Part.ClassName == 'UnionOperation') and Part.UsePartColor or nil };
end;
end;
-- Apply preview color
for _, Part in pairs(Selection.Items) do
Part.Color = Color;
-- Enable union coloring
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = true;
end;
end;
end;
function BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
table.insert(Connections, UserInputService.InputBegan:connect(function (InputInfo, GameProcessedEvent)
-- Make sure this is an intentional event
if GameProcessedEvent then
return;
end;
-- Make sure this input is a key press
if InputInfo.UserInputType ~= Enum.UserInputType.Keyboard then
return;
end;
-- Make sure it wasn't pressed while typing
if UserInputService:GetFocusedTextBox() then
return;
end;
-- Check if the enter key was pressed
if InputInfo.KeyCode == Enum.KeyCode.Return or InputInfo.KeyCode == Enum.KeyCode.KeypadEnter then
-- Paint the selection with the current color
PaintParts();
end;
-- Check if the R key was pressed, and it wasn't the selection clearing hotkey
if InputInfo.KeyCode == Enum.KeyCode.R and not Selection.Multiselecting then
-- Set the current color to that of the current mouse target (if any)
if Core.Mouse.Target then
SetColor(Core.Mouse.Target.Color);
end;
end;
end));
end;
function EnableClickPainting()
-- Allows the player to paint parts by clicking on them
-- Watch out for clicks on selected parts
Connections.ClickPainting = Selection.FocusChanged:connect(function (Part)
if Selection.IsSelected(Core.Mouse.Target) then
-- Paint the selected parts
PaintParts();
end;
end);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Parts = Support.CloneTable(Selection.Items);
BeforeColor = {};
BeforeUnionColoring = {};
AfterColor = {};
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Color = Record.BeforeColor[Part], UnionColoring = Record.BeforeUnionColoring[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncColor', Changes);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Parts);
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Color = Record.AfterColor[Part], UnionColoring = true });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncColor', Changes);
end;
};
-- Collect the selection's initial state
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.BeforeColor[Part] = Part.Color;
-- If this part is a union, collect its UsePartColor state
if Part.ClassName == 'UnionOperation' then
HistoryRecord.BeforeUnionColoring[Part] = Part.UsePartColor;
end;
end;
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Collect the selection's final state
local Changes = {};
for _, Part in pairs(HistoryRecord.Parts) do
HistoryRecord.AfterColor[Part] = Part.Color;
table.insert(Changes, { Part = Part, Color = Part.Color, UnionColoring = true });
end;
-- Send the change to the server
Core.SyncAPI:Invoke('SyncColor', Changes);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
--end)
|
task.spawn(function()
while true do
if Dead then
break
end
AI()
local n,mag,hum=near()
if n and not Dead then
n=n.p
if not r then
w=.14
local dir=h.Position-n
local tst ,_ =workspace:FindPartOnRay(Ray.new(t.Torso.Position,(n-t.Torso.Position).Unit*999),t)
if tst and not Dead then
local FoundHuman,VitimaHuman = CheckForHumanoid(tst)
if FoundHuman == true and VitimaHuman.Health > 0 and game.Players:GetPlayerFromCharacter(VitimaHuman.Parent) and perception < 10 then
perception = perception + Settings.Level.Value
t.Humanoid.WalkSpeed = SearchingWalkspeed
Memory = Settings.Level.Value * 100
CanSee = true
elseif perception > 0 then
perception = perception - 1/Settings.Level.Value * 2
t.Humanoid.WalkSpeed = SearchingWalkspeed
CanSee = false
elseif perception <= 0 then
perception = 0
t.Humanoid.WalkSpeed = RegularWalkspeed
Memory = Memory - .25
end
--print(Memory)
end
task.wait(5)
end
end
end
end)
|
-- When tool deselected
|
function onDeselected(mouse)
myMouse = nil
end
|
-- / Functions / --
|
RoundModule.StartRound = function(Gamemode)
local GamemodeModule = require(script:WaitForChild(Gamemode))
GamemodeModule.ApplyGamemode()
end
|
-- Function to turn particles on or off
|
local function ConfigWater()
for _,v in pairs(Emitters:GetChildren()) do
if v and v:FindFirstChild("Emit1") then
v:FindFirstChild("Emit1").Enabled = IsOn.Value
end
if v and v:FindFirstChild("Emit2") then
v:FindFirstChild("Emit2").Enabled = IsOn.Value
end
end
if ShouldEmitSound.Value and IsOn.Value then
WaterLoop:Play()
TweenVolume(WaterLoop.Volume,MaxVolume.Value,2.5,false)
elseif not IsOn.Value or not ShouldEmitSound.Value then
TweenVolume(MaxVolume.Value,0,2.9,true)
end
end
|
--[[ FUNCTIONS ]]
|
local function lerpLength(msg, min, max)
return min + (max-min) * math.min(getMessageLength(msg)/75.0, 1.0)
end
local function createFifo()
local this = {}
this.data = {}
local emptyEvent = Instance.new("BindableEvent")
this.Emptied = emptyEvent.Event
function this:Size()
return #this.data
end
function this:Empty()
return this:Size() <= 0
end
function this:PopFront()
table.remove(this.data, 1)
if this:Empty() then emptyEvent:Fire() end
end
function this:Front()
return this.data[1]
end
function this:Get(index)
return this.data[index]
end
function this:PushBack(value)
table.insert(this.data, value)
end
function this:GetData()
return this.data
end
return this
end
local function createCharacterChats()
local this = {}
this.Fifo = createFifo()
this.BillboardGui = nil
return this
end
local function createMap()
local this = {}
this.data = {}
local count = 0
function this:Size()
return count
end
function this:Erase(key)
if this.data[key] then count = count - 1 end
this.data[key] = nil
end
function this:Set(key, value)
this.data[key] = value
if value then count = count + 1 end
end
function this:Get(key)
if not key then return end
if not this.data[key] then
this.data[key] = createCharacterChats()
local emptiedCon = nil
emptiedCon = this.data[key].Fifo.Emptied:connect(function()
emptiedCon:disconnect()
this:Erase(key)
end)
end
return this.data[key]
end
function this:GetData()
return this.data
end
return this
end
local function createChatLine(message, bubbleColor, isLocalPlayer)
local this = {}
function this:ComputeBubbleLifetime(msg, isSelf)
if isSelf then
return lerpLength(msg,8,15)
else
return lerpLength(msg,12,20)
end
end
this.Origin = nil
this.RenderBubble = nil
this.Message = message
this.BubbleDieDelay = this:ComputeBubbleLifetime(message, isLocalPlayer)
this.BubbleColor = bubbleColor
this.IsLocalPlayer = isLocalPlayer
return this
end
local function createPlayerChatLine(player, message, isLocalPlayer)
local this = createChatLine(message, BubbleColor.WHITE, isLocalPlayer)
if player then
this.User = player.Name
this.Origin = player.Character
end
return this
end
local function createGameChatLine(origin, message, isLocalPlayer, bubbleColor)
local this = createChatLine(message, bubbleColor, isLocalPlayer)
this.Origin = origin
return this
end
function createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleMain = Instance.new("ImageLabel")
chatBubbleMain.Name = "ChatBubble"
chatBubbleMain.ScaleType = Enum.ScaleType.Slice
chatBubbleMain.SliceCenter = sliceRect
chatBubbleMain.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
chatBubbleMain.BackgroundTransparency = 1
chatBubbleMain.BorderSizePixel = 0
chatBubbleMain.Size = UDim2.new(1.0, 0, 1.0, 0)
chatBubbleMain.Position = UDim2.new(0,0,0,0)
return chatBubbleMain
end
function createChatBubbleTail(position, size)
local chatBubbleTail = Instance.new("ImageLabel")
chatBubbleTail.Name = "ChatBubbleTail"
chatBubbleTail.Image = "rbxasset://textures/ui/dialog_tail.png"
chatBubbleTail.BackgroundTransparency = 1
chatBubbleTail.BorderSizePixel = 0
chatBubbleTail.Position = position
chatBubbleTail.Size = size
return chatBubbleTail
end
function createChatBubbleWithTail(filePrefix, position, size, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleTail = createChatBubbleTail(position, size)
chatBubbleTail.Parent = chatBubbleMain
return chatBubbleMain
end
function createScaledChatBubbleWithTail(filePrefix, frameScaleSize, position, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local frame = Instance.new("Frame")
frame.Name = "ChatBubbleTailFrame"
frame.BackgroundTransparency = 1
frame.SizeConstraint = Enum.SizeConstraint.RelativeXX
frame.Position = UDim2.new(0.5, 0, 1, 0)
frame.Size = UDim2.new(frameScaleSize, 0, frameScaleSize, 0)
frame.Parent = chatBubbleMain
local chatBubbleTail = createChatBubbleTail(position, UDim2.new(1,0,0.5,0))
chatBubbleTail.Parent = frame
return chatBubbleMain
end
function createChatImposter(filePrefix, dotDotDot, yOffset)
local result = Instance.new("ImageLabel")
result.Name = "DialogPlaceholder"
result.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
result.BackgroundTransparency = 1
result.BorderSizePixel = 0
result.Position = UDim2.new(0, 0, -1.25, 0)
result.Size = UDim2.new(1, 0, 1, 0)
local image = Instance.new("ImageLabel")
image.Name = "DotDotDot"
image.Image = "rbxasset://textures/" .. tostring(dotDotDot) .. ".png"
image.BackgroundTransparency = 1
image.BorderSizePixel = 0
image.Position = UDim2.new(0.001, 0, yOffset, 0)
image.Size = UDim2.new(1, 0, 0.7, 0)
image.Parent = result
return result
end
local this = {}
this.ChatBubble = {}
this.ChatBubbleWithTail = {}
this.ScalingChatBubbleWithTail = {}
this.CharacterSortedMsg = createMap()
|
--Made by Stickmasterluke
|
local sp=script.Parent
damage=40
cooldown=.30
debris=game:GetService("Debris")
check=true
function waitfor(parent,name)
while true do
local child=parent:FindFirstChild(name)
if child~=nil then
return child
end
wait()
end
end
local handle=waitfor(sp,"Handle")
local debris=game:GetService("Debris")
function randomcolor()
if handle then
local m=handle:FindFirstChild("Mesh")
if m~=nil then
m.VertexColor=Vector3.new(math.random(1,2),math.random(1,2),math.random(1,2))*.5
end
end
end
function onButton1Down(mouse)
if check then
check=false
mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
local h=sp.Parent:FindFirstChild("Humanoid")
local t=sp.Parent:FindFirstChild("Torso")
local anim=sp:FindFirstChild("RightSlash")
if anim and t and h then
theanim=h:LoadAnimation(anim)
theanim:Play(nil,nil,1.5)
if theanim and h.Health>0 then
local sound=sp.Handle:FindFirstChild("SlashSound")
if sound then
sound:Play()
end
wait(.25)
handle.Transparency=1
local p=handle:clone()
p.Name="Effect"
p.CanCollide=false
p.Transparency=1
p.Script.Disabled=false
local tag=Instance.new("ObjectValue")
tag.Name="creator"
tag.Value=h
tag.Parent=p
p.RotVelocity=Vector3.new(0,0,0)
p.Velocity=(mouse.Hit.p-p.Position).unit*400+Vector3.new(0,0,0)
p.CFrame=CFrame.new(handle.Position,mouse.Hit.p)*CFrame.Angles(-math.pi/2,0,0)
debris:AddItem(p,20+math.random()*5)
p.Parent=game.Workspace
end
end
wait(cooldown-.25)
mouse.Icon="rbxasset://textures\\GunCursor.png"
randomcolor()
handle.Transparency=1
check=true
end
end
sp.Equipped:connect(function(mouse)
if mouse==nil then
print("Mouse not found")
return
end
equipped=true
mouse.Icon="rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
onButton1Down(mouse)
end)
end)
sp.Unequipped:connect(function()
equipped=false
handle.Transparency=1
randomcolor()
end)
|
-----------------------------------------ONLY EDIT THESE VALUES!!!!!-----------------------------------------
-----!Instructions!-----
--Make sure you have a part in the gun named Barrel, it is where the raycast will shoot from.--
--Just place this script into any gun and edit the values below.--
--Editting anything else will risk breaking it.--
------------------------
|
Damage = 18
SPS = 16 -- Shots Per Second, gives a limit of how fast the gun shoots.
Recoil = 6 -- [1-10] [1 = Minigun, 10 = Sniper]
WallShoot = false -- Shoots through walls.
GH = false -- [True = RB can't hurt RB.] [False = RB can hurt RB.]
BulletColor = "Cool yellow" -- Any Brickcolor will work.
Flash = true
|
--[=[
@private
@class LoaderUtils
]=]
|
local loader = script.Parent
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local GroupInfoUtils = require(script.Parent.GroupInfoUtils)
local PackageInfoUtils = require(script.Parent.PackageInfoUtils)
local ScriptInfoUtils = require(script.Parent.ScriptInfoUtils)
local Utils = require(script.Parent.Utils)
local LoaderUtils = {}
LoaderUtils.Utils = Utils -- TODO: Remove this
LoaderUtils.ContextTypes = Utils.readonly({
CLIENT = "client";
SERVER = "server";
})
LoaderUtils.IncludeBehavior = Utils.readonly({
NO_INCLUDE = "noInclude";
INCLUDE_ONLY = "includeOnly";
INCLUDE_SHARED = "includeShared";
})
function LoaderUtils.toWallyFormat(instance)
assert(typeof(instance) == "Instance", "Bad instance")
local topLevelPackages = {}
LoaderUtils.discoverTopLevelPackages(topLevelPackages, instance)
LoaderUtils.injectLoader(topLevelPackages)
local packageInfoList = {}
local packageInfoMap = {}
for _, folder in pairs(topLevelPackages) do
local packageInfo = PackageInfoUtils.getOrCreatePackageInfo(folder, packageInfoMap, "")
table.insert(packageInfoList, packageInfo)
end
PackageInfoUtils.fillDependencySet(packageInfoList)
local clientGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.CLIENT)
local serverGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.SERVER)
local sharedGroupList = GroupInfoUtils.groupPackageInfos(packageInfoList,
ScriptInfoUtils.ModuleReplicationTypes.SHARED)
local publishSet = LoaderUtils.getPublishPackageInfoSet(packageInfoList)
local clientFolder = Instance.new("Folder")
clientFolder.Name = "Packages"
local sharedFolder = Instance.new("Folder")
sharedFolder.Name = "SharedPackages"
local serverFolder = Instance.new("Folder")
serverFolder.Name = "Packages"
LoaderUtils.reifyGroupList(clientGroupList, publishSet, clientFolder, ScriptInfoUtils.ModuleReplicationTypes.CLIENT)
LoaderUtils.reifyGroupList(serverGroupList, publishSet, serverFolder, ScriptInfoUtils.ModuleReplicationTypes.SERVER)
LoaderUtils.reifyGroupList(sharedGroupList, publishSet, sharedFolder, ScriptInfoUtils.ModuleReplicationTypes.SHARED)
return clientFolder, serverFolder, sharedFolder
end
function LoaderUtils.isPackage(folder)
assert(typeof(folder) == "Instance", "Bad instance")
for _, item in pairs(folder:GetChildren()) do
if item:IsA("Folder") then
if item.Name == "Server"
or item.Name == "Client"
or item.Name == "Shared"
or item.Name == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
return true
end
end
end
return false
end
function LoaderUtils.injectLoader(topLevelPackages)
for _, item in pairs(topLevelPackages) do
-- If we're underneath the hierachy or if we're in the actual item...
if item == loader or loader:IsDescendantOf(item) then
return
end
end
-- We need the loader injected!
table.insert(topLevelPackages, loader)
end
function LoaderUtils.discoverTopLevelPackages(packages, instance)
assert(type(packages) == "table", "Bad packages")
assert(typeof(instance) == "Instance", "Bad instance")
if LoaderUtils.isPackage(instance) then
table.insert(packages, instance)
else
-- Loop through all folders
for _, item in pairs(instance:GetChildren()) do
if item:IsA("Folder") then
LoaderUtils.discoverTopLevelPackages(packages, item)
elseif item:IsA("ModuleScript") then
table.insert(packages, item)
end
end
end
end
function LoaderUtils.reifyGroupList(groupInfoList, publishSet, parent, replicationMode)
assert(type(groupInfoList) == "table", "Bad groupInfoList")
assert(type(publishSet) == "table", "Bad publishSet")
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(replicationMode) == "string", "Bad replicationMode")
local folder = Instance.new("Folder")
folder.Name = "_Index"
for _, groupInfo in pairs(groupInfoList) do
if LoaderUtils.needToReify(groupInfo, replicationMode) then
LoaderUtils.reifyGroup(groupInfo, folder, replicationMode)
end
end
-- Publish
for packageInfo, _ in pairs(publishSet) do
for scriptName, scriptInfo in pairs(packageInfo.scriptInfoLookup[replicationMode]) do
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = parent
end
end
folder.Parent = parent
end
function LoaderUtils.getPublishPackageInfoSet(packageInfoList)
local packageInfoSet = {}
for _, packageInfo in pairs(packageInfoList) do
packageInfoSet[packageInfo] = true
-- First level declared dependencies too (assuming we're importing just one item)
for dependentPackageInfo, _ in pairs(packageInfo.explicitDependencySet) do
packageInfoSet[dependentPackageInfo] = true
end
end
return packageInfoSet
end
function LoaderUtils.needToReify(groupInfo, replicationMode)
for _, scriptInfo in pairs(groupInfo.packageScriptInfoMap) do
if scriptInfo.replicationMode == replicationMode then
return true
end
end
return false
end
function LoaderUtils.reifyGroup(groupInfo, parent, replicationMode)
assert(type(groupInfo) == "table", "Bad groupInfo")
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(replicationMode) == "string", "Bad replicationMode")
local folder = Instance.new("Folder")
folder.Name = assert(next(groupInfo.packageSet).fullName, "Bad package fullName")
for scriptName, scriptInfo in pairs(groupInfo.packageScriptInfoMap) do
assert(scriptInfo.name == scriptName, "Bad scriptInfo.name")
if scriptInfo.replicationMode == replicationMode then
if scriptInfo.instance == loader and loader.Parent == game:GetService("ReplicatedStorage") then
-- Hack to prevent reparenting of loader in legacy mode
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
scriptInfo.instance.Name = scriptName
scriptInfo.instance.Parent = folder
end
else
if scriptInfo.instance == loader then
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
-- Turns out creating these links are a LOT faster than cloning a module script
local link = BounceTemplateUtils.createLink(scriptInfo.instance, scriptName)
link.Parent = folder
end
end
end
-- Link all of the other dependencies
for scriptName, scriptInfo in pairs(groupInfo.scriptInfoMap) do
assert(scriptInfo.name == scriptName, "Bad scriptInfo.name")
if not groupInfo.packageScriptInfoMap[scriptName] then
if scriptInfo.instance == loader then
local link = BounceTemplateUtils.create(scriptInfo.instance, scriptName)
link.Parent = folder
else
-- Turns out creating these links are a LOT faster than cloning a module script
local link = BounceTemplateUtils.createLink(scriptInfo.instance, scriptName)
link.Parent = folder
end
end
end
folder.Parent = parent
end
return LoaderUtils
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
plrData.Money.Gold.Value = plrData.Money.Gold.Value - 100
plrData.Classes.Base.Smasher.Obtained.Value = true
plrData.Classes.Base.Smasher.HammerShatterAbility.Value = true
end
|
--//Settings\--
|
local Save_Wait_Time = 60
local Auto_Save = true
local Save_On_Leave = true
function onPlayerEntered(newPlayer)
local datafolder = Instance.new("Folder")
datafolder.Parent = DataFolder
datafolder.Name = newPlayer.UserId
local DataValue = DataFolder.Data:clone()
DataValue.Parent = DataFolder[newPlayer.UserId]
local Data = DataValue:GetChildren()
local DataTable = {}
for i=1,#Data do
local n = Data[i].Name
DataTable[n] = Data[i].Value
end
--GetData--
local DataStore = DataStoreService:GetDataStore(newPlayer.userId)
if DataStore:GetAsync("Save") == nil then
local succeed, errormsg = pcall(function()
DataStore:SetAsync("Save", DataTable)
end)
if succeed then
print("Data saved correctly")
else
print("Error: ".. errormsg)
end
end
local succeed, errormsg = pcall(function()
DataTable = DataStore:GetAsync("Save")
end)
if succeed then
print("Data received correctly")
else
print("Error: ".. errormsg)
end
--LoadData--
local DataToLoad = DataValue:GetChildren()
for i=1,#DataToLoad do
local n = DataToLoad[i].Name
if DataTable[n] ~= nil then
DataToLoad[i].Value = DataTable[n]
end
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)
if Save_On_Leave then
game.Players.PlayerRemoving:connect(function(Player)
--SaveData--
local DataStore = DataStoreService:GetDataStore(Player.userId)
local Data = DataFolder[Player.UserId].Data:GetChildren()
local DataTable = {}
for i=1,#Data do
local n = Data[i].Name
DataTable[n] = Data[i].Value
end
local succeed, errormsg = pcall(function()
DataStore:SetAsync("Save", DataTable)
end)
if succeed then
print("Data saved correctly")
else
print("Error: ".. errormsg)
end
DataFolder[Player.UserId]:Destroy()
end)
end
local DataSaveTable = {}
if Auto_Save == true then
while wait(1) do
for _, Player in pairs(game.Players:GetPlayers()) do
if not DataSaveTable[Player] then
DataSaveTable[Player] = tick()
elseif tick() - DataSaveTable[Player] >= Save_Wait_Time then
print("Saved")
DataSaveTable[Player] = tick()
local DataStore = DataStoreService:GetDataStore(Player.userId)
local Data = DataFolder[Player.UserId].Data:GetChildren()
local DataTable = {}
for i=1,#Data do
local n = Data[i].Name
DataTable[n] = Data[i].Value
end
local succeed, errormsg = pcall(function()
DataStore:SetAsync("Save", DataTable)
end)
if succeed then
print("Data saved correctly")
else
print("Error: "..errormsg)
end
end
end
end
end
|
--[[Steering]]
|
function Steering(dt)
local deltaTime = (60/(1/dt))
--Mouse Steer
if _MSteer then
local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
local mdZone = _Tune.Peripherals.MSteerDZone/100
local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
if math.abs(mST)<=mdZone then
_GSteerT = 0
else
_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
end
end
_GSteerC = (_GSteerC+((_GSteerT-_GSteerC)*(_Tune.LeanSpeed*deltaTime)))
--Apply Steering
bike.Body.bal.LeanGyro.cframe = CFrame.new(bike.Body.bal.CFrame.p,bike.Body.bal.CFrame.p+bike.Body.bal.CFrame.lookVector)*CFrame.Angles(0,0,((_GSteerC*_Tune.LeanProgressiveness)*(math.rad(_Tune.MaxLean)/(bike.DriveSeat.Velocity.Magnitude+_Tune.LeanProgressiveness))-(_GSteerC*math.rad(_Tune.MaxLean))))
--Apply Low Speed Steering
bike.FrontSection.TripleTreeHinge.SteeringGyro.CFrame=bike.Body.SteeringHinge.CFrame*CFrame.Angles(math.rad(_GSteerT*_Tune.SteerAngle),0,0)
bike.FrontSection.TripleTreeHinge.SteeringGyro.MaxTorque = Vector3.new(_Tune.SteerMaxTorque*((math.max((_Tune.LowSpeedCut-bike.DriveSeat.Velocity.Magnitude)/_Tune.LowSpeedCut,0))^2),0,0)
end
|
--[[
TweenSequence Editor Animator
]]
|
local TweenSequenceUtils = script.Parent
local Track = require(TweenSequenceUtils.Track)
local Animator = {}
function Animator.new(tweens, root)
local newAnimator = {}
for _, tween in pairs(tweens:GetChildren()) do
local tweenTable = require(tween)
newAnimator[tween.Name] = Track.new(root, tweenTable, tween)
end
function newAnimator:SetOrigin(origin)
for _, animation in pairs(newAnimator) do
if type(animation) == "table" then
animation:SetOrigin(origin)
end
end
end
function newAnimator.StopAll()
for _, animation in pairs(newAnimator) do
if type(animation) == "table" then
animation:Stop()
end
end
end
return newAnimator
end
return Animator
|
--[[
function moveupL1()
local amount = A
local current = 0
MoverL1.TargetPosition = 0.076
repeat
current = current + amount/B
script.Parent.LowToneSolenoid.MovingParts.Spring.Size = script.Parent.LowToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,(amount/B)*C)
local lv = script.Parent.LowToneSolenoid.MovingParts.Spring.CFrame.LookVector
script.Parent.LowToneSolenoid.MovingParts:TranslateBy(lv*-amount/B)
game:GetService("RunService").Heartbeat:wait()
until current >= A
end
function movebackL1()
local amount = A
local current = 0
MoverL1.TargetPosition = 0
repeat
current = current + amount/B
script.Parent.LowToneSolenoid.MovingParts.Spring.Size = script.Parent.LowToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,-(amount/B)*C)
local lv = script.Parent.LowToneSolenoid.MovingParts.Spring.CFrame.LookVector
script.Parent.LowToneSolenoid.MovingParts:TranslateBy(lv*amount/B)
game:GetService("RunService").Heartbeat:wait()
until current >= A
end
function moveupL2()
local amount = A
local current = 0
MoverL2.TargetPosition = 0.076
repeat
current = current + amount/B
script.Parent.HighToneSolenoid.MovingParts.Spring.Size = script.Parent.HighToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,(amount/B)*C)
local lv = script.Parent.HighToneSolenoid.MovingParts.Spring.CFrame.LookVector
script.Parent.HighToneSolenoid.MovingParts:TranslateBy(lv*-amount/B)
game:GetService("RunService").Heartbeat:wait()
until current >= A
end
function movebackL2()
local amount = A
local current = 0
MoverL2.TargetPosition = 0
repeat
current = current + amount/B
script.Parent.HighToneSolenoid.MovingParts.Spring.Size = script.Parent.HighToneSolenoid.MovingParts.Spring.Size + Vector3.new(0,0,-(amount/B)*C)
local lv = script.Parent.HighToneSolenoid.MovingParts.Spring.CFrame.LookVector
script.Parent.HighToneSolenoid.MovingParts:TranslateBy(lv*amount/B)
game:GetService("RunService").Heartbeat:wait()
until current >= A
end
]]
|
script.Parent.L2:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.L2.Value == true then
--moveupL2()
script.Parent.HighToneSolenoid.ShutterPartClosed.Shutter.Transparency = 0
script.Parent.HighToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 0
script.Parent.HighToneSolenoid.ShutterPartClosed.Spring.Transparency = 0
script.Parent.HighToneSolenoid.ShutterPartOpened.Shutter.Transparency = 1
script.Parent.HighToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 1
script.Parent.HighToneSolenoid.ShutterPartOpened.Spring.Transparency = 1
SolenoidSound1.Volume = 0.09
SolenoidSound1:Play()
else
--movebackL2()
script.Parent.HighToneSolenoid.ShutterPartClosed.Shutter.Transparency = 1
script.Parent.HighToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 1
script.Parent.HighToneSolenoid.ShutterPartClosed.Spring.Transparency = 1
script.Parent.HighToneSolenoid.ShutterPartOpened.Shutter.Transparency = 0
script.Parent.HighToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 0
script.Parent.HighToneSolenoid.ShutterPartOpened.Spring.Transparency = 0
SolenoidSound1.Volume = 0.05
SolenoidSound1:Play()
end
end)
script.Parent.L1:GetPropertyChangedSignal("Value"):Connect(function()
if script.Parent.L1.Value == true then
--moveupL1()
script.Parent.LowToneSolenoid.ShutterPartClosed.Shutter.Transparency = 0
script.Parent.LowToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 0
script.Parent.LowToneSolenoid.ShutterPartClosed.Spring.Transparency = 0
script.Parent.LowToneSolenoid.ShutterPartOpened.Shutter.Transparency = 1
script.Parent.LowToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 1
script.Parent.LowToneSolenoid.ShutterPartOpened.Spring.Transparency = 1
SolenoidSound2.Volume = 0.07
SolenoidSound2:Play()
else
--movebackL1()
script.Parent.LowToneSolenoid.ShutterPartClosed.Shutter.Transparency = 1
script.Parent.LowToneSolenoid.ShutterPartClosed.SolenoidPart.Transparency = 1
script.Parent.LowToneSolenoid.ShutterPartClosed.Spring.Transparency = 1
script.Parent.LowToneSolenoid.ShutterPartOpened.Shutter.Transparency = 0
script.Parent.LowToneSolenoid.ShutterPartOpened.SolenoidPart.Transparency = 0
script.Parent.LowToneSolenoid.ShutterPartOpened.Spring.Transparency = 0
SolenoidSound2.Volume = 0.03
SolenoidSound2:Play()
end
end)
function ActivateSolenoids()
if Flasher.On.Value == true and Flasher.Power.Value == true then
if Flasher.Outputs.SIG1.Value == true then
script.Parent.L1.Value = true
script.Parent.L2.Value = false
else
script.Parent.L1.Value = false
script.Parent.L2.Value = true
end
else
script.Parent.L1.Value = false
script.Parent.L2.Value = false
end
end
Flasher.Outputs.SIG1.Changed:Connect(function()
ActivateSolenoids()
end)
Flasher.On.Changed:Connect(function()
script.Parent.ModulationActive.Value = Flasher.On.Value
ActivateSolenoids()
end)
Flasher.Outputs.SIG1.Test.Changed:Connect(function()
repeat wait()
script.Parent.L1.Value = true
until Flasher.Power.Value == false or Flasher.Outputs.SIG1.Test.Value == false
script.Parent.L1.Value = false
end)
Flasher.Outputs.SIG2.Test.Changed:Connect(function()
repeat wait()
script.Parent.L2.Value = true
until Flasher.Power.Value == false or Flasher.Outputs.SIG2.Test.Value == false
script.Parent.L2.Value = false
end)
|
--//Toggle event//--
|
script.Parent.Button1.ClickDetector.MouseClick:Connect(function()
if DoorStatus == "Closed" and Debounce == false then
Debounce = true
Door.Button1.Click:Play()
DoorMain.Sound:Play()
Open()
wait(1)
DoorStatus = "Opened"
Debounce = false
elseif DoorStatus == "Opened" and Debounce == false then
Debounce = true
Door.Button1.Click:Play()
DoorMain.Sound:Play()
Close()
wait(1)
DoorStatus = "Closed"
Debounce = false
end
end)
script.Parent.Button2.ClickDetector.MouseClick:Connect(function()
if DoorStatus == "Closed" and Debounce == false then
Debounce = true
Door.Button2.Click:Play()
DoorMain.Sound:Play()
Open()
wait(1)
DoorStatus = "Opened"
Debounce = false
elseif DoorStatus == "Opened" and Debounce == false then
Debounce = true
Door.Button2.Click:Play()
DoorMain.Sound:Play()
Close()
wait(1)
DoorStatus = "Closed"
Debounce = false
end
end)
|
-- Setup selection camera
|
local SelectedCamera = Instance.new("Camera")
SelectedCamera.Parent = Selected
SelectedCamera.FieldOfView = 30
Selected.CurrentCamera = SelectedCamera
|
--[[ --------- ]]
|
--
function speed(run)
if run then
if not running then
running = true
script.Running.Value = true
for i = 1, 8 do
game.Workspace.CurrentCamera.FieldOfView = (90 + (i * 2))
r.Stepped:wait()
end
end
else
if running then
running = false
script.Running.Value = false
for i = 1, 8 do
game.Workspace.CurrentCamera.FieldOfView = (90 - (i * 2))
r.Stepped:wait()
end
end
end
end
mouse.KeyDown:connect(function(key)
if (string.byte(key:lower()) == 48)then
script.Parent.LoadingBar.Stamina.Text = ("Stamina")
speed(true)
mouse.KeyUp:connect(function(key)
if (string.byte(key:lower()) == 48)then
speed(false)
end
end)
end
end)
while true do
r.Stepped:wait(0.10)
if running then
if not (Bar.Size == UDim2.new(0, 0, 0.9, 0)) then
if not (Bar.Size.X.Scale - 0.01 <= 0) then
Bar:TweenSize(UDim2.new((Bar.Size.X.Scale - 0.01), 0, Bar.Size.Y.Scale, 0), Out, "Sine", 0.10, true, nil)
else
Bar:TweenSize(UDim2.new(Bar.Size.X.Scale - (-(0-Bar.Size.X.Scale)), 0, Bar.Size.Y.Scale, 0),Out, "Sine", 0.10, true, nil)
end
else
speed(false)
end
if Bar.Size.X.Scale < 0.05 then
speed(false)
end
else
if not (Bar.Size == UDim2.new(0.985, 0, 0.9, 0)) then
if not (Bar.Size.X.Scale + 0.005 >= 0.985) then
wait(0.15)
Bar:TweenSize(UDim2.new((Bar.Size.X.Scale + 0.005), 0, Bar.Size.Y.Scale, 0), Out, "Sine", 0.10, true, nil)
else
wait(0.15)
Bar:TweenSize(UDim2.new(Bar.Size.X.Scale + (0.985-Bar.Size.X.Scale), 0, 0.9, 0),Out, "Sine", 0.10, true, nil)
end
end
end
end
|
--// Event for making player say chat message.
|
function chatBarFocusLost(enterPressed, inputObject)
DoBackgroundFadeIn()
chatBarFocusChanged:Fire(false)
if (enterPressed) then
local message = ChatBar:GetTextBox().Text
if ChatBar:IsInCustomState() then
local customMessage = ChatBar:GetCustomMessage()
if customMessage then
message = customMessage
end
local messageSunk = ChatBar:CustomStateProcessCompletedMessage(message)
ChatBar:ResetCustomState()
if messageSunk then
return
end
end
ChatBar:GetTextBox().Text = ""
if message ~= "" then
--// Sends signal to eventually call Player:Chat() to handle C++ side legacy stuff.
moduleApiTable.MessagePosted:fire(message)
if not CommandProcessor:ProcessCompletedChatMessage(message, ChatWindow) then
if ChatSettings.DisallowedWhiteSpace then
for i = 1, #ChatSettings.DisallowedWhiteSpace do
if ChatSettings.DisallowedWhiteSpace[i] == "\t" then
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], " ")
else
message = string.gsub(message, ChatSettings.DisallowedWhiteSpace[i], "")
end
end
end
message = string.gsub(message, "\n", "")
message = string.gsub(message, "[ ]+", " ")
local targetChannel = ChatWindow:GetTargetMessageChannel()
if targetChannel then
MessageSender:SendMessage(message, targetChannel)
else
MessageSender:SendMessage(message, nil)
end
end
end
end
end
local ChatBarConnections = {}
function setupChatBarConnections()
for i = 1, #ChatBarConnections do
ChatBarConnections[i]:Disconnect()
end
ChatBarConnections = {}
local focusLostConnection = ChatBar:GetTextBox().FocusLost:connect(chatBarFocusLost)
table.insert(ChatBarConnections, focusLostConnection)
local focusGainedConnection = ChatBar:GetTextBox().Focused:connect(chatBarFocused)
table.insert(ChatBarConnections, focusGainedConnection)
end
setupChatBarConnections()
ChatBar.GuiObjectsChanged:connect(setupChatBarConnections)
function getEchoMessagesInGeneral()
if ChatSettings.EchoMessagesInGeneralChannel == nil then
return true
end
return ChatSettings.EchoMessagesInGeneralChannel
end
EventFolder.OnMessageDoneFiltering.OnClientEvent:connect(function(messageData)
if not ChatSettings.ShowUserOwnFilteredMessage then
if messageData.FromSpeaker == LocalPlayer.Name then
return
end
end
local channelName = messageData.OriginalChannel
local channelObj = ChatWindow:GetChannel(channelName)
if channelObj then
channelObj:UpdateMessageFiltered(messageData)
end
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:UpdateMessageFiltered(messageData)
end
end
end)
EventFolder.OnNewMessage.OnClientEvent:connect(function(messageData, channelName)
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
if (messageData.FromSpeaker ~= LocalPlayer.Name) then
ChannelsBar:UpdateMessagePostedInChannel(channelName)
end
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(messageData)
end
end
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
end
end)
EventFolder.OnNewSystemMessage.OnClientEvent:connect(function(messageData, channelName)
channelName = channelName or "System"
local channelObj = ChatWindow:GetChannel(channelName)
if (channelObj) then
channelObj:AddMessageToChannel(messageData)
ChannelsBar:UpdateMessagePostedInChannel(channelName)
moduleApiTable.MessageCount = moduleApiTable.MessageCount + 1
moduleApiTable.MessagesChanged:fire(moduleApiTable.MessageCount)
DoFadeInFromNewInformation()
if getEchoMessagesInGeneral() and ChatSettings.GeneralChannelName and channelName ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(messageData)
end
end
else
warn(string.format("Just received system message for channel I'm not in [%s]", channelName))
end
end)
function HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, addHistoryToGeneralChannel,
addWelcomeMessageToGeneralChannel)
if ChatWindow:GetChannel(channel) then
--- If the channel has already been added, remove it first.
ChatWindow:RemoveChannel(channel)
end
if (channel == ChatSettings.GeneralChannelName) then
DidFirstChannelsLoads = true
end
if channelNameColor then
ChatBar:SetChannelNameColor(channel, channelNameColor)
end
local channelObj = ChatWindow:AddChannel(channel)
if (channelObj) then
if (channel == ChatSettings.GeneralChannelName) then
DoSwitchCurrentChannel(channel)
end
if (messageLog) then
local startIndex = 1
if #messageLog > ChatSettings.MessageHistoryLengthPerChannel then
startIndex = #messageLog - ChatSettings.MessageHistoryLengthPerChannel
end
for i = startIndex, #messageLog do
channelObj:AddMessageToChannel(messageLog[i])
end
if getEchoMessagesInGeneral() and addHistoryToGeneralChannel then
if ChatSettings.GeneralChannelName and channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessagesToChannelByTimeStamp(messageLog, startIndex)
end
end
end
end
if (welcomeMessage ~= "") then
local welcomeMessageObject = {
ID = -1,
FromSpeaker = nil,
SpeakerUserId = 0,
OriginalChannel = channel,
IsFiltered = true,
MessageLength = string.len(welcomeMessage),
Message = trimTrailingSpaces(welcomeMessage),
MessageType = ChatConstants.MessageTypeWelcome,
Time = os.time(),
ExtraData = nil,
}
channelObj:AddMessageToChannel(welcomeMessageObject)
if getEchoMessagesInGeneral() and addWelcomeMessageToGeneralChannel and not ChatSettings.ShowChannelsBar then
if channel ~= ChatSettings.GeneralChannelName then
local generalChannel = ChatWindow:GetChannel(ChatSettings.GeneralChannelName)
if generalChannel then
generalChannel:AddMessageToChannel(welcomeMessageObject)
end
end
end
end
DoFadeInFromNewInformation()
end
end
EventFolder.OnChannelJoined.OnClientEvent:connect(function(channel, welcomeMessage, messageLog, channelNameColor)
HandleChannelJoined(channel, welcomeMessage, messageLog, channelNameColor, false, true)
end)
EventFolder.OnChannelLeft.OnClientEvent:connect(function(channel)
ChatWindow:RemoveChannel(channel)
DoFadeInFromNewInformation()
end)
EventFolder.OnMuted.OnClientEvent:connect(function(channel)
--// Do something eventually maybe?
--// This used to take away the chat bar in channels the player was muted in.
--// We found out this behavior was inconvenient for doing chat commands though.
end)
EventFolder.OnUnmuted.OnClientEvent:connect(function(channel)
--// Same as above.
end)
EventFolder.OnMainChannelSet.OnClientEvent:connect(function(channel)
DoSwitchCurrentChannel(channel)
end)
coroutine.wrap(function()
-- ChannelNameColorUpdated may not exist if the client version is older than the server version.
local ChannelNameColorUpdated = DefaultChatSystemChatEvents:WaitForChild("ChannelNameColorUpdated", 5)
if ChannelNameColorUpdated then
ChannelNameColorUpdated.OnClientEvent:connect(function(channelName, channelNameColor)
ChatBar:SetChannelNameColor(channelName, channelNameColor)
end)
end
end)()
|
--Heat Limit
|
if Heat <= 0 then
enabled = true
Heat = 0
end
if Heat >= 150 then
enabled = false
Heat = 150
end
rotvalueB1 = rotvalueB1 + Spin
rotvalueB2 = rotvalueB2 + Spin
rotvalueB3 = rotvalueB3 + Spin
rotvalueB4 = rotvalueB4 + Spin
rotvalueB5 = rotvalueB5 + Spin
rotvalueB6 = rotvalueB6 + Spin
Tool.B1.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB1)) * Dist, 0, math.cos(math.rad(rotvalueB1)) * Dist)
Tool.B2.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB2)) * Dist, 0, math.cos(math.rad(rotvalueB2)) * Dist)
Tool.B3.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB3)) * Dist, 0, math.cos(math.rad(rotvalueB3)) * Dist)
Tool.B4.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB4)) * Dist, 0, math.cos(math.rad(rotvalueB4)) * Dist)
Tool.B5.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB5)) * Dist, 0, math.cos(math.rad(rotvalueB5)) * Dist)
Tool.B6.Mesh.Offset = Vector3.new(math.sin(math.rad(rotvalueB6)) * Dist, 0, math.cos(math.rad(rotvalueB6)) * Dist)
game.Players.LocalPlayer.PlayerGui.OverheatBar.HeatRed.Size = UDim2.new(0, Heat, 0, 10)
wait()
end
end
Tool.Equipped:connect(onEquippedLocal)
Tool.Equipped:connect(onEquippedLocal2)
Tool.Equipped:connect(Equip)
Tool.Unequipped:connect(Unequip)
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(equip1)
script.Parent.Unequipped:connect(unequip1)
|
-- New ProfileStore:
|
function ProfileService.GetProfileStore(profile_store_name, profile_template) --> [ProfileStore]
if type(profile_store_name) ~= "string" then
error("[ProfileService]: profile_store_name must be a string")
elseif string.len(profile_store_name) == 0 then
error("[ProfileService]: Invalid profile_store_name")
end
if type(profile_template) ~= "table" then
error("[ProfileService]: Invalid profile_template")
end
local profile_store
profile_store = {
Mock = {
LoadProfileAsync = function(_, profile_key, not_released_handler)
return profile_store:LoadProfileAsync(profile_key, not_released_handler, UseMockTag)
end,
GlobalUpdateProfileAsync = function(_, profile_key, update_handler)
return profile_store:GlobalUpdateProfileAsync(profile_key, update_handler, UseMockTag)
end,
ViewProfileAsync = function(_, profile_key)
return profile_store:ViewProfileAsync(profile_key, UseMockTag)
end,
WipeProfileAsync = function(_, profile_key)
return profile_store:WipeProfileAsync(profile_key, UseMockTag)
end
},
_profile_store_name = profile_store_name,
_profile_template = profile_template,
_global_data_store = nil,
_loaded_profiles = {},
_profile_load_jobs = {},
_mock_loaded_profiles = {},
_mock_profile_load_jobs = {},
_is_pending = false,
}
if IsLiveCheckActive == true then
profile_store._is_pending = true
coroutine.wrap(function()
WaitForLiveAccessCheck()
if UseMockDataStore == false then
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name)
end
profile_store._is_pending = false
end)()
else
if UseMockDataStore == false then
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name)
end
end
setmetatable(profile_store, ProfileStore)
return profile_store
end
|
-- Get the BanPlayer RemoteFunction from ReplicatedStorage
|
local banPlayerRemote = ReplicatedStorage:WaitForChild("KickPlayer")
|
--//Client Animations
|
IdleAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play() -- require(script).FakeRightPos (For fake arms) | require(script).RightArmPos (For real arms)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).LeftPos}):Play() -- require(script).FakeLeftPos (For fake arms) | require(script).LeftArmPos (For real arms)
end;
StanceDown = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
StanceUp = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -1.5, -1.25) * CFrame.Angles(math.rad(-160), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(.8,-0.6,-1.15) * CFrame.Angles(math.rad(-170),math.rad(60),math.rad(15))}):Play()
wait(0.3)
end;
Patrol = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.75, -.9, -1.6) * CFrame.Angles(math.rad(-80), math.rad(-70), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.75,0.75,-1) * CFrame.Angles(math.rad(-90),math.rad(-45),math.rad(-25))}):Play()
wait(0.3)
end;
SprintAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.3)
end;
EquipAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0),{C1 = CFrame.new(1.2,-0.05,-1.65) * CFrame.Angles(math.rad(-90),math.rad(35),math.rad(-25))}):Play()
wait(0.1)
objs[5].Handle:WaitForChild("AimUp"):Play()
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.5),{C1 = require(script.Parent.Settings).LeftPos}):Play()
wait(0.5)
end;
ZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new(-0.2, 0.21, 0)*CFrame.Angles(0, 0, math.rad(90))*CFrame.new(0.225, -0.75, 0)}):Play()
wait(0.3)
end;
UnZoomAnim = function(char, speed, objs)
--ts:Create(objs[2],TweenInfo.new(0),{C1 = CFrame.new(-.875, -0.2, -1.25) * CFrame.Angles(math.rad(-60), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.25, -1.1, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.65, -0.7, -1)*CFrame.Angles(math.rad(-180), 0, 0)*CFrame.Angles(0, 0, math.rad(30))}):Play()
ts:Create(objs[5].g33:WaitForChild("g33"),TweenInfo.new(0.3),{C1 = CFrame.new()}):Play()
wait(0.3)
end;
ChamberAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = require(script.Parent.Settings).RightPos}):Play()
ts:Create(objs[3],TweenInfo.new(0.35),{C1 = CFrame.new(0.15,0.1,-1.2) * CFrame.Angles(math.rad(-120),math.rad(15),math.rad(15))}):Play()
wait(0.35)
objs[5].Bolt:WaitForChild("SlidePull"):Play()
ts:Create(objs[3],TweenInfo.new(0.25),{C1 = CFrame.new(0,-0.25,-1.05) * CFrame.Angles(math.rad(-120),math.rad(15),math.rad(15))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].BoltExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.25),{C0 = CFrame.new(objs[6].SlideExtend) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
end;
ChamberBKAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, -0.465, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.1,-0.15,-1.115) * CFrame.Angles(math.rad(-110),math.rad(25),math.rad(0))}):Play()
wait(0.3)
objs[5].Bolt:WaitForChild("SlideRelease"):Play()
ts:Create(objs[3],TweenInfo.new(0.15),{C1 = CFrame.new(0.1,-0.15,-1.025) * CFrame.Angles(math.rad(-100),math.rad(30),math.rad(0))}):Play()
ts:Create(objs[5].Handle:WaitForChild("Bolt"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
ts:Create(objs[5].Handle:WaitForChild("Slide"),TweenInfo.new(0.1),{C0 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0)}):Play()
wait(0.15)
end;
CheckAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.875, 0, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(.35)
local MagC = objs[5]:WaitForChild("Mag"):clone()
objs[5].Mag.Transparency = 1
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagOut"):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.15,0.475,-1.5) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.45,0.475,-2.05) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.3)
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
wait(0.3)
end;
ShellInsertAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-115), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.55,-0.4,-1.15) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
wait(0.3)
objs[5].Handle:WaitForChild("ShellInsert"):Play()
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.975, -0.365, -1.2) * CFrame.Angles(math.rad(-110), math.rad(-2), math.rad(9))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(1.6,-0.3,-1.1) * CFrame.Angles(math.rad(-100),math.rad(70),math.rad(-41))}):Play()
objs[6].Value = objs[6].Value - 1
objs[7].Value = objs[7].Value + 1
wait(0.3)
end;
ReloadAnim = function(char, speed, objs)
ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.8, 1, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.5)
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = CFrame.new(-0.8, 1, -1.35) * CFrame.Angles(math.rad(-100), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.6),{C1 = CFrame.new(1.195,1.4,-0.5) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0))}):Play()
objs[5].Mag.Transparency = 1
objs[5].Handle:WaitForChild("MagOut"):Play()
local MagC = objs[5]:WaitForChild("Mag"):clone()
MagC.Parent = objs[5]
MagC.Name = "MagC"
MagC.Transparency = 0
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = objs[3].Parent.Parent:WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[3].Parent.Parent:WaitForChild("Left Arm").CFrame)
ts:Create(MagCW,TweenInfo.new(0),{C0 = CFrame.new(.3, -.15, .75) * CFrame.Angles(math.rad(-90), math.rad(90), math.rad(180))}):Play()
wait(1.5)
ts:Create(objs[2],TweenInfo.new(0.4),{C1 = CFrame.new(-0.8, 1, -1.15) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
ts:Create(objs[3],TweenInfo.new(0.4),{C1 = CFrame.new(-0.5,0.475,-1.6) * CFrame.Angles(math.rad(-100),math.rad(0),math.rad(7.5))}):Play()
wait(0.5)
ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.8, 1, -1.125) * CFrame.Angles(math.rad(-95), math.rad(-2), math.rad(7.5))}):Play()
objs[5].Handle:WaitForChild("MagIn"):Play()
MagC:Destroy()
objs[5].Mag.Transparency = 0
if (objs[6].Value - (objs[8].Ammo - objs[7].Value)) < 0 then
objs[7].Value = objs[7].Value + objs[6].Value
objs[6].Value = 0
--Evt.Recarregar:FireServer(objs[5].Value)
elseif objs[7].Value <= 0 then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
objs[9] = false
elseif objs[7].Value > 0 and objs[9] and objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value) - 1
--objs[10].Recarregar:FireServer(objs[6].Value)
objs[7].Value = objs[8].Ammo + 1
elseif objs[7].Value > 0 and objs[9] and not objs[8].IncludeChamberedBullet then
objs[6].Value = objs[6].Value - (objs[8].Ammo - objs[7].Value)
--Evt.Recarregar:FireServer(objs[5].Value)
objs[7].Value = objs[8].Ammo
end
wait(0.55)
end;
|
--Supercharger
|
local Whine_Pitch = 1.3 --max pitch of the whine (not exact so might have to mess with it)
local S_Loudness = 1.3 --volume of the supercharger(s) (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
if not _Tune.Engine then return end
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = _Tune.Turbochargers
local _SCount = _Tune.Superchargers
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/((_Tune.T_Boost*_TCount)+(_Tune.S_Boost*_SCount)))*2)
local tpsi = (((script.Parent.Values.BoostTurbo.Value)/(_Tune.T_Boost*_TCount))*2)
local spsi = ((script.Parent.Values.BoostSuper.Value)/(_Tune.S_Boost*_SCount))
--(script.Parent.Values.RPM.Value/_Tune.Redline)
local WP,WV,BP,BV,HP,HV = 0,0,0,0,0,0
BOVact = math.floor(tpsi*20)
if _TCount~=0 then
WP = (tpsi)
WV = (tpsi/4)*T_Loudness
BP = (1-(-tpsi/20))*BOV_Pitch
BV = (((-0.5+((tpsi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
else
WP,WV,BP,BV=0,0,0,0
end
if _SCount~=0 then
HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch
HV = (spsi/4)*S_Loudness
else
HP,HV = 0,0
end
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(tpsi*20)
ticc = tick()
end
end
|
--This is my first time scripting something! :D
--It's good for horror games too!
|
local mouse = game.Players.LocalPlayer:GetMouse()
function Light()
player = game.Players.LocalPlayer
playerChar = player.Character
playerLight = playerChar.Torso:FindFirstChild("Light")
if playerLight then
playerLight:Destroy()
else
light = Instance.new("SurfaceLight",playerChar:FindFirstChild("Torso"))
light.Name = "Light"
light.Range = 180 -- Change to distance ofthe Light.
light.Brightness = 60 -- Change to how much.
light.Shadows = true -- Change it to True/False.
end
end
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "f" then -- Change this to any Keys but I reccomand leaving it as [F] key.
Light()
end
end)
|
--THX for using my good Anti-Lag script! Garunteed to work unless your place has SUPER lag!
|
mx = game.Debris
mx2 = game.Debris.MaxItems --This lets the script find out how much debris there is.
if (mx.MaxItems > 100) then
mx.MaxItems = mx2*.75 --This makes it delete the debris every 100 items.
|
-- Feel free to use however you want
-- Credit is appreciated but not necessary
|
return function(SlotsFolder,overflowCollapse)
overflowCollapse = overflowCollapse or true
-- Define some values
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService('Players')
local Player = Players.LocalPlayer
local EquippedVal = Instance.new('ObjectValue')
EquippedVal.Name = 'Equipped'
if not Player.Character then -- Ensure the charater has loaded
Player.CharacterAdded:Wait()
end
local Char = Player.Character
local Backpack = Player:FindFirstChildOfClass('Backpack')
local function getSlotFromTool(tool)
for i,v in pairs(SlotsFolder:GetChildren()) do
if v.Value == tool then
return v
end
end
return false
end
-- returns every tool the user owns
local function getAllTools()
local tools = {}
for i,v in pairs(Backpack:GetChildren()) do
if v:IsA('Tool') then
table.insert(tools,v)
end
end
for i,v in pairs(Char:GetChildren()) do
if v:IsA('Tool') then
table.insert(tools,v)
end
end
return tools
end
-- returns tools not being displayed
local function getOverflowedTools()
local tools = {}
for i,v in pairs(getAllTools()) do
if not getSlotFromTool(v) then
table.insert(tools,v)
end
end
return tools
end
-- Removes tool from the slots folder's records
local function removeToolFromSlots(tool)
for i,v in pairs(SlotsFolder:GetChildren()) do
if v.Value == tool then
v.Value = nil
if overflowCollapse then
for i,v in pairs(getOverflowedTools()) do
v.Parent = script
v.Parent = Backpack
end
end
return true
end
end
return false
end
-- Returns true if tool is assigned to a slot
local function checkIfToolInSlots(tool)
for i,v in pairs(SlotsFolder:GetChildren()) do
if v.Value == tool then
return true
end
end
return false
end
-- Adds tool to slots folder's records
local function addToolToSlots(tool)
if not tool:IsA('Tool') then -- failsafe
return nil
end
if checkIfToolInSlots(tool) then -- prevents resorting
return true
end
-- If user drops tool, remove from slots folder's records
tool.AncestryChanged:Connect(function()
if (tool.Parent ~= Char) and (tool.Parent ~= Backpack) then
removeToolFromSlots(tool)
end
end)
for i,v in pairs(SlotsFolder:GetChildren()) do
if v.Value == nil then
v.Value = tool
if tool.Parent == Char then
EquippedVal.Value = v
end
return true
end
end
return false
end
-- Make sure stuff inside backpack gets added to slots folder
for i,v in pairs(Backpack:GetChildren()) do
addToolToSlots(v)
end
Backpack.ChildAdded:Connect(addToolToSlots)
-- Make sure stuff inside character gets added to slots folder
for i,v in pairs(Char:GetChildren()) do
addToolToSlots(v)
end
Char.ChildAdded:Connect(addToolToSlots)
-- Equips given tool or unequips everything if given nil
local function equip(tool)
|
--May not work for some models but it works for most...
| |
--[[**
ensures value matches string pattern
@param string pattern to check against
@returns A function that will return true iff the condition is passed
**--]]
|
function t.match(pattern)
assert(t.string(pattern))
return function(value)
local stringSuccess, stringErrMsg = t.string(value)
if not stringSuccess then
return false, stringErrMsg
end
if string.match(value, pattern) == nil then
return false, string.format("%q failed to match pattern %q", value, pattern)
end
return true
end
end
|
-- Assign grouping hotkeys
|
AssignHotkey({ 'LeftShift', 'G' }, Support.Call(GroupSelection, 'Model'))
AssignHotkey({ 'RightShift', 'G' }, Support.Call(GroupSelection, 'Model'))
AssignHotkey({ 'LeftShift', 'F' }, Support.Call(GroupSelection, 'Folder'))
AssignHotkey({ 'RightShift', 'F' }, Support.Call(GroupSelection, 'Folder'))
AssignHotkey({ 'LeftShift', 'U' }, UngroupSelection)
AssignHotkey({ 'RightShift', 'U' }, UngroupSelection)
function GetPartsFromSelection(Selection)
local Parts = {}
-- Get parts from selection
for _, Item in pairs(Selection) do
if Item:IsA 'BasePart' then
Parts[#Parts + 1] = Item
-- Get parts within other items
else
for _, Descendant in pairs(Item:GetDescendants()) do
if Descendant:IsA 'BasePart' then
Parts[#Parts + 1] = Descendant
end
end
end
end
-- Return parts
return Parts
end
function IsSelectable(Items)
-- Returns whether `Items` can be selected
-- Check each item
for _, Item in pairs(Items) do
-- Ensure item exists and is not locked
if (not Item) or (not Item.Parent) or (Item:IsA 'BasePart' and Item.Locked) then
return false
end
-- Ensure item can be modified
if not Security.IsItemAllowed(Item, Player) then
return false
end
end
-- Check if parts intruding into private areas
local Parts = GetPartsFromSelection(Items)
if Security.ArePartsViolatingAreas(Parts, Player, true) then
return false
end
-- If no checks fail, items are selectable
return true
end
function ExportSelection()
-- Exports the selected parts
-- Make sure that there are items in the selection
if #Selection.Items == 0 then
return;
end;
-- Start an export dialog
local DialogHandle
local DialogComponent = require(Tool:WaitForChild('UI'):WaitForChild('ExportDialog'))
local DialogDismissCallback = function ()
DialogHandle = Roact.unmount(DialogHandle)
end
local DialogElement = Roact.createElement(DialogComponent, {
Text = 'Uploading selection...';
OnDismiss = DialogDismissCallback;
})
DialogHandle = Roact.mount(DialogElement, UI, 'ExportDialog')
-- Send the exporting request to the server
Try(SyncAPI.Invoke, SyncAPI, 'Export', Selection.Items)
-- Display creation ID on success
:Then(function (CreationId)
Roact.update(DialogHandle, Roact.createElement(DialogComponent, {
Text = 'Your creation\'s ID:<font size="5"><br /></font>\n' ..
'<font face="GothamBlack" size="18">' .. CreationId .. '</font><font size="6"><br /></font>\n' ..
'<font face="Gotham" size="10">Use the code above to import your creation using the plugin in Studio.</font>';
OnDismiss = DialogDismissCallback;
}))
print('[Building Tools by F3X] Uploaded Export:', CreationId);
end)
-- Display error messages on failure
:Catch('Http requests are not enabled', function ()
Roact.update(DialogHandle, Roact.createElement(DialogComponent, {
Text = 'Please enable HTTP requests.';
OnDismiss = DialogDismissCallback;
}))
end)
:Catch('Export failed due to server-side error', function ()
Roact.update(DialogHandle, Roact.createElement(DialogComponent, {
Text = 'An error occurred — please try again.';
OnDismiss = DialogDismissCallback;
}))
end)
:Catch('Post data too large', function ()
Roact.update(DialogHandle, Roact.createElement(DialogComponent, {
Text = 'Try splitting up your build.';
OnDismiss = DialogDismissCallback;
}))
end)
:Catch(function (Error, Stack, Attempt)
Roact.update(DialogHandle, Roact.createElement(DialogComponent, {
Text = 'An unknown error occurred — please try again.';
OnDismiss = DialogDismissCallback;
}))
warn('❌ [Building Tools by F3X] Failed to export selection', '\n\nError:\n', Error, '\n\nStack:\n', Stack)
end)
end;
|
---RandFade SCRIPT, DO NOT EDIT!---
|
for i,v in pairs(game.workspace.PLights:GetChildren()) do
spawn(function()
while true do
wait(math.random())
v.Body.Head.Lens.Transparency = 0.2
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 5
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.2))
wait(.05)
v.Body.Head.Lens.Transparency = 0.3
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 4
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.3))
wait(.05)
v.Body.Head.Lens.Transparency = 0.4
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 3
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.4))
wait(.05)
v.Body.Head.Lens.Transparency = 0.5
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 3
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.5))
wait(.05)
v.Body.Head.Lens.Transparency = 0.6
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 2
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.6))
wait(.05)
v.Body.Head.Lens.Transparency = 0.7
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 2
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.7))
wait(.05)
v.Body.Head.Lens.Transparency = 0.8
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 1
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.8))
wait(.05)
v.Body.Head.Lens.Transparency = 0.9
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 1
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(0.9))
wait(.05)
v.Body.Head.Lens.Transparency = 1
v.Body.Head.Lens.SurfaceLgt.PointLight.Brightness = 0
v.Body.Head.Lens.Beam.Transparency = (NumberSequence.new(1))
end
end)
end
|
------------------------------------------------------------------------------------
|
local item = game.Lighting:findFirstChild(tostring(itemname))
local trigger = script.Parent
enabled = true
function onClick(plyr)
if plyr.Backpack:findFirstChild(tostring(itemname)) == nil and enabled == true then
enabled = false
trigger.BrickColor = BrickColor.new("Black")
local itemclone = item:clone()
itemclone.Parent = plyr.Backpack
wait(9)
enabled = true
trigger.BrickColor = BrickColor.new("Black")
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
|
--THIS SCRIPT GOES IN StarterPlayer > StarterCharacterScripts
|
math.randomseed(tick())
local runService = game:GetService("RunService")
local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local nextFire = 0
|
--[[**
<description>
Saves the data to the data store. Called when a Player leaves.
</description>
**--]]
|
function DataStore:Save()
local success, result = self:SaveAsync():await()
if success then
print("saved", self.Name)
else
error(result)
end
end
|
-- definimos la posicion inicial
|
musicGui.Position = UDim2.new(2,0,0.69,0)
function showMusic(gui, name)
gui.Text = name -- aqui mostramos el nombre de la cancion
gui:TweenPosition(UDim2.new(0.818,0,0.69,0),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
1,
true
)
delay(5, function()
gui:TweenPosition(UDim2.new(2,0,0.69,0),
Enum.EasingDirection.In,
Enum.EasingStyle.Linear,
1,
true
)
end)
end
|
--[=[
@interface HighlightOptions
@within Plasma
.outlineColor?: Color3
.fillColor?: Color3
.fillTransparency?: number
.outlineTransparency?: number
.fillMode?: HighlightFillMode
]=]
| |
-- Clean up the event connections when a character model is removed
|
local function onCharacterRemoving(character)
if signalBindings[character] then
signalBindings[character]:Disconnect()
end
if charactersOnFire[character] then
charactersOnFire[character] = nil
end
end
|
-- Recusively parses folders only and makes a table tree.
---@param rootFolder instance
---@param data table
|
function Database._Parse_R(dataRoot,rootFolder,data,_id)
_id = _id and _id or 0
local initialTable = {}
-- Ignore the first folder which is our root
if _id > 0 then
initialTable = { ["id"] = _id + 1 }
dataRoot[rootFolder.name] = initialTable -- Store by Name
end
-- Store attributes
local attributes = rootFolder:GetAttributes()
for name, value in pairs(attributes) do
initialTable[name] = value
end
-- Recursively parse every child that is a folder
for _, child in ipairs(rootFolder:GetChildren()) do
-- Recursively parse the folders only
if child.ClassName == "Folder" then
_id = _id + 1
Database._Parse_R(dataRoot,child,initialTable,_id)
else
-- If it's not a folder then store it as a reference
initialTable[child.name] = child
end
end
end
return Database
|
--["Walk"] = "rbxassetid://1136173829",
|
["Walk"] = "http://www.roblox.com/asset/?id=507767714",
["Idle"] = "http://www.roblox.com/asset/?id=507766666",
["SwingTool"] = "rbxassetid://1262318281"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end
local fallConstant = -2
run.Heartbeat:connect(function()
local part,pos,norm,mat = workspace:FindPartOnRay(Ray.new(root.Position,Vector3.new(0,-2.8,0)),char)
if target.Value then
local facingCFrame = CFrame.new(Vector3.new(root.CFrame.X,pos.Y+6.8,root.CFrame.Z),CFrame.new(target.Value.CFrame.X,pos.Y+3,target.Value.CFrame.Z).p)
bg.CFrame = facingCFrame
else
--bg.CFrame = CFrame.new(root.CFrame.X,pos.Y+3,root.CFrame.Z)
end
if target.Value then
bv.P = 100000
bv.Velocity = root.CFrame.lookVector*14
if not part then
bv.Velocity = bv.Velocity+Vector3.new(0,fallConstant,0)
fallConstant = fallConstant-1
else
fallConstant = -2
end
if not anims["Walk"].IsPlaying then
anims["Walk"]:Play()
end
else
bv.P = 0
bv.Velocity = Vector3.new(0,0,0)
anims["Walk"]:Stop()
anims["Idle"]:Play()
end
end)
while wait(1) do
local thresh,nearest = 120,nil
for _,player in next,game.Players:GetPlayers() do
if player.Character and player.Character.PrimaryPart then
local dist = (player.Character.PrimaryPart.Position-root.Position).magnitude
if dist < thresh then
thresh = dist
nearest = player.Character.PrimaryPart
end
end
end
if nearest then
if thresh < 8 then
anims["SwingTool"]:Play()
nearest.Parent.Humanoid:TakeDamage(24)
target.Value = nil
wait(1)
end
target.Value = nearest
else
target.Value = nil
end
end
|
--[[
Constructs a new computed state object, which follows the value of another
state object using a spring simulation.
]]
|
local Package = script.Parent.Parent
local Dependencies = require(Package.Dependencies)
local xtypeof = require(Package.ObjectUtility).xtypeof
local unwrap = require(Package.States.unwrap)
local SpringScheduler = require(script.SpringScheduler)
local unpackType = require(script.unpackType)
local parseError = Dependencies.utility.parseError
local class = {}
local CLASS_METATABLE = {__index = class}
local WEAK_KEYS_METATABLE = {__mode = "k"}
|
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
else
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled then
local buttons = player.PlayerGui.UI.CarButtons
buttons.Visible = true
local function handleLeftButton(input)
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
local function handleRightButton(input)
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
end
local function handleForwardButton(input)
if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
end
buttons.Left.InputBegan:Connect(handleLeftButton)
buttons.Left.InputEnded:Connect(handleLeftButton)
buttons.Right.InputBegan:Connect(handleRightButton)
buttons.Right.InputEnded:Connect(handleRightButton)
buttons.Forward.InputBegan:Connect(handleForwardButton)
buttons.Forward.InputEnded:Connect(handleForwardButton)
end
|
------------------------------------------------------------------------
|
do
local enabled = false
local function ToggleFreecam()
if enabled then
StopFreecam()
else
StartFreecam()
end
enabled = not enabled
end
local function CheckMacro(macro)
for i = 1, #macro - 1 do
if not UserInputService:IsKeyDown(macro[i]) then
return
end
end
ToggleFreecam()
end
local function HandleActivationInput(action, state, input)
if state == Enum.UserInputState.Begin then
if input.KeyCode == FREECAM_MACRO_KB[#FREECAM_MACRO_KB] then
CheckMacro(FREECAM_MACRO_KB)
end
end
return Enum.ContextActionResult.Pass
end
ContextActionService:BindActionAtPriority("FreecamToggle", HandleActivationInput, false, TOGGLE_INPUT_PRIORITY, FREECAM_MACRO_KB[#FREECAM_MACRO_KB])
end
|
-- Text sizes
|
local TextBoundaries = Vector2.new(math.huge, math.huge)
local TITLE_SIZE = TextService:GetTextSize('Selection mode', 24/2, Enum.Font.SourceSans, TextBoundaries)
local HOTKEY_SIZE = TextService:GetTextSize('SHIFT-T', 24/2, Enum.Font.SourceSans, TextBoundaries)
local SCOPED_LABEL_SIZE = TextService:GetTextSize('Groups and parts', 25/2, Enum.Font.SourceSans, TextBoundaries)
local DIRECT_LABEL_SIZE = TextService:GetTextSize('Parts only', 25/2, Enum.Font.SourceSans, TextBoundaries)
local function Tooltip(props)
return new('ImageLabel', {
AnchorPoint = props.IsToolModeEnabled and
Vector2.new(0, 1) or
Vector2.new(0, 0);
Position = props.IsToolModeEnabled and
UDim2.new(0, 0, 0, -12/2) or
UDim2.new(0, 0, 1, 12/2);
BackgroundTransparency = 1;
Image = 'rbxassetid://4445959523';
ScaleType = Enum.ScaleType.Slice;
SliceCenter = Rect.new(4, 4, 12, 12);
ImageColor3 = Color3.fromRGB(67, 67, 67);
Size = UDim2.new(0, TITLE_SIZE.X + 15/2 + HOTKEY_SIZE.X + 22/2, 0, 94/2);
Visible = props.Visible;
},
{
Arrow = new('Frame', {
BackgroundColor3 = Color3.fromRGB(67, 67, 67);
BorderSizePixel = 0;
AnchorPoint = Vector2.new(0.5, 0.5);
Position = props.IsToolModeEnabled and
UDim2.new(0, 18/2, 1, 0) or
UDim2.new(0, 18/2, 0, 0);
Size = UDim2.new(0, 10/2, 0, 10/2);
Rotation = 45;
});
Title = new('TextLabel', {
BackgroundTransparency = 1;
Font = Enum.Font.SourceSans;
TextSize = 24/2;
TextColor3 = Color3.new(1, 1, 1);
TextTransparency = 1 - 0.6;
Text = 'Selection mode';
Size = UDim2.new(0, TITLE_SIZE.X, 0, TITLE_SIZE.Y);
Position = UDim2.new(0, 8/2, 0, 5/2 + 2);
});
Hotkey = new('TextLabel', {
BackgroundTransparency = 1;
Font = Enum.Font.SourceSansSemibold;
TextSize = 20/2;
TextColor3 = Color3.new(1, 1, 1);
TextTransparency = 0;
Text = 'SHIFT-T';
Size = UDim2.new(0, HOTKEY_SIZE.X, 0, HOTKEY_SIZE.Y);
Position = UDim2.new(0, 8/2 + TITLE_SIZE.X + 15/2, 0, 5/2 + 2);
});
ScopedIcon = new('ImageLabel', {
BackgroundTransparency = 1;
Image = 'rbxassetid://4463020853';
ImageTransparency = 1 - 0.4;
Position = UDim2.fromOffset(
8/2,
5/2 + TITLE_SIZE.Y + 2
);
Size = UDim2.new(0, 28/2, 0, 28/2);
ImageRectOffset = Vector2.new(0, 0);
ImageRectSize = Vector2.new(14, 14);
});
ScopedLabel = new('TextLabel', {
BackgroundTransparency = 1;
Font = Enum.Font.SourceSans;
TextSize = 25/2;
TextColor3 = Color3.new(1, 1, 1);
Text = 'Groups and parts';
Size = UDim2.new(0, SCOPED_LABEL_SIZE.X, 0, SCOPED_LABEL_SIZE.Y);
Position = UDim2.fromOffset(
(8 + 26 + 8)/2,
5/2 + TITLE_SIZE.Y + 2
);
TextXAlignment = Enum.TextXAlignment.Left;
});
DirectIcon = new('ImageLabel', {
BackgroundTransparency = 1;
Image = 'rbxassetid://4463020853';
ImageTransparency = 1 - 0.4;
Position = UDim2.fromOffset(
8/2,
5/2 + TITLE_SIZE.Y + 2 + SCOPED_LABEL_SIZE.Y + 1
);
Size = UDim2.new(0, 28/2, 0, 28/2);
ImageRectOffset = Vector2.new(14, 0);
ImageRectSize = Vector2.new(14, 14);
});
DirectLabel = new('TextLabel', {
BackgroundTransparency = 1;
Font = Enum.Font.SourceSans;
TextSize = 25/2;
TextColor3 = Color3.new(1, 1, 1);
Text = 'Parts only';
Size = UDim2.new(0, DIRECT_LABEL_SIZE.X, 0, DIRECT_LABEL_SIZE.Y);
Position = UDim2.fromOffset(
(8 + 26 + 8)/2,
5/2 + TITLE_SIZE.Y + 2 + SCOPED_LABEL_SIZE.Y + 1
);
TextXAlignment = Enum.TextXAlignment.Left;
});
})
end
return Tooltip
|
-- SERVICES --
|
local Players = game:GetService('Players')
local BadgeService = game:GetService('BadgeService')
local TweenService = game:GetService('TweenService')
|
--[=[
Returns true if the value is a cancel token
@param value any
@return boolean
]=]
|
function CancelToken.isCancelToken(value)
return type(value) == "table"
and getmetatable(value) == CancelToken
end
local EMPTY_FUNCTION = function() end
|
-- events
|
Players.PlayerAdded:connect(HandlePlayer)
|
-- only merge property defined on target
|
function mergeProps(source, target)
if not source or not target then return end
for prop, value in pairs(source) do
if target[prop] ~= nil then
target[prop] = value
end
end
end
function methods:CreateGuiObjects(targetParent)
local userDefinedChatWindowStyle
pcall(function()
userDefinedChatWindowStyle= Chat:InvokeChatCallback(Enum.ChatCallbackType.OnCreatingChatWindow, nil)
end)
-- merge the userdefined settings with the ChatSettings
mergeProps(userDefinedChatWindowStyle, ChatSettings)
local BaseFrame = Instance.new("Frame")
BaseFrame.BackgroundTransparency = 1
BaseFrame.Active = ChatSettings.WindowDraggable
BaseFrame.Parent = targetParent
BaseFrame.AutoLocalize = false
local ChatBarParentFrame = Instance.new("Frame")
ChatBarParentFrame.Selectable = false
ChatBarParentFrame.Name = "ChatBarParentFrame"
ChatBarParentFrame.BackgroundTransparency = 1
ChatBarParentFrame.Parent = BaseFrame
local ChannelsBarParentFrame = Instance.new("Frame")
ChannelsBarParentFrame.Selectable = false
ChannelsBarParentFrame.Name = "ChannelsBarParentFrame"
ChannelsBarParentFrame.BackgroundTransparency = 1
ChannelsBarParentFrame.Position = UDim2.new(0, 0, 0, 0)
ChannelsBarParentFrame.Parent = BaseFrame
local ChatChannelParentFrame = Instance.new("Frame")
ChatChannelParentFrame.Selectable = false
ChatChannelParentFrame.Name = "ChatChannelParentFrame"
ChatChannelParentFrame.BackgroundTransparency = 1
ChatChannelParentFrame.BackgroundColor3 = ChatSettings.BackGroundColor
ChatChannelParentFrame.BackgroundTransparency = 0.6
ChatChannelParentFrame.BorderSizePixel = 0
ChatChannelParentFrame.Parent = BaseFrame
local ChatResizerFrame = Instance.new("ImageButton")
ChatResizerFrame.Selectable = false
ChatResizerFrame.Image = ""
ChatResizerFrame.BackgroundTransparency = 0.6
ChatResizerFrame.BorderSizePixel = 0
ChatResizerFrame.Visible = false
ChatResizerFrame.BackgroundColor3 = ChatSettings.BackGroundColor
ChatResizerFrame.Active = true
if bubbleChatOnly() then
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 0, 0)
else
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 1, -ChatResizerFrame.AbsoluteSize.Y)
end
ChatResizerFrame.Parent = BaseFrame
local ResizeIcon = Instance.new("ImageLabel")
ResizeIcon.Selectable = false
ResizeIcon.Size = UDim2.new(0.8, 0, 0.8, 0)
ResizeIcon.Position = UDim2.new(0.2, 0, 0.2, 0)
ResizeIcon.BackgroundTransparency = 1
ResizeIcon.Image = "rbxassetid://261880743"
ResizeIcon.Parent = ChatResizerFrame
local function GetScreenGuiParent()
--// Travel up parent list until you find the ScreenGui that the chat window is parented to
local screenGuiParent = BaseFrame
while (screenGuiParent and not screenGuiParent:IsA("ScreenGui")) do
screenGuiParent = screenGuiParent.Parent
end
return screenGuiParent
end
local deviceType = DEVICE_DESKTOP
local screenGuiParent = GetScreenGuiParent()
if (screenGuiParent.AbsoluteSize.X <= PHONE_SCREEN_WIDTH) then
deviceType = DEVICE_PHONE
elseif (screenGuiParent.AbsoluteSize.X <= TABLET_SCREEN_WIDTH) then
deviceType = DEVICE_TABLET
end
local checkSizeLock = false
local function doCheckSizeBounds()
if (checkSizeLock) then return end
checkSizeLock = true
if (not BaseFrame:IsDescendantOf(PlayerGui)) then return end
local screenGuiParent = GetScreenGuiParent()
local minWinSize = ChatSettings.MinimumWindowSize
local maxWinSize = ChatSettings.MaximumWindowSize
local forceMinY = ChannelsBarParentFrame.AbsoluteSize.Y + ChatBarParentFrame.AbsoluteSize.Y
local minSizePixelX = (minWinSize.X.Scale * screenGuiParent.AbsoluteSize.X) + minWinSize.X.Offset
local minSizePixelY = math.max((minWinSize.Y.Scale * screenGuiParent.AbsoluteSize.Y) + minWinSize.Y.Offset, forceMinY)
local maxSizePixelX = (maxWinSize.X.Scale * screenGuiParent.AbsoluteSize.X) + maxWinSize.X.Offset
local maxSizePixelY = (maxWinSize.Y.Scale * screenGuiParent.AbsoluteSize.Y) + maxWinSize.Y.Offset
local absSizeX = BaseFrame.AbsoluteSize.X
local absSizeY = BaseFrame.AbsoluteSize.Y
if (absSizeX < minSizePixelX) then
local offset = UDim2.new(0, minSizePixelX - absSizeX, 0, 0)
BaseFrame.Size = BaseFrame.Size + offset
elseif (absSizeX > maxSizePixelX) then
local offset = UDim2.new(0, maxSizePixelX - absSizeX, 0, 0)
BaseFrame.Size = BaseFrame.Size + offset
end
if (absSizeY < minSizePixelY) then
local offset = UDim2.new(0, 0, 0, minSizePixelY - absSizeY)
BaseFrame.Size = BaseFrame.Size + offset
elseif (absSizeY > maxSizePixelY) then
local offset = UDim2.new(0, 0, 0, maxSizePixelY - absSizeY)
BaseFrame.Size = BaseFrame.Size + offset
end
local xScale = BaseFrame.AbsoluteSize.X / screenGuiParent.AbsoluteSize.X
local yScale = BaseFrame.AbsoluteSize.Y / screenGuiParent.AbsoluteSize.Y
-- cap chat window scale at a value smaller than 0.5 to prevent center of screen overlap
if FFlagFixMouseCapture then
xScale = math.min(xScale, 0.45)
yScale = math.min(xScale, 0.45)
end
BaseFrame.Size = UDim2.new(xScale, 0, yScale, 0)
checkSizeLock = false
end
BaseFrame.Changed:connect(function(prop)
if (prop == "AbsoluteSize") then
doCheckSizeBounds()
end
end)
ChatResizerFrame.DragBegin:connect(function(startUdim)
BaseFrame.Draggable = false
end)
local function UpdatePositionFromDrag(atPos)
if ChatSettings.WindowDraggable == false and ChatSettings.WindowResizable == false then
return
end
local newSize = atPos - BaseFrame.AbsolutePosition + ChatResizerFrame.AbsoluteSize
BaseFrame.Size = UDim2.new(0, newSize.X, 0, newSize.Y)
if bubbleChatOnly() then
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 0, 0)
else
ChatResizerFrame.Position = UDim2.new(1, -ChatResizerFrame.AbsoluteSize.X, 1, -ChatResizerFrame.AbsoluteSize.Y)
end
end
ChatResizerFrame.DragStopped:connect(function(endX, endY)
BaseFrame.Draggable = ChatSettings.WindowDraggable
--UpdatePositionFromDrag(Vector2.new(endX, endY))
end)
local resizeLock = false
ChatResizerFrame.Changed:connect(function(prop)
if (prop == "AbsolutePosition" and not BaseFrame.Draggable) then
if (resizeLock) then return end
resizeLock = true
UpdatePositionFromDrag(ChatResizerFrame.AbsolutePosition)
resizeLock = false
end
end)
local function CalculateChannelsBarPixelSize(textSize)
if (deviceType == DEVICE_PHONE) then
textSize = textSize or ChatSettings.ChatChannelsTabTextSizePhone
else
textSize = textSize or ChatSettings.ChatChannelsTabTextSize
end
local channelsBarTextYSize = textSize
local chatChannelYSize = math.max(32, channelsBarTextYSize + 8) + 2
return chatChannelYSize
end
local function CalculateChatBarPixelSize(textSize)
if (deviceType == DEVICE_PHONE) then
textSize = textSize or ChatSettings.ChatBarTextSizePhone
else
textSize = textSize or ChatSettings.ChatBarTextSize
end
local chatBarTextSizeY = textSize
local chatBarYSize = chatBarTextSizeY + (7 * 2) + (5 * 2)
return chatBarYSize
end
if bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 0, 0)
ChannelsBarParentFrame.Visible = false
ChannelsBarParentFrame.Active = false
ChatChannelParentFrame.Visible = false
ChatChannelParentFrame.Active = false
local useXScale = 0
local useXOffset = 0
local screenGuiParent = GetScreenGuiParent()
if (deviceType == DEVICE_PHONE) then
useXScale = ChatSettings.DefaultWindowSizePhone.X.Scale
useXOffset = ChatSettings.DefaultWindowSizePhone.X.Offset
elseif (deviceType == DEVICE_TABLET) then
useXScale = ChatSettings.DefaultWindowSizeTablet.X.Scale
useXOffset = ChatSettings.DefaultWindowSizeTablet.X.Offset
else
useXScale = ChatSettings.DefaultWindowSizeTablet.X.Scale
useXOffset = ChatSettings.DefaultWindowSizeTablet.X.Offset
end
local chatBarYSize = CalculateChatBarPixelSize()
BaseFrame.Size = UDim2.new(useXScale, useXOffset, 0, chatBarYSize)
BaseFrame.Position = ChatSettings.DefaultWindowPosition
else
local screenGuiParent = GetScreenGuiParent()
if (deviceType == DEVICE_PHONE) then
BaseFrame.Size = ChatSettings.DefaultWindowSizePhone
elseif (deviceType == DEVICE_TABLET) then
BaseFrame.Size = ChatSettings.DefaultWindowSizeTablet
else
BaseFrame.Size = ChatSettings.DefaultWindowSizeDesktop
end
BaseFrame.Position = ChatSettings.DefaultWindowPosition
end
if (deviceType == DEVICE_PHONE) then
ChatSettings.ChatWindowTextSize = ChatSettings.ChatWindowTextSizePhone
ChatSettings.ChatChannelsTabTextSize = ChatSettings.ChatChannelsTabTextSizePhone
ChatSettings.ChatBarTextSize = ChatSettings.ChatBarTextSizePhone
end
local function UpdateDraggable(enabled)
BaseFrame.Active = enabled
BaseFrame.Draggable = enabled
end
local function UpdateResizable(enabled)
ChatResizerFrame.Visible = enabled
ChatResizerFrame.Draggable = enabled
local frameSizeY = ChatBarParentFrame.Size.Y.Offset
if (enabled) then
ChatBarParentFrame.Size = UDim2.new(1, -frameSizeY - 2, 0, frameSizeY)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -frameSizeY)
end
else
ChatBarParentFrame.Size = UDim2.new(1, 0, 0, frameSizeY)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -frameSizeY)
end
end
end
local function UpdateChatChannelParentFrameSize()
local channelsBarSize = CalculateChannelsBarPixelSize()
local chatBarSize = CalculateChatBarPixelSize()
if (ChatSettings.ShowChannelsBar) then
ChatChannelParentFrame.Size = UDim2.new(1, 0, 1, -(channelsBarSize + chatBarSize + 2 + 2))
ChatChannelParentFrame.Position = UDim2.new(0, 0, 0, channelsBarSize + 2)
else
ChatChannelParentFrame.Size = UDim2.new(1, 0, 1, -(chatBarSize + 2 + 2))
ChatChannelParentFrame.Position = UDim2.new(0, 0, 0, 2)
end
end
local function UpdateChatChannelsTabTextSize(size)
local channelsBarSize = CalculateChannelsBarPixelSize(size)
ChannelsBarParentFrame.Size = UDim2.new(1, 0, 0, channelsBarSize)
UpdateChatChannelParentFrameSize()
end
local function UpdateChatBarTextSize(size)
local chatBarSize = CalculateChatBarPixelSize(size)
ChatBarParentFrame.Size = UDim2.new(1, 0, 0, chatBarSize)
if not bubbleChatOnly() then
ChatBarParentFrame.Position = UDim2.new(0, 0, 1, -chatBarSize)
end
ChatResizerFrame.Size = UDim2.new(0, chatBarSize, 0, chatBarSize)
ChatResizerFrame.Position = UDim2.new(1, -chatBarSize, 1, -chatBarSize)
UpdateChatChannelParentFrameSize()
UpdateResizable(ChatSettings.WindowResizable)
end
local function UpdateShowChannelsBar(enabled)
ChannelsBarParentFrame.Visible = enabled
UpdateChatChannelParentFrameSize()
end
UpdateChatChannelsTabTextSize(ChatSettings.ChatChannelsTabTextSize)
UpdateChatBarTextSize(ChatSettings.ChatBarTextSize)
UpdateDraggable(ChatSettings.WindowDraggable)
UpdateResizable(ChatSettings.WindowResizable)
UpdateShowChannelsBar(ChatSettings.ShowChannelsBar)
ChatSettings.SettingsChanged:connect(function(setting, value)
if (setting == "WindowDraggable") then
UpdateDraggable(value)
elseif (setting == "WindowResizable") then
UpdateResizable(value)
elseif (setting == "ChatChannelsTabTextSize") then
UpdateChatChannelsTabTextSize(value)
elseif (setting == "ChatBarTextSize") then
UpdateChatBarTextSize(value)
elseif (setting == "ShowChannelsBar") then
UpdateShowChannelsBar(value)
end
end)
self.GuiObject = BaseFrame
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.ChatBarParentFrame = ChatBarParentFrame
self.GuiObjects.ChannelsBarParentFrame = ChannelsBarParentFrame
self.GuiObjects.ChatChannelParentFrame = ChatChannelParentFrame
self.GuiObjects.ChatResizerFrame = ChatResizerFrame
self.GuiObjects.ResizeIcon = ResizeIcon
self:AnimGuiObjects()
end
function methods:GetChatBar()
return self.ChatBar
end
function methods:RegisterChatBar(ChatBar)
self.ChatBar = ChatBar
self.ChatBar:CreateGuiObjects(self.GuiObjects.ChatBarParentFrame)
end
function methods:RegisterChannelsBar(ChannelsBar)
self.ChannelsBar = ChannelsBar
self.ChannelsBar:CreateGuiObjects(self.GuiObjects.ChannelsBarParentFrame)
end
function methods:RegisterMessageLogDisplay(MessageLogDisplay)
self.MessageLogDisplay = MessageLogDisplay
self.MessageLogDisplay.GuiObject.Parent = self.GuiObjects.ChatChannelParentFrame
end
function methods:AddChannel(channelName)
if (self:GetChannel(channelName)) then
error("Channel '" .. channelName .. "' already exists!")
return
end
local channel = moduleChatChannel.new(channelName, self.MessageLogDisplay)
self.Channels[channelName:lower()] = channel
channel:SetActive(false)
local tab = self.ChannelsBar:AddChannelTab(channelName)
tab.NameTag.MouseButton1Click:connect(function()
self:SwitchCurrentChannel(channelName)
end)
channel:RegisterChannelTab(tab)
return channel
end
function methods:GetFirstChannel()
--// Channels are not indexed numerically, so this function is necessary.
--// Grabs and returns the first channel it happens to, or nil if none exist.
for i, v in pairs(self.Channels) do
return v
end
return nil
end
function methods:RemoveChannel(channelName)
if (not self:GetChannel(channelName)) then
error("Channel '" .. channelName .. "' does not exist!")
end
local indexName = channelName:lower()
local needsChannelSwitch = false
if (self.Channels[indexName] == self:GetCurrentChannel()) then
needsChannelSwitch = true
self:SwitchCurrentChannel(nil)
end
self.Channels[indexName]:Destroy()
self.Channels[indexName] = nil
self.ChannelsBar:RemoveChannelTab(channelName)
if (needsChannelSwitch) then
local generalChannelExists = (self:GetChannel(ChatSettings.GeneralChannelName) ~= nil)
local removingGeneralChannel = (indexName == ChatSettings.GeneralChannelName:lower())
local targetSwitchChannel = nil
if (generalChannelExists and not removingGeneralChannel) then
targetSwitchChannel = ChatSettings.GeneralChannelName
else
local firstChannel = self:GetFirstChannel()
targetSwitchChannel = (firstChannel and firstChannel.Name or nil)
end
self:SwitchCurrentChannel(targetSwitchChannel)
end
if not ChatSettings.ShowChannelsBar then
if self.ChatBar.TargetChannel == channelName then
self.ChatBar:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end
function methods:GetChannel(channelName)
return channelName and self.Channels[channelName:lower()] or nil
end
function methods:GetTargetMessageChannel()
if (not ChatSettings.ShowChannelsBar) then
return self.ChatBar.TargetChannel
else
local curChannel = self:GetCurrentChannel()
return curChannel and curChannel.Name
end
end
function methods:GetCurrentChannel()
return self.CurrentChannel
end
function methods:SwitchCurrentChannel(channelName)
if (not ChatSettings.ShowChannelsBar) then
local targ = self:GetChannel(channelName)
if (targ) then
self.ChatBar:SetChannelTarget(targ.Name)
end
channelName = ChatSettings.GeneralChannelName
end
local cur = self:GetCurrentChannel()
local new = self:GetChannel(channelName)
if new == nil then
error(string.format("Channel '%s' does not exist.", channelName))
end
if (new ~= cur) then
if (cur) then
cur:SetActive(false)
local tab = self.ChannelsBar:GetChannelTab(cur.Name)
tab:SetActive(false)
end
if (new) then
new:SetActive(true)
local tab = self.ChannelsBar:GetChannelTab(new.Name)
tab:SetActive(true)
end
self.CurrentChannel = new
end
end
function methods:UpdateFrameVisibility()
self.GuiObject.Visible = (self.Visible and self.CoreGuiEnabled)
end
function methods:GetVisible()
return self.Visible
end
function methods:SetVisible(visible)
self.Visible = visible
self:UpdateFrameVisibility()
end
function methods:GetCoreGuiEnabled()
return self.CoreGuiEnabled
end
function methods:SetCoreGuiEnabled(enabled)
self.CoreGuiEnabled = enabled
self:UpdateFrameVisibility()
end
function methods:EnableResizable()
self.GuiObjects.ChatResizerFrame.Active = true
end
function methods:DisableResizable()
self.GuiObjects.ChatResizerFrame.Active = false
end
function methods:FadeOutBackground(duration)
self.ChannelsBar:FadeOutBackground(duration)
self.MessageLogDisplay:FadeOutBackground(duration)
self.ChatBar:FadeOutBackground(duration)
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInBackground(duration)
self.ChannelsBar:FadeInBackground(duration)
self.MessageLogDisplay:FadeInBackground(duration)
self.ChatBar:FadeInBackground(duration)
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeOutText(duration)
self.MessageLogDisplay:FadeOutText(duration)
self.ChannelsBar:FadeOutText(duration)
end
function methods:FadeInText(duration)
self.MessageLogDisplay:FadeInText(duration)
self.ChannelsBar:FadeInText(duration)
end
function methods:AnimGuiObjects()
self.GuiObjects.ChatChannelParentFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.ChatResizerFrame.BackgroundTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.ResizeIcon.ImageTransparency = self.AnimParams.Background_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
end
function methods:Update(dtScale)
self.ChatBar:Update(dtScale)
self.ChannelsBar:Update(dtScale)
self.MessageLogDisplay:Update(dtScale)
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
|
-- setup emote chat hook
--[[game:GetService("Players").LocalPlayer.Chatted:connect(function(msg)
local emote = ""
if (string.sub(msg, 1, 3) == "/e ") then
emote = string.sub(msg, 4)
elseif (string.sub(msg, 1, 7) == "/emote ") then
emote = string.sub(msg, 8)
end
if (pose == "Standing" and emoteNames[emote] ~= nil) then
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
end
end)--]]
| |
-- Ego's version
|
local region = {};
function region.new(cframe, size)
local self = setmetatable({}, {__index = region});
self.CFrame = cframe;
self.Planes = {
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Top)), d = -size.y / 2};
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Bottom)), d = -size.y / 2};
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Left)), d = -size.x / 2};
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Right)), d = -size.x / 2};
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Front)), d = -size.z / 2};
{n = cframe:vectorToWorldSpace(Vector3.FromNormalId(Enum.NormalId.Back)), d = -size.z / 2};
};
return self;
end;
function getCorners(part)
local size, corners = part.Size / 2, {};
for x = -1, 1, 2 do
for y = -1, 1, 2 do
for z = -1, 1, 2 do
table.insert(corners, (part.CFrame * CFrame.new(size * Vector3.new(x, y, z))).p);
end;
end;
end;
return corners;
end;
function region:CastPart(part)
local corners = getCorners(part);
for _, corner in next, corners do
local position = corner - self.CFrame.p;
local isInRegion = true;
for _, plane in next, self.Planes do
if (position:Dot(plane.n) + plane.d) >= 0 then
isInRegion = false;
break;
end;
end;
if isInRegion then
return true;
end;
end;
return false;
end;
return region;
|
-------------- I'm not responsible for any PAIN if you edit past this (pun intended)
|
local blood_folder = Instance.new("Folder",game.Workspace)
blood_folder.Name = "Blood.Splatter.Particles"
function create_blood_splatter(player_class)
local blood_parts = {"LeftFoot","LeftHand","LeftLowerArm","LeftLowerLeg","LeftUpperArm","LeftUpperLeg","LowerTorso","RightFoot","RightHand","RightLowerArm","RightLowerLeg","RightUpperArm","RightUpperLeg","UpperTorso","Head"}
local chosen_part
if(player_class.humanoid.Health <= 0) then
repeat wait() chosen_part = blood_parts[math.random(1,#blood_parts)] until player_class.character:FindFirstChild(chosen_part)
chosen_part = player_class.character[chosen_part]
local blood_emmiter = script.Blood:Clone()
blood_emmiter.Parent = chosen_part
blood_emmiter.Enabled = true
else
chosen_part = player_class.torso
end
local ray = Ray.new(chosen_part.Position, Vector3.new(0,-100,0))
local hit, position = game.Workspace:FindPartOnRayWithIgnoreList(ray, {blood_folder , unpack(player_class.character:GetChildren())} , true)
if(hit) then
local blood = Instance.new("Part",blood_folder)
blood.Anchored = true
blood.CanCollide = false
blood.Transparency = 1
blood.Name = "Particle_Blood"
blood.FormFactor = Enum.FormFactor.Custom
blood.Size = Vector3.new(0.01 , 0.1 , 0.01)
blood.CFrame = CFrame.new(position)
local blood_decal = Instance.new("Decal",blood)
blood_decal.Transparency = 1
blood_decal.Texture = "http://www.roblox.com/asset/?id=" .. blood_textures[math.random(1,#blood_textures)]
blood_decal.Face = "Top"
game.Debris:AddItem(blood,settings.remove_time+20)
local edit_blood = coroutine.wrap(function()
local original_size = blood.Size
local original_transparency = blood_decal.Transparency
local new_transparency = math.random(settings.max_transparency*100,settings.min_transparency*100)/100
local new_size = Vector3.new(math.random(settings.min_size_x*100,settings.max_size_x*100)/100 , blood.Size.Y , math.random(settings.min_size_z*100,settings.max_size_z*100)/100)
local tran_tw_time = math.random(settings.tran_tw_time_min*100,settings.tran_tw_time_max*100)/100
local size_tw_time = math.random(settings.size_tw_time_min*100,settings.size_tw_time_max*100)/100
for i = 1,10*tran_tw_time do
wait()
local perc = i/(10*tran_tw_time)
blood_decal.Transparency = original_transparency - (perc*new_transparency)
end
for i = 1,10*size_tw_time do
wait()
local perc = i/(10*size_tw_time)
blood.Size = Vector3.new(original_size.X+(perc*new_size.X) , original_size.Y , original_size.Z+(perc*new_size.Z))
end
wait(settings.remove_time)
blood:Destroy()
end)
edit_blood()
end
end
function monitor_character(player_class)
local last_health = player_class.humanoid.Health
player_class.humanoid.HealthChanged:connect(function()
if(player_class.humanoid.Health < last_health) then
if(last_health - player_class.humanoid.Health >= settings.damage_inc) then
for i = 1,settings.splatters_per_health_inc*((last_health - player_class.humanoid.Health)/settings.damage_inc) do
create_blood_splatter(player_class)
if(settings.max_splatter_time > 0) then
wait(math.random(settings.min_splatter_time*100,settings.max_splatter_time*100)/100)
end
end
end
end
last_health = player_class.humanoid.Health
end)
end
function monitor_player(player)
repeat wait() until player.Character ~= nil
player.CharacterAdded:connect(function()
local player_class = {
player = player,
character = player.Character,
torso = player.Character:WaitForChild("LowerTorso"),
head = player.Character:WaitForChild("Head"),
humanoid = player.Character:WaitForChild("Humanoid"),
}
monitor_character(player_class)
end)
local player_class = {
player = player,
character = player.Character,
torso = player.Character:WaitForChild("UpperTorso"),
head = player.Character:WaitForChild("Head"),
humanoid = player.Character:WaitForChild("Humanoid"),
}
monitor_character(player_class)
end
game.Players.PlayerAdded:connect(function(player)
monitor_player(player)
end)
for i,v in ipairs(game.Players:GetChildren()) do
if(v.ClassName == "Player") then
monitor_player(v)
end
end
|
--[[
[Instructions]
- Put the Script inside a Seat.
- Remove the GUI already inside the Script (It's just an example).
- Put your own GUI inside the script.
- Re-name the GUI to "GUI" (Without the quotation marks " ")
It should work, but tell me if it doesn't.
--]]
| |
--//Services//--
|
local Debris = game:GetService("Debris")
|
--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 >= 20
end
|
-- Local private variables and constants
|
local ZERO_VECTOR2 = Vector2.new(0,0)
local tweenAcceleration = math.rad(220) --Radians/Second^2
local tweenSpeed = math.rad(0) --Radians/Second
local tweenMaxSpeed = math.rad(250) --Radians/Second
local TIME_BEFORE_AUTO_ROTATE = 2.0 --Seconds, used when auto-aligning camera with vehicles
local PORTRAIT_OFFSET = Vector3.new(0, 2, 0)
local MOBILE_OFFSET = Vector3.new(0, 1, 0)
local INITIAL_CAMERA_ANGLE = CFrame.fromOrientation(math.rad(-15), 0, 0)
|
--- Skill
|
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Z and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "LightBarrage"
Track1 = Player.Character.Humanoid:LoadAnimation(script.Anim01)
Track1:Play()
wait(0.3)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,30 do
wait()
hum.CameraOffset = Vector3.new(
math.random(0.1,0.1),
math.random(0.1,0.1),
math.random(0.1,0.1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
Tool.Active.Value = "None"
wait(2)
Debounce = true
end
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.