prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- создание клона |
local target = targets.Zombie:Clone() |
-- PRIVATE FUNCTIONS |
function ZoneController._registerZone(zone)
registeredZones[zone] = true
local registeredMaid = zone._maid:give(Maid.new())
zone._registeredMaid = registeredMaid
registeredMaid:give(zone.updated:Connect(function()
ZoneController._updateZoneDetails()
end))
ZoneController._updateZoneDetails()
end
function ZoneController._deregisterZone(zone)
registeredZones[zone] = nil
zone._registeredMaid:clean()
zone._registeredMaid = nil
ZoneController._updateZoneDetails()
end
function ZoneController._registerConnection(registeredZone, registeredTriggerType)
local originalItems = dictLength(registeredZone.activeTriggers)
activeConnections += 1
if originalItems == 0 then
activeZones[registeredZone] = true
ZoneController._updateZoneDetails()
end
local currentTriggerCount = activeTriggers[registeredTriggerType]
activeTriggers[registeredTriggerType] = (currentTriggerCount and currentTriggerCount+1) or 1
registeredZone.activeTriggers[registeredTriggerType] = true
if registeredZone.touchedConnectionActions[registeredTriggerType] then
registeredZone:_formTouchedConnection(registeredTriggerType)
end
if heartbeatActions[registeredTriggerType] then
ZoneController._formHeartbeat(registeredTriggerType)
end
end
|
--[[
Create a ClientAvatarComponent for the given model
]] |
function ClientAvatarComponent.new(model, userId)
local component = {
model = model
}
setmetatable(component, {__index = ClientAvatarComponent})
local avatar = model:FindFirstChild(ReplicatedConstants.AVATAR_MODEL_NAME)
component.avatar = avatar
component:setupJoints()
return component
end
|
--activate |
script.Parent.Activated:Connect(function()
end)
|
-- same as jump for now |
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = (3.14)
LeftShoulder.DesiredAngle = (-3.14)
RightHip.DesiredAngle = (0)
LeftHip.DesiredAngle = (0)
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = (3.14 /2)
LeftShoulder.DesiredAngle = (-3.14 /2)
RightHip.DesiredAngle = (3.14 /2)
LeftHip.DesiredAngle = (-3.14 /2)
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = (1.57)
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = (0)
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = (1.57)
LeftShoulder.DesiredAngle = (1.0)
RightHip.DesiredAngle = (1.57)
LeftHip.DesiredAngle = (1.0)
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = (desiredAngle + climbFudge)
LeftShoulder.DesiredAngle = (desiredAngle - climbFudge)
RightHip.DesiredAngle = (-desiredAngle)
LeftHip.DesiredAngle = (-desiredAngle)
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
--Institutional white
--Electric blue |
function SetDigit(Value)
if Value == "0" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really black")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really red")
SP.D7.BrickColor = BrickColor.new("Really red")
return
end
if Value == "1" then
SP.D1.BrickColor = BrickColor.new("Electric blue")
SP.D2.BrickColor = BrickColor.new("Electric blue")
SP.D3.BrickColor = BrickColor.new("Electric blue")
SP.D4.BrickColor = BrickColor.new("Electric blue")
SP.D5.BrickColor = BrickColor.new("Institutional white")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "2" then
SP.D1.BrickColor = BrickColor.new("Institutional white")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Institutional white")
SP.D4.BrickColor = BrickColor.new("Electric blue")
SP.D5.BrickColor = BrickColor.new("Institutional white")
SP.D6.BrickColor = BrickColor.new("Institutional white")
SP.D7.BrickColor = BrickColor.new("Electric blue")
return
end
if Value == "3" then
SP.D1.BrickColor = BrickColor.new("Institutional white")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Institutional white")
SP.D4.BrickColor = BrickColor.new("Electric blue")
SP.D5.BrickColor = BrickColor.new("Institutional white")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "4" then
SP.D1.BrickColor = BrickColor.new("Electric blue")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Electric blue")
SP.D4.BrickColor = BrickColor.new("Institutional white")
SP.D5.BrickColor = BrickColor.new("Institutional white")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "5" then
SP.D1.BrickColor = BrickColor.new("Institutional white")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Institutional white")
SP.D4.BrickColor = BrickColor.new("Institutional white")
SP.D5.BrickColor = BrickColor.new("Electric blue")
SP.D6.BrickColor = BrickColor.new("Electric blue")
SP.D7.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "6" then
SP.D1.BrickColor = BrickColor.new("Institutional white")
SP.D2.BrickColor = BrickColor.new("Institutional white")
SP.D3.BrickColor = BrickColor.new("Institutional white")
SP.D4.BrickColor = BrickColor.new("Institutional white")
SP.D5.BrickColor = BrickColor.new("Electric blue")
SP.D6.BrickColor = BrickColor.new("Institutional white")
SP.D7.BrickColor = BrickColor.new("Institutional white")
return
end
if Value == "7" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really black")
SP.D3.BrickColor = BrickColor.new("Really black")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really red")
return
end
if Value == "8" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really red")
SP.D7.BrickColor = BrickColor.new("Really red")
return
end
if Value == "9" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really red")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really red")
return
end
if Value == "L" then
SP.D1.BrickColor = BrickColor.new("Really black")
SP.D2.BrickColor = BrickColor.new("Really black")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really black")
SP.D6.BrickColor = BrickColor.new("Really red")
SP.D7.BrickColor = BrickColor.new("Really black")
return
end
if Value == "E" then
SP.D1.BrickColor = BrickColor.new("Really red")
SP.D2.BrickColor = BrickColor.new("Really red")
SP.D3.BrickColor = BrickColor.new("Really red")
SP.D4.BrickColor = BrickColor.new("Really red")
SP.D5.BrickColor = BrickColor.new("Really black")
SP.D6.BrickColor = BrickColor.new("Really red")
SP.D7.BrickColor = BrickColor.new("Really black")
return
end
if Value == "" then
SP.D1.BrickColor = BrickColor.new("Really black")
SP.D2.BrickColor = BrickColor.new("Really black")
SP.D3.BrickColor = BrickColor.new("Really black")
SP.D4.BrickColor = BrickColor.new("Really black")
SP.D5.BrickColor = BrickColor.new("Really black")
SP.D6.BrickColor = BrickColor.new("Really black")
SP.D7.BrickColor = BrickColor.new("Really black")
return
end
end
SP.Value.Changed:connect(function() SetDigit(SP.Value.Value) end)
|
-- Number of lines used to draw axis circles |
ArcHandles.CircleSlices = 60
function ArcHandles.new(Options)
local self = setmetatable({}, ArcHandles)
-- Create maid for cleanup on destroyal
self.Maid = Maid.new()
-- Create UI container
local Gui = Instance.new('ScreenGui')
self.Gui = Gui
Gui.Name = 'BTArcHandles'
Gui.IgnoreGuiInset = true
self.Maid.Gui = Gui
-- Create interface
self.IsMouseAvailable = UserInputService.MouseEnabled
self:CreateCircles()
self:CreateHandles(Options)
-- Get camera and viewport information
self.Camera = Workspace.CurrentCamera
self.GuiInset = GuiService:GetGuiInset()
-- Get list of ignorable handle obstacles
self.ObstacleBlacklistIndex = Support.FlipTable(Options.ObstacleBlacklist or {})
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
-- Enable handles
self:SetAdornee(Options.Adornee)
self.Gui.Parent = Options.Parent
-- Return new handles
return self
end
function ArcHandles:CreateCircles()
-- Create folder to contain circles
local CircleFolder = Instance.new('Folder')
CircleFolder.Name = 'AxisCircles'
CircleFolder.Parent = self.Gui
local Circles = {}
self.AxisCircles = Circles
-- Determine angle for each circle slice
local CircleSliceAngle = 2 * math.pi / self.CircleSlices
-- Set up each axis
for _, Axis in ipairs(Enum.Axis:GetEnumItems()) do
local AxisColor = self.AxisColors[Axis.Name]
-- Create container for circle
local Circle = Instance.new('Folder', CircleFolder)
Circle.Name = Axis.Name
local Lines = {}
Circles[Axis.Name] = Lines
-- Create lines for circle
for i = 1, self.CircleSlices do
local Line = Instance.new 'CylinderHandleAdornment'
Line.Transparency = 0.4
Line.Color3 = AxisColor
Line.Radius = 0
Line.Height = 0
Line.Parent = Circle
Lines[i] = Line
end
end
end
function ArcHandles:CreateHandles(Options)
-- Create folder to contain handles
local HandlesFolder = Instance.new('Folder')
HandlesFolder.Name = 'Handles'
HandlesFolder.Parent = self.Gui
self.Handles = {}
self.HandleStates = {}
-- Generate a handle for each side
for _, Side in ipairs(Enum.NormalId:GetEnumItems()) do
-- Get axis information
local Axis = self.SideToAxis[Side.Name]
local AxisColor = self.AxisColors[Axis]
-- Create handle
local Handle = Instance.new('ImageButton')
Handle.Name = Side.Name
Handle.Image = 'rbxassetid://2347145012'
Handle.ImageColor3 = AxisColor
Handle.ImageTransparency = 0.33
Handle.AnchorPoint = Vector2.new(0.5, 0.5)
Handle.BackgroundTransparency = 1
Handle.BorderSizePixel = 0
Handle.ZIndex = 1
Handle.Visible = false
-- Create handle dot
local HandleDot = Handle:Clone()
HandleDot.Active = false
HandleDot.Size = UDim2.new(0, 4, 0, 4)
HandleDot.Position = UDim2.new(0.5, 0, 0.5, 0)
HandleDot.Visible = true
HandleDot.Parent = Handle
HandleDot.ZIndex = 0
-- Create maid for handle cleanup
local HandleMaid = Maid.new()
self.Maid[Side.Name] = HandleMaid
-- Add handle hover effect
HandleMaid.HoverStart = Handle.MouseEnter:Connect(function ()
Handle.ImageTransparency = 0
self:SetCircleTransparency(Axis, 0)
end)
HandleMaid.HoverEnd = Handle.MouseLeave:Connect(function ()
Handle.ImageTransparency = 0.33
self:SetCircleTransparency(Axis, 0.4)
end)
-- Listen for handle interactions on click
HandleMaid.DragStart = Handle.MouseButton1Down:Connect(function (X, Y)
local InitialHandlePlane = self.HandleStates[Handle].PlaneNormal
local InitialHandleCFrame = self.HandleStates[Handle].HandleCFrame
local InitialAdorneeCFrame = self.HandleStates[Handle].AdorneeCFrame
-- Calculate aim offset
local AimRay = self.Camera:ViewportPointToRay(X, Y)
local AimDistance = (InitialHandleCFrame.p - AimRay.Origin):Dot(InitialHandlePlane) / AimRay.Direction:Dot(InitialHandlePlane)
local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin
local InitialDragOffset = InitialAdorneeCFrame:PointToObjectSpace(AimWorldPoint)
-- Run callback
if Options.OnDragStart then
Options.OnDragStart()
end
local function ProcessDragChange(AimScreenPoint)
-- Calculate current aim
local AimRay = self.Camera:ScreenPointToRay(AimScreenPoint.X, AimScreenPoint.Y)
local AimDistance = (InitialHandleCFrame.p - AimRay.Origin):Dot(InitialHandlePlane) / AimRay.Direction:Dot(InitialHandlePlane)
local AimWorldPoint = (AimDistance * AimRay.Direction) + AimRay.Origin
local CurrentDragOffset = InitialAdorneeCFrame:PointToObjectSpace(AimWorldPoint)
-- Calculate angle on dragged axis
local DragAngle
if Axis == 'X' then
local InitialAngle = math.atan2(InitialDragOffset.Y, -InitialDragOffset.Z)
DragAngle = math.atan2(CurrentDragOffset.Y, -CurrentDragOffset.Z) - InitialAngle
elseif Axis == 'Y' then
local InitialAngle = math.atan2(InitialDragOffset.X, InitialDragOffset.Z)
DragAngle = math.atan2(CurrentDragOffset.X, CurrentDragOffset.Z) - InitialAngle
elseif Axis == 'Z' then
local InitialAngle = math.atan2(InitialDragOffset.X, InitialDragOffset.Y)
DragAngle = math.atan2(-CurrentDragOffset.X, CurrentDragOffset.Y) - InitialAngle
end
-- Run drag callback
if Options.OnDrag then
Options.OnDrag(Axis, DragAngle)
end
end
-- Create maid for dragging cleanup
local DragMaid = Maid.new()
HandleMaid.Dragging = DragMaid
-- Perform dragging when aiming anywhere (except handle)
DragMaid.Drag = Support.AddUserInputListener('Changed', {'MouseMovement', 'Touch'}, true, function (Input)
ProcessDragChange(Input.Position)
end)
-- Perform dragging while aiming at handle
DragMaid.InHandleDrag = Handle.MouseMoved:Connect(function (X, Y)
local AimScreenPoint = Vector2.new(X, Y) - self.GuiInset
ProcessDragChange(AimScreenPoint)
end)
-- Finish dragging when input ends
DragMaid.DragEnd = Support.AddUserInputListener('Ended', {'MouseButton1', 'Touch'}, true, function (Input)
HandleMaid.Dragging = nil
end)
-- Fire callback when dragging ends
DragMaid.Callback = function ()
coroutine.wrap(Options.OnDragEnd)()
end
end)
-- Finish dragging when input ends while aiming at handle
HandleMaid.InHandleDragEnd = Handle.MouseButton1Up:Connect(function ()
HandleMaid.Dragging = nil
end)
-- Save handle
Handle.Parent = HandlesFolder
self.Handles[Side.Name] = Handle
end
end
function ArcHandles:Hide()
-- Make sure handles are enabled
if not self.Running then
return self
end
-- Pause updating
self:Pause()
-- Hide UI
self.Gui.Enabled = false
end
function ArcHandles:Pause()
self.Running = false
end
local function IsFirstPerson(Camera)
return (Camera.CFrame.p - Camera.Focus.p).magnitude <= 0.6
end
function ArcHandles:Resume()
-- Make sure handles are disabled
if self.Running then
return self
end
-- Allow handles to run
self.Running = true
-- Update each handle
for Side, Handle in pairs(self.Handles) do
coroutine.wrap(function ()
while self.Running do
self:UpdateHandle(Side, Handle)
RunService.RenderStepped:Wait()
end
end)()
end
-- Update each axis circle
for Axis, Lines in pairs(self.AxisCircles) do
coroutine.wrap(function ()
while self.Running do
self:UpdateCircle(Axis, Lines)
RunService.RenderStepped:Wait()
end
end)()
end
-- Ignore character whenever character enters first person
if Players.LocalPlayer then
coroutine.wrap(function ()
while self.Running do
local FirstPerson = IsFirstPerson(self.Camera)
local Character = Players.LocalPlayer.Character
if Character then
self.ObstacleBlacklistIndex[Character] = FirstPerson and true or nil
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
end
wait(0.2)
end
end)()
end
-- Show UI
self.Gui.Enabled = true
end
function ArcHandles:SetAdornee(Item)
-- Return self for chaining
-- Save new adornee
self.Adornee = Item
self.IsAdorneeModel = Item and (Item:IsA 'Model') or nil
-- Attach axis circles to adornee
for Axis, Lines in pairs(self.AxisCircles) do
for _, Line in ipairs(Lines) do
Line.Adornee = Item
end
end
-- Resume handles
if Item then
self:Resume()
else
self:Hide()
end
-- Return handles for chaining
return self
end
function ArcHandles:SetCircleTransparency(Axis, Transparency)
for _, Line in ipairs(self.AxisCircles[Axis]) do
Line.Transparency = Transparency
end
end
local function WorldToViewportPoint(Camera, Position)
-- Get viewport position for point
local ViewportPoint, Visible = Camera:WorldToViewportPoint(Position)
local CameraDepth = ViewportPoint.Z
ViewportPoint = Vector2.new(ViewportPoint.X, ViewportPoint.Y)
-- Adjust position if point is behind camera
if CameraDepth < 0 then
ViewportPoint = Camera.ViewportSize - ViewportPoint
end
-- Return point and visibility
return ViewportPoint, CameraDepth, Visible
end
function ArcHandles:BlacklistObstacle(Obstacle)
if Obstacle then
self.ObstacleBlacklistIndex[Obstacle] = true
self.ObstacleBlacklist = Support.Keys(self.ObstacleBlacklistIndex)
end
end
function ArcHandles:UpdateHandle(Side, Handle)
local Camera = self.Camera
-- Hide handles if not attached to an adornee
if not self.Adornee then
Handle.Visible = false
return
end
-- Get adornee CFrame and size
local AdorneeCFrame = self.IsAdorneeModel and
self.Adornee:GetModelCFrame() or
self.Adornee.CFrame
local AdorneeSize = self.IsAdorneeModel and
self.Adornee:GetModelSize() or
self.Adornee.Size
-- Calculate radius of adornee extents
local ViewportPoint, CameraDepth, Visible = WorldToViewportPoint(Camera, AdorneeCFrame.p)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * CameraDepth
local StudsPerPixel = StudWidth / Camera.ViewportSize.X
local HandlePadding = math.max(1, StudsPerPixel * 14) * (self.IsMouseAvailable and 1 or 1.6)
local AdorneeRadius = AdorneeSize.magnitude / 2
local Radius = AdorneeRadius + 2 * HandlePadding
-- Calculate CFrame of the handle's side
local SideUnitVector = Vector3.FromNormalId(Side)
local HandleCFrame = AdorneeCFrame * CFrame.new(Radius * SideUnitVector)
local AxisCFrame = AdorneeCFrame * Vector3.FromAxis(self.SideToAxis[Side])
local HandleNormal = (AxisCFrame - AdorneeCFrame.p).unit
-- Get viewport position of adornee and the side the handle will be on
local HandleViewportPoint, HandleCameraDepth, HandleVisible = WorldToViewportPoint(Camera, HandleCFrame.p)
-- Display handle if side is visible to the camera
Handle.Visible = HandleVisible
-- Calculate handle size (12 px, or at least 0.5 studs)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * HandleCameraDepth
local PixelsPerStud = Camera.ViewportSize.X / StudWidth
local HandleSize = math.max(12, 0.5 * PixelsPerStud) * (self.IsMouseAvailable and 1 or 1.6)
Handle.Size = UDim2.new(0, HandleSize, 0, HandleSize)
-- Calculate where handles will appear on the screen
Handle.Position = UDim2.new(
0, HandleViewportPoint.X,
0, HandleViewportPoint.Y
)
-- Save handle position
local HandleState = self.HandleStates[Handle] or {}
self.HandleStates[Handle] = HandleState
HandleState.HandleCFrame = HandleCFrame
HandleState.PlaneNormal = HandleNormal
HandleState.AdorneeCFrame = AdorneeCFrame
-- Hide handles if obscured by a non-blacklisted part
local HandleRay = Camera:ViewportPointToRay(HandleViewportPoint.X, HandleViewportPoint.Y)
local TargetRay = Ray.new(HandleRay.Origin, HandleRay.Direction * (HandleCameraDepth - 0.25))
local Target, TargetPoint = Workspace:FindPartOnRayWithIgnoreList(TargetRay, self.ObstacleBlacklist)
if Target then
Handle.ImageTransparency = 1
elseif Handle.ImageTransparency == 1 then
Handle.ImageTransparency = 0.33
end
end
function ArcHandles:UpdateCircle(Axis, Lines)
local Camera = self.Camera
-- Get adornee CFrame and size
local AdorneeCFrame = self.IsAdorneeModel and
self.Adornee:GetModelCFrame() or
self.Adornee.CFrame
local AdorneeSize = self.IsAdorneeModel and
self.Adornee:GetModelSize() or
self.Adornee.Size
-- Get circle information
local AxisVector = Vector3.FromAxis(Axis)
local CircleVector = Vector3.FromNormalId(self.AxisToSide[Axis])
-- Determine circle radius
local ViewportPoint, CameraDepth, Visible = WorldToViewportPoint(Camera, AdorneeCFrame.p)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * CameraDepth
local StudsPerPixel = StudWidth / Camera.ViewportSize.X
local HandlePadding = math.max(1, StudsPerPixel * 14) * (self.IsMouseAvailable and 1 or 1.6)
local AdorneeRadius = AdorneeSize.magnitude / 2
local Radius = AdorneeRadius + 2 * HandlePadding
-- Determine angle of each circle slice
local Angle = 2 * math.pi / #Lines
-- Circle thickness (px)
local Thickness = 1.5
-- Redraw lines for circle
for i, Line in ipairs(Lines) do
-- Calculate arc's endpoints
local From = CFrame.fromAxisAngle(AxisVector, Angle * (i - 1)) *
(CircleVector * Radius)
local To = CFrame.fromAxisAngle(AxisVector, Angle * i) *
(CircleVector * Radius)
local Center = From:Lerp(To, 0.5)
-- Determine thickness of line (in studs)
local ViewportPoint, CameraDepth, Visible = WorldToViewportPoint(Camera, AdorneeCFrame * Center)
local StudWidth = 2 * math.tan(math.rad(Camera.FieldOfView) / 2) * CameraDepth
local StudsPerPixel = StudWidth / Camera.ViewportSize.X
Line.Radius = Thickness * StudsPerPixel / 2
-- Position line between the endpoints
Line.CFrame = CFrame.new(Center, To) *
CFrame.new(0, 0, Line.Radius / 2)
-- Make line span between endpoints
Line.Height = (To - From).magnitude
end
end
function ArcHandles:Destroy()
-- Pause updating
self.Running = nil
-- Clean up resources
self.Maid:Destroy()
end
return ArcHandles
|
--- Alternative to WaitForChild which doesn't error and has custom wait time |
local function WaitFor(parent, index) --- funny
if not parent then
return print("Failed to grab " .. index .. " (" .. parent.Name .. " is nil)", true)
end
local _t = tick()
while (tick() - _t) <= waitTimeout do
local child = parent:FindFirstChild(index)
if child then
return child
end
_L.RunService.Heartbeat:Wait()
end
return print("Failed to grab " .. index, true)
end
Player.Get = function(instance, player)
if isClient then
player = player or game.Players.LocalPlayer
end
player = (type(player) == "string" and game.Players:FindFirstChild(player) or player)
instance = instance or "Player"
instance = string.lower(instance)
--- Wait for player + character to EXIST!
local _t = tick()
while (player and (not player.Character) and (tick() - _t < waitTimeout)) do _L.RunService.Stepped:Wait() end
if (not player) or (tick() - _t) >= waitTimeout then return end
--- Get humanoid & rigtype
local humanoid = player.Character:FindFirstChild("Humanoid")
local rigType = defaultRigType --- this will be default if humanoid cannot be read
if humanoid then
rigType = humanoid.RigType
end
--- R6 Compatibility
if rigType == Enum.HumanoidRigType.R6 then
if instance == "torso" then
return WaitFor(player.Character, "Torso")
elseif instance == "leftarm" then
return WaitFor(player.Character, "LeftArm")
elseif instance == "leftleg" then
return WaitFor(player.Character, "LeftLeg")
elseif instance == "rightarm" then
return WaitFor(player.Character, "RightArm")
elseif instance == "rightleg" then
return WaitFor(player.Character, "RightLeg")
end
end
--- R15 + everything else
if instance == "player" or (not instance) then
return player
elseif instance == "character" then
return player.Character
elseif instance == "head" then
return WaitFor(player.Character, "Head")
elseif instance == "torso" or instance == "uppertorso" then
return WaitFor(player.Character, "UpperTorso")
elseif instance == "rootpart" or instance == "humanoidrootpart" then
return WaitFor(player.Character, "HumanoidRootPart")
elseif instance == "humanoid" then
return WaitFor(player.Character, "Humanoid")
elseif instance == "lowertorso" then
return WaitFor(player.Character, "LowerTorso")
elseif instance == "leftfoot" then
return WaitFor(player.Character, "LeftFoot")
elseif instance == "lefthand" then
return WaitFor(player.Character, "LeftHand")
elseif instance == "leftlowerarm" then
return WaitFor(player.Character, "LeftLowerArm")
elseif instance == "leftlowerleg" then
return WaitFor(player.Character, "LeftLowerLeg")
elseif instance == "leftupperarm" then
return WaitFor(player.Character, "LeftUpperArm")
elseif instance == "leftupperleg" then
return WaitFor(player.Character, "LeftUpperLeg")
elseif instance == "rightfoot" then
return WaitFor(player.Character, "RightFoot")
elseif instance == "righthand" then
return WaitFor(player.Character, "RightHand")
elseif instance == "rightlowerarm" then
return WaitFor(player.Character, "RightLowerArm")
elseif instance == "rightlowerleg" then
return WaitFor(player.Character, "RightLowerLeg")
elseif instance == "rightupperarm" then
return WaitFor(player.Character, "RightUpperArm")
elseif instance == "rightupperleg" then
return WaitFor(player.Character, "RightUpperLeg")
elseif instance == "root" then
return WaitFor(WaitFor(player.Character, "LowerTorso"), "Root")
elseif instance == "waist" then
return WaitFor(WaitFor(player.Character, "UpperTorso"), "Waist")
elseif instance == "neck" then
return WaitFor(WaitFor(player.Character, "Head"), "Neck")
elseif instance == "leftankle" then
return WaitFor(WaitFor(player.Character, "LeftFoot"), "LeftAnkle")
elseif instance == "leftwrist" then
return WaitFor(WaitFor(player.Character, "LeftHand"), "LeftWrist")
elseif instance == "leftelbow" then
return WaitFor(WaitFor(player.Character, "LeftLowerArm"), "LeftElbow")
elseif instance == "leftknee" then
return WaitFor(WaitFor(player.Character, "LeftLowerLeg"), "LeftKnee")
elseif instance == "leftshoulder" then
return WaitFor(WaitFor(player.Character, "LeftUpperArm"), "LeftShoulder")
elseif instance == "lefthip" then
return WaitFor(WaitFor(player.Character, "LeftUpperLeg"), "LeftHip")
elseif instance == "rightankle" then
return WaitFor(WaitFor(player.Character, "RightFoot"), "RightAnkle")
elseif instance == "rightwrist" then
return WaitFor(WaitFor(player.Character, "RightHand"), "RightWrist")
elseif instance == "rightelbow" then
return WaitFor(WaitFor(player.Character, "RightLowerArm"), "RightElbow")
elseif instance == "rightknee" then
return WaitFor(WaitFor(player.Character, "RightLowerLeg"), "RightKnee")
elseif instance == "rightshoulder" then
return WaitFor(WaitFor(player.Character, "RightUpperArm"), "RightShoulder")
elseif instance == "righthip" then
return WaitFor(WaitFor(player.Character, "RightUpperLeg"), "RightHip")
elseif instance == "playergui" then
return player:WaitForChild("PlayerGui")
elseif instance == "starterplayer" then
return player:WaitForChild("StarterPlayer")
elseif instance == "mouse" then
return player:GetMouse()
elseif instance == "camera" then
return game.Workspace.CurrentCamera
elseif instance == "name" then
return player.Name
end
end
|
-- Test Module
-- Username
-- August 29, 2020 |
local TestModule = {}
function TestModule:Start()
print("Test Module loaded.")
self.Controllers.HelloController:SayHello()
while (not TestModule.ABC) do
wait()
end
end
function TestModule:Init()
end
return TestModule
|
----------------------This is just an example----------------------------- |
script.Parent.Parent.Ammo.Visible = true
script.Parent.Parent.Ammo.Text = ammo.value |
--script.Parent.CCC.Velocity = script.Parent.CCC.CFrame.lookVector *script.Parent.Speed.Value |
script.Parent.CCCC.Velocity = script.Parent.CCCC.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.D.Velocity = script.Parent.D.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DD.Velocity = script.Parent.DD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DDD.Velocity = script.Parent.DDD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.DDDD.Velocity = script.Parent.DDDD.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.E.Velocity = script.Parent.E.CFrame.lookVector *script.Parent.Speed.Value |
-- Battery1 -- |
Battery.Interaction.Touched:Connect(function(hit)
if hit.Parent:IsA("Tool") and hit.Parent.Name == ToolRequired then
Battery.Battery1.Transparency = 0
if game.ReplicatedStorage.ItemSwitching.Value == true then
hit.Parent:Destroy()
end
Battery.Parent.SoundPart.Insert:Play()
Battery.Parent.Light2.Color = Color3.fromRGB(0,255,0)
LocksLeft.Value = LocksLeft.Value - 1
Battery.Battery1Script.Disabled = true
end
end)
Battery.Interaction.ClickDetector.MouseClick:Connect(function(plr)
if plr.Backpack:FindFirstChild(Battery.ToolRequired.Value) then
Battery.Battery1.Transparency = 0
if game.ReplicatedStorage.ItemSwitching.Value == true then
plr.Backpack:FindFirstChild(ToolRequired):Destroy()
end
Battery.Parent.SoundPart.Insert:Play()
Battery.Parent.Light2.Color = Color3.fromRGB(0,255,0)
LocksLeft.Value = LocksLeft.Value - 1
Battery.Battery1Script.Disabled = true
end
end)
|
--[[Running Logic]] | --
local equipped = false
local rayparts = {}
local ColorChoices = {BrickColor.new('Really red'),BrickColor.new('Lime green'),BrickColor.new('Toothpaste')}
local StartOffset = {Vector3.new(-.45,0,0),Vector3.new(0,0,0),Vector3.new(.45,0,0)}
local oldC0 =nil
local nweld
local EffectFunctions =
{
function(hum,dir) hum:TakeDamage(1) end,
function(hum,dir) hum:TakeDamage(-1) end,
function(hum,dir)
if hum.Torso then
local nforce = Instance.new('BodyForce')
nforce.force = dir*100
nforce.Parent = hum.Torso
hum.Sit = true
game.Debris:AddItem(nforce,.2)
Delay(.2,function() hum.Sit = false end)
end
end
}
Tool.Equipped:connect(function(mouse)
--game.Players.LocalPlayer:GetMouse()
Spawn(function()
local colorChoice = 1
if not Tool.Parent:FindFirstChild('Torso') or not Tool.Parent.Torso:FindFirstChild('Right Shoulder') or not Tool.Parent:FindFirstChild('Humanoid') then return end
LazerSound:Play()
nweld = Tool.Parent.Torso['Right Shoulder']
oldC0 = nweld.C0
nweld.CurrentAngle = 0
nweld.DesiredAngle = 0
nweld.MaxVelocity = 0
mouse.Button1Down:connect(function()
colorChoice=colorChoice+1
if colorChoice>#ColorChoices then colorChoice =1 end
LazerSound.Pitch = .75+((colorChoice*.25)*3)
end)
equipped = true
while equipped and Tool.Parent:FindFirstChild('Torso') do
local tframe = Tool.Parent.Torso.CFrame
tframe = tframe + tframe:vectorToWorldSpace(Vector3.new(1, 0.5, 0))
local taim = mouse.Hit.p -( tframe.p )
nweld.C0 = (CFrame.new(Vector3.new(),tframe:vectorToObjectSpace(taim))*CFrame.Angles(0,math.pi/2,0))+Vector3.new( 1, 0.5, 0 )
rayparts = CastLightRay(Handle.CFrame.p+Handle.CFrame:vectorToWorldSpace(StartOffset[colorChoice]),mouse.Hit.p,ColorChoices[colorChoice], 5, .2,rayparts, EffectFunctions[colorChoice])
LazerSound.Volume = ((math.sin(tick()*3)+1)*.25)+.25
wait()
end
nweld.C0 =oldC0
LazerSound:Stop()
end)
end)
Tool.Unequipped:connect(function(mouse)
equipped= false
LazerSound:Stop()
for i=1,50,1 do
if rayparts[i] then
rayparts[i]:Destroy()
rayparts[i]=nil
end
end
if nweld then
nweld.MaxVelocity =.15
nweld.C0 =oldC0
end
end)
|
-- |
Edit = {
U = {{CFrame.new(0,0.03*(3.5/TimeOpen),0),TimeOpen*SL}},
D = {{CFrame.new(0,-0.03*(3.5/TimeOpen),0),TimeOpen*SL}},
R = {{CFrame.new(-0.03*(3.5/TimeOpen),0,0),TimeOpen*SL,TimeOpen}},
L = {{CFrame.new(0.03*(3.5/TimeOpen),0,0),TimeOpen*SL,TimeOpen}},
}
WaitTime = 7.5 |
--Kinglime |
while true do
script.Parent.Velocity = script.Parent.CFrame.lookVector *script.Parent.Speed.Value
wait(0.1)
end
|
-- Adds numParts more parts to the cache. |
function PartCacheStatic:Expand(numParts: number): ()
assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("Expand", "PartCache.new"))
if numParts == nil then
numParts = self.ExpansionSize
end
for i = 1, numParts do
table.insert(self.Open, MakeFromTemplate(self.Template, self.CurrentCacheParent))
end
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!! |
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.SuperSpeedRibbon -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
--This will change all player's characters into R6 1.0.
--You can either modify this script or use another script to change the player's 'package'. |
script:WaitForChild("R6 Camera").Parent = game.StarterPlayer.StarterPlayerScripts
script:WaitForChild("R6").Parent = game:GetService("ReplicatedStorage")
game.Players.PlayerAdded:connect(function(p)
p.CharacterAdded:connect(function(c)
if not p.Character:FindFirstChild("R6") then
game.Workspace:WaitForChild(p.Name)
local r = game:GetService("ReplicatedStorage"):WaitForChild("R6"):Clone()
r.Name = p.Name
r.Parent = game.Workspace
r.HumanoidRootPart.CFrame = CFrame.new(c.HumanoidRootPart.Position)
r:WaitForChild("Body Colors")
c:WaitForChild("Body Colors")
local b1 = r["Body Colors"]
local b2 = c["Body Colors"]
b1.HeadColor = b2.HeadColor
b1.LeftArmColor = b2.LeftArmColor
b1.LeftLegColor = b2.LeftLegColor
b1.RightArmColor = b2.RightArmColor
b1.RightLegColor = b2.RightLegColor
b1.TorsoColor = b2.TorsoColor
r:WaitForChild("Head"):WaitForChild("face").Texture = c.Head.face.Texture
for _,h in pairs(c:GetChildren()) do
if h.ClassName == "Accessory" or h.ClassName == "Hat" or h.ClassName == "Shirt" or h.ClassName == "Pants" or h.ClassName == "Shirt Graphic" then
h.Parent = game.Workspace
h.Parent = r
end
end
c:Destroy()
p.Character = r
wait()
p.Character:WaitForChild("Animate").Disabled = false
end
end)
end)
|
-----------------
--| Constants |--
----------------- |
local GRAVITY_ACCELERATION = workspace.Gravity
local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 80 -- Speed of the projectile
local MISSILE_MESH_ID = 'http://www.roblox.com/asset/?id=2251534'
local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)
|
--!strict
--[=[
@function merge
@within Set
@param ... ...any -- The sets to merge.
@return { [T]: boolean } -- The merged set.
Combines one or more sets into a single set.
Aliases: `join`, `union`
```lua
local set1 = { hello = true, world = true }
local set2 = { cat = true, dog = true, hello = true }
local merge = Merge(set1, set2) -- { hello = true, world = true, cat = true, dog = true }
```
]=] |
local function merge<T>(...: any): { [T]: boolean }
local result = {}
for setIndex = 1, select("#", ...) do
local set = select(setIndex, ...)
if type(set) ~= "table" then
continue
end
for key, _ in pairs(set) do
result[key] = true
end
end
return result
end
return merge
|
--[[
Returns the currentMinigame object
]] |
function RoundController.getCurrentMinigame()
return currentMinigame
end
return RoundController
|
--[=[
Retrieves the full path of this datastore stage for diagnostic purposes.
@return string
]=] |
function DataStoreStage:GetFullPath()
if self._loadParent then
return self._loadParent:GetFullPath() .. "." .. tostring(self._loadName)
else
return tostring(self._loadName)
end
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Base.Smasher.Obtained.Value == false
end
|
-- Unlock the camera: |
function CamLock.Unlock()
cam.CameraType = Enum.CameraType.Custom
plane = nil
end
return CamLock
|
-- ROBLOX deviation: ansi-styles not ported |
local CurrentModule = script
local Packages = CurrentModule.Parent
local LuauPolyfill = require(Packages.LuauPolyfill)
local Error = LuauPolyfill.Error
local Object = LuauPolyfill.Object
local extends = LuauPolyfill.extends
local isNaN = LuauPolyfill.Number.isNaN
local Collections = require(CurrentModule.Collections)
local printTableEntries = Collections.printTableEntries
local printListItems = Collections.printListItems
local AsymmetricMatcher = require(CurrentModule.plugins.AsymmetricMatcher)
local ConvertAnsi = require(CurrentModule.plugins.ConvertAnsi)
local RobloxInstance = require(CurrentModule.plugins.RobloxInstance)
local ReactElement = require(CurrentModule.plugins.ReactElement)
local ReactTestComponent = require(CurrentModule.plugins.ReactTestComponent)
local JestGetType = require(Packages.JestGetType)
local getType = JestGetType.getType
local isRobloxBuiltin = JestGetType.isRobloxBuiltin
local Types = require(CurrentModule.Types)
export type Colors = Types.Colors
export type CompareKeys = Types.CompareKeys
export type Config = Types.Config
export type Options = Types.Options
export type OptionsReceived = Types.OptionsReceived
export type OldPlugin = Types.OldPlugin
export type NewPlugin = Types.NewPlugin
export type Plugin = Types.Plugin
export type Plugins = Types.Plugins
export type PrettyFormatOptions = Types.PrettyFormatOptions
export type Printer = Types.Printer
export type Refs = Types.Refs
export type Theme = Types.Theme
local PrettyFormatPluginError = extends(Error, "PrettyFormatPluginError", function(self, message)
self.name = "PrettyFormatPluginError"
self.message = message
end)
|
-- Given a part, will return return the character from the given part. |
function PartUtility.GetCharacterFromInstance_R(part)
local model = part:FindFirstAncestorOfClass("Model")
if model and model:FindFirstChild("Humanoid") then
return model
elseif model then
PartUtility.GetCharacterFromInstance_R(model)
end
end
function PartUtility.MakeInvisible(model)
for _, child in pairs(model:GetDescendants()) do
if child:IsA("BasePart") then
child:SetAttribute("InitialTransparency",child.Transparency)
child.Transparency = 1
end
end
end
function PartUtility.RestoreVisibility(model)
for _, child in pairs(model:GetDescendants()) do
if child:IsA("BasePart") then
child.Transparency = child:GetAttribute("InitialTransparency") and child:GetAttribute("InitialTransparency") or 0
end
end
end
function PartUtility.MakeVisible(model)
for _, child in pairs(model:GetDescendants()) do
if child:IsA("BasePart") then
child.Transparency = 0
end
end
end
return PartUtility
|
----- Connections ----- |
Players.PlayerAdded:Connect(function(player)
PlayerReference[player] = true
end)
Players.PlayerRemoving:Connect(function(player)
PlayerReference[player] = nil
-- Automatic player reference cleanup:
for rate_limiter in pairs(RateLimiters) do
rate_limiter._sources[player] = nil
end
end)
return RateLimiter
|
-- Copied from GenericButton. TODO: factor it out |
return function(contentMap, controlState, style)
local contentThemeClass = contentMap[controlState]
or contentMap[ControlState.Default]
local contentStyle = {
Color = style.Theme[contentThemeClass].Color,
Transparency = style.Theme[contentThemeClass].Transparency,
}
--Based on the design specs, the disabled and pressed state is 0.5 * alpha value
if controlState == ControlState.Disabled or
controlState == ControlState.Pressed then
contentStyle.Transparency = 0.5 * contentStyle.Transparency + 0.5
end
return contentStyle
end
|
--------STAGE-------- |
game.Workspace.back1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.back2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crewbig1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crewsmall1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.djstand.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.djtv.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side4.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side11.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.side12.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.sidebig1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
if game.Workspace.CurrentStageTV.Value == "1" then
game.Workspace.main1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
end
|
-- Services |
local Teams = game:GetService("Teams")
local Workspace = game:GetService("Workspace")
local Debris = game:GetService("Debris")
local ContentProvider = game:GetService("ContentProvider")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
|
--[=[
Pops an entry from the left of the queue
@return T
]=] |
function Queue:PopLeft()
if self._first > self._last then
error("Queue is empty")
end
local value = self[self._first]
self[self._first] = nil
self._first = self._first + 1
return value
end
|
--create tables: |
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "a" then
table.insert(a, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "b" then
table.insert(b, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "c" then
table.insert(c, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "d" then
table.insert(d, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "e" then
table.insert(e, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "f" then
table.insert(f, 1, part)
end
end
function on(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = true
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = true
end
end
end
function off(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = false
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = false
end
end
end
function run() --mian
off(a)--turns all lights off
off(b)
off(c)
off(d)
off(e)
off(f)
if pattern == "Flash" then
repeat
local w = 0.45
off(c)
off(d)
on(a)
on(b)
on(e)
on(f)
wait(w)
off(a)
off(b)
off(e)
off(f)
on(c)
on(d)
wait(w)
until pattern ~= "Flash"
return
end
if pattern == "Left" then
repeat
local w = 0.15
on(f)
wait(w)
on(e)
wait(w)
on(d)
wait(w)
on(c)
wait(w)
on(b)
wait(w)
on(a)
wait(w)
off(f)
wait(w)
off(e)
wait(w)
off(d)
wait(w)
off(c)
wait(w)
off(b)
wait(w)
off(a)
wait(w)
until pattern ~= "Left"
return
end
if pattern == "Right" then
repeat
local w = 0.15
on(a)
wait(w)
on(b)
wait(w)
on(c)
wait(w)
on(d)
wait(w)
on(e)
wait(w)
on(f)
wait(w)
off(a)
wait(w)
off(b)
wait(w)
off(c)
wait(w)
off(d)
wait(w)
off(e)
wait(w)
off(f)
wait(w)
until pattern ~= "Right"
return
end
if pattern == "Split" then
repeat
local w = 0.2
on(c)
on(d)
wait(w)
on(b)
on(e)
wait(w)
on(a)
on(f)
wait(w)
off(c)
off(d)
wait(w)
off(b)
off(e)
wait(w)
off(a)
off(f)
wait(w)
until pattern ~= "Split"
return
end
end--run end |
--[[
]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local AvatarEditor = ReplicatedStorage.AvatarEditor
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Promise = require(AvatarEditor.Shared.Util.Promise)
local GuiLib = require(AvatarEditor.Client.GuiLib.LazyLoader)
local Theme = require(AvatarEditor.Client.Theme)
local player = Players.LocalPlayer
local Class = {}
Class.__index = Class
function Class.new(frame)
local self = setmetatable({}, Class)
self.Frame = frame
self.ScrollingFrame = self.Frame.ScrollingFrame
self.Maid = Maid.new()
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame, "ScrollBarImageColor3", "Scrollbar"))
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame.Theme.DropdownButton, "BackgroundColor3", "Tertiary"))
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame.Theme.DropdownButton.ListFrame, "BackgroundColor3", "Tertiary"))
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame.Theme.DropdownButton.Arrow, "ImageColor3", "Deselected"))
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame.Theme.DropdownButton.Option, "TextColor3", "Text"))
self.Maid:GiveTask(Theme:Bind(self.ScrollingFrame.Theme.TextLabel, "TextColor3", "Text"))
local dropdownButton = self.ScrollingFrame.Theme.DropdownButton
for i, v in ipairs(Theme:GetAll()) do
local button = AvatarEditor.DropdownTemplate:Clone()
button.LayoutOrder = i
button.Text = v
button.Name = v
self.Maid:GiveTask(Theme:Bind(button, "BackgroundColor3", "Tertiary"))
self.Maid:GiveTask(Theme:Bind(button, "TextColor3", "Text"))
self.Maid:GiveTask(button)
button.Parent = dropdownButton.ListFrame.ScrollFrame
end
self.Maid:GiveTask(Theme:Bind(dropdownButton.ListFrame.ScrollFrame, "ScrollBarImageColor3", "Scrollbar"))
-- for some reason AutomaticCanvasSize doesnt want to work here...
dropdownButton.ListFrame.ScrollFrame.CanvasSize = UDim2.new(0, 0, 0, dropdownButton.ListFrame.ScrollFrame.UIListLayout.AbsoluteContentSize.Y)
local themeDropdown = GuiLib.Classes.Dropdown.new(dropdownButton, dropdownButton.ListFrame)
self.Maid:GiveTask(themeDropdown)
self.Maid:GiveTask(themeDropdown.Changed:Connect(function(button)
local theme = button.Name
Theme:Set(theme)
end))
Promise.new(function(resolve, reject)
local folder = player:WaitForChild("AE_Settings")
resolve(folder)
end)
:andThen(function(folder)
self.Folder = folder
themeDropdown:Set(dropdownButton.ListFrame.ScrollFrame[self.Folder:GetAttribute("Theme")])
Theme:Set(themeDropdown:Get().Name)
end)
:catch(warn)
return self
end
function Class:Destroy()
self.Maid:DoCleaning()
self.Maid = nil
setmetatable(self, nil)
end
return Class
|
--[[
Instantiates object fields
]] |
function VehicleSoundComponent:setup()
local idle = CarSoundsFolder:FindFirstChild("Idle")
local engine = CarSoundsFolder:FindFirstChild("Engine")
local skid = CarSoundsFolder:FindFirstChild("Skid")
local boost = CarSoundsFolder:FindFirstChild("Boost")
self.idle = idle:Clone()
self.engine = engine:Clone()
self.skid = skid:Clone()
self.boost = boost:Clone()
self.idle.Parent = self.model.PrimaryPart
self.engine.Parent = self.model.PrimaryPart
self.skid.Parent = self.model.PrimaryPart
self.boost.Parent = self.model.PrimaryPart
self.idle.Volume = 0
self.engine.Volume = 0
self.skid.Volume = 0
self.boost.Volume = 0
self.idle:Play()
self.engine:Play()
self.skid:Play()
self.boost:Play()
coroutine.wrap(
function()
while self.model and self.model.Parent do
self:updateSounds()
wait(0.5)
end
end
)()
end
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local ClassInformationTable = require(game.ReplicatedStorage.Source.Modules.CharacterScripts.Classes.ClassInformation)
return ClassInformationTable:GetClassFolder(player,"Warlock").Firespread.Value and ClassInformationTable:GetClassFolder(player,"Warlock").FastCasting.Value ~= true
end
|
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value) |
-- Important parts -- |
local faucet = p.Faucet
local faucetParticles = p.Tap.ParticleEmitter
local showerHead = p.ShowerHead.Spout.ParticleEmitter
local bathPlug = p.Plug
local showerPlug = p.ShowerPlug
|
-- Local variables |
local PlayersCanSpawn = false
local GameRunning = false
|
-- Libraries |
local Roact = require(Vendor:WaitForChild 'Roact')
local Maid = require(Libraries:WaitForChild 'Maid')
|
--[[Run]] |
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("Novena: AC6T Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--Power
Engine()
--Update External Values
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = (_Boost/2)*_TPsi
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpBoosted.Value = _BH*(_Boost/2)
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TqNatural.Value = _NT
script.Parent.Values.TqBoosted.Value = _BT*(_Boost/2)
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot*_GThrotShift
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
end)
--15 c/s
while wait(.0667) do
--Automatic Transmission
if _TMode == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end
|
--Toggle Lights 1 or 0 |
function Chassis.ToggleLights()
local lightR = Chassis.Body.lightR
local lightL = Chassis.Body.lightL
local lightValue = lightR.SurfaceLight.Enabled
lightR.SurfaceLight.Enabled = not lightValue
lightL.SurfaceLight.Enabled = not lightValue
end
|
--[=[
Concats `target` with `source`.
@param target table -- Table to append to
@param source table -- Table read from
@return table -- parameter table
]=] |
function Table.append(target, source)
for _, value in pairs(source) do
target[#target+1] = value
end
return target
end
|
----------------------------------------------------## |
script.Parent.ClickDetector.MouseClick:Connect(function()
if isopen == false then
isopen = true
script.Parent.DoorOpen:Play()
doormotor.Motor.DesiredAngle = -0.8
else
isopen = false
script.Parent.DoorClose:Play()
doormotor.Motor.DesiredAngle = 0
end
end) |
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Explode Zone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--[[
!Reminder!
Format to calculate hour's rotation:
90 * DateTimeTable.hour / 3 (1 to 12) or (90 * DateTimeTable.hour / 3) / 3) (12 to 24)
Every 3 hours the needle will rotate 90 degrees.
Format to calculate second's rotation:
90 * DateTimeTable.min / 15 (1 to 30) or (90 * DateTimeTable.min / 15) / 15) (30 to 60)
Every 15 minutes the needle will rotate 90 degrees.
Format to calculate second's rotation:
90 * DateTimeTable.sec / 15 (1 to 30) or (90 * DateTimeTable.sec / 15) / 15) (30 to 60)
Every 15 seconds the needle will rotate 90 degrees.
]] | --
|
--[[
Returns the enums.Device of the DeviceInputTypePattern that matches the
`inputType`.
This function is called when the LocalPlayer's LastInputType has changed,
thus possibly requiring an update to the enums.Device
]] |
local ExperienceComponents = script:FindFirstAncestor("ExperienceComponents")
local constants = require(ExperienceComponents.constants)
local enums = require(ExperienceComponents.enums)
|
-- ROBLOX deviation END |
local exports = {}
exports.DiscreteEvent = 0
exports.UserBlockingEvent = 1
exports.ContinuousEvent = 2
export type ReactFundamentalComponentInstance<C, H> = {
currentFiber: Object,
instance: any,
prevProps: Object?,
props: Object,
impl: ReactFundamentalImpl<C, H>,
state: Object,
}
export type ReactFundamentalImpl<C, H> = {
displayName: string,
reconcileChildren: boolean,
getInitialState: nil | (Object) -> (Object),
getInstance: (C, Object, Object) -> (H),
getServerSideString: nil | (C, Object) -> (string),
getServerSideStringClose: nil | (C, Object) -> (string),
onMount: (C, any, Object, Object) -> (),
shouldUpdate: nil | (C, Object?, Object, Object) -> (boolean),
onUpdate: nil | (C, any, Object?, Object, Object) -> (),
onUnmount: nil | (C, any, Object, Object) -> (),
onHydrate: nil | (C, Object, Object) -> boolean,
onFocus: nil | (C, Object, Object) -> boolean,
}
export type ReactFundamentalComponent<C, H> = {
["$$typeof"]: number,
impl: ReactFundamentalImpl<C, H>,
}
export type ReactScope = {
["$$typeof"]: number,
}
export type ReactScopeQuery = (
type: string,
-- ROBLOX deviation START: leave closed to extension unless necessary
props: { [string]: any? },
-- ROBLOX deviation END
instance: any
) -> boolean
export type ReactScopeInstance = {
DO_NOT_USE_queryAllNodes: (ReactScopeQuery) -> nil | Array<Object>,
DO_NOT_USE_queryFirstNode: (ReactScopeQuery) -> nil | Object,
containsNode: (Object) -> boolean,
getChildContextValues: <T>(context: ReactContext<T>) -> Array<T>,
}
|
--- Skill |
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
local Track1 : Animation = script:WaitForChild("Anim01")
Track1 = Player.Character:WaitForChild("Humanoid"):LoadAnimation(script.Anim01)
local PrevWalkSpeed = nil
local Tween = game:GetService("TweenService")
local Gui = Player.PlayerGui:WaitForChild("Mochi_Skill_List".. Player.Name):WaitForChild("Frame")
local Mouse = Player:GetMouse()
local Cooldown = 15
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.V and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Tool.Active.Value = "4DoughBarrage"
PrevWalkSpeed = Player.Character:WaitForChild("Humanoid").WalkSpeed
Gui:FindFirstChild(Tool.Active.Value).Frame.Size = UDim2.new(1, 0, 1, 0)
Player.Character:WaitForChild("Humanoid").WalkSpeed = 5
Track1:Play()
Track1:AdjustSpeed(0)
wait(0.15)
script.Fire:FireServer("hold")
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.V and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "4DoughBarrage" then
Debounce = false
Tool.Active.Value = "4DoughBarrage"
Player.Character:WaitForChild("Humanoid").WalkSpeed = 2
Track1:AdjustSpeed(1)
script.Fire:FireServer("release", Mouse.Hit.p)
local hum = Player.Character.Humanoid
wait(1)
Tween:Create(Gui:FindFirstChild(Tool.Active.Value).Frame, TweenInfo.new(Cooldown), {Size = UDim2.new(0, 0, 1, 0)}):Play()
Tool.Active.Value = "None"
Player.Character:WaitForChild("Humanoid").WalkSpeed = PrevWalkSpeed
wait(Cooldown)
Debounce = true
end
end)
|
-- Initialize the tool |
local LightingTool = {
Name = 'Lighting Tool';
Color = BrickColor.new 'Really black';
-- Signals
OnSideChanged = Signal.new();
}
LightingTool.ManualText = [[<font face="GothamBlack" size="16">Lighting Tool 🛠</font>
Lets you add point lights, surface lights, and spotlights to parts.<font size="6"><br /></font>
<b>TIP:</b> Click on the surface of any part to change a light's side quickly.]]
|
---Controls UI |
script.Parent.Parent:WaitForChild("Controls")
script.Parent.Parent:WaitForChild("ControlsOpen")
script.Parent:WaitForChild("Window")
script.Parent:WaitForChild("Toggle")
local car = script.Parent.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local UserInputService = game:GetService("UserInputService")
local cPanel = script.Parent
local Controls = script.Parent.Parent.Controls
local ver = require(car["A-Chassis Tune"].README)
cPanel.Window["//INSPARE"].Text = "A-Chassis "..ver.." by //INSPARE"
local controlsOpen = false
local cInputB = nil
local cInputT = nil
local cInput = false
for i,v in pairs(_Tune.Controls) do
script.Parent.Parent.Controls:WaitForChild(i)
local button = cPanel.Window.Content[i]
button.Text = v.Name
button.MouseButton1Click:connect(function()
script.Parent.Parent.ControlsOpen.Value = true
cPanel.Window.Overlay.Visible = true
cInput = true
repeat wait() until cInputB~=nil
if cInputB == Enum.KeyCode.Return or cInputB == Enum.KeyCode.KeypadEnter then
--do nothing
elseif string.find(i,"Contlr")~=nil then
if cInputT.Name:find("Gamepad") then
Controls[i].Value = cInputB.Name
button.Text = cInputB.Name
else
cPanel.Window.Error.Visible = true
end
elseif i=="MouseThrottle" or i=="MouseBrake" then
if cInputT == Enum.UserInputType.MouseButton1 or cInputT == Enum.UserInputType.MouseButton2 then
Controls[i].Value = cInputT.Name
button.Text = cInputT.Name
else
cPanel.Window.Error.Visible = true
end
else
if cInputT == Enum.UserInputType.Keyboard then
Controls[i].Value = cInputB.Name
button.Text = cInputB.Name
else
cPanel.Window.Error.Visible = true
end
end
cInputB = nil
cInputT = nil
cInput = false
wait(.2)
cPanel.Window.Overlay.Visible = false
script.Parent.Parent.ControlsOpen.Value = false
end)
end
cPanel.Window.Error.Changed:connect(function(property)
if property == "Visible" then
wait(3)
cPanel.Window.Error.Visible = false
end
end)
UserInputService.InputBegan:connect(function(input) if cInput then cInputB = input.KeyCode cInputT = input.UserInputType end end)
UserInputService.InputChanged:connect(function(input) if cInput and (input.KeyCode==Enum.KeyCode.Thumbstick1 or input.KeyCode==Enum.KeyCode.Thumbstick2) then cInputB = input.KeyCode cInputT = input.UserInputType end end)
cPanel.Toggle.MouseButton1Click:connect(function()
controlsOpen = not controlsOpen
if controlsOpen then
cPanel.Toggle.BackgroundColor3 = Color3.new(1,85/255,.5)
cPanel.Window:TweenPosition(UDim2.new(0.5, -250,0.5, -250),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.7,true)
else
cPanel.Toggle.BackgroundColor3 = Color3.new(1,170/255,0)
cPanel.Window:TweenPosition(UDim2.new(0.5, -250,0, -500),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.7,true)
end
end)
cPanel.Window.Tabs.Keyboard.MouseButton1Click:connect(function()
cPanel.Window.Content:TweenPosition(UDim2.new(0, 0, 0, 60),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Keyboard:TweenPosition(UDim2.new(0, 5, 0, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Mouse:TweenPosition(UDim2.new(0, 120, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Controller:TweenPosition(UDim2.new(0, 235, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
end)
cPanel.Window.Tabs.Mouse.MouseButton1Click:connect(function()
cPanel.Window.Content:TweenPosition(UDim2.new(-1, 0, 0, 60),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Keyboard:TweenPosition(UDim2.new(0, 5, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Mouse:TweenPosition(UDim2.new(0, 120, 0, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Controller:TweenPosition(UDim2.new(0, 235, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
end)
cPanel.Window.Tabs.Controller.MouseButton1Click:connect(function()
cPanel.Window.Content:TweenPosition(UDim2.new(-2, 0, 0, 60),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Keyboard:TweenPosition(UDim2.new(0, 5, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Mouse:TweenPosition(UDim2.new(0, 120, 0, -5),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
cPanel.Window.Tabs.Controller:TweenPosition(UDim2.new(0, 235, 0, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,true)
end)
wait(.5)
cPanel.Toggle:TweenPosition(UDim2.new(0, 50, 1, -30),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.4,false)
for i=1,6 do
cPanel.Toggle.BackgroundColor3 = Color3.new(100/255,100/255,100/255)
wait(.2)
if controlsOpen then
cPanel.Toggle.BackgroundColor3 = Color3.new(1,85/255,.5)
else
cPanel.Toggle.BackgroundColor3 = Color3.new(1,170/255,0)
end
wait(.2)
end
|
--[[Weight and CG]] |
Tune.Weight = 4000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 2.5 ,
--[[Length]] 10 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 1 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--[[Weight and CG]] |
Tune.Weight = 3042 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
--Unsprung Weight
Tune.FWheelDensity = .1 -- Front Wheel Density
Tune.RWheelDensity = .1 -- Rear Wheel Density
Tune.FWLgcyDensity = 1 -- Front Wheel Density [PGS OFF]
Tune.RWLgcyDensity = 1 -- Rear Wheel Density [PGS OFF]
Tune.AxleSize = 2.2 -- Size of structural members (larger = more stable/carry more weight)
Tune.AxleDensity = .1 -- Density of structural members
|
--me.ImageLabel.ScaleType = Enum.ScaleType.Slice -- обрезание
--me.ImageLabel.SliceCenter = Rect.new(38, 38, 42, 42) -- отступ от лево верх
--me.ImageLabel.SliceScale=1 -- размер | |
--[[
function this:SwordSkill() -- fired when the sword skill is activated
print("Special sword skill")
end
]] |
return this
|
-- Modules |
local ReplicatedModuleScripts = ReplicatedStorage:FindFirstChild("ModuleScripts")
local RaceManager = require(ReplicatedModuleScripts:FindFirstChild("RaceManager"))
local displayValues = ReplicatedStorage:WaitForChild("DisplayValues")
local GameStatus = script.Parent
local StatusBar = GameStatus.Parent
local TimerAndStatus = StatusBar.Parent
local TopBar = TimerAndStatus.Parent |
-- if _Tune.Config == "RWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="RL" or v.Name=="RR" or v.Name=="R" then table.insert(Drive,v) end end end |
--Determine Wheel Size
local wDia = 0 for i,v in pairs(Drive) do if v.Size.x>wDia then wDia = v.Size.x end end
--Pre-Toggled PBrake
for i,v in pairs(car.Wheels:GetChildren()) do if math.abs(v["#AV"].maxTorque.Magnitude-PBrakeForce)<1 then _PBrake.Value=true end end
|
-- Roughly how far the script looks for valid nearby objects. |
config.CheckRadius = 6
|
-- Clear orientable body event listeners for a given player |
local function onPlayerRemoving(player)
if orientableBodies[player] then
orientableBodies[player]:destroy()
orientableBodies[player] = nil
end
if characterAddedConnections[player] then
characterAddedConnections[player]:Disconnect()
characterAddedConnections[player] = nil
end
if characterRemovingConnections[player] then
characterRemovingConnections[player]:Disconnect()
characterRemovingConnections[player] = nil
end
end
|
--Tell if a seat is flipped |
local function isFlipped(Seat)
local UpVector = Seat.CFrame.upVector
local Angle = math.deg(math.acos(UpVector:Dot(Vector3.new(0, 1, 0))))
return Angle >= MIN_FLIP_ANGLE
end
local function Raycast(startPos, direction, range, ignore, inceptNumber)
if inceptNumber == nil then inceptNumber = 0 end
inceptNumber = inceptNumber + 1
local ray = Ray.new(startPos, direction * range)
local part, position = Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
if part then
if part.CanCollide == false and inceptNumber <= 5 then
--raycast again if we hit a cancollide false brick, put a limit on to prevent an infinite loop
local rangeLeft = range - (startPos - position).magnitude
part, position = Raycast(position, direction, rangeLeft, ignore, inceptNumber) --Raycast remaining distance.
end
end
return part, position
end
local function ExitSeat(player, character, seat, weld)
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
weld:Destroy()
if seat:FindFirstChild("DoorHinge") then
seat.DoorLatchWeld.Enabled = false
seat.DoorHinge.TargetAngle = DOOR_OPEN_ANGLE
playDoorSound(seat, "OpenClose")
end
--Record the interaction
SeatInteractionCount[seat] = SeatInteractionCount[seat] and SeatInteractionCount[seat] + 1 or 1
seat:SetAttribute('LastExit', tick())
wait()
if seat:FindFirstChild("ExitPosition") then --Check if we can move the character to the designated pos.
--Find vehicle model
local model
local newParent = seat
repeat
model = newParent
newParent = model.Parent
until newParent.ClassName ~= "Model"
local targetPos = seat.ExitPosition.WorldPosition
local delta = targetPos - seat.Position
local dist = delta.magnitude
local dir = delta.unit
local part, _ = Raycast(seat.Position, dir, dist, {character, model})
if not part then --Prevent people being CFramed into walls and stuff
hrp.CFrame = CFrame.new(targetPos)
else
hrp.CFrame = CFrame.new(seat.Position)
--The CFrame element orients the character up-right, the MoveTo stops the character from clipping into objects
character:MoveTo(seat.Position+Vector3.new(0,8,0))
end
else
hrp.CFrame = CFrame.new(seat.Position)
character:MoveTo(seat.Position+Vector3.new(0,8,0))
end
if player then
RemotesFolder.ExitSeat:FireClient(player, true) --Fire this to trigger the client-side anti-trip function
end
wait(DOOR_OPEN_TIME)
SeatInteractionCount[seat] = SeatInteractionCount[seat] > 1 and SeatInteractionCount[seat] - 1 or nil
if seat:FindFirstChild("DoorHinge") then
--If nobody else has interactied in this time, close the door.
if SeatInteractionCount[seat] == nil then
seat.DoorHinge.TargetAngle = 0
-- Weld door shut when closed
while math.abs(seat.DoorHinge.CurrentAngle) > 0.01 do
wait()
end
seat.DoorLatchWeld.Enabled = true
end
end
end
end
local function FlipSeat(Player, Seat)
if Seat then
if Seat.Parent then
if not Seat.Parent.Parent:FindFirstChild("Scripts") then
warn("Flip Error: Scripts file not found. Please parent seats to the chassis model")
return
end
if not Seat.Parent.Parent.Scripts:FindFirstChild("Chassis") then
warn("Flip Error: Chassis module not found.")
return
end
local Chassis = require(Seat.Parent.Parent.Scripts.Chassis)
Chassis.Redress()
end
end
end
function VehicleSeating.EjectCharacter(character)
if character and character.HumanoidRootPart then
for _, weld in pairs(character.HumanoidRootPart:GetJoints()) do
if weld.Name == "SeatWeld" then
ExitSeat(Players:GetPlayerFromCharacter(character), character, weld.Part0, weld)
break
end
end
end
end
function VehicleSeating.SetRemotesFolder(remotes)
RemotesFolder = remotes
--Detect exit seat requests
RemotesFolder:FindFirstChild("ExitSeat").OnServerEvent:Connect(function(player)
if player.Character then
local character = player.Character
VehicleSeating.EjectCharacter(character)
end
end)
--Detect force exit seat requests
RemotesFolder:FindFirstChild("ForceExitSeat").OnServerEvent:Connect(function(seatName)
local chassis = PackagedVehicle:FindFirstChild("Chassis")
if chassis then
local seat = chassis:FindFirstChild(seatName)
if seat and seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
VehicleSeating.EjectCharacter(occupantCharacter)
end
end
end)
end
function VehicleSeating.SetBindableEventsFolder(bindables)
local BindableEventsFolder = bindables
--Detect force exit seat requests
BindableEventsFolder:FindFirstChild("ForceExitSeat").Event:Connect(function(seatName)
local chassis = PackagedVehicle:FindFirstChild("Chassis")
if chassis then
local seat = chassis:FindFirstChild(seatName)
if seat and seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
VehicleSeating.EjectCharacter(occupantCharacter)
end
end
end)
end
function VehicleSeating.AddSeat(seat, enterCallback, exitCallback)
local promptLocation = seat:FindFirstChild("PromptLocation")
if promptLocation then
local proximityPrompt = promptLocation:FindFirstChildWhichIsA("ProximityPrompt")
if proximityPrompt then
local vehicleObj = getVehicleObject()
local function setCarjackPrompt()
if seat.Occupant and not carjackingEnabled(vehicleObj) then
proximityPrompt.Enabled = false
else
proximityPrompt.Enabled = true
end
end
seat:GetPropertyChangedSignal("Occupant"):connect(setCarjackPrompt)
vehicleObj:GetAttributeChangedSignal("AllowCarjacking"):Connect(setCarjackPrompt)
proximityPrompt.Triggered:connect(function(Player)
if seat then
if isFlipped(seat) then
FlipSeat(Player, seat)
elseif not seat:FindFirstChild("SeatWeld") or carjackingEnabled(vehicleObj) then
if Player.Character ~= nil then
local HRP = Player.Character:FindFirstChild("HumanoidRootPart")
local humanoid = Player.Character:FindFirstChild("Humanoid")
if HRP then
local Dist = (HRP.Position - seat.Position).magnitude
if Dist <= MAX_SEATING_DISTANCE then
if seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
for _, weld in pairs(occupantCharacter.HumanoidRootPart:GetJoints()) do
if weld.Name == "SeatWeld" then
ExitSeat(Players:GetPlayerFromCharacter(occupantCharacter), occupantCharacter, weld.Part0, weld)
break
end
end
end
seat:Sit(humanoid)
if seat:FindFirstChild("DoorHinge") then
if seat.DoorHinge.ClassName ~= "HingeConstraint" then warn("Warning, door hinge is not actually a hinge!") end
--Record that a player is trying to get in the seat
SeatInteractionCount[seat] = SeatInteractionCount[seat] and SeatInteractionCount[seat] + 1 or 1
--Activate the hinge
seat.DoorLatchWeld.Enabled = false
seat.DoorHinge.TargetAngle = DOOR_OPEN_ANGLE
seat.DoorHinge.AngularSpeed = DOOR_OPEN_SPEED
playDoorSound(seat, "OpenClose")
wait(DOOR_OPEN_TIME)
--Check if anyone has interacted with the door within this time. If not, close it.
SeatInteractionCount[seat] = SeatInteractionCount[seat] > 1 and SeatInteractionCount[seat] - 1 or nil
if SeatInteractionCount[seat] == nil then
seat.DoorHinge.TargetAngle = 0
-- Weld door shut when closed
while math.abs(seat.DoorHinge.CurrentAngle) > 0.01 do
wait()
end
seat.DoorLatchWeld.Enabled = true
end
end
end
end
end
end
end
end)
end
end
local effectsFolder = getEffectsFolderFromSeat(seat)
if effectsFolder then
-- set open/close Sound
local openclose = effectsFolder:FindFirstChild("OpenCloseDoor")
if openclose then
openclose:Clone().Parent = seat
end
end
local currentOccupant = nil
local occupantChangedConn = seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
if enterCallback then
currentOccupant = seat.Occupant
currentOccupant = Players:GetPlayerFromCharacter(currentOccupant.Parent) or currentOccupant
enterCallback(currentOccupant, seat)
end
elseif exitCallback then
exitCallback(currentOccupant, seat)
currentOccupant = nil
end
end)
--Clean up after the seat is destroyed
seat.AncestryChanged:connect(function()
if not seat:IsDescendantOf(game) then
occupantChangedConn:Disconnect()
end
end)
end
return VehicleSeating
|
--- VARIABLES |
Remote = ReplicatedStorage.DataCommunicator
|
--------------------------------------- |
local Handling = false
Grenade.Touched:connect(function(part)
--ignore collisions with firer's stuff
if Character and part:IsDescendantOf(Character) then return end
if Handling then return end
Handling = true
--wait a second, this is a grenade so it won't explode on contact
wait(0.1)
--end grenade
Grenade.Anchored = true
Grenade.CanCollide = false
Grenade.Transparency = 1
--play soud
ExplodeSound:Play()
--do explode |
-- Set Pet Canvas Size -- |
function PetSrollingFrame:SetTradingPlayerListCanvasSize(searchOn)
TradingPlayerListUI.Size = UDim2.new(0.35, 0, 0.6, 0)
local PADDING, SIZE, MaxCells = getSizes()
local AbsoluteSize = ScrollingFrame.AbsoluteSize
local NewPadding = PADDING * AbsoluteSize
NewPadding = UDim2.new(0, NewPadding.X, 0, NewPadding.Y)
local NewSize = SIZE * AbsoluteSize
NewSize = UDim2.new(0, NewSize.X, 0, NewSize.Y)
UIGridLayout.CellPadding = NewPadding
UIGridLayout.CellSize = NewSize
local children = ScrollingFrame:GetChildren()
local items = 0
if searchOn == true then
for _, v in pairs(ScrollingFrame:GetChildren()) do
if v:IsA("ImageLabel") and v:FindFirstChild("Data") then
if v.Visible == true then
items = items + 1
end
end
end
else
items = (#children) - 1
end
local frameSizeY = ScrollingFrame.AbsoluteSize.Y
local ySize = UIGridLayout.CellSize.Y.Offset
local yPadding = UIGridLayout.CellPadding.Y.Offset
UIGridLayout.FillDirectionMaxCells = MaxCells
local rows = math.ceil(items / UIGridLayout.FillDirectionMaxCells)
local pixels = rows * ySize + (rows - 1) * yPadding
ScrollingFrame.CanvasSize = UDim2.new(0, 0, 0, (pixels + 5))
if TradingPlayerListUI.Visible == false then
TradingPlayerListUI.Size = UDim2.new(0, 0, 0, 0)
end
end
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
function Encode(text)
--- Init (if haven't already)
if not inited then
Init()
end
--- Main
local dictionary = Copy(dictionary)
local key, sequence, size = "", {}, #dictionary
local width, spans, span = 1, {}, 0
local function listkey(key)
local value = ToBase93(dictionary[key])
if #value > width then
width, span, spans[width] = #value, 0, span
end
sequence[#sequence+1] = (" "):rep(width - #value)..value
span = span + 1
end
text = Escape(text)
for i = 1, #text do
local c = text:sub(i, i)
local new = key..c
if dictionary[new] then
key = new
else
listkey(key)
key, size = c, size+1
dictionary[new], dictionary[size] = size, new
end
end
listkey(key)
spans[width] = span
--
return table.concat(spans, ",").."|"..table.concat(sequence)
end
function Decode(text)
--- Init (if haven't already)
if not inited then
Init()
end
--- Main
local dictionary = Copy(dictionary)
local sequence, spans, content = {}, text:match("(.-)|(.*)")
local groups, start = {}, 1
for span in spans:gmatch("%d+") do
local width = #groups+1
groups[width] = content:sub(start, start + span*width - 1)
start = start + span*width
end
local previous;
for width = 1, #groups do
for value in groups[width]:gmatch(('.'):rep(width)) do
local entry = dictionary[ToBase10(value)]
if previous then
if entry then
sequence[#sequence+1] = entry
dictionary[#dictionary+1] = previous..entry:sub(1, 1)
else
entry = previous..previous:sub(1, 1)
sequence[#sequence+1] = entry
dictionary[#dictionary+1] = entry
end
else
sequence[1] = entry
end
previous = entry
end
end
--
return Unescape(table.concat(sequence))
end
function Escape(s)
return (s:gsub("[%c\"\\]", function(c)
return "\127"..escapemap[c]
end))
end
function Unescape(s)
return (s:gsub("\127(.)", function(c)
return escapemap[c]
end))
end
function Copy(t)
local new = {}
for k, v in pairs(t) do
new[k] = v
end
return new
end
function ToBase93(n)
local value = ""
repeat
local remainder = n%93
value = dictionary[remainder]..value
n = (n - remainder)/93
until n == 0
return value
end
function ToBase10(value)
local n = 0
for i = 1, #value do
n = n + 93^(i-1)*dictionary[value:sub(-i, -i)]
end
return n
end
function Init()
for i = 32, 127 do
if i ~= 34 and i ~= 92 then
local c = string.char(i)
dictionary[c], dictionary[length] = length, c
length = length + 1
end
end
for i = 1, 34 do
i = ({34, 92, 127})[i-31] or i
local c, e = string.char(i), string.char(i + 31)
escapemap[c], escapemap[e] = e, c
end
--
inited = true
end
|
-- Local Functions |
local function CreateRocket()
local rocketCopy = RocketTemplate:Clone()
rocketCopy.PrimaryPart.CFrame = CFrame.new(Configurations.StoragePosition.Value)
rocketCopy.Parent = Storage
rocketCopy.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocketCopy.PrimaryPart.BrickColor = Owner.TeamColor
end
table.insert(Buffer, rocketCopy)
end
local function IntializeBuffer()
for i = 1, Configurations.BufferSize.Value do
CreateRocket()
end
end
local function RemoveFromBuffer(rocket)
for i = 1, #Buffer do
if Buffer[i] == rocket then
table.remove(Buffer, i)
return
end
end
end
local function ResetRocketOwner()
for _, rocket in ipairs(Buffer) do
rocket.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocket.PrimaryPart.BrickColor = Owner.TeamColor
end
end
end
local function OnExplosionHit(part, distance)
local player = Players:GetPlayerFromCharacter(part.Parent) or Players:GetPlayerFromCharacter(part.Parent.Parent)
if not player then
if part.Parent.Name ~= 'RocketLauncher' and part.Parent.Name ~= 'Flag' and not part.Anchored then
local volume = part.Size.X * part.Size.Y * part.Size.Z
if volume <= Configurations.MaxDestroyVolume.Value then
if distance < Configurations.BlastRadius.Value * Configurations.DestroyJointRadiusPercent.Value then
part:BreakJoints()
end
if part.Parent.Name == "Rocket" then
RemoveFromBuffer(part.Parent)
end
if #part:GetChildren() == 0 then
wait(2 * volume)
part:Destroy()
end
end
end
end
end
local function OnRocketHit(player, rocket, position)
local explosion = Instance.new('Explosion', game.Workspace)
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = Configurations.BlastRadius.Value
explosion.BlastPressure = Configurations.BlastPressure.Value
explosion.Position = position
explosion.Hit:connect(function(part, distance) OnExplosionHit(part, distance, rocket) end)
rocket.Part.Fire.Enabled = false
wait(1)
rocket:Destroy()
end
local function OnChanged(property)
if property == 'Parent' then
if Tool.Parent.Name == 'Backpack' then
local backpack = Tool.Parent
Owner = backpack.Parent
elseif Players:GetPlayerFromCharacter(Tool.Parent) then
Owner = Players:GetPlayerFromCharacter(Tool.Parent)
else
Owner = nil
end
ResetRocketOwner()
end
end
local function OnFireRocket(player, rocket)
rocket.Rocket.Transparency = 0
rocket.Part.Fire.Enabled = true
CreateRocket()
end
local function DamagePlayer(hitPlayerId, player, damage)
local hitPlayer = Players:GetPlayerByUserId(tonumber(hitPlayerId))
if (hitPlayer.TeamColor == player.TeamColor and Configurations.FriendlyFire.Value) or hitPlayer.TeamColor ~= player.TeamColor then
local humanoid = hitPlayer.Character:FindFirstChild('Humanoid')
if humanoid then
humanoid:TakeDamage(damage)
end
end
end
local function OnHitPlayers(player, hitPlayers)
for hitPlayerId, _ in pairs(hitPlayers) do
DamagePlayer(hitPlayerId, player, Configurations.SplashDamage.Value)
end
end
local function OnDirectHitPlayer(player, hitPlayerId)
DamagePlayer(hitPlayerId, player, Configurations.Damage.Value)
end
|
-- Buttons |
local sparklerButton = prizeGUI:WaitForChild("SparklerGeneric")
local exitButton = prizeGUI:WaitForChild("ExitButton")
local function exit()
prizeGUI.Visible = false
end
local function openPrizeGUI()
prizeGUI.Visible = true
end
local function openRedeem()
prizeGUI.Visible = false
end
local function awardPrize(whichPrize)
-- Check if backpack already has that sparkler
local cloneObject = sparklerPrize:Clone()
cloneObject.Parent = backpack
-- MAybe equip it?
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid") or character:WaitForChild("Humanoid")
humanoid:EquipTool(cloneObject)
end
exitButton.MouseButton1Click:Connect(exit)
sparklerButton.MouseButton1Click:Connect(function()
awardPrize()
end)
proximityPrize.Triggered:Connect(openPrizeGUI)
|
-- print("mouseleave", object,self.current) |
if (self.current == object) then
--Maybe we drop down onto another object now?
--We left, do we hover a different object?
for key,rec in pairs(self.list) do
if (key==self.current) then
continue --skip us
end
if (rec.screen ~= screen) then
continue
end
if (rec.hovering == true) then
--They're hovering but were not current, meaning they were waiting
self.current = rec.object
rec.enterMethod()
rec.down = true
return
end
end
self.current = nil
end
end)
end
function module:EnterHover(object)
if (self.current == object) then
module:LetUpAllOthers(object)
return true
end
if (self.current == nil) then
module:LetUpAllOthers(object)
self.current = object
return true
end
if (object.ZIndex > self.current.ZIndex) then
module:LetUpAllOthers(object)
self.current = object
return true
end
return false
end
function module:LetUpAllOthers(object)
local screen = object:FindFirstAncestorWhichIsA("ScreenGui")
for key,rec in pairs(self.list) do
if (rec.screen ~= screen) then
continue
end
if (rec.hovering and rec.object ~= object) then
if (rec.down == true) then
if (rec.exitMethod) then
rec.exitMethod()
end
rec.down = false
end
end
end
end
return module
|
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------Signal class begin------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
--[[
A 'Signal' object identical to the internal RBXScriptSignal object in it's public API and semantics. This function
can be used to create "custom events" for user-made code.
API:
Method :Connect( function handler )
Arguments: The function to connect to.
Returns: A new connection object which can be used to disconnect the connection
Description: Connects this signal to the function specified by |handler|. That is, when |fire( ... )| is called for
the signal the |handler| will be called with the arguments given to |fire( ... )|. Note, the functions
connected to a signal are called in NO PARTICULAR ORDER, so connecting one function after another does
NOT mean that the first will be called before the second as a result of a call to |fire|.
Method :disconnect()
Arguments: None
Returns: None
Description: Disconnects all of the functions connected to this signal.
Method :fire( ... )
Arguments: Any arguments are accepted
Returns: None
Description: Calls all of the currently connected functions with the given arguments.
Method :wait()
Arguments: None
Returns: The arguments given to fire
Description: This call blocks until
]] |
function t.CreateSignal()
local this = {}
local mBindableEvent = Instance.new('BindableEvent')
local mAllCns = {} --all connection objects returned by mBindableEvent::connect
--main functions
function this:Connect(func)
if self ~= this then error("connect must be called with `:`, not `.`", 2) end
if type(func) ~= 'function' then
error("Argument #1 of connect must be a function, got a "..type(func), 2)
end
local cn = mBindableEvent.Event:Connect(func)
mAllCns[cn] = true
local pubCn = {}
function pubCn:disconnect()
cn:Disconnect()
mAllCns[cn] = nil
end
pubCn.Disconnect = pubCn.disconnect
return pubCn
end
function this:disconnect()
if self ~= this then error("disconnect must be called with `:`, not `.`", 2) end
for cn, _ in pairs(mAllCns) do
cn:Disconnect()
mAllCns[cn] = nil
end
end
function this:wait()
if self ~= this then error("wait must be called with `:`, not `.`", 2) end
return mBindableEvent.Event:Wait()
end
function this:fire(...)
if self ~= this then error("fire must be called with `:`, not `.`", 2) end
mBindableEvent:Fire(...)
end
this.Connect = this.connect
this.Disconnect = this.disconnect
this.Wait = this.wait
this.Fire = this.fire
return this
end
|
--// Use the power of the stars and hit as many people as you can to perform a chain attack! |
local Properties = {
DamageMode = "Normal", --What mode to reference the damage tables listed below
Special = true,--The internal logical indicator to determine if we can use our special.
Special_Reload = 10, --The Cooldown time until the ability is ready to be used.
SpeedCap = 30, --This is the wielder's walkspeed when equipped
DamageValues = {
Normal = {
Min = 2,
Max = 5,
},
Lunge = {
Min = 7,
Max = 10
}
}
}
local FindFirstChild, FindFirstChildOfClass, WaitForChild = script.FindFirstChild, script.FindFirstChildOfClass, script.WaitForChild
local Clone, Destroy = script.Clone, script.Destroy
local GetChildren = script.GetChildren
local IsA = script.IsA
local Tool = script.Parent
Tool.Enabled = true
local DefaultGrip = FindFirstChild(Tool, "DefaultGrip")
if not DefaultGrip then
-- Create a new grip reference
DefaultGrip = Instance.new("CFrameValue")
DefaultGrip.Name = "DefaultGrip"
DefaultGrip.Value = Tool.Grip
DefaultGrip.Parent = Tool
end
Tool.Grip = DefaultGrip.Value --Reset the Tool's grip values to the DefaultGrip Value
local Handle = WaitForChild(Tool, "Handle")
pcall(function()
Handle["Sparkle_Large_Blue"].Enabled = true --We're gonna use this as our visual indicator for our special.
end)
local Sounds = {
Equip = WaitForChild(Handle, "Equip"),
Slash = WaitForChild(Handle, "Slash"),
Lunge = WaitForChild(Handle, "Lunge")
}
local Players = (game:FindService("Players") or game:GetService("Players"))
local Debris = (game:FindService("Debris") or game:GetService("Debris"))
local RunService = (game:FindService("RunService") or game:GetService("RunService"))
local ServerScriptService = (game:FindService("ServerScriptService") or game:GetService("ServerScriptService"))
local NewRay = Ray.new
|
-------- OMG HAX |
r = game:service("RunService")
local damage = 5
local slash_damage = 15
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function isTurbo(character)
return character:FindFirstChild("PirateHat") ~= nil
end
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
if (isTurbo(vCharacter) == true) then
humanoid:TakeDamage(damage * 1.5)
else
humanoid:TakeDamage(damage)
end
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(.5)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
-- Inverse Kinematics will require profecient knowledge of trig and potentially calculus to understand completely. |
local pi =math.pi -- We are using radian-based angles (rather than degree), so we use pi! pi radians = 180 degrees
local hpi =pi/2 -- pi/2 radians = 90 degrees
local tau =2*pi -- 2pi radians = 360 degrees
local CF =CFrame.new -- We don't want to type CFrame.new over and over
local V3 =Vector3.new -- We don't want to type Vector3.new over and over
local ANGLES =CFrame.Angles -- Again, so we don't have to repeat it
local fromAxisAngle =CFrame.fromAxisAngle -- Lol again
local NC =CF() -- Get a blank cframe, same as Cframe.new(0,0,0)
local NV =V3() -- Get a blank vector3, same as Vector3.new(0,0,0)
local forwardV3 =V3(0,0,-1) -- Get a forward-directional Vector3
local x_and_y =V3(1,0,1) -- This will be used later; Vector3*x_and_y will remove the middle value, or the y-value.
local rhipcf =CFrame.new(0.5, -0.4, 0) -- The right-hip reference CFrame, relative to the RightUpperLeg position
local lhipcf =CFrame.new(-0.5, -0.4, 0) -- The left-hip reference CFrame, relative to the LeftUpperLeg position
local rhipcf2 =CFrame.new(0.5,-2.5,0)
local lhipcf2 =CFrame.new(-0.5,-2.5,0)
local rIdle =CFrame.new(0.25,-1.9,0) -- Idle CFrame of Motor6D joint
local lIdle =CFrame.new(-0.25,-1.9,0) -- Idle CFrame of Motor6D joint
|
-- Set green edge if nothing toy |
if script.Parent.ItemType.Value == "Toy" and itemName == "" then
-- Check if equipped anywhere
local equipped = false
for _, o in pairs(settingVals) do
if o.Value ~= "" then
equipped = true
break
end
end
-- Only turn on border if nothing equipped
if equipped then
script.Parent.GreenEdge.Visible = false
else
script.Parent.GreenEdge.Visible = true
end
end
|
-- Dont touch |
while wait() do
script.Parent.Rotation = script.Parent.Rotation + 5
if script.Parent.Rotation == 360 then
script.Parent.Rotation = 0
end
end
|
-- Extends one table with another.
-- Similar to the spread operator in JavaScript. |
function Util.Extend(original: AnyTable, extension: AnyTable): AnyTable
local t = Util.DeepCopy(original)
for k, v in pairs(extension) do
if type(v) == "table" then
if type(original[k]) == "table" then
t[k] = Util.Extend(original[k], v)
else
t[k] = Util.DeepCopy(v)
end
elseif v == Util.None then
t[k] = nil
else
t[k] = v
end
end
return t
end
return Util
|
-- unit.TextTransparency = -0.25 + 1.25*cosRot2
-- unit.BackgroundTransparency = 0.00 + 1.50*cosRot2 |
else
unit.Visible = false
end
end
end)
|
-- Signal class |
local Signal = {}
Signal.__index = Signal
export type ClassType = typeof(setmetatable({} :: {
_handlerListHead: SignalConnection?,
}, Signal))
function Signal.new(): ClassType
return setmetatable({
_handlerListHead = nil,
}, Signal)
end
function Signal.Connect(self: ClassType, fn: Callback): SignalConnection
local connection = Connection.new(self, fn)
if self._handlerListHead then
connection._next = self._handlerListHead :: SignalConnection
self._handlerListHead = connection
else
self._handlerListHead = connection
end
return connection
end
|
-- print("Wha " .. Pose) |
Amplitude = 0.1
Frequency = 1
SetAngles = true
end
if SetAngles then
DesiredAngle = (Amplitude * math.sin(Time * Frequency))
--RightShoulder:SetDesiredAngle(DesiredAngle + ClimbFudge)
--LeftShoulder:SetDesiredAngle(DesiredAngle - ClimbFudge)
RightHip:SetDesiredAngle(-DesiredAngle)
LeftHip:SetDesiredAngle(-DesiredAngle)
end
-- Tool Animation handling
local Tool = GetTool()
if Tool then
AnimStringValueObject = GetToolAnim(Tool)
if AnimStringValueObject then
ToolAnim = AnimStringValueObject.Value
-- message recieved, delete StringValue
AnimStringValueObject.Parent = nil
ToolAnimTime = (Time + 0.3)
end
if Time > ToolAnimTime then
ToolAnimTime = 0
ToolAnim = "None"
end
AnimateTool()
else
StopToolAnimations()
ToolAnim = "None"
ToolAnimTime = 0
end
end
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 1604 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 2000 -- Use sliders to manipulate values
Tune.Redline = 12000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--Made by Luckymaxer |
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Functions = {}
function Functions.GetAngle(Direction)
local Angle = math.acos(Direction:Dot(Vector3.new(1, 0, 0)))
local Modifier = math.acos(Direction:Dot(Vector3.new(0, 0, -1)))
return (Angle * (Modifier > (math.pi / 2) and -1 or 1))
end
function Functions.Clamp(Number, Min, Max)
return math.max(math.min(Max, Number), Min)
end
function Functions.GetPercentage(Start, End, Number)
return (((Number - Start) / (End - Start)) * 100)
end
function Functions.Round(Number, RoundDecimal)
local WholeNumber, Decimal = math.modf(Number)
return ((Decimal >= RoundDecimal and math.ceil(Number)) or (Decimal < RoundDecimal and math.floor(Number)))
end
function Functions.IsTeamMate(Player1, Player2)
return (Player1 and Player2 and not Player1.Neutral and not Player2.Neutral and Player1.TeamColor == Player2.TeamColor)
end
function Functions.TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function Functions.UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function Functions.CheckTableForString(Table, String)
for i, v in pairs(Table) do
if string.find(string.lower(String), string.lower(v)) then
return true
end
end
return false
end
function Functions.CheckIntangible(Hit)
local ProjectileNames = {"Water", "Arrow", "Projectile", "Effect", "Rail", "Laser", "Bullet"}
if Hit and Hit.Parent then
if ((not Hit.CanCollide or Hit.Parent:IsA("Hat") or Functions.CheckTableForString(ProjectileNames, Hit.Name)) and not Hit.Parent:FindFirstChild("Humanoid")) then
return true
end
end
return false
end
function Functions.CastRay(StartPos, Vec, Length, Ignore, DelayIfHit)
local Ignore = ((type(Ignore) == "table" and Ignore) or {Ignore})
local RayHit, RayPos, RayNormal = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(Ray.new(StartPos, Vec * Length), Ignore)
if RayHit and Functions.CheckIntangible(RayHit) then
if DelayIfHit then
wait()
end
RayHit, RayPos, RayNormal = Functions.CastRay((RayPos + (Vec * 0.01)), Vec, (Length - ((StartPos - RayPos).magnitude)), Ignore, DelayIfHit)
end
return RayHit, RayPos, RayNormal
end
function Functions.CheckTableForInstance(Table, Instance)
for i, v in pairs(Table) do
if v == Instance then
return true
end
end
return false
end
function Functions.GetAllConnectedParts(Object)
local Parts = {}
local function GetConnectedParts(Object)
for i, v in pairs(Object:GetConnectedParts()) do
local Ignore = false
if not Functions.CheckTableForInstance(Parts, v) then
table.insert(Parts, v)
GetConnectedParts(v)
end
end
end
GetConnectedParts(Object)
return Parts
end
function GetTotalParts(MaxParts, PossibleParts, Parts)
if MaxParts < PossibleParts then
return MaxParts
elseif Parts >= MaxParts then
return 0
elseif MaxParts >= PossibleParts then
local PartCount = (MaxParts - PossibleParts)
if Parts <= MaxParts then
PartCount = (MaxParts - Parts)
if PartCount > PossibleParts then
return PossibleParts
else
return PartCount
end
elseif PartCount >= PossibleParts then
return PossibleParts
else
return PartCount
end
end
end
function Functions.GetParts(Region, MaxParts, Ignore)
local Parts = {}
local RerunFailed = false
while #Parts < MaxParts and not RerunFailed do
local Region = Region
local PossibleParts = GetTotalParts(MaxParts, 100, #Parts)
local PartsNearby = game:GetService("Workspace"):FindPartsInRegion3WithIgnoreList(Region, Ignore, PossibleParts)
if #PartsNearby == 0 then
RerunFailed = true
else
for i, v in pairs(PartsNearby) do
table.insert(Parts, v)
table.insert(Ignore, v)
end
end
end
return Parts
end
return Functions
|
-- TODO: Get rid of this at some point |
type Jasmine = { _DEFAULT_TIMEOUT_INTERVAL: number?, addMatchers: (matchers: Record<string, any>) -> () }
|
-- PUBLIC |
local ZoneController = {}
local trackers = {}
trackers.player = Tracker.new("player")
trackers.item = Tracker.new("item")
ZoneController.trackers = trackers
|
-- by Ganondude |
ring1 = script.Parent.Parent.Rings.Ring1
lifts1 = ring1.Lifts:getChildren()
parts1 = ring1.Parts:getChildren()
ring2 = script.Parent.Parent.Rings.Ring2
lifts2 = ring2.Lifts:getChildren()
parts2 = ring2.Parts:getChildren()
ring3 = script.Parent.Parent.Rings.Ring3
lifts3 = ring3.Lifts:getChildren()
parts3 = ring3.Parts:getChildren()
ring4 = script.Parent.Parent.Rings.Ring4
lifts4 = ring4.Lifts:getChildren()
parts4 = ring4.Parts:getChildren()
ring5 = script.Parent.Parent.Rings.Ring5
lifts5 = ring5.Lifts:getChildren()
parts5 = ring5.Parts:getChildren()
localdeb = script.Parent.Debounce
foreigndeb = script.Parent.Parent.Parent:findFirstChild(script.Parent.Parent.Destination.Value).Button.Debounce
function onTouched(hit)
if (localdeb.Value~=true) and (foreigndeb.Value~=true) then
localdeb.Value = true
foreigndeb.Value = true
|
-- Arceusinator's Easing Functions |
local function RevBack(t, b, c, d)
t = 1 - t / d
return c * (1 - (sin(t * 1.5707963267948965579989817342720925807952880859375) + (sin(t * 3.14159265358979311599796346854418516159057617187) * (cos(t * 3.14159265358979311599796346854418516159057617187) + 1) * 0.5))) + b
end
local function RidiculousWiggle(t, b, c, d)
t = t / d
return c * sin(sin(t * 3.14159265358979311599796346854418516159057617187) * 1.5707963267948965579989817342720925807952880859375) + b
end
|
--[[
Creates & returns a value instance from 1st argument.
Functions.QuickValue(
..., <-- |REQ| Anything
)
--]] |
return function(value, parent)
--- Var
local valueType
--- Grab type of userdata
if type(value) == "boolean" then
--- Booleans
valueType = "BoolValue"
elseif type(value) == "number" then
--- Numbers/integers
valueType = "NumberValue"
elseif type(value) == "string" then
--- Strings
valueType = "StringValue"
elseif typeof(value) == "BrickColor" then
--- BrickColors
valueType = "BrickColorValue"
elseif typeof(value) == "CFrame" then
--- CFrames
valueType = "CFrameValue"
elseif typeof(value) == "Color3" then
--- Color3s
valueType = "Color3Value"
elseif typeof(value) == "Ray" then
--- Rays
valueType = "RayValue"
elseif typeof(value) == "Vector3" then
--- Vector3s
valueType = "Vector3Value"
elseif typeof(value) == "Instance" then
--- Instances
valueType = "ObjectValue"
end
--- Successfully grabbed type?
if valueType then
--- Create value instance
local valueObj = Instance.new(valueType)
valueObj.Value = value
--- Parent if argument provided
if parent then
valueObj.Parent = parent
end
--
return valueObj
else
--- Value not supported (or nil)
_L.Print("Value type not supported", true)
end
end
|
--Locals |
local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character
local bp = player.Backpack
local hum = char:WaitForChild("Humanoid")
local frame = script.Parent.Frame
local template = frame.Template
local equipped = 0
local unequipped = 0.3
local iconSize = template.Size
local iconBorder = {x = 5, y = 15}
local inputKeys = {
--To add more keys just copy and paste and add more slots
["One"] = {txt = "1"},
["Two"] = {txt = "2"},
["Three"] = {txt = "3"},
}
local inputOrder = {
inputKeys["One"],inputKeys["Two"],inputKeys["Three"],inputKeys["Four"],inputKeys["Five"],
}
|
---------------------------------------------------------------------------------------------------------------
-- Do not edit past here or you will be risking breaking the script!!!! --
--------------------------------------------------------------------------------------------------------------- |
-- VERY UGLY HACK
-- Will this leak threads?
-- Is the problem even what I think it is (player arrived before character)?
while true do
if newPlayer.Character ~= nil then break end
wait(5)
end
local humanoid = newPlayer.Character.Humanoid
humanoid.Died:connect(function() onHumanoidDied(humanoid, newPlayer) end )
-- start to listen for new humanoid
newPlayer.Changed:connect(function(property) onPlayerRespawn(property, newPlayer) end )
stats.Parent = newPlayer
end
function Send_DB_Event_Died(victim, killer)
-- killer may be nil
local killername = "unknown"
if killer ~= nil then killername = killer.Name end
print(victim.Name, " was killed by ", killername)
if shared["deaths"] ~= nil then
shared["deaths"](victim, killer)
print("Death event sent.")
end
end
function Send_DB_Event_Kill(killer, victim)
print(killer.Name, " killed ", victim.Name)
if shared["kills"] ~= nil then
shared["kills"](killer, victim)
print("Kill event sent.")
end
end
function onHumanoidDied(humanoid, player)
local stats = player:findFirstChild("leaderstats")
if stats ~= nil then
local deaths = stats:findFirstChild("Deaths")
deaths.Value = deaths.Value + 1
-- do short dance to try and find the killer
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
Send_DB_Event_Died(player, killer)
handleKillCount(humanoid, player)
end
end
function onPlayerRespawn(property, player)
-- need to connect to new humanoid
if property == "Character" and player.Character ~= nil then
local humanoid = player.Character.Humanoid
local p = player
local h = humanoid
humanoid.Died:connect(function() onHumanoidDied(h, p) end )
end
end
function getKillerOfHumanoidIfStillInGame(humanoid)
-- returns the player object that killed this humanoid
-- returns nil if the killer is no longer in the game
-- check for kill tag on humanoid - may be more than one - todo: deal with this
local tag = humanoid:findFirstChild("creator")
-- find player with name on tag
if tag ~= nil then
local killer = tag.Value
if killer.Parent ~= nil then -- killer still in game
return killer
end
end
return nil
end
function handleKillCount(humanoid, player)
local killer = getKillerOfHumanoidIfStillInGame(humanoid)
if killer ~= nil then
local stats = killer:findFirstChild("leaderstats")
if stats ~= nil then
local kills = stats:findFirstChild("Kills")
local cash = stats:findFirstChild("Cash")
local xp = stats:findFirstChild("XP")
if killer ~= player then
kills.Value = kills.Value + 1
cash.Value = cash.Value + 50
xp.Value = xp.Value + 3
else
kills.Value = kills.Value - 0
end
Send_DB_Event_Kill(killer, player)
end
end
end
game.Players.ChildAdded:connect(onPlayerEntered)
|
----- Creator By: Kaario Studios -----
----- Don't Forget To Join Group! ----- |
local Delay = 7 --- Waiting time when clicked
local player = game.Players.LocalPlayer
local enabled = true
script.Parent.MouseButton1Click:Connect(function()
local char = player.Character
if enabled == true then
enabled = false
if char:FindFirstChild('Humanoid')then
char.Head.CFrame = CFrame.new(game.Workspace.Position.Position)--- Workspace.(Position) <-- Name Of Block (Teleport)
wait (Delay)
enabled = true
end
end
end)
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["Promise"]["Promise"])
return Package
|
--// Animations |
-- Idle Anim
IdleAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.0318467021, -0.0621779114, -1.67288721, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.17)
objs[4]:WaitForChild("Click"):Play()
end;
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.2)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.1)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.2)
MagC:Destroy()
objs[4].Transparency = 0
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.518400908, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.492658436, -1.55705214, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.609481037, -1.02827215, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.175939053, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.3)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.84623456, -0.900531948, -0.749261618, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.617181182, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.03)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
InspectAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
wait(1)
end
}
nadeReload = function(char, speed, objs)
ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
wait(0.6)
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
wait(0.6)
end;
AttachAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- Patrol Anim
PatrolAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
return Settings
|
-- Shovel @ JDLENL 3/22/20
-- If you use this in your game, consider mentioning me in the description! I'd appreciate it. |
local MouseData = Instance.new("RemoteFunction",script.Parent)
local KeyEvent = Instance.new("RemoteEvent",script.Parent)
local Tool = script.Parent
local Gui = script.SoilGUI
local Handle = Tool.Handle
local Settings = require(script.Parent.Settings)
local Hitting = false
function Swing()
local Anim = Instance.new("StringValue")
Anim.Name = "toolanim"
Anim.Value = "Slash"
Anim.Parent = Tool
end
function CreateDust(Pos)
local Attach = Instance.new("Attachment",workspace.Terrain)
Attach.Position = Pos
local Dust = script.DigSmoke:Clone()
Dust.Parent = Attach
Dust.Enabled = true
game.Debris:AddItem(Attach,2)
end
script.Parent.Equipped:Connect(function()
Handle.AllowPlacement.Value = Settings.AllowPlacement
if Settings.GuiEnabled then
local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
Gui.Parent = Player.PlayerGui
KeyEvent:FireClient(Player,Gui,Settings.Soil)
end
Tool.ToolTip = "Dig out terrain! " .. (Settings.AllowPlacement and "Press E to place soil." or "")
Hitting = false
end)
script.Parent.Unequipped:Connect(function()
if Settings.GuiEnabled then
Gui.Parent = script
end
Hitting = false
end)
script.Parent.Activated:Connect(function()
if not Tool.Enabled then return end
Swing()
local Player = game.Players:GetPlayerFromCharacter(Tool.Parent)
if Player.Character.Humanoid.Health <= 0 then return end
if Player then
local Target,HitPos = MouseData:InvokeClient(Player)
if Target and (HitPos - Handle.Position).Magnitude <= Settings.ReachDistance then
if Target == workspace.Terrain then
Tool.Enabled = false
CreateDust(HitPos)
workspace.Terrain:FillBall(HitPos,Settings.DigSize,Enum.Material.Air)
Handle.Dig:Play()
if Settings.ConsumeSoil then
Settings.Soil = Settings.Soil + 1
end
if Settings.GuiEnabled then
KeyEvent:FireClient(Player,Gui,Settings.Soil)
end
if Settings.Hunger then
Player.Hunger.Value = math.clamp(Player.Hunger.Value - Settings.DigHunger,0,100)
end
wait(Settings.Cooldown)
Tool.Enabled = true
end
end
end
end)
KeyEvent.OnServerEvent:Connect(function(Player,Target,HitPos)
if not Tool.Enabled then return end
if Player.Character.Humanoid.Health <= 0 then return end
if Settings.AllowPlacement and Target and (HitPos - Handle.Position).Magnitude <= Settings.ReachDistance then
if (not Settings.ConsumeSoil) or (Settings.ConsumeSoil and Settings.Soil > 0) then
Tool.Enabled = false
Settings.Soil = Settings.Soil - 1
Handle.Dig:Play()
Swing()
workspace.Terrain:FillBall(HitPos,Settings.PlaceSize,Settings.SoilMaterial)
if Settings.GuiEnabled then
KeyEvent:FireClient(Player,Gui,Settings.Soil)
end
if Settings.Hunger then
Player.Hunger.Value = math.clamp(Player.Hunger.Value - Settings.PlaceHunger,0,100)
end
wait(Settings.PlacementCooldown)
Tool.Enabled = true
end
end
end)
Handle.Touched:Connect(function(Part)
if Settings.AllowDamage then
if Part.Parent and Part.Parent:FindFirstChild"Humanoid" then
if Hitting then return end
if Part.Parent.Humanoid.Health > 0 then
Part.Parent.Humanoid:TakeDamage(Settings.Damage)
Handle.Bonk:Play()
Hitting = true
if Settings.DeathMessagesEnabled then
local flag = Instance.new("ObjectValue",Part.Parent.Humanoid)
flag.Name = Settings.DeathMessageFlag
flag.Value = game.Players:GetPlayerFromCharacter(Tool.Parent)
game.Debris:AddItem(flag,Settings.HitCooldown)
end
delay(Settings.HitCooldown,function()
Hitting = false
end)
end
end
end
end)
|
-- made by Bertox
-- lul
-- Edited by Yukinoshida |
script.Parent.Parent.Parent.Parent.Electrics.Changed:connect(function()
if script.Parent.Parent.Parent.Parent.Electrics.Value == true then
script.Parent.Material = Enum.Material.Neon
script.Parent.BrickColor = BrickColor.new("Medium blue")
else
script.Parent.Material = Enum.Material.SmoothPlastic
script.Parent.BrickColor = BrickColor.new("Institutional white")
end
end)
|
--Made by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
Animations = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
Rate = (1 / 60)
ToolEquipped = false
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop(value.FadeTime)
table.remove(Animations, i)
end
end
end
end
function KeyPressed(Key, Down)
InvokeServer("KeyPressed", {Key = Key, Down = Down})
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
ToolEquipped = true
if not CheckIfAlive() then
return
end
PlayerMouse = Mouse
PlayerMouse.KeyDown:connect(function(Key)
KeyPressed(Key, true)
end)
PlayerMouse.KeyUp:connect(function(Key)
KeyPressed(Key, false)
end)
end
function Unequipped()
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
local ServerReturn
pcall(function()
ServerReturn = ServerControl:InvokeServer(mode, value)
end)
return ServerReturn
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MouseData" then
return ((PlayerMouse and {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}) or nil)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[
local gui = game.StarterGui.HDAdminGUIs
for a,b in pairs(gui:GetDescendants()) do
if b:IsA("GuiObject") and b.BackgroundColor3 == Color3.fromRGB(0, 100, 150) and b:FindFirstChild("Theme") == nil then
local bool = Instance.new("BoolValue")
bool.Name = "Theme"
bool.Parent = b
end
end
--]] | |
--[[Tires]] | --
-- Tire Curve Profiler: https://www.desmos.com/calculator/og4x1gyzng
Tune.TireCylinders = 8 -- How many cylinders are used for the tires. More means a smoother curve but way more parts meaning lag. (Default = 4)
Tune.TiresVisible = false -- Makes the tires visible (Debug)
|
--Put this and HoverSoundScript in script in your TextButton |
local sp = script.Parent
local SS = game:GetService("SoundService")
local sound = SS.ClickSound
sp.MouseButton1Click:Connect(function()
sound:Play()
end)
|
--fetching effectlib |
local common_modules = game.ReplicatedStorage.CommonModules
EFFECT_LIB = require(common_modules.EffectLib)
local GenColor = function(t, rate)
local get_t = (t - math.floor(t / rate) * rate) / rate * math.pi * 2
local red = math.sin(get_t + 0) * 0.5 + 0.5
local green = math.sin(get_t + math.pi / 2) * 0.5 + 0.5
local blue = math.sin(get_t + math.pi) * 0.5 + 0.5
return Color3.new(red, green, blue)
end
|
--Make the gamepad hint frame |
local gamepadHintsFrame = Utility:Create'Frame'
{
Name = "GamepadHintsFrame",
Size = UDim2.new(0, HotbarFrame.Size.X.Offset, 0, (IsTenFootInterface and 95 or 60)),
BackgroundTransparency = 1,
Visible = false,
Parent = MainFrame
}
local function addGamepadHint(hintImage, hintImageLarge, hintText)
local hintFrame = Utility:Create'Frame'
{
Name = "HintFrame",
Size = UDim2.new(1, 0, 1, -5),
Position = UDim2.new(0, 0, 0, 0),
BackgroundTransparency = 1,
Parent = gamepadHintsFrame
}
local hintImage = Utility:Create'ImageLabel'
{
Name = "HintImage",
Size = (IsTenFootInterface and UDim2.new(0,90,0,90) or UDim2.new(0,60,0,60)),
BackgroundTransparency = 1,
Image = (IsTenFootInterface and hintImageLarge or hintImage),
Parent = hintFrame
}
local hintText = Utility:Create'TextLabel'
{
Name = "HintText",
Position = UDim2.new(0, (IsTenFootInterface and 100 or 70), 0, 0),
Size = UDim2.new(1, -(IsTenFootInterface and 100 or 70), 1, 0),
Font = Enum.Font.SourceSansBold,
FontSize = (IsTenFootInterface and Enum.FontSize.Size36 or Enum.FontSize.Size24),
BackgroundTransparency = 1,
Text = hintText,
TextColor3 = Color3.new(1,1,1),
TextXAlignment = Enum.TextXAlignment.Left,
TextWrapped = true,
Parent = hintFrame
}
local textSizeConstraint = Instance.new("UITextSizeConstraint", hintText)
textSizeConstraint.MaxTextSize = hintText.TextSize
end
local function resizeGamepadHintsFrame()
gamepadHintsFrame.Size = UDim2.new(HotbarFrame.Size.X.Scale, HotbarFrame.Size.X.Offset, 0, (IsTenFootInterface and 95 or 60))
gamepadHintsFrame.Position = UDim2.new(HotbarFrame.Position.X.Scale, HotbarFrame.Position.X.Offset, InventoryFrame.Position.Y.Scale, InventoryFrame.Position.Y.Offset - gamepadHintsFrame.Size.Y.Offset)
local spaceTaken = 0
local gamepadHints = gamepadHintsFrame:GetChildren()
--First get the total space taken by all the hints
for i = 1, #gamepadHints do
gamepadHints[i].Size = UDim2.new(1, 0, 1, -5)
gamepadHints[i].Position = UDim2.new(0, 0, 0, 0)
spaceTaken = spaceTaken + (gamepadHints[i].HintText.Position.X.Offset + gamepadHints[i].HintText.TextBounds.X)
end
--The space between all the frames should be equal
local spaceBetweenElements = (gamepadHintsFrame.AbsoluteSize.X - spaceTaken)/(#gamepadHints - 1)
for i = 1, #gamepadHints do
gamepadHints[i].Position = (i == 1 and UDim2.new(0, 0, 0, 0) or UDim2.new(0, gamepadHints[i-1].Position.X.Offset + gamepadHints[i-1].Size.X.Offset + spaceBetweenElements, 0, 0))
gamepadHints[i].Size = UDim2.new(0, (gamepadHints[i].HintText.Position.X.Offset + gamepadHints[i].HintText.TextBounds.X), 1, -5)
end
end
addGamepadHint("rbxasset://textures/ui/Settings/Help/XButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Remove From Hotbar")
addGamepadHint("rbxasset://textures/ui/Settings/Help/AButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Select/Swap")
addGamepadHint("rbxasset://textures/ui/Settings/Help/BButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Close Backpack")
do -- Search stuff
local searchFrame = NewGui('Frame', 'Search')
searchFrame.BackgroundColor3 = SEARCH_BACKGROUND_COLOR
searchFrame.BackgroundTransparency = SEARCH_BACKGROUND_FADE
searchFrame.Size = UDim2.new(0, SEARCH_WIDTH - (SEARCH_BUFFER * 2), 0, INVENTORY_HEADER_SIZE - (SEARCH_BUFFER * 2))
searchFrame.Position = UDim2.new(1, -searchFrame.Size.X.Offset - SEARCH_BUFFER, 0, SEARCH_BUFFER)
local searchFrameUIC = Instance.new("UICorner")
searchFrameUIC.CornerRadius = UDim.new(1,0)
searchFrameUIC.Parent = searchFrame
searchFrame.Parent = InventoryFrame
local searchBox = NewGui('TextBox', 'TextBox')
searchBox.PlaceholderText = SEARCH_TEXT
searchBox.TextScaled = true
searchBox.ClearTextOnFocus = false
searchBox.Font = Enum.Font.JosefinSans
searchBox.FontSize = Enum.FontSize.Size14
searchBox.TextXAlignment = Enum.TextXAlignment.Center
searchBox.Size = UDim2.new(0.87, 0, 1, 0)
searchBox.AnchorPoint = Vector2.new(0.5,0.5)
searchBox.Position = UDim2.new(0.5, SEARCH_TEXT_OFFSET_FROMLEFT, 0.5, 0)
local searchBoxUIC = Instance.new("UICorner")
searchBoxUIC.CornerRadius = UDim.new(1,0)
searchBoxUIC.Parent = searchBox
searchBox.Parent = searchFrame
local xButton = NewGui('TextButton', 'X')
xButton.Text = 'x'
xButton.Font = Enum.Font.Oswald
xButton.ZIndex = 10
xButton.TextColor3 = SLOT_EQUIP_COLOR
xButton.FontSize = Enum.FontSize.Size24
xButton.TextYAlignment = Enum.TextYAlignment.Bottom
xButton.BackgroundColor3 = SEARCH_BACKGROUND_COLOR
xButton.BackgroundTransparency = 1
xButton.AnchorPoint = Vector2.new(1,0.5)
xButton.Size = UDim2.new(0.15, 0, 0.5, 0)
xButton.Position = UDim2.new(0.98, 0, 0.5, 0)
xButton.Visible = false
xButton.ZIndex = 0
xButton.BorderSizePixel = 0
xButton.Parent = searchFrame
local function search()
local terms = {}
for word in searchBox.Text:gmatch('%S+') do
terms[word:lower()] = true
end
local hitTable = {}
for i = NumberOfHotbarSlots + 1, #Slots do -- Only search inventory slots
local slot = Slots[i]
local hits = slot:CheckTerms(terms)
table.insert(hitTable, {slot, hits})
slot.Frame.Visible = false
slot.Frame.Parent = InventoryFrame
end
table.sort(hitTable, function(left, right)
return left[2] > right[2]
end)
ViewingSearchResults = true
local hitCount = 0
for i, data in ipairs(hitTable) do
local slot, hits = data[1], data[2]
if hits > 0 then
slot.Frame.Visible = true
slot.Frame.Parent = UIGridFrame
slot.Frame.LayoutOrder = NumberOfHotbarSlots + hitCount
hitCount = hitCount + 1
end
end
ScrollingFrame.CanvasPosition = Vector2.new(0, 0)
UpdateScrollingFrameCanvasSize()
xButton.ZIndex = 3
end
local function clearResults()
if xButton.ZIndex > 0 then
ViewingSearchResults = false
for i = NumberOfHotbarSlots + 1, #Slots do
local slot = Slots[i]
slot.Frame.LayoutOrder = slot.Index
slot.Frame.Parent = UIGridFrame
slot.Frame.Visible = true
end
xButton.ZIndex = 0
end
UpdateScrollingFrameCanvasSize()
end
local function reset()
clearResults()
searchBox.Text = ''
end
local function onChanged(property)
if property == 'Text' then
local text = searchBox.Text
if text == '' then
clearResults()
elseif text ~= SEARCH_TEXT then
search()
end
xButton.Visible = text ~= '' and text ~= SEARCH_TEXT
end
end
local function focusLost(enterPressed)
if enterPressed then
--TODO: Could optimize
search()
end
end
xButton.MouseButton1Click:Connect(reset)
searchBox.Changed:Connect(onChanged)
searchBox.FocusLost:Connect(focusLost)
BackpackScript.StateChanged.Event:Connect(function(isNowOpen)
InventoryIcon:getInstance("iconButton").Modal = isNowOpen -- Allows free mouse movement even in first person
if not isNowOpen then
reset()
end
end)
HotkeyFns[Enum.KeyCode.Escape.Value] = function(isProcessed)
if isProcessed then -- Pressed from within a TextBox
reset()
elseif InventoryFrame.Visible then
InventoryIcon:deselect()
end
end
local function detectGamepad(lastInputType)
if lastInputType == Enum.UserInputType.Gamepad1 and not UserInputService.VREnabled then
searchFrame.Visible = false
else
searchFrame.Visible = true
end
end
UserInputService.LastInputTypeChanged:Connect(detectGamepad)
end
GuiService.MenuOpened:Connect(function()
if InventoryFrame.Visible then
InventoryIcon:deselect()
end
end)
do -- Make the Inventory expand/collapse arrow (unless TopBar)
local removeHotBarSlot = function(name, state, input)
if state ~= Enum.UserInputState.Begin then return end
if not GuiService.SelectedObject then return end
for i = 1, NumberOfHotbarSlots do
if Slots[i].Frame == GuiService.SelectedObject and Slots[i].Tool then
Slots[i]:MoveToInventory()
return
end
end
end
local function openClose()
if not next(Dragging) then -- Only continue if nothing is being dragged
InventoryFrame.Visible = not InventoryFrame.Visible
local nowOpen = InventoryFrame.Visible
AdjustHotbarFrames()
HotbarFrame.Active = not HotbarFrame.Active
for i = 1, NumberOfHotbarSlots do
Slots[i]:SetClickability(not nowOpen)
end
end
if InventoryFrame.Visible then
if GamepadEnabled then
if GAMEPAD_INPUT_TYPES[UserInputService:GetLastInputType()] then
resizeGamepadHintsFrame()
gamepadHintsFrame.Visible = not UserInputService.VREnabled
end
enableGamepadInventoryControl()
end
if BackpackPanel and VRService.VREnabled then
BackpackPanel:SetVisible(true)
BackpackPanel:RequestPositionUpdate()
end
else
if GamepadEnabled then
gamepadHintsFrame.Visible = false
end
disableGamepadInventoryControl()
end
if InventoryFrame.Visible then
ContextActionService:BindAction("RBXRemoveSlot", removeHotBarSlot, false, Enum.KeyCode.ButtonX)
else
ContextActionService:UnbindAction("RBXRemoveSlot")
end
BackpackScript.IsOpen = InventoryFrame.Visible
BackpackScript.StateChanged:Fire(InventoryFrame.Visible)
end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
BackpackScript.OpenClose = openClose -- Exposed
end
|
--[[ ALL WORKSPACE FUNCTIONS ]] | --
local Workspace = workspace
local Camera = Workspace.Camera
local Terrain = Workspace.Terrain
|
-- Ensures that 'actual' is of type 'number' |
local function ensureActualIsNumber(actual: any, matcherName: string, options: MatcherHintOptions?): ()
-- ROBLOX deviation: we do not support a "bigint" type
if typeof(actual) ~= "number" then
-- Prepend maybe not only for backward compatibility
local matcherString = matcherName
if not options then
matcherString = "[.never]" .. matcherString
end
error(
Error(
matcherErrorMessage(
matcherHint(matcherString, nil, nil, options),
RECEIVED_COLOR("received") .. " value must be a number",
printWithType("Received", actual, printReceived)
)
)
)
end
end
|
--[[
CameraShaker.CameraShakeInstance
cameraShaker = CameraShaker.new(renderPriority, callbackFunction)
CameraShaker:Start()
CameraShaker:Stop()
CameraShaker:Shake(shakeInstance)
CameraShaker:ShakeSustain(shakeInstance)
CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
CameraShaker:StartShake(magnitude, roughness [, fadeInTime, posInfluence, rotInfluence])
EXAMPLE:
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCFrame)
camera.CFrame = playerCFrame * shakeCFrame
end)
camShake:Start()
-- Explosion shake:
camShake:Shake(CameraShaker.Presets.Explosion)
wait(1)
-- Custom shake:
camShake:ShakeOnce(3, 1, 0.2, 1.5)
NOTE:
This was based entirely on the EZ Camera Shake asset for Unity3D. I was given written
permission by the developer, Road Turtle Games, to port this to Roblox.
Original asset link: https://assetstore.unity.com/packages/tools/camera/ez-camera-shake-33148
--]] |
local CameraShaker = {}
CameraShaker.__index = CameraShaker
local profileBegin = debug.profilebegin
local profileEnd = debug.profileend
local profileTag = "CameraShakerUpdate"
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local RAD = math.rad
local v3Zero = V3()
local CameraShakeInstance = require(script.CameraShakeInstance)
local CameraShakeState = CameraShakeInstance.CameraShakeState
local defaultPosInfluence = V3(0, 0, 0)
local defaultRotInfluence = V3(1, 1, 1)
CameraShaker.CameraShakeInstance = CameraShakeInstance
CameraShaker.Presets = require(script.CameraShakePresets)
function CameraShaker.new(renderPriority, callback)
assert(type(renderPriority) == "number", "RenderPriority must be a number (e.g.: Enum.RenderPriority.Camera.Value)")
assert(type(callback) == "function", "Callback must be a function")
local self = setmetatable({
_running = false;
_renderName = "CameraShaker";
_renderPriority = renderPriority;
_posAddShake = v3Zero;
_rotAddShake = v3Zero;
_camShakeInstances = {};
_removeInstances = {};
_callback = callback;
}, CameraShaker)
return self
end
function CameraShaker:Start()
if (self._running) then return end
self._running = true
local callback = self._callback
game:GetService("RunService"):BindToRenderStep(self._renderName, self._renderPriority, function(dt)
profileBegin(profileTag)
local cf = self:Update(dt)
profileEnd()
callback(cf)
end)
end
function CameraShaker:Stop()
if (not self._running) then return end
game:GetService("RunService"):UnbindFromRenderStep(self._renderName)
self._running = false
end
function CameraShaker:Update(dt)
local posAddShake = v3Zero
local rotAddShake = v3Zero
local instances = self._camShakeInstances
-- Update all instances:
for i = 1,#instances do
local c = instances[i]
local state = c:GetState()
if (state == CameraShakeState.Inactive and c.DeleteOnInactive) then
self._removeInstances[#self._removeInstances + 1] = i
elseif (state ~= CameraShakeState.Inactive) then
posAddShake = posAddShake + (c:UpdateShake(dt) * c.PositionInfluence)
rotAddShake = rotAddShake + (c:UpdateShake(dt) * c.RotationInfluence)
end
end
-- Remove dead instances:
for i = #self._removeInstances,1,-1 do
local instIndex = self._removeInstances[i]
table.remove(instances, instIndex)
self._removeInstances[i] = nil
end
return CF(posAddShake) *
ANG(0, RAD(rotAddShake.Y), 0) *
ANG(RAD(rotAddShake.X), 0, RAD(rotAddShake.Z))
end
function CameraShaker:Shake(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:ShakeSustain(shakeInstance)
assert(type(shakeInstance) == "table" and shakeInstance._camShakeInstance, "ShakeInstance must be of type CameraShakeInstance")
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
shakeInstance:StartFadeIn(shakeInstance.fadeInDuration)
return shakeInstance
end
function CameraShaker:ShakeOnce(magnitude, roughness, fadeInTime, fadeOutTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime, fadeOutTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
function CameraShaker:StartShake(magnitude, roughness, fadeInTime, posInfluence, rotInfluence)
local shakeInstance = CameraShakeInstance.new(magnitude, roughness, fadeInTime)
shakeInstance.PositionInfluence = (typeof(posInfluence) == "Vector3" and posInfluence or defaultPosInfluence)
shakeInstance.RotationInfluence = (typeof(rotInfluence) == "Vector3" and rotInfluence or defaultRotInfluence)
shakeInstance:StartFadeIn(fadeInTime)
self._camShakeInstances[#self._camShakeInstances + 1] = shakeInstance
return shakeInstance
end
return CameraShaker
|
-- +3 PETS EQUIPPED |
PetsEquippedButton.MouseEnter:Connect(function()
PetsEquippedButton.Text = "149 R$"
PetsEquippedButton.TextColor3 = Color3.fromRGB(0, 255, 0)
end)
PetsEquippedButton.MouseLeave:Connect(function()
PetsEquippedButton.Text = "BUY"
PetsEquippedButton.TextColor3 = Color3.fromRGB(255, 255, 255)
end)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.