prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
------------------------------------------------------WeldArm---------------------------------------------------------------
|
Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}
local neck = nil
local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
function Equip(mouse)
wait(0.01)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
head = Tool.Parent:FindFirstChild("Head")
torso = Tool.Parent:FindFirstChild("Torso")
if neck == nil then
neck = Tool.Parent:FindFirstChild("Torso").Neck
end
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Name = "weld1"
weld1.Part0 = head
weld1.Parent = head
weld1.Part1 = arms[1]
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Name = "weld2"
weld2.Part0 = head
weld2.Parent = head
weld2.Part1 = arms[2]
welds[2] = weld2
|
--["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,-10,0)),char)
if target.Value then
local facingCFrame = CFrame.new(Vector3.new(root.CFrame.X,pos.Y+10,root.CFrame.Z),CFrame.new(target.Value.CFrame.X,pos.Y+10,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*10
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 true do
local thresh,nearest = 60,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 < 10 then
anims["SwingTool"]:Play()
nearest.Parent.Humanoid:TakeDamage(24)
target.Value = nil
task.wait(1)
end
target.Value = nearest
else
target.Value = nil
end
task.wait(1)
end
|
--[[Engine]]
--Torque Curve
|
Tune.Horsepower = 4500 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 2000 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 4500 -- Use sliders to manipulate values
Tune.Redline = 10000
Tune.EqPoint = 7500
Tune.PeakSharpness = 16
Tune.CurveMult = 4
|
--[=[
@interface KnitOptions
.ServicePromises boolean?
.Middleware Middleware?
.PerServiceMiddleware PerServiceMiddleware?
@within KnitClient
- `ServicePromises` defaults to `true` and indicates if service methods use promises.
- Each service will go through the defined middleware, unless the service
has middleware defined in `PerServiceMiddleware`.
]=]
|
type KnitOptions = {
ServicePromises: boolean,
Middleware: Middleware?,
PerServiceMiddleware: PerServiceMiddleware?,
}
local defaultOptions: KnitOptions = {
ServicePromises = true,
Middleware = nil,
PerServiceMiddleware = {},
}
local selectedOptions = nil
|
--[[ This script removes the border part.
The border parts are there to make sure when you pawn the model in, that it's not tilted.]]
|
wait()
script.Parent:Destroy()
|
-- Services
|
local Players = game:GetService('Players')
local TweenService = game:GetService('TweenService')
local Debris = game:GetService('Debris')
|
-- 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, 0.1, Humanoid)
end
end)
|
--for _,Spawn in next,Rep.Spawns:GetDescendants() do
-- if Spawn:IsA("BasePart") and allowedParents[Spawn.Parent.Name] then
-- if not Spawn:FindFirstChild("Radius") then
-- table.insert(_G.Safezones, {["Position"] = Spawn.Position, ["Magnitude"] = 30})
-- else
-- local radi = Spawn:FindFirstChild("Radius").Value
-- table.insert(_G.Safezones, {["Position"] = Spawn.Position, ["Magnitude"] = radi})
-- end
-- end
--end
| |
-- NPC animation script (will be added to dropper)
|
local Worker = script.Parent
while true do
local animationTrack = Worker.Char.Humanoid:LoadAnimation(Worker.Animations.WorkerAnim)
animationTrack:Play()
wait(1)
end
|
--reset
|
script.Parent.Mode.Value = 1
end
end)
script.Parent.Mode.Changed:connect(function()
if script.Parent.Mode.Value == 1 then
script.Parent.B1.Transparency = 0
script.Parent.Main.Transparency = 1
script.Parent.B2.Transparency = 1
elseif script.Parent.Mode.Value == 2 then
script.Parent.B1.Transparency = 1
script.Parent.Main.Transparency = 0
script.Parent.B2.Transparency = 1
elseif script.Parent.Mode.Value == 3 then
script.Parent.B1.Transparency = 1
script.Parent.Main.Transparency = 1
script.Parent.B2.Transparency = 0
end
end)
script.Parent.Main.ClickDetector.MouseClick:connect (ChangeMode)
|
--[[
Is the given object a Promise instance?
]]
|
function Promise.is(object)
if type(object) ~= "table" then
return false
end
return object._type == "Promise"
end
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = true --- Automatically operates the bolt on reload if needed
,SlideLock = false
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = true
,CanBreak = true --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = true --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = true --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 8
,GunFOVReduction = 8
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
--[[
local missile = Instance.new("Part")
missile.Position = spawnPos
missile.Size = Vector3.new(2,2,2)
missile.Velocity = v * 200
missile.BrickColor = BrickColor.random() -- BrickColor.new(26)
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "Cannon Shot"
missile.Elasticity = 1
missile.Reflectance = 0
missile.Friction = 0
Tool.Handle.Boing:clone().Parent = missile
local new_script = script.Parent.CannonBall:clone()
new_script.Disabled = false
new_script.Parent = missile
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
]]
|
connection:disconnect()
wait()
Tool.Parent = game.Workspace
Tool.Handle.Position = spawnPos
Tool.Handle.Velocity = v * 175
end
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]]
|
--
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
local u2 = Random.new();
return function(p1, p2)
if p2 then
p1 = u2:NextNumber(p1, p2);
end;
task.wait(p1);
end;
|
-- local input = game:GetService('UserInputService');
|
Mouse.KeyDown:connect(function(key)
key = string.lower(key)
if string.byte(key) == 48 then -- Shift Number
if Debounce == false then
Debounce = true
C.Humanoid.WalkSpeed = 28 -- Você pode mudar pra tal numero
for i=1,10 do
game.Workspace.CurrentCamera.FieldOfView = (70 + (i * 2))
wait()
end;
end;
end;
end);
|
------------------------------------------------------------------------
-- emit a set list instruction if enough elements (LFIELDS_PER_FLUSH)
-- * used in constructor()
------------------------------------------------------------------------
|
function luaY:closelistfield(fs, cc)
if cc.v.k == "VVOID" then return end -- there is no list item
luaK:exp2nextreg(fs, cc.v)
cc.v.k = "VVOID"
if cc.tostore == luaP.LFIELDS_PER_FLUSH then
luaK:setlist(fs, cc.t.info, cc.na, cc.tostore) -- flush
cc.tostore = 0 -- no more items pending
end
end
|
-- Placeholder texture can be any roblox asset link
|
local initialTexture = ""
local RowCount = 5
local ColCount = 3
local perImageSpriteCount = RowCount * ColCount
local width = 320
local height = 200
local framesInTotal = 26
assert(numImages * RowCount * ColCount >= framesInTotal)
local animPeriod = 1 -- period for the whole animation, in seconds
assert(animPeriod > 0)
local curImageIdx = 0
local curSpriteIdx = 0
local fps = framesInTotal / animPeriod
local accumulatedTime = 0
local function AnimateImageSpriteSheet(dt)
accumulatedTime = math.fmod(accumulatedTime + dt, animPeriod)
curSpriteIdx = math.floor(accumulatedTime * fps)
local prevImageIndex = curImageIdx
curImageIdx = math.floor(curSpriteIdx / perImageSpriteCount)
if prevImageIndex ~= curImageIdx then
imageInstance.Image = imageAssetIDs[curImageIdx + 1]
end
local localSpriteIndex = curSpriteIdx - curImageIdx * perImageSpriteCount
local row = math.floor(localSpriteIndex / ColCount)
local col = localSpriteIndex - row * ColCount
imageInstance.ImageRectOffset = Vector2.new(col * width, row * height)
end
Animator.Connection = nil
Animator.Init = function()
Animator.Connection = game:GetService("RunService").RenderStepped:Connect(AnimateImageSpriteSheet)
end
Animator.Stop = function()
if Animator.Connection then
imageInstance.Image = initialTexture
Animator.Connection:Disconnect()
end
end
return Animator
|
---------------------------------
---Day/Night Script for Blocks---
---------------------------------
|
b = script.Parent
local oh,om = 6,10 -- Open Time (hours,minutes) DON'T TOUCH!
local ch,cm = 17,30 -- Close Time (hours, minutes) DON'T TOUCH!
local l = game:service("Lighting")
if (om == nil) then om = 0 end
if (cm == nil) then cm = 0 end
function TimeChanged()
local ot = (oh + (om/60)) * 60
local ct = (ch + (cm/60)) * 60
if (ot < ct) then
if (l:GetMinutesAfterMidnight() >= ot) and (l:GetMinutesAfterMidnight() <= ct) then
b.Material = ("SmoothPlastic")
b.Color = Color3.fromRGB(255, 195, 0)
else
b.Material = ("Neon")
b.Color = Color3.fromRGB(180, 135, 0)
end
elseif (ot > ct) then
if (l:GetMinutesAfterMidnight() >= ot) or (l:GetMinutesAfterMidnight() <= ct) then
b.Material = ("SmoothPlastic")
b.Color = Color3.fromRGB(255, 195, 0)
else
b.Material = ("Neon")
b.Color = Color3.fromRGB(180, 135, 0)
end
end
end
TimeChanged()
game.Lighting.Changed:connect(function(property)
if (property == "TimeOfDay") then
TimeChanged()
end
end)
|
--Unordered service loading
|
for _,Module in packages:GetChildren() do
if string.find(string.lower(Module.Name), "service") and Module.Name ~= "ServiceBag" then
serviceBag:GetService(Module)
end
end
serviceBag:Init()
serviceBag:Start()
|
--SMOOTHDRIVE TECHNOLOGY BOGIE CONTROLLER
--Copyright 2017 NsNidPL. All rights resrved.
| |
-- Connections
|
Players.PlayerAdded:Connect(onPlayerAdded)
|
--doomSuite = {
--fogColor = Color3.fromRGB(205, 0, 29),
--fogDist = 1200,
--brightness = 2.5,
--},
|
}
return module
|
-- spawn a random ore
|
local oreName = oreBank[math.random(1,#oreBank)]
GU.SpawnItem(oreName,1,root.CFrame*CFrame.new(0,1,0))
end
end)
AttitudeCoroutine()
while true do
if mode == "charLock" then
targetLocation = (charRoot.CFrame*CFrame.new(-3,-2.6,1)).p
targetLook = charRoot.CFrame*CFrame.new(charRoot.CFrame.lookVector*1000)
end
bg.CFrame = targetLook
bp.Position = targetLocation
wait()
end
|
-- FACES
|
x2FacesButton.MouseEnter:Connect(function()
x2FacesButton.Text = "179 R$"
x2FacesButton.TextColor3 = Color3.fromRGB(0, 255, 0)
end)
x2FacesButton.MouseLeave:Connect(function()
x2FacesButton.Text = "BUY"
x2FacesButton.TextColor3 = Color3.fromRGB(255, 255, 255)
end)
|
-- Define the function to open or close the window with gene-alike effect
|
local function toggleWindow(button)
local windowName = button.Name
-- Find the corresponding frame in the AppManager using the window name
local window = gui:FindFirstChild(windowName)
if window then
if window.Visible == false then
-- Close other windows
for _, child in ipairs(gui:GetChildren()) do
if child:IsA("Frame") and child.Visible then
end
end
local startPos = UDim2.new(0.0, 0, 0.978, 0)
window.Position = startPos
-- Set the initial size of the window to be zero
window.Size = UDim2.new(1, 0, 0.022, 0)
-- Show the window and tween its position and size from the button position and size to its original position and size
window.Visible = true
window:TweenSizeAndPosition(
UDim2.new(1, 0, 0.597, 0),
UDim2.new(0, 0, 0.403, 0),
'Out',
'Quad',
0.2
)
end
end
end
|
--- Transparency ---
|
button.MouseEnter:Connect(function()
TweenService:Create(leftarrow, Info, {TextTransparency = 0}):Play()
TweenService:Create(rightarrow, Info, {TextTransparency = 0}):Play()
end)
button.MouseLeave:Connect(function()
TweenService:Create(leftarrow, Info, {TextTransparency = 1}):Play()
TweenService:Create(rightarrow, Info, {TextTransparency = 1}):Play()
end)
|
-- Local Functions
|
local MakeFlag
local function DestroyFlag(flagObject)
flagObject.Flag:Destroy()
for player, object in pairs(FlagCarriers) do
if object == flagObject then
FlagCarriers[player] = nil
end
end
end
local function OnCarrierDied(player)
local flagObject = FlagCarriers[player]
if flagObject then
local flagPole = flagObject.FlagPole
local flagBanner = flagObject.FlagBanner
flagPole.CanCollide = false
flagBanner.CanCollide = false
flagPole.Anchored = true
flagBanner.Anchored = true
flagObject.PickedUp = false
FlagCarriers[player] = nil
if Configurations.RETURN_FLAG_ON_DROP then
wait(Configurations.FLAG_RESPAWN_TIME)
if not flagObject.AtSpawn and not flagObject.PickedUp then
DestroyFlag(flagObject)
MakeFlag(flagObject)
ReturnFlag:Fire(flagObject.FlagBanner.BrickColor)
end
end
end
end
local function PickupFlag(player, flagObject)
FlagCarriers[player] = flagObject
flagObject.AtSpawn = false
flagObject.PickedUp = true
local torso = player.Character:FindFirstChild('Torso')
local flagPole = flagObject.FlagPole
local flagBanner = flagObject.FlagBanner
flagPole.Anchored = false
flagBanner.Anchored = false
flagPole.CanCollide = false
flagBanner.CanCollide = false
local weld = Instance.new('Weld', flagPole)
weld.Name = 'PlayerFlagWeld'
weld.Part0 = flagPole
weld.Part1 = torso
weld.C0 = CFrame.new(0,0,-1)
end
local function BindFlagTouched(flagObject)
local flagPole = flagObject.FlagPole
local flagBanner = flagObject.FlagBanner
flagPole.Touched:connect(function(otherPart)
local player = Players:GetPlayerFromCharacter(otherPart.Parent)
if not player then return end
if not player.Character then return end
local humanoid = player.Character:FindFirstChild('Humanoid')
if not humanoid then return end
if humanoid.Health <= 0 then return end
if flagBanner.BrickColor ~= player.TeamColor and not flagObject.PickedUp then
PickupFlag(player, flagObject)
elseif flagBanner.BrickColor == player.TeamColor and not flagObject.AtSpawn and Configurations.FLAG_RETURN_ON_TOUCH then
DestroyFlag(flagObject)
MakeFlag(flagObject)
ReturnFlag:Fire(flagObject.FlagBanner.BrickColor)
end
end)
end
function MakeFlag(flagObject)
flagObject.Flag = flagObject.FlagCopy:Clone()
flagObject.Flag.Parent = flagObject.FlagContainer
flagObject.FlagPole = flagObject.Flag.FlagPole
flagObject.FlagBanner = flagObject.Flag.FlagBanner
flagObject.FlagBanner.CanCollide = false
flagObject.AtSpawn = true
flagObject.PickedUp = false
BindFlagTouched(flagObject)
end
local function BindBaseTouched(flagObject)
local flagBase = flagObject.FlagBase
flagBase.Touched:connect(function(otherPart)
local player = Players:GetPlayerFromCharacter(otherPart.Parent)
if not player then return end
if flagBase.BrickColor == player.TeamColor and FlagCarriers[player] then
CaptureFlag:Fire(player)
local otherFlag = FlagCarriers[player]
DestroyFlag(otherFlag)
MakeFlag(otherFlag)
end
end)
end
local function OnPlayerAdded(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild('Humanoid').Died:connect(function() OnCarrierDied(player) end)
end)
player.CharacterRemoving:connect(function()
OnCarrierDied(player)
end)
end
|
-- Local player
|
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local humanoidRoot = character:WaitForChild("HumanoidRootPart")
|
-- Output from buffer.
|
function ChangeBuffer:moveLinesTo(lines: Array<Diff>): ()
if not self:isLineEmpty() then
self:pushLine()
end
for _, value in ipairs(self.lines) do
table.insert(lines, value)
end
self.lines = {}
end
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Crimson",Paint)
end)
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{71,61,59,41,30,56,58},t},
[49]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{71,61,59,41,30,56,58,20,19},t},
[59]={{71,61,59},t},
[63]={{71,61,59,41,30,56,58,23,62,63},t},
[34]={{71,61,59,41,39,35,34},t},
[21]={{71,61,59,41,30,56,58,20,21},t},
[48]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{71,61,59,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{71,61,59,41,39,35,34,32,31},t},
[56]={{71,61,59,41,30,56},t},
[29]={{71,61,59,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{71,61,59,41,39,35,34,32,31,29,28,44,45},t},
[57]={{71,61,59,41,30,56,57},t},
[36]={{71,61,59,41,39,35,37,36},t},
[25]={{71,61,59,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{71},t},
[20]={{71,61,59,41,30,56,58,20},t},
[60]={{71,61,60},t},
[8]={n,f},
[4]={n,f},
[75]={{71,72,76,73,75},t},
[22]={{71,61,59,41,30,56,58,20,21,22},t},
[74]={{71,72,76,73,74},t},
[62]={{71,61,59,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{71,61,59,41,39,35,37},t},
[2]={n,f},
[35]={{71,61,59,41,39,35},t},
[53]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{71,72,76,73},t},
[72]={{71,72},t},
[33]={{71,61,59,41,39,35,37,36,33},t},
[69]={{71,61,69},t},
[65]={{71,61,59,41,30,56,58,20,19,66,64,65},t},
[26]={{71,61,59,41,39,35,34,32,31,29,28,27,26},t},
[68]={{71,61,59,41,30,56,58,20,19,66,64,67,68},t},
[76]={{71,72,76},t},
[50]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{71,61,59,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{71,61,59,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{71,61,59,41,30,56,58,23},t},
[44]={{71,61,59,41,39,35,34,32,31,29,28,44},t},
[39]={{71,61,59,41,39},t},
[32]={{71,61,59,41,39,35,34,32},t},
[3]={n,f},
[30]={{71,61,59,41,30},t},
[51]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{71,61,59,41,30,56,58,20,19,66,64,67},t},
[61]={{71,61},t},
[55]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{71,61,59,41,39,40,38,42},t},
[40]={{71,61,59,41,39,40},t},
[52]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{71,61,59,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{71,61,59,41},t},
[17]={n,f},
[38]={{71,61,59,41,39,40,38},t},
[28]={{71,61,59,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{71,61,59,41,30,56,58,20,19,66,64},t},
}
return r
|
---Creator function return object keys
|
local KEY_BASE_FRAME = "BaseFrame"
local KEY_BASE_MESSAGE = "BaseMessage"
local KEY_UPDATE_TEXT_FUNC = "UpdateTextFunction"
local KEY_GET_HEIGHT = "GetHeightFunction"
local KEY_FADE_IN = "FadeInFunction"
local KEY_FADE_OUT = "FadeOutFunction"
local KEY_UPDATE_ANIMATION = "UpdateAnimFunction"
|
--None of this is mine...
|
Tool = script.Parent;
local arms = nil
local torso = nil
local welds = {}
script.act.OnServerEvent:Connect(function()
wait(0.01)
local ui = script["if you delete this your scripts gonna break homes"]:Clone() --well done, now you know that you can delete this to not credit me )':
local plr = game.Players:GetPlayerFromCharacter(Tool.Parent)
ui.Parent = plr.PlayerGui
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Name = "weld1"
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(1.2, 0, 0.) * CFrame.fromEulerAnglesXYZ(math.rad(-10), math.rad(-6), 0)
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Name = "weld2"
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.2, 1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), -.4)
welds[2] = weld2
end
else
print("sh")
end
else
print("arms")
end
end)
arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
torso = Tool.Parent:FindFirstChild("Torso")
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = nil
sh[2].Part1 = nil
local weld1 = Instance.new("Weld")
weld1.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(1.2, 0, 0.) * CFrame.fromEulerAnglesXYZ(math.rad(-10), math.rad(-6), 0)
welds[1] = weld1
local weld2 = Instance.new("Weld")
weld2.Name = "weld2"
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1.2, 1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-5), -.4)
welds[2] = weld2
weld2.Name = "weld2"
end
else
print("sh")
end
else
print("arms")
end;
script.dct.OnServerEvent:Connect(function()
local ui = script.Parent.Parent.Parent.PlayerGui["if you delete this your scripts gonna break homes"]
ui:Destroy()
if arms ~= nil and torso ~= nil then
local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
if sh ~= nil then
local yes = true
if yes then
yes = false
sh[1].Part1 = arms[1]
sh[2].Part1 = arms[2]
welds[1].Parent = nil
welds[2].Parent = nil
end
else
print("sh")
end
else
end
end)
|
--Prefabricate objects
|
local Camera = Instance.new("Camera")
Camera.FieldOfView = 20
local ViewportFrame = Instance.new("ViewportFrame")
ViewportFrame.BackgroundColor3 = Color3.new()
ViewportFrame.BackgroundTransparency = 1
ViewportFrame.LightDirection = Vector3.new(0,1,0)
ViewportFrame.Ambient = Color3.new(1,1,1)
ViewportFrame.Size = UDim2.new(0,100,0,100)
local Decal = Instance.new("Decal")
Decal.Face = Enum.NormalId.Top
|
--todo: remove this once TouchTapInWorld is on all platforms
|
local touchWorkspaceEventEnabled = pcall(function() local test = UserInputService.TouchTapInWorld end)
local function layoutGestureArea(portraitMode)
if GestureArea and not GestureAreaManagedByControlScript then
if portraitMode then
GestureArea.Size = UDim2.new(1, 0, .6, 0)
GestureArea.Position = UDim2.new(0, 0, 0, 0)
else
GestureArea.Size = UDim2.new(1, 0, .5, -18)
GestureArea.Position = UDim2.new(0, 0, 0, 0)
end
end
end
|
--[[ Version ]]
|
module.MajorVersion = 0
module.MinorVersion = 8
module.BuildVersion = "2018.05.16"
|
-------------------------
|
function onClicked()
R.Function1.Disabled = true
FX.ROLL.BrickColor = BrickColor.new("CGA brown")
FX.ROLL.loop.Disabled = true
FX.REVERB.BrickColor = BrickColor.new("CGA brown")
FX.REVERB.loop.Disabled = true
FX.GATE.BrickColor = BrickColor.new("CGA brown")
FX.GATE.loop.Disabled = true
FX.PHASER.BrickColor = BrickColor.new("CGA brown")
FX.PHASER.loop.Disabled = true
FX.SLIPROLL.BrickColor = BrickColor.new("CGA brown")
FX.SLIPROLL.loop.Disabled = true
FX.FILTER.BrickColor = BrickColor.new("CGA brown")
FX.FILTER.loop.Disabled = true
FX.ECHO.BrickColor = BrickColor.new("CGA brown")
FX.ECHO.loop.Disabled = true
FX.TRANS.BrickColor = BrickColor.new("CGA brown")
FX.TRANS.loop.Disabled = true
FX.MultiTapDelay.BrickColor = BrickColor.new("CGA brown")
FX.MultiTapDelay.loop.Disabled = true
FX.DELAY.BrickColor = BrickColor.new("CGA brown")
FX.DELAY.loop.Disabled = true
FX.REVROLL.BrickColor = BrickColor.new("CGA brown")
FX.REVROLL.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Gets a part from the cache, or creates one if no more are available.
|
function PartCacheStatic:GetPart(): BasePart
assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("GetPart", "PartCache.new"))
if #self.Open == 0 then
warn("No parts available in the cache! Creating [" .. self.ExpansionSize .. "] new part instance(s) - this amount can be edited by changing the ExpansionSize property of the PartCache instance... (This cache now contains a grand total of " .. tostring(#self.Open + #self.InUse + self.ExpansionSize) .. " parts.)")
for i = 1, self.ExpansionSize, 1 do
table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
end
end
local part = self.Open[#self.Open]
self.Open[#self.Open] = nil
table.insert(self.InUse, part)
return part
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
script.Parent.Humanoid:ApplyDescription(game.Players:GetHumanoidDescriptionFromUserId(game.CreatorId));
script.Parent.Humanoid.BodyDepthScale.Value = script.Parent.Humanoid.BodyDepthScale.Value * 100;
script.Parent.Humanoid.BodyWidthScale.Value = script.Parent.Humanoid.BodyWidthScale.Value * 100;
script.Parent.Humanoid.BodyHeightScale.Value = script.Parent.Humanoid.BodyHeightScale.Value * 100;
script.Parent.Humanoid.HeadScale.Value = script.Parent.Humanoid.HeadScale.Value * 100;
script.Parent.Humanoid.BodyProportionScale.Value = script.Parent.Humanoid.BodyProportionScale.Value;
|
--On lines 10 and 29 change Gold to the name of your money and Exp to the stat you wish to upgrade.
|
local Humanoid = script.Parent.Humanoid -- Change Enemy to the name of your Monsters Humanoid
function PwntX_X()
local tag = Humanoid:findFirstChild("creator")
if tag ~= nil then
if tag.Value ~= nil then
local Leaderstats = tag.Value:findFirstChild("leaderstats")
if Leaderstats ~= nil then
Leaderstats.ABFightCoins.Value = Leaderstats.ABFightCoins.Value + 2 --How Much Money Given
wait(0.1)
script:remove()
end
end
end
end
Humanoid.Died:connect(PwntX_X)
|
--- RUNTIME ---
|
Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
if Debounce == true then return end
-- Clone script.Indicator to Character.Face, rotate, float via StudsOffset tween, and fade a BillboardGui damage indicator when the dummy is attacked
-- Get the damage dealt
local Damage = Humanoid.MaxHealth - Humanoid.Health
Debounce = true
Humanoid.Health += Damage
Debounce = false
-- Clone script.Indicator to Character.Face
local Indicator = script.Indicator:Clone()
Indicator.Enabled = true
Indicator.Parent = Character.Face
Indicator.TextLabel.Text = Damage
-- Rotate the indicator a random amount of degrees
Indicator.StudsOffset = Vector3.new(math.random(-15,15)/10,3,math.random(-50,50)/100)
Indicator.TextLabel.Rotation = math.random(-30, 30)
-- Float via StudsOffset tween and fade out over time with BillboardGui's TextTransparency property
local Tween = TweenService:Create(Indicator, TweenInfo.new(3, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {StudsOffset = Vector3.new(Indicator.StudsOffset.X, math.random(30,60)/10, Indicator.StudsOffset.Z)})
Tween:Play()
local Tween = TweenService:Create(Indicator.TextLabel, TweenInfo.new(3, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {TextTransparency = 1})
Tween:Play()
local Tween = TweenService:Create(Indicator.TextLabel, TweenInfo.new(3, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {TextStrokeTransparency = 1})
Tween:Play()
task.wait(3)
Indicator:Destroy()
end)
|
--mayo's pedal script
|
local mouse = game.Players.LocalPlayer:GetMouse()
local car = script.Parent.Car.Value
local handler = car:WaitForChild("PedalsFE")
script.Parent.Values.Throttle.Changed:connect(function()
local gas = script.Parent.Values.Throttle.Value^1*math.rad(32)
handler:FireServer("PedalUpdate","Gas",gas)
end)
script.Parent.Values.Brake.Changed:connect(function()
local bp = script.Parent.Values.Brake.Value^1*math.rad(26)
handler:FireServer("PedalUpdate","Brake",bp)
end)
script.Parent.Values.Gear.Changed:connect(function()
handler:FireServer("PedalUpdate","Clutch",0.55)
end)
script.Parent.Values.PBrake.Changed:connect(function()
if script.Parent.Values.PBrake.Value == true then
handler:FireServer("PBrake")
end
end)
script.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Values.Gear.Changed then
handler:FireServer("Pedal")
wait(.15)
handler:FireServer("Shift")
end
end)
mouse.KeyDown:connect(function(key)
if script.Parent.Values.MouseSteerOn.Value == false and key=="w" then
handler:FireServer("Pedal")
end
end)
mouse.KeyDown:connect(function(key)
if script.Parent.Values.MouseSteerOn.Value == false and key=="s" then
handler:FireServer("Pedal")
end
end)
mouse.Button1Down:connect(function()
if script.Parent.Values.MouseSteerOn.Value == true then
handler:FireServer("Pedal")
end
end)
mouse.Button2Down:connect(function()
if script.Parent.Values.MouseSteerOn.Value == true then
handler:FireServer("Pedal")
end
end)
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
function methods:CreateGuiObjects(targetParent)
local BaseFrame = Instance.new("Frame")
BaseFrame.BackgroundTransparency = 1
BaseFrame.Active = ChatSettings.WindowDraggable
BaseFrame.Parent = targetParent
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
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
|
--[[Main.Radios.BuyRadio.Get.MouseButton1Click:connect(function()
game.ReplicatedStorage.GetRadio:FireServer();
end)]]
| |
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
|
return function(data)
local gui = script.Parent.Parent
local playergui = service.PlayerGui
local str = data.Message
local time = data.Time or 15
--client.UI.Make("HintHolder")
local container = client.UI.Get("HintHolder",nil,true)
if not container then
local holder = service.New("ScreenGui")
local hTable = client.UI.Register(holder)
local frame = service.New("ScrollingFrame", holder)
client.UI.Prepare(holder)
hTable.Name = "HintHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(1, 0, 0,150)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
container = hTable
hTable:Ready()
end
container = container.Object.Frame
--// First things first account for notif :)
local notif = client.UI.Get("Notif")
if notif then
container.Position = UDim2.new(0,0,0,30)
else
container.Position = UDim2.new(0,0,0,0)
end
local children = container:children()
gui.Position = UDim2.new(0,0,0,-100)
gui.Frame.msg.Text = str
local bounds = gui.Frame.msg.TextBounds.X
local function moveGuis(m,ignore)
m = m or 0
local max = #container:children()
for i,v in pairs(container:children()) do
if v~=ignore then
local y = (i+m)*28
v.Position = UDim2.new(0,0,0,y)
if i~=max then v.Size = UDim2.new(1,0,0,28) end
end
end
end
local lom = -1
moveGuis(-1)
gui.Parent = container
if #container:children()>5 then lom = -2 end
UDim2.new(0,0,0,(#container:children()+lom)*28)
moveGuis(-1)
--gui:TweenPosition(UDim2.new(0,0,0,(#container:children()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)
if #container:children()>5 then
local gui = container:children()[1]
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
wait(data.Time or 5)
if gui and gui.Parent then
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
end
|
--CONFIG VARIABLES
|
local tweenTime = 13
local closeWaitTime = 3
local easingStyle = Enum.EasingStyle.Quad
local easingDirection = Enum.EasingDirection.InOut
local repeats = 0
local reverse = false
local delayTime = 0
|
-- Define the function to open or close the window with gene-alike effect
|
local function toggleWindow()
if window.Visible then
window.Visible = false
end
end
|
-- UTC (year, month, day, hour, minute)
|
local FIRST_EVER_SHOW = DateTime.fromUniversalTime(year, month, day, hour, minute, second, millisecond).UnixTimestampMillis/1000
|
--Functions--
|
UIS.InputBegan:Connect(function(input, isTyping)
if isTyping then return end
if input.KeyCode == Enum.KeyCode.F and Enabled == true and Usable == true then
ButtonDown = true
Key = "F"
script.Function:FireServer("Mochi Roll", mouse.Hit.Position)
local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(25000,0,25000)
BV.Parent = c.HumanoidRootPart
while ButtonDown == true do
c.HumanoidRootPart.CFrame = CFrame.new(c.HumanoidRootPart.Position, Vector3.new(mouse.Hit.Position.X,c.HumanoidRootPart.Position.Y,mouse.Hit.Position.Z))
BV.Velocity = c.HumanoidRootPart.CFrame.lookVector * 75
RS.Heartbeat:Wait()
end
Enabled = true
BV:Destroy()
end
end)
UIS.InputEnded:Connect(function(input, IsTyping)
if IsTyping then return end
if input.KeyCode == Enum.KeyCode.F and Key == "F" then
--FireServer--
script.Function:FireServer("Release", mouse.Hit.Position)
ButtonDown = false
Key = nil
end
end)
|
--[[
ROBLOX TODO: add default generic param when possible
original code:
export const setState = <State extends MatcherState = MatcherState>(
]]
|
local function setState<State>(state: Partial<State>): ()
Object.assign(_G[JEST_MATCHERS_OBJECT].state, state)
end
|
--[=[
@within Comm
@prop ServerComm ServerComm
]=]
--[=[
@within Comm
@prop ClientComm ClientComm
]=]
| |
------------------------------------------------------------------------------------------------------------------------------------------------------
|
LocalMouse.WheelForward:connect(function()
if (CameraZoomCount + 1) <= MaxCameraZoomCount then
CameraZoomCount = CameraZoomCount + 1
end
end)
LocalMouse.WheelBackward:connect(function()
if (CameraZoomCount - 1) >= -MaxCameraZoomCount then
CameraZoomCount = CameraZoomCount - 1
end
end)
RunService.RenderStepped:connect(function(delta)
if LocalPlayer.Character then
local Head = LocalPlayer.Character:WaitForChild('Head')
local Diff = CameraZoomCount * delta
LocalCamera.CFrame = LocalCamera.CFrame:lerp(
CFrame.new(Head.CFrame.X, Head.CFrame.Y, Head.CFrame.Z)
* CFrame.new(0, 10, -12.5)
* CFrame.new(0, -Diff + (0.7 ^ CameraZoomCount), Diff)
* CFrame.Angles(0, math.rad(180), 0)
* CFrame.Angles(math.rad(-45 + (1.75 ^ CameraZoomCount) + (CameraZoomCount * 2)), 0, 0), 0.25)
end
end)
|
-- Also set this to true if you want the thumbstick to not affect throttle, only triggers when a gamepad is conected
|
local onlyTriggersForThrottle = false
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local betterHandlingInputStatesFlagExists, betterHandlingInputStatesFlagEnabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserBetterHandlingVehicleInputStates")
end)
local FFlagBetterHandlingVehicleInputStates = betterHandlingInputStatesFlagExists and betterHandlingInputStatesFlagEnabled
local FFlagUserClickToMoveFollowPathRefactorSuccess, FFlagUserClickToMoveFollowPathRefactorResult = pcall(function() return UserSettings():IsUserFeatureEnabled("UserClickToMoveFollowPathRefactor") end)
local FFlagUserClickToMoveFollowPathRefactor = FFlagUserClickToMoveFollowPathRefactorSuccess and FFlagUserClickToMoveFollowPathRefactorResult
local AUTO_PILOT_DEFAULT_MAX_STEERING_ANGLE = 35
|
---------------Explosion Properties-----------
|
local Force = 150000
local Radius = 7
|
-- Connect mobile sprint button state change to update walk speed
|
if UserInputService.TouchEnabled then
local sprintButton = game:GetService("ReplicatedStorage"):WaitForChild("SprintButton")
sprintButton.ButtonStateChanged:Connect(updateWalkSpeed)
end
|
-- setup helper functions
|
local insertBoundingBoxOverlapVector = Vector3.new(.3, .3, .3) -- we can still stamp if our character extrudes into the target stamping space by .3 or fewer units
|
--made by Bertox
--lul
|
script.Parent.Parent.Parent.Parent.Electrics.Changed:connect(function()
if script.Parent.Parent.Parent.Parent.Electrics.Value == true then
script.Parent.Material = Enum.Material.Neon
else
script.Parent.Material = Enum.Material.Glass
end
end)
|
-- Directions of resizing for each handle's dragged face
|
local AxisSizeMultipliers = {
[Enum.NormalId.Top] = Vector3.new(0, 1, 0);
[Enum.NormalId.Bottom] = Vector3.new(0, 1, 0);
[Enum.NormalId.Front] = Vector3.new(0, 0, 1);
[Enum.NormalId.Back] = Vector3.new(0, 0, 1);
[Enum.NormalId.Left] = Vector3.new(1, 0, 0);
[Enum.NormalId.Right] = Vector3.new(1, 0, 0);
};
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5
local slash_damage = 10
local lunge_damage = 15
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.Torso
wait(.1)
swordOut()
wait(.1)
force.Parent = nil
wait(.2)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Modules
|
local ActionManager = {}
local Actions = {}
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Army Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1, 1, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -0.15, 0.03)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-----------------------------------------------------------------------------------------------
|
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local gauges = script.Parent
local values = script.Parent.Parent.Values
local isOn = script.Parent.Parent.IsOn
local RPM = 0
local RPM2 = 0
gauges:WaitForChild("Tach")
gauges:WaitForChild("ln")
gauges:WaitForChild("bln")
gauges:WaitForChild("Gear")
car.DriveSeat.HeadsUpDisplay = false
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
local BST = 0
if _Tune.Aspiration == "Single" then
BST = _Tune.Boost
end
if _Tune.Aspiration == "Double" then
BST = _Tune.Boost*2
end
if _Tune.Aspiration == "Super" then
BST = _Tune.Boost
end
|
-- -- Go through each valid target to see if within field of view and if there is
-- -- clear line of sight. Field of view treated as wedge in front of character.
-- for _, character in pairs(characters) do
-- local toTarget = (character.HumanoidRootPart.Position - model.HumanoidRootPart.Position)
-- toTarget = Vector3.new(toTarget.X, 0, toTarget.Z)
-- local angle = math.acos(toTarget:Dot(model.HumanoidRootPart.CFrame.lookVector)/toTarget.magnitude)
-- if math.deg(angle) < configs["FieldOfView"]/2 then
-- ZombieTarget = character
-- -- raycast to see if target is actually visible
-- local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
-- local part, position = game.Workspace:FindPartOnRayWithIgnoreList(toTarget, zombies)
-- if part and part.Parent == ZombieTarget then
-- return true
-- end
-- ZombieTarget = nil
-- end
-- end
|
end
return false
end
CanSeeTarget.TransitionState = PursueState
-- TargetDead: Check if target is dead.
local TargetDead = StateMachine.NewCondition()
TargetDead.Name = "TargetDead"
TargetDead.Evaluate = function()
if ZombieTarget and ZombieTarget.Humanoid then
return ZombieTarget.Humanoid.Health <= 0
end
return true
end
TargetDead.TransitionState = IdleState
-- GotDamaged: Check if NPC has taken damage
local lastHealth = model.Humanoid.Health
local GotDamaged = StateMachine.NewCondition()
GotDamaged.Name = "GotDamaged"
GotDamaged.Evaluate = function()
if model then
if lastHealth > model.Humanoid.Health then
return true
end
end
return false
end
GotDamaged.TransitionState = SearchState
-- GotBored: Used to provide random state change.
local GotBored = StateMachine.NewCondition()
GotBored.Name = "GotBored"
GotBored.Evaluate = function()
local now = os.time()
if now - lastBored > configs["BoredomDuration"] then
local roll = math.random()
if roll < configs["ChanceOfBoredom"] then
lastBored = now
if GotBored.TransitionState == SearchState then
GotBored.TransitionState = IdleState
else
GotBored.TransitionState = SearchState
end
return true
end
end
return false
end
GotBored.TransitionState = IdleState
-- LostTarget: Checks clear line of sight
local LostTarget = StateMachine.NewCondition()
LostTarget.Name = "LostTarget"
LostTarget.Evaluate = function()
if true then return false end
if ZombieTarget then
if (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position).magnitude > 10 then
local toTarget = Ray.new(model.HumanoidRootPart.Position, (ZombieTarget.HumanoidRootPart.Position - model.HumanoidRootPart.Position))
local part, position = game.Workspace:FindPartOnRay(toTarget, model)
if not part or part.Parent ~= ZombieTarget then
--print("Lost target!")
ZombieTargetLastLocation = ZombieTarget.HumanoidRootPart.Position
ZombieTarget = nil
return true
end
end
end
return false
end
LostTarget.TransitionState = HuntState
local WithinRange = StateMachine.NewCondition()
WithinRange.Name = "WithinRange"
WithinRange.Evaluate = function()
if ZombieTarget then
if model:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
if distance < configs["AttackRange"] then
--print("Within attack range!")
return true
end
end
end
return false
end
WithinRange.TransitionState = AttackState
local OutsideRange = StateMachine.NewCondition()
OutsideRange.Name = "OutsideRange"
OutsideRange.Evaluate = function()
if ZombieTarget then
if model:FindFirstChild("HumanoidRootPart") and ZombieTarget:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - ZombieTarget.HumanoidRootPart.Position).magnitude
if distance > configs["AttackRange"] then
--print("Outside attack range!")
return true
end
end
end
return false
end
OutsideRange.TransitionState = PursueState
table.insert(IdleState.Conditions, CanSeeTarget)
table.insert(IdleState.Conditions, GotDamaged)
table.insert(IdleState.Conditions, GotBored)
table.insert(SearchState.Conditions, GotBored)
table.insert(SearchState.Conditions, CanSeeTarget)
table.insert(PursueState.Conditions, LostTarget)
table.insert(PursueState.Conditions, WithinRange)
table.insert(PursueState.Conditions, TargetDead)
table.insert(AttackState.Conditions, OutsideRange)
table.insert(AttackState.Conditions, TargetDead)
table.insert(HuntState.Conditions, GotBored)
table.insert(HuntState.Conditions, CanSeeTarget)
-- Setup arms damage
local canHit = true
local lastHit = os.time()
local function handleHit(other, zombieArm)
if canHit then
if other and other.Parent and other.Parent.Name ~= "Zombie" and other.Parent:FindFirstChild("Humanoid") then
local enemy = other.Parent
if enemy.Humanoid.WalkSpeed > 0 then
local shield = enemy:FindFirstChild("Shield")
if shield then
model:BreakJoints()
end
local killBehaviour = require(game.ServerScriptService.Server_Main.Behaviours.Kill)
killBehaviour:ExecuteBehaviour(zombieArm, enemy)
end
end
else
local now = os.time()
if now - lastHit > configs["DamageCooldown"] then
lastHit = now
canHit = true
end
end
end
local leftHitConnect, rightHitConnect
leftHitConnect = model:FindFirstChild("Left Arm").Touched:connect(function(other) handleHit(other, model:FindFirstChild("Left Arm")) end)
rightHitConnect = model:FindFirstChild("Right Arm").Touched:connect(function(other) handleHit(other, model:FindFirstChild("Right Arm")) end)
--ZombieAI.Animate(model)
--updateDisplay()
--updateDisplay(model.BillboardGui.TextLabel, StateMachine.CurrentState)
local thread = coroutine.create(function()
while true do
wait()
-- calculate repulsion force
if model == nil then
break
end
if model:FindFirstChild("HumanoidRootPart") == nil then
break
end
local humanoids = HumanoidList:GetCurrent()
local localZombies = {}
for _, humanoid in pairs(humanoids) do
if humanoid and humanoid ~= model.Humanoid and humanoid.Parent and humanoid.Parent:FindFirstChild("HumanoidRootPart") then
local HumanoidRootPart = humanoid.Parent:FindFirstChild("HumanoidRootPart")
if HumanoidRootPart ~= nil and model ~= nil then
if model:FindFirstChild("HumanoidRootPart") then
local distance = (model.HumanoidRootPart.Position - HumanoidRootPart.Position).magnitude
if distance <= 2.5 then
table.insert(localZombies, HumanoidRootPart.Position)
end
end
end
end
end
local repulsionDirection = AIUtilities:GetRepulsionVector(model.HumanoidRootPart.Position, localZombies)
if repulsionDirection.magnitude > 0 then
--print("replusion direction: " .. tostring(repulsionDirection))
end
model.HumanoidRootPart.RepulsionForce.force = repulsionDirection
if StateMachine.CurrentState and model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = true
model.BillboardGui.TextLabel.Text = StateMachine.CurrentState.Name
end
if not model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = false
end
end
end)
coroutine.resume(thread)
StateMachine.SwitchState(IdleState)
zombie.Stop = function()
StateMachine.SwitchState(nil)
end
return zombie
end
return ZombieAI
|
--[[
___ _____
/ _ |/ ___/ Avxnturador | Novena
/ __ / /__
/_/ |_\___/ LuaInt | Novena
*I assume you know what you're doing if you're gonna change something here.* ]]
|
--
--[[START]]
script.Parent:WaitForChild("Car")
script.Parent:WaitForChild("IsOn")
script.Parent:WaitForChild("ControlsOpen")
script.Parent:WaitForChild("Values")
--[[Dependencies]]
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
--[[Output Scaling Factor]]
local hpScaling = _Tune.WeightScaling*10
local FBrakeForce = _Tune.BrakeForce*_Tune.BrakeBias--luaint edit
local RBrakeForce = _Tune.BrakeForce*(1-_Tune.BrakeBias)--luaint edit
local PBrakeForce = _Tune.PBrakeForce
local EBrakeForce = _Tune.EBrakeForce
local SteerOuter = _Tune.SteerOuter--luaint edit
local SteerInner = _Tune.SteerInner--luaint edit
local RSteerOuter = _Tune.RSteerOuter
local RSteerInner = _Tune.RSteerInner
if not workspace:PGSIsEnabled() then
error("PGS is not enabled: A-Chassis will not work.")
end
--[[Status Vars]]
local _IsOn = _Tune.AutoStart
if _Tune.AutoStart and (_Tune.Engine or _Tune.Electric) then script.Parent.IsOn.Value=true end
local _GSteerT=0
local _GSteerC=0
local _GThrot=0
local _InThrot=0
local _IThrot=_Tune.IdleThrottle/100
local _GBrake=0
local _InBrake=0
local _IBrake=0
local _ClPressing = false
local _PlayerClutch = false
local _Clutch = 0
local _ClutchKick = 0
local _ClutchModulate = 0
local _RPM = 0
local _HP = 0
local _OutTorque = 0
local _CGear = 0
local _PGear = _CGear
local _ShiftUp = false
local _ShiftDn = false
local _Shifting = false
local _spLimit = 0
local _Boost = 0
local _TCount = 0
local _TPsi = 0
local _TBoost = 0
local _SCount = 0
local _SPsi = 0
local _SBoost = 0
local _NH = 0
local _NT = 0
local _EH = 0
local _ET = 0
local _TH = 0
local _TT = 0
local _SH = 0
local _ST = 0
local _BH = 0
local _BT = 0
local _TMode = _Tune.TransModes[1]
local _MSteer = false
local _SteerL = false
local _SteerR = false
local _PBrake = false
local _TCS = _Tune.TCSEnabled
local _TCSActive = false
local _TCSAmt = 0
local _ABS = _Tune.ABSEnabled
local _ABSActive = false
local FlipWait=tick()
local FlipDB=false
local _InControls = false
--[[Shutdown]]
car.DriveSeat.ChildRemoved:connect(function(child) if child.Name=="SeatWeld" and child:IsA("Weld") then script.Parent:Destroy() end end)
--[[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 (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<=1) and _Tune.AutoShiftVers == "New") or _TMode=="Semi") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftDn then _ShiftDn = true end
--Shift Up [Manual Transmission]
elseif (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and ((_IsOn and ((_TMode=="Auto" and _CGear<1) and _Tune.AutoShiftVers == "New") or _TMode=="Semi") or _TMode=="Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftUp then _ShiftUp = true end
--Toggle Clutch
elseif (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
_ClPressing = true
_PlayerClutch = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClPressing = false
_PlayerClutch = false
end
--Toggle PBrake
elseif 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 ((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 and _IsOn then
_IThrot = 1
else
_IThrot = _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
_IBrake = 1
else
_IBrake = 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
_IThrot = _Tune.IdleThrottle/100
_IBrake = 0
_GSteerT = 0
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 input.KeyCode == _CTRL["ContlrThrottle"] then
if _IsOn then
_IThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
else
_IThrot = _Tune.IdleThrottle/100
end
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_IBrake = input.Position.Z
end
end
else
_IThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_IBrake = 0
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
--[[Drivetrain Initialize]]
local Drive={}
--Power Front Wheels
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.insert(Drive,v) end end end
--Power Rear Wheels
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then table.insert(Drive,v) end end end
--Determine Wheel Size
local wDia = 0 for i,v in pairs(Drive) do if v.Size.x>wDia then wDia = v.Size.x end end
--Pre-Toggled PBrake
for i,v in pairs(car.Wheels:GetChildren()) do if math.abs(v["#BV"].MotorMaxTorque-PBrakeForce)<1 then _PBrake=true end end
--[[Throttle and Brake Input Smoothening]]
function Inputs(dt)
local deltaTime = (60/(1/dt))
if _InThrot <= _IThrot then
_InThrot = math.min(_IThrot,_InThrot+(_Tune.ThrotAccel*deltaTime))
else
_InThrot = math.max(_IThrot,_InThrot-(_Tune.ThrotDecel*deltaTime))
end
if _InBrake <= _IBrake then
_InBrake = math.min(_IBrake,_InBrake+(_Tune.BrakeAccel*deltaTime))
else
_InBrake = math.max(_IBrake,_InBrake-(_Tune.BrakeDecel*deltaTime))
end
end
--[[Steering]]
if _Tune.SteeringType == 'New' then--luaint edit
SteerOuter = (_Tune.LockToLock*180)/_Tune.SteerRatio
SteerInner = math.min(SteerOuter-(SteerOuter*(1-_Tune.Ackerman)),SteerOuter*1.2)
end
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
--Interpolate Steering
if _GSteerC < _GSteerT then
if _GSteerC<0 then
_GSteerC = math.min(_GSteerT,_GSteerC+(_Tune.ReturnSpeed*deltaTime))
else
_GSteerC = math.min(_GSteerT,_GSteerC+(_Tune.SteerSpeed*deltaTime))
end
else
if _GSteerC>0 then
_GSteerC = math.max(_GSteerT,_GSteerC-(_Tune.ReturnSpeed*deltaTime))
else
_GSteerC = math.max(_GSteerT,_GSteerC-(_Tune.SteerSpeed*deltaTime))
end
end
--Steer Decay Multiplier
local sDecay = (1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
local rsDecay = (1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerDecay,1-(_Tune.MinSteer/100)))
--Apply Steering
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="F" then
v.Arm.Steer.CFrame=car.Wheels.F.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*_Tune.SteerInner*sDecay),0)
elseif v.Name=="FL" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerOuter*sDecay),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.FL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerInner*sDecay),0)--luaint edit
end
elseif v.Name=="FR" then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerInner*sDecay),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.FR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*SteerOuter*sDecay),0)--luaint edit
end
elseif v.Name=='R' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.min(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
elseif _Tune.FWSteer=='Speed' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
elseif _Tune.FWSteer=='Both' then
v.Arm.Steer.CFrame=car.Wheels.R.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif v.Name=='RL' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.min(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Speed' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Both' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RL.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
end
elseif v.Name=='RR' then
if _Tune.FWSteer=='None' then
elseif _Tune.FWSteer=='Static' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.min(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(0,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Speed' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerInner*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,-math.rad(_GSteerC*RSteerOuter*rsDecay*math.min(1,(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
elseif _Tune.FWSteer=='Both' then
if _GSteerC>= 0 then
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerInner*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
else
v.Arm.Steer.CFrame=car.Wheels.RR.Base.CFrame*CFrame.Angles(0,math.rad(_GSteerC*RSteerOuter*rsDecay*math.max(-1,1-(car.DriveSeat.Velocity.Magnitude/_Tune.RSteerSpeed))),0)--luaint edit
end
end
end
end
end
--[[Engine]]
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
--Electric Only Setup
if not _Tune.Engine and _Tune.Electric then
_Tune.Redline = _Tune.E_Redline
_Tune.PeakRPM = _Tune.E_Trans2
_Tune.Turbochargers = 0
_Tune.Superchargers = 0
_Tune.Clutch = false
_Tune.IdleRPM = 0
_Tune.ClutchType = "Clutch"
_Tune.AutoShiftType = "DCT"
_Tune.ShiftUpTime = 0.1
_Tune.ShiftDnTime = 0.1
end
--Aspiration Setup
_TCount = _Tune.Turbochargers
_TPsi = _Tune.T_Boost*_Tune.Turbochargers
_SCount = _Tune.Superchargers
_SPsi = _Tune.S_Boost*_Tune.Superchargers
--Engine Curve
local HP=_Tune.Horsepower/100
local HP_T=((_Tune.Horsepower*((_TPsi)*(_Tune.T_Efficiency/10))/7.5)/2)/100
local HP_S=((_Tune.Horsepower*((_SPsi)*(_Tune.S_Efficiency/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
function CurveN(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveN = CurveN(_Tune.PeakRPM)
function CurveT(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_T/(Peak^2),CurveMult^(Peak/HP_T))+HP_T)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveT = CurveT(_Tune.PeakRPM)
function CurveS(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_S/(Peak^2),CurveMult^(Peak/HP_S))+HP_S)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveS = CurveS(_Tune.PeakRPM)
--Electric Curve
local EHP=_Tune.E_Horsepower/100
local ETQ=_Tune.E_Torque/100
local ETrans1=_Tune.E_Trans1/1000
local ETrans2=_Tune.E_Trans2/1000
local ELimit=_Tune.E_Redline/1000
function elecHP(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<=ETrans1 then
retVal=((((RPM/ETrans1)^_Tune.EH_FrontMult)/(1/EHP))*(RPM/ETrans1))+((((RPM/ETrans1)^(1/_Tune.EH_FrontMult))/(1/EHP))*(1-(RPM/ETrans1)))
elseif ETrans1<RPM and RPM<ETrans2 then
retVal=EHP
elseif ETrans2<=RPM then
retVal=EHP-(((RPM-ETrans2)/(ELimit-ETrans2))^_Tune.EH_EndMult)/(1/(EHP*(_Tune.EH_EndPercent/100)))
else
error( "\n\t [AC6C]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric horsepower."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
function elecTQ(RPM)
RPM=RPM/1000
local retVal=1e-9
if RPM<ETrans1 then
retVal=ETQ
elseif ETrans1<=RPM then
retVal=ETQ-(((RPM-ETrans1)/(ELimit-ETrans1))^_Tune.ET_EndMult)/(1/(ETQ*(_Tune.ET_EndPercent/100)))
else
error( "\n\t [AC6C]: Drive initialization failed!"
.."\n\t An unknown error occured when initializing electric torque."
.."\n\t Please send a screenshot of this message to Avxnturador."
.."\n\t R: "..RPM..", T1: "..ETrans1", T2: "..ETrans2", L: "..ELimit".")
end
return retVal
end
--Plot Current Naturally Aspirated Engine Horsepower
function GetNCurve(x,gear)
local hp=(math.max(CurveN(x)/(PeakCurveN/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Electric Horsepower
function GetECurve(x,gear)
local hp=(math.max(elecHP(x),0))*100
local tq=(math.max(elecTQ(x),0))*100
if gear~=0 then
return hp,math.max(tq*_Tune.Ratios[gear+2]*fFD*hpScaling,0)
else
return 0,0
end
end
--Plot Current Turbocharger Horsepower
function GetTCurve(x,gear)
local hp=(math.max(CurveT(x)/(PeakCurveT/HP_T),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Supercharger Horsepower
function GetSCurve(x,gear)
local hp=(math.max(CurveS(x)/(PeakCurveS/HP_S),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Output Cache
local NCache = {}
local ECache = {}
local TCache = {}
local SCache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local ehpPlot = {}
local thpPlot = {}
local shpPlot = {}
for rpm = 0, math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local etqPlot = {}
local ttqPlot = {}
local stqPlot = {}
if rpm~=0 then
if _Tune.Engine then
ntqPlot.Horsepower,ntqPlot.Torque = GetNCurve(rpm*100,gear-2)
if _TCount~=0 then
ttqPlot.Horsepower,ttqPlot.Torque = GetTCurve(rpm*100,gear-2)
else
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
end
if _SCount~=0 then
stqPlot.Horsepower,stqPlot.Torque = GetSCurve(rpm*100,gear-2)
else
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Electric then
etqPlot.Horsepower,etqPlot.Torque = GetECurve(rpm*100,gear-2)
else
etqPlot.Horsepower,etqPlot.Torque = 0,0
end
else
ntqPlot.Horsepower,ntqPlot.Torque = 0,0
etqPlot.Horsepower,etqPlot.Torque = 0,0
ttqPlot.Horsepower,ttqPlot.Torque = 0,0
stqPlot.Horsepower,stqPlot.Torque = 0,0
end
if _Tune.Engine then
nhp,ntq = GetNCurve((rpm+1)*100,gear-2)
if _TCount~=0 then
thp,ttq = GetTCurve((rpm+1)*100,gear-2)
else
thp,ttq = 0,0
end
if _SCount~=0 then
shp,stq = GetSCurve((rpm+1)*100,gear-2)
else
shp,stq = 0,0
end
else
nhp,ntq = 0,0
thp,ttq = 0,0
shp,stq = 0,0
end
if _Tune.Electric then
ehp,etq = GetECurve((rpm+1)*100,gear-2)
else
ehp,etq = 0,0
end
ntqPlot.HpSlope,ntqPlot.TqSlope = (nhp-ntqPlot.Horsepower),(ntq-ntqPlot.Torque)
etqPlot.HpSlope,etqPlot.TqSlope = (ehp-etqPlot.Horsepower),(etq-etqPlot.Torque)
ttqPlot.HpSlope,ttqPlot.TqSlope = (thp-ttqPlot.Horsepower),(ttq-ttqPlot.Torque)
stqPlot.HpSlope,stqPlot.TqSlope = (shp-stqPlot.Horsepower),(stq-stqPlot.Torque)
nhpPlot[rpm] = ntqPlot
ehpPlot[rpm] = etqPlot
thpPlot[rpm] = ttqPlot
shpPlot[rpm] = stqPlot
end
table.insert(NCache,nhpPlot)
table.insert(ECache,ehpPlot)
table.insert(TCache,thpPlot)
table.insert(SCache,shpPlot)
end
--Powertrain
wait()
--Automatic Transmission
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
if _Tune.AutoShiftVers == "Old" and _CGear == 0 then _CGear = 1 _ClPressing = false end
if _CGear >= 1 then
if (_CGear==1 and _InBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5) and _Tune.AutoShiftVers == "Old" then
_CGear = -1 _ClPressing = false
elseif car.DriveSeat.Velocity.Magnitude > 5 then
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if not _ShiftUp and not _Shifting then _ShiftUp = true end
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) and _CGear>1 then
if not _ShiftDn and not _Shifting then _ShiftDn = true end
end
end
end
else
if (_InThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 5) and _Tune.AutoShiftVers == "Old" then
_CGear = 1 _ClPressing = false
end
end
end
end
function Gear()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _ShiftUp and not _Shifting then
if (_TMode == "Manual" and not _ClPressing) or (_TMode == "Manual" and _Tune.ClutchRel and (_InThrot-(_Tune.IdleThrottle/100)>0)) or _CGear == #_Tune.Ratios-2 or (_TMode ~= "Manual" and not _IsOn) then _ShiftUp = false return end
local NextGear = math.min(_CGear+3,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>0 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftUpTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM<=math.max(math.min(maxSpin*_Tune.Ratios[NextGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftDn
end
end
end
_ShiftUp = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
if _TMode ~= "Manual" or (_TMode == "Manual" and _CGear == 1) and _IsOn then _ClPressing = false end
end
if _ShiftDn and not _Shifting then
if (_TMode == "Manual" and not _ClPressing) or _CGear == -1 or (_TMode ~= "Manual" and not _IsOn) then _ShiftDn = false return end
local PrevGear = math.min(_CGear+1,#_Tune.Ratios)
if _TMode~="Manual" then
_Shifting = true
if _CGear>1 then
if _Tune.AutoShiftType=="DCT" then
wait(_Tune.ShiftDnTime)
elseif _Tune.AutoShiftType=="Rev" then
repeat wait() until _RPM>=math.max(math.min(maxSpin*_Tune.Ratios[PrevGear]*fFDr,_Tune.Redline-_Tune.RevBounce),_Tune.IdleRPM) or not _IsOn or _ShiftUp
end
end
end
_ShiftDn = false
_Shifting = false
if _TMode ~= "Manual" and not _IsOn then return end
_CGear = math.max(_CGear-1,-1)
if _TMode ~= "Manual" or (_TMode == "Manual" and _CGear == -1) and _IsOn then _ClPressing = false end
end
end
local _GoalRPM=0
local tqTCS = 1
local sthrot = 0
local _StallOK = false
local ticc = tick()
--Apply Power
function Engine(dt)
local deltaTime = (60/(1/dt))
--Neutral Gear
if ((_CGear == 0 or _Shifting) and _IsOn) then
_ClPressing = true
_Clutch = 1
_StallOK = false
end
local revMin = _Tune.IdleRPM
local goalMin = _Tune.IdleRPM
local goalMax = _Tune.Redline
if _Tune.Stall and _Tune.Clutch then revMin = 0 end
if _Shifting and _ShiftUp then
_GThrot = 0
elseif _Shifting and _ShiftDn then
_GThrot = (_Tune.ShiftThrot/100)
else
if (_Tune.AutoShiftVers == "Old" and _CGear==-1 and _TMode=="Auto") then
_GThrot = _InBrake
else
_GThrot = _InThrot
end
end
if (_Tune.AutoShiftVers == "Old" and _CGear==-1 and _TMode=="Auto") then
_GBrake = _InThrot-(_Tune.IdleThrottle/100)
else
_GBrake = _InBrake
end
if not _IsOn then
ticc = tick()
revMin = 0
goalMin = 0
_GThrot = _Tune.IdleThrottle/100
if _TMode~="Manual" then
_CGear = 0
_ClPressing = true
_Clutch = 1
end
end
if ((_ClPressing and _CGear == 0) or (_PlayerClutch and _CGear ~= 0)) and _Tune.NeutralLimit then
if (_CGear == 0 and not _Tune.LimitClutch) or _Tune.LimitClutch then
goalMax = _Tune.NeutralRevRPM
end
end
--Determine RPM
local maxSpin=0
local maxCount=0
local revThrot=_GThrot
for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end
maxSpin=maxSpin/maxCount
if _GoalRPM>goalMax+100 then
revThrot = _Tune.IdleThrottle/100
end
if _Tune.Engine or _Tune.Electric then
_GoalRPM = math.clamp((_RPM-_Tune.RevDecay*deltaTime)+((_Tune.RevDecay+_Tune.RevAccel)*revThrot*deltaTime),goalMin,_Tune.Redline+100)
end
if _GoalRPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_GoalRPM = _GoalRPM-_Tune.RevBounce
else
_GoalRPM = _GoalRPM-_Tune.RevBounce*.5
end
end
local _WheelRPM = maxSpin*_Tune.Ratios[_CGear+2]*fFDr
if _Tune.Clutch then
if script.Parent.Values.AutoClutch.Value and _IsOn then
if _Tune.ClutchType == "Clutch" then
if _ClPressing then _ClutchKick = 1 end
_ClutchKick = _ClutchKick*(_Tune.ClutchEngage/100)
local ClRPMInfluence = math.max((_RPM-_Tune.IdleRPM)*_Tune.ClutchRPMMult/(_Tune.Redline-_Tune.IdleRPM),0)
if _Tune.ClutchMode == "New" then ClRPMInfluence = 0 end
_ClutchModulate = math.min(((((script.Parent.Values.Velocity.Value.Magnitude/_Tune.SpeedEngage)/math.abs(_CGear)) + ClRPMInfluence) - _ClutchKick), 1)
elseif _Tune.ClutchType == "CVT" or (_Tune.ClutchType == "TorqueConverter" and _Tune.TQLock) then
if (_GThrot-(_Tune.IdleThrottle/100)==0 and script.Parent.Values.Velocity.Value.Magnitude<_Tune.SpeedEngage) or (_GThrot-(_Tune.IdleThrottle/100)~=0 and (_RPM < _Tune.RPMEngage and _WheelRPM < _Tune.RPMEngage)) then
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100), 1)
else
_ClutchModulate = math.min(_ClutchModulate*(_Tune.ClutchEngage/100)+(1-(_Tune.ClutchEngage/100)), 1)
end
elseif _Tune.ClutchType == "TorqueConverter" and not _Tune.TQLock then
_ClutchModulate = math.min((_RPM/_Tune.Redline)*0.7, 1)
end
if not _ClPressing then _Clutch = math.min(1-_ClutchModulate,1) else _Clutch = 1 end
_StallOK = (_Clutch<=0.01) or _StallOK
else
_StallOK = _Tune.Stall
_Clutch = script.Parent.Values.Clutch.Value
end
else
_StallOK = false
if not _ClPressing and not _Shifting then _Clutch = 0 else _Clutch = 1 end
end
local aRPM = math.max(math.min((_GoalRPM*_Clutch) + (_WheelRPM*(1-_Clutch)),_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/(_Tune.Flywheel*deltaTime),.9)
if _ClPressing then clutchP = 0 end
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
if _RPM<=(_Tune.IdleRPM/4) and _StallOK and (tick()-ticc>=0.2) then script.Parent.IsOn.Value = not _Tune.Stall end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
--Aspiration
local TPsi = _TPsi/_TCount
local _BThrot = _GThrot
if _Tune.Engine then
if _TCount~=0 then
_TBoost = _TBoost + ((((((_HP*(_BThrot*1.2)/_Tune.Horsepower)/8)-(((_TBoost/TPsi*(TPsi/15)))))*((8/(_Tune.T_Size/(deltaTime)))*2))/TPsi)*15)
if _TBoost < 0.05 then _TBoost = 0.05 elseif _TBoost > 2 then _TBoost = 2 end
else
_TBoost = 0
end
if _SCount~=0 then
if _BThrot>sthrot then
sthrot=math.min(_BThrot,sthrot+_Tune.S_Sensitivity*deltaTime)
elseif _BThrot<sthrot then
sthrot=math.max(_BThrot,sthrot-_Tune.S_Sensitivity*deltaTime)
end
_SBoost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
else
_SBoost = 0
end
else
_TBoost = 0
_SBoost = 0
end
--Torque calculations
if _Tune.Engine then
local cTq = NCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_NT = cTq.Torque+(cTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
if _TCount~=0 then
local tTq = TCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_TH = (tTq.Horsepower+(tTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
_TT = (tTq.Torque+(tTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_TBoost/2)
else
_TH,_TT = 0,0
end
if _SCount~=0 then
local sTq = SCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(0,_RPM))/100)]
_SH = (sTq.Horsepower+(sTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
_ST = (sTq.Torque+(sTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1)))*(_SBoost/2)
else
_SH,_ST = 0,0
end
_BH = _TH+_SH
_BT = _TT+_ST
else
_NH,_NT = 0,0
_TH,_TT = 0,0
_SH,_ST = 0,0
_BH,_BT = 0,0
end
if _Tune.Electric and _CGear~=0 then
local eTq = ECache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(100,_RPM))/100)]
_EH = eTq.Horsepower+(eTq.HpSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
_ET = eTq.Torque+(eTq.TqSlope*(((_RPM-math.floor(_RPM/100))/100)%1))
else
_EH,_ET = 0,0
end
_HP = _NH + _BH + _EH
_OutTorque = _NT + _BT + _ET
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
local RRdiffMult=1
local RLdiffMult=1
local FRdiffMult=1
local FLdiffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--Differential/Torque-Vectoring
if _Tune.DifferentialType=='Old' then
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
else
if v.Name=="FR" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.FL.RotVelocity.Magnitude)-1)*(_Tune.FDiffPreload/10)
FRdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.FDiffPower/100)*avg*_GThrot) + ((_Tune.FDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
FLdiffMult=2-FRdiffMult
elseif v.Name=="FL" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.FR.RotVelocity.Magnitude)-1)*(_Tune.FDiffPreload/10)
FLdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.FDiffPower/100)*avg*_GThrot) + ((_Tune.FDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
FRdiffMult=2-FLdiffMult
elseif v.Name=="RR" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.RL.RotVelocity.Magnitude)-1)*(_Tune.RDiffPreload/10)
RRdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.RDiffPower/100)*avg*_GThrot) + ((_Tune.RDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
RLdiffMult=2-RRdiffMult
elseif v.Name=="RL" then
local avg=((v.RotVelocity.Magnitude/car.Wheels.RR.RotVelocity.Magnitude)-1)*(_Tune.RDiffPreload/10)
RLdiffMult=math.ceil(math.max(0,math.min(2,1-( ((_Tune.RDiffPower/100)*avg*_GThrot) + ((_Tune.RDiffCoast/100)*avg*(1-_GThrot)))))*100)/100
RRdiffMult=2-RLdiffMult
end
end
_TCSActive = false
_ABSActive = false
--Output
--Apply Power
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
local brake = _GBrake
local clutch=1
if _ClPressing then clutch=0 end
local tq = _OutTorque
--Apply ABS
local tqABS = 1
if _ABS and brake>0 and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
_ABSActive = (tqABS<1)
local PBrakeV=0
if _PBrake==true then PBrakeV=1 else PBrakeV=0 end
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
--Apply AWD Vectoring
if _Tune.Config == "AWD" then
local bias = (_Tune.TorqueVector+1)/2
if string.find(v.Name,"F") then
tq = tq*(1-bias)
elseif string.find(v.Name,"R") then
tq = tq*bias
end
end
--Apply TCS
tqTCS = 1
if _TCS and throt>0 then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir=1
if _CGear==-1 then dir = -1 end--luaint edit
if _Tune.ClutchKick and car.DriveSeat.Velocity.Magnitude<_Tune.KickSpeedThreshold and _RPM>_Tune.Redline-_Tune.KickRPMThreshold and v["#BV"].MotorMaxTorque<1 then
tq = (tq*_Tune.KickMult)
end
local tqOUT = tq*(60/workspace:GetRealPhysicsFPS())*(1+(v.RotVelocity.Magnitude/(120-workspace:GetRealPhysicsFPS()))^(1.15+(.07*(1-(60/workspace:GetRealPhysicsFPS())))))*throt*tqTCS*on*clutch
if v.Name=='RR' then
v["#AV"].MotorMaxTorque=tqOUT*RRdiffMult*diffMult
elseif v.Name=='RL' then
v["#AV"].MotorMaxTorque=tqOUT*RLdiffMult*diffMult
elseif v.Name=='FR' then
v["#AV"].MotorMaxTorque=tqOUT*FRdiffMult*diffMult
elseif v.Name=='FL' then
v["#AV"].MotorMaxTorque=tqOUT*FLdiffMult*diffMult
else
v["#AV"].MotorMaxTorque=tqOUT*diffMult
end
v["#AV"].AngularVelocity=_spLimit*dir
if string.find(v.Name,"F") then
v["#BV"].MotorMaxTorque=(FBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(EBrakeForce*((1-throt)*(_RPM/_Tune.Redline)))
else
v["#BV"].MotorMaxTorque=(RBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(EBrakeForce*((1-throt)*(_RPM/_Tune.Redline)))+(PBrakeForce*PBrakeV)
end
else--luaint edit
v["#AV"].MotorMaxTorque=0
v["#AV"].AngularVelocity=0
if string.find(v.Name,"F") then
v["#BV"].MotorMaxTorque=(FBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)
else
v["#BV"].MotorMaxTorque=(RBrakeForce*(60/workspace:GetRealPhysicsFPS())*brake*tqABS)+(PBrakeForce*PBrakeV)
end
end
end
end
--[[Flip]]
function Flip()
--Detect Orientation
if (car.DriveSeat.CFrame*CFrame.Angles(math.pi/2,0,0)).lookVector.y > .1 or FlipDB then
FlipWait=tick()
--Apply Flip
else
if tick()-FlipWait>=3 then
FlipDB=true
local gyro = car.DriveSeat.Flip
gyro.maxTorque = Vector3.new(10000,0,10000)
gyro.P=3000
gyro.D=500
wait(1)
gyro.maxTorque = Vector3.new(0,0,0)
gyro.P=0
gyro.D=0
FlipDB=false
end
end
end
--[[Run]]
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("Novena: AC6C Loaded - Version "..ver..", Update "..script.Parent.Version.Value)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Heartbeat:connect(function(dt)
--Update Internal Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
--Inputs
Inputs(dt)
--Steering
Steering(dt)
--Gear
Gear()
--Power
Engine(dt)
--Update External Values
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = ((_TBoost/2)*_TPsi)+((_SBoost/2)*_SPsi)
script.Parent.Values.BoostTurbo.Value = (_TBoost/2)*_TPsi
script.Parent.Values.BoostSuper.Value = (_SBoost/2)*_SPsi
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpElectric.Value = _EH
script.Parent.Values.HpTurbo.Value = _TH
script.Parent.Values.HpSuper.Value = _SH
script.Parent.Values.HpBoosted.Value = _BH
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.TqNatural.Value = _NT/_Tune.Ratios[_CGear+2]/fFD/hpScaling
script.Parent.Values.TqElectric.Value = _ET/_Tune.Ratios[_CGear+2]/fFD/hpScaling
script.Parent.Values.TqTurbo.Value = _TT/_Tune.Ratios[_CGear+2]/fFD/hpScaling
script.Parent.Values.TqSuper.Value = _ST/_Tune.Ratios[_CGear+2]/fFD/hpScaling
script.Parent.Values.TqBoosted.Value = script.Parent.Values.TqTurbo.Value+script.Parent.Values.TqSuper.Value
script.Parent.Values.Torque.Value = script.Parent.Values.TqNatural.Value+script.Parent.Values.TqElectric.Value+script.Parent.Values.TqBoosted.Value
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
if script.Parent.Values.AutoClutch.Value then
script.Parent.Values.Clutch.Value = _Clutch
end
script.Parent.Values.SteerC.Value = _GSteerC
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
--15 c/s
while wait(.0667) do
--Automatic Transmission
if _TMode == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 0 + (script.AddDam.Value/4)
local slash_damage = 25 + script.AddDam.Value
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=12722518"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--front motor
|
script.Parent.Wheels.boggieB.motf.HingeConstraint.AngularVelocity = speed
script.Parent.Wheels.boggieB.motf.HingeConstraint2.AngularVelocity = -speed
script.Parent.Wheels.boggieB.motf.HingeConstraint.MotorMaxTorque = RPM
script.Parent.Wheels.boggieB.motf.HingeConstraint2.MotorMaxTorque = RPM
|
-- Tips
|
DEFAULT_FORCED_GROUP_VALUES["tip"] = 1
function Icon:setTip(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
self.tipText = text
self.instances.tipLabel.Text = realText
self.instances.tipFrame.Parent = (isVisible and activeItems) or self.instances.iconContainer
self._maid.tipFrame = self.instances.tipFrame
self:_updateTipSize()
local tipMaid = Maid.new()
self._maid.tipMaid = tipMaid
if isVisible then
tipMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayTip(true)
end
end))
tipMaid:give(self.hoverEnded:Connect(function()
self:displayTip(false)
end))
tipMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayTip(false)
end
end))
end
self:displayTip(self.hovering and isVisible)
return self
end
function Icon:_updateTipSize()
local realText = self.tipText or ""
local isVisible = realText ~= ""
local iconContentText = self:_getContentText(realText)
local textSize = textService:GetTextSize(iconContentText, 12, Enum.Font.GothamSemibold, Vector2.new(1000, 20-6))
self.instances.tipFrame.Size = (isVisible and UDim2.new(0, textSize.X+6, 0, 20)) or UDim2.new(0, 0, 0, 0)
end
function Icon:displayTip(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
-- Determine caption visibility
local isVisible = self.tipVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.tipVisible = isVisible
-- Have tip position track mouse or finger
local tipFrame = self.instances.tipFrame
if isVisible then
-- When the user moves their cursor/finger, update tip to match the position
local function updateTipPositon(x, y)
local newX = x
local newY = y
local camera = workspace.CurrentCamera
local viewportSize = camera and camera.ViewportSize
if userInputService.TouchEnabled then
--tipFrame.AnchorPoint = Vector2.new(0.5, 0.5)
local desiredX = newX - tipFrame.Size.X.Offset/2
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset
local desiredY = newY + THUMB_OFFSET + 60
local minY = tipFrame.AbsoluteSize.Y + THUMB_OFFSET + 64 + 3
local maxY = viewportSize.Y - tipFrame.Size.Y.Offset
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
elseif IconController.controllerModeEnabled then
local indicator = TopbarPlusGui.Indicator
local newPos = indicator.AbsolutePosition
newX = newPos.X - tipFrame.Size.X.Offset/2 + indicator.AbsoluteSize.X/2
newY = newPos.Y + 90
else
local desiredX = newX
local minX = 0
local maxX = viewportSize.X - tipFrame.Size.X.Offset - 48
local desiredY = newY
local minY = tipFrame.Size.Y.Offset+3
local maxY = viewportSize.Y
newX = math.clamp(desiredX, minX, maxX)
newY = math.clamp(desiredY, minY, maxY)
end
--local difX = tipFrame.AbsolutePosition.X - tipFrame.Position.X.Offset
--local difY = tipFrame.AbsolutePosition.Y - tipFrame.Position.Y.Offset
--local globalX = newX - difX
--local globalY = newY - difY
--tipFrame.Position = UDim2.new(0, globalX, 0, globalY-55)
tipFrame.Position = UDim2.new(0, newX, 0, newY-20)
end
local cursorLocation = userInputService:GetMouseLocation()
if cursorLocation then
updateTipPositon(cursorLocation.X, cursorLocation.Y)
end
self._hoveringMaid:give(self.instances.iconButton.MouseMoved:Connect(updateTipPositon))
end
-- Change transparency of relavent tip instances
for _, settingName in pairs(self._groupSettings.tip) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
--//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.85, -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 = CFrame.new(-0.975, 0.165, -1.5) * CFrame.Angles(math.rad(-115), math.rad(-10), math.rad(10))}):Play()
ts:Create(objs[3],TweenInfo.new(0.35),{C1 = CFrame.new(-0.15,0.05,-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.15,-0.275,-1.175) * 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(-.62, -0.25, -0.83) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):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.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(0.5)
ts:Create(objs[2],TweenInfo.new(0.5),{C1 = CFrame.new(-0.875, 0, -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(-0.2, 0.5, -0.75) * CFrame.Angles(math.rad(-90), math.rad(0), math.rad(0))}):Play()
wait(1.5)
ts:Create(objs[2],TweenInfo.new(0.4),{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.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.875, 0, -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;
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 300 -- Spring Dampening
Tune.FSusStiffness = 8000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2.2 -- Suspension length (in studs)
Tune.FPreCompress = .95 -- Pre-compression adds resting length force
Tune.FExtensionLim = 1.1 -- Max Extension Travel (in studs)
Tune.FCompressLim = .1 -- Max Compression Travel (in studs)
Tune.FSusAngle = 90 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0.5 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -0.3 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 300 -- Spring Dampening
Tune.RSusStiffness = 8000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2.2 -- Suspension length (in studs)
Tune.RPreCompress = .7 -- Pre-compression adds resting length force
Tune.RExtensionLim = 1.1 -- Max Extension Travel (in studs)
Tune.RCompressLim = .1 -- Max Compression Travel (in studs)
Tune.RSusAngle = 90 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0.5 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -0.3 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
----- Private functions -----
|
local function IdentifyProfile(store_name, store_scope, key)
return string.format(
"[Store:\"%s\";%sKey:\"%s\"]",
store_name,
store_scope ~= nil and string.format("Scope:\"%s\";", store_scope) or "",
key
)
end
local function CustomWriteQueueCleanup(store, key)
if CustomWriteQueue[store] ~= nil then
CustomWriteQueue[store][key] = nil
if next(CustomWriteQueue[store]) == nil then
CustomWriteQueue[store] = nil
end
end
end
local function CustomWriteQueueMarkForCleanup(store, key)
if CustomWriteQueue[store] ~= nil then
if CustomWriteQueue[store][key] ~= nil then
local queue_data = CustomWriteQueue[store][key]
local queue = queue_data.Queue
if queue_data.CleanupJob == nil then
queue_data.CleanupJob = RunService.Heartbeat:Connect(function()
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and #queue == 0 then
queue_data.CleanupJob:Disconnect()
CustomWriteQueueCleanup(store, key)
end
end)
end
elseif next(CustomWriteQueue[store]) == nil then
CustomWriteQueue[store] = nil
end
end
end
local function CustomWriteQueueAsync(callback, store, key) --> ... -- Passed return from callback
if CustomWriteQueue[store] == nil then
CustomWriteQueue[store] = {}
end
if CustomWriteQueue[store][key] == nil then
CustomWriteQueue[store][key] = {LastWrite = 0, Queue = {}, CleanupJob = nil}
end
local queue_data = CustomWriteQueue[store][key]
local queue = queue_data.Queue
-- Cleanup job:
if queue_data.CleanupJob ~= nil then
queue_data.CleanupJob:Disconnect()
queue_data.CleanupJob = nil
end
-- Queue logic:
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and #queue == 0 then
queue_data.LastWrite = os.clock()
return callback()
else
table.insert(queue, callback)
while true do
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and queue[1] == callback then
table.remove(queue, 1)
queue_data.LastWrite = os.clock()
return callback()
end
Madwork.HeartbeatWait()
end
end
end
local function IsCustomWriteQueueEmptyFor(store, key) --> is_empty [bool]
local lookup = CustomWriteQueue[store]
if lookup ~= nil then
lookup = lookup[key]
return lookup == nil or #lookup.Queue == 0
end
return true
end
local function WaitForLiveAccessCheck() -- This function was created to prevent the ProfileService module yielding execution when required
while IsLiveCheckActive == true do
Madwork.HeartbeatWait()
end
end
local function WaitForPendingProfileStore(profile_store)
while profile_store._is_pending == true do
Madwork.HeartbeatWait()
end
end
local function RegisterIssue(error_message, store_name, store_scope, profile_key) -- Called when a DataStore API call errors
warn("[ProfileService]: DataStore API error " .. IdentifyProfile(store_name, store_scope, profile_key) .. " - \"" .. tostring(error_message) .. "\"")
table.insert(IssueQueue, os.clock()) -- Adding issue time to queue
ProfileService.IssueSignal:Fire(tostring(error_message), store_name, profile_key)
end
local function RegisterCorruption(store_name, store_scope, profile_key) -- Called when a corrupted profile is loaded
warn("[ProfileService]: Resolved profile corruption " .. IdentifyProfile(store_name, store_scope, profile_key))
ProfileService.CorruptionSignal:Fire(store_name, profile_key)
end
local function MockUpdateAsync(mock_data_store, profile_store_name, key, transform_function)
local profile_store = mock_data_store[profile_store_name]
if profile_store == nil then
profile_store = {}
mock_data_store[profile_store_name] = profile_store
end
local transform = transform_function(profile_store[key])
if transform == nil then
return nil
else
profile_store[key] = DeepCopyTable(transform)
return DeepCopyTable(profile_store[key])
end
end
local function IsThisSession(session_tag)
return session_tag[1] == PlaceId and session_tag[2] == JobId
end
|
-- In radians the minimum accuracy penalty
|
local MinSpread = 0.06
|
--Attributes
|
bcolor = part.BrickColor
material = part.Material
|
--[[
Performs property validation if the static method validateProps is declared.
validateProps should follow assert's expected arguments:
(false, message: string) | true. The function may return a message in the
true case; it will be ignored. If this fails, the function will throw the
error.
]]
|
function Component:__validateProps(props)
if not config.propValidation then
return
end
local validator = self[InternalData].componentClass.validateProps
if validator == nil then
return
end
if typeof(validator) ~= "function" then
error(("validateProps must be a function, but it is a %s.\nCheck the definition of the component %q."):format(
typeof(validator),
self.__componentName
))
end
local success, failureReason = validator(props)
if not success then
failureReason = failureReason or "<Validator function did not supply a message>"
error(("Property validation failed in %s: %s\n\n%s"):format(
self.__componentName,
tostring(failureReason),
self:getElementTraceback() or "<enable element tracebacks>"),
0)
end
end
|
-- Properties
|
local held = false
local step = 0.025
local percentage = 0
function snap(number, factor)
if factor == 0 then
return number
else
return math.floor(number/factor+0.5)*factor
end
end
UIS.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
held = false
end
end)
SliderBtn.MouseButton1Down:connect(function()
held = true
end)
RuS.RenderStepped:connect(function(delta)
if held then
local MousePos = UIS:GetMouseLocation().X
local BtnPos = SliderBtn.Position
local SliderSize = Slider.AbsoluteSize.X
local SliderPos = Slider.AbsolutePosition.X
local pos = snap((MousePos-SliderPos)/SliderSize,step)
percentage = math.clamp(pos,0,1)
SliderBtn.Position = UDim2.new(percentage,0,BtnPos.Y.Scale, BtnPos.Y.Offset)
local old = percentage
wait()
if old ~= percentage then
local b = (percentage-0.5) * 400
game.Players.LocalPlayer.Character["Vibe Radio"].changebass:FireServer(b)
end
end
end)
|
--["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+3,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*10
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 true do
local thresh,nearest = 60,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 < 5 then
anims["SwingTool"]:Play()
nearest.Parent.Humanoid:TakeDamage(8)
target.Value = nil
task.wait(1)
end
target.Value = nearest
else
target.Value = nil
end
task.wait(1)
end
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
|
return function(data, env)
if env then
setfenv(1, env)
end
local gui = script.Parent.Parent
local playergui = service.PlayerGui
local str = data.Message
local time = data.Time or 15
--client.UI.Make("HintHolder")
local container = client.UI.Get("HintHolder",nil,true)
if not container then
local holder = service.New("ScreenGui")
local hTable = client.UI.Register(holder)
local frame = service.New("ScrollingFrame", holder)
client.UI.Prepare(holder)
hTable.Name = "HintHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(1, 0, 0,150)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
container = hTable
hTable:Ready()
end
container = container.Object.Frame
--// First things first account for notif :)
local notif = client.UI.Get("Notif")
local topbar = client.UI.Get("TopBar")
container.Position = UDim2.new(0,0,0,((notif and 30) or 0) + ((topbar and 40) or 0) - 35)
local children = container:children()
gui.Position = UDim2.new(0,0,0,-100)
gui.Frame.msg.Text = str
local bounds = gui.Frame.msg.TextBounds.X
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
sound.SoundId = "rbxassetid://489390072"
wait(0.1)
sound:Play()
wait(0.8)
sound:Destroy()
end)
local function moveGuis(m,ignore)
m = m or 0
local max = #container:children()
for i,v in pairs(container:children()) do
if v~=ignore then
local y = (i+m)*28
v.Position = UDim2.new(0,0,0,y)
if i~=max then v.Size = UDim2.new(1,0,0,28) end
end
end
end
local lom = -1
moveGuis(-1)
gui.Parent = container
if #container:children()>5 then lom = -2 end
UDim2.new(0,0,0,(#container:children()+lom)*28)
moveGuis(-1)
--gui:TweenPosition(UDim2.new(0,0,0,(#container:children()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)
if #container:children()>5 then
local gui = container:children()[1]
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
wait(data.Time or 5)
if gui and gui.Parent then
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
end
|
--This module is for any client FX related to the Double Tap Machine
|
local MuleKickFX = {}
local tweenService = game:GetService("TweenService")
function MuleKickFX.POWER_ON(machine)
return
end
function MuleKickFX.POWER_OFF(machine)
return
end
return MuleKickFX
|
------------------------------------------------------------------------
-- tracks and limits parsing depth, assert check at end of parsing
------------------------------------------------------------------------
|
function luaY:enterlevel(ls)
ls.L.nCcalls = ls.L.nCcalls + 1
if ls.L.nCcalls > self.LUAI_MAXCCALLS then
luaX:lexerror(ls, "chunk has too many syntax levels", 0)
end
end
|
-- i didnt write this, its a lot of redundant code but it works so i wont bother changing it
|
ChangeAmount = 5
Player = game.Players.LocalPlayer
Camera = workspace.CurrentCamera
Mouse = Player:GetMouse()
local view = false
function FOV(key)
key = key:lower()
if key == "[" then
if view then
Camera.FieldOfView = Camera.FieldOfView - ChangeAmount
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
view = false
return
end
if not view then
Camera.FieldOfView = Camera.FieldOfView - ChangeAmount
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
end
end
end
Mouse.KeyDown:connect(FOV)
function FOV(key)
key = key:lower()
if key == "]" then
if view then
Camera.CameraSubject=game.Players.LocalPlayer.Character.Head
Camera.FieldOfView = Camera.FieldOfView + ChangeAmount
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
view = false
return
end
if not view then
Camera.CameraSubject=game.Players.LocalPlayer.Character.Head
Camera.FieldOfView = Camera.FieldOfView + ChangeAmount
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
end
end
end
Mouse.KeyDown:connect(FOV)
function FOV(key)
key = key:lower()
if key == "m" then
if view then
Camera.CameraSubject=game.Players.LocalPlayer.Character.Head
Camera.FieldOfView = 70
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
view = false
return
end
if not view then
Camera.CameraSubject=game.Players.LocalPlayer.Character.Head
Camera.FieldOfView = 70
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
view = true
end
end
end
Mouse.KeyDown:connect(FOV)
|
-- Delete default running sound
|
character.HumanoidRootPart:FindFirstChild("Running"):Destroy()
character.HumanoidRootPart:FindFirstChild("Jumping").Volume = 1
|
------------------------------------------------------------------------
-- parse a return statement
-- * used in statements()
------------------------------------------------------------------------
|
function luaY:retstat(ls)
-- stat -> RETURN explist
local fs = ls.fs
local e = {} -- expdesc
local first, nret -- registers with returned values
luaX:next(ls) -- skip RETURN
if self:block_follow(ls.t.token) or ls.t.token == ";" then
first, nret = 0, 0 -- return no values
else
nret = self:explist1(ls, e) -- optional return values
if self:hasmultret(e.k) then
luaK:setmultret(fs, e)
if e.k == "VCALL" and nret == 1 then -- tail call?
luaP:SET_OPCODE(luaK:getcode(fs, e), "OP_TAILCALL")
assert(luaP:GETARG_A(luaK:getcode(fs, e)) == fs.nactvar)
end
first = fs.nactvar
nret = self.LUA_MULTRET -- return all values
else
if nret == 1 then -- only one single value?
first = luaK:exp2anyreg(fs, e)
else
luaK:exp2nextreg(fs, e) -- values must go to the 'stack'
first = fs.nactvar -- return all 'active' values
assert(nret == fs.freereg - first)
end
end--if
end--if
luaK:ret(fs, first, nret)
end
|
--[=[
Intended for classes that extend BaseObject only
@class PromiseRemoteEventMixin
]=]
|
local require = require(script.Parent.loader).load(script)
local promiseChild = require("promiseChild")
local PromiseRemoteEventMixin = {}
|
--Special Colors
--Using these options will override the RGB Colors section. Make sure that your setup is correct.
--You may only use one of these options.
|
local stillRainbow = false --Change this to true in order to enable still rainbow colors (Gradient.)
local dynamicRainbow = true --Change this to true in order to enable dynamic rainbow colors (Changes over time.)
|
-- local script inside TextLabel
|
local Players = game:GetService("Players")
local TextLabel = script.Parent
local function updateName()
local player = Players.LocalPlayer
TextLabel.Text = player.Name
end
updateName()
Players.PlayerAdded:Connect(updateName)
|
--[[To use this script simply place the walk points where you want
and the NPC will follow them. will follow them first You can create as many points as needed
simply just duplicate a point and name it the next number in your line.
Note: DO NOT TOUCH ANYTHING ELSE IN THIS SCRIPT WITHOUT ASKING ME ~BigBoss(Raildex)
]]
|
local waitTime = 5 --This is the only thing you will need to change, it is the time he spends at the end of the points before going back the other way.
local waitPoint = script.Parent.Parent.WalkPoints:WaitForChild("1")
local points = script.Parent.Parent.WalkPoints:GetChildren()
script.Parent.Head.Weld.Part0 = script.Parent.Head
script.Parent.Head.Weld.Part1 = script.Parent.FakeHead
script.Parent.Torso["Neck"].Part1 = script.Parent.Head
script.Parent.Torso["Neck"].Part0 = script.Parent.Torso
script.Parent.Torso["Left Hip"].Part1 = script.Parent["Left Leg"]
script.Parent.Torso["Left Hip"].Part0 = script.Parent.Torso
script.Parent.Torso["Right Hip"].Part1 = script.Parent["Right Leg"]
script.Parent.Torso["Right Hip"].Part0 = script.Parent.Torso
script.Parent.Torso["Left Shoulder"].Part1 = script.Parent["Left Arm"]
script.Parent.Torso["Left Shoulder"].Part0 = script.Parent.Torso
script.Parent.Torso["Right Shoulder"].Part1 = script.Parent["Right Arm"]
script.Parent.Torso["Right Shoulder"].Part0 = script.Parent.Torso
function WeldClothes()
local children = script.Parent:GetChildren()
for i = 1, #children do
if children[i].ClassName == 'Part' and children[i].Name ~= 'FakeHead' then
local clothes = children[i].Clothes:GetChildren()
for j = 1, #clothes do
local W = Instance.new('Weld')
W.Part0 = children[i]
W.Part1 = clothes[j]
local CJ = CFrame.new(children[i].Position)
local C0 = children[i].CFrame:inverse()*CJ
local C1 = clothes[j].CFrame:inverse()*CJ
W.C0 = C0
W.C1 = C1
W.Parent = children[i]
clothes[j].Anchored = false
clothes[j].CanCollide = false
--[[
local Y = Instance.new("Weld")
Y.Part0 = hit
Y.Part1 = g.Middle
Y.C0 = CFrame.new(0, 0, 0)
Y.Parent = Y.Part0]]
end
end
end
end
WeldClothes()
script.Parent.Torso.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
script.Parent.Torso.Anchored = true
wait(.5)
script.Parent.Torso.Anchored = false
end
end)
wait(30)
while true do
for i=1,#points do
repeat
script.Parent.Humanoid:MoveTo(script.Parent.Parent.WalkPoints[i].Position)
wait(.5)
until (script.Parent.Torso.Position - script.Parent.Parent.WalkPoints[i].Position).magnitude <= 4
end
wait(waitTime)
for i=1,#points do
repeat
script.Parent.Humanoid:MoveTo(script.Parent.Parent.WalkPoints[#points+1-i].Position)
wait(.5)
until (script.Parent.Torso.Position - script.Parent.Parent.WalkPoints[#points+1-i].Position).magnitude <= 4
end
wait(waitTime)
end
|
--[[
LegacyCamera - Implements legacy controller types: Attach, Fixed, Watch
2018 Camera Update - AllYourBlox
--]]
|
wait(999999999999999999999)
local ZERO_VECTOR2 = Vector2.new(0,0)
local Util = require(script.Parent:WaitForChild("CameraUtils"))
|
--
|
RightShoulderClone = RightShoulder:Clone()
RightShoulderClone.Name = "RightShoulderClone"
RightShoulderClone.Parent = Torso
RightShoulderClone.Part0 = Torso
|
--- Add a task to clean up
-- @usage
-- Maid[key] = (function) Adds a task to perform
-- Maid[key] = (event connection) Manages an event connection
-- Maid[key] = (Maid) Maids can act as an event connection, allowing a Maid to have other maids to clean up.
-- Maid[key] = (Object) Maids can cleanup objects with a `Destroy` method
-- Maid[key] = nil Removes a named task. If the task is an event, it is disconnected. If it is an object, it is destroyed.
|
function Maid:__newindex(index, newTask)
if Maid[index] ~= nil then
error(("'%s' is reserved"):format(tostring(index)), 2)
end
local tasks = self._tasks
local oldTask = tasks[index]
tasks[index] = newTask
if oldTask then
if type(oldTask) == "function" then
oldTask()
elseif typeof(oldTask) == "RBXScriptConnection" then
oldTask:Disconnect()
elseif oldTask.Destroy then
oldTask:Destroy()
end
end
end
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l11.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(1)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(21)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(1)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(21)
|
--[=[
Observes all descendants of a specific class
@param parent Instance
@param className string
@return Observable<Instance>
]=]
|
function RxInstanceUtils.observeDescendantsOfClassBrio(parent, className)
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(className) == "string", "Bad className")
return RxInstanceUtils.observeDescendantsBrio(parent, function(child)
return child:IsA(className)
end)
end
return RxInstanceUtils
|
-- set and keep every body part Transparency to its real transparency
|
for childIndex, child in pairs(character:GetChildren()) do
if child:IsA("BasePart") and child.Name ~= "Head" then
child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
child.LocalTransparencyModifier = child.Transparency
end)
child.LocalTransparencyModifier = child.Transparency
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Resources"));
end)();
return function(p1, p2, ...)
local v1, v2 = ...;
local v3 = v2 or Color3.fromRGB(111, 111, 111);
p1.title.Text = v1;
if v3 == "Shadow" then
task.defer(function()
while not p1.Parent do
u1.RenderStepped();
end;
local v4 = os.clock();
while p1 and p1.Parent do
p1.title.Background.BackgroundColor3 = Color3.fromRGB(57, 8, 70):Lerp(Color3.fromRGB(192, 89, 255), math.sin((os.clock() - v4) * 5) / 2 + 0.5);
u1.RenderStepped();
end;
end);
return;
end;
if v3 == "Divine" then
task.defer(function()
while not p1.Parent do
u1.RenderStepped();
end;
u1.GFX.Rainbow(p1.title.Background, "BackgroundColor3", 3);
end);
return;
end;
if v3 == "Shiny" then
task.defer(function()
while not p1.Parent do
u1.RenderStepped();
end;
local v5 = os.clock();
while p1 and p1.Parent do
p1.title.Background.BackgroundColor3 = Color3.fromRGB(255, 253, 184):Lerp(Color3.fromRGB(255, 213, 61), math.sin((os.clock() - v5) * 4) / 2 + 0.5);
u1.RenderStepped();
end;
end);
return;
end;
p1.title.Background.BackgroundColor3 = v3;
end;
|
--[[ SCRIPT VARIABLES ]]
|
local CHAT_BUBBLE_FONT = Enum.Font.Fantasy
local CHAT_BUBBLE_FONT_SIZE = Enum.FontSize.Size18 -- if you change CHAT_BUBBLE_FONT_SIZE_INT please change this to match
local CHAT_BUBBLE_FONT_SIZE_INT = 18 -- if you change CHAT_BUBBLE_FONT_SIZE please change this to match
local CHAT_BUBBLE_LINE_HEIGHT = CHAT_BUBBLE_FONT_SIZE_INT + 8
local CHAT_BUBBLE_TAIL_HEIGHT = 14
local CHAT_BUBBLE_WIDTH_PADDING = 30
local CHAT_BUBBLE_FADE_SPEED = 2.5
local CHAT_TEXT_COLOR = Color3.new( 188/255 , 37/255 , 72/255 ) -- Color3.new( 27/255 , 42/255 , 53/255 )
local CHAT_BUBBLE_COLOR = Color3.new( 255/255 , 206/255 , 244/255 ) -- Color3.new( 255/255 , 255/255 , 255/255 )
local BILLBOARD_MAX_WIDTH = 375
local BILLBOARD_MAX_HEIGHT = 500 --This limits the number of bubble chats that you see above characters
local ELIPSES = "..."
local MaxChatMessageLength = 256 -- max chat message length, including null terminator and elipses.
local MaxChatMessageLengthExclusive = MaxChatMessageLength - string.len(ELIPSES) - 1
local NEAR_BUBBLE_DISTANCE = 50 --previously 45
local MAX_BUBBLE_DISTANCE = 125 --previously 80
|
-- PLEASE DO NOT TOUCH THIS |
-- V
|
print(MenuLoader)MenuLoader=MenuLoader
local val = script.PValue.Value
function onEnter(player)
local playClone = game.ServerStorage["PUT INTO SERVERSTORAGE"]:Clone()
if player then
playClone.Parent = player.PlayerGui
local song = player.PlayerGui["PUT INTO SERVERSTORAGE"]:WaitForChild("Song")
song:Play()
song.Volume = 0.1
wait(0.5)
song.Volume = 0.2
wait(0.5)
song.Volume = 0.3
local gui = player.PlayerGui["PUT INTO SERVERSTORAGE"].GUI:WaitForChild("Play")
function click()
wait(0.4)
song.Volume = 0.2
wait(0.1)
song.Volume = 0.1
wait(0.1)
song.Volume = 0.05
wait(0.1)
song.Volume = 0.04
wait(0.1)
song.Volume = 0.03
wait(0.1)
song.Volume = 0.02
wait(0.1)
song.Volume = 0.01
wait(0.1)
song:Stop()
end
gui.MouseButton1Down:connect(click)
end
end
game.Players.PlayerAdded:connect(onEnter)
script:WaitForChild("Intro"):Clone().Parent = game.StarterGui
script:Destroy()
|
--[[Wheel Alignment]]
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
|
Tune.FCamber = -0.6
Tune.RCamber = -0.7
Tune.FToe = 0
Tune.RToe = 0
|
-- Local Variables
|
local PlayersCanSpawn = false
local GameRunning = false
local HitArray = { }
local ScoreArray = { }
|
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]]
|
--
function OrbitalCamera:GetCameraToSubjectDistance()
return self.curDistance
end
function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
print("OrbitalCamera SetCameraToSubjectDistance ",desiredSubjectDistance)
local player = PlayersService.LocalPlayer
if player then
self.currentSubjectDistance = Util.Clamp(self.minDistance, self.maxDistance, desiredSubjectDistance)
-- OrbitalCamera is not allowed to go into the first-person range
self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD)
end
self.inFirstPerson = false
self:UpdateMouseBehavior()
return self.currentSubjectDistance
end
function OrbitalCamera:CalculateNewLookVector(suppliedLookVector, xyRotateVector)
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.y)
local yTheta = Util.Clamp(currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG), xyRotateVector.y)
local constrainedRotateInput = Vector2.new(xyRotateVector.x, yTheta)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookVector = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector
return newLookVector
end
function OrbitalCamera:GetGamepadPan(name, state, input)
if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if self.r3ButtonDown or self.l3ButtonDown then
-- R3 or L3 Thumbstick is depressed, right stick controls dolly in/out
if (input.Position.Y > THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 0.96
elseif (input.Position.Y < -THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 1.04
else
self.gamepadDollySpeedMultiplier = 1.00
end
else
if state == Enum.UserInputState.Cancel then
self.gamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
self.gamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
self.gamepadPanningCamera = ZERO_VECTOR2
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Pass
end
end
function OrbitalCamera:DoGamepadZoom(name, state, input)
if input.UserInputType == self.activeGamepad and (input.KeyCode == Enum.KeyCode.ButtonR3 or input.KeyCode == Enum.KeyCode.ButtonL3) then
if (state == Enum.UserInputState.Begin) then
self.r3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonR3
self.l3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonL3
elseif (state == Enum.UserInputState.End) then
if (input.KeyCode == Enum.KeyCode.ButtonR3) then
self.r3ButtonDown = false
elseif (input.KeyCode == Enum.KeyCode.ButtonL3) then
self.l3ButtonDown = false
end
if (not self.r3ButtonDown) and (not self.l3ButtonDown) then
self.gamepadDollySpeedMultiplier = 1.00
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Pass
end
end
function OrbitalCamera:BindGamepadInputActions()
if FFlagPlayerScriptsBindAtPriority then
self:BindAction("OrbitalCamGamepadPan", function(name, state, input) self:GetGamepadPan(name, state, input) end,
false, Enum.KeyCode.Thumbstick2)
self:BindAction("OrbitalCamGamepadZoom", function(name, state, input) self:DoGamepadZoom(name, state, input) end,
false, Enum.KeyCode.ButtonR3, Enum.KeyCode.ButtonL3)
else
local ContextActionService = game:GetService('ContextActionService')
ContextActionService:BindAction("OrbitalCamGamepadPan", function(name, state, input) self:GetGamepadPan(name, state, input) end, false, Enum.KeyCode.Thumbstick2)
ContextActionService:BindAction("OrbitalCamGamepadZoom", function(name, state, input) self:DoGamepadZoom(name, state, input) end, false, Enum.KeyCode.ButtonR3)
ContextActionService:BindAction("OrbitalCamGamepadZoomAlt", function(name, state, input) self:DoGamepadZoom(name, state, input) end, false, Enum.KeyCode.ButtonL3)
end
end
|
---------END LEFT DOOR
|
game.Workspace.DoorValues.Moving.Value = true
game.Workspace.DoorClosed.Value = false
wait(0.1)
until game.Workspace.DoorValues.Close.Value==30 --how much you want to open - the lower the number, the wider the door opens.
end
game.Workspace.DoorValues.Moving.Value = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- constants
|
local PLAYER = Players.LocalPlayer
local EFFECTS = Workspace.Effects
return function(character)
local rootPart = character.HumanoidRootPart
local ray = Ray.new(rootPart.Position, Vector3.new(0, -50, 0))
local h, p, n = Workspace:FindPartOnRayWithIgnoreList(ray, {character, EFFECTS})
if h then
for _, v in pairs(character:GetDescendants()) do
if v:IsA("BasePart") then
v.Transparency = 1
elseif v:IsA("Decal") then
v.Transparency = 1
end
end
local angle = math.rad(math.random(360))
local gravestone = script.Gravestone:Clone()
gravestone.Dirt.CFrame = CFrame.new(p, p + n) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.Angles(0, angle, 0)
gravestone.Stone.CFrame = CFrame.new(p, p + n) * CFrame.Angles(-math.pi/2, 0, 0) * CFrame.new(0, gravestone.Stone.Size.Y/2, 0) * CFrame.Angles(0, angle, 0)
gravestone.Parent = EFFECTS
gravestone.Dirt.DirtEmitter:Emit(10)
gravestone.Dirt.ImpactEmitter:Emit(10)
end
end
|
-- Directions of movement for each handle's dragged face
|
local AxisMultipliers = {
[Enum.NormalId.Top] = Vector3.new(0, 1, 0);
[Enum.NormalId.Bottom] = Vector3.new(0, -1, 0);
[Enum.NormalId.Front] = Vector3.new(0, 0, -1);
[Enum.NormalId.Back] = Vector3.new(0, 0, 1);
[Enum.NormalId.Left] = Vector3.new(-1, 0, 0);
[Enum.NormalId.Right] = Vector3.new(1, 0, 0);
}
function HandleDragging.new(Tool)
local self = {
Tool = Tool;
-- Handle state
IsHandleDragging = false;
Handles = nil;
-- Selection state
InitialExtentsSize = nil;
InitialExtentsCFrame = nil;
InitialState = nil;
InitialFocusCFrame = nil;
}
return setmetatable(self, HandleDragging)
end
function HandleDragging:AttachHandles(Part, Autofocus)
-- Creates and attaches handles to `Part`, and optionally automatically attaches to the focused part
-- Enable autofocus if requested and not already on
if Autofocus and not self.Tool.Maid.AutofocusHandle then
self.Tool.Maid.AutofocusHandle = Selection.FocusChanged:Connect(function ()
self:AttachHandles(Selection.Focus, true)
end)
-- Disable autofocus if not requested and on
elseif not Autofocus and self.Tool.Maid.AutofocusHandle then
self.Tool.Maid.AutofocusHandle = nil
end
-- Just attach and show the handles if they already exist
if self.Handles then
self.Handles:BlacklistObstacle(BoundingBox.GetBoundingBox())
self.Handles:SetAdornee(Part)
return
end
local AreaPermissions
local function OnHandleDragStart()
-- Prepare for moving parts when the handle is clicked
-- Prevent selection
Core.Targeting.CancelSelecting()
-- Indicate dragging via handles
self.IsHandleDragging = true
-- Freeze bounding box extents while dragging
if BoundingBox.GetBoundingBox() then
local InitialExtentsSize, InitialExtentsCFrame =
BoundingBox.CalculateExtents(Selection.Parts, BoundingBox.StaticExtents)
self.InitialExtentsSize = InitialExtentsSize
self.InitialExtentsCFrame = InitialExtentsCFrame
BoundingBox.PauseMonitoring()
end
-- Stop parts from moving, and capture the initial state of the parts
local InitialState, InitialFocusCFrame = self.Tool:PreparePartsForDragging()
self.InitialState = InitialState
self.InitialFocusCFrame = InitialFocusCFrame
-- Track the change
self.Tool:TrackChange()
-- Cache area permissions information
if Core.Mode == 'Tool' then
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Parts), Core.Player)
end
end
local function OnHandleDrag(Face, Distance)
-- Update parts when the handles are moved
-- Only drag if handle is enabled
if not self.IsHandleDragging then
return
end
-- Calculate the increment-aligned drag distance
Distance = MoveUtil.GetIncrementMultiple(Distance, self.Tool.Increment)
-- Move the parts along the selected axes by the calculated distance
self.Tool:MovePartsAlongAxesByFace(Face, Distance, self.InitialState, self.InitialFocusCFrame)
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Parts, Core.Player, false, AreaPermissions) then
local Part, InitialPartState = next(self.InitialState)
Part.CFrame = InitialPartState.CFrame
MoveUtil.TranslatePartsRelativeToPart(Part, self.InitialState)
Distance = 0
end
-- Signal out change in dragged distance
self.Tool.DragChanged:Fire(Distance)
-- Update bounding box if enabled in global axes movements
if self.Tool.Axes == 'Global' and BoundingBox.GetBoundingBox() then
BoundingBox.GetBoundingBox().CFrame = self.InitialExtentsCFrame + (AxisMultipliers[Face] * Distance)
end
end
local function OnHandleDragEnd()
if not self.IsHandleDragging then
return
end
-- Disable dragging
self.IsHandleDragging = false
-- Make joints, restore original anchor and collision states
for Part, State in pairs(self.InitialState) do
Part:MakeJoints()
Core.RestoreJoints(State.Joints)
Part.CanCollide = State.CanCollide
Part.Anchored = State.Anchored
end
-- Register change
self.Tool:RegisterChange()
-- Resume bounding box updates
BoundingBox.RecalculateStaticExtents()
BoundingBox.ResumeMonitoring()
end
-- Create the handles
local Handles = require(Libraries:WaitForChild 'Handles')
self.Handles = Handles.new({
Color = self.Tool.Color.Color,
Parent = Core.UIContainer,
Adornee = Part,
ObstacleBlacklist = { BoundingBox.GetBoundingBox() },
OnDragStart = OnHandleDragStart,
OnDrag = OnHandleDrag,
OnDragEnd = OnHandleDragEnd
})
end
function HandleDragging:HideHandles()
-- Hides the resizing handles
-- Make sure handles exist and are visible
if not self.Handles then
return
end
-- Hide the handles
self.Handles = self.Handles:Destroy()
-- Disable handle autofocus
self.Tool.Maid.AutofocusHandle = nil
end
return HandleDragging
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.