prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
---- IconMap ----
-- Image size: 256px x 256px
-- Icon size: 16px x 16px
-- Padding between each icon: 2px
-- Padding around image edge: 1px
-- Total icons: 14 x 14 (196)
|
local Icon do
local iconMap = 'http://www.roblox.com/asset/?id=' .. MAP_ID
game:GetService('ContentProvider'):Preload(iconMap)
local iconDehash do
-- 14 x 14, 0-based input, 0-based output
local f=math.floor
function iconDehash(h)
return f(h/14%14),f(h%14)
end
end
function Icon(IconFrame,index)
local row,col = iconDehash(index)
local mapSize = Vector2.new(256,256)
local pad,border = 2,1
local iconSize = 16
local class = 'Frame'
if type(IconFrame) == 'string' then
class = IconFrame
IconFrame = nil
end
if not IconFrame then
IconFrame = Create(class,{
Name = "Icon";
BackgroundTransparency = 1;
ClipsDescendants = true;
Create('ImageLabel',{
Name = "IconMap";
Active = false;
BackgroundTransparency = 1;
Image = iconMap;
Size = UDim2.new(mapSize.x/iconSize,0,mapSize.y/iconSize,0);
});
})
end
IconFrame.IconMap.Position = UDim2.new(-col - (pad*(col+1) + border)/iconSize,0,-row - (pad*(row+1) + border)/iconSize,0)
return IconFrame
end
end
local function CreateCell()
local tableCell = Instance.new("Frame")
tableCell.Size = UDim2.new(0.5, -1, 1, 0)
tableCell.BackgroundColor3 = Row.BackgroundColor
tableCell.BorderColor3 = Row.BorderColor
return tableCell
end
local function CreateLabel(readOnly)
local label = Instance.new("TextLabel")
label.Font = Row.Font
label.FontSize = Row.FontSize
label.TextXAlignment = Row.TextXAlignment
label.BackgroundTransparency = 1
if readOnly then
label.TextColor3 = Row.TextLockedColor
else
label.TextColor3 = Row.TextColor
end
return label
end
local function CreateTextButton(readOnly, onClick)
local button = Instance.new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
if readOnly then
button.TextColor3 = Row.TextLockedColor
else
button.TextColor3 = Row.TextColor
button.MouseButton1Click:connect(function()
onClick()
end)
end
return button
end
local function CreateObject(readOnly)
local button = Instance.new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
if readOnly then
button.TextColor3 = Row.TextLockedColor
else
button.TextColor3 = Row.TextColor
end
local cancel = Create(Icon('ImageButton',177),{
Name = "Cancel";
Visible = false;
Position = UDim2.new(1,-20,0,0);
Size = UDim2.new(0,20,0,20);
Parent = button;
})
return button
end
local function CreateTextBox(readOnly)
if readOnly then
local box = CreateLabel(readOnly)
return box
else
local box = Instance.new("TextBox")
if not SettingsRemote:Invoke("ClearProps") then
box.ClearTextOnFocus = false
end
box.Font = Row.Font
box.FontSize = Row.FontSize
box.TextXAlignment = Row.TextXAlignment
box.BackgroundTransparency = 1
box.TextColor3 = Row.TextColor
return box
end
end
local function CreateDropDownItem(text, onClick)
local button = Instance.new("TextButton")
button.Font = DropDown.Font
button.FontSize = DropDown.FontSize
button.TextColor3 = DropDown.TextColor
button.TextXAlignment = DropDown.TextXAlignment
button.BackgroundColor3 = DropDown.BackColor
button.AutoButtonColor = false
button.BorderSizePixel = 0
button.Active = true
button.Text = text
button.MouseEnter:connect(function()
button.TextColor3 = DropDown.TextColorOver
button.BackgroundColor3 = DropDown.BackColorOver
end)
button.MouseLeave:connect(function()
button.TextColor3 = DropDown.TextColor
button.BackgroundColor3 = DropDown.BackColor
end)
button.MouseButton1Click:connect(function()
onClick(text)
end)
return button
end
local function CreateDropDown(choices, currentChoice, readOnly, onClick)
local frame = Instance.new("Frame")
frame.Name = "DropDown"
frame.Size = UDim2.new(1, 0, 1, 0)
frame.BackgroundTransparency = 1
frame.Active = true
local menu = nil
local arrow = nil
local expanded = false
local margin = DropDown.BorderSizePixel;
local button = Instance.new("TextButton")
button.Font = Row.Font
button.FontSize = Row.FontSize
button.TextXAlignment = Row.TextXAlignment
button.BackgroundTransparency = 1
button.TextColor3 = Row.TextColor
if readOnly then
button.TextColor3 = Row.TextLockedColor
end
button.Text = currentChoice
button.Size = UDim2.new(1, -2 * Styles.Margin, 1, 0)
button.Position = UDim2.new(0, Styles.Margin, 0, 0)
button.Parent = frame
local function showArrow(color)
if arrow then arrow:Destroy() end
local graphicTemplate = Create('Frame',{
Name="Graphic";
BorderSizePixel = 0;
BackgroundColor3 = color;
})
local graphicSize = 16/2
arrow = ArrowGraphic(graphicSize,'Down',true,graphicTemplate)
arrow.Position = UDim2.new(1,-graphicSize * 2,0.5,-graphicSize/2)
arrow.Parent = frame
end
local function hideMenu()
expanded = false
showArrow(DropDown.ArrowColor)
if menu then menu:Destroy() end
end
local function showMenu()
expanded = true
menu = Instance.new("Frame")
menu.Size = UDim2.new(1, -2 * margin, 0, #choices * DropDown.Height)
menu.Position = UDim2.new(0, margin, 0, Row.Height + margin)
menu.BackgroundTransparency = 0
menu.BackgroundColor3 = DropDown.BackColor
menu.BorderColor3 = DropDown.BorderColor
menu.BorderSizePixel = DropDown.BorderSizePixel
menu.Active = true
menu.ZIndex = 5
menu.Parent = frame
local parentFrameHeight = menu.Parent.Parent.Parent.Parent.Size.Y.Offset
local rowHeight = menu.Parent.Parent.Parent.Position.Y.Offset
if (rowHeight + menu.Size.Y.Offset) > math.max(parentFrameHeight,PropertiesFrame.AbsoluteSize.y) then
menu.Position = UDim2.new(0, margin, 0, -1 * (#choices * DropDown.Height) - margin)
end
local function choice(name)
onClick(name)
hideMenu()
end
for i,name in pairs(choices) do
local option = CreateDropDownItem(name, function()
choice(name)
end)
option.Size = UDim2.new(1, 0, 0, 16)
option.Position = UDim2.new(0, 0, 0, (i - 1) * DropDown.Height)
option.ZIndex = menu.ZIndex
option.Parent = menu
end
end
showArrow(DropDown.ArrowColor)
if not readOnly then
button.MouseEnter:connect(function()
button.TextColor3 = Row.TextColor
showArrow(DropDown.ArrowColorOver)
end)
button.MouseLeave:connect(function()
button.TextColor3 = Row.TextColor
if not expanded then
showArrow(DropDown.ArrowColor)
end
end)
button.MouseButton1Click:connect(function()
if expanded then
hideMenu()
else
showMenu()
end
end)
end
return frame,button
end
local function CreateBrickColor(readOnly, onClick)
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundTransparency = 1
local colorPalette = Instance.new("Frame")
colorPalette.BackgroundTransparency = 0
colorPalette.SizeConstraint = Enum.SizeConstraint.RelativeXX
colorPalette.Size = UDim2.new(1, -2 * BrickColors.OuterBorder, 1, -2 * BrickColors.OuterBorder)
colorPalette.BorderSizePixel = BrickColors.BorderSizePixel
colorPalette.BorderColor3 = BrickColors.BorderColor
colorPalette.Position = UDim2.new(0, BrickColors.OuterBorder, 0, BrickColors.OuterBorder + Row.Height)
colorPalette.ZIndex = 5
colorPalette.Visible = false
colorPalette.BorderSizePixel = BrickColors.OuterBorder
colorPalette.BorderColor3 = BrickColors.OuterBorderColor
colorPalette.Parent = frame
local function show()
colorPalette.Visible = true
end
local function hide()
colorPalette.Visible = false
end
local function toggle()
colorPalette.Visible = not colorPalette.Visible
end
local colorBox = Instance.new("TextButton", frame)
colorBox.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)
colorBox.Size = UDim2.new(0, BrickColors.BoxSize, 0, BrickColors.BoxSize)
colorBox.Text = ""
colorBox.MouseButton1Click:connect(function()
if not readOnly then
toggle()
end
end)
if readOnly then
colorBox.AutoButtonColor = false
end
local spacingBefore = (Styles.Margin * 2) + BrickColors.BoxSize
local propertyLabel = CreateTextButton(readOnly, function()
if not readOnly then
toggle()
end
end)
propertyLabel.Size = UDim2.new(1, (-1 * spacingBefore) - Styles.Margin, 1, 0)
propertyLabel.Position = UDim2.new(0, spacingBefore, 0, 0)
propertyLabel.Parent = frame
local size = (1 / BrickColors.ColorsPerRow)
for index = 0, 127 do
local brickColor = BrickColor.palette(index)
local color3 = brickColor.Color
local x = size * (index % BrickColors.ColorsPerRow)
local y = size * math.floor(index / BrickColors.ColorsPerRow)
local brickColorBox = Instance.new("TextButton")
brickColorBox.Text = ""
brickColorBox.Size = UDim2.new(size,0,size,0)
brickColorBox.BackgroundColor3 = color3
brickColorBox.Position = UDim2.new(x, 0, y, 0)
brickColorBox.ZIndex = colorPalette.ZIndex
brickColorBox.Parent = colorPalette
brickColorBox.MouseButton1Click:connect(function()
hide()
onClick(brickColor)
end)
end
return frame,propertyLabel,colorBox
end
local function CreateColor3Control(readOnly, onClick)
local frame = Instance.new("Frame")
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundTransparency = 1
local colorBox = Instance.new("TextButton", frame)
colorBox.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)
colorBox.Size = UDim2.new(0, BrickColors.BoxSize, 0, BrickColors.BoxSize)
colorBox.Text = ""
colorBox.AutoButtonColor = false
local spacingBefore = (Styles.Margin * 2) + BrickColors.BoxSize
local box = CreateTextBox(readOnly)
box.Size = UDim2.new(1, (-1 * spacingBefore) - Styles.Margin, 1, 0)
box.Position = UDim2.new(0, spacingBefore, 0, 0)
box.Parent = frame
return frame,box,colorBox
end
function CreateCheckbox(value, readOnly, onClick)
local checked = value
local mouseover = false
local checkboxFrame = Instance.new("ImageButton")
checkboxFrame.Size = UDim2.new(0, Sprite.Width, 0, Sprite.Height)
checkboxFrame.BackgroundTransparency = 1
checkboxFrame.ClipsDescendants = true
--checkboxFrame.Position = UDim2.new(0, Styles.Margin, 0, Styles.Margin)
local spritesheetImage = Instance.new("ImageLabel", checkboxFrame)
spritesheetImage.Name = "SpritesheetImageLabel"
spritesheetImage.Size = UDim2.new(0, Spritesheet.Width, 0, Spritesheet.Height)
spritesheetImage.Image = Spritesheet.Image
spritesheetImage.BackgroundTransparency = 1
local function updateSprite()
local spriteName = GetCheckboxImageName(checked, readOnly, mouseover)
local spritePosition = SpritePosition(spriteName)
spritesheetImage.Position = UDim2.new(0, -1 * spritePosition[1], 0, -1 * spritePosition[2])
end
local function setValue(val)
checked = val
updateSprite()
end
if not readOnly then
checkboxFrame.MouseEnter:connect(function() mouseover = true updateSprite() end)
checkboxFrame.MouseLeave:connect(function() mouseover = false updateSprite() end)
checkboxFrame.MouseButton1Click:connect(function()
onClick(checked)
end)
end
updateSprite()
return checkboxFrame, setValue
end
|
-- Make a base cosmetic bullet object. This will be cloned every time we fire off a ray.
|
local CosmeticBullet = Instance.new("Part")
CosmeticBullet.Material = Enum.Material.Glass
CosmeticBullet.Transparency = .5
CosmeticBullet.Color = Color3.fromRGB(58, 160, 255)
CosmeticBullet.CanCollide = false
CosmeticBullet.CastShadow = false
CosmeticBullet.Anchored = true
CosmeticBullet.Size = Vector3.new(0.2, 0.2, 2.4)
local sphereMesh = Instance.new("SpecialMesh")
sphereMesh.MeshType = Enum.MeshType.Sphere
sphereMesh.Parent = CosmeticBullet
|
--Wheel Stabilizer Gyro
|
Tune.FGyroD = 100
Tune.FGyroMaxTorque = Vector3.new(1,0,1)
Tune.FGyroP = 0
Tune.RGyroD = 100
Tune.RGyroMaxTorque = Vector3.new(1,0,1)
Tune.RGyroP = 0
|
--SecondLogic @ INSPARE
|
wait(.2)
local out=false
coroutine.resume(coroutine.create(function()
local fr = 0
local trs=1
while wait(.05) do
fr = fr+1
if fr>=10 then fr=0 end
if not out then
trs=math.max(0,trs-.05)
else
trs=math.min(1,trs+.05)
end
for i,v in pairs(script.Parent.Frame:GetChildren()) do
v.Frame.ImageLabel.ImageTransparency = trs
v.Frame.ImageLabel.Position=UDim2.new(-(fr%3),0,-math.floor(fr/3),0)
if out then
v.BackgroundTransparency=.5+(.5*trs)
v.Frame.ImageLabel.BackgroundTransparency=trs
end
end
if out then
script.Parent.IN.TextTransparency=trs
script.Parent.SPARE.TextTransparency=trs
end
if out and trs==1 then
break
end
end
script.Parent:Destroy()
end))
game:GetService("RunService").RenderStepped:connect(function()
for i,v in pairs(script.Parent.Frame:GetChildren()) do
v.Frame.Position = UDim2.new(0,-250-v.Position.X.Offset-script.Parent.Frame.Position.X.Offset,0,-136-v.Position.Y.Offset)
end
end)
script.Parent.Frame:TweenPosition(UDim2.new(0,-100,0,0),Enum.EasingDirection.InOut,Enum.EasingStyle.Linear,10)
script.Parent.IN:TweenPosition(UDim2.new(0.5,-74,0.5,100),Enum.EasingDirection.InOut,Enum.EasingStyle.Linear,10)
script.Parent.SPARE:TweenPosition(UDim2.new(0.5,6,0.5,100),Enum.EasingDirection.InOut,Enum.EasingStyle.Linear,10)
script.Parent.Frame.B:TweenPosition(UDim2.new(0.5, -44,0.5, -134),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
script.Parent.Frame.C:TweenPosition(UDim2.new(0.5, -44,0.5, -134),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
script.Parent.Frame.D:TweenPosition(UDim2.new(0.5, -44,0.5, -134),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
script.Parent.Frame.E:TweenPosition(UDim2.new(0.5, -44,0.5, -134),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
wait(.35)
script.Parent.Frame.C:TweenPosition(UDim2.new(0.5, -44,0.5, -44),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
script.Parent.Frame.D:TweenPosition(UDim2.new(0.5, -44,0.5, 46),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
script.Parent.Frame.E:TweenPosition(UDim2.new(0.5, -44,0.5, 46),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
wait(.35)
script.Parent.Frame.E:TweenPosition(UDim2.new(0.5, -134,0.5, 46),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,.3)
wait(1)
for i=1,30 do
for _,v in pairs(script.Parent.Frame:GetChildren()) do
v.BackgroundTransparency=1-(i/60)
end
script.Parent.IN.TextTransparency=1-(i/30)
script.Parent.SPARE.TextTransparency=1-(i/30)
wait(.01)
end
wait(1.5)
out=true
|
--//everything else
|
F.updateLights = function(lights, bool)
if lights == 'brake' then
body.Brake.Material = bool and "Neon" or "SmoothPlastic"
body.Brake.BrickColor = bool and BrickColor.new("Really red") or BrickColor.new("Crimson")
elseif lights == 'beam' then
|
-- Decompiled with the Synapse X Luau decompiler.
|
while not require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library")).Loaded do
game:GetService("RunService").Heartbeat:Wait();
end;
return function(p1, p2)
end;
|
---Adjusts the camera Y touch Sensitivity when moving away from the center and in the TOUCH_SENSITIVTY_ADJUST_AREA
|
function BaseCamera:AdjustTouchSensitivity(delta, sensitivity)
local cameraCFrame = game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CFrame
if not cameraCFrame then
return sensitivity
end
local currPitchAngle = cameraCFrame:ToEulerAnglesYXZ()
local multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y
if currPitchAngle > TOUCH_ADJUST_AREA_UP and delta.Y < 0 then
local fractionAdjust = (currPitchAngle - TOUCH_ADJUST_AREA_UP)/(MAX_Y - TOUCH_ADJUST_AREA_UP)
fractionAdjust = 1 - (1 - fractionAdjust)^3
multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y - fractionAdjust * (
TOUCH_SENSITIVTY_ADJUST_MAX_Y - TOUCH_SENSITIVTY_ADJUST_MIN_Y)
elseif currPitchAngle < TOUCH_ADJUST_AREA_DOWN and delta.Y > 0 then
local fractionAdjust = (currPitchAngle - TOUCH_ADJUST_AREA_DOWN)/(MIN_Y - TOUCH_ADJUST_AREA_DOWN)
fractionAdjust = 1 - (1 - fractionAdjust)^3
multiplierY = TOUCH_SENSITIVTY_ADJUST_MAX_Y - fractionAdjust * (
TOUCH_SENSITIVTY_ADJUST_MAX_Y - TOUCH_SENSITIVTY_ADJUST_MIN_Y)
end
return Vector2.new(
sensitivity.X,
sensitivity.Y * multiplierY
)
end
function BaseCamera:OnTouchBegan(input, processed)
local canUseDynamicTouch = self.isDynamicThumbstickEnabled and not processed
if canUseDynamicTouch then
if self.dynamicTouchInput == nil and isInDynamicThumbstickArea(input) then
-- First input in the dynamic thumbstick area should always be ignored for camera purposes
-- Even if the dynamic thumbstick does not process it immediately
self.dynamicTouchInput = input
return
end
self.fingerTouches[input] = processed
self.inputStartPositions[input] = input.Position
self.inputStartTimes[input] = tick()
self.numUnsunkTouches = self.numUnsunkTouches + 1
end
end
function BaseCamera:OnTouchChanged(input, processed)
if self.fingerTouches[input] == nil then
if self.isDynamicThumbstickEnabled then
return
end
self.fingerTouches[input] = processed
if not processed then
self.numUnsunkTouches = self.numUnsunkTouches + 1
end
end
if self.numUnsunkTouches == 1 then
if self.fingerTouches[input] == false then
self.panBeginLook = self.panBeginLook or self:GetCameraLookVector()
self.startPos = self.startPos or input.Position
self.lastPos = self.lastPos or self.startPos
self.userPanningTheCamera = true
local delta = input.Position - self.lastPos
delta = Vector2.new(delta.X, delta.Y * UserGameSettings:GetCameraYInvertValue())
if self.panEnabled then
local adjustedTouchSensitivity = TOUCH_SENSITIVTY
if FFlagUserTouchSensitivityAdjust then
self:AdjustTouchSensitivity(delta, TOUCH_SENSITIVTY)
end
local desiredXYVector = self:InputTranslationToCameraAngleChange(delta, adjustedTouchSensitivity)
self.rotateInput = self.rotateInput + desiredXYVector
end
self.lastPos = input.Position
end
else
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
end
if self.numUnsunkTouches == 2 then
local unsunkTouches = {}
for touch, wasSunk in pairs(self.fingerTouches) do
if not wasSunk then
table.insert(unsunkTouches, touch)
end
end
if #unsunkTouches == 2 then
local difference = (unsunkTouches[1].Position - unsunkTouches[2].Position).magnitude
if self.startingDiff and self.pinchBeginZoom then
local scale = difference / math.max(0.01, self.startingDiff)
local clampedScale = Util.Clamp(0.1, 10, scale)
if self.distanceChangeEnabled then
self:SetCameraToSubjectDistance(self.pinchBeginZoom / clampedScale)
end
else
self.startingDiff = difference
self.pinchBeginZoom = self:GetCameraToSubjectDistance()
end
end
else
self.startingDiff = nil
self.pinchBeginZoom = nil
end
end
function BaseCamera:OnTouchEnded(input, processed)
if input == self.dynamicTouchInput then
self.dynamicTouchInput = nil
return
end
if self.fingerTouches[input] == false then
if self.numUnsunkTouches == 1 then
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
elseif self.numUnsunkTouches == 2 then
self.startingDiff = nil
self.pinchBeginZoom = nil
end
end
if self.fingerTouches[input] ~= nil and self.fingerTouches[input] == false then
self.numUnsunkTouches = self.numUnsunkTouches - 1
end
self.fingerTouches[input] = nil
self.inputStartPositions[input] = nil
self.inputStartTimes[input] = nil
end
function BaseCamera:OnMouse2Down(input, processed)
if processed then return end
self.isRightMouseDown = true
self:OnMousePanButtonPressed(input, processed)
end
function BaseCamera:OnMouse2Up(input, processed)
self.isRightMouseDown = false
self:OnMousePanButtonReleased(input, processed)
end
function BaseCamera:OnMouse3Down(input, processed)
if processed then return end
self.isMiddleMouseDown = true
self:OnMousePanButtonPressed(input, processed)
end
function BaseCamera:OnMouse3Up(input, processed)
self.isMiddleMouseDown = false
self:OnMousePanButtonReleased(input, processed)
end
function BaseCamera:OnMouseMoved(input, processed)
if not self.hasGameLoaded and VRService.VREnabled then
return
end
local inputDelta = input.Delta
inputDelta = Vector2.new(inputDelta.X, inputDelta.Y * UserGameSettings:GetCameraYInvertValue())
if self.panEnabled and ((self.startPos and self.lastPos and self.panBeginLook) or self.inFirstPerson or self.inMouseLockedMode) then
local desiredXYVector = self:InputTranslationToCameraAngleChange(inputDelta,MOUSE_SENSITIVITY)
self.rotateInput = self.rotateInput + desiredXYVector
end
if self.startPos and self.lastPos and self.panBeginLook then
self.lastPos = self.lastPos + input.Delta
end
end
function BaseCamera:OnMousePanButtonPressed(input, processed)
if processed then return end
self:UpdateMouseBehavior()
self.panBeginLook = self.panBeginLook or self:GetCameraLookVector()
self.startPos = self.startPos or input.Position
self.lastPos = self.lastPos or self.startPos
self.userPanningTheCamera = true
end
function BaseCamera:OnMousePanButtonReleased(input, processed)
self:UpdateMouseBehavior()
if not (self.isRightMouseDown or self.isMiddleMouseDown) then
self.panBeginLook = nil
self.startPos = nil
self.lastPos = nil
self.userPanningTheCamera = false
end
end
function BaseCamera:OnMouseWheel(input, processed) -- remove with FFlagUserPointerActionsInPlayerScripts
if not self.hasGameLoaded and VRService.VREnabled then
return
end
if not processed then
if self.distanceChangeEnabled then
local wheelInput = Util.Clamp(-1, 1, -input.Position.Z)
local newDistance
if self.inFirstPerson and wheelInput > 0 then
newDistance = FIRST_PERSON_DISTANCE_THRESHOLD
else
-- The 0.156 and 1.7 values are the slope and intercept of a line that is replacing the old
-- rk4Integrator function which was not being used as an integrator, only to get a delta as a function of distance,
-- which was linear as it was being used. These constants preserve the status quo behavior.
newDistance = self.currentSubjectDistance + 0.156 * self.currentSubjectDistance * wheelInput + 1.7 * math.sign(wheelInput)
end
self:SetCameraToSubjectDistance(newDistance)
end
end
end
function BaseCamera:UpdateMouseBehavior()
-- first time transition to first person mode or mouse-locked third person
if self.inFirstPerson or self.inMouseLockedMode then
UserGameSettings.RotationType = Enum.RotationType.CameraRelative
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
else
UserGameSettings.RotationType = Enum.RotationType.MovementRelative
if self.isRightMouseDown or self.isMiddleMouseDown then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
end
function BaseCamera:UpdateForDistancePropertyChange()
-- Calling this setter with the current value will force checking that it is still
-- in range after a change to the min/max distance limits
self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end
function BaseCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
local player = Players.LocalPlayer
local lastSubjectDistance = self.currentSubjectDistance
-- By default, camera modules will respect LockFirstPerson and override the currentSubjectDistance with 0
-- regardless of what Player.CameraMinZoomDistance is set to, so that first person can be made
-- available by the developer without needing to allow players to mousewheel dolly into first person.
-- Some modules will override this function to remove or change first-person capability.
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
local newSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, desiredSubjectDistance)
if newSubjectDistance < FIRST_PERSON_DISTANCE_THRESHOLD then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
else
self.currentSubjectDistance = newSubjectDistance
if self.inFirstPerson then
self:LeaveFirstPerson()
end
end
end
-- Pass target distance and zoom direction to the zoom controller
ZoomController.SetZoomParameters(self.currentSubjectDistance, math.sign(desiredSubjectDistance - lastSubjectDistance))
-- Returned only for convenience to the caller to know the outcome
return self.currentSubjectDistance
end
function BaseCamera:SetCameraType( cameraType )
--Used by derived classes
self.cameraType = cameraType
end
function BaseCamera:GetCameraType()
return self.cameraType
end
|
---
|
script.Parent["1"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["2"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["3"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["4"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["5"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["6"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["7"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["8"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["9"].ClickDetector.MouseClick:Connect(kventer)
script.Parent["0"].ClickDetector.MouseClick:Connect(kventer)
|
--[[ # YAY CONTROLING THE ENTIRE INTRO FROM HERE! # ]]
|
--
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
game.ReplicatedStorage.GameTrackIntro:Play()
local settingsFramePos = UDim2.new(0.377,0 , 0.272, 0)
game.Lighting.IntroBlur.Enabled = true
script.IntroGui.Enabled = true
local player = game.Players.LocalPlayer
game.StarterGui["Realism Mod"].Sprint.Enabled = false
local IntroGui = script.IntroGui
local lighting = game.Lighting
IntroGui.ButtonFrame:TweenPosition(UDim2.new(0.4, 0, 0.696, 0), "In", "Sine", 0.5)
IntroGui.ButtonFrame.PlayButton.MouseButton1Click:Connect(function() --[[ PLAY ]]--
IntroGui.ButtonFrame:TweenPosition(UDim2.new(0, 0, -1, -1), "In", "Sine", 0.5)
wait(0.5)
SetValue = true
game.StarterGui["Realism Mod"].Sprint.Enabled = true
--[[ THIS PART OF THE SCRIPT USED TO BE A CONTROLLING CAMERA ]]--
lighting.IntroBlur.Enabled = false
IntroGui.Enabled = false
workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
workspace.CurrentCamera.CFrame = player.Character.HumanoidRootPart.CFrame
game.ReplicatedStorage.GameTrackIntro:Stop()
game.ReplicatedStorage.GameplayAudio:Play()
end)
IntroGui.ButtonFrame.SettingButton.MouseButton1Click:Connect(function() --[[ SETTINGS ]]--
IntroGui.ButtonFrame:TweenPosition(UDim2.new(0, 0, -1, -1), "InOut", "Sine", 0.5)
wait(0.5)
workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.IntroCamera2.CFrame
IntroGui.SettingsFrame:TweenPosition(settingsFramePos, "InOut", "Sine", 0.5)
end)
IntroGui.ButtonFrame.ChangelogButton.MouseButton1Click:Connect(function() --[[ CHANGELOGS ]]--
IntroGui.ButtonFrame:TweenPosition(UDim2.new(0, 0, -1, -1), "InOut", "Sine", 0.5)
wait(0.5)
IntroGui.ChangelogFrame:TweenPosition(settingsFramePos, "InOut", "Sine", 0.5)
workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CFrame = workspace.IntroCamera3.CFrame
end)
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
|
vars.Wandering.Changed:connect(function(b)
if vars.Wandering.Value and not vars.Attacking.Value and not vars.Chasing.Value then
if sdb then
removeSound()
else
playSound(sr[4])
end
end
end)
vars.Attacking.Changed:connect(function(b)
if vars.Attacking.Value then
removeSound()
playSound(sr[1])
end
end)
vars.Chasing.Changed:connect(function(b)
if vars.Chasing.Value and not vars.Wandering.Value and not vars.Attacking.Value then
if sdb then
removeSound()
else
playSound(sr[2])
end
end
end)
|
-- create a sound
|
local sound = workspace.World.MusicPlayer.GUIPart:WaitForChild("Sound")
|
--[=[
Subscribes immediately, fireCallback may return a maid (or a task a maid can handle)
to clean up
@param fireCallback function?
@param failCallback function?
@param completeCallback function?
@return MaidTask
]=]
|
function Observable:Subscribe(fireCallback, failCallback, completeCallback)
local sub = Subscription.new(fireCallback, failCallback, completeCallback)
local cleanup = self._onSubscribe(sub)
if cleanup then
sub:_giveCleanup(cleanup)
end
return sub
end
return Observable
|
-- Trace which interactions trigger each commit.
|
exports.enableSchedulerTracing = _G.__PROFILE__
|
--[[
-- {PoisonApple, PoisonCake, PoisonPorkChop}
local BaseIdUrl = 'http://www.roblox.com/asset/?id='
local IconIds = {'87862872', '87863072', '87871704'}
local MeshIds = {'87862943', '87863104', '87863169'}
local TextureIds = {'87862921', '87863090', '87863148'}
local HandleSizes = {Vector3.new(1.2, 1.2, 1.2), Vector3.new(1.08, 1.11, 1.14), Vector3.new(0.45, 1.82, 1.33)}
--]]
|
local MyModel = nil
local MyPlayer = nil
uses = 0
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
end
local function OnActivated()
if not MyModel or not MyModel:FindFirstChild('Humanoid') or not Tool.Enabled then return end
Tool.Enabled = false
uses = uses + 1
ThrowSound:Play()
local handleClone = ToolHandle:Clone()
DebrisService:AddItem(handleClone, 30)
--handleClone.Velocity = (MyModel.Humanoid.TargetPoint - ToolHandle.CFrame.p).unit * THROW_SPEED
handleClone.Name = 'Food'
handleClone.Parent = Workspace
handleClone.Transparency = 0
handleClone.CanCollide = true
Instance.new('BodyGyro', handleClone) -- Keeps it upright
local selfDestructScript = handleClone:FindFirstChild('SelfDestruct')
if selfDestructScript and selfDestructScript:FindFirstChild('TimeToLive') then
selfDestructScript.TimeToLive.Value = TIME_TO_LIVE
selfDestructScript.Disabled = false
end
local foodScript = handleClone:FindFirstChild('PoisonedFood')
if foodScript then
local creator = Instance.new('ObjectValue', foodScript)
creator.Name = 'Creator'
creator.Value = MyPlayer
foodScript.Disabled = false
end
handleClone.CFrame = Tool.Parent:FindFirstChild("HumanoidRootPart").CFrame
if uses >= 3 then
Tool:Destroy()
end
--[[ Load new item (while we wait)
local index = math.random(3)
ToolHandle.Mesh.MeshId = BaseIdUrl .. MeshIds[index]
ToolHandle.Mesh.TextureId = BaseIdUrl .. TextureIds[index]
ToolHandle.Size = HandleSizes[index] -- This breaks the weld
MyWeld.Parent = Game.JointsService -- Fix the weld
Tool.TextureId = BaseIdUrl .. IconIds[index] -- Change the tool icon
--]]
wait(COOLDOWN)
Tool.Enabled = true
end
local function OnUnequipped()
ToolHandle.Transparency = 0
end
Tool.Equipped:connect(OnEquipped)
Tool.Activated:connect(OnActivated)
Tool.Unequipped:connect(OnUnequipped)
|
--// # key, Wail
|
mouse.KeyDown:connect(function(key)
if key=="f" then
if veh.Lightbar.middle.Wail.IsPlaying == true then
veh.Lightbar.middle.Wail:Stop()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
else
veh.Lightbar.middle.Wail:Play()
veh.Lightbar.middle.Yelp:Stop()
veh.Lightbar.middle.Priority:Stop()
script.Parent.Parent.Sirens.Wail.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
script.Parent.Parent.Sirens.Yelp.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
script.Parent.Parent.Sirens.Priority.BackgroundColor3 = Color3.fromRGB(62, 62, 62)
end
end
end)
|
--[=[
Ensures the computed version of a value is limited by lifetime instead
of multiple. Used in conjunction with [Blend.Children] and [Blend.Computed].
:::warning
In general, cosntructing new instances like this is a bad idea, so it's recommended against it.
:::
```lua
Blend.New "ScreenGui" {
Parent = game.Players.LocalPlayer.PlayerGui;
[Blend.Children] = {
Blend.Single(Blend.Computed(percentVisible, function()
-- you generally would not want to do this anyway because this reconstructs a new frame
-- every frame.
Blend.New "Frame" {
Size = UDim2.new(1, 0, 1, 0);
BackgroundTransparency = 0.5;
};
end)
};
};
```
@function Single
@param Observable<Instance | Brio<Instance>>
@return Observable<Brio<Instance>>
@within Blend
]=]
|
function Blend.Single(observable)
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(observable:Subscribe(function(result)
if Brio.isBrio(result) then
local copy = BrioUtils.clone(result)
maid._current = copy
sub:Fire(copy)
return copy
end
local current = Brio.new(result)
maid._current = current
sub:Fire(current)
return current
end))
return maid
end)
end
|
-----------------------------------
|
elseif script.Parent.Parent.Parent.TrafficControl.Value == "=" then
script.Parent.Parent.Off.Spotlight2.Transparency = 1
script.Parent.Parent.Off.Spotlight3.Transparency = 1
script.Parent.Parent.Off.Part.Transparency = 1
script.Parent.Parent.Off.Union.Transparency = 1
script.Parent.Parent.Off.a1.Transparency = 1
script.Parent.Parent.Front.Spotlight2.Transparency = 0.3
script.Parent.Parent.Front.Spotlight2.Point.Enabled = true
script.Parent.Parent.Front.Spotlight2.Lighto.Enabled = true
script.Parent.Parent.Front.Part.Transparency = 0
script.Parent.Parent.Front.Union.Transparency = 0
script.Parent.Parent.Front.a1.Transparency = 0
script.Parent.Parent.Left.Spotlight2.Transparency = 1
script.Parent.Parent.Left.Spotlight2.Point.Enabled = false
script.Parent.Parent.Left.Spotlight2.Lighto.Enabled = false
script.Parent.Parent.Left.Part.Transparency = 1
script.Parent.Parent.Left.Union.Transparency = 1
script.Parent.Parent.Left.a1.Transparency = 1
script.Parent.Parent.Right.Spotlight2.Transparency = 1
script.Parent.Parent.Right.Spotlight2.Point.Enabled = false
script.Parent.Parent.Right.Spotlight2.Lighto.Enabled = false
script.Parent.Parent.Right.Part.Transparency = 1
script.Parent.Parent.Right.Union.Transparency = 1
script.Parent.Parent.Right.a1.Transparency = 1
|
-- << LOCAL FUNCTIONS >>
|
local function displayHomeArrowIcons(status)
for a,b in pairs(mainFrame.Pages.Home:GetChildren()) do
if b:FindFirstChild("Arrow") then
b.Arrow.Visible = status
end
end
end
local function updateDragBar()
if currentPage.Name == "Home" then
local forceUpperFrom = main.hdAdminCoreName:find(" ")
mainFrame.DragBar.Title.Text = main.hdAdminCoreName:sub(1, forceUpperFrom-1).. (main.hdAdminCoreName:sub(forceUpperFrom)):upper()
mainFrame.DragBar.Back.Visible = false
mainFrame.DragBar.Title.Position = UDim2.new(0.04, 0, 0.15, 0)
displayHomeArrowIcons(true)
else
mainFrame.DragBar.Title.Text = string.upper(currentPage.Name)
mainFrame.DragBar.Back.Visible = true
mainFrame.DragBar.Title.Position = UDim2.new(0.15, 0, 0.15, 0)
displayHomeArrowIcons(false)
end
end
local function tweenPages(tweenOutPosition, tweenInPage, instantTween)
local tweenTime
if instantTween then
tweenTime = 0
else
tweenTime = 0.3
end
local tweenInfoSlide = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad)
local oldPage = currentPage
local tweenOut = main.tweenService:Create(currentPage, tweenInfoSlide, {Position = tweenOutPosition})
local tweenIn = main.tweenService:Create(tweenInPage, tweenInfoSlide, {Position = UDim2.new(0, 0, 0, 0)})
if tweenInPage.Name == "Home" then
tweenInPage.Position = UDim2.new(-1,0,0,0)
else
tweenInPage.Position = UDim2.new(1,0,0,0)
if tweenInPage.Name == "Admin" then
spawn(function() main:GetModule("PageAdmin"):UpdatePages() end)
end
end
tweenInPage.Visible = true
tweenOut:Play()
tweenIn:Play()
currentPage = tweenInPage
updateDragBar()
tweenIn.Completed:Wait()
oldPage.Visible = false
end
|
--strategy that you jump (when you can run away in a straight line) while opponent's lunge is down
| |
-- Decompiled with the Synapse X Luau decompiler.
|
local l__TweenService__1 = game:GetService("TweenService");
local l__Modules__2 = game:GetService("ReplicatedStorage"):WaitForChild("Modules");
local v3 = require(l__Modules__2.Raycast);
local l__Ignored__4 = workspace:WaitForChild("Ignored");
local v5 = {};
local u1 = require(l__Modules__2.PseudoDebris);
function v5.RunStompFx(p1, p2, p3, p4)
local v6 = Instance.new("Attachment", workspace.Terrain);
v6.WorldPosition = p2.Position;
u1:AddItem(v6, 12.5, false);
for v7, v8 in pairs(script.FX:GetDescendants()) do
if v8:IsA("ParticleEmitter") then
local v9 = v8:Clone();
v9.Parent = v6;
v9:Emit(v9:GetAttribute("EmitCount"));
end;
end;
return nil;
end;
return v5;
|
--[=[
Flat map equivalent for brios. The resulting observables will
be disconnected at the end of the brio.
Like [RxBrioUtils.flatMap], but emitted values are wrapped in brios.
The lifetime of this brio is limited by the lifetime of the
input brios, which are unwrapped and repackaged.
@since 3.6.0
@param project (value: TBrio) -> TProject | Brio<TProject>
@return (source: Observable<Brio<TBrio>> -> Observable<Brio<TResult>>)
]=]
|
function RxBrioUtils.flatMapBrio(project)
return Rx.flatMap(RxBrioUtils.mapBrioBrio(project))
end
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]]
|
--
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
function CompareTable(p1, p2, p3)
local v1 = type(p1);
local v2 = type(p2);
if v1 ~= v2 then
return false;
end;
if v1 ~= "table" then
if v2 ~= "table" then
return p1 == p2;
end;
end;
local v3 = getmetatable(p1);
if not p3 then
if v3 then
if v3.__eq then
return p1 == p2;
end;
end;
end;
local v4, v5, v6 = pairs(p1);
for v7, v8 in pairs(p1) do
local v9 = p2[v7];
if v9 ~= nil then
else
return false;
end;
if not CompareTable(v8, v9) then
return false;
end;
end
for v13, v14 in pairs(p2) do
local v15 = p1[v13];
if v15 ~= nil then
else
return false;
end;
if not CompareTable(v15, v14) then
return false;
end;
end
return true;
end;
return CompareTable;
|
--[[Transmission]]
|
Tune.TransModes = {"Auto", "Semi", "Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 4.06 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
--[[ 7 ]] 0.53 ,
--[[ 8 ]] 0.47 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
--Server-sided code for handling game interactions with player
| |
-----------------
--| Variables |--
-----------------
|
local Tool = script.Parent
local FireAndReloadAnimation = WaitForChild(script, 'FireAndReload')
local FireAndReloadTrack = nil
|
--------------| MODIFY COMMANDS |--------------
|
SetCommandRankByName = {
--["jump"] = "VIP";
};
SetCommandRankByTag = {
--["abusive"] = "Admin";
};
};
|
-- Ganondude
-- For those players fond of adding many anti-lag scripts, this script is sure to help.
|
wait(1)
local parts = game.Workspace:GetChildren()
for i = 1,#parts do
local name = string.lower(parts[i].Name)
if (string.find(name,"lag") ~= nil) and ((string.find(name,"anti") ~= nil) or (string.find(name,"no") ~= nil) or (string.find(name,"remover") ~= nil) or (string.find(name,"killer") ~= nil)) and (parts[i] ~= script) then
parts[i]:remove()
end
end
wait()
script:remove()
|
--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.Part0 = torso
weld1.Parent = torso
weld1.Part1 = arms[1]
weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles
welds[1] = weld1
weld1.Name = "weld1"
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
welds[2] = weld2
weld2.Name = "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, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90)) ---The first set of numbers changes where the arms move to the second set changes their angles
welds[1] = weld1
weld1.Name = "weld1"
local weld2 = Instance.new("Weld")
weld2.Part0 = torso
weld2.Parent = torso
weld2.Part1 = arms[2]
weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0) --- Same as top
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
print("arms")
end
end)
|
-- Container for temporary connections (disconnected automatically)
|
local Connections = {};
function ResizeTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
ShowHandles();
BindShortcutKeys();
end;
function ResizeTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
HideHandles();
ClearConnections();
SnapTracking.StopTracking();
FinishSnapping();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ClearConnection(ConnectionKey)
-- Clears the given specific connection
local Connection = Connections[ConnectionKey];
-- Disconnect the connection if it exists
if Connection then
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if ResizeTool.UI then
-- Reveal the UI
ResizeTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
ResizeTool.UI = Core.Tool.Interfaces.BTResizeToolGUI:Clone();
ResizeTool.UI.Parent = Core.UI;
ResizeTool.UI.Visible = true;
-- Add functionality to the directions option switch
local DirectionsSwitch = ResizeTool.UI.DirectionsOption;
DirectionsSwitch.Normal.Button.MouseButton1Down:connect(function ()
SetDirections('Normal');
end);
DirectionsSwitch.Both.Button.MouseButton1Down:connect(function ()
SetDirections('Both');
end);
-- Add functionality to the increment input
local IncrementInput = ResizeTool.UI.IncrementOption.Increment.TextBox;
IncrementInput.FocusLost:connect(function (EnterPressed)
ResizeTool.Increment = tonumber(IncrementInput.Text) or ResizeTool.Increment;
IncrementInput.Text = Support.Round(ResizeTool.Increment, 4);
end);
-- Add functionality to the size inputs
local XInput = ResizeTool.UI.Info.SizeInfo.X.TextBox;
local YInput = ResizeTool.UI.Info.SizeInfo.Y.TextBox;
local ZInput = ResizeTool.UI.Info.SizeInfo.Z.TextBox;
XInput.FocusLost:connect(function (EnterPressed)
local NewSize = tonumber(XInput.Text);
if NewSize then
SetAxisSize('X', NewSize);
end;
end);
YInput.FocusLost:connect(function (EnterPressed)
local NewSize = tonumber(YInput.Text);
if NewSize then
SetAxisSize('Y', NewSize);
end;
end);
ZInput.FocusLost:connect(function (EnterPressed)
local NewSize = tonumber(ZInput.Text);
if NewSize then
SetAxisSize('Z', NewSize);
end;
end);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not ResizeTool.UI then
return;
end;
-- Hide the UI
ResizeTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not ResizeTool.UI then
return;
end;
-- Only show and calculate selection info if it's not empty
if #Selection.Items == 0 then
ResizeTool.UI.Info.Visible = false;
ResizeTool.UI.Size = UDim2.new(0, 245, 0, 90);
return;
else
ResizeTool.UI.Info.Visible = true;
ResizeTool.UI.Size = UDim2.new(0, 245, 0, 150);
end;
-----------------------------------------
-- Update the size information indicators
-----------------------------------------
-- Identify common sizes across axes
local XVariations, YVariations, ZVariations = {}, {}, {};
for _, Part in pairs(Selection.Items) do
table.insert(XVariations, Support.Round(Part.Size.X, 3));
table.insert(YVariations, Support.Round(Part.Size.Y, 3));
table.insert(ZVariations, Support.Round(Part.Size.Z, 3));
end;
local CommonX = Support.IdentifyCommonItem(XVariations);
local CommonY = Support.IdentifyCommonItem(YVariations);
local CommonZ = Support.IdentifyCommonItem(ZVariations);
-- Shortcuts to indicators
local XIndicator = ResizeTool.UI.Info.SizeInfo.X.TextBox;
local YIndicator = ResizeTool.UI.Info.SizeInfo.Y.TextBox;
local ZIndicator = ResizeTool.UI.Info.SizeInfo.Z.TextBox;
-- Update each indicator if it's not currently being edited
if not XIndicator:IsFocused() then
XIndicator.Text = CommonX or '*';
end;
if not YIndicator:IsFocused() then
YIndicator.Text = CommonY or '*';
end;
if not ZIndicator:IsFocused() then
ZIndicator.Text = CommonZ or '*';
end;
end;
function SetDirections(DirectionMode)
-- Sets the given resizing direction mode
-- Update setting
ResizeTool.Directions = DirectionMode;
-- Update the UI switch
if ResizeTool.UI then
Core.ToggleSwitch(DirectionMode, ResizeTool.UI.DirectionsOption);
end;
end;
|
-- These values are added to the beginning/end of the kick message, respectively
|
local MESSAGE_PREFIX = "\n\n"
local MESSAGE_POSTFIX = ""
|
--Finds the model the current part is in which is closest to workspace
--Returns the part is the part is in Workspace
--Returns nil if the object is already in the roomModel we are constructing
|
local function closestParentToWorkspace(object, roomModel)
if object.Parent == roomModel then
return nil
end
if object.Parent == game.Workspace then
return object
else
return closestParentToWorkspace(object.Parent, roomModel)
end
end
|
-- Creates a new tree node from an object. Called when an object starts
-- existing in the game tree.
|
addObject = function(object,noupdate,parent)
if script then
-- protect against naughty RobloxLocked objects
local s = pcall(check,object)
if not s then
return
end
end
local parentNode
if parent then
parentNode = NodeLookup[parent]
else
parentNode = NodeLookup[object.Parent]
end
if not parentNode then
return
end
local objectNode = {
Object = object;
Parent = parentNode;
Index = 0;
Expanded = false;
Selected = false;
Depth = depth(object);
}
connLookup[object] = Connect(object.AncestryChanged,function(c,p)
if c == object then
if p == nil then
removeObject(c)
else
moveObject(c,p)
end
end
end)
NodeLookup[object] = objectNode
insert(parentNode,#parentNode+1,objectNode)
if not noupdate then
if nodeIsVisible(objectNode) then
updateList()
elseif nodeIsVisible(objectNode.Parent) then
updateScroll()
end
end
end
local function makeObject(obj, par)
--[[local newObject = Instance_new(obj.ClassName)
for i,v in pairs(obj.Properties) do
ypcall(function()
local newProp
newProp = ToPropValue(v.Value,v.Type)
newObject[v.Name] = newProp
end)
end
newObject.Parent = par
obj.Properties.Parent = par--]]
RemoteEvent:InvokeServer("InstanceNew", obj.ClassName, obj.Properties)
end
local function writeObject(obj)
local newObject = {ClassName = obj.ClassName, Properties = {}}
for i,v in pairs(RbxApi.GetProperties(obj.className)) do
if v["Name"] ~= "Parent" then
print("thispassed")
table.insert(newObject.Properties,{Name = v["Name"], Type = v["ValueType"], Value = tostring(obj[v["Name"]])})
end
end
return newObject
end
do
local function registerNodeLookup4(o)
NodeLookup[o] = {
Object = o;
Parent = nil;
Index = 0;
Expanded = true;
}
end
registerNodeLookup4(game)
NodeLookup[DexOutput] = {
Object = DexOutput;
Parent = nil;
Index = 0;
Expanded = true;
}
registerNodeLookup4(HiddenEntries)
registerNodeLookup4(HiddenGame)
Connect(game.DescendantAdded,addObject)
Connect(game.DescendantRemoving,removeObject)
Connect(DexOutput.DescendantAdded,addObject)
Connect(DexOutput.DescendantRemoving,removeObject)
local function get(o)
return o:GetChildren()
end
local function r(o)
if o == game and MuteHiddenItems then
for i, v in pairs(gameChildren) do
addObject(v,true)
r(v)
end
return
end
local s,children = pcall(get,o)
if s then
for i = 1,#children do
addObject(children[i],true)
r(children[i])
end
end
end
r(game)
r(DexOutput)
r(HiddenEntries)
scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
updateList()
end
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:GetInstance(className)
if self.InstancePoolsByClass[className] == nil then
self.InstancePoolsByClass[className] = {}
end
local availableInstances = #self.InstancePoolsByClass[className]
if availableInstances > 0 then
local instance = self.InstancePoolsByClass[className][availableInstances]
table.remove(self.InstancePoolsByClass[className])
return instance
end
return Instance.new(className)
end
function methods:ReturnInstance(instance)
if self.InstancePoolsByClass[instance.ClassName] == nil then
self.InstancePoolsByClass[instance.ClassName] = {}
end
if #self.InstancePoolsByClass[instance.ClassName] < self.PoolSizePerType then
table.insert(self.InstancePoolsByClass[instance.ClassName], instance)
else
instance:Destroy()
end
end
|
-- ["leftLeg"] = {
-- ["CurrentCycle"] = math.pi,
-- ["LimbChain"] =leftLegChain,
-- ["CCDIKController"] =leftLegChain,
-- ["HipAttachment"]= leftHipAttachment,
-- ["FootAttachment"] = leftStepAttachment,
-- }
-- }
|
local Signal = require(script.Parent.Signal)
function ProceduralAnimatorClass.new(RootPart,Legs,RootMotor,raycastParams)
local self = setmetatable({}, ProceduralAnimatorClass)
--Constants
self.RootPart = RootPart
self.RaycastParams = raycastParams --manual input it
if RootMotor then
self.RootMotor = RootMotor
self.RootMotorC1Store = RootMotor.C1
self.WaistCycle = 0
end
self.Legs = Legs
--Default settings for legs
self.DefaultStride = 2 -- Changes how far the legs move
self.CycleSpeed = 15 -- How fast the leg-movement cycle is. Change this to suit your needs!
self.DefaultStrideOffset = 0
-- Radius of the circle at CFrame front of the player
self.DefaultStrideCF = CFrame.new(0, 0, -self.DefaultStride / 2) -- Turn that stride number into a CFrame we can use
--Variables that will change
self.MovementDirectionXZ = Vector3.new(1, 0, 1) -- This will be changed
self.rootvelm = 0
--Sound
self.FootStep = Signal.new();
self.MaxSpeed = 20
self.EngineSound = nil;
self.FootStepSound = nil;
self.RandomNumGenerator = Random.new()
--debug the signal, works
--self.FootStep:Connect(function()
-- print("Step")
--end)
self.WalkBounce = 0.4 -- factor by which it bounces
self.SwayX = -1*5 -- factor in Z direction front or behind, currently set to tilt forward
return self
end
function ProceduralAnimatorClass:MoveLegs(stepCycle,dt)
--if moving
if self.rootVelocityMagnitude > 0.1 then
for _, Leg in pairs(self.Legs) do
local strideCF = Leg.StrideCF or self.DefaultStrideCF
local strideOffset = Leg.StrideOffset or self.DefaultStrideOffset
local raycastParams = self.RaycastParams
Leg.CurrentCycle = (Leg.CurrentCycle+stepCycle)%360
local cycle = Leg.CurrentCycle
local IKTolerance = Leg.IKTolerance or 0
local hip =Leg.HipAttachment.WorldPosition
--Position of where the lower leg should be, spread out
local ground =Leg.FootAttachment.WorldPosition
local desiredPos =(CF(ground, ground+self.MovementDirectionXZ)*ANGLES(-cycle, 0, 0)*strideCF).p
local offset =(desiredPos-hip)--vector from hip to the circle
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+strideOffset),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+strideOffset))
--debug foot pos position
--local part = Instance.new("Part")
--part.CanCollide = false
--part.CanTouch = false
--part.BrickColor = BrickColor.Red()
--part.Anchored = true
--part.CanQuery = false
--part.Size = Vector3.new(0.1,0.1,0.1)
--part.Position = footPos
--part.Parent = workspace
--game.Debris:AddItem(part,0.1)
--Do IK towards foot pos
--Leg.CCDIKController:CCDIKIterateOnce(footPos,IKTolerance)
--Iterating once won't fully track the footPos, needs to iterate until
Leg.CCDIKController:CCDIKIterateUntil(footPos,IKTolerance)
if not Leg.TouchGround and raycastResult then
--print("Stomp")
self.FootStep:Fire(raycastResult)
end
--
if raycastResult then -- hit ground so raycast result
Leg.TouchGround = true
else
Leg.TouchGround = false
end
end
else--stand still
for _, Leg in pairs(self.Legs) do
local strideCF = Leg.StrideCF or self.DefaultStrideCF
local strideOffset = Leg.StrideOffset or self.DefaultStrideOffset
local raycastParams = self.RaycastParams
local IKTolerance = Leg.IKTolerance or 0
local hip =Leg.HipAttachment.WorldPosition
--Position of where the lower leg should be, spread out
local desiredPos =Leg.FootAttachment.WorldPosition+DOWN
local offset =(desiredPos-hip)--vector from hip to the circle
local raycastResult = workspace:Raycast(hip,offset.unit*(offset.magnitude+strideOffset),raycastParams)
local footPos = raycastResult and raycastResult.Position or (hip + offset.unit*(offset.magnitude+strideOffset))
--Do IK towards foot pos
Leg.CCDIKController:CCDIKIterateOnce(footPos,IKTolerance)
--Leg.LimbChain:IterateOnce(footPos,0.1)
--Leg.LimbChain:UpdateMotors()
if not Leg.TouchGround and raycastResult then
--print("Stomp")
self.FootStep:Fire(raycastResult)
end
if raycastResult then -- hit ground so raycast result
Leg.TouchGround = true
else
Leg.TouchGround = false
end
end
end
end
function ProceduralAnimatorClass:MoveTorso(stepCycle,dt10,rootVelocity)
local lowercf = self.RootPart.CFrame
local waistjoint = self.RootMotor
local waist1 = self.RootMotorC1Store
local rootvel = rootVelocity
if self.rootVelocityMagnitude > 0.1 then
self.WaistCycle = (self.WaistCycle+stepCycle)%360
local relv0 =lowercf:vectorToObjectSpace(rootvel)
local relv1 =relv0*0.2
do -- Upper Torso
local bounceCFrame = CFrame.new(0,self.WalkBounce*math.cos((self.WaistCycle+90+45)*2),0)
local sway = math.rad(-relv1.X)+0.08*math.cos(self.WaistCycle+90)
local swayY = 0.1*math.cos(self.WaistCycle)-2*math.rad(relv1.X)
local swayX = math.rad(relv1.Z)*0.5*self.SwayX
local goalCF = bounceCFrame*waist1*ANGLES(swayX,swayY,sway):inverse()
-- goalCF *= CFrame.new(0,math.cos((self.WaistCycle+90+45)*2),0)-- Up and down
--goalCF *= CFrame.new(0,self.WalkBounce*math.cos((self.WaistCycle+90+45)*2),0)-- Up and down
--local rotationOnly = goalCF-goalCF.Position
waistjoint.C1 = waistjoint.C1:Lerp(goalCF,dt10)
end
else
--when not moving go back to original position
local goalCF = waistjoint.C1:Lerp(waist1, dt10)
--local rotationOnly = goalCF-goalCF.Position
waistjoint.C1 = goalCF
end
end
function ProceduralAnimatorClass:Animate(dt)
-- Begin the step-------
local dt10 = math.min(dt*10, 1) -- Normalize dt for our needs
local rootpart = self.RootPart
local rootvel0 = rootpart.Velocity -- Our movement velocity
local rootVelocity = rootvel0 * x_and_y --XY plane velocity only
local rootVelocityMagnitude = rootVelocity.Magnitude --root velocity magnitude
self.rootVelocityMagnitude = rootVelocityMagnitude
if self.EngineSound then
self.EngineSound.PlaybackSpeed = (rootVelocityMagnitude / self.MaxSpeed) + 0.6
end
--if moving then lerp current direction
if rootVelocityMagnitude > 0.1 then
--lerp current direction towards curren velocity
self.MovementDirectionXZ = self.MovementDirectionXZ:Lerp(rootVelocity.unit, dt10)
end
local relativizeToHumanoidSpeed = rootVelocityMagnitude/16 --default walk speed is 16
local stepCycle = relativizeToHumanoidSpeed*dt*self.CycleSpeed
self:MoveLegs(stepCycle,dt)
if self.RootMotor then
self:MoveTorso(stepCycle,dt10,rootVelocity)
end
end
function ProceduralAnimatorClass:ConnectFootStepSound(sound : Sound)
self.FootStep:Connect(function(raycastResult)
local soundPositionAttachment = Instance.new("Attachment")
soundPositionAttachment.WorldPosition = raycastResult.Position
soundPositionAttachment.Parent = workspace.Terrain
local footStepSound = sound:Clone()
local randomPlaybackSpeed = self.RandomNumGenerator:NextNumber(0.7,1)
footStepSound.PlaybackSpeed = randomPlaybackSpeed
local reverbEffect = Instance.new("ReverbSoundEffect")
reverbEffect.Density = 0.8
reverbEffect.DecayTime = 1
reverbEffect.Parent = footStepSound
footStepSound.PlayOnRemove = true
footStepSound.Parent = soundPositionAttachment
soundPositionAttachment:Destroy()
end)
end
function ProceduralAnimatorClass:StartEngineSound(sound : Sound)
local engineSound = sound:Clone()
engineSound.Parent = self.RootPart
engineSound.Looped = true
engineSound:Play()
end
function ProceduralAnimatorClass:InitDragDebug()
for _, Leg in pairs(self.Legs) do
Leg.CCDIKController:InitDragDebug()
end
end
function ProceduralAnimatorClass:Destroy()
if self.FootStep then
self.FootStep:Destroy()
end
self = nil
end
return ProceduralAnimatorClass
|
--[=[
@return PROPERTY_MARKER
Returns a marker that will transform the current key into
a RemoteProperty once the service is created. Should only
be called within the Client table of a service. An initial
value can be passed along as well.
RemoteProperties are great for replicating data to all of
the clients. Different data can also be set per client.
See [RemoteProperty](https://sleitnick.github.io/RbxUtil/api/RemoteProperty)
documentation for more info.
```lua
local MyService = Knit.CreateService {
Name = "MyService",
Client = {
-- Create the property marker, which will turn into a
-- RemoteProperty when Knit.Start() is called:
MyProperty = Knit.CreateProperty("HelloWorld"),
},
}
function MyService:KnitInit()
-- Change the value of the property:
self.Client.MyProperty:Set("HelloWorldAgain")
end
```
]=]
|
function KnitServer.CreateProperty(initialValue: any)
return { PROPERTY_MARKER, initialValue }
end
|
-- How many times per second the gun can fire
|
local FireRate = 20 / 30
|
-- (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 = "Valkyrie Helm"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1, 2, 1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new (-0, -0.124, -0.992)
h.AttachmentPos = Vector3.new(0.07, -0.4, 0.5)
h.AttachmentRight = Vector3.new (1, -0, 0)
h.AttachmentUp = Vector3.new (0, 0.992, -0.124)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--// Hash: 9043abc9834370d0811d3561bb07616137d303330a5e983d0bce677e5fdf5cb35241b3933100842275d036cb9b9de3c8
-- Decompiled with the Synapse X Luau decompiler.
|
return {
ButtonX = "rbxassetid://9876149963",
ButtonY = "rbxassetid://9876149854",
ButtonA = "rbxassetid://9876150181",
ButtonB = "rbxassetid://9876150092"
};
|
-- Decompiled with the Synapse X Luau decompiler.
|
local function u1(p1, p2)
p2 = p2 or {};
if type(p1) ~= "table" then
return p1;
end;
if p2[p1] then
return p2[p1];
end;
local v1 = {};
p2[p1] = v1;
for v2, v3 in next, p1 do
v1[u1(v2, p2)] = u1(v3, p2);
end;
setmetatable(v1, u1(getmetatable(p1), p2));
return v1;
end;
local l__HttpService__2 = game:GetService("HttpService");
return function(p3, p4)
if p4 then
return u1(p3);
end;
return l__HttpService__2:JSONDecode(l__HttpService__2:JSONEncode(p3));
end;
|
-- Catch whenever the user finishes dragging
|
UserInputService.InputEnded:connect(function (InputInfo, GameProcessedEvent)
-- Make sure this was button 1 being released
if InputInfo.UserInputType ~= Enum.UserInputType.MouseButton1 then
return;
end;
-- Clean up dragging detection listeners and data
if DragStart then
-- Clear dragging detection data
DragStart = nil;
DragStartTarget = nil;
-- Disconnect dragging initiation listeners
ClearConnection 'WatchForDrag';
end;
-- Reset from drag mode if dragging
if Dragging then
-- Reset normal axes option state
SetAxes(MoveTool.Axes);
-- Finalize the dragging operation
FinishDragging();
end;
end);
function SetUpDragging(BasePart, BasePoint)
-- Sets up and initiates dragging based on the given base part
-- Prevent selection while dragging
Core.Targeting.CancelSelecting();
-- Prepare parts, and start dragging
InitialState = PreparePartsForDragging();
StartDragging(BasePart, InitialState, BasePoint);
end;
MoveTool.SetUpDragging = SetUpDragging;
function PreparePartsForDragging()
-- Prepares parts for dragging and returns the initial state of the parts
local InitialState = {};
-- Get index of parts
local PartIndex = Support.FlipTable(Selection.Items);
-- Stop parts from moving, and capture the initial state of the parts
for _, Part in pairs(Selection.Items) do
InitialState[Part] = { Anchored = Part.Anchored, CanCollide = Part.CanCollide, CFrame = Part.CFrame };
Part.Anchored = true;
Part.CanCollide = false;
InitialState[Part].Joints = Core.PreserveJoints(Part, PartIndex);
Part:BreakJoints();
Part.Velocity = Vector3.new();
Part.RotVelocity = Vector3.new();
end;
return InitialState;
end;
function StartDragging(BasePart, InitialState, BasePoint)
-- Begins dragging the selection
-- Ensure dragging is not already ongoing
if Dragging then
return;
end;
-- Indicate that we're dragging
Dragging = true;
-- Track changes
TrackChange();
-- Disable bounding box calculation
BoundingBox.ClearBoundingBox();
-- Cache area permissions information
local AreaPermissions;
if Core.Mode == 'Tool' then
AreaPermissions = Security.GetPermissions(Security.GetSelectionAreas(Selection.Items), Core.Player);
end;
-- Ensure a base part is provided
if not BasePart or not InitialState[BasePart] then
return;
end;
-- Determine the base point for dragging
local BasePartOffset = -BasePart.CFrame:pointToObjectSpace(Core.Mouse.Hit.p);
-- Improve base point alignment for the given increment
BasePartOffset = Vector3.new(
math.clamp(GetIncrementMultiple(BasePartOffset.X, MoveTool.Increment), -BasePart.Size.X / 2, BasePart.Size.X / 2),
math.clamp(GetIncrementMultiple(BasePartOffset.Y, MoveTool.Increment), -BasePart.Size.Y / 2, BasePart.Size.Y / 2),
math.clamp(GetIncrementMultiple(BasePartOffset.Z, MoveTool.Increment), -BasePart.Size.Z / 2, BasePart.Size.Z / 2)
);
-- Use the given base point instead if any
if BasePoint then
BasePartOffset = -BasePart.CFrame:pointToObjectSpace(BasePoint);
end;
-- Prepare snapping in case it is enabled, and make sure to override its default target selection
SnapTracking.TargetBlacklist = Selection.Items;
Connections.DragSnapping = PointSnapped:connect(function (SnappedPoint)
-- Align the selection's base point to the snapped point
local Rotation = SurfaceAlignment or (InitialState[BasePart].CFrame - InitialState[BasePart].CFrame.p);
BasePart.CFrame = CFrame.new(SnappedPoint) * Rotation * CFrame.new(BasePartOffset);
TranslatePartsRelativeToPart(BasePart, InitialState);
-- Make sure we're not entering any unauthorized private areas
if Core.Mode == 'Tool' and Security.ArePartsViolatingAreas(Selection.Items, Core.Player, false, AreaPermissions) then
BasePart.CFrame = InitialState[BasePart].CFrame;
TranslatePartsRelativeToPart(BasePart, InitialState);
end;
end);
-- Update cache of corner offsets for later crossthrough calculations
CornerOffsets = GetCornerOffsets(InitialState[BasePart].CFrame, InitialState);
-- Provide a callback to trigger alignment
TriggerAlignment = function ()
-- Trigger drag recalculation
DragToMouse(BasePart, BasePartOffset, InitialState, AreaPermissions);
-- Trigger snapping recalculation
if SnapTracking.Enabled then
PointSnapped:fire(SnappedPoint);
end;
end;
-- Start up the dragging action
Connections.Drag = Core.Mouse.Move:connect(function ()
DragToMouse(BasePart, BasePartOffset, InitialState, AreaPermissions);
end);
end;
|
-- / Teams / --
|
local PlayingTeam = game.Teams.Playing
local LobbyTeam = game.Teams.Lobby
|
--[=[
@within Comm
@private
@interface Server
.BindFunction (parent: Instance, name: string, fn: FnBind, inboundMiddleware: ServerMiddleware?, outboundMiddleware: ServerMiddleware?): RemoteFunction
.WrapMethod (parent: Instance, tbl: table, name: string, inboundMiddleware: ServerMiddleware?, outboundMiddleware: ServerMiddleware?): RemoteFunction
.CreateSignal (parent: Instance, name: string, inboundMiddleware: ServerMiddleware?, outboundMiddleware: ServerMiddleware?): RemoteSignal
.CreateProperty (parent: Instance, name: string, value: any, inboundMiddleware: ServerMiddleware?, outboundMiddleware: ServerMiddleware?): RemoteProperty
Server Comm
]=]
--[=[
@within Comm
@private
@interface Client
.GetFunction (parent: Instance, name: string, usePromise: boolean, inboundMiddleware: ClientMiddleware?, outboundMiddleware: ClientMiddleware?): (...: any) -> any
.GetSignal (parent: Instance, name: string, inboundMiddleware: ClientMiddleware?, outboundMiddleware: ClientMiddleware?): ClientRemoteSignal
.GetProperty (parent: Instance, name: string, inboundMiddleware: ClientMiddleware?, outboundMiddleware: ClientMiddleware?): ClientRemoteProperty
Client Comm
]=]
|
function Server.BindFunction(parent: Instance, name: string, func: Types.FnBind, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?): RemoteFunction
assert(Util.IsServer, "BindFunction must be called from the server")
local folder = Util.GetCommSubFolder(parent, "RF"):Expect("Failed to get Comm RF folder")
local rf = Instance.new("RemoteFunction")
rf.Name = name
local hasInbound = type(inboundMiddleware) == "table" and #inboundMiddleware > 0
local hasOutbound = type(outboundMiddleware) == "table" and #outboundMiddleware > 0
local function ProcessOutbound(player, ...)
local args = table.pack(...)
for _,middlewareFunc in ipairs(outboundMiddleware) do
local middlewareResult = table.pack(middlewareFunc(player, args))
if not middlewareResult[1] then
return table.unpack(middlewareResult, 2, middlewareResult.n)
end
args.n = #args
end
return table.unpack(args, 1, args.n)
end
if hasInbound and hasOutbound then
local function OnServerInvoke(player, ...)
local args = table.pack(...)
for _,middlewareFunc in ipairs(inboundMiddleware) do
local middlewareResult = table.pack(middlewareFunc(player, args))
if not middlewareResult[1] then
return table.unpack(middlewareResult, 2, middlewareResult.n)
end
args.n = #args
end
return ProcessOutbound(player, func(player, table.unpack(args, 1, args.n)))
end
rf.OnServerInvoke = OnServerInvoke
elseif hasInbound then
local function OnServerInvoke(player, ...)
local args = table.pack(...)
for _,middlewareFunc in ipairs(inboundMiddleware) do
local middlewareResult = table.pack(middlewareFunc(player, args))
if not middlewareResult[1] then
return table.unpack(middlewareResult, 2, middlewareResult.n)
end
args.n = #args
end
return func(player, table.unpack(args, 1, args.n))
end
rf.OnServerInvoke = OnServerInvoke
elseif hasOutbound then
local function OnServerInvoke(player, ...)
return ProcessOutbound(player, func(player, ...))
end
rf.OnServerInvoke = OnServerInvoke
else
rf.OnServerInvoke = func
end
rf.Parent = folder
return rf
end
function Server.WrapMethod(parent: Instance, tbl: {}, name: string, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?): RemoteFunction
assert(Util.IsServer, "WrapMethod must be called from the server")
local fn = tbl[name]
assert(type(fn) == "function", "Value at index " .. name .. " must be a function; got " .. type(fn))
return Server.BindFunction(parent, name, function(...) return fn(tbl, ...) end, inboundMiddleware, outboundMiddleware)
end
function Server.CreateSignal(parent: Instance, name: string, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?)
assert(Util.IsServer, "CreateSignal must be called from the server")
local folder = Util.GetCommSubFolder(parent, "RE"):Expect("Failed to get Comm RE folder")
local rs = RemoteSignal.new(folder, name, inboundMiddleware, outboundMiddleware)
return rs
end
function Server.CreateProperty(parent: Instance, name: string, initialValue: any, inboundMiddleware: Types.ServerMiddleware?, outboundMiddleware: Types.ServerMiddleware?)
assert(Util.IsServer, "CreateProperty must be called from the server")
local folder = Util.GetCommSubFolder(parent, "RP"):Expect("Failed to get Comm RP folder")
local rp = RemoteProperty.new(folder, name, initialValue, inboundMiddleware, outboundMiddleware)
return rp
end
return Server
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = {
Name = "Explorer",
Title = "Game Explorer",
Size = { 400, 300 },
MinSize = { 150, 100 },
AllowMultiple = false
};
local u1 = nil;
local u2 = game;
function v1.OnRefresh()
u1(u2);
end;
local v2 = client.UI.Make("Window", v1);
local u3 = nil;
local u4 = game;
local u5 = nil;
local function u6(p2, p3, p4, p5)
local v3 = u3:Add("TextLabel", {
Text = " " .. tostring(p3),
ToolTip = p2.ClassName,
TextXAlignment = "Left",
Size = UDim2.new(1, 0, 0, 30),
Position = UDim2.new(0, 0, 0, 30 * p4)
});
local v4 = {
Text = "Delete",
Size = UDim2.new(0, 80, 0, 30),
Position = UDim2.new(1, -160, 0, 0),
Visible = not p5
};
function v4.OnClick()
u2 = u2.Parent or game;
client.Remote.Send("HandleExplore", p2, "Delete");
p2:Destroy();
u1(u2);
end;
local v5 = v3:Add("TextButton", v4);
local v6 = v3:Add("TextButton", {
Text = "Open",
Size = UDim2.new(0, 80, 0, 30),
Position = UDim2.new(1, -80, 0, 0),
OnClick = function()
u4 = u2;
u2 = p2;
u1(p2);
end
});
end;
u1 = function(p6)
local l__Text__7 = u5.Text;
local v8 = 1;
u3:ClearAllChildren();
u6(p6.Parent or (u4 or game), "Previous Parent (Go Up..)", 0, true);
local l__next__9 = next;
local v10, v11 = p6:GetChildren();
while true do
local v12, v13 = l__next__9(v10, v11);
if not v12 then
break;
end;
v11 = v12;
local u7 = v8;
pcall(function()
if v13.Name:sub(1, #l__Text__7):lower() == l__Text__7:lower() or v13.ClassName:sub(1, #l__Text__7):lower() == l__Text__7:lower() then
u6(v13, v13.Name, u7);
u7 = u7 + 1;
end;
end);
end;
u3:ResizeCanvas(false, true, false, false, 5, 5);
end;
if v2 then
u3 = v2:Add("ScrollingFrame", {
List = {},
ScrollBarThickness = 2,
BackgroundTransparency = 1,
Position = UDim2.new(0, 5, 0, 30),
Size = UDim2.new(1, -10, 1, -30)
});
u5 = v2:Add("TextBox", {
Size = UDim2.new(1, -10, 0, 20),
Position = UDim2.new(0, 5, 0, 5),
BackgroundTransparency = 0.5,
BorderSizePixel = 0,
TextColor3 = Color3.new(1, 1, 1),
Text = "",
PlaceholderText = "Search",
TextStrokeTransparency = 0.8
});
u5.FocusLost:connect(function(p7)
u1(u2, u5.Text);
end);
u1(game);
local l__gTable__14 = v2.gTable;
v2:Ready();
end;
end;
|
-----------------------------------------------------------
----------------------- STATIC DATA -----------------------
-----------------------------------------------------------
|
local RunService = game:GetService("RunService")
local Workspace = game:GetService("Workspace")
local ReplicatedStorage = game:GetService("ReplicatedStorage").TankGunsFolder
local Modules = ReplicatedStorage:WaitForChild("Modules")
local Utilities = require(Modules.Utilities)
local Signal = Utilities.Signal
local table = Utilities.Table
local Thread = Utilities.Thread
local TargetEvent
if RunService:IsClient() then
TargetEvent = RunService.RenderStepped
else
TargetEvent = RunService.Heartbeat
end
local Projectiles = {}
local RemoveList = {}
|
--- Switches to the specified targeting mode.
-- @returns void
|
function TargetingModule:SetTargetingMode(NewTargetingMode)
if (NewTargetingMode == 'Scoped') or (NewTargetingMode == 'Direct') then
self.TargetingMode = NewTargetingMode
self.TargetingModeChanged:Fire(NewTargetingMode)
else
error('Invalid targeting mode', 2)
end
end
|
-- Event Bindings
|
DisplayIntermission.OnClientEvent:Connect(OnDisplayIntermission)
|
---------------------[ TWEEN MODULE ]-------------------------------------------------
|
function tweenFoV(goal, frames)
coroutine.resume(coroutine.create(function()
SFn = SFn and SFn + 1 or 0
local SFn_S = SFn
for i = 1, frames do
if SFn ~= SFn_S then break end
Camera.FieldOfView = Camera.FieldOfView + (goal - Camera.FieldOfView) * (i / frames)
game:GetService("RunService").RenderStepped:wait()
end
end))
end
function Lerp(n,g,t)
return n+(g-n)*t
end
local RS = game:GetService("RunService")
function tweenJoint(Joint, newC0, newC1, Alpha, Duration)
spawn(function()
local newCode = math.random(-1e9, 1e9) --This creates a random code between -1000000000 and 1000000000
local tweenIndicator = nil
if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
tweenIndicator = Instance.new("IntValue")
tweenIndicator.Name = "tweenCode"
tweenIndicator.Value = newCode
tweenIndicator.Parent = Joint
else
tweenIndicator = Joint.tweenCode
tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
--local tweenIndicator = createTweenIndicator:InvokeServer(Joint, newCode)
if Duration <= 0 then --If the duration is less than or equal to 0 then there's no need for a tweening loop
if newC0 then Joint.C0 = newC0 end
if newC1 then Joint.C1 = newC1 end
else
local Increment = 1.5 / Duration
local startC0 = Joint.C0
local startC1 = Joint.C1
local X = 0
while true do
RS.RenderStepped:wait() --This makes the for loop step every 1/60th of a second
local newX = X + Increment
X = (newX > 90 and 90 or newX)
if tweenIndicator.Value ~= newCode then break end --This makes sure that another tween wasn't called on the same joint
if (not Equipped) then break end --This stops the tween if the tool is deselected
if newC0 then Joint.C0 = startC0:lerp(newC0, Alpha(X)) end
if newC1 then Joint.C1 = startC1:lerp(newC1, Alpha(X)) end
if X == 90 then break end
end
end
if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
tweenIndicator:Destroy()
end
end)
end
function LoadClientMods()
for L_335_forvar1, L_336_forvar2 in pairs(GunMods:GetChildren()) do
if L_336_forvar2:IsA('LocalScript') then
local L_337_ = L_336_forvar2:clone()
L_337_.Parent = ModStorageFolder
L_337_.Disabled = false
end
end
end
function UnloadClientMods()
for L_335_forvar1, L_336_forvar2 in pairs(ModStorageFolder:GetChildren()) do
if L_336_forvar2:IsA('LocalScript') then
L_336_forvar2:Destroy()
end
end
end
function CheckForHumanoid(L_225_arg1)
local L_226_ = false
local L_227_ = nil
if L_225_arg1 then
if (L_225_arg1.Parent:FindFirstChildOfClass("Humanoid") or L_225_arg1.Parent.Parent:FindFirstChildOfClass("Humanoid")) then
L_226_ = true
if L_225_arg1.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent:FindFirstChildOfClass('Humanoid')
elseif L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid') then
L_227_ = L_225_arg1.Parent.Parent:FindFirstChildOfClass('Humanoid')
end
else
L_226_ = false
end
end
return L_226_, L_227_
end
function CreateShell()
delay(math.random(4,8)/10, function()
if PastaFX:FindFirstChild('ShellCasing') then
local Som = PastaFX.ShellCasing:clone()
Som.Parent = Jogador.PlayerGui
Som.PlaybackSpeed = math.random(30,50)/40
Som.PlayOnRemove = true
Debris:AddItem(Som, 0)
end
end)
end
local Tracers = 1
function TracerCalculation()
local VisibleTracer
if Settings.RandomTracer then
if (math.random(1, 100) <= Settings.TracerChance) then
VisibleTracer = true
else
VisibleTracer = false
end
else
if Tracers >= Settings.TracerEveryXShots then
VisibleTracer = true
Tracers = 1
else
Tracers = Tracers + 1
end
end
return VisibleTracer
end
function CreateBullet(BSpread)
local Bullet = Instance.new("Part")
Bullet.Name = Player.Name.."_Bullet"
Bullet.CanCollide = false
Bullet.Transparency = 1
Bullet.FormFactor = "Custom"
Bullet.Size = Vector3.new(1,1,1)
local BulletMass = Bullet:GetMass()
local Force = Vector3.new(0,BulletMass * (196.2) - (Settings.BDrop) * (196.2), 0)
local BF = Instance.new("BodyForce")
BF.force = Force
BF.Parent = Bullet
local Origin = ArmaClone.SmokePart.Position
local Direction = ArmaClone.SmokePart.CFrame.lookVector + (ArmaClone.SmokePart.CFrame.upVector * (((Settings.BDrop*Zeroing.Value/2.8)/Settings.BSpeed))/2)
local BulletCF = CFrame.new(Origin, Origin + Direction)
local balaspread = CFrame.Angles(
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20),
RAD(RAND(-BSpread - ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier), BSpread + ((SpeedPrecision/Saude.Stances.Mobility.Value)*Settings.WalkMultiplier)) / 20)
)
Direction = balaspread * Direction
Bullet.Parent = BulletModel
Bullet.CFrame = BulletCF + Direction
Bullet.Velocity = Direction * Settings.BSpeed
local RainbowModeCode = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
local Visivel = TracerCalculation()
if Settings.BulletFlare == true and Visivel then
local bg = Instance.new("BillboardGui", Bullet)
bg.Adornee = Bullet
bg.Enabled = false
local flashsize = math.random(275, 375)/10
bg.Size = UDim2.new(flashsize, 0, flashsize, 0)
bg.LightInfluence = 0
local flash = Instance.new("ImageLabel", bg)
flash.BackgroundTransparency = 1
flash.Size = UDim2.new(1, 0, 1, 0)
flash.Position = UDim2.new(0, 0, 0, 0)
flash.Image = "http://www.roblox.com/asset/?id=1047066405"
if Settings.RainbowMode == true then
flash.ImageColor3 = RainbowModeCode
else
flash.ImageColor3 = Settings.BulletFlareColor
end
flash.ImageTransparency = math.random(2, 5)/15
spawn(function()
wait(.2)
if Bullet:FindFirstChild("BillboardGui") ~= nil then
Bullet.BillboardGui.Enabled = true
end
end)
end
if Settings.Tracer == true and Visivel then
local At1 = Instance.new("Attachment")
At1.Name = "At1"
At1.Position = Vector3.new(-(Settings.TracerWidth),0,0)
At1.Parent = Bullet
local At2 = Instance.new("Attachment")
At2.Name = "At2"
At2.Position = Vector3.new((Settings.TracerWidth),0,0)
At2.Parent = Bullet
local Particles = Instance.new("Trail")
Particles.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.WidthScale = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
if Settings.RainbowMode == true then
Particles.Color = ColorSequence.new(RainbowModeCode)
else
Particles.Color = ColorSequence.new(Settings.TracerColor)
end
Particles.Texture = "rbxassetid://232918622"
Particles.TextureMode = Enum.TextureMode.Stretch
Particles.FaceCamera = true
Particles.LightEmission = Settings.TracerLightEmission
Particles.LightInfluence = Settings.TracerLightInfluence
Particles.Lifetime = Settings.TracerLifeTime
Particles.Attachment0 = At1
Particles.Attachment1 = At2
Particles.Parent = Bullet
end
if Settings.BulletLight == true and Visivel then
local BulletLight = Instance.new("PointLight")
BulletLight.Parent = Bullet
BulletLight.Brightness = Settings.BulletLightBrightness
if Settings.RainbowMode == true then
BulletLight.Color = RainbowModeCode
else
BulletLight.Color = Settings.BulletLightColor
end
BulletLight.Range = Settings.BulletLightRange
BulletLight.Shadows = true
end
CreateShell()
if Visivel then
if ServerConfig.ReplicatedBullets then
Evt.ServerBullet:FireServer(BulletCF, Settings.Tracer, Settings.BDrop, Settings.BSpeed, Direction, Settings.TracerColor,Ray_Ignore,Settings.BulletFlare,Settings.BulletFlareColor)
end
end
game.Debris:AddItem(Bullet, 5)
return Bullet
end
function CalcularDano(DanoBase,Dist,Vitima,Type)
local damage = 0
local VestDamage = 0
local HelmetDamage = 0
local Traveleddamage = DanoBase-(math.ceil(Dist)/40)*Settings.FallOfDamage
if Vitima.Parent:FindFirstChild("Saude") ~= nil then
local Vest = Vitima.Parent.Saude.Protecao.VestVida
local Vestfactor = Vitima.Parent.Saude.Protecao.VestProtect
local Helmet = Vitima.Parent.Saude.Protecao.HelmetVida
local Helmetfactor = Vitima.Parent.Saude.Protecao.HelmetProtect
if Type == "Head" then
if Helmet.Value > 0 and (Settings.BulletPenetration) < Helmetfactor.Value then
damage = Traveleddamage * ((Settings.BulletPenetration)/Helmetfactor.Value)
HelmetDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Helmetfactor.Value))
if HelmetDamage <= 0 then
HelmetDamage = 0.5
end
elseif Helmet.Value > 0 and (Settings.BulletPenetration) >= Helmetfactor.Value then
damage = Traveleddamage
HelmetDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Helmetfactor.Value))
if HelmetDamage <= 0 then
HelmetDamage = 1
end
elseif Helmet.Value <= 0 then
damage = Traveleddamage
end
else
if Vest.Value > 0 and (Settings.BulletPenetration) < Vestfactor.Value then
damage = Traveleddamage * ((Settings.BulletPenetration)/Vestfactor.Value)
VestDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Vestfactor.Value))
if VestDamage <= 0 then
VestDamage = 0.5
end
elseif Vest.Value > 0 and (Settings.BulletPenetration) >= Vestfactor.Value then
damage = Traveleddamage
VestDamage = (Traveleddamage * ((100 - Settings.BulletPenetration)/Vestfactor.Value))
if VestDamage <= 0 then
VestDamage = 1
end
elseif Vest.Value <= 0 then
damage = Traveleddamage
end
end
else
damage = Traveleddamage
end
if damage <= 0 then
damage = 1
end
return damage,VestDamage,HelmetDamage
end
local WhizzSound = {"342190005"; "342190012"; "342190017"; "342190024";}
Evt.Whizz.OnClientEvent:connect(function()
local Som = Instance.new('Sound')
Som.Parent = Jogador.PlayerGui
Som.SoundId = "rbxassetid://"..WhizzSound[math.random(1,4)]
Som.Volume = 2
Som.PlayOnRemove = true
Som:Destroy()
end)
Evt.Suppression.OnClientEvent:Connect(function(Mode,Intensity,Tempo)
if ServerConfig.EnableStatusUI and Jogador.Character and Human.Health > 0 then
if Mode == 1 then
TS:Create(StatusClone.Efeitos.Suppress,TweenInfo.new(.1),{ImageTransparency = 0, Size = UDim2.fromScale(1,1.15)}):Play()
delay(.1,function()
TS:Create(StatusClone.Efeitos.Suppress,TweenInfo.new(1,Enum.EasingStyle.Exponential,Enum.EasingDirection.InOut,0,false,0.15),{ImageTransparency = 1,Size = UDim2.fromScale(2,2)}):Play()
end)
else
--local SKP_22 = script.FX.Dirty:clone()
--SKP_22.Parent = Jogador.PlayerGui.StatusUI.Supressao
--SKP_22.ImageTransparency = 0
--SKP_22.BackgroundTransparency = (Intensity - 1) * -1
--TS:Create(SKP_22,TweenInfo.new(0.25 ,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0),{ImageTransparency = 0}):Play()
--TS:Create(SKP_22,TweenInfo.new(Tempo/2 ,Enum.EasingStyle.Elastic,Enum.EasingDirection.In,0,false,0),{BackgroundTransparency = 1}):Play()
--delay(Tempo/2,function()
--TS:Create(SKP_22,TweenInfo.new(Tempo ,Enum.EasingStyle.Sine,Enum.EasingDirection.In,0,false,0),{ImageTransparency = 1}):Play()
--TS:AddItem(SKP_22, Tempo)
--end)
end
end
end)
function CastRay(Bala)
local Hit2, Pos2, Norm2, Mat2
local Hit, Pos, Norm, Mat
local L_257_ = ArmaClone.SmokePart.Position;
local L_258_ = Bala.Position;
local TotalDistTraveled = 0
local L_260_ = false
local recast
while true do
RS.Heartbeat:wait()
L_258_ = Bala.Position;
TotalDistTraveled = TotalDistTraveled + (L_258_ - L_257_).magnitude
Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
for L_264_forvar1, L_265_forvar2 in pairs(game.Players:GetChildren()) do
if L_265_forvar2:IsA('Player') and L_265_forvar2 ~= Player and L_265_forvar2.Character and L_265_forvar2.Character:FindFirstChild('Head') and (L_265_forvar2.Character.Head.Position - Pos).magnitude <= Settings.SuppressMaxDistance and Settings.BulletWhiz and not L_260_ then
Evt.Whizz:FireServer(L_265_forvar2)
Evt.Suppression:FireServer(L_265_forvar2)
L_260_ = true
end
end
if TotalDistTraveled > Settings.Distance then
Bala:Destroy()
L_260_ = true
break
end
if Hit2 then
while not recast do
if Hit2 and (Hit2 and Hit2.Transparency >= 1 or Hit2.CanCollide == false or Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2") and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
table.insert(Ray_Ignore, Hit2)
recast = true
end
if recast then
Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
recast = false
else
break
end
end
end
if Hit and not recast then
Bala:Destroy()
L_260_ = true
local FoundHuman,VitimaHuman = CheckForHumanoid(Hit)
Hitmarker.HitEffect(Ray_Ignore,ACS_Storage, Pos, Hit, Norm, Mat, Settings)
Evt.Hit:FireServer(Pos, Hit, Norm, Mat,Settings,TotalDistTraveled)
if FoundHuman == true and VitimaHuman.Health > 0 then
if ServerConfig.HitmarkerSound then
local hurtSound = PastaFX.Hitmarker:Clone()
hurtSound.Parent = Player.PlayerGui
hurtSound.Volume = 2
hurtSound.PlayOnRemove = true
Debris:AddItem(hurtSound,0)
end
if not Settings.ModoTreino then
Evt.CreateOwner:FireServer(VitimaHuman)
if game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil then
if Hit.Name == "Head" then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Torso" or Hit.Parent.Name == "UpperTorso" or Hit.Parent.Name == "LowerTorso" then
local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
else
local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
end
else
if not ServerConfig.TeamKill then
if game.Players:FindFirstChild(VitimaHuman.Parent.Name) and game.Players:FindFirstChild(VitimaHuman.Parent.Name).Team ~= Player.Team or game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil then
if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
end
end
else
if game.Players:FindFirstChild(VitimaHuman.Parent.Name) and game.Players:FindFirstChild(VitimaHuman.Parent.Name).Team ~= Player.Team or game.Players:FindFirstChild(VitimaHuman.Parent.Name) == nil then
if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
end
else
if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])* ServerConfig.TeamDamageMultiplier
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) then
local DanoBase = math.random(Settings.HeadDamage[1], Settings.HeadDamage[2])* ServerConfig.TeamDamageMultiplier
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Head")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" then
local DanoBase = math.random(Settings.TorsoDamage[1], Settings.TorsoDamage[2])* ServerConfig.TeamDamageMultiplier
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
elseif Hit.Name == "Right Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Name == "Left Arm" then
local DanoBase = math.random(Settings.LimbsDamage[1], Settings.LimbsDamage[2])* ServerConfig.TeamDamageMultiplier
local Dano,DanoColete,DanoCapacete = CalcularDano(DanoBase, TotalDistTraveled, VitimaHuman, "Body")
Evt.Damage:FireServer(VitimaHuman,Dano,DanoColete,DanoCapacete)
end
end
end
end
else
if Hit.Name == "Head" or Hit.Parent.Name == "Top" or Hit.Parent.Name == "Headset" or Hit.Parent.Name == "Olho" or Hit.Parent.Name == "Face" or Hit.Parent.Name == "Numero" or (Hit.Parent:IsA('Accessory') or Hit.Parent:IsA('Hat')) or Hit.Name == "Torso" or Hit.Parent.Name == "Chest" or Hit.Parent.Name == "Waist" or Hit.Name == "Right Arm" or Hit.Name == "Left Arm" or Hit.Name == "Right Leg" or Hit.Name == "Left Leg" or Hit.Parent.Name == "Back" or Hit.Parent.Name == "Leg1" or Hit.Parent.Name == "Leg2" or Hit.Parent.Name == "Arm1" or Hit.Parent.Name == "Arm2" then
Evt.Treino:FireServer(VitimaHuman)
end
end
break
end
end
L_257_ = L_258_;
end
end
Human.Running:connect(function(walkin)
if Equipped then
SpeedPrecision = walkin
Sprint()
if walkin > 1 then
Walking = true
else
Walking = false
end
end
end)
Mouse.KeyDown:connect(function(Key)
if Equipped then
if Key == "w" then
if not w then
w = true
end
end
if Key == "a" then
if not a then
a = true
end
end
if Key == "s" then
if not s then
s = true
end
end
if Key == "d" then
if not d then
d = true
end
end
end
end)
Mouse.KeyUp:connect(function(Key)
if Equipped then
if Key == "w" then
if w then
w = false
end
end
if Key == "a" then
if a then
a = false
end
end
if Key == "s" then
if s then
s = false
end
end
if Key == "d" then
if d then
d = false
end
end
end
end)
function SlideEx()
tweenJoint(ArmaClone.Handle:WaitForChild("Slide"), CFrame.new(Settings.SlideExtend) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
if Settings.MoveBolt == true then
tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"), CFrame.new(Settings.BoltExtend) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
end
delay(FireRate/2,function()
if Ammo.Value >= 1 then
tweenJoint(ArmaClone.Handle:WaitForChild("Slide"), CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
if Settings.MoveBolt == true then
tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"), CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
end
elseif Ammo.Value < 1 and Settings.SlideLock == true then
Chambered.Value = false
if Settings.MoveBolt == true and Settings.BoltLock == false then
tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"), CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
end
ArmaClone.Handle.Click:Play()
slideback = true
elseif Ammo.Value < 1 and Settings.SlideLock == false then
tweenJoint(ArmaClone.Handle:WaitForChild("Slide"), CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
if Settings.MoveBolt == true then
tweenJoint(ArmaClone.Handle:WaitForChild("Bolt"), CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0),0) , nil, function(X) return math.sin(math.rad(X)) end, 1 * (FireRate/2))
end
Chambered.Value = false
ArmaClone.Handle.Click:Play()
end
end)
end
function recoil()
spawn(function()
if Bipod then
local vr = (VRecoil)/5
local hr = ((HRecoil) * math.random(-1, 1))/5
Camera.CFrame = Camera.CFrame * CFrame.Angles(vr, hr, 0)
local c = -vr/30
local cx = -(hr)/30
local curId
local EquipId = curId
local vP
if Settings.GunType == 0 then
vP = (VPunchBase)
else
vP = (VPunchBase*10)/100
end
local hP = (math.random(-HPunchBase*25, HPunchBase*25))/100
local dP = ((DPunchBase) * math.random(-1, 1))
if not Aiming then
Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower*0.25),RAD(hP*RecoilPower*0.25),RAD(dP*RecoilPower*0.25)),1)
else
Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower*0.25),RAD(hP*RecoilPower*0.25),RAD(dP*RecoilPower*0.25)),1)
end
for i = 1, 30 do
if EquipId == curId then
Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(c, cx, 0) * CFrame.new(0, 0, (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude)
wait()
else
break
end
end
else
local vr = (VRecoil)
local hr = (HRecoil) * math.random(-1, 1)
Camera.CFrame = Camera.CFrame * CFrame.Angles(vr, hr, 0)
local c = -vr/30
local cx = -(hr)/30
local curId
local EquipId = curId
local vP
if Settings.GunType == 0 then
vP = (VPunchBase)
else
vP = (math.random(-VPunchBase*50,VPunchBase*100))/100
end
local hP = (math.random(-HPunchBase*100, HPunchBase*100))/100
local dP = ((DPunchBase) * math.random(-1, 1))
if not Aiming then
Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch)) * CFrame.Angles(RAD(vP*RecoilPower),RAD(hP*RecoilPower),RAD(dP*RecoilPower)),1)
else
Recoil = Recoil:lerp(Recoil*CFrame.new(0,0,(Settings.RecoilPunch/2)) * CFrame.Angles(RAD(vP*RecoilPower/Settings.AimRecoilReduction),RAD(hP*RecoilPower/Settings.AimRecoilReduction),RAD(dP*RecoilPower/Settings.AimRecoilReduction)),1)
end
for i = 1, 30*Settings.AimRecover do
if EquipId == curId then
Camera.CoordinateFrame = CFrame.new(Camera.Focus.p) * (Camera.CoordinateFrame - Camera.CoordinateFrame.p) * CFrame.Angles(c, cx, 0) * CFrame.new(0, 0, (Camera.Focus.p - Camera.CoordinateFrame.p).magnitude)
wait()
else
break
end
end
end
end)
for _, v in pairs(ArmaClone.SmokePart:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
v.Enabled = true
end
end
for _, a in pairs(ArmaClone.Chamber:GetChildren()) do
if a.Name:sub(1, 7) == "FlashFX" or a.Name:sub(1, 7) == "Smoke" then
a.Enabled = true
end
end
delay(1 / 30, function()
for _, v in pairs(ArmaClone.SmokePart:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
v.Enabled = false
end
end
for _, a in pairs(ArmaClone.Chamber:GetChildren()) do
if a.Name:sub(1, 7) == "FlashFX" or a.Name:sub(1, 7) == "Smoke" then
a.Enabled = false
end
end
end)
if Silencer.Value == true then
Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Supressor'):Play()
else
Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Fire'):Play()
Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Echo'):Play()
end
SlideEx()
end
function Emperrar()
if Settings.CanBreak == true and Chambered.Value == true and (Ammo.Value - 1) > 0 then
local Jam = math.random(Settings.JamChance)
if Jam <= 2 then
Emperrado.Value = true
ArmaClone.Handle:WaitForChild("Click"):Play()
end
end
end
function HalfStepFunc(Rot)
if PlaceHolder then
Offset = Human.CameraOffset
Evt.HeadRot:FireServer(Rot, Offset, Equipped)
end
PlaceHolder = not PlaceHolder
end
oldtick = tick()
xTilt = 0
yTilt = 0
lastPitch = 0
lastYaw = 0
local TVal = 0
local L_199_ = nil
Personagem.ChildAdded:connect(function(Tool)
if Tool:IsA('Tool') and Tool:FindFirstChild('ACS_Modulo') and Tool.ACS_Modulo:FindFirstChild('ACS_Setup') and Humanoid.Health > 0 and not ToolEquip and require(Tool.ACS_Modulo.ACS_Setup).Type == 'Gun' then
local L_370_ = true
if Personagem:WaitForChild('Humanoid').Sit and Personagem.Humanoid.SeatPart:IsA("VehicleSeat") or Personagem:WaitForChild('Humanoid').Sit and Personagem.Humanoid.SeatPart:IsA("VehicleSeat") or Nadando then
L_370_ = false;
end
if L_370_ then
L_199_ = Tool
if not Equipped then
uis.MouseIconEnabled = false
Player.CameraMode = Enum.CameraMode.LockFirstPerson
Setup(Tool)
LoadClientMods()
Ray_Ignore = {Character, Ignore_Model, Camera, BulletModel}
Gui = StatusClone:WaitForChild("GunHUD")
Gui.Visible = true
CanUpdateGui = true
Update_Gui()
EquipAnim()
if Settings.ZoomAnim and AimPartMode == 2 then
ZoomAnim()
end
Sprint()
elseif Equipped then
Unset()
Setup(L_199_)
LoadClientMods()
end;
end;
end
end)
Human.Seated:Connect(function(isSeated, seat)
if isSeated and (seat:IsA("VehicleSeat")) then
Unset()
Humanoid:UnequipTools()
Jogador.CameraMaxZoomDistance = ServerConfig.VehicleMaxZoom
else
Jogador.CameraMaxZoomDistance = game.StarterPlayer.CameraMaxZoomDistance
end
end)
Jogador.Backpack.ChildRemoved:connect(function(L_371_arg1)
Evt.Holster:FireServer(L_371_arg1)
end)
Personagem.ChildRemoved:connect(function(L_371_arg1)
if L_371_arg1 == ArmaClient then
if Equipped then
if Balinha then
Balinha:Destroy()
end
Unset()
end
end
end)
RS.RenderStepped:connect(function(Update)
if not Equipped then
HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5)
else
Update_Gui()
HalfStepFunc(-math.asin(Camera.CoordinateFrame.lookVector.y))
Recoil = Recoil:lerp(CFrame.new(),Settings.PunchRecover)
--RA.C0 = Recoil
--LA.C0 = Recoil
local Raio = Ray.new(ArmaClone.Handle.Position, Camera.CFrame.LookVector * Settings.GunSize)
local Hit, Pos = workspace:FindPartOnRayWithIgnoreList(Raio, Ray_Ignore, false, true)
local lk = Camera.CoordinateFrame.lookVector
local x = lk.X
local rise = lk.Y
local z = lk.Z
local lookpitch, lookyaw = math.asin(rise), -math.atan(x / z)
local pitchChange = lastPitch - lookpitch
local yawChange = lastYaw - lookyaw
pitchChange = pitchChange * ((math.abs(pitchChange) < 1) and 1 or 0)
yawChange = yawChange * ((math.abs(yawChange) < 1) and 1 or 0)
yTilt = (yTilt * 0.5 + pitchChange)
xTilt = (xTilt * 0.5 + yawChange)
lastPitch = lookpitch
lastYaw = lookyaw
sway.t = V3(xTilt, yTilt, TVal)
local swayVec = sway.p
local TWAY = swayVec.z
local XSWY = swayVec.X * 5
local YSWY = swayVec.Y * 5
local xWalk = SIN(t*3)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
local yWalk = COS(t*3)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
local xWak = SIN(t*1.75)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
local yWak = COS(t*3.5)*(SpeedPrecision/ServerConfig.RunWalkSpeed *(WVal+1))
local zWalk = WVal
Walk.t = Vector3.new(xWalk,yWalk,WVal)
local Walk2 = Walk.p
local xWalk2 = Walk2.X/3
local yWalk2 = Walk2.Y/3
local zWalk2 = Walk2.Z/10
local xWalk3 = Walk2.X/1
local yWalk3 = Walk2.Y/1
if Clone then
if Aiming then
zWalk = 0
else
zWalk = WVal
end
if Walking then
WalkRate = (Human.WalkSpeed/3)
if a then
TVal = Lerp(0,(-.20*SpeedPrecision/ServerConfig.RunWalkSpeed),10)
elseif d then
TVal = Lerp(0,(.20*SpeedPrecision/ServerConfig.RunWalkSpeed),10)
else
TVal = Lerp(0,0,10)
end
else
WalkRate = (SpeedPrecision/ServerConfig.RunWalkSpeed) + .5
WVal = Lerp(0,0,10)
end
local currtick = tick()
t = t + (((currtick - OldTick)*WalkRate))
OldTick = currtick
local Sway = CFa(YSWY*RAD(5),-XSWY*RAD(5),-XSWY*RAD(0))
Waval = Waval:lerp(CFn(xWalk3/220,-yWalk3/180,0)*CFn(xWak/220,-yWak/180,0)*CFa(0,0,zWalk2/5)*CFa(0,0,(TWAY/2)/10),1)
Clone.C0 = Clone.C0:lerp(Waval*Sway,1)
end
if OverHeat and Can_Shoot then
delay(5,function()
if Can_Shoot then
OverHeat = false
end
end)
end
if BSpread then
local currTime = time()
if currTime - LastSpreadUpdate > FireRate * 2 then
LastSpreadUpdate = currTime
BSpread = math.max(Settings.MinSpread, BSpread - (Settings.AimInaccuracyStepAmount)/5)
RecoilPower = math.max(Settings.MinRecoilPower, RecoilPower - (Settings.RecoilPowerStepAmount)/4)
end
end
if OverHeat then
ArmaClone.SmokePart.OverHeat.Enabled = true
else
ArmaClone.SmokePart.OverHeat.Enabled = false
end
if Aiming then
if not NVG or ArmaClone.AimPart:FindFirstChild("NVAim") == nil then
if AimPartMode == 1 and ArmaClone:FindFirstChild("AimPart2") ~= nil then
Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * CFrame.new() * ArmaClone.AimPart.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
elseif AimPartMode == 2 and ArmaClone:FindFirstChild("AimPart2") ~= nil then
Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * ArmaClone.AimPart2.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
else
Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * ArmaClone.AimPart.CFrame:toObjectSpace(HeadBase.CFrame),0.15)
end
else
if not Bipod then
Clone.C1 = Clone.C1:Lerp(Clone.C1 * Clone.C0:inverse() * Recoil * CFrame.new() * (ArmaClone.AimPart.CFrame * ArmaClone.AimPart.NVAim.CFrame):toObjectSpace(HeadBase.CFrame),0.15)
else
Aiming = false
stance = 0
end
end
else
if Hit and stance == 0 and Bipod == false then
Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(0,0,(((ArmaClone.Handle.Position - Pos).magnitude/Settings.GunSize) - 1) * -Settings.GunFOVReduction) ,0.15)
else
Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(),0.15)
end
end
if ArmaClone:FindFirstChild("BipodPoint") ~= nil then
local BipodRay = Ray.new(ArmaClone.BipodPoint.Position, ArmaClone.BipodPoint.CFrame.UpVector * -1.75)
local BipodHit, BipodPos, BipodNorm = workspace:FindPartOnRayWithIgnoreList(BipodRay, Ray_Ignore, false, true)
if BipodHit and (stance == 0 or stance == 2) then
Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 0)
BipodEnabled = true
if BipodEnabled and Bipod then
Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 255)
local StaminaValue = 0
HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
if stance == 0 and not Aiming then
Clone.C1 = Clone.C1:Lerp(Clone.C0:inverse() * Recoil * CFrame.new(0,(((ArmaClone.BipodPoint.Position - BipodPos).magnitude)-1) * (-1.5), 0) ,0.15)
end
else
Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 255, 0)
local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
end
else
Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 0, 0)
Bipod = false
BipodEnabled = false
local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
end
else
Gui.Bipod.ImageColor3 = Color3.fromRGB(255, 0, 0)
local StaminaValue = Settings.SwayBase + (1-(Personagem.Saude.Variaveis.Stamina.Value/Personagem.Saude.Variaveis.Stamina.MaxValue))* Settings.MaxSway
HeadBase.CFrame = Camera.CFrame * CFrame.new(0, 0, -.5) * CFrame.Angles( math.rad(StaminaValue * math.sin( tick() * 2.5 )),math.rad(StaminaValue * math.sin( tick() * 1.25 )), 0)
end
if Equipped and LaserAtivo then
if NVG then
Pointer.Transparency = 0
Laser.Enabled = true
else
if not ServerConfig.RealisticLaser then
Laser.Enabled = true
else
Laser.Enabled = false
end
if IRmode then
Pointer.Transparency = 1
else
Pointer.Transparency = 0
end
end
local L_361_ = Ray.new(ArmaClone.LaserPoint.Position, AnimBase.CFrame.lookVector * 999)
local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(L_361_, Ray_Ignore, false, true)
LaserEP.CFrame = CFrame.new(0, 0, -LaserDist)
Pointer.CFrame = CFrame.new(Pos, Pos + Normal)
if Hit then
LaserDist = (ArmaClone.LaserPoint.Position - Pos).magnitude
else
LaserDist = 999
end
Evt.SVLaser:FireServer(Pos,1,ArmaClone.LaserPoint.Color,ArmaClient,IRmode)
end
end
end)
Evt.SVFlash.OnClientEvent:Connect(function(Player,Mode,Arma,Angle,Bright,Color,Range)
if Player ~= Jogador and Player.Character['S' .. Arma.Name].Grip:FindFirstChild("Flash") ~= nil then
local Arma = Player.Character['S' .. Arma.Name]
local Luz = Instance.new("SpotLight")
local bg = Instance.new("BillboardGui")
if Mode == true then
Luz.Parent = Arma.Grip.Flash
Luz.Angle = Angle
Luz.Brightness = Bright
Luz.Range = Range
Luz.Color = Color
bg.Parent = Arma.Grip.Flash
bg.Adornee = Arma.Grip.Flash
bg.Size = UDim2.new(10, 0, 10, 0)
local flash = Instance.new("ImageLabel", bg)
flash.BackgroundTransparency = 1
flash.Size = UDim2.new(1, 20, 1, 20)
flash.AnchorPoint = Vector2.new(0.5,0.5)
flash.Position = UDim2.new(0.5, 0, 0.5, 0)
flash.Image = "http://www.roblox.com/asset/?id=1847258023"
flash.ImageColor3 = Color
flash.ImageTransparency = 0.25
flash.Rotation = math.random(-45, 45)
else
if Arma.Grip.Flash:FindFirstChild("SpotLight") ~= nil then
Arma.Grip.Flash:FindFirstChild("SpotLight"):Destroy()
end
if Arma.Grip.Flash:FindFirstChild("BillboardGui") ~= nil then
Arma.Grip.Flash:FindFirstChild("BillboardGui"):Destroy()
end
end
end
end)
Evt.SVLaser.OnClientEvent:Connect(function(Player,Position,Modo,Cor,Arma,IR)
if Player ~= Jogador then
if BulletModel:FindFirstChild(Player.Name.."_Laser") == nil then
local Dot = Instance.new('Part')
local Att0 = Instance.new('Attachment')
Att0.Name = "Att0"
Att0.Parent = Dot
Dot.Name = Player.Name.."_Laser"
Dot.Parent = BulletModel
Dot.Transparency = 1
if Player.Character and Player.Character:FindFirstChild('S'.. Arma.Name) ~= nil and Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):FindFirstChild("Laser") ~= nil then
local Muzzle = Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):WaitForChild("Laser")
local Laser = Instance.new('Beam')
Laser.Parent = Dot
Laser.Transparency = NumberSequence.new(0)
Laser.LightEmission = 1
Laser.LightInfluence = 0
Laser.Attachment0 = Att0
Laser.Attachment1 = Muzzle
Laser.Color = ColorSequence.new(Cor)
Laser.FaceCamera = true
Laser.Width0 = 0.01
Laser.Width1 = 0.01
if not NVG then
Laser.Enabled = false
end
end
end
if Modo == 1 then
if BulletModel:FindFirstChild(Player.Name.."_Laser") ~= nil then
local LA = BulletModel:FindFirstChild(Player.Name.."_Laser")
LA.Shape = 'Ball'
LA.Size = Vector3.new(0.2, 0.2, 0.2)
LA.CanCollide = false
LA.Anchored = true
LA.Color = Cor
LA.Material = Enum.Material.Neon
LA.Position = Position
if NVG then
LA.Transparency = 0
if LA:FindFirstChild("Beam") ~= nil then
LA.Beam.Enabled = true
end
else
if Player.Character and Player.Character:FindFirstChild('S'.. Arma.Name) ~= nil and Player.Character:WaitForChild('S'.. Arma.Name):WaitForChild('Grip'):FindFirstChild("Laser") ~= nil then
if IR then
LA.Transparency = 1
else
LA.Transparency = 0
end
end
if LA:FindFirstChild("Beam") ~= nil then
LA.Beam.Enabled = false
end
end
end
elseif Modo == 2 then
if BulletModel:FindFirstChild(Player.Name.."_Laser") ~= nil then
local LA = BulletModel:FindFirstChild(Player.Name.."_Laser")
LA:Destroy()
end
end
end
end)
function Launcher()
if Settings.FireModes.Explosive == true then
Character:WaitForChild('S'.. ArmaClone.Name):WaitForChild('Grip'):WaitForChild('Fire2'):Play()
local M203 = Instance.new("Part")
M203.Shape = 'Ball'
M203.CanCollide = false
M203.Size = Vector3.new(0.25,0.25,0.25)
M203.Material = Enum.Material.Metal
M203.Color = Color3.fromRGB(27, 42, 53)
M203.Parent = BulletModel
M203.CFrame = ArmaClone.SmokePart2.CFrame
M203.Velocity = ArmaClone.SmokePart2.CFrame.lookVector*(600-196.2)
local At1 = Instance.new("Attachment")
At1.Name = "At1"
At1.Position = Vector3.new(-.15,0,0)
At1.Parent = M203
local At2 = Instance.new("Attachment")
At2.Name = "At2"
At2.Position = Vector3.new(.15,0,0)
At2.Parent = M203
local Particles = Instance.new("Trail")
Particles.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.WidthScale = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
Particles.Texture = "rbxassetid://232918622"
Particles.TextureMode = Enum.TextureMode.Stretch
Particles.FaceCamera = true
Particles.LightEmission = 0
Particles.LightInfluence = 1
Particles.Lifetime = 0.2
Particles.Attachment0 = At1
Particles.Attachment1 = At2
Particles.Parent = M203
local Hit2, Pos2, Norm2, Mat2
local Hit, Pos, Norm, Mat
local L_257_ = ArmaClone.SmokePart2.Position;
local L_258_ = M203.Position;
local L_260_ = false
local recast
while true do
RS.Heartbeat:wait()
L_258_ = M203.Position;
Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
if Hit2 then
while not recast do
if Hit2 and (Hit2 and Hit2.Transparency >= 1 or Hit2.CanCollide == false or Hit2.Name == "Ignorable" or Hit2.Name == "Glass" or Hit2.Parent.Name == "Top" or Hit2.Parent.Name == "Helmet" or Hit2.Parent.Name == "Up" or Hit2.Parent.Name == "Down" or Hit2.Parent.Name == "Face" or Hit2.Parent.Name == "Olho" or Hit2.Parent.Name == "Headset" or Hit2.Parent.Name == "Numero" or Hit2.Parent.Name == "Vest" or Hit2.Parent.Name == "Chest" or Hit2.Parent.Name == "Waist" or Hit2.Parent.Name == "Back" or Hit2.Parent.Name == "Belt" or Hit2.Parent.Name == "Leg1" or Hit2.Parent.Name == "Leg2" or Hit2.Parent.Name == "Arm1" or Hit2.Parent.Name == "Arm2") and Hit2.Name ~= 'Right Arm' and Hit2.Name ~= 'Left Arm' and Hit2.Name ~= 'Right Leg' and Hit2.Name ~= 'Left Leg' and Hit2.Name ~= 'Armor' and Hit2.Name ~= 'EShield' then
table.insert(Ray_Ignore, Hit2)
recast = true
end
if recast then
Hit2, Pos2, Norm2, Mat2 = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)*20), Ray_Ignore, false, true);
Hit, Pos, Norm, Mat = workspace:FindPartOnRayWithIgnoreList(Ray.new(L_257_, (L_258_ - L_257_)), Ray_Ignore, false, true);
recast = false
else
break
end
end
end
if Hit and not recast then
Evt.LauncherHit:FireServer(Pos, Hit, Norm, Mat)
Hitmarker.Explosion(Pos, Hit, Norm)
M203:remove()
local Hitmark = Instance.new("Attachment")
Hitmark.CFrame = CFrame.new(Pos, Pos + Norm)
Hitmark.Parent = workspace.Terrain
Debris:AddItem(Hitmark, 5)
local Exp = Instance.new("Explosion")
Exp.BlastPressure = 0
Exp.BlastRadius = Settings.LauncherRadius
Exp.DestroyJointRadiusPercent = 0
Exp.Position = Hitmark.Position
Exp.Parent = Hitmark
Exp.Visible = false
Exp.Hit:connect(function(hitPart, partDistance)
local FoundHuman,VitimaHuman = CheckForHumanoid(hitPart)
local damage = math.random(Settings.LauncherDamage[1],Settings.LauncherDamage[2])
if FoundHuman == true and VitimaHuman.Health > 0 then
local distance_factor = partDistance / Exp.BlastRadius -- get the distance as a value between 0 and 1
distance_factor = 1 - distance_factor -- flip the amount, so that lower == closer == more damage
if distance_factor > 0 then
Evt.Damage:FireServer(VitimaHuman,(damage*distance_factor),0,0)
end
end
end)
break
end
L_257_ = L_258_;
end
end
end
Evt.LauncherHit.OnClientEvent:Connect(function(Player, Position, HitPart, Normal)
if Player ~= Jogador then
Hitmarker.Explosion(Position, HitPart, Normal)
end
end)
Mouse.Button1Down:connect(function()
if Equipped then
MouseHeld = true
if Settings.Mode ~= "Explosive" then
if slideback or not Chambered.Value == true or Emperrado.Value == true then
ArmaClone.Handle.Click:Play()
return
end
elseif Settings.Mode == "Explosive" and GLChambered.Value == false or GLAmmo.Value <= 0 then
ArmaClone.Handle.Click:Play()
return
end
if Can_Shoot and not Reloading and not Safe and not Correndo then
Can_Shoot = false
if Settings.Mode == "Semi" and Ammo.Value > 0 and Emperrado.Value == false then
Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
for _ = 1, Settings.Bullets do
coroutine.resume(coroutine.create(function()
Balinha = CreateBullet(BSpread)
CastRay(Balinha)
end))
end
recoil()
Emperrar()
if Emperrado.Value == false then
--EjectShells()
end
Ammo.Value = Ammo.Value - 1
if BSpread and not DecreasedAimLastShot then
BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
RecoilPower = math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if BSpread >= Settings.MaxSpread then
OverHeat = true
end
wait(FireRate)
elseif Settings.Mode == "Auto" then
while MouseHeld and Equipped and not Can_Shoot and Emperrado.Value == false and Ammo.Value > 0 do
Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
for _ = 1, Settings.Bullets do
coroutine.resume(coroutine.create(function()
Balinha = CreateBullet(BSpread)
CastRay(Balinha)
end))
end
recoil()
Emperrar()
if Emperrado.Value == false then
--EjectShells()
end
Ammo.Value = Ammo.Value - 1
if BSpread and not DecreasedAimLastShot then
BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
RecoilPower = math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if BSpread >= Settings.MaxSpread then
OverHeat = true
end
wait(FireRate)
end
elseif Settings.Mode == "Burst" and Ammo.Value > 0 then
for i = 1, Settings.BurstShot do
for _ = 1, Settings.Bullets do
if MouseHeld and Ammo.Value > 0 and Emperrado.Value == false then
Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
coroutine.resume(coroutine.create(function()
Balinha = CreateBullet(BSpread)
CastRay(Balinha)
end))
recoil()
Emperrar()
if Emperrado.Value == false then
--EjectShells()
end
Ammo.Value = Ammo.Value - 1
end
end
if BSpread and not DecreasedAimLastShot then
BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
RecoilPower = math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if BSpread >= Settings.MaxSpread then
OverHeat = true
end
wait(BurstFireRate)
end
elseif Settings.Mode == "Bolt-Action" or Settings.Mode == "Pump-Action" and Ammo.Value > 0 and Emperrado.Value == false then
Evt.Atirar:FireServer(FireRate,Anims,ArmaClient)
for _ = 1, Settings.Bullets do
coroutine.resume(coroutine.create(function()
Balinha = CreateBullet(BSpread)
CastRay(Balinha)
end))
end
recoil()
if (Ammo.Value - 1) > 0 then
Emperrado.Value = true
end
if Emperrado == false then
--EjectShells()
end
Ammo.Value = Ammo.Value - 1
if BSpread and not DecreasedAimLastShot then
BSpread = math.min(Settings.MaxSpread, BSpread + Settings.AimInaccuracyStepAmount)
RecoilPower = math.min(Settings.MaxRecoilPower, RecoilPower + Settings.RecoilPowerStepAmount)
end
DecreasedAimLastShot = not DecreasedAimLastShot
if BSpread >= Settings.MaxSpread then
OverHeat = true
end
if (Settings.AutoChamber) then
if Aiming and (Settings.ChamberWhileAim) then
MouseHeld = false
Can_Shoot = false
Reloading = true
ChamberAnim()
Sprint()
Can_Shoot = true
Reloading = false
elseif not Aiming then
MouseHeld = false
Can_Shoot = false
Reloading = true
ChamberAnim()
Sprint()
Can_Shoot = true
Reloading = false
end
end
wait(FireRate)
elseif Settings.Mode == "Explosive" and GLAmmo.Value > 0 and GLChambered.Value == true and not Correndo then
GLChambered.Value = false
GLAmmo.Value = GLAmmo.Value - 1
coroutine.resume(coroutine.create(function()
Launcher()
end))
end
Can_Shoot = true
Update_Gui()
end
end
end)
Mouse.Button1Up:connect(function()
if Equipped then
MouseHeld = false
end
end)
Mouse.WheelForward:connect(function()
if Equipped and not Aiming and not Reloading and not Correndo then
MouseHeld = false
if stance == 0 then
Safe = true
stance = 1
Evt.Stance:FireServer(stance,Settings,Anims)
StanceUp()
elseif stance == -1 then
Safe = false
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
IdleAnim()
elseif stance == -2 then
Safe = true
stance = -1
Evt.Stance:FireServer(stance,Settings,Anims)
StanceDown()
end
Update_Gui()
end
if Equipped and Aiming and Sens.Value < 100 then
Sens.Value = Sens.Value + 5
Update_Gui()
game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
end
end)
Mouse.WheelBackward:connect(function()
if Equipped and not Aiming and not Reloading and not Correndo then
MouseHeld = false
if stance == 0 then
Safe = true
stance = -1
Evt.Stance:FireServer(stance,Settings,Anims)
StanceDown()
elseif stance == -1 then
Safe = true
stance = -2
Evt.Stance:FireServer(stance,Settings,Anims)
Patrol()
elseif stance == 1 then
Safe = false
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
IdleAnim()
end
Update_Gui()
end
if Equipped and Aiming and Sens.Value > 5 then
Sens.Value = Sens.Value - 5
Update_Gui()
game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
end
end)
Mouse.Button2Down:connect(function()
if Equipped and stance > -2 and not Aiming and (Camera.Focus.p - Camera.CFrame.p).magnitude < 1 and not Correndo then
if NVG and ArmaClone.AimPart:FindFirstChild("NVAim") ~= nil and Bipod then
else
if Safe then
Safe = false
IdleAnim()
Update_Gui()
end
stance = 2
Evt.Stance:FireServer(stance,Settings,Anims)
Aiming = true
game:GetService('UserInputService').MouseDeltaSensitivity = (Sens.Value/100)
ArmaClone.Handle.AimDown:Play()
if not NVG or ArmaClone.AimPart:FindFirstChild("NVAim") == nil then
if ArmaClone:FindFirstChild('AimPart2') ~= nil then
if AimPartMode == 1 then
tweenFoV(Settings.ChangeFOV[1],120)
if Settings.FocusOnSight then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
elseif AimPartMode == 2 then
tweenFoV(Settings.ChangeFOV[2],120)
if Settings.FocusOnSight2 then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
end
else
if AimPartMode == 1 then
tweenFoV(Settings.ChangeFOV[1],120)
if Settings.FocusOnSight then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
elseif AimPartMode == 2 then
tweenFoV(Settings.ChangeFOV[2],120)
if Settings.FocusOnSight2 then
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.75),{ImageTransparency = 0}):Play()
else
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
end
end
else
tweenFoV(70,120)
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
end
elseif Aiming and Equipped then
stance = 0
Evt.Stance:FireServer(stance,Settings,Anims)
game:GetService('UserInputService').MouseDeltaSensitivity = 1
ArmaClone.Handle.AimUp:Play()
tweenFoV(70,120)
Aiming = false
TS:Create(StatusClone.Efeitos.Aim,TweenInfo.new(.3),{ImageTransparency = 1}):Play()
end
end)
Human.Died:connect(function()
ResetWorkspace()
Human:UnequipTools()
Evt.Rappel.CutEvent:FireServer()
Unset()
end)
function onStateChanged(_,state)
if state == Enum.HumanoidStateType.Swimming then
Nadando = true
if Equipped then
Unset()
Humanoid:UnequipTools()
end
else
Nadando = false
end
if ServerConfig.EnableFallDamage then
if state == Enum.HumanoidStateType.Freefall and not falling then
falling = true
local curVel = 0
local peak = 0
while falling do
curVel = HumanoidRootPart.Velocity.magnitude
peak = peak + 1
wait()
end
local damage = (curVel - (ServerConfig.MaxVelocity)) * ServerConfig.DamageMult
if damage > 5 and peak > 20 then
local hurtSound = PastaFX.FallDamage:Clone()
hurtSound.Parent = Player.PlayerGui
hurtSound.Volume = damage/Human.MaxHealth
hurtSound:Play()
Debris:AddItem(hurtSound,hurtSound.TimeLength)
Evt.Damage:FireServer(Human,damage,0,0)
end
elseif state == Enum.HumanoidStateType.Landed or state == Enum.HumanoidStateType.Dead then
falling = false
end
end
end
Evt.ServerBullet.OnClientEvent:Connect(function(SKP_arg1,SKP_arg3,SKP_arg4,SKP_arg5,SKP_arg6,SKP_arg7,SKP_arg8,SKP_arg9,SKP_arg10,SKP_arg11,SKP_arg12)
if SKP_arg1 ~= Jogador and SKP_arg1.Character then
local SKP_01 = SKP_arg3
local SKP_02 = Instance.new("Part")
SKP_02.Parent = workspace.ACS_WorkSpace.Server
SKP_02.Name = SKP_arg1.Name..'_Bullet'
Debris:AddItem(SKP_02, 5)
SKP_02.Shape = "Ball"
SKP_02.Size = Vector3.new(1, 1, 1)
SKP_02.CanCollide = false
SKP_02.CFrame = SKP_01
SKP_02.Transparency = 1
local SKP_03 = SKP_02:GetMass()
local SKP_04 = Instance.new('BodyForce', SKP_02)
SKP_04.Force = Vector3.new(0,SKP_03 * (196.2) - SKP_arg5 * (196.2), 0)
SKP_02.Velocity = SKP_arg7 * SKP_arg6
local SKP_05 = Instance.new('Attachment', SKP_02)
SKP_05.Position = Vector3.new(0.1, 0, 0)
local SKP_06 = Instance.new('Attachment', SKP_02)
SKP_06.Position = Vector3.new(-0.1, 0, 0)
if SKP_arg4 then
local SKP_07 = Instance.new('Trail', SKP_02)
SKP_07.Attachment0 = SKP_05
SKP_07.Attachment1 = SKP_06
SKP_07.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
SKP_07.WidthScale = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2, 0);
NumberSequenceKeypoint.new(1, 0);
}
)
SKP_07.Texture = "rbxassetid://232918622"
SKP_07.TextureMode = Enum.TextureMode.Stretch
SKP_07.LightEmission = 1
SKP_07.Lifetime = 0.2
SKP_07.FaceCamera = true
SKP_07.Color = ColorSequence.new(SKP_arg8)
end
if SKP_arg10 then
local SKP_08 = Instance.new("BillboardGui", SKP_02)
SKP_08.Adornee = SKP_02
local SKP_09 = math.random(375, 475)/10
SKP_08.Size = UDim2.new(SKP_09, 0, SKP_09, 0)
SKP_08.LightInfluence = 0
local SKP_010 = Instance.new("ImageLabel", SKP_08)
SKP_010.BackgroundTransparency = 1
SKP_010.Size = UDim2.new(1, 0, 1, 0)
SKP_010.Position = UDim2.new(0, 0, 0, 0)
SKP_010.Image = "http://www.roblox.com/asset/?id=1047066405"
SKP_010.ImageColor3 = SKP_arg11
SKP_010.ImageTransparency = math.random(2, 5)/15
if SKP_02:FindFirstChild("BillboardGui") ~= nil then
SKP_02.BillboardGui.Enabled = true
end
end
local SKP_011 = {SKP_arg1.Character,SKP_02,workspace.ACS_WorkSpace}
while true do
RS.Heartbeat:wait()
local SKP_012 = Ray.new(SKP_02.Position, SKP_02.CFrame.LookVector*25)
local SKP_013, SKP_014 = workspace:FindPartOnRayWithIgnoreList(SKP_012, SKP_011, false, true)
if SKP_013 then
game.Debris:AddItem(SKP_02,0)
break
end
end
game.Debris:AddItem(SKP_02,0)
return SKP_02
end
end)
Human.StateChanged:connect(onStateChanged)
Evt.ACS_AI.AIBullet.OnClientEvent:Connect(function(SKP_arg1,SKP_arg3,SKP_arg4,SKP_arg5,SKP_arg6,SKP_arg7,SKP_arg8,SKP_arg9,SKP_arg10,SKP_arg11,SKP_arg12)
if SKP_arg1 ~= Jogador then
local SKP_01 = SKP_arg3
local SKP_02 = Instance.new("Part")
SKP_02.Parent = workspace.ACS_WorkSpace.Server
SKP_02.Name = "AI_Bullet"
Debris:AddItem(SKP_02, 5)
SKP_02.Shape = "Ball"
SKP_02.Size = Vector3.new(1, 1, 1)
SKP_02.CanCollide = false
SKP_02.CFrame = SKP_01
SKP_02.Transparency = 1
local SKP_03 = SKP_02:GetMass()
local SKP_04 = Instance.new('BodyForce', SKP_02)
SKP_04.Force = Vector3.new(0,SKP_03 * (196.2) - SKP_arg5 * (196.2), 0)
SKP_02.Velocity = SKP_arg7 * SKP_arg6
local SKP_05 = Instance.new('Attachment', SKP_02)
SKP_05.Position = Vector3.new(0.1, 0, 0)
local SKP_06 = Instance.new('Attachment', SKP_02)
SKP_06.Position = Vector3.new(-0.1, 0, 0)
if SKP_arg4 then
local SKP_07 = Instance.new('Trail', SKP_02)
SKP_07.Attachment0 = SKP_05
SKP_07.Attachment1 = SKP_06
SKP_07.Transparency = NumberSequence.new({
NumberSequenceKeypoint.new(0, 0, 0);
NumberSequenceKeypoint.new(1, 1);
}
)
SKP_07.WidthScale = NumberSequence.new({
NumberSequenceKeypoint.new(0, 2, 0);
NumberSequenceKeypoint.new(1, 0);
}
)
SKP_07.Texture = "rbxassetid://232918622"
SKP_07.TextureMode = Enum.TextureMode.Stretch
SKP_07.LightEmission = 1
SKP_07.Lifetime = 0.2
SKP_07.FaceCamera = true
SKP_07.Color = ColorSequence.new(SKP_arg8)
end
if SKP_arg10 then
local SKP_08 = Instance.new("BillboardGui", SKP_02)
SKP_08.Adornee = SKP_02
local SKP_09 = math.random(375, 475)/10
SKP_08.Size = UDim2.new(SKP_09, 0, SKP_09, 0)
SKP_08.LightInfluence = 0
local SKP_010 = Instance.new("ImageLabel", SKP_08)
SKP_010.BackgroundTransparency = 1
SKP_010.Size = UDim2.new(1, 0, 1, 0)
SKP_010.Position = UDim2.new(0, 0, 0, 0)
SKP_010.Image = "http://www.roblox.com/asset/?id=1047066405"
SKP_010.ImageColor3 = SKP_arg11
SKP_010.ImageTransparency = math.random(2, 5)/15
if SKP_02:FindFirstChild("BillboardGui") ~= nil then
SKP_02.BillboardGui.Enabled = true
end
end
local SKP_011 = {SKP_02,workspace.ACS_WorkSpace}
while true do
RS.Heartbeat:wait()
local SKP_012 = Ray.new(SKP_02.Position, SKP_02.CFrame.LookVector*25)
local SKP_013, SKP_014 = workspace:FindPartOnRayWithIgnoreList(SKP_012, SKP_011, false, true)
if SKP_013 then
game.Debris:AddItem(SKP_02,0)
break
end
end
game.Debris:AddItem(SKP_02,0)
return SKP_02
end
end)
Evt.ACS_AI.AIShoot.OnClientEvent:Connect(function(Gun)
for _, v in pairs(Gun.Muzzle:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
v.Enabled = true
end
end
delay(1 / 30, function()
for _, v in pairs(Gun.Muzzle:GetChildren()) do
if v.Name:sub(1, 7) == "FlashFX" or v.Name:sub(1, 7) == "Smoke" then
v.Enabled = false
end
end
end)
end)
|
--[[for index, child in pairs(workspace.TexturePallete:GetChildren()) do
if child:IsA("Part") then
if child.BrickColor.Name == "Dark green" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Grass)
end
if child.BrickColor.Name == "Dirt brown" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Mud)
end
if child.BrickColor.Name == "Deep blue" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Water)
end
if child.BrickColor.Name == "Pine Cone" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.WoodPlanks)
end
if child.BrickColor.Name == "Teal" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Glacier)
end
if child.BrickColor.Name == "Really red" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.CrackedLava)
end
if child.BrickColor.Name == "Wheat" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Concrete)
end
if child.BrickColor.Name == "Bronze" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Sand)
end
if child.BrickColor.Name == "Smoky grey" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Rock)
end
if child.BrickColor.Name == "Rust" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Sandstone)
end
if child.BrickColor.Name == "Reddish brown" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Ground)
end
if child.BrickColor.Name == "Fossil" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Slate)
end
if child.BrickColor.Name == "Burgundy" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Brick)
end
if child.BrickColor.Name == "White" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Snow)
end
if child.BrickColor.Name == "Really black" then
game.Workspace.Terrain:FillBlock(child.CFrame, child.Size, Enum.Material.Basalt)
end
end
-- print(index, child.Name)
end]]
| |
---------------------------------------------------
|
Displays = 3 -- Sets how many displays this scripts will use...
DisplayColor = Color3.fromRGB(85, 85, 255)
|
--local function UpdateIcon()
-- if Mouse then
-- Mouse.Icon = Tool.Enabled and MOUSE_ICON or RELOADING_ICON
-- end
--end
| |
--
--
|
local Monster = {} -- Create the monster class
function Monster:GetCFrame()
-- Returns the CFrame of the monster's humanoidrootpart
local humanoidRootPart = Self:FindFirstChild('HumanoidRootPart')
if humanoidRootPart ~= nil and humanoidRootPart:IsA('BasePart') then
return humanoidRootPart.CFrame
else
return CFrame.new()
end
end
function Monster:GetMaximumDetectionDistance()
-- Returns the maximum detection distance
local setting = Settings.MaximumDetectionDistance.Value
if setting < 0 then
return math.huge
else
return setting
end
end
function Monster:SearchForTarget()
-- Finds the closest player and sets the target
local players = Info.Players:GetPlayers()
local closestCharacter, closestCharacterDistance
for i=1, #players do
local player = players[i]
if player.Neutral or player.TeamColor ~= Settings.FriendlyTeam.Value then
local character = player.Character
if character ~= nil and character:FindFirstChild('Humanoid') ~= nil and character.Humanoid:IsA('Humanoid') then
local distance = player:DistanceFromCharacter(Monster:GetCFrame().p)
if distance < Monster:GetMaximumDetectionDistance() then
if closestCharacter == nil then
closestCharacter, closestCharacterDistance = character, distance
else
if closestCharacterDistance > distance then
closestCharacter, closestCharacterDistance = character, distance
end
end
end
end
end
end
if closestCharacter ~= nil then
Mind.CurrentTargetHumanoid.Value = closestCharacter.Humanoid
end
end
function Monster:TryRecomputePath()
if Data.AutoRecompute or tick() - Data.LastRecomputePath > 1/Info.RecomputePathFrequency then
Monster:RecomputePath()
end
end
function Monster:GetTargetCFrame()
local targetHumanoid = Mind.CurrentTargetHumanoid.Value
if Monster:TargetIsValid() then
return targetHumanoid.Torso.CFrame
else
return CFrame.new()
end
end
function Monster:IsAlive()
return Self.Humanoid.Health > 0 and Self.Humanoid.Torso ~= nil
end
function Monster:TargetIsValid()
local targetHumanoid = Mind.CurrentTargetHumanoid.Value
if targetHumanoid ~= nil and targetHumanoid:IsA 'Humanoid' and targetHumanoid.Torso ~= nil and targetHumanoid.Torso:IsA 'BasePart' then
return true
else
return false
end
end
function Monster:HasClearLineOfSight()
-- Going to cast a ray to see if I can just see my target
local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p
local hit, pos = Workspace:FindPartOnRayWithIgnoreList(
Ray.new(
myPos,
targetPos - myPos
),
{
Self,
Mind.CurrentTargetHumanoid.Value.Parent
}
)
if hit == nil then
return true
else
return false
end
end
function Monster:RecomputePath()
if not Data.Recomputing then
if Monster:IsAlive() and Monster:TargetIsValid() then
if Monster:HasClearLineOfSight() then
Data.AutoRecompute = true
Data.PathCoords = {
Monster:GetCFrame().p,
Monster:GetTargetCFrame().p
}
Data.LastRecomputePath = tick()
Data.CurrentNode = nil
Data.CurrentNodeIndex = 2 -- Starts chasing the target without evaluating its current position
else
-- Do pathfinding since you can't walk straight
Data.Recomputing = true -- Basically a debounce.
Data.AutoRecompute = false
local path = Info.PathfindingService:ComputeSmoothPathAsync(
Monster:GetCFrame().p,
Monster:GetTargetCFrame().p,
500
)
Data.PathCoords = path:GetPointCoordinates()
Data.Recomputing = false
Data.LastRecomputePath = tick()
Data.CurrentNode = nil
Data.CurrentNodeIndex = 1
end
end
end
end
function Monster:Update()
Monster:ReevaluateTarget()
Monster:SearchForTarget()
Monster:TryRecomputePath()
Monster:TravelPath()
end
function Monster:TravelPath()
local closest, closestDistance, closestIndex
local myPosition = Monster:GetCFrame().p
local skipCurrentNode = Data.CurrentNode ~= nil and (Data.CurrentNode - myPosition).magnitude < 3
for i=Data.CurrentNodeIndex, #Data.PathCoords do
local coord = Data.PathCoords[i]
if not (skipCurrentNode and coord == Data.CurrentNode) then
local distance = (coord - myPosition).magnitude
if closest == nil then
closest, closestDistance, closestIndex = coord, distance, i
else
if distance < closestDistance then
closest, closestDistance, closestIndex = coord, distance, i
else
break
end
end
end
end
--
if closest ~= nil then
Data.CurrentNode = closest
Data.CurrentNodeIndex = closestIndex
local humanoid = Self:FindFirstChild 'Humanoid'
if humanoid ~= nil and humanoid:IsA'Humanoid' then
humanoid:MoveTo(closest)
end
if Monster:IsAlive() and Monster:TargetIsValid() then
Monster:TryJumpCheck()
Monster:TryAttack()
end
if closestIndex == #Data.PathCoords then
-- Reached the end of the path, force a new check
Data.AutoRecompute = true
end
end
end
function Monster:TryJumpCheck()
if tick() - Data.LastJumpCheck > 1/Info.JumpCheckFrequency then
Monster:JumpCheck()
end
end
function Monster:TryAttack()
if tick() - Data.LastAttack > 1/Settings.AttackFrequency.Value then
Monster:Attack()
end
end
function Monster:Attack()
local myPos, targetPos = Monster:GetCFrame().p, Monster:GetTargetCFrame().p
if (myPos - targetPos).magnitude <= Settings.AttackRange.Value then
Mind.CurrentTargetHumanoid.Value:TakeDamage(Settings.AttackDamage.Value)
Data.LastAttack = tick()
Data.AttackTrack:Play()
end
end
function Monster:JumpCheck()
-- Do a raycast to check if we need to jump
local myCFrame = Monster:GetCFrame()
local checkVector = (Monster:GetTargetCFrame().p - myCFrame.p).unit*2
local hit, pos = Workspace:FindPartOnRay(
Ray.new(
myCFrame.p + Vector3.new(0, -2.4, 0),
checkVector
),
Self
)
if hit ~= nil and not hit:IsDescendantOf(Mind.CurrentTargetHumanoid.Value.Parent) then
-- Do a slope check to make sure we're not walking up a ramp
local hit2, pos2 = Workspace:FindPartOnRay(
Ray.new(
myCFrame.p + Vector3.new(0, -2.3, 0),
checkVector
),
Self
)
if hit2 == hit then
if ((pos2 - pos)*Vector3.new(1,0,1)).magnitude < 0.05 then -- Will pass for any ramp with <2 slope
Self.Humanoid.Jump = true
end
end
end
Data.LastJumpCheck = tick()
end
function Monster:Connect()
Mind.CurrentTargetHumanoid.Changed:connect(function(humanoid)
if humanoid ~= nil then
assert(humanoid:IsA'Humanoid', 'Monster target must be a humanoid')
Monster:RecomputePath()
end
end)
Self.Respawn.OnInvoke = function(point)
Monster:Respawn(point)
end
end
function Monster:Initialize()
Monster:Connect()
if Settings.AutoDetectSpawnPoint.Value then
Settings.SpawnPoint.Value = Monster:GetCFrame().p
end
end
function Monster:Respawn(point)
local point = point or Settings.SpawnPoint.Value
for index, obj in next, Data.BaseMonster:Clone():GetChildren() do
if obj.Name == 'Configurations' or obj.Name == 'Mind' or obj.Name == 'Respawned' or obj.Name == 'Died' or obj.Name == 'MonsterScript' or obj.Name == 'Respawn' then
obj:Destroy()
else
Self[obj.Name]:Destroy()
obj.Parent = Self
end
end
Monster:InitializeUnique()
Self.Parent = Workspace
Self.HumanoidRootPart.CFrame = CFrame.new(point)
Settings.SpawnPoint.Value = point
Self.Respawned:Fire()
end
function Monster:InitializeUnique()
Data.AttackTrack = Self.Humanoid:LoadAnimation(script.Attack)
end
function Monster:ReevaluateTarget()
local currentTarget = Mind.CurrentTargetHumanoid.Value
if currentTarget ~= nil and currentTarget:IsA'Humanoid' then
local character = currentTarget.Parent
if character ~= nil then
local player = Info.Players:GetPlayerFromCharacter(character)
if player ~= nil then
if not player.Neutral and player.TeamColor == Settings.FriendlyTeam.Value then
Mind.CurrentTargetHumanoid.Value = nil
end
end
end
if currentTarget == Mind.CurrentTargetHumanoid.Value then
local torso = currentTarget.Torso
if torso ~= nil and torso:IsA 'BasePart' then
if Settings.CanGiveUp.Value and (torso.Position - Monster:GetCFrame().p).magnitude > Monster:GetMaximumDetectionDistance() then
Mind.CurrentTargetHumanoid.Value = nil
end
end
end
end
end
|
-- So if you used your script & when you click "q" & release it, the Animation instance that's loaded in your Humanoid will be created 2 times, since you loaded it twice (through your .KeyDown/.KeyUp functions).
| |
--to do
--go towards boxes
--account for arrows and paladins
--account for boss size
|
local MoveDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5)}
local GasDirections = {Vector3.new(5,0,0),Vector3.new(-5,0,0),Vector3.new(0,0,5),Vector3.new(0,0,-5),Vector3.new(5,0,5),Vector3.new(-5,0,5),Vector3.new(5,0,5),Vector3.new(5,0,-5)}
return function(Map)
local Pathfinding = require(game.ReplicatedStorage.PathfindFunctions)(Map)
local Movement = require(game.ReplicatedStorage.EnemyAi.Movement)(Map)
local Self = {}
local ExploredPositions = {}
local OutsidePositions = {}
Self.CheckSquare = function(Position)
if table.find(Map,Vector3.new(Position.X, 0, Position.Z)) then
return true
end
return false
end
Self.GetDangerSpots = function(Enemies)
local Spots = {}
for i, Enemy in pairs (Enemies) do
if Enemy.IsAttacking then
for i, v in pairs(MoveDirections) do
table.insert(Spots, Enemy.Position - Vector3.new(0, Enemy.Position.Y) + v)
end
end
end
for i, Projectile in pairs(workspace.ActiveProjectiles:GetChildren()) do
local NewPos = Projectile.PrimaryPart.Position + Projectile.MoveDirection.Value
local FlooredSpot = Vector3.new(math.floor(NewPos.X/5)*5, 0,math.floor(NewPos.Z/5)*5)
table.insert(Spots, FlooredSpot)
end
for i, Trap in pairs(workspace.ActiveTraps:GetChildren()) do
table.insert(Spots, Trap.PrimaryPart.Position)
if Trap.PrimaryPart.Size.X >= 12 then
for i, v in pairs(GasDirections) do
table.insert(Spots, Trap.PrimaryPart.Position + v)
end
end
end
return Spots
end
Self.GetAttackersOfSpot = function(Position)
local Attackers = {}
for i, Model in pairs(workspace.ActiveEnemies:GetChildren()) do
if (Model.PrimaryPart.Position - Position).Magnitude <= 7 then
table.insert(Attackers, Model)
end
end
return Attackers
end
Self.GetEnemies = function()
local EnemyTable = {}
for i ,v in pairs(workspace.ActiveEnemies:GetChildren()) do
local SpotData = {}
SpotData.Position = v.PrimaryPart.Position
SpotData.IsAttacking = v.PrimaryPart.BrickColor == BrickColor.new("Really red")
table.insert(EnemyTable, SpotData)
end
return EnemyTable
end
Self.GetEnemyAtPosition = function(Position, EnemyTable)
for i, v in pairs(EnemyTable) do
if Vector3.new(v.Position.X, 0, v.Position.Z) == Vector3.new(Position.X, 0, Position.Z) then
return v
end
end
return false
end
Self.CheckIfDangerSpot = function(Position, DangerSpots)
for i, v in pairs(DangerSpots) do
if Vector3.new(v.X, 0, v.Z) == Vector3.new(Position.X, 0, Position.Z) then
return v
end
end
return false
end
Self.GetBestCostingSpot = function(Spots)
local BestCost = -math.huge
local BestSpots = {}
for i, v in pairs(Spots) do
if v.Cost > BestCost then
BestCost = v.Cost
BestSpots = {}
table.insert(BestSpots, v)
elseif v.Cost == BestCost then
table.insert(BestSpots, v)
end
end
return BestSpots[math.random(1, #BestSpots)]
end
Self.PositionReachedAmount = function(Position)
local Amount = 0
for i, v in pairs(ExploredPositions) do
if Vector3.new(v.X, 0, v.Z) == Position - Vector3.new(Position.Y) then
Amount += 1
end
end
return Amount
end
Self.UpdateEnemies = function(EnemyTable)
local NewTable = {}
for i, v in pairs(EnemyTable) do
if v.IsAttacking then
local MoveDirection = Movement.GetNearestPlayerDirection(v.Position, false, false, nil, true)
local NewData = {}
NewData.Position = v.Position + MoveDirection
-- you could check but this is the lazy way
NewData.IsAttacking = true
end
end
return NewTable
end
Self.GetOutsideSquares = function()
local Squares = {}
for i, Spot in pairs(Map) do
for i, v in pairs(MoveDirections) do
if not Self.CheckSquare(Spot+v) then
table.insert(Squares, Spot)
break
end
end
end
OutsidePositions = Squares
end
Self.IsOutsideSquare = function(Position, Squares)
if table.find(OutsidePositions, Vector3.new(Position.X,0,Position.Z)) then
return true
else
return false
end
end
Self.GetMoveInfo = function(EnemyTable, Depth, playerPos, SentDirections)
local Spots = {}
local PlayerPos = playerPos
local DangerSpots = Self.GetDangerSpots(EnemyTable)
local Loot = workspace.Loot:GetChildren()
local Closestloot = nil
local LootPos = nil
local ClosestLootDistance = math.huge
if #Loot~=0 then
for i, v in pairs(workspace.Loot:GetChildren()) do
local Distance = (v.PrimaryPart.Position - PlayerPos).Magnitude
if Distance < ClosestLootDistance then
Closestloot = v
ClosestLootDistance= Distance
end
end
LootPos = Closestloot.PrimaryPart.Position
end
local NewPos
for i, v in pairs(MoveDirections) do
DangerSpots = Self.GetDangerSpots(EnemyTable)
--PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position
local OriginPos = PlayerPos
local AttackDirection = OriginPos + v
--something wrong
NewPos = (not Self.CheckSquare(AttackDirection) or Self.GetEnemyAtPosition(AttackDirection, EnemyTable))and OriginPos or AttackDirection
local Directions
if SentDirections then
Directions = SentDirections
table.remove(Directions, 1)
end
local Directions = (not SentDirections and LootPos) and Pathfinding.GetDirections(PlayerPos, LootPos)
-- could check if there are still boxes
local IsDangerous = Self.CheckIfDangerSpot(NewPos, DangerSpots)
local Enemy = Self.GetEnemyAtPosition(AttackDirection, EnemyTable)
local TimesPositionReached = Self.PositionReachedAmount(NewPos)
local HasLoot = Closestloot and (Closestloot.PrimaryPart.Position - NewPos).Magnitude<3
local IsOutsideSquare = Self.IsOutsideSquare(NewPos)
local IsDirectionOfCrate = Directions and Directions[1] == v
-- make it realize that an enemy dies when it's attacked at 0 health
-- make this account for paladins
local AttackersOfPlayerSpot = Self.GetAttackersOfSpot(PlayerPos)
local CanAttackThoughRed = #AttackersOfPlayerSpot== 1 and AttackersOfPlayerSpot[1].Health.Value == 1 and AttackersOfPlayerSpot[1].PrimaryPart.Position == AttackDirection + Vector3.new(0, -AttackDirection.Y + AttackersOfPlayerSpot[1].PrimaryPart.Position.Y)
local Cost = (IsDangerous and not CanAttackThoughRed) and-10 or 0
Cost += TimesPositionReached*-0.1
Cost += IsOutsideSquare and -1 or 0
Cost += (Enemy and not IsDangerous) and 2 or 0
Cost += CanAttackThoughRed and 2 or 0
Cost += IsDirectionOfCrate and 4 or 0
Cost += HasLoot and 4 or 0
if Depth>0 then
Cost += Self.GetMoveInfo(Self.UpdateEnemies(EnemyTable), Depth-1, PlayerPos + v, Directions).Cost
end
local Data = {}
Data.Direction = v
Data.Cost = Cost
table.insert(Spots, Data)
end
local BestSpot = Self.GetBestCostingSpot(Spots)
table.insert(ExploredPositions, PlayerPos)
return BestSpot
end
Self.MovePlayer = function()
local PlayerPos = game.Players.LocalPlayer.Character.PrimaryPart.Position
PlayerPos = Vector3.new(math.floor(PlayerPos.X + 0.5), 0, math.floor(PlayerPos.Z + 0.5))
Self.GetOutsideSquares()
local MoveInfo = Self.GetMoveInfo(Self.GetEnemies(), 0, PlayerPos)
game.ReplicatedStorage.Events.Move:FireServer(MoveInfo.Direction.Unit)
end
return Self
end
|
--[=[
@within TableUtil
@function Map
@param tbl table
@param predicate (value: any, key: any, tbl: table) -> newValue: any
@return table
Performs a map operation against the given table, which can be used to
map new values based on the old values at given keys/indices.
For example:
```lua
local t = {A = 10, B = 20, C = 30}
local t2 = TableUtil.Map(t, function(value)
return value * 2
end)
print(t2) --> {A = 20, B = 40, C = 60}
```
]=]
|
local function Map<T, M>(t: { T }, f: (T, number, { T }) -> M): { M }
assert(type(t) == "table", "First argument must be a table")
assert(type(f) == "function", "Second argument must be a function")
local newT = table.create(#t)
for k, v in t do
newT[k] = f(v, k, t)
end
return newT
end
|
--- Flash text color (good for visually showing updates to text)
|
return function(textLabel, speed)
--- Variables
speed = speed or 1
--- Cache original text color (or grab it)
local originalTextColor = _L.GUIFX.CacheProperty(textLabel, "TextColor3")
--- Change to 'flashed' text
if originalTextColor == Color3.new(1, 1, 1) then
--- Half text color saturation
textLabel.TextColor3 = Color3.new(
originalTextColor.r / 2,
originalTextColor.g / 2,
originalTextColor.b / 2
)
else
--- Double text color saturation
textLabel.TextColor3 = Color3.new(
originalTextColor.r * 2,
originalTextColor.g * 2,
originalTextColor.b * 2
)
end
--- Revert (fade in)
local tween = _L.Functions.FastTween(textLabel, {TextColor3 = originalTextColor}, {speed, EasingStyle})
end
|
-- Function to handle key input
|
local function handleKeyPress(input, gameProcessedEvent)
if not gameProcessedEvent and input.KeyCode == Enum.KeyCode.LeftShift then
setWalkspeed(desiredWalkspeed)
end
end
|
--[=[
@class Keyboard
@client
The Keyboard class is part of the Input package.
```lua
local Keyboard = require(packages.Input).Keyboard
```
]=]
|
local Keyboard = {}
Keyboard.__index = Keyboard
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
ZoneModelName = "Red ring" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
----[FIRE FUNCTIONS WHEN PLUGIN SIZE CHANGES]----
|
local function PluginChanged()
ResizeSlider()
end
PluginGui.Changed:Connect(PluginChanged)
|
-- TableUtil
-- Stephen Leitnick
-- September 13, 2017
|
type Table = {any}
type MapPredicate = (any, any, Table) -> any
type FilterPredicate = (any, any, Table) -> boolean
type ReducePredicate = (any, any, any, Table) -> any
type FindCallback = (any, any, Table) -> boolean
type IteratorFunc = (t: Table, k: any) -> (any, any)
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = false --- Automatically operates the bolt on reload if needed
,SlideLock = false
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = false
,CanBreak = false --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = false --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = false --- 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 = 6.5
,GunFOVReduction = 5.5
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
-- initialize to idle
|
playAnimation("idle", 0.1, zombie)
pose = "Standing"
|
-----------------------------------------------------------------------------------------------
|
ItemID = 97569329 -- The ID of the Gamepass/T-Shirt.
OpenTime = 0 -- The time the door is open for.
OpenTrans = 1 -- The transparency of the door when it is open.
CloseTrans = 1 -- The transparency of the door when it is closed.
BuyGUI = true -- Set to false to stop the BuyGUI appearing.
KillOnTouch = false -- Set to false to stop players being killed when they touch it.
|
-- create a basic loading gui
|
local screenGui = Instance.new("ScreenGui")
local textLabel = Instance.new("TextLabel", screenGui)
textLabel.Text = "Loading"
textLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
textLabel.AnchorPoint = Vector2.new(0.5, 0.5)
textLabel.Size = UDim2.new(1 , 0, 1, 100) -- make sure the topbar is covered
textLabel.FontSize = Enum.FontSize.Size14
screenGui.Parent = playerGui
|
-- TaskQueue
-- Stephen Leitnick
-- November 20, 2021
| |
--[[Controls]]
|
local _CTRL = _Tune.Controls
local Controls = Instance.new("Folder",script.Parent)
Controls.Name = "Controls"
for i,v in pairs(_CTRL) do
local a=Instance.new("StringValue",Controls)
a.Name=i
a.Value=v.Name
a.Changed:connect(function()
if i=="MouseThrottle" or i=="MouseBrake" then
if a.Value == "MouseButton1" or a.Value == "MouseButton2" then
_CTRL[i]=Enum.UserInputType[a.Value]
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
else
_CTRL[i]=Enum.KeyCode[a.Value]
end
end)
end
--Deadzone Adjust
local _PPH = _Tune.Peripherals
for i,v in pairs(_PPH) do
local a = Instance.new("IntValue",Controls)
a.Name = i
a.Value = v
a.Changed:connect(function()
a.Value=math.min(100,math.max(0,a.Value))
_PPH[i] = a.Value
end)
end
--Input Handler
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GThrot = 1
else
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_GBrake = 1
car.Body.TL.BRAKE.Enabled = true
else
_GBrake = 0
car.Body.TL.BRAKE.Enabled = false
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--
--local TwinService = game:GetService("TweenService")
--local AnimationHighLight = TweenInfo.new(3)
--local Info = {FillTransparency = 0}
--local Animka = TwinService:Create(HighLight, AnimationHighLight, Info )
--local char = script.Parent
|
local hum = char:WaitForChild("Humanoid")
local deathAnim = hum:LoadAnimation(script.DeathAnim)
hum.BreakJointsOnDeath = false
local dead = false
|
--[[
Returns a 2x2 matrix of coefficients for a given damping ratio, speed and
time step. These coefficients can then be multiplied with the position and
velocity of an existing spring to find the new position and velocity values.
Specifically, this function returns four numbers - posPos, posVel, velPos,
and velVel, in that order - which can be applied to position and velocity
like so:
local newPosition = oldPosition * posPos + oldVelocity * posVel
local newVelocity = oldPosition * velPos + oldVelocity * velVel
If a large number of springs with identical damping ratios and speeds are
being updated with the same time step, then these coefficients can be used
to update all of them at once.
This function assumes the damping ratio, speed and time step are all >= 0,
with the expectation that these values have been verified beforehand.
]]
|
local function springCoefficients(timeStep: number, damping: number, speed: number): (number, number, number, number)
-- if time step or speed is 0, then the spring won't move, so an identity
-- matrix can be returned early
if timeStep == 0 or speed == 0 then
return
1, 0,
0, 1
end
if damping > 1 then
-- overdamped spring
-- solutions to the characteristic equation
-- z = -ζω ± Sqrt[ζ^2 - 1] ω
local zRoot = math.sqrt(damping^2 - 1)
local z1 = (-zRoot - damping)*speed
local z2 = (zRoot - damping)*speed
-- x[t] -> x0(e^(t z2) z1 - e^(t z1) z2)/(z1 - z2)
-- + v0(e^(t z1) - e^(t z2))/(z1 - z2)
local zDivide = 1/(z1 - z2)
local z1Exp = math.exp(timeStep * z1)
local z2Exp = math.exp(timeStep * z2)
local posPosCoef = (z2Exp * z1 - z1Exp * z2) * zDivide
local posVelCoef = (z1Exp - z2Exp) * zDivide
-- v[t] -> x0(z1 z2(-e^(t z1) + e^(t z2)))/(z1 - z2)
-- + v0(z1 e^(t z1) - z2 e^(t z2))/(z1 - z2)
local velPosCoef = z1*z2 * (-z1Exp + z2Exp) * zDivide
local velVelCoef = (z1*z1Exp - z2*z2Exp) * zDivide
return
posPosCoef, posVelCoef,
velPosCoef, velVelCoef
elseif damping == 1 then
-- critically damped spring
-- x[t] -> x0(e^-tω)(1+tω) + v0(e^-tω)t
local timeStepSpeed = timeStep * speed
local negSpeedExp = math.exp(-timeStepSpeed)
local posPosCoef = negSpeedExp * (1 + timeStepSpeed)
local posVelCoef = negSpeedExp * timeStep
-- v[t] -> x0(t ω^2)(-e^-tω) + v0(1 - tω)(e^-tω)
local velPosCoef = -negSpeedExp * (timeStep * speed*speed)
local velVelCoef = negSpeedExp * (1 - timeStepSpeed)
return
posPosCoef, posVelCoef,
velPosCoef, velVelCoef
else
-- underdamped spring
-- factored out of the solutions to the characteristic equation, to make
-- the math cleaner
local alpha = math.sqrt(1 - damping^2) * speed
-- x[t] -> x0(e^-tζω)(α Cos[tα] + ζω Sin[tα])/α
-- + v0(e^-tζω)(Sin[tα])/α
local negDampSpeedExp = math.exp(-timeStep * damping * speed)
local sinAlpha = math.sin(timeStep*alpha)
local alphaCosAlpha = alpha * math.cos(timeStep*alpha)
local dampSpeedSinAlpha = damping*speed*sinAlpha
local invAlpha = 1 / alpha
local posPosCoef = negDampSpeedExp * (alphaCosAlpha + dampSpeedSinAlpha) * invAlpha
local posVelCoef = negDampSpeedExp * sinAlpha * invAlpha
-- v[t] -> x0(-e^-tζω)(α^2 + ζ^2 ω^2)(Sin[tα])/α
-- + v0(e^-tζω)(α Cos[tα] - ζω Sin[tα])/α
local velPosCoef = -negDampSpeedExp * (alpha*alpha + damping*damping * speed*speed) * sinAlpha * invAlpha
local velVelCoef = negDampSpeedExp * (alphaCosAlpha - dampSpeedSinAlpha) * invAlpha
return
posPosCoef, posVelCoef,
velPosCoef, velVelCoef
end
end
return springCoefficients
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local function ShallowCopy(table)
local copy = {}
for i, v in pairs(table) do
copy[i] = v
end
return copy
end
local methods = {}
local lazyEventNames =
{
eDestroyed = true,
eSaidMessage = true,
eReceivedMessage = true,
eReceivedUnfilteredMessage = true,
eMessageDoneFiltering = true,
eReceivedSystemMessage = true,
eChannelJoined = true,
eChannelLeft = true,
eMuted = true,
eUnmuted = true,
eExtraDataUpdated = true,
eMainChannelSet = true,
eChannelNameColorUpdated = true,
}
local lazySignalNames =
{
Destroyed = "eDestroyed",
SaidMessage = "eSaidMessage",
ReceivedMessage = "eReceivedMessage",
ReceivedUnfilteredMessage = "eReceivedUnfilteredMessage",
RecievedUnfilteredMessage = "eReceivedUnfilteredMessage", -- legacy mispelling
MessageDoneFiltering = "eMessageDoneFiltering",
ReceivedSystemMessage = "eReceivedSystemMessage",
ChannelJoined = "eChannelJoined",
ChannelLeft = "eChannelLeft",
Muted = "eMuted",
Unmuted = "eUnmuted",
ExtraDataUpdated = "eExtraDataUpdated",
MainChannelSet = "eMainChannelSet",
ChannelNameColorUpdated = "eChannelNameColorUpdated"
}
methods.__index = function (self, k)
local fromMethods = rawget(methods, k)
if fromMethods then return fromMethods end
if lazyEventNames[k] and not rawget(self, k) then
rawset(self, k, Instance.new("BindableEvent"))
end
local lazySignalEventName = lazySignalNames[k]
if lazySignalEventName and not rawget(self, k) then
if not rawget(self, lazySignalEventName) then
rawset(self, lazySignalEventName, Instance.new("BindableEvent"))
end
rawset(self, k, rawget(self, lazySignalEventName).Event)
end
return rawget(self, k)
end
function methods:LazyFire(eventName, ...)
local createdEvent = rawget(self, eventName)
if createdEvent then
createdEvent:Fire(...)
end
end
function methods:SayMessage(message, channelName, extraData)
if self.ChatService:InternalDoProcessCommands(self.Name, message, channelName) then
return
end
if not channelName then
return
end
local channel = self.Channels[channelName:lower()]
if not channel then
return
end
local messageObj = channel:InternalPostMessage(self, message, extraData)
if messageObj then
pcall(function()
self:LazyFire("eSaidMessage", messageObj, channelName)
end)
end
return messageObj
end
function methods:JoinChannel(channelName)
if (self.Channels[channelName:lower()]) then
warn("Speaker is already in channel \"" .. channelName .. "\"")
return
end
local channel = self.ChatService:GetChannel(channelName)
if (not channel) then
error("Channel \"" .. channelName .. "\" does not exist!")
end
self.Channels[channelName:lower()] = channel
channel:InternalAddSpeaker(self)
local success, err = pcall(function()
self.eChannelJoined:Fire(channel.Name, channel:GetWelcomeMessageForSpeaker(self))
end)
if not success and err then
print("Error joining channel: " ..err)
end
end
function methods:LeaveChannel(channelName)
if (not self.Channels[channelName:lower()]) then
warn("Speaker is not in channel \"" .. channelName .. "\"")
return
end
local channel = self.Channels[channelName:lower()]
self.Channels[channelName:lower()] = nil
channel:InternalRemoveSpeaker(self)
local success, err = pcall(function()
self:LazyFire("eChannelLeft", channel.Name)
if self.PlayerObj then
self.EventFolder.OnChannelLeft:FireClient(self.PlayerObj, channel.Name)
end
end)
if not success and err then
print("Error leaving channel: " ..err)
end
end
function methods:IsInChannel(channelName)
return (self.Channels[channelName:lower()] ~= nil)
end
function methods:GetChannelList()
local list = {}
for i, channel in pairs(self.Channels) do
table.insert(list, channel.Name)
end
return list
end
function methods:SendMessage(message, channelName, fromSpeaker, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendMessageToSpeaker(message, self.Name, fromSpeaker, extraData)
elseif RunService:IsStudio() then
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a message in it.", self.Name, channelName))
end
end
function methods:SendSystemMessage(message, channelName, extraData)
local channel = self.Channels[channelName:lower()]
if (channel) then
channel:SendSystemMessageToSpeaker(message, self.Name, extraData)
elseif RunService:IsStudio() then
warn(string.format("Speaker '%s' is not in channel '%s' and cannot receive a system message in it.", self.Name, channelName))
end
end
function methods:GetPlayer()
return self.PlayerObj
end
function methods:GetNameForDisplay()
if ChatSettings.PlayerDisplayNamesEnabled then
local player = self:GetPlayer()
if player then
return player.DisplayName
else
return self.Name
end
else
return self.Name
end
end
function methods:SetExtraData(key, value)
self.ExtraData[key] = value
self:LazyFire("eExtraDataUpdated", key, value)
end
function methods:GetExtraData(key)
return self.ExtraData[key]
end
function methods:SetMainChannel(channelName)
local success, err = pcall(function()
self:LazyFire("eMainChannelSet", channelName)
if self.PlayerObj then
self.EventFolder.OnMainChannelSet:FireClient(self.PlayerObj, channelName)
end
end)
if not success and err then
print("Error setting main channel: " ..err)
end
end
|
--- Setting Fire ---
|
local fire = script.Fire
fire.Parent = pellet
fire.Enabled = true
damage = 15
local DebrisService = game:GetService('Debris')
function TagHumanoid(humanoid, vPlayer)
-- Add more tags here to customize what tags are available.
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = vPlayer
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
end
function FireScript(human)
if human.Parent.Torso:FindFirstChild("FIRE")~= nil then
else
local FireBurn = script.FIRE:Clone()
FireBurn.Parent = human.Parent.Torso
FireBurn.FireDamage.Disabled = false
end
end
function onTouched(hit)
if hit and hit.Parent then
if HitPeople[hit.Parent.Name] then
|
--
|
h = script.Parent.Parent:WaitForChild("Enemy")
pathService = game:GetService("PathfindingService")
targetV = script.Parent:WaitForChild("Target")
function closestTargetAndPath()
local humanoids = {}
if targetNPCs then
local function recurse(o)
for _,obj in pairs(o:GetChildren()) do
if obj:IsA("Model") then
if obj:findFirstChild("Humanoid") and obj:findFirstChild("Torso") and obj.Humanoid ~= h and obj.Humanoid.Health > 0 and not obj:findFirstChild("ForceField") then
table.insert(humanoids,obj.Humanoid)
end
end
recurse(obj)
end
end
recurse(workspace)
else
for _,v in pairs(game.Players:GetPlayers()) do
if v.Character and v.Character:findFirstChild("HumanoidRootPart") and v.Character:findFirstChild("Humanoid") and v.Character.Humanoid.Health > 0 and not v:findFirstChild("ForceField") then
table.insert(humanoids,v.Character.Humanoid)
end
end
end
local closest,path,dist
for _,humanoid in pairs(humanoids) do
local myPath = pathService:ComputeRawPathAsync(h.Torso.Position,humanoid.Torso.Position,500)
if myPath.Status ~= Enum.PathStatus.FailFinishNotEmpty then
-- Now that we have a successful path, we need to figure out how far we need to actually travel to reach this point.
local myDist = 0
local previous = h.Torso.Position
for _,point in pairs(myPath:GetPointCoordinates()) do
myDist = myDist + (point-previous).magnitude
previous = point
end
if not dist or myDist < dist then -- if true, this is the closest path so far.
closest = humanoid
path = myPath
dist = myDist
end
end
end
return closest,path
end
function goToPos(loc)
h:MoveTo(loc)
local distance = (loc-h.Torso.Position).magnitude
local start = tick()
while distance > 4 do
if tick()-start > distance/h.WalkSpeed then -- Something may have gone wrong. Just break.
break
end
distance = (loc-h.Torso.Position).magnitude
wait()
end
end
while wait() do
local target,path = closestTargetAndPath()
local didBreak = false
local targetStart
if target and h.Torso then
targetV.Value = target
targetStart = target.Torso.Position
roaming = false
local previous = h.Torso.Position
local points = path:GetPointCoordinates()
local s = #points > 1 and 2 or 1
for i = s,#points do
local point = points[i]
if didBreak then
break
end
if target and target.Torso and target.Health > 0 then
if (target.Torso.Position-targetStart).magnitude < 1.5 then
local pos = previous:lerp(point,.5)
local moveDir = ((pos - h.Torso.Position).unit * 2)
goToPos(previous:lerp(point,.5))
previous = point
end
else
didBreak = true
break
end
end
else
targetV.Value = nil
end
if not didBreak and targetStart then
goToPos(targetStart)
end
end
|
-- emote bindable hook
|
script:WaitForChild("PlayEmote").OnInvoke = function(emote)
-- Only play emotes when idling
if pose ~= "Standing" then
return
end
if emoteNames[emote] ~= nil then
-- Default emotes
playAnimation(emote, EMOTE_TRANSITION_TIME, Humanoid)
return true, currentAnimTrack
elseif typeof(emote) == "Instance" and emote:IsA("Animation") then
-- Non-default emotes
playEmote(emote, EMOTE_TRANSITION_TIME, Humanoid)
return true, currentAnimTrack
end
-- Return false to indicate that the emote could not be played
return false
end
if Character.Parent ~= nil then
-- initialize to idle
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
|
--[[
Creates an interest point that the monsters can pathfind to at specified position, and with specified weight. If no timeout is supplied, then the interest point exists forever
]]
|
function MonsterManager.createInterest(position, weight, timeout)
local entry = {position = position, weight = weight}
table.insert(interests, entry)
if timeout then
delay(
timeout,
function()
interests = TableUtils.without(interests, entry)
MonsterManager.updateMonsterInterests()
end
)
end
MonsterManager.updateMonsterInterests()
end
|
--Made by Stickmasterluke
|
sp=script.Parent
speed=2
topspeed=50
function waitfor(parent,name)
while parent:FindFirstChild(name)==nil do
wait()
end
return parent:FindFirstChild(name)
end
local canim=waitfor(sp,"coastingpose")
local lanim=waitfor(sp,"leftturn")
local ranim=waitfor(sp,"rightturn")
local handle=waitfor(sp,"Handle")
local wind=waitfor(handle,"Wind")
local mesh=waitfor(handle,"Mesh")
inertia=1-(speed/topspeed)
debris=game:GetService("Debris")
equipped=false
flying=false
controls={forward=0,backward=0,left=0,right=0}
momentum=Vector3.new(0,0,0)
lastmomentum=Vector3.new(0,0,0)
totalmomentum=0
tilt=0
lasttilt=0
currentanim="coast"
lastanim=wind
mesh.Scale=Vector3.new(3,3,3)
handle.Size=Vector3.new(2,1.5,3)
sp.Grip=CFrame.new(0,0,0)
function RemoveFlyStuff()
wind:Stop()
local plr=game.Players.LocalPlayer
if plr then
local chr=plr.Character
if chr then
for i,v in ipairs(chr:getChildren()) do
if v.Name=="Humanoid" then
v.PlatformStand=false
end
if v and v.Name=="EffectCloud" then
v:remove()
end
end
local torso=chr:FindFirstChild("Torso")
if torso~=nil then
for i,v in ipairs(torso:GetChildren()) do
if v and (v.Name=="FlightGyro" or v.Name=="FlightVelocity") then
v:remove()
end
end
end
end
end
handle.Transparency=0
handle.Smoke.Enabled=true
if lastanim~=nil then
lastanim:Stop()
end
end
function fly() --(de)activate fly mode
if not equipped then
flying=false
else
flying=not flying
end
RemoveFlyStuff()
if flying then
local torso=sp.Parent:FindFirstChild("Torso")
local humanoid=sp.Parent:FindFirstChild("Humanoid")
if torso and humanoid and humanoid.Health>0 then
handle.Transparency=1
handle.Smoke.Enabled=false
humanoid.PlatformStand=true
momentum=torso.Velocity+(torso.CFrame.lookVector*10)+Vector3.new(0,3,0)
local gyro=Instance.new("BodyGyro")
gyro.Name="FlightGyro"
gyro.P=10^6
gyro.maxTorque=Vector3.new(gyro.P,gyro.P,gyro.P)
gyro.cframe=torso.CFrame
gyro.Parent=torso
velocity=Instance.new("BodyVelocity")
velocity.Name="FlightVelocity"
velocity.velocity=Vector3.new(0,0,0)
velocity.P=10^4
velocity.maxForce=Vector3.new(1,1,1)*(10^6)
velocity.Parent=torso
local cloud=handle:clone()
cloud.Transparency=0
cloud.CanCollide=false
waitfor(cloud,"Smoke").Enabled=true
cloud.Name="EffectCloud"
local w=Instance.new("Weld")
w.Part0=torso
w.Part1=cloud
w.C0=CFrame.new(1,-4,0)*CFrame.Angles(0,math.pi/2,0)
w.Parent=cloud
cloud.Parent=sp.Parent
if lastanim~=nil then
lastanim:Stop()
end
lastanim=humanoid:LoadAnimation(canim)
lastanimused=0
if lastanim then
lastanim:Play(.5)
end
wind:Play()
while flying and torso and humanoid and humanoid.Health>0 and equipped do
local movement=game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(Vector3.new(controls.left+controls.right,math.abs(controls.forward)*.2,controls.forward+controls.backward))*speed
momentum=(momentum*inertia)+movement
totalmomentum=math.min(momentum.magnitude,topspeed)
local momentumpercent=(totalmomentum/topspeed)
if cloud~=nil then
local m=cloud:FindFirstChild("Mesh")
m.Scale=Vector3.new(4,4,4+(momentumpercent*4))
end
wind.Pitch=(momentumpercent*2)+1
wind.Volume=momentumpercent+.1
local tilt=((momentum*Vector3.new(1,0,1)).unit:Cross(((lastmomentum*Vector3.new(1,0,1)).unit))).y
if tostring(tilt)=="-1.#IND" or tostring(tilt)=="1.#IND" or tilt==math.huge or tilt==-math.huge or tostring(0/0) == tostring(tilt) then
tilt=0
end
local abstilt=math.abs(tilt)
if abstilt>.06 or abstilt<.0001 then
if math.abs(lasttilt)>.0001 then
tilt=lasttilt*.96
else
tilt=0
end
else
tilt=(lasttilt*.9)+(tilt*.1) --weighted average
end
lasttilt=tilt
if tilt>.01 then
if lastanimused~=1 then
lastanim:Stop(.5)
lastanim=humanoid:LoadAnimation(ranim)
lastanim:Play(.5)
lastanimused=1
end
elseif tilt<(-.01) then
if lastanimused~=-1 then
lastanim:Stop(.5)
lastanim=humanoid:LoadAnimation(lanim)
lastanim:Play(.5)
lastanimused=-1
end
elseif lastanimused~=0 then
lastanim:Stop(.5)
lastanim=humanoid:LoadAnimation(canim)
lastanim:Play(.5)
lastanimused=0
end
if totalmomentum<.5 then
momentum=Vector3.new(0,0,0)
totalmomentum=0
gyro.cframe=CFrame.new(Vector3.new(0,0,0),game.Workspace.CurrentCamera.CoordinateFrame.lookVector*Vector3.new(1,0,1))*CFrame.Angles(0,-math.pi/2,0)
else
gyro.cframe=CFrame.new(Vector3.new(0,0,0),momentum)*CFrame.Angles(0,-math.pi/2,0)*CFrame.Angles(tilt*(-20),0,0)
end
velocity.velocity=momentum
lastmomentum=momentum
wait(rate)
end
end
RemoveFlyStuff()
flying=false
end
end
function onEquipped(mouse)
equipped=true
if mouse~=nil then
mouse.Icon="rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
fly()
local torso=sp.Parent:FindFirstChild("Torso")
if torso~=nil then
torso.Velocity=momentum
end
end)
mouse.KeyDown:connect(function(key2)
local key=string.byte(key2)
if key==32 then --Space bar
--[[fly()
local torso=sp.Parent:FindFirstChild("Torso")
if torso~=nil then
torso.Velocity=momentum
end]]
elseif key==string.byte("w") or key==17 then
controls.forward=-1
elseif key==string.byte("a") or key==20 then
controls.left=-1
elseif key==string.byte("s") or key==18 then
controls.backward=1
elseif key==string.byte("d") or key==19 then
controls.right=1
end
end)
mouse.KeyUp:connect(function(key2)
local key=string.byte(key2)
if key==string.byte("w") or key==17 then
controls.forward=0
elseif key==string.byte("a") or key==20 then
controls.left=0
elseif key==string.byte("s") or key==18 then
controls.backward=0
elseif key==string.byte("d") or key==19 then
controls.right=0
end
end)
end
end
function onUnequipped()
equipped=false
end
sp.Equipped:connect(onEquipped)
sp.Unequipped:connect(onUnequipped)
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58},t},
[49]={{53,52,47,48,49},t},
[16]={n,f},
[19]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19},t},
[59]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59},t},
[63]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62,63},t},
[34]={{53,52,47,48,49,45,44,28,29,31,32,34},t},
[21]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21},t},
[48]={{53,52,47,48},t},
[27]={{53,52,47,48,49,45,44,28,27},t},
[14]={n,f},
[31]={{53,52,47,48,49,45,44,28,29,31},t},
[56]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56},t},
[29]={{53,52,47,48,49,45,44,28,29},t},
[13]={n,f},
[47]={{53,52,47},t},
[12]={n,f},
[45]={{53,52,47,48,49,45},t},
[57]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,57},t},
[36]={{53,52,47,48,49,45,44,28,29,31,32,33,36},t},
[25]={{53,52,47,48,49,45,44,28,27,26,25},t},
[71]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71},t},
[20]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20},t},
[60]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,75},t},
[22]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,21,22},t},
[74]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73,74},t},
[62]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{53,52,47,48,49,45,44,28,29,31,32,33,36,37},t},
[2]={n,f},
[35]={{53,52,47,48,49,45,44,28,29,31,32,34,35},t},
[53]={{53},t},
[73]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76,73},t},
[72]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72},t},
[33]={{53,52,47,48,49,45,44,28,29,31,32,33},t},
[69]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,60,69},t},
[65]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,65},t},
[26]={{53,52,47,48,49,45,44,28,27,26},t},
[68]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67,68},t},
[76]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61,71,72,76},t},
[50]={{53,52,50},t},
[66]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66},t},
[10]={n,f},
[24]={{53,52,47,48,49,45,44,28,27,26,25,24},t},
[23]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,23},t},
[44]={{53,52,47,48,49,45,44},t},
[39]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39},t},
[32]={{53,52,47,48,49,45,44,28,29,31,32},t},
[3]={n,f},
[30]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30},t},
[51]={{53,54,55,51},t},
[18]={n,f},
[67]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64,67},t},
[61]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,59,61},t},
[55]={{53,54,55},t},
[46]={{53,52,47,46},t},
[42]={{53,52,47,48,49,45,44,28,29,31,32,34,35,38,42},t},
[40]={{53,52,47,48,49,45,44,28,29,31,32,34,35,40},t},
[52]={{53,52},t},
[54]={{53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41},t},
[17]={n,f},
[38]={{53,52,47,48,49,45,44,28,29,31,32,34,35,38},t},
[28]={{53,52,47,48,49,45,44,28},t},
[5]={n,f},
[64]={{53,52,47,48,49,45,44,28,29,31,32,34,35,39,41,30,56,58,20,19,66,64},t},
}
return r
|
--[=[
@param ... any -- Arguments to pass to the server
Fires the equivalent server-side signal with the given arguments.
:::note Outbound Middleware
All arguments pass through any outbound middleware before being
sent to the server.
:::
]=]
|
function ClientRemoteSignal:Fire(...: any)
if self._hasOutbound then
self._re:FireServer(self:_processOutboundMiddleware(...))
else
self._re:FireServer(...)
end
end
|
--Made by Luckymaxer
|
Figure = script.Parent
RunService = game:GetService("RunService")
Creator = Figure:FindFirstChild("Creator")
Humanoid = Figure:WaitForChild("Humanoid")
Torso = Figure:WaitForChild("Torso")
Healing = Figure:WaitForChild("Healing")
FollowingPath = false
WalkRadius = 25
WalkingPaused = false
OriginallyIgnored = false
Humanoid.Health = Humanoid.MaxHealth
function RayCast(Position, Direction, MaxDistance, IgnoreList)
return game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(Position, Direction.unit * (MaxDistance or 999.999)), IgnoreList)
end
function MoveAround(TargetPoint)
TargetPoint = ((not TargetPoint and (Torso.Position + Vector3.new(math.random(-WalkRadius, WalkRadius), 0, math.random(-WalkRadius, WalkRadius))) or TargetPoint))
Humanoid:MoveTo(TargetPoint)
end
function SecureJump()
if Humanoid.Jump then
return
end
local TargetPoint = Humanoid.TargetPoint
local Blockage, BlockagePos = RayCast((Torso.CFrame + CFrame.new(Torso.Position, Vector3.new(TargetPoint.X, Torso.Position.Y, TargetPoint.Z)).lookVector * (Torso.Size.Z / 2)).p, Torso.CFrame.lookVector, (Torso.Size.Z * 2.5), {Figure, (((Creator and Creator.Value and Creator.Value:IsA("Player") and Creator.Value.Character) and Creator.Value.Character) or nil)})
local Jumpable = false
if Blockage then
Jumpable = true
if Blockage:IsA("Terrain") then
local CellPos = Blockage:WorldToCellPreferSolid((BlockagePos - Vector3.new(0, 2, 0)))
local CellMaterial, CellShape, CellOrientation = Blockage:GetCell(CellPos.X, CellPos.Y, CellPos.Z)
if CellMaterial == Enum.CellMaterial.Water then
Jumpable = false
end
elseif Blockage.Parent:FindFirstChild("Humanoid") then
Jumpable = false
end
end
if Jumpable then
Humanoid.Jump = true
end
end
RunService.Stepped:connect(function()
if WalkingPaused then
return
end
local Wait = false
local IgnoreDistance = false
local CreatorValue = ((Creator and Creator.Value) or nil)
local CreatorCharacter, CreatorTorso, TorsoPosition
local DistanceApart
if CreatorValue and CreatorValue:IsA("Player") and CreatorValue.Character then
CreatorCharacter = CreatorValue.Character
CreatorTorso = CreatorCharacter:FindFirstChild("Torso")
if CreatorTorso then
DistanceApart = (Torso.Position - CreatorTorso.Position).magnitude
TorsoPosition = (CreatorTorso.CFrame + CreatorTorso.CFrame.lookVector * (CreatorTorso.Size.Z * ((not Healing.Value and -0.25) or -1.5)))
if not Healing.Value then
TorsoPosition = (TorsoPosition + (TorsoPosition * CFrame.Angles(0, (math.pi / 2), 0)).lookVector * (Torso.Size.X * 1.5)).p
else
TorsoPosition = TorsoPosition.p
IgnoreDistance = true
OriginallyIgnored = true
end
end
end
if DistanceApart then
if DistanceApart > 6 or IgnoreDistance or OriginallyIgnored then
if not IgnoreDistance then
OriginallyIgnored = false
end
if Humanoid.Sit then
Humanoid.Jump = true
end
local WalkSpeed = (((CreatorTorso and (Torso.Position - CreatorTorso.Position).magnitude >= 20) and 24) or 16)
Humanoid.WalkSpeed = WalkSpeed
MoveAround(TorsoPosition)
end
else
MoveAround(nil)
Wait = true
end
SecureJump()
if Wait then
WalkingPaused = true
local RandomInterval = {Min = 1, Max = 3}
RandomInterval = {Min = (RandomInterval.Min * 100), Max = (RandomInterval.Max * 100)}
local WaitTime = (math.random(RandomInterval.Min, RandomInterval.Max) * 0.01)
wait(WaitTime)
WalkingPaused = false
end
end)
|
-------------------------
|
function onClicked()
Car.BodyVelocity.velocity = Vector3.new(0, -8, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--Input Handler
|
function DealWithInput(input,IsRobloxFunction)
if (UserInputService:GetFocusedTextBox()==nil) and not _InControls then --Ignore when UI Focus
--Shift Down [Manual Transmission]
if _IsOn and (input.KeyCode ==_CTRL["ContlrShiftDown"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftDown"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftDown"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.max(_CGear-1,-1)
--Shift Up [Manual Transmission]
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrShiftUp"] or (_MSteer and input.KeyCode==_CTRL["MouseShiftUp"]) or ((not _MSteer) and input.KeyCode==_CTRL["ShiftUp"])) and (_TMode=="Semi" or (_TMode=="Manual" and (not _ClutchOn))) and input.UserInputState == Enum.UserInputState.Begin then
if _CGear == 0 and (_TMode=="Auto" or not _ClPressing) then _ClutchOn = true end
_CGear = math.min(_CGear+1,#_Tune.Ratios-2)
--Toggle Clutch
elseif _IsOn and (input.KeyCode ==_CTRL["ContlrClutch"] or (_MSteer and input.KeyCode==_CTRL["MouseClutch"]) or ((not _MSteer) and input.KeyCode==_CTRL["Clutch"])) and _TMode=="Manual" then
if input.UserInputState == Enum.UserInputState.Begin then
_ClutchOn = false
_ClPressing = true
elseif input.UserInputState == Enum.UserInputState.End then
_ClutchOn = true
_ClPressing = false
end
--Toggle PBrake
elseif _IsOn and input.KeyCode ==_CTRL["ContlrPBrake"] or (_MSteer and input.KeyCode==_CTRL["MousePBrake"]) or ((not _MSteer) and input.KeyCode==_CTRL["PBrake"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if car.DriveSeat.Velocity.Magnitude>5 then
_PBrake = false
end
end
--Toggle Transmission Mode
elseif (input.KeyCode == _CTRL["ContlrToggleTMode"] or input.KeyCode==_CTRL["ToggleTransMode"]) and input.UserInputState == Enum.UserInputState.Begin then
local n=1
for i,v in pairs(_Tune.TransModes) do
if v==_TMode then n=i break end
end
n=n+1
if n>#_Tune.TransModes then n=1 end
_TMode = _Tune.TransModes[n]
--Throttle
elseif _IsOn and ((not _MSteer) and (input.KeyCode==_CTRL["Throttle"] or input.KeyCode == _CTRL["Throttle2"])) or ((((_CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseThrottle"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseThrottle"]) or input.KeyCode == _CTRL["MouseThrottle"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_ThrotActive = true;
_GThrot = 1
else
_ThrotActive = false;
_GThrot = _Tune.IdleThrottle/100
end
--Brake
elseif ((not _MSteer) and (input.KeyCode==_CTRL["Brake"] or input.KeyCode == _CTRL["Brake2"])) or ((((_CTRL["MouseBrake"]==Enum.UserInputType.MouseButton1 or _CTRL["MouseBrake"]==Enum.UserInputType.MouseButton2) and input.UserInputType == _CTRL["MouseBrake"]) or input.KeyCode == _CTRL["MouseBrake"])and _MSteer) then
if input.UserInputState == Enum.UserInputState.Begin then
_BrakeActive = true;
_GBrake = 1
else
_BrakeActive = false;
_GBrake = 0
end
--Steer Left
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerLeft"] or input.KeyCode == _CTRL["SteerLeft2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
--Steer Right
elseif (not _MSteer) and (input.KeyCode==_CTRL["SteerRight"] or input.KeyCode == _CTRL["SteerRight2"]) then
if input.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
--Toggle Mouse Controls
elseif input.KeyCode ==_CTRL["ToggleMouseDrive"] then
if input.UserInputState == Enum.UserInputState.End then
_MSteer = not _MSteer
_GThrot = _Tune.IdleThrottle/100
_GBrake = 0
_GSteerT = 0
_ClutchOn = true
end
--Toggle TCS
elseif _Tune.TCSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleTCS"] or input.KeyCode == _CTRL["ContlrToggleTCS"] then
if input.UserInputState == Enum.UserInputState.End then
_TCS = not _TCS
end
--Toggle ABS
elseif _Tune. ABSEnabled and _IsOn and input.KeyCode == _CTRL["ToggleABS"] or input.KeyCode == _CTRL["ContlrToggleABS"] then
if input.UserInputState == Enum.UserInputState.End then
_ABS = not _ABS
end
end
--Variable Controls
if input.UserInputType.Name:find("Gamepad") then
--Gamepad Steering
if input.KeyCode == _CTRL["ContlrSteer"] then
if input.Position.X>= 0 then
local cDZone = math.min(.99,_Tune.Peripherals.ControlRDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X-cDZone)/(1-cDZone)
else
_GSteerT = 0
end
else
local cDZone = math.min(.99,_Tune.Peripherals.ControlLDZone/100)
if math.abs(input.Position.X)>cDZone then
_GSteerT = (input.Position.X+cDZone)/(1-cDZone)
else
_GSteerT = 0
end
end
--Gamepad Throttle
elseif _IsOn and input.KeyCode == _CTRL["ContlrThrottle"] then
_GThrot = math.max(_Tune.IdleThrottle/100,input.Position.Z)
--Gamepad Brake
elseif input.KeyCode == _CTRL["ContlrBrake"] then
_GBrake = input.Position.Z
end
end
else
_GThrot = _Tune.IdleThrottle/100
_GSteerT = 0
_GBrake = 0
if _CGear~=0 then _ClutchOn = true end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)
UserInputService.InputEnded:connect(DealWithInput)
|
--// Recoil Settings
|
gunrecoil = -0.5; -- How much the gun recoils backwards when not aiming
camrecoil = 0.26; -- How much the camera flicks when not aiming
AimGunRecoil = -0.1; -- How much the gun recoils backwards when aiming
AimCamRecoil = 0.13; -- How much the camera flicks when aiming
CamShake = 0.5; -- THIS IS NEW!!!! CONTROLS CAMERA SHAKE WHEN FIRING
AimCamShake = 0.5; -- THIS IS ALSO NEW!!!!
Kickback = 1.5; -- Upward gun rotation when not aiming
AimKickback = 0.2; -- Upward gun rotation when aiming
|
--
|
function Raycast.FindPartOnRayWithCallbackWithIgnoreList(ray, list, terrainCellsAreCubes, ignoreWater, loopout, callbackFunc)
local maxDistance = ray.Direction.Magnitude
local direction = ray.Direction.Unit
loopout = loopout or 25
local loopCount = 0
local lastPosition = ray.Origin
local distance = 0
local hit, position, normal, material
repeat
local r = Ray.new(lastPosition, direction * (maxDistance - distance))
hit, position, normal, material = WORKSPACE:FindPartOnRayWithIgnoreList(ray, list, terrainCellsAreCubes, ignoreWater, true)
local result = callbackFunc(hit, position, normal, material)
if (result == CALLBACKRESULT.Continue) then
distance = (ray.Origin - position).Magnitude
lastPosition = position
elseif (result == CALLBACKRESULT.Finished) then
return hit, position, normal, material
elseif (result == CALLBACKRESULT.Fail or result == nil) then
break
end
loopCount = loopCount + 1
until (loopCount > loopout or distance >= maxDistance - 0.1)
return
end
function Raycast.FindPartOnRayWithCallbackWithWhiteList(ray, list, terrainCellsAreCubes, ignoreWater, loopout, callbackFunc)
local maxDistance = ray.Direction.Magnitude
local direction = ray.Direction.Unit
loopout = loopout or 25
local loopCount = 0
local lastPosition = ray.Origin
local distance = 0
local hit, position, normal, material
repeat
local r = Ray.new(lastPosition, direction * (maxDistance - distance))
hit, position, normal, material = WORKSPACE:FindPartOnRayWithWhitelist(ray, list, terrainCellsAreCubes, ignoreWater, true)
if hit then
--print(hit:GetFullName())
end
local result = callbackFunc(hit, position, normal, material)
if (result == CALLBACKRESULT.Continue) then
distance = (ray.Origin - position).Magnitude
lastPosition = position
elseif (result == CALLBACKRESULT.Finished) then
return hit, position, normal, material
elseif (result == CALLBACKRESULT.Fail or result == nil) then
break
end
loopCount = loopCount + 1
until (loopCount > loopout or distance >= maxDistance - 0.1)
return
end
function Raycast.FindPartOnRayWithCallback(ray, ignore, terrainCellsAreCubes, ignoreWater, callbackFunc)
return Raycast.FindPartOnRayWithCallbackWithIgnoreList(ray, {ignore}, terrainCellsAreCubes, ignoreWater, callbackFunc)
end
|
-- Enemy spawn system
|
for _,area in pairs(workspace.Areas:GetChildren()) do
local function RefillEnemies()
local function SpawnEnemy(spawnRegion)
local enemyToSpawn = spawnRegion.EnemiesToSpawnHere:GetChildren()[math.random(1,#spawnRegion.EnemiesToSpawnHere:GetChildren())].Name
local xVectorRandom = spawnRegion.CFrame.RightVector * spawnRegion.Size.X * (math.random(-50, 50) / 100)
local yVectorRandom = spawnRegion.CFrame.UpVector * spawnRegion.Size.Y * (math.random(-50, 50) / 100)
local zVectorRandom = spawnRegion.CFrame.LookVector * spawnRegion.Size.Z * (math.random(-50, 50) / 100)
local spawnPosition = spawnRegion.Position + xVectorRandom + yVectorRandom + zVectorRandom
require(enemyFunctions).SpawnEnemy(enemyToSpawn, spawnPosition, area.Enemies)
end
local enemyCounts = {}
for _,enemy in pairs(area.Enemies:GetChildren()) do
if not enemyCounts[enemy.Name] then
enemyCounts[enemy.Name] = 1
else
enemyCounts[enemy.Name] = enemyCounts[enemy.Name] + 1
end
end
for _,spawnRegion in pairs(area.SpawnRegions:GetChildren()) do
local enemiesInRegion = 0
for _,enemyToSpawn in pairs(spawnRegion.EnemiesToSpawnHere:GetChildren()) do
if enemyCounts[enemyToSpawn.Name] then
enemiesInRegion = enemiesInRegion + enemyCounts[enemyToSpawn.Name]
end
end
for i = 1, spawnRegion.MaximumEnemies.Value - enemiesInRegion do
SpawnEnemy(spawnRegion)
end
end
end
if area:FindFirstChild("Enemies") and area:FindFirstChild("SpawnRegions") then
RefillEnemies()
area.Enemies.ChildRemoved:Connect(RefillEnemies)
end
end
|
--LockController
|
Closed = true
function LockItems()
Timer.EnclosureDoor.Buttons.Locked.Value = script.Locked.Value
if script.Locked.Value == true then
Timer.EnclosureDoor.Locked.Value = script.Locked.Value
Timer.EnclosureDoor.Interactive.ProximityPromptService.MaxActivationDistance = 0
else
Timer.EnclosureDoor.Interactive.ProximityPromptService.MaxActivationDistance = 8
end
end
script.Parent.Touched:connect(function(P)
if P ~= nil and P.Parent ~= nil and P.Parent:FindFirstChild("CardNumber") ~= nil and P.Parent.CardNumber.Value == 0 then
if Closed == true then
Closed = 1
script.Locked.Value = false
LockItems()
script.Parent.Open.Value = true
wait(1)
Closed = false
return
end
if Closed == false and Timer.EnclosureDoor.DoorOpen.Value == false then
Closed = 1
script.Locked.Value = true
LockItems()
script.Parent.Open.Value = false
wait(1)
Closed = true
return
end
end
end)
|
--// Connections
|
L_105_.OnClientEvent:connect(function(L_188_arg1, L_189_arg2, L_190_arg3, L_191_arg4, L_192_arg5, L_193_arg6, L_194_arg7)
if L_188_arg1 and not L_15_ then
MakeFakeArms()
L_42_ = L_2_.PlayerGui.MainGui
L_26_ = L_42_:WaitForChild('Others')
L_27_ = L_26_:WaitForChild('Kill')
L_28_ = L_42_:WaitForChild('GameGui'):WaitForChild('AmmoFrame')
L_29_ = L_28_:WaitForChild('Ammo')
L_30_ = L_28_:WaitForChild('AmmoBackground')
L_31_ = L_28_:WaitForChild('MagCount')
L_32_ = L_28_:WaitForChild('MagCountBackground')
L_33_ = L_28_:WaitForChild('DistDisp')
L_34_ = L_28_:WaitForChild('Title')
L_35_ = L_28_:WaitForChild('Mode1')
L_36_ = L_28_:WaitForChild('Mode2')
L_37_ = L_28_:WaitForChild('Mode3')
L_38_ = L_28_:WaitForChild('Mode4')
L_39_ = L_28_:WaitForChild('Mode5')
L_40_ = L_28_:WaitForChild('Stances')
L_41_ = L_42_:WaitForChild('Shading')
L_41_.Visible = false
L_34_.Text = L_1_.Name
UpdateAmmo()
L_43_ = L_189_arg2
L_44_ = L_190_arg3
L_45_ = L_191_arg4
L_46_ = L_192_arg5
L_47_ = L_193_arg6
L_48_ = L_194_arg7
L_49_ = L_59_.Bolt
L_84_ = L_48_.C1
L_85_ = L_48_.C0
if L_1_:FindFirstChild('AimPart2') then
L_54_ = L_1_:WaitForChild('AimPart2')
end
if L_1_:FindFirstChild('FirePart2') then
L_57_ = L_1_.FirePart2
end
if L_24_.FirstPersonOnly then
L_2_.CameraMode = Enum.CameraMode.LockFirstPerson
end
--uis.MouseIconEnabled = false
L_5_.FieldOfView = 70
L_15_ = true
elseif L_15_ then
if L_3_ and L_3_.Humanoid and L_3_.Humanoid.Health > 0 and L_9_ then
Stand()
Unlean()
end
L_90_ = 0
L_77_ = false
L_78_ = false
L_79_ = false
L_61_ = false
L_64_ = false
L_63_ = false
Shooting = false
L_94_ = 70
RemoveArmModel()
L_42_:Destroy()
for L_195_forvar1, L_196_forvar2 in pairs(IgnoreList) do
if L_196_forvar2 ~= L_3_ and L_196_forvar2 ~= L_5_ and L_196_forvar2 ~= L_98_ then
table.remove(IgnoreList, L_195_forvar1)
end
end
if L_3_:FindFirstChild('Right Arm') and L_3_:FindFirstChild('Left Arm') then
L_3_['Right Arm'].LocalTransparencyModifier = 0
L_3_['Left Arm'].LocalTransparencyModifier = 0
end
L_75_ = false
L_66_ = true
L_2_.CameraMode = Enum.CameraMode.Classic
L_104_.MouseIconEnabled = true
L_5_.FieldOfView = 70
L_15_ = false
L_104_.MouseDeltaSensitivity = L_52_
L_4_.Icon = "http://www.roblox.com/asset?id=0"
L_15_ = false
end
end)
|
--Light off
|
src.Parent.right.Value.Value = 0
light.Value = false
else
src.Parent.right.Value.Value = 1
light.Value = true
return
end
end
end)
src.Parent.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
src:Stop()
script.Parent:Destroy()
end
end)
|
------------------------------------------------------------------------------------------------------------
|
function configureAnimationSetOld(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
local allowCustomAnimations = true
local AllowDisableCustomAnimsUserFlag = false
local success, msg = pcall(function()
AllowDisableCustomAnimsUserFlag = UserSettings():IsUserFeatureEnabled("UserAllowDisableCustomAnims2")
end)
if (AllowDisableCustomAnimsUserFlag) then
local success, msg = pcall(function() allowCustomAnimations = game:GetService("StarterPlayer").AllowCustomAnimations end)
if not success then
allowCustomAnimations = true
end
end
-- check for config values
local config = script:FindFirstChild(name)
if (allowCustomAnimations and config ~= nil) then
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
end
end
-- preload anims
if PreloadAnimsUserFlag then
for i, animType in pairs(animTable) do
for idx = 1, animType.count, 1 do
Humanoid:LoadAnimation(animType[idx].anim)
end
end
end
end
|
--[[
Alternative to game.Debris:AddItem() which runs on heartbeat (and runs better, for that matter)
60hz accurate
also supports array of objects in 1st arg
--]]
|
function Step()
--- scan garbage for items that are expired and clean them up
for i = #garbage, 1, -1 do
local v = garbage[i]
local obj = v[1]
local t = v[2]
local removetime = v[3]
local tp = (tick() - t)
if tp >= removetime then
if type(obj) == "table" then
for _, objchild in ipairs(obj) do
objchild:Destroy()
end
else
obj:Destroy()
end
table.remove(garbage, i)
end
end
end
coroutine.wrap(function() --- main loop
while _L.Services.RunService.Heartbeat:Wait() do
Step()
end
end)()
return function(obj, t)
if not t then
t = 10
end
--- add to garbage
table.insert(garbage, {obj, tick(), t})
end
|
-----------------------------------------------------------------------------------------------
|
script.Parent:WaitForChild("Speedo")
script.Parent:WaitForChild("Tach")
script.Parent:WaitForChild("ln")
script.Parent:WaitForChild("Gear")
script.Parent:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Parent.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["JestEach"]["JestEach"])
return Package
|
--[[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 = 4000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2.5 -- Suspension length (in studs)
Tune.FPreCompress = .5 -- Pre-compression adds resting length force
Tune.FExtensionLim = .5 -- Max Extension Travel (in studs)
Tune.FCompressLim = 2 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 8 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.5 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 300 -- Spring Dampening
Tune.RSusStiffness = 4000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2.5 -- Suspension length (in studs)
Tune.RPreCompress = .5 -- Pre-compression adds resting length force
Tune.RExtensionLim = .5 -- Max Extension Travel (in studs)
Tune.RCompressLim = 2 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 8 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.5 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Bright red" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Version 1.43 Made my PistonsofDoom--
|
local carSeat=script.Parent.Parent.Parent.Parent
local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115}
while true do
wait(0.01)
local value=(carSeat.Velocity.magnitude)/1.7 --This is the velocity so if it was 1.6 it should work. If not PM me! or comment!--
if value<10000 then
local nnnn=math.floor(value/1000)
local nnn=(math.floor(value/100))-(nnnn*10)
local nn=(math.floor(value/10)-(nnn*10))-(nnnn*100)
local n=(math.floor(value)-(nn*10)-(nnn*100))-(nnnn*1000)
script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1]
if value>=10 then
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1]
else
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
if value>=100 then
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1]
else
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
else
script.Parent.A.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.B.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.C.Image="http://www.roblox.com/asset/?id="..numbers[10]
end
end
|
-- don't set to attack
|
else
stance = "attack"
target = v.Parent
|
-- Designate a friendly name to each material
|
local Materials = {
[Enum.Material.SmoothPlastic] = 'Smooth Plastic';
[Enum.Material.Plastic] = 'Plastic';
[Enum.Material.Brick] = 'Brick';
[Enum.Material.Cobblestone] = 'Cobblestone';
[Enum.Material.Concrete] = 'Concrete';
[Enum.Material.CorrodedMetal] = 'Corroded Metal';
[Enum.Material.DiamondPlate] = 'Diamond Plate';
[Enum.Material.Fabric] = 'Fabric';
[Enum.Material.Foil] = 'Foil';
[Enum.Material.ForceField] = 'Forcefield';
[Enum.Material.Granite] = 'Granite';
[Enum.Material.Grass] = 'Grass';
[Enum.Material.Ice] = 'Ice';
[Enum.Material.Marble] = 'Marble';
[Enum.Material.Metal] = 'Metal';
[Enum.Material.Neon] = 'Neon';
[Enum.Material.Pebble] = 'Pebble';
[Enum.Material.Sand] = 'Sand';
[Enum.Material.Slate] = 'Slate';
[Enum.Material.Wood] = 'Wood';
[Enum.Material.WoodPlanks] = 'Wood Planks';
[Enum.Material.Glass] = 'Glass';
};
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if UI then
-- Reveal the UI
UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
UI = Core.Tool.Interfaces.BTMaterialToolGUI:Clone();
UI.Parent = Core.UI;
UI.Visible = true;
-- References to inputs
local TransparencyInput = UI.TransparencyOption.Input.TextBox;
local ReflectanceInput = UI.ReflectanceOption.Input.TextBox;
-- Sort the material list
local MaterialList = Support.Values(Materials);
table.sort(MaterialList);
-- Create the material selection dropdown
MaterialDropdown = Core.Cheer(UI.MaterialOption.Dropdown).Start(MaterialList, '', function (Material)
SetProperty('Material', Support.FindTableOccurrence(Materials, Material));
end);
-- Enable the transparency and reflectance inputs
SyncInputToProperty('Transparency', TransparencyInput);
SyncInputToProperty('Reflectance', ReflectanceInput);
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not UI then
return;
end;
-- Hide the UI
UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function SyncInputToProperty(Property, Input)
-- Enables `Input` to change the given property
-- Enable inputs
Input.FocusLost:Connect(function ()
SetProperty(Property, tonumber(Input.Text));
end);
end;
function SetProperty(Property, Value)
-- Make sure the given value is valid
if Value == nil then
return;
end;
-- Start a history record
TrackChange();
-- Go through each part
for _, Part in pairs(Selection.Parts) do
-- Store the state of the part before modification
table.insert(HistoryRecord.Before, { Part = Part, [Property] = Part[Property] });
-- Create the change request for this part
table.insert(HistoryRecord.After, { Part = Part, [Property] = Value });
end;
-- Register the changes
RegisterChange();
end;
function UpdateDataInputs(Data)
-- Updates the data in the given TextBoxes when the user isn't typing in them
-- Go through the inputs and data
for Input, UpdatedValue in pairs(Data) do
-- Makwe sure the user isn't typing into the input
if not Input:IsFocused() then
-- Set the input's value
Input.Text = tostring(UpdatedValue);
end;
end;
end;
|
--Traction Control Settings
|
Tune.TCSEnabled = false -- Implements TCS
Tune.TCSThreshold = 20 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 20 -- Minimum amount of torque at max reduction (in percent)
|
--[[--------------------------------------------------------------------
-- Notes:
-- * one function manipulate a pointer argument with a simple data type
-- (can't be emulated by a table, ambiguous), now returns that value:
-- luaK:concat(fs, l1, l2)
-- * luaM_growvector uses the faux luaY:growvector, for limit checking
-- * some function parameters changed to boolean, additional code
-- translates boolean back to 1/0 for instruction fields
--
-- Not implemented:
-- * NOTE there is a failed assert in luaK:addk, a porting problem
--
-- Added:
-- * constant MAXSTACK from llimits.h
-- * luaK:ttisnumber(o) (from lobject.h)
-- * luaK:nvalue(o) (from lobject.h)
-- * luaK:setnilvalue(o) (from lobject.h)
-- * luaK:setnvalue(o, x) (from lobject.h)
-- * luaK:setbvalue(o, x) (from lobject.h)
-- * luaK:sethvalue(o, x) (from lobject.h), parameter L deleted
-- * luaK:setsvalue(o, x) (from lobject.h), parameter L deleted
-- * luaK:numadd, luaK:numsub, luaK:nummul, luaK:numdiv, luaK:nummod,
-- luaK:numpow, luaK:numunm, luaK:numisnan (from luaconf.h)
-- * copyexp(e1, e2) added in luaK:posfix to copy expdesc struct
--
-- Changed in 5.1.x:
-- * enum BinOpr has a new entry, OPR_MOD
-- * enum UnOpr has a new entry, OPR_LEN
-- * binopistest, unused in 5.0.x, has been deleted
-- * macro setmultret is new
-- * functions isnumeral, luaK_ret, boolK are new
-- * funcion nilK was named nil_constant in 5.0.x
-- * function interface changed: need_value, patchtestreg, concat
-- * TObject now a TValue
-- * functions luaK_setreturns, luaK_setoneret are new
-- * function luaK:setcallreturns deleted, to be replaced by:
-- luaK:setmultret, luaK:ret, luaK:setreturns, luaK:setoneret
-- * functions constfolding, codearith, codecomp are new
-- * luaK:codebinop has been deleted
-- * function luaK_setlist is new
-- * OPR_MULT renamed to OPR_MUL
----------------------------------------------------------------------]]
| |
--// Settings //--
|
script.Parent.Triggered:Connect(function(plr)
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + amount
end)
|
--Load the Nexus VR Character Model module.
|
local NexusVRCharacterModelModule
local MainModule = script:FindFirstChild("MainModule")
if MainModule then
NexusVRCharacterModelModule = require(MainModule)
else
NexusVRCharacterModelModule = require(10728814921)
end
|
-- Demo dynamic settings
|
local Gui = Instance.new("ScreenGui")
local CountLabel = Instance.new("TextLabel")
CountLabel.Text = string.format("Leaf Count: %d Active, %d Inactive, 77760 Total",0,0)
CountLabel.BackgroundTransparency = 0.3
CountLabel.BackgroundColor3 = Color3.new()
CountLabel.TextStrokeTransparency = 0.8
CountLabel.Size = UDim2.new(0.6,0,0,27)
CountLabel.Position = UDim2.new(0.2,0,1,-35)
CountLabel.Font = Enum.Font.RobotoMono
CountLabel.TextSize = 25
CountLabel.TextColor3 = Color3.new(1,1,1)
CountLabel.Parent = Gui
local SpeedInput = Instance.new("TextBox")
SpeedInput.Text = string.format("Wind Speed: %.1f",WIND_SPEED)
SpeedInput.PlaceholderText = "Input Speed"
SpeedInput.BackgroundTransparency = 0.8
SpeedInput.TextStrokeTransparency = 0.8
SpeedInput.Size = UDim2.new(0.2,0,0,20)
SpeedInput.Position = UDim2.new(0,5,0.45,0)
SpeedInput.Font = Enum.Font.RobotoMono
SpeedInput.TextXAlignment = Enum.TextXAlignment.Left
SpeedInput.TextSize = 18
SpeedInput.TextColor3 = Color3.new(1,1,1)
SpeedInput.FocusLost:Connect(function()
local newSpeed = tonumber(SpeedInput.Text:match("[%d%.]+"))
if newSpeed then
WIND_SPEED = math.clamp(newSpeed,0,50)
WindLines.Speed = WIND_SPEED
WindShake:UpdateAllObjectSettings({Speed = WIND_SPEED})
WindShake:SetDefaultSettings({Speed = WIND_SPEED})
end
SpeedInput.Text = string.format("Wind Speed: %.1f",WIND_SPEED)
end)
SpeedInput.Parent = Gui
local PowerInput = Instance.new("TextBox")
PowerInput.Text = string.format("Wind Power: %.1f",WIND_POWER)
PowerInput.PlaceholderText = "Input Power"
PowerInput.BackgroundTransparency = 0.8
PowerInput.TextStrokeTransparency = 0.8
PowerInput.Size = UDim2.new(0.2,0,0,20)
PowerInput.Position = UDim2.new(0,5,0.45,25)
PowerInput.Font = Enum.Font.RobotoMono
PowerInput.TextXAlignment = Enum.TextXAlignment.Left
PowerInput.TextSize = 18
PowerInput.TextColor3 = Color3.new(1,1,1)
PowerInput.FocusLost:Connect(function()
local newPower = tonumber(PowerInput.Text:match("[%d%.]+"))
if newPower then
WIND_POWER = math.clamp(newPower,0,3)
WindShake:UpdateAllObjectSettings({Power = WIND_POWER})
WindShake:SetDefaultSettings({Power = WIND_POWER})
end
PowerInput.Text = string.format("Wind Power: %.1f",WIND_POWER)
end)
PowerInput.Parent = Gui
local DirInput = Instance.new("TextBox")
DirInput.Text = string.format("Wind Direction: %.1f,%.1f,%.1f",WIND_DIRECTION.X,WIND_DIRECTION.Y,WIND_DIRECTION.Z)
DirInput.PlaceholderText = "Input Direction"
DirInput.BackgroundTransparency = 0.8
DirInput.TextStrokeTransparency = 0.8
DirInput.Size = UDim2.new(0.2,0,0,20)
DirInput.Position = UDim2.new(0,5,0.45,50)
DirInput.Font = Enum.Font.RobotoMono
DirInput.TextXAlignment = Enum.TextXAlignment.Left
DirInput.TextSize = 18
DirInput.TextColor3 = Color3.new(1,1,1)
DirInput.FocusLost:Connect(function()
local Inputs = table.create(3)
for Num in string.gmatch(DirInput.Text, "%-?[%d%.]+") do
Inputs[#Inputs+1] = tonumber(Num)
end
local newDir = Vector3.new(
Inputs[1] or WIND_DIRECTION.X,
Inputs[2] or WIND_DIRECTION.Y,
Inputs[3] or WIND_DIRECTION.Z
).Unit
if newDir then
WIND_DIRECTION = newDir
WindLines.Direction = newDir
WindShake:UpdateAllObjectSettings({Direction = newDir})
WindShake:SetDefaultSettings({Direction = newDir})
end
DirInput.Text = string.format("Wind Direction: %.1f, %.1f, %.1f",WIND_DIRECTION.X,WIND_DIRECTION.Y,WIND_DIRECTION.Z)
end)
DirInput.Parent = Gui
spawn(function()
while wait(0.1) do
local Active,Handled = WindShake.Active,WindShake.Handled
CountLabel.Text = string.format("Leaf Count: %d Active, %d Inactive, %d Not Streamed In (77760 Total)",Active,Handled-Active,77760-Handled)
end
end)
|
-- Roact
|
local new = Roact.createElement
local ToolManualWindow = require(UI:WaitForChild('ToolManualWindow'))
local MANUAL_CONTENT = [[<font face="GothamBlack" size="16">Building Tools by F3X 🛠</font>
To learn more about each tool, click on its ❔ icon at the top right corner.<font size="12"><br /></font>
<font size="12" color="rgb(150, 150, 150)"><b>Selecting</b></font>
<font color="rgb(150, 150, 150)">•</font> Select individual parts by holding <b>Shift</b> and clicking each one.
<font color="rgb(150, 150, 150)">•</font> Rectangle select parts by holding <b>Shift</b>, clicking, and dragging.
<font color="rgb(150, 150, 150)">•</font> Press <b>Shift-K</b> to select parts inside of the selected parts.
<font color="rgb(150, 150, 150)">•</font> Press <b>Shift-R</b> to clear your selection.<font size="12"><br /></font>
<font size="12" color="rgb(150, 150, 150)"><b>Exporting your creations</b></font>
You can export your builds into a short code by clicking the export button, or pressing <b>Shift-P</b>.<font size="8"><br /></font>
Install the import plugin in <b>Roblox Studio</b> to import your creation:
<font color="rgb(150, 150, 150)">roblox.com/library/142485815</font>]]
|
-- Load all services within 'Controllers':
|
Knit.AddControllersDeep(script.Parent.Controllers)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.