prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--// Bar Colors // |
local Stamina_Red_Color = Color3.new(0.619608, 0.0588235, 0)
local Stamina_Yellow_Color = Color3.new(0, 0.666667, 1)
local Stamina_Green_Color = Color3.new(0, 0.666667, 1)
local Util = {}
do
function Util.IsTouchDevice()
return UserInputService.TouchEnabled
end
function Util.Create(instanceType)
return function(data)
local obj = Instance.new(instanceType)
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
else
obj[k] = v
end
end
return obj
end
end
function Util.Clamp(low, high, input)
return math.max(low, math.min(high, input))
end
function Util.DisconnectEvent(conn)
if conn then
conn:disconnect()
end
return nil
end
function Util.SetGUIInsetBounds(x1, y1, x2, y2)
GuiService:SetGlobalGuiInset(x1, y1, x2, y2)
end
local humanoidCache = {}
function Util.FindPlayerHumanoid(player)
local character = player and player.Character
if character then
local resultHumanoid = humanoidCache[player]
if resultHumanoid and resultHumanoid.Parent == character then
return resultHumanoid
else
humanoidCache[player] = nil -- Bust Old Cache
for _, child in pairs(character:GetChildren()) do
if child:IsA('Humanoid') then
humanoidCache[player] = child
return child
end
end
end
end
end
end
walking.Changed:Connect(function()
if walking.Value == false then
SprintingValue.Value = false
BreathRunningStop:Play()
elseif walking and Sprinting == true then
SprintingValue.Value = true
end
end)
UIS.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
repeat wait() until Sprinting == false
if (Sprinting == false) and (Stamina.Value > StaminaReductionRate) and script.LoadingBcsTAMINAis0.Value == false then
TS:Create(plr.Character.Humanoid, TweenInfo.new(3), {WalkSpeed = SprintSpeed}):Play()
Sprinting = true
if walking.Value == true then
SprintingValue.Value = true
end
repeat wait(StaminaReductionDelay)
if walking.Value == true and SprintingValue.Value == true then
Stamina.Value -= StaminaReductionRate
end
until Sprinting == false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end
end)
UserInputService.InputEnded:connect(function(inputkey)
if inputkey.KeyCode == Enum.KeyCode.LeftShift then
if Sprinting == true or walking.Value == false then
Sprinting = false
SprintingValue.Value = false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end
end)
if UserInputService.TouchEnabled then
StaminaButton.Visible = true
end
StaminaButton.Button.MouseButton1Down:Connect(function()
if (Sprinting == false) and (Stamina.Value > StaminaReductionRate) and script.LoadingBcsTAMINAis0.Value == false then
Border.Color = Color3.new(1, 1, 1)
Sprinting = true
TS:Create(plr.Character.Humanoid, TweenInfo.new(3), {WalkSpeed = SprintSpeed}):Play()
if walking.Value == true then
SprintingValue.Value = true
end
repeat wait(StaminaReductionDelay)
if walking.Value == true and SprintingValue.Value == true then
Stamina.Value -= StaminaReductionRate
end
until Sprinting == false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
elseif Sprinting == true and Stamina.Value < 100 then
BreathRunningStop:Play()
Border.Color = Color3.new(0, 0, 0)
SprintingValue.Value = false
Sprinting = false
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
end)
Stamina.Changed:connect(function(value)
if (value < StaminaReductionRate) then
Sprinting = false
SprintingValue.Value = false
end
local Bar = script.Parent:WaitForChild('Frame_Bar')
local Fill = script.Parent.Frame_Bar:WaitForChild('Frame_BarFill')
Fill:TweenSize(UDim2.new(value/100,0,1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, .5, true)
local healthColorToPosition = {
[Vector3.new(Stamina_Red_Color.r, Stamina_Red_Color.g, Stamina_Red_Color.b)] = 0.1;
[Vector3.new(Stamina_Yellow_Color.r, Stamina_Yellow_Color.g, Stamina_Yellow_Color.b)] = 0.5;
[Vector3.new(Stamina_Green_Color.r, Stamina_Green_Color.g, Stamina_Green_Color.b)] = 0.8;
}
local min = 0.1
local minColor = Stamina_Red_Color
local max = 0.8
local maxColor = Stamina_Green_Color
local function HealthbarColorTransferFunction(staminaPercent)
if staminaPercent < min then
return minColor
elseif staminaPercent > max then
return maxColor
end
local numeratorSum = Vector3.new(0,0,0)
local denominatorSum = 0
for colorSampleValue, samplePoint in pairs(healthColorToPosition) do
local distance = staminaPercent - samplePoint
if distance == 0 then
return Color3.new(colorSampleValue.x, colorSampleValue.y, colorSampleValue.z)
else
local wi = 1 / (distance*distance)
numeratorSum = numeratorSum + wi * colorSampleValue
denominatorSum = denominatorSum + wi
end
end
local result = numeratorSum / denominatorSum
return Color3.new(result.x, result.y, result.z)
end
local staminaPercent = Stamina.Value / 100
if Stamina.Value < 3 then
Border.Color = Color3.new(0, 0, 0)
TS:Create(plr.Character.Humanoid, TweenInfo.new(1.2), {WalkSpeed = OriginalWalkSpeed}):Play()
end
staminaPercent = Util.Clamp(0, 1, staminaPercent)
local staminaColor = HealthbarColorTransferFunction(staminaPercent)
Fill.BackgroundColor3 = staminaColor
if Stamina.Value > 99 then
script.LoadingBcsTAMINAis0.Value = false
SprintGui:WaitForChild("Frame_Bar"):TweenPosition(UDim2.new(0.5, 0, 1, SprintGui:WaitForChild("Frame_Bar").AbsoluteSize.Y + 1), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.75, true)
else
SprintGui:WaitForChild("Frame_Bar"):TweenPosition(UDim2.new(0.5, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quart, 0.25, true)
if Stamina.Value < 40 then
BreathRunning:Play()
elseif Stamina.Value > 41 then
BreathRunningStop:Play()
end
end
end)
SprintingValue.Changed:Connect(function()
if SprintingValue.Value == false then
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = false
wait(0.01)
script.CanFill.Value = true
end
end)
Stamina.Changed:Connect(function()
if Stamina.Value < 0 then
Stamina.Value = 0
elseif Stamina.Value >= 100 then
Stamina.Value = 100
end
end)
Stamina.Changed:Connect(function()
if Stamina.Value < 3 then
script.LoadingBcsTAMINAis0.Value = true
elseif Stamina.Value >= 98 then
script.LoadingBcsTAMINAis0.Value = false
end
end)
while true do
wait(RegenerateDelay)
if (SprintingValue.Value == false) and (Stamina.Value < 100) and (script.CanFill.Value == true) then
Stamina.Value = Stamina.Value + RegenerateValue
end
end
|
-- print("Script "..i.Name.." detected in "..getAncestry(i).." ("..i.className..")") |
end
end
for x = 1, #maliciousobjects do
if i.Name == maliciousobjects[x] then |
-- Feed the Humanoid this script is attached to, then remove their food and attach poisonScript |
if hungryHumanoid and hungryHumanoid:IsA("Humanoid") and hungryHumanoid.Parent then
local food = hungryHumanoid.Parent:FindFirstChild("Food")
local eatAnimTrack = hungryHumanoid:LoadAnimation(eatAnimation)
if eatAnimTrack then eatAnimTrack:Play() end
wait(2.2) -- Nom nom nom
if food then food:Destroy() end
end
wait(20)
script:Destroy()
|
--> LOCAL VARIABLES |
local FlareBullet = script.Parent
local Force = FlareBullet:WaitForChild("BodyVelocity")
local FireSound = FlareBullet:WaitForChild("Fire")
local BulletVelocity = FlareBullet:WaitForChild("BulletVelocity").Value
local LookVector = FlareBullet.CFrame.lookVector
local Flames = FlareBullet:WaitForChild("Flames")
|
--[[
CameraShakePresets.Bump
CameraShakePresets.Explosion
CameraShakePresets.Earthquake
CameraShakePresets.BadTrip
CameraShakePresets.HandheldCamera
CameraShakePresets.Vibration
CameraShakePresets.RoughDriving
--]] |
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakePresets = {
-- A high-magnitude, short, yet smooth shake.
-- Should happen once.
Bump = function()
local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
-- An intense and rough shake.
-- Should happen once.
Explosion = function()
local c = CameraShakeInstance.new(3, 10, 0, 1.2)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(4, 1, 1)
return c
end;
-- A continuous, rough shake
-- Sustained.
Earthquake = function()
local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(1, 1, 4)
return c
end;
-- A bizarre shake with a very high magnitude and low roughness.
-- Sustained.
BadTrip = function()
local c = CameraShakeInstance.new(10, 0.15, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 4)
return c
end;
-- A subtle, slow shake.
-- Sustained.
HandheldCamera = function()
local c = CameraShakeInstance.new(1, 0.25, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
return c
end;
-- A very rough, yet low magnitude shake.
-- Sustained.
Vibration = function()
local c = CameraShakeInstance.new(0.4, 20, 2, 2)
c.PositionInfluence = Vector3.new(0, 0.15, 0)
c.RotationInfluence = Vector3.new(1.25, 0, 4)
return c
end;
-- A slightly rough, medium magnitude shake.
-- Sustained.
RoughDriving = function()
local c = CameraShakeInstance.new(1, 2, 1, 1)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
}
return setmetatable({}, {
__index = function(t, i)
local f = CameraShakePresets[i]
if (type(f) == "function") then
return f()
end
error("No preset found with index \"" .. i .. "\"")
end;
})
|
-- Create component |
local Explorer = Roact.PureComponent:extend 'Explorer'
function Explorer:init(props)
self:setState {
Items = {},
RowHeight = 18
}
-- Update batching data
self.UpdateQueues = {}
self.QueueTimers = {}
-- Item tracking data
self.LastId = 0
self.IdMap = {}
self.PendingParent = {}
-- Define item expanding function
self.ToggleExpand = function (ItemId)
return self:setState(function (State)
local Item = State.Items[ItemId]
Item.Expanded = not Item.Expanded
return { Items = State.Items }
end)
end
end
function Explorer:didUpdate(previousProps, previousState)
-- Trigger a scope change if prop changes
if previousProps.Scope ~= self.props.Scope then
self:UpdateScope(self.props.Scope)
end
end
function Explorer:UpdateScope(Scope)
local Core = self.props.Core
local Selection = Core.Selection
-- Clear previous cleanup maid
if self.ScopeMaid then
self.ScopeMaid:Destroy()
end
-- Create maid for cleanup
self.ScopeMaid = Maid.new()
-- Ensure new scope is defined
if not Scope then
return
end
-- Build initial tree
coroutine.resume(coroutine.create(function ()
self:UpdateTree()
-- Scroll to first selected item
if #Selection.Items > 0 then
local FocusedItem = Selection.IsSelected(Selection.Focus) and Selection.Focus or Selection.Items[1]
self:setState({
ScrollTo = self.IdMap[FocusedItem]
})
else
self:setState({
ScrollTo = Roact.None
})
end
end))
-- Listen for new and removing items
local Scope = Core.Targeting.Scope
self.ScopeMaid.Add = Scope.DescendantAdded:Connect(function (Item)
self:UpdateTree()
end)
self.ScopeMaid.Remove = Scope.DescendantRemoving:Connect(function (Item)
self:UpdateTree()
end)
-- Listen for selected items
self.ScopeMaid.Select = Selection.ItemsAdded:Connect(function (Items)
self:UpdateSelection(Items)
-- If single item selected, get item state
local ItemId = (#Items == 1) and self.IdMap[Items[1]]
-- Expand ancestors leading to item
self:setState(function (State)
local Changes = {}
local ItemState = State.Items[ItemId]
local ParentId = ItemState and self.IdMap[ItemState.Parent]
local ParentState = ParentId and State.Items[ParentId]
while ParentState do
ParentState.Expanded = true
Changes[ParentId] = ParentState
ParentId = self.IdMap[ParentState.Parent]
ParentState = State.Items[ParentId]
end
return {
Items = Support.Merge(State.Items, Changes),
ScrollTo = ItemId
}
end)
end)
self.ScopeMaid.Deselect = Selection.ItemsRemoved:Connect(function (Items)
self:UpdateSelection(Items)
end)
end
function Explorer:didMount()
self.Mounted = true
-- Create maid for cleanup on unmount
self.ItemMaid = Maid.new()
-- Set scope
self:UpdateScope(self.props.Scope)
end
function Explorer:willUnmount()
self.Mounted = false
-- Clean up resources
self.ScopeMaid:Destroy()
self.ItemMaid:Destroy()
end
local function IsTargetable(Item)
return Item:IsA 'Model' or
Item:IsA 'BasePart' or
Item:IsA 'Tool' or
Item:IsA 'Accessory' or
Item:IsA 'Accoutrement'
end
function Explorer.IsItemIndexable(Item)
return (IsTargetable(Item) and Item.ClassName ~= 'Terrain') or
Item:IsA 'Folder'
end
function Explorer:UpdateTree()
-- Check if queue should be executed
if not self:ShouldExecuteQueue('Tree') then
return
end
-- Track order of each item
local OrderCounter = 1
local IdMap = self.IdMap
-- Perform update to state
self:setState(function (State)
local Changes = {}
local Descendants = self.props.Scope:GetDescendants()
local DescendantMap = Support.FlipTable(Descendants)
-- Check all items in scope
for Index, Item in ipairs(Descendants) do
local ItemId = IdMap[Item]
local ItemState = ItemId and State.Items[ItemId]
-- Update reordered items
if ItemState then
if ItemState.Order ~= OrderCounter then
ItemState = Support.CloneTable(ItemState)
ItemState.Order = OrderCounter
Changes[ItemId] = ItemState
end
OrderCounter = OrderCounter + 1
-- Update parents in case scope changed
local ParentId = self.IdMap[ItemState.Parent]
if not State.Items[ParentId] then
self:UpdateItemParent(Item, Changes, State)
end
-- Introduce new items
elseif self:BuildItemState(Item, self.props.Scope, OrderCounter, Changes, State) then
OrderCounter = OrderCounter + 1
end
end
-- Remove old items from state
for ItemId, Item in pairs(State.Items) do
local Object = Item.Instance
if not DescendantMap[Object] then
-- Clear state
Changes[ItemId] = Support.Blank
-- Clear ID
IdMap[Object] = nil
-- Clean up resources
self.ItemMaid[ItemId] = nil
-- Update parent child counter
local ParentId = Item.Parent and self.IdMap[Item.Parent]
local ParentState = self:GetStagedItemState(ParentId, Changes, State)
if ParentState then
ParentState.Children[ItemId] = nil
ParentState.Unlocked[ItemId] = nil
ParentState.IsLocked = next(ParentState.Children) and not next(ParentState.Unlocked)
Changes[ParentId] = ParentState
self:PropagateLock(ParentState, Changes, State)
end
end
end
-- Update state
return { Items = Support.MergeWithBlanks(State.Items, Changes) }
end)
end
function Explorer:UpdateSelection(Items)
local Selection = self.props.Core.Selection
-- Queue changed items
self:QueueUpdate('Selection', Items)
-- Check if queue should be executed
if not self:ShouldExecuteQueue('Selection') then
return
end
-- Perform updates to state
self:setState(function (State)
local Changes = {}
local Queue = self:GetUpdateQueue('Selection')
for Items in pairs(Queue) do
for _, Item in ipairs(Items) do
local ItemId = self.IdMap[Item]
if ItemId then
local ItemState = Support.CloneTable(State.Items[ItemId])
ItemState.Selected = Selection.IsSelected(Item)
Changes[ItemId] = ItemState
end
end
end
return { Items = Support.Merge(State.Items, Changes) }
end)
end
function Explorer:BuildItemState(Item, Scope, Order, Changes, State)
local Parent = Item.Parent
local ParentId = self.IdMap[Parent]
-- Check if indexable and visible in hierarchy
local InHierarchy = ParentId or (Parent == Scope)
if not (self.IsItemIndexable(Item) and InHierarchy) then
return nil
end
-- Assign ID
local ItemId = self.LastId + 1
self.LastId = ItemId
self.IdMap[Item] = ItemId
-- Check if item is a part
local IsPart = Item:IsA 'BasePart'
-- Create maid for cleanup when item is removed
local ItemMaid = Maid.new()
self.ItemMaid[ItemId] = ItemMaid
-- Prepare item state
local ItemState = {
Id = ItemId,
Name = Item.Name,
IsPart = IsPart,
IsLocked = IsPart and Item.Locked or nil,
Class = Item.ClassName,
Parent = Parent,
Children = {},
Unlocked = {},
Order = Order,
Expanded = nil,
Instance = Item,
Selected = self.props.Core.Selection.IsSelected(Item) or nil
}
-- Register item state into changes
Changes[ItemId] = ItemState
-- Update parent children
local ParentState = self:GetStagedItemState(ParentId, Changes, State)
if ParentState then
ParentState.Children[ItemId] = true
Changes[ParentId] = ParentState
end
-- Update children
for PendingChildId in pairs(self.PendingParent[Item] or {}) do
local ChildState = self:GetStagedItemState(PendingChildId, Changes, State)
if ChildState then
ItemState.Children[PendingChildId] = true
self:PropagateLock(ChildState, Changes, State)
end
end
-- Propagate lock to ancestors
self:PropagateLock(ItemState, Changes, State)
-- Listen to name changes
ItemMaid.Name = Item:GetPropertyChangedSignal('Name'):Connect(function ()
-- Queue change
self:QueueUpdate('Name', Item)
-- Check if queue should be executed
if not self:ShouldExecuteQueue('Name') then
return
end
-- Perform updates to state
self:setState(function (State)
local Changes = {}
local Queue = self:GetUpdateQueue('Name')
for Item in pairs(Queue) do
local ItemId = self.IdMap[Item]
local ItemState = Support.CloneTable(State.Items[ItemId])
ItemState.Name = Item.Name
Changes[ItemId] = ItemState
end
return { Items = Support.Merge(State.Items, Changes) }
end)
end)
-- Listen to parent changes
ItemMaid.Parent = Item:GetPropertyChangedSignal('Parent'):Connect(function ()
if not Item.Parent then
return
end
-- Queue change
self:QueueUpdate('Parent', Item)
-- Check if queue should be executed
if not self:ShouldExecuteQueue('Parent') then
return
end
-- Perform updates to state
self:setState(function (State)
local Changes = {}
local Queue = self:GetUpdateQueue('Parent')
for Item in pairs(Queue) do
self:UpdateItemParent(Item, Changes, State)
end
return { Items = Support.MergeWithBlanks(State.Items, Changes) }
end)
-- Update tree state
self:UpdateTree()
end)
-- Attach part-specific listeners
if IsPart then
ItemMaid.Locked = Item:GetPropertyChangedSignal('Locked'):Connect(function ()
-- Queue change
self:QueueUpdate('Lock', Item)
-- Check if queue should be executed
if not self:ShouldExecuteQueue('Lock') then
return
end
-- Perform updates to state
self:setState(function (State)
local Changes = {}
local Queue = self:GetUpdateQueue('Lock')
for Item in pairs(Queue) do
self:UpdateItemLock(Item, Changes, State)
end
return { Items = Support.MergeWithBlanks(State.Items, Changes) }
end)
end)
end
-- Indicate that item state was created
return true
end
function Explorer:QueueUpdate(Type, Item)
self.UpdateQueues[Type] = Support.Merge(self.UpdateQueues[Type] or {}, {
[Item] = true
})
end
function Explorer:GetUpdateQueue(Type)
-- Get queue
local Queue = self.UpdateQueues[Type]
self.UpdateQueues[Type] = nil
-- Return queued items
return Queue
end
function Explorer:ShouldExecuteQueue(Type)
local ShouldExecute = self.QueueTimers[Type] or Support.CreateConsecutiveCallDeferrer(0.025)
self.QueueTimers[Type] = ShouldExecute
-- Wait until state updatable
if ShouldExecute() and self.Mounted then
return true
end
end
function Explorer:UpdateItemLock(Item, Changes, State)
-- Get staged item state
local ItemId = self.IdMap[Item]
local ItemState = self:GetStagedItemState(ItemId, Changes, State)
if not ItemState then
return
end
-- Update state
ItemState.IsLocked = Item.Locked
Changes[ItemId] = ItemState
-- Propagate lock state up hierarchy
self:PropagateLock(ItemState, Changes, State)
end
function Explorer:GetStagedItemState(ItemId, Changes, State)
-- Check if item staged yet
local StagedItemState = ItemId and Changes[ItemId]
-- Ensure item still exists
if not ItemId or (StagedItemState == Support.Blank) or
not (StagedItemState or State.Items[ItemId]) then
return
end
-- Return staged item state
return StagedItemState or Support.CloneTable(State.Items[ItemId])
end
function Explorer:UpdateItemParent(Item, Changes, State)
-- Get staged item state
local ItemId = self.IdMap[Item]
local ItemState = self:GetStagedItemState(ItemId, Changes, State)
if not ItemState then
return
end
-- Get current parent ID
local PreviousParentId = ItemState.Parent and self.IdMap[ItemState.Parent]
-- Set new parent ID
local Parent = Item.Parent
local ParentId = self.IdMap[Parent]
ItemState.Parent = Parent
Changes[ItemId] = ItemState
-- Queue parenting if parent item valid, but not yet registered
if not ParentId and not (Parent == Scope) then
if Parent:IsDescendantOf(Scope) then
self.PendingParent[Parent] = Support.Merge(self.PendingParent[Parent] or {}, { [ItemId] = true })
end
end
-- Update previous parent
local PreviousParentState = self:GetStagedItemState(PreviousParentId, Changes, State)
if PreviousParentState then
PreviousParentState.Children[ItemId] = nil
PreviousParentState.Unlocked[ItemId] = nil
PreviousParentState.IsLocked = next(PreviousParentState.Children) and not next(PreviousParentState.Unlocked)
Changes[PreviousParentId] = PreviousParentState
end
-- Update new parent
local ParentState = self:GetStagedItemState(ParentId, Changes, State)
if ParentState then
ParentState.Children[ItemId] = true
Changes[ParentId] = ParentState
self:PropagateLock(ItemState, Changes, State)
end
end
function Explorer:PropagateLock(ItemState, Changes, State)
-- Continue if upward propagation is possible
if not ItemState.Parent then
return
end
-- Start propagation from changed item
local ItemId = ItemState.Id
local ItemState = ItemState
-- Get item's parent state
repeat
local Parent = ItemState.Parent
local ParentId = Parent and self.IdMap[Parent]
local ParentState = self:GetStagedItemState(ParentId, Changes, State)
if ParentState then
-- Update parent lock state
ParentState.Unlocked[ItemId] = (not ItemState.IsLocked) and true or nil
ParentState.IsLocked = next(ParentState.Children) and not next(ParentState.Unlocked)
Changes[ParentId] = ParentState
-- Continue propagation upwards in the hierarchy
ItemId = ParentId
ItemState = ParentState
-- Stop propagation if parent being removed
else
ItemId = nil
ItemState = nil
end
-- Stop at highest reachable point in hierarchy
until
not ItemState
end
function Explorer:render()
local props = self.props
local state = self.state
-- Display window
return new(ImageLabel, {
Active = true,
Layout = 'List',
LayoutDirection = 'Vertical',
AnchorPoint = Vector2.new(1, 0),
Position = UDim2.new(1, -100, 0.6, -380/2),
Width = UDim.new(0, 145),
Height = 'WRAP_CONTENT',
Image = 'rbxassetid://2244248341',
ScaleType = 'Slice',
SliceCenter = Rect.new(4, 4, 12, 12),
ImageTransparency = 1 - 0.93,
ImageColor = '3B3B3B'
},
{
-- Window header
Header = new(TextLabel, {
Text = ' EXPLORER',
TextSize = 9,
Height = UDim.new(0, 14),
TextColor = 'FFFFFF',
TextTransparency = 1 - 0.6/2
},
{
CloseButton = new(ImageButton, {
Image = 'rbxassetid://2244452978',
ImageRectOffset = Vector2.new(0, 0),
ImageRectSize = Vector2.new(14, 14) * 2,
AspectRatio = 1,
AnchorPoint = Vector2.new(1, 0.5),
Position = UDim2.new(1, 0, 0.5, 0),
ImageTransparency = 1 - 0.34,
[Roact.Event.Activated] = props.Close
})
}),
-- Scrollable item list
ItemList = new(ItemList, {
Scope = props.Scope,
Items = state.Items,
ScrollTo = state.ScrollTo,
Core = props.Core,
IdMap = self.IdMap,
RowHeight = state.RowHeight,
ToggleExpand = self.ToggleExpand
})
})
end
return Explorer
|
--]] |
local RaycastHitbox = {
Version = "3.3",
AttachmentName = "DmgPoint",
DebugMode = false,
WarningMessage = false
}
|
-- you can mess with these settings |
local easingtime = 0.1 --0~1
local walkspeeds = {
enabled = true;
walkingspeed = 16;
backwardsspeed = 10;
sidewaysspeed = 15;
diagonalspeed = 16;
runningspeed = 25;
runningFOV= 100;
}
|
-- Modules |
local ModuleScripts = ReplicatedStorage.ModuleScripts
local WaypointController = require(script.WaypointController)
local GameSettings = require(ModuleScripts.GameSettings)
|
--// Handling Settings |
Firerate = 60 / 80; -- 60 = 1 Minute, 700 = Rounds per that 60 seconds. DO NOT TOUCH THE 60!
FireMode = 1; -- 1 = Semi, 2 = Auto, 3 = Burst, 4 = Bolt Action, 5 = Shot, 6 = Explosive
|
-- script to kill the teleport delay if they step off the teleporter (checked by taking the point distance from torso center to teleport pad center) |
local teleDelay = script.Parent
if teleDelay ~= nil then
local telePos = teleDelay.Value
teleDelay.Value = Vector3.new(math.huge, math.huge, math.huge) -- signals that we've retrieved this value (acts as a lock: super-gross hack; a little part of me died when I coded this D': )
local vChar = teleDelay.Parent
if vChar ~= nil and telePos ~= nil then
local vTorso = vChar:FindFirstChild("Torso")
if vTorso ~= nil then
while (vTorso.Position - telePos):Dot(vTorso.Position - telePos) < 25 do -- currently hard-coded to the right distance
wait(.1)
end
teleDelay:remove()
end
end
end
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name
--// Be sure to update the console gui's code if you change stuff |
return function(data, env)
if env then
setfenv(1, env)
end
local client, cPcall, Pcall, Routine, service, gTable =
client, cPcall, Pcall, Routine, service, gTable
local gui = script.Parent.Parent
local localplayer = service.Player
local mouse = localplayer:GetMouse()
local playergui = service.PlayerGui
local storedChats = client.Variables.StoredChats
local desc = gui.Desc
local nohide = data.KeepChat
local function Expand(ent, point)
ent.MouseLeave:Connect(function(x, y)
point.Visible = false
end)
ent.MouseMoved:Connect(function(x, y)
point.Text = ent.Desc.Value
point.Size = UDim2.new(0, 10000, 0, 10000)
local bounds = point.TextBounds.X
local rows = math.floor(bounds / 500)
rows = rows + 1
if rows < 1 then
rows = 1
end
local newx = 500
if bounds < 500 then
newx = bounds
end
point.Visible = true
point.Size = UDim2.new(0, newx + 10, 0, rows * 20)
point.Position = UDim2.new(0, x, 0, y - 40 - (rows * 20))
end)
end
local function UpdateChat()
if gui then
local globalTab = gui.Drag.Frame.Frame.Global
local teamTab = gui.Drag.Frame.Frame.Team
local localTab = gui.Drag.Frame.Frame.Local
local adminsTab = gui.Drag.Frame.Frame.Admins
local crossTab = gui.Drag.Frame.Frame.Cross
local entry = gui.Entry
local tester = gui.BoundTest
globalTab:ClearAllChildren()
teamTab:ClearAllChildren()
localTab:ClearAllChildren()
adminsTab:ClearAllChildren()
crossTab:ClearAllChildren()
local globalNum = 0
local teamNum = 0
local localNum = 0
local adminsNum = 0
local crossNum = 0
for i, v in storedChats do
local clone = entry:Clone()
clone.Message.Text = service.MaxLen(v.Message, 100)
clone.Desc.Value = v.Message
Expand(clone, desc)
if not string.match(v.Player, "%S") then
clone.Nameb.Text = v.Player
else
clone.Nameb.Text = `[{v.Player}]: `
end
clone.Visible = true
clone.Nameb.Font = "SourceSansBold"
local color = v.Color or BrickColor.White()
clone.Nameb.TextColor3 = color.Color
tester.Text = `[{v.Player}]: `
local naml = tester.TextBounds.X + 5
if naml > 100 then
naml = 100
end
tester.Text = v.Message
local mesl = tester.TextBounds.X
clone.Message.Position = UDim2.new(0, naml, 0, 0)
clone.Message.Size = UDim2.new(1, -(naml + 10), 1, 0)
clone.Nameb.Size = UDim2.new(0, naml, 0, 20)
clone.Visible = false
clone.Parent = globalTab
local rows = math.floor((mesl + naml) / clone.AbsoluteSize.X)
rows = rows + 1
if rows < 1 then
rows = 1
end
if rows > 3 then
rows = 3
end
--rows = rows+1
clone.Parent = nil
clone.Visible = true
clone.Size = UDim2.new(1, 0, 0, rows * 20)
if v.Private then
clone.Nameb.TextColor3 = Color3.new(0.58823529411765, 0.22352941176471, 0.69019607843137)
end
if v.Mode == "Global" then
clone.Position = UDim2.new(0, 0, 0, globalNum * 20)
globalNum = globalNum + 1
if rows > 1 then
globalNum = globalNum + rows - 1
end
clone.Parent = globalTab
elseif v.Mode == "Team" then
clone.Position = UDim2.new(0, 0, 0, teamNum * 20)
teamNum = teamNum + 1
if rows > 1 then
teamNum = teamNum + rows - 1
end
clone.Parent = teamTab
elseif v.Mode == "Local" then
clone.Position = UDim2.new(0, 0, 0, localNum * 20)
localNum = localNum + 1
if rows > 1 then
localNum = localNum + rows - 1
end
clone.Parent = localTab
elseif v.Mode == "Admins" then
clone.Position = UDim2.new(0, 0, 0, adminsNum * 20)
adminsNum = adminsNum + 1
if rows > 1 then
adminsNum = adminsNum + rows - 1
end
clone.Parent = adminsTab
elseif v.Mode == "Cross" then
clone.Position = UDim2.new(0, 0, 0, crossNum * 20)
crossNum = crossNum + 1
if rows > 1 then
crossNum = crossNum + rows - 1
end
clone.Parent = crossTab
end
end
globalTab.CanvasSize = UDim2.new(0, 0, 0, ((globalNum) * 20))
teamTab.CanvasSize = UDim2.new(0, 0, 0, ((teamNum) * 20))
localTab.CanvasSize = UDim2.new(0, 0, 0, ((localNum) * 20))
adminsTab.CanvasSize = UDim2.new(0, 0, 0, ((adminsNum) * 20))
crossTab.CanvasSize = UDim2.new(0, 0, 0, ((crossNum) * 20))
local glob = (((globalNum) * 20) - globalTab.AbsoluteWindowSize.Y)
local tea = (((teamNum) * 20) - teamTab.AbsoluteWindowSize.Y)
local loc = (((localNum) * 20) - localTab.AbsoluteWindowSize.Y)
local adm = (((adminsNum) * 20) - adminsTab.AbsoluteWindowSize.Y)
local cro = (((crossNum) * 20) - crossTab.AbsoluteWindowSize.Y)
if glob < 0 then
glob = 0
end
if tea < 0 then
tea = 0
end
if loc < 0 then
loc = 0
end
if adm < 0 then
adm = 0
end
if cro < 0 then
cro = 0
end
globalTab.CanvasPosition = Vector2.new(0, glob)
teamTab.CanvasPosition = Vector2.new(0, tea)
localTab.CanvasPosition = Vector2.new(0, loc)
adminsTab.CanvasPosition = Vector2.new(0, adm)
crossTab.CanvasPosition = Vector2.new(0, cro)
end
end
if not storedChats then
client.Variables.StoredChats = {}
storedChats = client.Variables.StoredChats
end
gTable:Ready()
local bubble = gui.Bubble
local toggle = gui.Toggle
local drag = gui.Drag
local frame = gui.Drag.Frame
local frame2 = gui.Drag.Frame.Frame
local box = gui.Drag.Frame.Chat
local globalTab = gui.Drag.Frame.Frame.Global
local teamTab = gui.Drag.Frame.Frame.Team
local localTab = gui.Drag.Frame.Frame.Local
local adminsTab = gui.Drag.Frame.Frame.Admins
local crossTab = gui.Drag.Frame.Frame.Cross
local global = gui.Drag.Frame.Global
local team = gui.Drag.Frame.Team
local localb = gui.Drag.Frame.Local
local admins = gui.Drag.Frame.Admins
local cross = gui.Drag.Frame.Cross
if not nohide then
client.Variables.CustomChat = true
client.Variables.ChatEnabled = false
service.StarterGui:SetCoreGuiEnabled('Chat', false)
else
drag.Position = UDim2.new(0, 10, 1, -180)
end
local dragger = gui.Drag.Frame.Dragger
local fakeDrag = gui.Drag.Frame.FakeDragger
local boxFocused = false
local mode = "Global"
local lastChat = 0
local lastClick = 0
local isAdmin = client.Remote.Get("CheckAdmin")
if not isAdmin then
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
if client.UI.Get("HelpButton") then
toggle.Position = UDim2.new(1, -90, 1, -45)
end
local function openGlobal()
globalTab.Visible = true
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = false
global.Text = "Global"
mode = "Global"
global.BackgroundTransparency = 0
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openTeam()
globalTab.Visible = false
teamTab.Visible = true
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = false
team.Text = "Team"
mode = "Team"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0
localb.BackgroundTransparency = 0.5
admins.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openLocal()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = true
adminsTab.Visible = false
crossTab.Visible = false
localb.Text = "Local"
mode = "Local"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0
admins.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openAdmins()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = true
crossTab.Visible = false
admins.Text = "Admins"
mode = "Admins"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0
admins.TextTransparency = 0
cross.BackgroundTransparency = 0.5
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function openCross()
globalTab.Visible = false
teamTab.Visible = false
localTab.Visible = false
adminsTab.Visible = false
crossTab.Visible = true
cross.Text = "Cross"
mode = "Cross"
global.BackgroundTransparency = 0.5
team.BackgroundTransparency = 0.5
localb.BackgroundTransparency = 0.5
if isAdmin then
admins.BackgroundTransparency = 0.5
admins.TextTransparency = 0
cross.BackgroundTransparency = 0
cross.TextTransparency = 0
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
end
local function fadeIn()
--[[
frame.BackgroundTransparency = 0.5
frame2.BackgroundTransparency = 0.5
box.BackgroundTransparency = 0.5
for i=0.1,0.5,0.1 do
--wait(0.1)
frame.BackgroundTransparency = 0.5-i
frame2.BackgroundTransparency = 0.5-i
box.BackgroundTransparency = 0.5-i
end-- Disabled ]]
frame.BackgroundTransparency = 0
frame2.BackgroundTransparency = 0
box.BackgroundTransparency = 0
fakeDrag.Visible = true
end
local function fadeOut()
--[[
frame.BackgroundTransparency = 0
frame2.BackgroundTransparency = 0
box.BackgroundTransparency = 0
for i=0.1,0.5,0.1 do
--wait(0.1)
frame.BackgroundTransparency = i
frame2.BackgroundTransparency = i
box.BackgroundTransparency = i
end-- Disabled ]]
frame.BackgroundTransparency = 0.7
frame2.BackgroundTransparency = 1
box.BackgroundTransparency = 1
fakeDrag.Visible = false
end
fadeOut()
frame.MouseEnter:Connect(function()
fadeIn()
end)
frame.MouseLeave:Connect(function()
if not boxFocused then
fadeOut()
end
end)
toggle.MouseButton1Click:Connect(function()
if drag.Visible then
drag.Visible = false
toggle.Image = "rbxassetid://417301749"--417285299"
else
drag.Visible = true
toggle.Image = "rbxassetid://417301773"--417285351"
end
end)
global.MouseButton1Click:Connect(function()
openGlobal()
end)
team.MouseButton1Click:Connect(function()
openTeam()
end)
localb.MouseButton1Click:Connect(function()
openLocal()
end)
admins.MouseButton1Click:Connect(function()
if isAdmin or tick() - lastClick > 5 then
isAdmin = client.Remote.Get("CheckAdmin")
if isAdmin then
openAdmins()
else
admins.BackgroundTransparency = 0.8
admins.TextTransparency = 0.8
end
lastClick = tick()
end
end)
cross.MouseButton1Click:Connect(function()
if isAdmin or tick() - lastClick > 5 then
isAdmin = client.Remote.Get("CheckAdmin")
if isAdmin then
openCross()
else
cross.BackgroundTransparency = 0.8
cross.TextTransparency = 0.8
end
lastClick = tick()
end
end)
box.FocusLost:Connect(function(enterPressed)
boxFocused = false
if enterPressed and not client.Variables.Muted then
if box.Text ~= '' and ((mode ~= "Cross" and tick() - lastChat >= 0.5) or (mode == "Cross" and tick() - lastChat >= 10)) then
if not client.Variables.Muted then
client.Remote.Send('ProcessCustomChat', box.Text, mode)
lastChat = tick()
end
elseif not ((mode ~= "Cross" and tick() - lastChat >= 0.5) or (mode == "Cross" and tick() - lastChat >= 10)) then
local tim
if mode == "Cross" then
tim = 10 - (tick() - lastChat)
else
tim = 0.5 - (tick() - lastChat)
end
tim = string.sub(tostring(tim), 1, 3)
client.Handlers.ChatHandler("SpamBot", `Sending too fast! Please wait {tim} seconds.`, "System")
end
box.Text = "Click here or press the '/' key to chat"
fadeOut()
if mode ~= "Cross" then
lastChat = tick()
end
end
end)
box.Focused:Connect(function()
boxFocused = true
if box.Text == "Click here or press the '/' key to chat" then
box.Text = ''
end
fadeIn()
end)
if not nohide then
service.UserInputService.InputBegan:Connect(function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and InputObject.UserInputType == Enum.UserInputType.Keyboard and InputObject.KeyCode == Enum.KeyCode.Slash then
if box.Text == "Click here or press the '/' key to chat" then
box.Text = ''
end
service.RunService.RenderStepped:Wait()
box:CaptureFocus()
end
end)
end
local dragging = false
local nx, ny = drag.AbsoluteSize.X, frame.AbsoluteSize.Y --450,200
local defx, defy = nx, ny
mouse.Move:Connect(function(x, y)
if dragging then
nx = math.clamp(defx + (dragger.Position.X.Offset + 20), 1, 260)
ny = math.clamp(defy + (dragger.Position.Y.Offset + 20), 1, 100)
frame.Size = UDim2.new(1, 0, 0, ny)
drag.Size = UDim2.new(0, nx, 0, 30)
end
end)
dragger.DragBegin:Connect(function(init)
dragging = true
end)
dragger.DragStopped:Connect(function(x, y)
dragging = false
defx = nx
defy = ny
dragger.Position = UDim2.new(1, -20, 1, -20)
UpdateChat()
end)
UpdateChat()
|
-- Useful functions |
local function vertShape(cf, size2, array)
local output = {}
for i = 1, #array do
output[i] = cf:PointToWorldSpace(array[i] * size2)
end
return output
end
local function getCentroidFromSet(set)
local sum = set[1]
for i = 2, #set do
sum = sum + set[2]
end
return sum / #set
end
local function classify(part)
if (part.ClassName == "Part") then
if (part.Shape == Enum.PartType.Block) then
return "Block"
elseif (part.Shape == Enum.PartType.Cylinder) then
return "Cylinder"
elseif (part.Shape == Enum.PartType.Ball) then
return "Ball"
end;
elseif (part.ClassName == "WedgePart") then
return "Wedge"
elseif (part.ClassName == "CornerWedgePart") then
return "CornerWedge"
elseif (part:IsA("BasePart")) then -- mesh, CSG, truss, etc... just use block
return "Block"
end
end
|
--[[
(Yields) Animates the camera to pan into a specific art spot on the wall.
Target position: Center of the SurfaceSpot that we want to animate to (in studs)
Parameters:
- spot (Instance) - Frame of the target SurfaceSpot to animate to
]] |
function CameraModule:animateToSpotAsync(spot)
self.camera.CameraType = Enum.CameraType.Scriptable
local adornee = self.surfaceGui.Adornee
local face = self.surfaceGui.Face
-- Calculate the actual position of the center of spot (in studs)
local spotPosition = self:getSpotPosition(self.surfaceGui, spot)
-- Make sure we're facing the surface at an offset
local offset = adornee.CFrame:VectorToWorldSpace(Vector3.FromNormalId(face))
local function getDistanceToSpot(fov, size, viewportSize)
local angle = math.rad(fov / 2)
local opp = (size / 2) / self.surfaceGui.PixelsPerStud
local distance = opp / math.tan(angle)
-- Move camera back based on ratio of viewport size
distance *= (viewportSize / constants.SurfaceArtSelectorItemSize)
return distance
end
local aspectRatio = self.camera.ViewportSize.X / self.camera.ViewportSize.Y
local vertical = getDistanceToSpot(self.camera.FieldOfView, spot.AbsoluteSize.Y, self.camera.ViewportSize.Y)
local horizontal = getDistanceToSpot(
self.camera.FieldOfView * aspectRatio,
spot.AbsoluteSize.X,
self.camera.ViewportSize.X
)
local distance = math.max(horizontal, vertical)
distance = math.clamp(distance, MIN_STUDS_OFFSET, MAX_STUDS_OFFSET)
offset *= distance
local upVector = self:_getUpVectorByFace(adornee.CFrame, face)
local target = CFrame.lookAt(spotPosition + offset, spotPosition, upVector)
-- Top view has a weird bug that turns things upside down
if face == Enum.NormalId.Top then
target *= CFrame.Angles(0, 0, math.pi)
end
self:_tweenCamera(target)
end
|
-- body.FB.BrickColor = bool and BrickColor.new("Pearl") or BrickColor.new("Black") |
body.FB.Material = bool and "Neon" or "SmoothPlastic"
body.RB.BrickColor = bool and BrickColor.new("Really red") or BrickColor.new("Really red")
body.RB.Material = bool and "Neon" or "SmoothPlastic"
tk.Rb.BrickColor = bool and BrickColor.new("Really red") or BrickColor.new("Really red")
tk.Rb.Material = bool and "Neon" or "SmoothPlastic"
body.L.Light.Enabled = bool
car.DriveSeat.Lights.Value = bool
end
end
local b = ''
function Toggle(dir, tog)
if dir == 'Left' then
body.RLeft.Material = tog and "Neon" or "SmoothPlastic"
body.RLeft.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.LeftIn.Transparency = tog and 0 or 1
car.Misc.FL.Door.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FL.Door.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.LI.Value = tog
elseif dir == 'Right' then
body.RRight.Material = tog and "Neon" or "SmoothPlastic"
body.RRight.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.RightIn.Transparency = tog and 0 or 1
car.Misc.FR.Door.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FR.Door.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.RI.Value = tog
elseif dir == 'Hazards' then
body.RLeft.Material = tog and "Neon" or "SmoothPlastic"
body.RRight.Material = tog and "Neon" or "SmoothPlastic"
body.RLeft.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.RRight.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
body.LeftIn.Transparency = tog and 0 or 1
body.RightIn.Transparency = tog and 0 or 1
car.Misc.FL.Door.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FL.Door.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.Misc.FR.Door.Ind.Material = tog and "Neon" or "SmoothPlastic"
car.Misc.FR.Door.Ind.BrickColor = tog and BrickColor.new("Deep orange") or BrickColor.new("Pearl")
car.DriveSeat.LI.Value = tog
car.DriveSeat.RI.Value = tog
end
end
function blink(typ)
b = typ
if blinking == true then
blinking = false
else
blinking = true
while blinking do
Toggle(typ, true)
script.Parent:FireClient(player, 'blink', .9, true)
wait(1/3)
Toggle(typ, false)
script.Parent:FireClient(player, 'blink', 0.8, true)
wait(1/3)
end
Toggle('Hazards', false)
script.Parent:FireClient(player, 'blink', .9, false)
end
end
script.Parent.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") and BlinkersEnabled then
if blinking == true and b == 'Hazards' then
return
else
blinking = false
end
end
end)
F.blinkers = function(dir)
blink(dir)
end
script.Parent.OnServerEvent:connect(function(pl,Fnc,...)
player = pl
F[Fnc](...)
end)
|
--SFX ID to Sound object |
local Sounds = {}
local SoundService = game:GetService("SoundService")
do
local Figure = script.Parent.Parent
Head = Figure:WaitForChild("Head")
while not Humanoid do
for _,NewHumanoid in pairs(Figure:GetChildren()) do
if NewHumanoid:IsA("Humanoid") then
Humanoid = NewHumanoid
break
end
end
if Humanoid then break end
Figure.ChildAdded:wait()
end
Sounds[SFX.Died] = Head:WaitForChild("Died")
Sounds[SFX.Running] = Head:WaitForChild("Running")
Sounds[SFX.Swimming] = Head:WaitForChild("Swimming")
Sounds[SFX.Climbing] = Head:WaitForChild("Climbing")
Sounds[SFX.Jumping] = Head:WaitForChild("Jumping")
Sounds[SFX.GettingUp] = Head:WaitForChild("GettingUp")
Sounds[SFX.FreeFalling] = Head:WaitForChild("FreeFalling")
Sounds[SFX.Landing] = Head:WaitForChild("Landing")
Sounds[SFX.Splash] = Head:WaitForChild("Splash")
local DefaultServerSoundEvent = game:GetService("ReplicatedStorage"):FindFirstChild("DefaultServerSoundEvent")
if DefaultServerSoundEvent then
DefaultServerSoundEvent.OnClientEvent:connect(function(sound, playing, resetPosition)
if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") then
if resetPosition and sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if sound.IsPlaying ~= playing then
sound.Playing = playing
end
else
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if not sound.IsPlaying then
sound.Playing = true
end
end
end)
end
end
local IsSoundFilteringEnabled = function()
return game.Workspace.FilteringEnabled and SoundService.RespectFilteringEnabled
end
local Util
Util = {
--Define linear relationship between (pt1x,pt2x) and (pt2x,pt2y). Evaluate this at x.
YForLineGivenXAndTwoPts = function(x,pt1x,pt1y,pt2x,pt2y)
--(y - y1)/(x - x1) = m
local m = (pt1y - pt2y) / (pt1x - pt2x)
--float b = pt1.y - m * pt1.x;
local b = (pt1y - m * pt1x)
return m * x + b
end;
--Clamps the value of "val" between the "min" and "max"
Clamp = function(val,min,max)
return math.min(max,math.max(min,val))
end;
--Gets the horizontal (x,z) velocity magnitude of the given part
HorizontalSpeed = function(Head)
local hVel = Head.Velocity + Vector3.new(0,-Head.Velocity.Y,0)
return hVel.magnitude
end;
--Gets the vertical (y) velocity magnitude of the given part
VerticalSpeed = function(Head)
return math.abs(Head.Velocity.Y)
end;
--Setting Playing/TimePosition values directly result in less network traffic than Play/Pause/Resume/Stop
--If these properties are enabled, use them.
Play = function(sound)
if IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(true, true)
end
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
if not sound.IsPlaying then
sound.Playing = true
end
end;
Pause = function(sound)
if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(false, false)
end
if sound.IsPlaying then
sound.Playing = false
end
end;
Resume = function(sound)
if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(true, false)
end
if not sound.IsPlaying then
sound.Playing = true
end
end;
Stop = function(sound)
if UserSettings():IsUserFeatureEnabled("UserPlayCharacterLoopSoundWhenFE") and IsSoundFilteringEnabled() then
sound.CharacterSoundEvent:FireServer(false, true)
end
if sound.IsPlaying then
sound.Playing = false
end
if sound.TimePosition ~= 0 then
sound.TimePosition = 0
end
end;
}
do
-- List of all active Looped sounds
local playingLoopedSounds = {}
-- Last seen Enum.HumanoidStateType
local activeState = nil
local fallSpeed = 0
-- Verify and set that "sound" is in "playingLoopedSounds".
function setSoundInPlayingLoopedSounds(sound)
for i=1, #playingLoopedSounds do
if playingLoopedSounds[i] == sound then
return
end
end
table.insert(playingLoopedSounds,sound)
end
-- Stop all active looped sounds except parameter "except". If "except" is not passed, all looped sounds will be stopped.
function stopPlayingLoopedSoundsExcept(except)
for i=#playingLoopedSounds,1,-1 do
if playingLoopedSounds[i] ~= except then
Util.Pause(playingLoopedSounds[i])
table.remove(playingLoopedSounds,i)
end
end
end
-- Table of Enum.HumanoidStateType to handling function
local stateUpdateHandler = {
[Enum.HumanoidStateType.Dead] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Died]
Util.Play(sound)
end;
[Enum.HumanoidStateType.RunningNoPhysics] = function(speed)
stateUpdated(Enum.HumanoidStateType.Running, speed)
end;
[Enum.HumanoidStateType.Running] = function(speed)
local sound = Sounds[SFX.Running]
stopPlayingLoopedSoundsExcept(sound)
if(useUpdatedLocalSoundFlag and activeState == Enum.HumanoidStateType.Freefall and fallSpeed > 0.1) then
-- Play a landing sound if the character dropped from a large distance
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
local freeFallSound = Sounds[SFX.FreeFalling]
freeFallSound.Volume = vol
Util.Play(freeFallSound)
fallSpeed = 0
end
if useUpdatedLocalSoundFlag then
if speed ~= nil and speed > 0.5 then
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
elseif speed ~= nil then
stopPlayingLoopedSoundsExcept()
end
else
if Util.HorizontalSpeed(Head) > 0.5 then
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
else
stopPlayingLoopedSoundsExcept()
end
end
end;
[Enum.HumanoidStateType.Swimming] = function(speed)
local threshold
if useUpdatedLocalSoundFlag then threshold = speed else threshold = Util.VerticalSpeed(Head) end
if activeState ~= Enum.HumanoidStateType.Swimming and threshold > 0.1 then
local splashSound = Sounds[SFX.Splash]
splashSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
100, 0.28,
350, 1),
0,1)
Util.Play(splashSound)
end
do
local sound = Sounds[SFX.Swimming]
stopPlayingLoopedSoundsExcept(sound)
Util.Resume(sound)
setSoundInPlayingLoopedSounds(sound)
end
end;
[Enum.HumanoidStateType.Climbing] = function(speed)
local sound = Sounds[SFX.Climbing]
if useUpdatedLocalSoundFlag then
if speed ~= nil and math.abs(speed) > 0.1 then
Util.Resume(sound)
stopPlayingLoopedSoundsExcept(sound)
else
Util.Pause(sound)
stopPlayingLoopedSoundsExcept(sound)
end
else
if Util.VerticalSpeed(Head) > 0.1 then
Util.Resume(sound)
stopPlayingLoopedSoundsExcept(sound)
else
stopPlayingLoopedSoundsExcept()
end
end
setSoundInPlayingLoopedSounds(sound)
end;
[Enum.HumanoidStateType.Jumping] = function()
if activeState == Enum.HumanoidStateType.Jumping then
return
end
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.Jumping]
Util.Play(sound)
end;
[Enum.HumanoidStateType.GettingUp] = function()
stopPlayingLoopedSoundsExcept()
local sound = Sounds[SFX.GettingUp]
Util.Play(sound)
end;
[Enum.HumanoidStateType.Freefall] = function()
if activeState == Enum.HumanoidStateType.Freefall then
return
end
local sound = Sounds[SFX.FreeFalling]
sound.Volume = 0
stopPlayingLoopedSoundsExcept()
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.y))
end;
[Enum.HumanoidStateType.FallingDown] = function()
stopPlayingLoopedSoundsExcept()
end;
[Enum.HumanoidStateType.Landed] = function()
stopPlayingLoopedSoundsExcept()
if Util.VerticalSpeed(Head) > 75 then
local landingSound = Sounds[SFX.Landing]
landingSound.Volume = Util.Clamp(
Util.YForLineGivenXAndTwoPts(
Util.VerticalSpeed(Head),
50, 0,
100, 1),
0,1)
Util.Play(landingSound)
end
end;
[Enum.HumanoidStateType.Seated] = function()
stopPlayingLoopedSoundsExcept()
end;
}
-- Handle state event fired or OnChange fired
function stateUpdated(state, speed)
if stateUpdateHandler[state] ~= nil then
if useUpdatedLocalSoundFlag and (state == Enum.HumanoidStateType.Running
or state == Enum.HumanoidStateType.Climbing
or state == Enum.HumanoidStateType.Swimming
or state == Enum.HumanoidStateType.RunningNoPhysics) then
stateUpdateHandler[state](speed)
else
stateUpdateHandler[state]()
end
end
activeState = state
end
Humanoid.Died:connect( function() stateUpdated(Enum.HumanoidStateType.Dead) end)
Humanoid.Running:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Running, speed) end)
Humanoid.Swimming:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Swimming, speed) end)
Humanoid.Climbing:connect( function(speed) stateUpdated(Enum.HumanoidStateType.Climbing, speed) end)
Humanoid.Jumping:connect( function() stateUpdated(Enum.HumanoidStateType.Jumping) end)
Humanoid.GettingUp:connect( function() stateUpdated(Enum.HumanoidStateType.GettingUp) end)
Humanoid.FreeFalling:connect( function() stateUpdated(Enum.HumanoidStateType.Freefall) end)
Humanoid.FallingDown:connect( function() stateUpdated(Enum.HumanoidStateType.FallingDown) end)
-- required for proper handling of Landed event
Humanoid.StateChanged:connect(function(old, new)
stateUpdated(new)
end)
function onUpdate(stepDeltaSeconds, tickSpeedSeconds)
local stepScale = stepDeltaSeconds / tickSpeedSeconds
do
local sound = Sounds[SFX.FreeFalling]
if activeState == Enum.HumanoidStateType.Freefall then
if Head.Velocity.Y < 0 and Util.VerticalSpeed(Head) > 75 then
Util.Resume(sound)
--Volume takes 1.1 seconds to go from volume 0 to 1
local ANIMATION_LENGTH_SECONDS = 1.1
local normalizedIncrement = tickSpeedSeconds / ANIMATION_LENGTH_SECONDS
sound.Volume = Util.Clamp(sound.Volume + normalizedIncrement * stepScale, 0, 1)
else
sound.Volume = 0
end
else
Util.Pause(sound)
end
end
do
local sound = Sounds[SFX.Running]
if activeState == Enum.HumanoidStateType.Running then
if Util.HorizontalSpeed(Head) < 0.5 then
Util.Pause(sound)
end
end
end
end
local lastTick = tick()
local TICK_SPEED_SECONDS = 0.25
while true do
onUpdate(tick() - lastTick,TICK_SPEED_SECONDS)
lastTick = tick()
wait(TICK_SPEED_SECONDS)
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 = "Spin stars and bone" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--//Custom Functions\\-- |
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "Creator"
Creator_Tag.Value = player
debris:AddItem(Creator_Tag, 0.3)
Creator_Tag.Parent = humanoid
end
function 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 TextEffects(element, floatAmount, direction, style, duration)
element:TweenPosition(UDim2.new(0, math.random(-40, 40), 0, -floatAmount), direction, style, duration)
wait(0.5)
for i = 1, 60 do
element.TextTransparency = element.TextTransparency + 1/60
element.TextStrokeTransparency = element.TextStrokeTransparency + 1/60
wait(1/60)
end
element.TextTransparency = element.TextTransparency + 1
element.TextStrokeTransparency = element.TextStrokeTransparency + 1
element.Parent:Destroy()
end
function DynamicText(damage, criticalPoint, humanoid)
local bill = Instance.new("BillboardGui", humanoid.Parent.Head)
bill.Size = UDim2.new(0, 50, 0, 100)
local part = Instance.new("TextLabel", bill)
bill.AlwaysOnTop = true
part.TextColor3 = Color3.fromRGB(255, 0, 0)
part.Text = damage
part.Font = Enum.Font.SourceSans
part.TextStrokeTransparency = 0
part.Size = UDim2.new(1, 0, 1, 0)
part.Position = UDim2.new(0, 0, 0, 0)
part.BackgroundTransparency = 1
bill.Adornee = bill.Parent
if damage < criticalPoint then
part.TextSize = 28
part.TextColor3 = Color3.new(1, 0, 0)
elseif damage >= criticalPoint then
part.TextSize = 32
part.TextColor3 = Color3.new(1, 1, 0)
end
spawn(function()
TextEffects(part, 85, Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.75)
end)
end
function DamageAndTagHumanoid(player, humanoid, damage)
hit:FireClient(player)
UntagHumanoid(handle)
humanoid:TakeDamage(damage) TagHumanoid(humanoid, player)
end
|
--[[
// Name: Extended GroupService
// Author: Sebastian Erik Bauer (SimplyData)
// Date: 25/04/2019
--]] |
local GroupService = {}
local RbxGroupService = game:GetService("GroupService")
local DEFAULT_ROLE = "Guest"
local function PagesToArray(Pages)
local Array = {}
local Length = 0
while true do
for _, Value in ipairs(Pages:GetCurrentPage()) do
Length = Length + 1
Array[Length] = Value
end
if Pages.IsFinished then
break
else
Pages:AdvanceToNextPageAsync()
end
end
return Array
end
|
-------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------- |
function onSwimming(speed)
if speed > 1.00 then
local scale = 10.0
playAnimation("swim", 0.4, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Swimming"
else
playAnimation("swimidle", 0.4, Humanoid)
pose = "Standing"
end
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
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
local lastTick = 0
function stepAnimate(currentTime)
local amplitude = 1
local frequency = 1
local deltaTime = currentTime - lastTick
lastTick = currentTime
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.2, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
stopAllAnimations()
amplitude = 0.1
frequency = 1
setAngles = true
end
-- Tool Animation handling
local tool = Character:FindFirstChildOfClass("Tool")
if tool and tool:FindFirstChild("Handle") then
local animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = currentTime + .3
end
if currentTime > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
stopToolAnimations()
toolAnim = "None"
toolAnimInstance = nil
toolAnimTime = 0
end
end
|
-- FUNCTIONS -- |
return function(Character)
task.delay(5, function()
for i, v in pairs(Character:GetDescendants()) do
if v:IsA("MeshPart") or v:IsA("Part") or v:IsA("Decal") then
-- Transparency Tween --
local tweenTime = 2
local ImpTween = TS:Create(v, TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {Transparency = 1})
ImpTween:Play()
task.delay(tweenTime, function()
--print("Tween Completed - NPCDeathFX")
end)
end
end
end)
end
|
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server:" OR "Server-"
CLIENT PLUGINS' NAMES MUST START WITH "Client:" OR "Client-"
Plugins have full access to the server/client tables and most variables.
You can use the MakePluginEvent to use the script instead of setting up an event.
PlayerChatted will get chats from the custom chat and nil players.
PlayerJoined will fire after the player finishes initial loading
CharacterAdded will also fire after the player is loaded, it does not use the CharacterAdded event.
service.Events.PlayerChatted(function(plr, msg)
print(msg..' from '..plr.Name..' Example Plugin')
end)
service.Events.PlayerAdded(function(p)
print(p.Name..' Joined! Example Plugin')
end)
service.Events.CharacterAdded(function(p)
server.RunCommand('name',plr.Name,'BobTest Example Plugin')
end)
--]] |
return function(Vargs)
local server, service = Vargs.Server, Vargs.Service
server.Commands.ExampleCommand = {
Prefix = server.Settings.Prefix; -- Prefix to use for command
Commands = {"example"}; -- Commands
Args = {"arg1"}; -- Command arguments
Description = "Example command"; -- Command Description
Hidden = true; -- Is it hidden from the command list?
Fun = false; -- Is it fun?
AdminLevel = "Players"; -- Admin level; If using settings.CustomRanks set this to the custom rank name (eg. "Baristas")
Function = function(plr,args) -- Function to run for command
print("HELLO WORLD FROM AN EXAMPLE COMMAND :)")
print("Player supplied args[1] "..tostring(args[1]))
end
}
end
|
-- ANimation |
local Sound = script:WaitForChild("Haoshoku Sound")
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == false then
Debounce = 2
Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
for i = 1,math.huge do
if Debounce == 2 then
plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Mouse.Hit.p)
plr.Character.HumanoidRootPart.Anchored = true
else
break
end
wait()
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.X and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" and script.Parent.DargonOn.Value == false then
Debounce = 3
plr.Character.HumanoidRootPart.Anchored = false
local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
Sound:Play()
for i = 1,10 do
wait(0.1)
local mousepos = Mouse.Hit
script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
end
wait(0.3)
Track2:Stop()
wait(.5)
Tool.Active.Value = "None"
wait(3)
Debounce = 1
end
end)
|
--[[Engine]] |
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then
_TCount = 1
_TPsi = _Tune.Boost
elseif _Tune.Aspiration == "Double" then
_TCount = 2
_TPsi = _Tune.Boost*2
end
|
-- ArrayScriptConnection object: |
local ArrayScriptConnection = {
--[[
_listener = function -- [function]
_listener_table = {} -- [table] -- Table from which the function entry will be removed
_disconnect_listener -- [function / nil]
_disconnect_param -- [value / nil]
--]]
}
function ArrayScriptConnection:Disconnect()
local listener = self._listener
if listener ~= nil then
local listener_table = self._listener_table
local index = table.find(listener_table, listener)
if index ~= nil then
table.remove(listener_table, index)
end
self._listener = nil
end
if self._disconnect_listener ~= nil then
if not FreeRunnerThread then
FreeRunnerThread = coroutine.create(RunEventHandlerInFreeThread)
end
task.spawn(FreeRunnerThread, self._disconnect_listener, self._disconnect_param)
self._disconnect_listener = nil
end
end
function MadworkScriptSignal.NewArrayScriptConnection(listener_table, listener, disconnect_listener, disconnect_param) --> [ScriptConnection]
return {
_listener = listener,
_listener_table = listener_table,
_disconnect_listener = disconnect_listener,
_disconnect_param = disconnect_param,
Disconnect = ArrayScriptConnection.Disconnect
}
end
|
--[=[
Returns whether a class is a signal
@param value any
@return boolean
]=] |
function Signal.isSignal(value)
return type(value) == "table"
and getmetatable(value) == Signal
end
|
-- This function is monkey patched to return MockDataStoreService during tests |
local IsPlayer = {}
function IsPlayer.Check(object)
return typeof(object) == "Instance" and object.ClassName == "Player"
end
return IsPlayer
|
--- |
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("DSG",Paint)
end)
|
--// Events |
local L_111_ = L_20_:WaitForChild('Equipped')
local L_112_ = L_20_:WaitForChild('ShootEvent')
local L_113_ = L_20_:WaitForChild('DamageEvent')
local L_114_ = L_20_:WaitForChild('CreateOwner')
local L_115_ = L_20_:WaitForChild('Stance')
local L_116_ = L_20_:WaitForChild('HitEvent')
local L_117_ = L_20_:WaitForChild('KillEvent')
local L_118_ = L_20_:WaitForChild('AimEvent')
local L_119_ = L_20_:WaitForChild('ExploEvent')
local L_120_ = L_20_:WaitForChild('AttachEvent')
local L_121_ = L_20_:WaitForChild('ServerFXEvent')
local L_122_ = L_20_:WaitForChild('ChangeIDEvent')
|
-- Input begin |
userInputService.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.KeyCode == Enum.KeyCode.W then
movement = Vector2.new(movement.X, 1)
elseif inputObject.KeyCode == Enum.KeyCode.A then
movement = Vector2.new(-1, movement.Y)
elseif inputObject.KeyCode == Enum.KeyCode.S then
movement = Vector2.new(movement.X, -1)
elseif inputObject.KeyCode == Enum.KeyCode.D then
movement = Vector2.new(1, movement.Y)
end
end
end)
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
delay(5,function()
game.ReplicatedStorage.Events.System.NewCharacterServer:Fire(player)
end)
end
|
--local function OnEquipped(mouse)
-- Mouse = mouse
-- UpdateIcon()
--end | |
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 310 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 500 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 3900 -- Use sliders to manipulate values
Tune.Redline = 4500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 4500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 1.3 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 80 -- RPM acceleration when clutch is off
Tune.RevDecay = 70 -- RPM decay when clutch is off
Tune.RevBounce = 10 -- RPM kickback from redline
Tune.IdleThrottle = 1 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- regeneration |
while true do
local s = wait(1)
local health = Humanoid.Health
if health > 0 and health < Humanoid.MaxHealth then
health = health + 0.01 * s * Humanoid.MaxHealth
if health * 1.05 < Humanoid.MaxHealth then
Humanoid.Health = health
else
Humanoid.Health = Humanoid.MaxHealth
end
end
end
|
-- Use module to insert latest tool |
local GetLatestTool = require(script.MainModule); --require(580330877)
if not GetLatestTool then
return;
end;
|
-- << RETRIEVE FRAMEWORK >> |
local main = _G.HDAdminMain
local commandInfoForClient = {"Contributors", "Prefixes", "Rank", "Aliases", "Tags", "Description", "Args", "Loopable"}
|
-- RightShoulder.DesiredAngle = (LimbDesiredAngle + ClimbFudge)
-- LeftShoulder.DesiredAngle = (LimbDesiredAngle + ClimbFudge)
-- RightHip.DesiredAngle = -LimbDesiredAngle
-- LeftHip.DesiredAngle = -LimbDesiredAngle |
end
Humanoid.Died:connect(OnDied)
Humanoid.Running:connect(OnRunning)
Humanoid.Jumping:connect(OnJumping)
Humanoid.Climbing:connect(OnClimbing)
Humanoid.GettingUp:connect(OnGettingUp)
Humanoid.FreeFalling:connect(OnFreeFall)
Humanoid.FallingDown:connect(OnFallingDown)
Humanoid.Seated:connect(OnSeated)
Humanoid.PlatformStanding:connect(OnPlatformStanding)
Humanoid.Swimming:connect(OnSwimming)
Humanoid:ChangeState(Enum.HumanoidStateType.None)
RunService.Stepped:connect(function()
local _, Time = wait(0.1)
Move(Time)
end)
|
-- Roblox User Input Control Modules - each returns a new() constructor function used to create controllers as needed |
local Keyboard = require(script:WaitForChild("Keyboard"))
local Gamepad = require(script:WaitForChild("Gamepad"))
local DynamicThumbstick = require(script:WaitForChild("DynamicThumbstick"))
local FFlagUserMakeThumbstickDynamic do
local success, value = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserMakeThumbstickDynamic")
end)
FFlagUserMakeThumbstickDynamic = success and value
end
local TouchThumbstick = FFlagUserMakeThumbstickDynamic and DynamicThumbstick or require(script:WaitForChild("TouchThumbstick"))
|
--[[
This function creates a meteor in a random room with windows, breaching a number of them, as well as the room.
This is also where monsters would be spawned, if the spawn line of code were to be commented out.
]] |
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TableUtils = require(ReplicatedStorage.Dependencies.LuaUtils.TableUtils)
local RoomManager = require(ServerStorage.Source.Managers.RoomManager)
local Constants = require(ReplicatedStorage.Source.Common.Constants)
local MonsterManager = require(ServerStorage.Source.Managers.MonsterManager)
local monstersEnabled = ReplicatedStorage.MonstersEnabled.Value
math.randomseed(tick())
return function()
local rooms = RoomManager.getRooms()
local roomsWithWindows =
TableUtils.filter(
rooms,
function(room)
if #room:getWindows() > 0 then
return true
end
end
)
if #roomsWithWindows > 0 then
local room = roomsWithWindows[math.random(1, #roomsWithWindows)]
local windows = room:getWindows()
local windowsToBreak = math.random(1, #windows)
for i = 1, windowsToBreak do
local window = windows[i]
if not window then
return
end
if window:getState() == Constants.State.Window.Normal then
window:breach()
else
windowsToBreak = windowsToBreak + 1
end
end
if monstersEnabled then
MonsterManager.spawnMonsterInRoom(room)
end
end
end
|
--[[Simple Message Example:
local url = "Url Here"
local webhookService = require(game.ServerStorage.WebhookService)
webhookService:createMessage(url, "Message Here")
webhookService:createEmbed(url, "Title Here", "Message Here", "Image Link Here (OPTIONAL)")
]] | |
--------RIGHT DOOR -------- |
game.Workspace.doorright.l12.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l71.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.secondary.Value)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
---SG Is Here---
---Please Dont Change Anything Can Dont Work If You Change-- |
local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:FindFirstChild("Rebirth")
local button = script.Parent
local debounce = false
button.MouseButton1Click:Connect(function()
local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")
if not debounce then
debounce = true
local playerPoint = rebirths
remote:FireServer(playerPoint)
wait(0.01)
debounce = false
end
end)
repeat
local rebirths = game.Players.LocalPlayer.leaderstats:FindFirstChild("Rebirths")
local textButton = script.Parent
textButton.Text = "".. tostring(100 * (rebirths.Value + 1)) .." Coins "
wait(0.01)
until script.Parent == nil
|
-- functions |
local function HandleCharacter(character)
if character then
spawn(function()
wait(1)
for _, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v:GetPropertyChangedSignal("Size"):Connect(function()
wait(2)
PLAYER:Kick()
end)
end
end
end)
end
end
local function HandlePlayer(player)
player.CharacterAdded:connect(HandleCharacter)
if player.Character then
HandleCharacter(player.Character)
end
end
|
--math |
local inf = 99999*9999*99999*9999*9999
while true do
wait (5.5)
sit:Play()
wait (2)
thud:Play()
wait (1)
typee:Play()
script.Parent.NameDev.TextTransparency = 0
wait (0.5)
typee:Play()
script.Parent.Presents.TextTransparency = 0
wait (1)
script.Parent.D1.TextTransparency = 0
typee:Play()
wait (1)
typee:Play()
script.Parent.D2.TextTransparency = 0
wait (1)
typee:Play()
script.Parent.D3.TextTransparency = 0
wait (4)
Music:Play()
script.Parent.GameName.TextTransparency = 0
wait (4)
Music.Volume = 1
wait (0.3)
Music.Volume = 0.4
wait (0.3)
Music.Volume = 0.1
wait (0.2)
Music:Destroy()
wait (0.5)
click:Play()
script.Parent.ChapterName.TextTransparency = 0
wait (4.5)
start:Play()
script.Parent.Visible = false
wait (inf)
end
|
--[[
Sets the velocity of the internal springs, overwriting the existing velocity
of this Spring. This doesn't affect position.
If the type doesn't match the current type of the spring, an error will be
thrown.
]] |
function class:setVelocity(newValue)
local newType = typeof(newValue)
if newType ~= self._currentType then
parseError("springTypeMismatch", nil, newType, self._currentType)
end
self._springVelocities = unpackType(newValue, newType)
SpringScheduler.add(self)
end
|
--------------------) Settings |
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Glitch void" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage |
--Tires |
function GetTireCurve(c,x) return (((-math.abs(x^(c*2.4)))/2.4)+((-math.abs(x^2.4))/2.4))*(7/6) end
function WFriction(v,val)
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(0,val,0,.1,0)
end
Instance.new("Model",fWheel.Parts).Name = "Tires"
Instance.new("Model",rWheel.Parts).Name = "Tires"
for i=0,_Tune.TireCylinders do
local fCyl = fWheel:Clone()
fCyl.Name = "FTire"
for _,a in pairs(fCyl:GetChildren()) do a:Destroy() end
fCyl.Parent = fWheel.Parts.Tires
if _Tune.TiresVisible or _Tune.Debug then fCyl.Transparency = 0 else fCyl.Transparency = 1 end
fCyl.Size = Vector3.new(fWheel.Size.X*(i/_Tune.TireCylinders),fWheel.Size.Y+(_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,i/_Tune.TireCylinders)),fWheel.Size.Y+(_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,i/_Tune.TireCylinders)))
if (i/_Tune.TireCylinders < 1/3 and _Tune.FTireCompound == 3) or (i/_Tune.TireCylinders < 1/2 and _Tune.FTireCompound == 2) then
WFriction(fCyl,_Tune.FTireFriction-.1)
fCyl.Name = fCyl.Name.."L"
elseif i/_Tune.TireCylinders >= 1/3 and i/_Tune.TireCylinders < 2/3 and _Tune.FTireCompound == 3 then
WFriction(fCyl,(_Tune.FTireFriction+(_Tune.FTireFriction-.1))/2)
fCyl.Name = fCyl.Name.."M"
elseif i/_Tune.TireCylinders >= 2/3 or (i/_Tune.TireCylinders >= 1/2 and _Tune.FTireCompound == 2) or _Tune.FTireCompound == 1 then
WFriction(fCyl,_Tune.FTireFriction)
fCyl.Name = fCyl.Name.."H"
end
local rCyl = rWheel:Clone()
rCyl.Name = "RTire"
for _,b in pairs(rCyl:GetChildren()) do b:Destroy() end
rCyl.Parent = rWheel.Parts.Tires
if _Tune.TiresVisible or _Tune.Debug then rCyl.Transparency = 0 else rCyl.Transparency = 1 end
rCyl.Size = Vector3.new(rWheel.Size.X*(i/_Tune.TireCylinders),rWheel.Size.Y+(_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,i/_Tune.TireCylinders)),rWheel.Size.Y+(_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,i/_Tune.TireCylinders)))
if (i/_Tune.TireCylinders < 1/3 and _Tune.RTireCompound == 3) or (i/_Tune.TireCylinders < 1/2 and _Tune.RTireCompound == 2) then
WFriction(rCyl,_Tune.RTireFriction-.1)
rCyl.Name = rCyl.Name.."L"
elseif i/_Tune.TireCylinders >= 1/3 and i/_Tune.TireCylinders < 2/3 and _Tune.RTireCompound == 3 then
WFriction(rCyl,(_Tune.RTireFriction+(_Tune.RTireFriction-.1))/2)
rCyl.Name = rCyl.Name.."M"
elseif i/_Tune.TireCylinders >= 2/3 or (i/_Tune.TireCylinders >= 1/2 and _Tune.RTireCompound == 2) or _Tune.RTireCompound == 1 then
WFriction(rCyl,_Tune.RTireFriction)
rCyl.Name = rCyl.Name.."H"
end
wait()
end
fWheel.CanCollide = false
fWheel.Transparency = 1
rWheel.CanCollide = false
rWheel.Transparency = 1
|
-- << SERVER RANKS >> |
function module:CreateServerRanks()
coroutine.wrap(function()
local serverRankInfo = main.signals.RetrieveServerRanks:InvokeServer()
--Organise ranks
local rankPositions = {}
local ranks = {}
local plrRanks = {}
for i, rankDetails in pairs(main.settings.Ranks) do
local rankId = rankDetails[1]
local rankName = rankDetails[2]
table.insert(ranks, 1, {rankId, rankName, {}})
end
for i,v in pairs(ranks) do
rankPositions[v[1]] = i
end
--Split players into ranks
for i, playerRankInfo in pairs(serverRankInfo) do
local plr = playerRankInfo.Player
local rankId = playerRankInfo.RankId
local rankTypeId = playerRankInfo.RankType
local rankDetail = ranks[rankPositions[rankId]]
if rankDetail then
table.insert(rankDetail[3], {plr, rankTypeId})
end
end
--Sort ranks by RankType (Perm > Server > Temp)
for i, rankInfo in pairs(ranks) do
local listOfPlrs = rankInfo[3]
table.sort(listOfPlrs, function(a,b) return a[2] < b[2] end)
end
--Clear labels
main:GetModule("cf"):ClearPage(pages.serverRanks)
--Setup labels
local rankTypesReversed = {}
for a,b in pairs(main.rankTypes) do
rankTypesReversed[b] = a
end
local labelCount = 0
for i, rankInfo in pairs(ranks) do
local rankId = rankInfo[1]
local rankName = rankInfo[2]
local listOfPlrs = rankInfo[3]
for _, playerRankDetail in pairs(listOfPlrs) do
labelCount = labelCount + 1
local plr = playerRankDetail[1]
local rankTypeId = playerRankDetail[2]
local rankTypeName = rankTypesReversed[rankTypeId]
local label = templates.admin:Clone()
label.Name = "Label".. labelCount
label.PlrName.Text = plr.Name
label.PlrRank.Text = rankName.." ("..rankTypeName..")"
label.PlayerImage.Image = main:GetModule("cf"):GetUserImage(plr.UserId)
label.BackgroundColor3 = main:GetModule("cf"):GetLabelBackgroundColor(labelCount)
label.Visible = true
label.Parent = pages.serverRanks
end
end
--Canvas Size
pages.serverRanks.CanvasSize = UDim2.new(0, 0, 0, labelCount*templates.admin.AbsoluteSize.Y)
end)()
end
|
-------- |
local HitboxObject = {}
local Hitbox = {}
Hitbox.__index = Hitbox
function Hitbox:__tostring()
return string.format("Hitbox for instance %s [%s]", self.object.Name, self.object.ClassName)
end
function HitboxObject:new()
return setmetatable({}, Hitbox)
end
function Hitbox:config(object, ignoreList)
self.active = false
self.deleted = false
self.partMode = false
self.debugMode = false
self.points = {}
self.targetsHit = {}
self.endTime = 0
self.OnHit = Signal:Create()
self.OnUpdate = Signal:Create()
self.raycastParams = RaycastParams.new()
self.raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
self.raycastParams.FilterDescendantsInstances = ignoreList or {}
self.object = object
CollectionService:AddTag(self.object, "RaycastModuleManaged")
end
function Hitbox:SetPoints(object, vectorPoints, groupName)
if object and (object:IsA("BasePart") or object:IsA("MeshPart") or object:IsA("Attachment")) then
for _, vectors in ipairs(vectorPoints) do
if typeof(vectors) == "Vector3" then
local Point = {
IsAttachment = object:IsA("Attachment"),
RelativePart = object,
Attachment = vectors,
LastPosition = nil,
group = groupName,
solver = CastVectorPoint
}
table.insert(self.points, Point)
end
end
end
end
function Hitbox:RemovePoints(object, vectorPoints)
if object then
if object:IsA("BasePart") or object:IsA("MeshPart") then --- for some reason it doesn't recognize meshparts unless I add it in
for i = 1, #self.points do
local Point = self.points[i]
for _, vectors in ipairs(vectorPoints) do
if typeof(Point.Attachment) == "Vector3" and Point.Attachment == vectors and Point.RelativePart == object then
self.points[i] = nil
end
end
end
end
end
end
function Hitbox:LinkAttachments(primaryAttachment, secondaryAttachment)
if primaryAttachment:IsA("Attachment") and secondaryAttachment:IsA("Attachment") then
local group = primaryAttachment:FindFirstChild("Group")
local Point = {
RelativePart = nil,
Attachment = primaryAttachment,
Attachment0 = secondaryAttachment,
LastPosition = nil,
group = group and group.Value,
solver = CastLinkAttach
}
table.insert(self.points, Point)
end
end
function Hitbox:UnlinkAttachments(primaryAttachment)
for i, Point in ipairs(self.points) do
if Point.Attachment and Point.Attachment == primaryAttachment then
table.remove(self.points, i)
break
end
end
end
function Hitbox:seekAttachments(attachmentName, canWarn)
if #self.points <= 0 then
table.insert(self.raycastParams.FilterDescendantsInstances, workspace.Terrain.Ignore)
end
for _, attachment in ipairs(self.object:GetDescendants()) do
if attachment:IsA("Attachment") and attachment.Name == attachmentName then
local group = attachment:FindFirstChild("Group")
local Point = {
Attachment = attachment,
RelativePart = nil,
LastPosition = nil,
group = group and group.Value,
solver = CastAttachment
}
table.insert(self.points, Point)
end
end
if canWarn then
if #self.points <= 0 then
warn(string.format("\n[[RAYCAST WARNING]]\nNo attachments with the name '%s' were found in %s. No raycasts will be drawn. Can be ignored if you are using SetPoints.",
attachmentName, self.object.Name)
)
else
print(string.format("\n[[RAYCAST MESSAGE]]\n\nCreated Hitbox for %s - Attachments found: %s",
self.object.Name, #self.points)
)
end
end
end
function Hitbox:Destroy()
if self.deleted then return end
if self.OnHit then self.OnHit:Delete() end
if self.OnUpdate then self.OnUpdate:Delete() end
self.points = nil
self.active = false
self.deleted = true
end
function Hitbox:HitStart(seconds)
self.active = true
if seconds then
assert(type(seconds) == "number", "Argument #1 must be a number!")
local minSeconds = 1 / 60 --- Seconds cannot be under 1/60th
if seconds <= minSeconds or seconds == math.huge then
seconds = minSeconds
end
self.endTime = clock() + seconds
end
end
function Hitbox:HitStop()
if self.deleted then return end
self.active = false
self.endTime = 0
table.clear(self.targetsHit)
end
function Hitbox:PartMode(bool)
self.partMode = bool
end
function Hitbox:DebugMode(bool)
self.debugMode = bool
end
return HitboxObject
|
-- Define the minimum and maximum size of the window |
local minSize = Vector2.new(265, 394)
local maxSize = Vector2.new(999, 999)
|
-- Events listening for seat action |
for i=1, #BasketSeats do
local Seat = BasketSeats[i]
Seat.Changed:connect(function()DetectPlayer(Seat)end)
end
|
--script.Parent.ChargeSphere.Enabled = true |
script.Parent.ChargeGlow.Enabled = true |
--[[script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") then
--child.C0 = CFrame.new(-1.4,-1.3,0.2)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("AudioPlayer")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
if script.Parent.Audio.EqualizerSoundEffect.HighGain == 5 then
player.PlayerGui.AudioPlayer.AudioPlayerGui.onOff.Text = "OUT"
else
player.PlayerGui.AudioPlayer.AudioPlayerGui.onOff.Text = "IN"
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("AudioPlayer") then
player.PlayerGui:FindFirstChild("AudioPlayer"):Destroy()
end
end
end
end)]] | |
-- This will inject all types into this context.
-- YES, THIS MEANS YOU IGNORE MISSING TYPE ERRORS. Remember: Type checking is still in beta!
-- * As of release |
require(script.TypeDefinitions)
|
--[=[
Impulses the spring, increasing velocity by the amount given. This is useful to make something shake,
like a Mac password box failing.
@param velocity T -- The velocity to impulse with
@return ()
]=] |
function Spring:Impulse(velocity)
self.Velocity = self.Velocity + velocity
end
|
--CONFIG VARIABLES |
local tweenTime = 1
local closeWaitTime = 3
local easingStyle = Enum.EasingStyle.Exponential
local easingDirection = Enum.EasingDirection.InOut
local repeats = 0
local reverse = false
local delayTime = 0 |
--[[
Returns a new list with the reversed order of the given list
]] |
local function reverse(list)
local new = {}
local len = #list
local top = len + 1
for i = 1, len do
new[i] = list[top - i]
end
return new
end
return reverse
|
-- Connect prompt events to handling functions |
script.Parent.Triggered:Connect(onPromptTriggered)
Stored.Changed:Connect(function()
if not Infinite then
script.Parent.ObjectText = BulletType.." | "..Stored.Value
else
script.Parent.ObjectText = BulletType
end
end)
|
-- the handshake is always "@3ZCGdZ5#qtH2b_DBG7f2pj-d+nqa*mQ" | |
--[[
___ _______ _ _______
/ _ |____/ ___/ / ___ ____ ___ (_)__ /__ __/
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-< / /
/_/ |_| \___/_//_/\_,_/___/___/_/___/ /_/
SecondLogic @ Inspare
Avxnturador @ Novena
]] |
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local BOVact = 0
local BOVact2 = 0
local BOV_Loudness = 1 --volume of the BOV (not exact volume so you kinda have to experiment with it)
local BOV_Pitch = 0.9 --max pitch of the BOV (not exact so might have to mess with it)
local TurboLoudness = .75 --volume of the Turbo (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
BOVact = math.floor(psi*20)
WP = (psi)
WV = (psi/4)*TurboLoudness
BP = (1-(-psi/20))*BOV_Pitch
BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
if FE then
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
else
car.DriveSeat.Whistle.Pitch = WP
car.DriveSeat.Whistle.Volume = WV
car.DriveSeat.BOV.Pitch = BP
car.DriveSeat.BOV.Volume = BV
end
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(psi*20)
ticc = tick()
end
end
|
--// end of config, actual code below |
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local TweenService = game:GetService("TweenService")
local Player : Player = game.Players.LocalPlayer
local Camera : Camera = workspace.CurrentCamera
repeat RunService.Heartbeat:Wait() until script.Parent:IsA("Model") -- yield until Character
local Character : Model = Player.Character
local HumanoidRootPart : Part = Character:WaitForChild("HumanoidRootPart")
local Humanoid : Humanoid = Character:WaitForChild("Humanoid")
local AimOffset = script:WaitForChild("AimOffset") -- a property for other scripts to use to influence the Viewmodel offset (such as a gun aim system)
local Torso : Part
local RootHipJoint : Motor6D
local RootOldC0 : CFrame
local LeftShoulder : Motor6D
local RightShoulder : Motor6D
local LeftArm : Part
local RightArm : Part
local ArmPartsTable = {}
local armTransparency = baseArmTransparency
local isFirstPerson = false
local Sway = Vector3.new(0,0,0)
local WalkSway = CFrame.new(0,0,0)
local StrafeSway = CFrame.Angles(0,0,0)
local JumpSway = CFrame.new(0,0,0)
local JumpSwayGoal = Instance.new("CFrameValue")
|
--tone hz |
elseif sv.Value==3 then
while s.Pitch<0.77 do
s.Pitch=s.Pitch+0.010
s:Play()
if s.Pitch>0.77 then
s.Pitch=0.77
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
wait()
end
|
-- Return an error that occurred during reporting. This error will
-- define whether the test run was successful or failed. |
function BaseReporter:getLastError(): (Error | nil)
return self._error
end
exports.default = BaseReporter
return exports
|
--[=[
An enum value used to represent the Promise's status.
@interface Status
@tag enum
@within Promise
.Started "Started" -- The Promise is executing, and not settled yet.
.Resolved "Resolved" -- The Promise finished successfully.
.Rejected "Rejected" -- The Promise was rejected.
.Cancelled "Cancelled" -- The Promise was cancelled before it finished.
]=]
--[=[
@prop Status Status
@within Promise
@readonly
@tag enums
A table containing all members of the `Status` enum, e.g., `Promise.Status.Resolved`.
]=]
--[=[
A Promise is an object that represents a value that will exist in the future, but doesn't right now.
Promises allow you to then attach callbacks that can run once the value becomes available (known as *resolving*),
or if an error has occurred (known as *rejecting*).
@class Promise
@__index prototype
]=] |
local Promise = {
Error = Error,
Status = makeEnum("Promise.Status", { "Started", "Resolved", "Rejected", "Cancelled" }),
_getTime = os.clock,
_timeEvent = game:GetService("RunService").Heartbeat,
_unhandledRejectionCallbacks = {},
}
Promise.prototype = {}
Promise.__index = Promise.prototype
function Promise._new(traceback, callback, parent)
if parent ~= nil and not Promise.is(parent) then
error("Argument #2 to Promise.new must be a promise or nil", 2)
end
local self = {
-- The executor thread.
_thread = nil,
-- Used to locate where a promise was created
_source = traceback,
_status = Promise.Status.Started,
-- A table containing a list of all results, whether success or failure.
-- Only valid if _status is set to something besides Started
_values = nil,
-- Lua doesn't like sparse arrays very much, so we explicitly store the
-- length of _values to handle middle nils.
_valuesLength = -1,
-- Tracks if this Promise has no error observers..
_unhandledRejection = true,
-- Queues representing functions we should invoke when we update!
_queuedResolve = {},
_queuedReject = {},
_queuedFinally = {},
-- The function to run when/if this promise is cancelled.
_cancellationHook = nil,
-- The "parent" of this promise in a promise chain. Required for
-- cancellation propagation upstream.
_parent = parent,
-- Consumers are Promises that have chained onto this one.
-- We track them for cancellation propagation downstream.
_consumers = setmetatable({}, MODE_KEY_METATABLE),
}
if parent and parent._status == Promise.Status.Started then
parent._consumers[self] = true
end
setmetatable(self, Promise)
local function resolve(...)
self:_resolve(...)
end
local function reject(...)
self:_reject(...)
end
local function onCancel(cancellationHook)
if cancellationHook then
if self._status == Promise.Status.Cancelled then
cancellationHook()
else
self._cancellationHook = cancellationHook
end
end
return self._status == Promise.Status.Cancelled
end
self._thread = coroutine.create(function()
local ok, _, result = runExecutor(self._source, callback, resolve, reject, onCancel)
if not ok then
reject(result[1])
end
end)
task.spawn(self._thread)
return self
end
|
--[[
Assert that the expectation value is the given type.
expect(5).to.be.a("number")
]] |
function Expectation:a(typeName)
local result = (typeof(self.value) == typeName) == self.successCondition
local message = formatMessage(self.successCondition,
("Expected value of type %q, got value %q of type %s"):format(
typeName,
tostring(self.value),
type(self.value)
),
("Expected value not of type %q, got value %q of type %s"):format(
typeName,
tostring(self.value),
type(self.value)
)
)
assertLevel(result, message, 3)
self:_resetModifiers()
return self
end
|
--[=[
Rejects the promise with the values given
@param ... T -- Params to reject with
]=] |
function Promise:Reject(...)
self:_reject({...}, select("#", ...))
end
function Promise:_reject(values, valuesLength)
if not self._pendingExecuteList then
return
end
self._rejected = values
self._valuesLength = valuesLength
local list = self._pendingExecuteList
self._pendingExecuteList = nil
for _, data in pairs(list) do
self:_executeThen(unpack(data))
end
-- Check for uncaught exceptions
if self._unconsumedException and self._valuesLength > 0 then
coroutine.resume(coroutine.create(function()
-- Yield to end of frame, giving control back to Roblox.
-- This is the equivalent of giving something back to a task manager.
RunService.Heartbeat:Wait()
if self._unconsumedException then
if ENABLE_TRACEBACK then
warn(("[Promise] - Uncaught exception in promise\n\n%q\n\n%s")
:format(tostring(self._rejected[1]), self._source))
else
warn(("[Promise] - Uncaught exception in promise: %q")
:format(tostring(self._rejected[1])))
end
end
end))
end
end
|
--[[
Takes a table and returns the field count
]] |
return function(t)
local fieldCount = 0
for _ in pairs(t) do
fieldCount = fieldCount + 1
end
return fieldCount
end
|
--[[
CameraShakePresets.Bump
CameraShakePresets.Explosion
CameraShakePresets.Earthquake
CameraShakePresets.BadTrip
CameraShakePresets.HandheldCamera
CameraShakePresets.Vibration
CameraShakePresets.RoughDriving
--]] |
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakePresets = {
-- A high-magnitude, short, yet smooth shake.
-- Should happen once.
Bump = function()
local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
-- An intense and rough shake.
-- Should happen once.
Explosion = function()
local c = CameraShakeInstance.new(2.5, 6, 0, 0.9)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(3.5, 1, 1)
return c
end;
Dash = function()
local c = CameraShakeInstance.new(2, 5, 0, 0.85)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 1)
return c
end;
IceZ = function()
local c = CameraShakeInstance.new(2.5, 6, 0, 0.9)
c.PositionInfluence = Vector3.new(0.3, 0.3, 0.3)
c.RotationInfluence = Vector3.new(3.5, 1, 1)
return c
end;
LightningStrike = function()
local c = CameraShakeInstance.new(2.5, 6, 0, 0.9)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(3.5, 1, 1)
return c
end;
Hit = function()
local c = CameraShakeInstance.new(1, 3, 0.1, 1)
c.PositionInfluence = Vector3.new(0.1, 0.1, 0.1)
c.RotationInfluence = Vector3.new(2, 1.05, 1.05)
return c
end;
Twerk = function()
local c = CameraShakeInstance.new(15, 20, 0.1, 10)
c.PositionInfluence = Vector3.new(0.5, 0.5, 0.5)
c.RotationInfluence = Vector3.new(4, 4, 4)
return c
end;
-- A continuous, rough shake
-- Sustained.
Earthquake = function()
local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(1, 1, 4)
return c
end;
-- A bizarre shake with a very high magnitude and low roughness.
-- Sustained.
BadTrip = function()
local c = CameraShakeInstance.new(10, 0.15, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 4)
return c
end;
-- A subtle, slow shake.
-- Sustained.
HandheldCamera = function()
local c = CameraShakeInstance.new(1, 0.25, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
return c
end;
-- A very rough, yet low magnitude shake.
-- Sustained.
Vibration = function()
local c = CameraShakeInstance.new(0.4, 20, 2, 2)
c.PositionInfluence = Vector3.new(0, 0.15, 0)
c.RotationInfluence = Vector3.new(1.25, 0, 4)
return c
end;
-- A slightly rough, medium magnitude shake.
-- Sustained.
RoughDriving = function()
local c = CameraShakeInstance.new(1, 2, 1, 1)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
}
return setmetatable({}, {
__index = function(t, i)
local f = CameraShakePresets[i]
if (type(f) == "function") then
return f()
end
error("No preset found with index \"" .. i .. "\"")
end;
})
|
--// Damage Settings |
BaseDamage = 22; -- Torso Damage
LimbDamage = 19; -- Arms and Legs
ArmorDamage = 19; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 27; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--[=[
Returns whether or not a value is a LinearValue object.
@param value any -- A value to check
@return boolean -- True if a linear value, false otherwise
]=] |
function LinearValue.isLinear(value)
return type(value) == "table" and getmetatable(value) == LinearValue
end
|
--[[Transmission]] |
Tune.TransModes = {"Semi","Manual"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.9 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.16 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 2.43 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 1.53 ,
--[[ 3 ]] 1 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- -- Narrowing this type here lets us appease the type checker while still
-- -- counting on types for the rest of this file
-- local loadmodule: (ModuleScript) -> (any, string) = debug["loadmodule"]
-- local moduleFunction, errorMessage = loadmodule(scriptInstance)
-- assert(moduleFunction ~= nil, errorMessage) | |
--// All global vars will be wiped/replaced except script
--// All guis are autonamed codeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local player = service.Players.LocalPlayer
local playergui = player.PlayerGui
local gui = script.Parent.Parent
local frame = gui.Frame
local text = gui.Frame.TextBox
local scroll = gui.Frame.ScrollingFrame
local players = gui.Frame.PlayerList
local entry = gui.Entry
local BindEvent = gTable.BindEvent
local opened = false
local scrolling = false
local scrollOpen = false
local debounce = false
local settings = client.Remote.Get("Setting",{"SplitKey","ConsoleKeyCode","BatchKey","Prefix"})
local splitKey = settings.SplitKey
local consoleKey = settings.ConsoleKeyCode
local batchKey = settings.BatchKey
local prefix = settings.Prefix
local commands = client.Remote.Get('FormattedCommands') or {}
local tweenInfo = TweenInfo.new(0.15)----service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
local scrollOpenTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 140);
})
local scrollCloseTween = service.TweenService:Create(frame, tweenInfo, {
Size = UDim2.new(1, 0, 0, 40);
})
local consoleOpenTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0, 0);
})
local consoleCloseTween = service.TweenService:Create(frame, tweenInfo, {
Position = UDim2.new(0, 0, 0, -200);
})
frame.Position = UDim2.new(0,0,0,-200)
frame.Visible = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
if client.Variables.ConsoleOpen then
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
end
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
local function close()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
scroll.ScrollingEnabled = false
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
if client.Variables.ChatEnabled then
service.StarterGui:SetCoreGuiEnabled("Chat",true)
end
if client.Variables.PlayerListEnabled then
service.StarterGui:SetCoreGuiEnabled('PlayerList',true)
end
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = true
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = true end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = true end
consoleCloseTween:Play();
--service.SafeTweenPos(frame,UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
--frame:TweenPosition(UDim2.new(0,0,0,-200),'Out','Linear',0.2,true)
debounce = false
opened = false
end
end
local function open()
if gui:IsDescendantOf(game) and not debounce then
debounce = true
client.Variables.ChatEnabled = service.StarterGui:GetCoreGuiEnabled("Chat")
client.Variables.PlayerListEnabled = service.StarterGui:GetCoreGuiEnabled('PlayerList')
service.StarterGui:SetCoreGuiEnabled("Chat",false)
service.StarterGui:SetCoreGuiEnabled('PlayerList',false)
scroll.ScrollingEnabled = true
players.ScrollingEnabled = true
if client.UI.Get("Notif") then
client.UI.Get("Notif",nil,true).Object.LABEL.Visible = false
end
local scr = client.UI.Get("Chat",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("PlayerList",nil,true)
if scr then scr.Object.Drag.Visible = false end
local scr = client.UI.Get("HintHolder",nil,true)
if scr then scr.Object.Frame.Visible = false end
consoleOpenTween:Play();
frame.Size = UDim2.new(1,0,0,40)
scroll.Visible = false
players.Visible = false
scrollOpen = false
text.Text = ''
frame.Visible = true
frame.Position = UDim2.new(0,0,0,0)
text:CaptureFocus()
text.Text = ''
wait()
text.Text = ''
debounce = false
opened = true
end
end
text.FocusLost:Connect(function(enterPressed)
if enterPressed then
if text.Text~='' and string.len(text.Text)>1 then
spawn(function()
local sound = Instance.new("Sound",service.LocalContainer())
sound.SoundId = "rbxassetid://669596713"
sound.Volume = 0.2
sound:Play()
wait(0.5)
sound:Destroy()
end)
client.Remote.Send('ProcessCommand',text.Text)
end
end
close()
end)
text.Changed:Connect(function(c)
if c == 'Text' and text.Text ~= '' and open then
if string.sub(text.Text, string.len(text.Text)) == " " then
if players:FindFirstChild("Entry 0") then
text.Text = (string.sub(text.Text, 1, (string.len(text.Text) - 1))..players["Entry 0"].Text).." "
elseif scroll:FindFirstChild("Entry 0") then
text.Text = string.split(scroll["Entry 0"].Text, "<")[1]
else
text.Text = text.Text..prefix
end
text.CursorPosition = string.len(text.Text) + 1
text.Text = string.gsub(text.Text, " ", "")
end
scroll:ClearAllChildren()
players:ClearAllChildren()
local nText = text.Text
if string.match(nText,".*"..batchKey.."([^']+)") then
nText = string.match(nText,".*"..batchKey.."([^']+)")
nText = string.match(nText,"^%s*(.-)%s*$")
end
local pNum = 0
local pMatch = string.match(nText,".+"..splitKey.."(.*)$")
for i,v in next,service.Players:GetPlayers() do
if (pMatch and string.sub(string.lower(tostring(v)),1,#pMatch) == string.lower(pMatch)) or string.match(nText,splitKey.."$") then
local new = entry:Clone()
new.Text = tostring(v)
new.Name = "Entry "..pNum
new.TextXAlignment = "Right"
new.Visible = true
new.Parent = players
new.Position = UDim2.new(0,0,0,20*pNum)
new.MouseButton1Down:Connect(function()
text.Text = text.Text..tostring(v)
text:CaptureFocus()
end)
pNum = pNum+1
end
end
players.CanvasSize = UDim2.new(0,0,0,pNum*20)
local num = 0
for i,v in next,commands do
if string.sub(string.lower(v),1,#nText) == string.lower(nText) or string.find(string.lower(v), string.match(string.lower(nText),"^(.-)"..splitKey) or string.lower(nText), 1, true) then
if not scrollOpen then
scrollOpenTween:Play();
--frame.Size = UDim2.new(1,0,0,140)
scroll.Visible = true
players.Visible = true
scrollOpen = true
end
local b = entry:Clone()
b.Visible = true
b.Parent = scroll
b.Text = v
b.Name = "Entry "..num
b.Position = UDim2.new(0,0,0,20*num)
b.MouseButton1Down:Connect(function()
text.Text = b.Text
text:CaptureFocus()
end)
num = num+1
end
end
frame.Size = UDim2.new(1, 0, 0, math.clamp((num*20)+40, 40, 140))
scroll.CanvasSize = UDim2.new(0,0,0,num*20)
elseif c == 'Text' and text.Text == '' and opened then
scrollCloseTween:Play();
--service.SafeTweenSize(frame,UDim2.new(1,0,0,40),nil,nil,0.3,nil,function() if scrollOpen then frame.Size = UDim2.new(1,0,0,140) end end)
scroll.Visible = false
players.Visible = false
scrollOpen = false
scroll:ClearAllChildren()
scroll.CanvasSize = UDim2.new(0,0,0,0)
end
end)
BindEvent(service.UserInputService.InputBegan, function(InputObject)
local textbox = service.UserInputService:GetFocusedTextBox()
if not (textbox) and rawequal(InputObject.UserInputType, Enum.UserInputType.Keyboard) and InputObject.KeyCode.Name == (client.Variables.CustomConsoleKey or consoleKey) then
if opened then
close()
else
open()
end
client.Variables.ConsoleOpen = opened
end
end)
gTable:Ready()
end
|
---Engine |
function Engine()
script.Parent:WaitForChild("Gauges")
script.Parent:WaitForChild("Status")
local down1
local down2
local Drive={
car.Wheels.FL:GetChildren(),
car.Wheels.FR:GetChildren(),
car.Wheels.RL:GetChildren(),
car.Wheels.RR:GetChildren()
}
local Tc={
Speed=0,
ThrotAccel=.1,
ThrotDecay=.4,
ClutchAccel=.1,
ClutchDecay=.5,
FreeAccel=.1,
FreeDecay=.01,
BrakeAccel=.5,
BrakeDecay=.5,
ExpGradient=2,
MaxTorque=100000,
BrakeMaxTorque=100000,
BExpGradient=2,
Brakes=4000, --Brake Force
ClutchGain=6000,
ClutchStall=0,
ShiftSpeed=.3,
ClutchShiftSpeed=.7,
RevBounceP=.93,
VariableThrotAdj=.1,
Trans={
-- Tuning: http://i.imgur.com/wbHZPI7.png
-- [1] [2] [3] [4] [5] [6] [7] [8] [9]
-- {Int Tq , Peak Tq , Peak Sp , Max Sp , Tq Decay, Limiter , C Tolerance , C Gain , C Stall }
{1750 , 2500 , 030 , 060 , 17 , 8 , .7 , .5 , 0 }, --1st
{1250 , 1500 , 045 , 095 , 20 , 10 , .2 , .3 , 0 }, --2nd
{1000 , 1250 , 085 , 130 , 27 , 13 , .1 , .2 , 0 }, --3rd
{625 , 1000 , 110 , 165 , 28 , 20 , .08 , .15 , 0 }, --4th
{625 , 825 , 130 , 180 , 50 , 30 , .06 , .1 , 0 },
{625 , 825 , 130 , 200 , 50 , 30 , .06 , .1 , 0 },
{625 , 825 , 130 , 200 , 50 , 30 , .06 , .1 , 0 }, --5th --6th
},
ReverseTq=14000, --Reverse Torque
ReverseSp=30, --Max Reverse Speed
FDiffPerc=-.2, --Front Differential (-1 -> 1) *value < 0 is outer wheel biased
CDiffPerc=.25, --Center Differential (-1 -> 1) *value < 0 is front biased
RDiffPerc=-.2, --Rear Differential (-1 -> 1) *value < 0 is outer wheel biased
DTrainDist=-.5, --Power Distribution (See below diagram)
-- Rear <-|-------|-------|-------|-------|-> Front
-- Biased -1 0 1 Biased
-- RWD AWD FWD
-------------------------------------------
ThrotP=0,
MaxThrotP=1,
BrakeP=0,
ClutchP=0,
Throttle=0,
Brake=0,
Clutch=0,
Gear=1,
GearShift=1,
PrevGear=1,
RPM=0,
Units={
{"SPS",1},
{"MPH",.682},
{"KPH",1.097}
},
CUnit=1
}
local Friction={
TractionControl=true,
FDownforce=0000, --Front Downforce (Unsprung)
RDownforce=1000, --Rear Downforce (Unsprung)
FFChange=0,
FTolerance=10,
FMaxDiff=40,
FDecay=1,
FGripGain=1,
RFChange=-40000,
RTolerance=10,
RMaxDiff=40,
RDecay=.01,
RGripGain=.01,
PBrakeForce=40000,
SkidTol=40,
-----------------------------------------
PBrake=false,
FSkid=0,
RSkid=0,
}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("#AV") then
a.Wheel:FindFirstChild("#AV"):Destroy()
end
local AV=Instance.new("BodyAngularVelocity",a.Wheel)
AV.Name="#AV"
AV.angularvelocity=Vector3.new(0,0,0)
AV.maxTorque=Vector3.new(0,0,0)
AV.P=Tc.MaxTorque
end
end
mouse.Button1Up:connect(function() down1=false end)
mouse.Button1Down:connect(function() down1=true end)
mouse.Button2Up:connect(function() down2=false end)
mouse.Button2Down:connect(function() down2=true end)
mouse.WheelForward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.min(1,Tc.MaxThrotP+Tc.VariableThrotAdj)
end
end)
mouse.WheelBackward:connect(function()
if GMode==1 then
Tc.MaxThrotP=math.max(0,Tc.MaxThrotP-Tc.VariableThrotAdj)
end
end)
mouse.KeyDown:connect(function(key)
if key=="q" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
elseif key=="e" then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=1
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=1
elseif key=="t" then
Friction.TractionControl=not Friction.TractionControl
end
end)
mouse.KeyUp:connect(function(key)
if (string.byte(key)==48 and GMode==1) or (key=="p" and GMode==0) then
Friction.PBrake=0
elseif (key=="w" and GMode==1) or (string.byte(key)==48 and GMode==0) then
Tc.Clutch=0
end
end)
local function AChassis()
if GMode==0 then
Tc.MaxThrotP=1
Tc.MaxBrakeP=1
Tc.Throttle=math.max(car.DriveSeat.Throttle,0)
Tc.Brake=math.max(-car.DriveSeat.Throttle,0)
elseif GMode==1 then
Tc.MaxBrakeP=1
if down1 then
Tc.Throttle=1
else
Tc.Throttle=0
end
if down2 then
Tc.Brake=1
else
Tc.Brake=0
end
else
Friction.PBrake=ButtonL1
Tc.Clutch=ButtonR1
Tc.Throttle=math.ceil(RTriggerValue)
Tc.MaxThrotP=RTriggerValue
Tc.Brake=math.ceil(LTriggerValue)
Tc.MaxBrakeP=LTriggerValue^Tc.BExpGradient
if Tc.ControllerGUp==0 and ButtonY==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.min(Tc.Gear+1,#Tc.Trans)
elseif Tc.ControllerGDown==0 and ButtonX==1 then
Tc.PrevGear=Tc.Gear
Tc.GearShift=0
Tc.Gear=math.max(Tc.Gear-1,-1)
end
Tc.ControllerGUp=ButtonY
Tc.ControllerGDown=ButtonX
end
if Tc.Throttle==1 then
Tc.ThrotP=math.min(Tc.MaxThrotP,Tc.ThrotP+Tc.ThrotAccel)
else
Tc.ThrotP=math.max(0,Tc.ThrotP-Tc.ThrotDecay)
end
if Tc.Brake==1 then
Tc.BrakeP=math.min(Tc.MaxBrakeP,Tc.BrakeP+Tc.BrakeAccel)
else
Tc.BrakeP=math.max(0,Tc.BrakeP-Tc.BrakeDecay)
end
if Tc.Clutch==1 or Tc.Gear==0 then
Tc.ClutchP=math.max(0,Tc.ClutchP-Tc.ClutchDecay)
else
Tc.ClutchP=math.min(1,Tc.ClutchP+Tc.ClutchAccel)
end
-------------
Tc.GearShift=math.min(1,Tc.GearShift+Tc.ShiftSpeed+(Tc.ClutchShiftSpeed*(1-Tc.ClutchP)))
---GearChangeBeta
local tol=Tc.Trans[math.max(Tc.Gear,1)][7]
local NSGear=Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6]+3
local OSGear=Tc.Trans[math.max(Tc.PrevGear,1)][4]+Tc.Trans[math.max(Tc.PrevGear,1)][6]+3
local toprev=OSGear+((NSGear-OSGear)*Tc.GearShift)
local gearDiff=(Tc.RPM*NSGear)-(Tc.RPM*OSGear)
local stall=1
local stalltq=0
if math.abs(gearDiff)>tol then
stall=Tc.GearShift
if gearDiff>0 then
stalltq=Tc.Trans[Tc.Gear][8]*(1-Tc.GearShift)
else
stalltq=Tc.Trans[Tc.Gear][9]*(1-Tc.GearShift)
end
end
-------------
local frev=0
local rrev=0
for i,v in pairs(Drive[1]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[2]) do
frev=math.max(frev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[3]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
for i,v in pairs(Drive[4]) do
rrev=math.max(rrev,v.Wheel.RotVelocity.Magnitude)
end
local rev=rrev/toprev
if Tc.DTrainDist==1 then
rev=frev/toprev
elseif Tc.DTrainDist~=-1 then
rev=math.max(rev,frev/toprev)
end
local rGain=(Tc.ThrotP*2)-1
if rGain>0 then
rGain=rGain*Tc.FreeAccel
else
rGain=rGain*Tc.FreeDecay
end
Tc.RPM=math.min(1,math.max(0,rev*Tc.ClutchP^.3,(Tc.RPM+rGain)*(1-Tc.ClutchP)^.3))
-- A-Chassis 5.0
for i,a in pairs(Drive) do
for n,v in pairs(a) do
local tq=0
if Tc.Gear>0 then
Tc.Speed=toprev
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4] then
local tPerc=math.min(v.Wheel.RotVelocity.Magnitude/Tc.Trans[Tc.Gear][3],1)
local tqChange=Tc.Trans[Tc.Gear][2]-Tc.Trans[Tc.Gear][1]
tq=(Tc.Trans[Tc.Gear][1]+(tPerc*tqChange))
else
if v.Wheel.RotVelocity.Magnitude<Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6]-1 then
local tPerc=(v.Wheel.RotVelocity.Magnitude-Tc.Trans[Tc.Gear][4])/Tc.Trans[Tc.Gear][5]
local tqChange=Tc.Trans[Tc.Gear][2]
tq=(math.max(0,Tc.Trans[Tc.Gear][2]-(tPerc*tqChange)))
else
Tc.Speed=(Tc.Trans[Tc.Gear][4]+Tc.Trans[Tc.Gear][6])*Tc.RevBounceP
tq=Tc.Trans[Tc.Gear][2]*2
end
end
elseif Tc.Gear==0 then
tq=0
else
Tc.Speed=-Tc.ReverseSp
tq=Tc.ReverseTq
end
if i==1 then
tq=tq*(1-(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==2 then
tq=tq*(1+(GSteer*Tc.FDiffPerc))*(1+math.abs(GSteer*Tc.CDiffPerc))*(1+Tc.DTrainDist)
elseif i==3 then
tq=tq*(1-(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
else
tq=tq*(1+(GSteer*Tc.RDiffPerc))*(1-math.abs(GSteer*Tc.CDiffPerc))*(1-Tc.DTrainDist)
end
tq=tq*Tc.ThrotP*Tc.ClutchP^Tc.ExpGradient
tq=tq+(tq*stalltq)
local br=Tc.Brakes*Tc.BrakeP^Tc.ExpGradient
tq=math.abs(tq-br)
Tc.Speed=Tc.Speed*(1-math.ceil(Tc.BrakeP))
if i>2 and Friction.PBrake==1 then
Tc.Speed=0
tq=Friction.PBrakeForce
end
local Ref=v.Axle.CFrame.lookVector
local Speed=Tc.Speed
if i==1 or i==3 then Speed=-Speed end
local TqVector=1
if Friction.TractionControl then
TqVector=math.max(0,Friction.SkidTol-math.abs((v.Wheel.RotVelocity.Magnitude*(v.Wheel.Size.X/2))-v.Wheel.Velocity.Magnitude))/Friction.SkidTol
if TqVector<.7 then
script.Parent.Gauges.Speedo.TC.Visible=true
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
else
script.Parent.Gauges.Speedo.TC.Visible=false
end
v.Wheel["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*TqVector
v.Wheel["#AV"].angularvelocity=Ref*Speed*stall
v.Wheel["#AV"].P=Tc.MaxTorque*TqVector
end
end
end
script.Parent.Gauges.Speedo.Units.MouseButton1Click:connect(function()
if Tc.CUnit>=3 then
Tc.CUnit=1
else
Tc.CUnit=Tc.CUnit+1
end
script.Parent.Gauges.Speedo.Units.Text=Tc.Units[Tc.CUnit][1]
end)
local numbers={180354176,180354121,180354128,180354131,180354134,180354138,180354146,180354158,180354160,180354168,180355596,180354115}
local function Speedometer()
--Sound
car.DriveSeat.Rev.Pitch=car.DriveSeat.Rev.SetPitch.Value+car.DriveSeat.Rev.SetRev.Value*Tc.RPM
car.DriveSeat.Rel.Pitch=car.DriveSeat.Rel.SetPitch.Value+car.DriveSeat.Rel.SetRev.Value*Tc.RPM
car.DriveSeat.Rev.Volume=car.DriveSeat.Rev.SetVolume.Value*Tc.ThrotP
car.DriveSeat.Rel.Volume=car.DriveSeat.Rel.SetVolume.Value*(1-Tc.ThrotP)
if Tc.Throttle ~= 1 then
car.DriveSeat.Backfire.Volume=math.min(math.max((Tc.RPM-.5)/.5,0)*.7,car.DriveSeat.Backfire.Volume+.07)
else
car.DriveSeat.Backfire.Volume=math.max(car.DriveSeat.Backfire.Volume-.07,0)
end
--Afterburn
if Tc.PrevThrot~=Tc.Throttle and Tc.RPM > .6 then
local a=math.random(0,1)
if a==1 then
coroutine.resume(coroutine.create(function()
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=10
end
wait(.1)
for i,v in pairs(car.Body.Exhaust:GetChildren()) do
v.Afterburn.Rate=0
end
end))
end
end
--Speedo
local fwheel=Tc.RPM*(Tc.Trans[math.max(Tc.Gear,1)][4]+Tc.Trans[math.max(Tc.Gear,1)][6])
local z1=math.min(1,math.max(0,fwheel-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5))/(Tc.Trans[math.max(Tc.Gear,1)][3]-(Tc.Trans[math.max(Tc.Gear,1)][3]*.5)))
local z2=math.min(1,math.max(0,fwheel-Tc.Trans[math.max(Tc.Gear,1)][4])/Tc.Trans[math.max(Tc.Gear,1)][6])
local blue=1-z1
local red=z2*2
local green=0
if fwheel>Tc.Trans[math.max(Tc.Gear,1)][4] then
green=1-z2
else
green=math.max(.45,z1*2)
end
for i,v in pairs(script.Parent.Gauges.Tach:GetChildren()) do
local n=tonumber(string.match(v.Name, "%d+"))
if n~=nil then
if n%2 == 0 then
v.P.Size=UDim2.new(0,4,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
else
v.P.Size=UDim2.new(0,6,0,((1-math.abs(Tc.RPM-((n-1)/18)))^12*-40)-10)
end
v.P.BackgroundColor3 = Color3.new(red,green,blue)
end
end
local sp=car.DriveSeat.Velocity.Magnitude*Tc.Units[Tc.CUnit][2]
if sp<1000 then
local nnn=math.floor(sp/100)
local nn=(math.floor(sp/10))-(nnn*10)
local n=(math.floor(sp)-(nn*10))-(nnn*100)
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[n+1]
if sp>=10 then
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[nn+1]
else
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
if sp>=100 then
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[nnn+1]
else
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[12]
end
else
script.Parent.Gauges.Speedo.A.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.B.Image="http://www.roblox.com/asset/?id="..numbers[10]
script.Parent.Gauges.Speedo.C.Image="http://www.roblox.com/asset/?id="..numbers[10]
end
if Tc.Gear>=0 then
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[Tc.Gear+1]
else
script.Parent.Gauges.Gear.G.Image="http://www.roblox.com/asset/?id="..numbers[11]
end
--Status Indicators
script.Parent.Status.Clutch.B.Size=UDim2.new(0,4,-Tc.ClutchP,0)
script.Parent.Status.Throttle.B.Size=UDim2.new(0,4,-Tc.ThrotP,0)
script.Parent.Status.Brakes.B.Size=UDim2.new(0,4,-Tc.BrakeP,0)
script.Parent.Status.ThrotLimit.B.Size=UDim2.new(0,4,-Tc.MaxThrotP,0)
GSpeed=car.DriveSeat.Velocity.Magnitude
GTopSp=Tc.Trans[#Tc.Trans][4]+Tc.Trans[#Tc.Trans][6]
GRev=Tc.RPM
GThrottle=Tc.ThrotP
GBrake=Tc.BrakeP
Tc.PrevThrot=Tc.Throttle
end
local function Smoke()
local tireSP={}
for i,v in pairs(Drive) do
for n,a in pairs(v) do
if a.Wheel:FindFirstChild("Smoke")~=nil and a.Wheel:FindFirstChild("Squeal")~=nil then
if workspace:FindPartOnRay(Ray.new(a.Wheel.Position,Vector3.new(0,-a.Wheel.Size.X/2,0)),car) then
a.Wheel.Smoke.Enabled=math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)>20
a.Wheel.Squeal.Volume=math.min(1,math.max(0,math.abs((a.Wheel.RotVelocity.Magnitude*(a.Wheel.Size.X/2))-a.Wheel.Velocity.Magnitude)-20)/20)
else
a.Wheel.Smoke.Enabled=false
a.Wheel.Squeal.Volume=0
end
end
end
end
end
--run:BindToRenderStep("AChassis",Enum.RenderPriority.Last.Value,AChassis)
--run:BindToRenderStep("Speedometer",Enum.RenderPriority.Last.Value,Speedometer)
--run:BindToRenderStep("Smoke",Enum.RenderPriority.Last.Value,Smoke)
--table.insert(Binded,"AChassis")
--table.insert(Binded,"Speedometer")
--table.insert(Binded,"Smoke")
table.insert(LoopRun,AChassis)
table.insert(LoopRun,Speedometer)
table.insert(LoopRun,Smoke)
end
Engine() |
-- debug.profilebegin("NEW_IF_THEN") |
if ScreenBlockCFrame.LookVector.Y > -0.4 and CanShow and not UnderObject(ScreenBlockCFrame.Position) then |
--[=[
Check if _either_ of the keys are down. Useful when two keys might perform
the same operation.
```lua
local wOrUp = keyboard:AreEitherKeysDown(Enum.KeyCode.W, Enum.KeyCode.Up)
if wOrUp then
-- Go forward
end
```
]=] |
function Keyboard:AreEitherKeysDown(keyCodeOne: Enum.KeyCode, keyCodeTwo: Enum.KeyCode): boolean
return self:IsKeyDown(keyCodeOne) or self:IsKeyDown(keyCodeTwo)
end
function Keyboard:_setup()
self._trove:Connect(UserInputService.InputBegan, function(input, processed)
if processed then
return
end
if input.UserInputType == Enum.UserInputType.Keyboard then
self.KeyDown:Fire(input.KeyCode)
end
end)
self._trove:Connect(UserInputService.InputEnded, function(input, processed)
if processed then
return
end
if input.UserInputType == Enum.UserInputType.Keyboard then
self.KeyUp:Fire(input.KeyCode)
end
end)
end
|
-- Update. Called every frame after the camera movement step |
function Invisicam:Update()
-- Make a list of world points to raycast to
local castPoints = {}
Behaviors[Mode](castPoints)
-- Cast to get a list of objects between the camera and the cast points
local currentHits = {}
local ignoreList = {Character}
local function add(hit)
currentHits[hit] = true
if not SavedHits[hit] then
SavedHits[hit] = hit.LocalTransparencyModifier
end
end
for _, worldPoint in pairs(castPoints) do
repeat
local hitPart = CameraCast(worldPoint, ignoreList)
if hitPart then
add(hitPart)
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
add(child)
end
end
table.insert(ignoreList, hitPart) -- Next ray will go through this part
end
until not hitPart
end
-- Fade out objects that are in the way, restore those that aren't anymore
for hit, originalFade in pairs(SavedHits) do
local currentFade = hit.LocalTransparencyModifier
if currentHits[hit] then -- Fade
if currentFade < FADE_TARGET then
hit.LocalTransparencyModifier = math.min(currentFade + FADE_RATE, FADE_TARGET)
end
else -- Restore
if currentFade > originalFade then
hit.LocalTransparencyModifier = math.max(originalFade, currentFade - FADE_RATE)
else
SavedHits[hit] = nil
end
end
end
end
function Invisicam:SetMode(newMode)
AssertTypes(newMode, 'number')
for modeName, modeNum in pairs(MODE) do
if modeNum == newMode then
Mode = newMode
return
end
end
error("Invalid mode number")
end
function Invisicam:SetCustomBehavior(func)
AssertTypes(func, 'function')
Behaviors[MODE.CUSTOM] = func
end
|
-- activate Script |
local Rep = game:GetService("ReplicatedStorage")
local Assets = Rep:FindFirstChild("Assets")
local Events = Assets:FindFirstChild("Events")
Events.Dialouge1.OnServerEvent:Connect(function()
script.Parent.Main.Disabled = false
end)
|
-- Setup animation objects |
function ScriptChildModified(Child)
local FileList = AnimNames[Child.Name]
if FileList then
ConfigureAnimationSet(Child.Name, FileList)
end
end
script.ChildAdded:connect(ScriptChildModified)
script.ChildRemoved:connect(ScriptChildModified)
for Name, FileList in pairs(AnimNames) do
ConfigureAnimationSet(Name, FileList)
end
|
--[[
Credit to einsteinK.
Credit to Stravant for LBI.
Credit to the creators of all the other modules used in this.
Sceleratis was here and decided modify some things.
einsteinK was here again to fix a bug in LBI for if-statements
--]] |
local waitDeps = {
'FiOne';
'LuaK';
'LuaP';
'LuaU';
'LuaX';
'LuaY';
'LuaZ';
}
for i,v in pairs(waitDeps) do script:WaitForChild(v) end
local luaX = require(script.LuaX)
local luaY = require(script.LuaY)
local luaZ = require(script.LuaZ)
local luaU = require(script.LuaU)
local rerubi = require(script.FiOne)
luaX:init()
local LuaState = {}
getfenv().script = nil
return function(str,env)
local f,writer,buff,name
local env = env or getfenv(2)
local name = (env.script and env.script:GetFullName())
local ran,error = pcall(function()
local zio = luaZ:init(luaZ:make_getS(str), nil)
if not zio then return error() end
local func = luaY:parser(LuaState, zio, nil, name or "nil")
writer, buff = luaU:make_setS()
luaU:dump(LuaState, func, writer, buff)
f = rerubi(buff.data, env)
end)
if ran then
return f,buff.data
else
return nil,error
end
end
|
---Controller |
local Controller=false
local UserInputService = game:GetService("UserInputService")
local LStickX = 0
local RStickX = 0
local RStickY = 0
local RTriggerValue = 0
local LTriggerValue = 0
local ButtonX = 0
local ButtonY = 0
local ButtonL1 = 0
local ButtonR1 = 0
local ButtonR3 = 0
local DPadUp = 0
function DealWithInput(input,IsRobloxFunction)
if Controller then
if input.KeyCode ==Enum.KeyCode.ButtonX then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonX=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonX=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonY then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonY=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonY=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonL1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonL1=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR1=0
end
elseif input.KeyCode ==Enum.KeyCode.DPadLeft then
if input.UserInputState == Enum.UserInputState.Begin then
DPadUp=1
elseif input.UserInputState == Enum.UserInputState.End then
DPadUp=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR3=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR3=0
end
end
if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
LStickX = input.Position.X
elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
RStickX = input.Position.X
RStickY = input.Position.Y
elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder
RTriggerValue = input.Position.Z
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder
LTriggerValue = input.Position.Z
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too
UserInputService.InputEnded:connect(DealWithInput)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(Binded) do
run:UnbindFromRenderStep(v)
end
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
workspace.CurrentCamera.FieldOfView=70
player.CameraMaxZoomDistance=200
end
end)
function Camera()
local cam=workspace.CurrentCamera
local intcam=false
local CRot=0
local CBack=0
local CUp=0
local mode=0
local look=0
local camChange = 0
local function CamUpdate()
if not pcall (function()
if camChange==0 and DPadUp==1 then
intcam = not intcam
end
camChange=DPadUp
if mode==1 then
if math.abs(RStickX)>.1 then
local sPos=1
if RStickX<0 then sPos=-1 end
if intcam then
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80
else
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90
end
else
CRot=0
end
if math.abs(RStickY)>.1 then
local sPos=1
if RStickY<0 then sPos=-1 end
if intcam then
CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30
else
CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30)
end
else
CUp=0
end
else
if CRot>look then
CRot=math.max(look,CRot-20)
elseif CRot<look then
CRot=math.min(look,CRot+20)
end
CUp=0
end
if intcam then
CBack=0
else
CBack=-180*ButtonR3
end
if intcam then
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Scriptable
cam.FieldOfView=80 + car.DriveSeat.Velocity.Magnitude/12
player.CameraMaxZoomDistance=5
local cf=car.Body.Cam.CFrame
if ButtonR3==1 then
cf=car.Body.RCam.CFrame
end
cam.CoordinateFrame=cf*CFrame.Angles(0,math.rad(CRot+CBack),0)*CFrame.Angles(math.rad(CUp),0,0)
else
cam.CameraSubject=car.DriveSeat
cam.FieldOfView=70
if mode==0 then
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
else
cam.CameraType = "Scriptable"
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-((car.DriveSeat.CFrame*CFrame.Angles(math.rad(CUp),math.rad(CRot+CBack),0)).lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
end
end
end) then
cam.FieldOfView=70
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
end
end
local function ModeChange()
if GMode~=mode then
mode=GMode
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end
mouse.KeyDown:connect(function(key)
if key=="5" then
look=50
elseif key=="6" then
if intcam then
look=-160
else
look=-180
end
elseif key=="7" then
look=-50
elseif key=="v" then
run:UnbindFromRenderStep("CamUpdate")
intcam=not intcam
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end)
mouse.KeyUp:connect(function(key)
if key=="5" and look==50 then
look=0
elseif key=="6" and (look==-160 or look==-180) then
look=0
elseif key=="7" and look==-50 then
look=0
end
end)
run:BindToRenderStep("CMChange",Enum.RenderPriority.Camera.Value,ModeChange)
table.insert(Binded,"CamUpdate")
table.insert(Binded,"CMChange")
end
Camera()
mouse.KeyDown:connect(function(key)
if key=="b" then
if GMode>=1 then
GMode=0
else
GMode=GMode+1
end
if GMode==1 then
Controller=true
else
Controller=false
end
end
end)
|
--Both |
local Loudness = .75 --volume of the boost supplier (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
--(script.Parent.Values.RPM.Value/_Tune.Redline)
local WP,WV,BP,BV,HP,HV = 0
BOVact = math.floor(psi*20)
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Double" then
WP = (psi)
WV = (psi/4)*Loudness
BP = (1-(-psi/20))*BOV_Pitch
BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
elseif _Tune.Aspiration == "Super" then
psi = psi/2
HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch
HV = (psi/4)*Loudness
end
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(psi*20)
ticc = tick()
end
end
|
-- CONSTRUCTORS |
function Icon.new()
local self = {}
setmetatable(self, Icon)
-- Maids (for autocleanup)
local maid = Maid.new()
self._maid = maid
self._hoveringMaid = maid:give(Maid.new())
self._dropdownClippingMaid = maid:give(Maid.new())
self._menuClippingMaid = maid:give(Maid.new())
-- These are the GuiObjects that make up the icon
local instances = {}
self.instances = instances
local iconContainer = maid:give(iconTemplate:Clone())
iconContainer.Visible = true
iconContainer.Parent = topbarContainer
instances["iconContainer"] = iconContainer
instances["iconButton"] = iconContainer.IconButton
instances["iconImage"] = instances.iconButton.IconImage
instances["iconLabel"] = instances.iconButton.IconLabel
instances["iconGradient"] = instances.iconButton.IconGradient
instances["iconCorner"] = instances.iconButton.IconCorner
instances["iconOverlay"] = iconContainer.IconOverlay
instances["iconOverlayCorner"] = instances.iconOverlay.IconOverlayCorner
instances["noticeFrame"] = instances.iconButton.NoticeFrame
instances["noticeLabel"] = instances.noticeFrame.NoticeLabel
instances["captionContainer"] = iconContainer.CaptionContainer
instances["captionFrame"] = instances.captionContainer.CaptionFrame
instances["captionLabel"] = instances.captionContainer.CaptionLabel
instances["captionCorner"] = instances.captionFrame.CaptionCorner
instances["captionOverlineContainer"] = instances.captionContainer.CaptionOverlineContainer
instances["captionOverline"] = instances.captionOverlineContainer.CaptionOverline
instances["captionOverlineCorner"] = instances.captionOverline.CaptionOverlineCorner
instances["captionVisibilityBlocker"] = instances.captionFrame.CaptionVisibilityBlocker
instances["captionVisibilityCorner"] = instances.captionVisibilityBlocker.CaptionVisibilityCorner
instances["tipFrame"] = iconContainer.TipFrame
instances["tipLabel"] = instances.tipFrame.TipLabel
instances["tipCorner"] = instances.tipFrame.TipCorner
instances["dropdownContainer"] = iconContainer.DropdownContainer
instances["dropdownFrame"] = instances.dropdownContainer.DropdownFrame
instances["dropdownList"] = instances.dropdownFrame.DropdownList
instances["menuContainer"] = iconContainer.MenuContainer
instances["menuFrame"] = instances.menuContainer.MenuFrame
instances["menuList"] = instances.menuFrame.MenuList
instances["clickSound"] = iconContainer.ClickSound
-- These determine and describe how instances behave and appear
self._settings = {
action = {
["toggleTransitionInfo"] = {},
["captionFadeInfo"] = {},
["tipFadeInfo"] = {},
["dropdownSlideInfo"] = {},
["menuSlideInfo"] = {},
},
toggleable = {
["iconBackgroundColor"] = {instanceNames = {"iconButton"}, propertyName = "BackgroundColor3"},
["iconBackgroundTransparency"] = {instanceNames = {"iconButton"}, propertyName = "BackgroundTransparency"},
["iconCornerRadius"] = {instanceNames = {"iconCorner", "iconOverlayCorner"}, propertyName = "CornerRadius"},
["iconGradientColor"] = {instanceNames = {"iconGradient"}, propertyName = "Color"},
["iconGradientRotation"] = {instanceNames = {"iconGradient"}, propertyName = "Rotation"},
["iconImage"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconImage"}, propertyName = "Image"},
["iconImageColor"] = {instanceNames = {"iconImage"}, propertyName = "ImageColor3"},
["iconImageTransparency"] = {instanceNames = {"iconImage"}, propertyName = "ImageTransparency"},
["iconScale"] = {instanceNames = {"iconButton"}, propertyName = "Size"},
["iconSize"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconContainer"}, propertyName = "Size"},
["iconOffset"] = {instanceNames = {"iconButton"}, propertyName = "Position"},
["iconText"] = {callMethods = {self._updateIconSize}, instanceNames = {"iconLabel"}, propertyName = "Text"},
["iconTextColor"] = {instanceNames = {"iconLabel"}, propertyName = "TextColor3"},
["iconFont"] = {instanceNames = {"iconLabel"}, propertyName = "Font"},
["iconImageYScale"] = {callMethods = {self._updateIconSize}},
["iconImageRatio"] = {callMethods = {self._updateIconSize}},
["iconLabelYScale"] = {callMethods = {self._updateIconSize}},
["noticeCircleColor"] = {instanceNames = {"noticeFrame"}, propertyName = "ImageColor3"},
["noticeCircleImage"] = {instanceNames = {"noticeFrame"}, propertyName = "Image"},
["noticeTextColor"] = {instanceNames = {"noticeLabel"}, propertyName = "TextColor3"},
["noticeImageTransparency"] = {instanceNames = {"noticeFrame"}, propertyName = "ImageTransparency"},
["noticeTextTransparency"] = {instanceNames = {"noticeLabel"}, propertyName = "TextTransparency"},
["baseZIndex"] = {callMethods = {self._updateBaseZIndex}},
["order"] = {callSignals = {self.updated}, instanceNames = {"iconContainer"}, propertyName = "LayoutOrder"},
["alignment"] = {callSignals = {self.updated}, callMethods = {self._updateDropdown}},
["iconImageVisible"] = {instanceNames = {"iconImage"}, propertyName = "Visible"},
["iconImageAnchorPoint"] = {instanceNames = {"iconImage"}, propertyName = "AnchorPoint"},
["iconImagePosition"] = {instanceNames = {"iconImage"}, propertyName = "Position"},
["iconImageSize"] = {instanceNames = {"iconImage"}, propertyName = "Size"},
["iconImageTextXAlignment"] = {instanceNames = {"iconImage"}, propertyName = "TextXAlignment"},
["iconLabelVisible"] = {instanceNames = {"iconLabel"}, propertyName = "Visible"},
["iconLabelAnchorPoint"] = {instanceNames = {"iconLabel"}, propertyName = "AnchorPoint"},
["iconLabelPosition"] = {instanceNames = {"iconLabel"}, propertyName = "Position"},
["iconLabelSize"] = {instanceNames = {"iconLabel"}, propertyName = "Size"},
["iconLabelTextXAlignment"] = {instanceNames = {"iconLabel"}, propertyName = "TextXAlignment"},
["iconLabelTextSize"] = {instanceNames = {"iconLabel"}, propertyName = "TextSize"},
["noticeFramePosition"] = {instanceNames = {"noticeFrame"}, propertyName = "Position"},
["clickSoundId"] = {instanceNames = {"clickSound"}, propertyName = "SoundId"},
["clickVolume"] = {instanceNames = {"clickSound"}, propertyName = "Volume"},
["clickPlaybackSpeed"] = {instanceNames = {"clickSound"}, propertyName = "PlaybackSpeed"},
["clickTimePosition"] = {instanceNames = {"clickSound"}, propertyName = "TimePosition"},
},
other = {
["captionBackgroundColor"] = {instanceNames = {"captionFrame"}, propertyName = "BackgroundColor3"},
["captionBackgroundTransparency"] = {instanceNames = {"captionFrame"}, propertyName = "BackgroundTransparency", unique = "caption"},
["captionBlockerTransparency"] = {instanceNames = {"captionVisibilityBlocker"}, propertyName = "BackgroundTransparency", unique = "caption"},
["captionOverlineColor"] = {instanceNames = {"captionOverline"}, propertyName = "BackgroundColor3"},
["captionOverlineTransparency"] = {instanceNames = {"captionOverline"}, propertyName = "BackgroundTransparency", unique = "caption"},
["captionTextColor"] = {instanceNames = {"captionLabel"}, propertyName = "TextColor3"},
["captionTextTransparency"] = {instanceNames = {"captionLabel"}, propertyName = "TextTransparency", unique = "caption"},
["captionFont"] = {instanceNames = {"captionLabel"}, propertyName = "Font"},
["captionCornerRadius"] = {instanceNames = {"captionCorner", "captionOverlineCorner", "captionVisibilityCorner"}, propertyName = "CornerRadius"},
["tipBackgroundColor"] = {instanceNames = {"tipFrame"}, propertyName = "BackgroundColor3"},
["tipBackgroundTransparency"] = {instanceNames = {"tipFrame"}, propertyName = "BackgroundTransparency", unique = "tip"},
["tipTextColor"] = {instanceNames = {"tipLabel"}, propertyName = "TextColor3"},
["tipTextTransparency"] = {instanceNames = {"tipLabel"}, propertyName = "TextTransparency", unique = "tip"},
["tipFont"] = {instanceNames = {"tipLabel"}, propertyName = "Font"},
["tipCornerRadius"] = {instanceNames = {"tipCorner"}, propertyName = "CornerRadius"},
["dropdownSize"] = {instanceNames = {"dropdownContainer"}, propertyName = "Size", unique = "dropdown"},
["dropdownCanvasSize"] = {instanceNames = {"dropdownFrame"}, propertyName = "CanvasSize"},
["dropdownMaxIconsBeforeScroll"] = {callMethods = {self._updateDropdown}},
["dropdownMinWidth"] = {callMethods = {self._updateDropdown}},
["dropdownSquareCorners"] = {callMethods = {self._updateDropdown}},
["dropdownBindToggleToIcon"] = {},
["dropdownToggleOnLongPress"] = {},
["dropdownToggleOnRightClick"] = {},
["dropdownCloseOnTapAway"] = {},
["dropdownHidePlayerlistOnOverlap"] = {},
["dropdownListPadding"] = {callMethods = {self._updateDropdown}, instanceNames = {"dropdownList"}, propertyName = "Padding"},
["dropdownAlignment"] = {callMethods = {self._updateDropdown}},
["dropdownScrollBarColor"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarImageColor3"},
["dropdownScrollBarTransparency"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarImageTransparency"},
["dropdownScrollBarThickness"] = {instanceNames = {"dropdownFrame"}, propertyName = "ScrollBarThickness"},
["dropdownIgnoreClipping"] = {callMethods = {self._dropdownIgnoreClipping}},
["menuSize"] = {instanceNames = {"menuContainer"}, propertyName = "Size", unique = "menu"},
["menuCanvasSize"] = {instanceNames = {"menuFrame"}, propertyName = "CanvasSize"},
["menuMaxIconsBeforeScroll"] = {callMethods = {self._updateMenu}},
["menuBindToggleToIcon"] = {},
["menuToggleOnLongPress"] = {},
["menuToggleOnRightClick"] = {},
["menuCloseOnTapAway"] = {},
["menuListPadding"] = {callMethods = {self._updateMenu}, instanceNames = {"menuList"}, propertyName = "Padding"},
["menuDirection"] = {callMethods = {self._updateMenu}},
["menuScrollBarColor"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarImageColor3"},
["menuScrollBarTransparency"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarImageTransparency"},
["menuScrollBarThickness"] = {instanceNames = {"menuFrame"}, propertyName = "ScrollBarThickness"},
["menuIgnoreClipping"] = {callMethods = {self._menuIgnoreClipping}},
}
}
-- The setting values themselves will be set within _settings
-- Setup a dictionary to make it quick and easy to reference setting by name
self._settingsDictionary = {}
-- Some instances require unique behaviours. These are defined with the 'unique' key
-- for instance, we only want caption transparency effects to be applied on hovering
self._uniqueSettings = {}
self._uniqueSettingsDictionary = {}
local uniqueBehaviours = {
["caption"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("captionFadeInfo")
local newValue = value
if not self.hovering or self.captionText == nil then
newValue = 1
end
tweenService:Create(instance, tweenInfo, {[propertyName] = newValue}):Play()
end,
["tip"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("tipFadeInfo")
local newValue = value
if not self.hovering or self.tipText == nil then
newValue = 1
end
tweenService:Create(instance, tweenInfo, {[propertyName] = newValue}):Play()
end,
["dropdown"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("dropdownSlideInfo")
local bindToggleToIcon = self:get("dropdownBindToggleToIcon")
local hidePlayerlist = self:get("dropdownHidePlayerlistOnOverlap") == true and self:get("alignment") == "right"
local dropdownContainer = self.instances.dropdownContainer
local dropdownFrame = self.instances.dropdownFrame
local newValue = value
local isOpen = true
local isDeselected = not self.isSelected
if bindToggleToIcon == false then
isDeselected = not self.dropdownOpen
end
local isSpecialPressing = self._longPressing or self._rightClicking
if self._tappingAway or (isDeselected and not isSpecialPressing) or (isSpecialPressing and self.dropdownOpen) then
local dropdownSize = self:get("dropdownSize")
local XOffset = (dropdownSize and dropdownSize.X.Offset/1) or 0
newValue = UDim2.new(0, XOffset, 0, 0)
isOpen = false
end
if #self.dropdownIcons > 0 and isOpen and hidePlayerlist then
if starterGui:GetCoreGuiEnabled(Enum.CoreGuiType.PlayerList) then
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end
IconController._bringBackPlayerlist = (IconController._bringBackPlayerlist and IconController._bringBackPlayerlist + 1) or 1
self._bringBackPlayerlist = true
elseif self._bringBackPlayerlist and not isOpen and IconController._bringBackPlayerlist then
IconController._bringBackPlayerlist -= 1
if IconController._bringBackPlayerlist <= 0 then
IconController._bringBackPlayerlist = nil
starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
end
self._bringBackPlayerlist = nil
end
local tween = tweenService:Create(instance, tweenInfo, {[propertyName] = newValue})
local connection
connection = tween.Completed:Connect(function()
connection:Disconnect()
--dropdownContainer.ClipsDescendants = not self.dropdownOpen
end)
tween:Play()
if isOpen then
dropdownFrame.CanvasPosition = self._dropdownCanvasPos
else
self._dropdownCanvasPos = dropdownFrame.CanvasPosition
end
self.dropdownOpen = isOpen
self:_decideToCallSignal("dropdown")
end,
["menu"] = function(settingName, instance, propertyName, value)
local tweenInfo = self:get("menuSlideInfo")
local bindToggleToIcon = self:get("menuBindToggleToIcon")
local menuContainer = self.instances.menuContainer
local menuFrame = self.instances.menuFrame
local newValue = value
local isOpen = true
local isDeselected = not self.isSelected
if bindToggleToIcon == false then
isDeselected = not self.menuOpen
end
local isSpecialPressing = self._longPressing or self._rightClicking
if self._tappingAway or (isDeselected and not isSpecialPressing) or (isSpecialPressing and self.menuOpen) then
local menuSize = self:get("menuSize")
local YOffset = (menuSize and menuSize.Y.Offset/1) or 0
newValue = UDim2.new(0, 0, 0, YOffset)
isOpen = false
end
if isOpen ~= self.menuOpen then
self.updated:Fire()
end
if isOpen and tweenInfo.EasingDirection == Enum.EasingDirection.Out then
tweenInfo = TweenInfo.new(tweenInfo.Time, tweenInfo.EasingStyle, Enum.EasingDirection.In)
end
local tween = tweenService:Create(instance, tweenInfo, {[propertyName] = newValue})
local connection
connection = tween.Completed:Connect(function()
connection:Disconnect()
--menuContainer.ClipsDescendants = not self.menuOpen
end)
tween:Play()
if isOpen then
menuFrame.CanvasPosition = self._menuCanvasPos
else
self._menuCanvasPos = menuFrame.CanvasPosition
end
self.menuOpen = isOpen
self:_decideToCallSignal("menu")
end,
}
for settingsType, settingsDetails in pairs(self._settings) do
for settingName, settingDetail in pairs(settingsDetails) do
if settingsType == "toggleable" then
settingDetail.values = settingDetail.values or {
deselected = nil,
selected = nil,
}
else
settingDetail.value = nil
end
settingDetail.additionalValues = {}
settingDetail.type = settingsType
self._settingsDictionary[settingName] = settingDetail
--
local uniqueCat = settingDetail.unique
if uniqueCat then
local uniqueCatArray = self._uniqueSettings[uniqueCat] or {}
table.insert(uniqueCatArray, settingName)
self._uniqueSettings[uniqueCat] = uniqueCatArray
self._uniqueSettingsDictionary[settingName] = uniqueBehaviours[uniqueCat]
end
--
end
end
-- Signals (events)
self.updated = maid:give(Signal.new())
self.selected = maid:give(Signal.new())
self.deselected = maid:give(Signal.new())
self.toggled = maid:give(Signal.new())
self.hoverStarted = maid:give(Signal.new())
self.hoverEnded = maid:give(Signal.new())
self.dropdownOpened = maid:give(Signal.new())
self.dropdownClosed = maid:give(Signal.new())
self.menuOpened = maid:give(Signal.new())
self.menuClosed = maid:give(Signal.new())
self.notified = maid:give(Signal.new())
self._endNotices = maid:give(Signal.new())
self._ignoreClippingChanged = maid:give(Signal.new())
-- Connections
-- This enables us to chain icons and features like menus and dropdowns together without them being hidden by parent frame with ClipsDescendants enabled
local function setFeatureChange(featureName, value)
local parentIcon = self._parentIcon
self:set(featureName.."IgnoreClipping", value)
if value == true and parentIcon then
local connection = parentIcon._ignoreClippingChanged:Connect(function(_, value)
self:set(featureName.."IgnoreClipping", value)
end)
local endConnection
endConnection = self[featureName.."Closed"]:Connect(function()
endConnection:Disconnect()
connection:Disconnect()
end)
end
end
self.dropdownOpened:Connect(function()
setFeatureChange("dropdown", true)
end)
self.dropdownClosed:Connect(function()
setFeatureChange("dropdown", false)
end)
self.menuOpened:Connect(function()
setFeatureChange("menu", true)
end)
self.menuClosed:Connect(function()
setFeatureChange("menu", false)
end)
--]]
-- Properties
self.deselectWhenOtherIconSelected = true
self.name = ""
self.isSelected = false
self.presentOnTopbar = true
self.accountForWhenDisabled = false
self.enabled = true
self.hovering = false
self.tipText = nil
self.captionText = nil
self.totalNotices = 0
self.notices = {}
self.dropdownIcons = {}
self.menuIcons = {}
self.dropdownOpen = false
self.menuOpen = false
self.locked = false
self.topPadding = UDim.new(0, 4)
self.targetPosition = nil
self.toggleItems = {}
-- Private Properties
self._draggingFinger = false
self._updatingIconSize = true
self._previousDropdownOpen = false
self._previousMenuOpen = false
self._bindedToggleKeys = {}
self._bindedEvents = {}
-- Apply start values
self:setName("UnnamedIcon")
self:setTheme(DEFAULT_THEME, true)
-- Input handlers
-- Calls deselect/select when the icon is clicked
instances.iconButton.MouseButton1Click:Connect(function()
if self._draggingFinger then
return false
elseif self.isSelected then
self:deselect()
return true
end
self:select()
end)
instances.iconButton.MouseButton2Click:Connect(function()
self._rightClicking = true
if self:get("dropdownToggleOnRightClick") == true then
self:_update("dropdownSize")
end
if self:get("menuToggleOnRightClick") == true then
self:_update("menuSize")
end
self._rightClicking = false
end)
-- Shows/hides the dark overlay when the icon is presssed/released
instances.iconButton.MouseButton1Down:Connect(function()
if self.locked then return end
self:_updateStateOverlay(0.7, Color3.new(0, 0, 0))
end)
instances.iconButton.MouseButton1Up:Connect(function()
if self.locked then return end
self:_updateStateOverlay(0.9, Color3.new(1, 1, 1))
end)
-- Tap away + KeyCode toggles
userInputService.InputBegan:Connect(function(input, touchingAnObject)
local validTapAwayInputs = {
[Enum.UserInputType.MouseButton1] = true,
[Enum.UserInputType.MouseButton2] = true,
[Enum.UserInputType.MouseButton3] = true,
[Enum.UserInputType.Touch] = true,
}
if not touchingAnObject and validTapAwayInputs[input.UserInputType] then
self._tappingAway = true
if self.dropdownOpen and self:get("dropdownCloseOnTapAway") == true then
self:_update("dropdownSize")
end
if self.menuOpen and self:get("menuCloseOnTapAway") == true then
self:_update("menuSize")
end
self._tappingAway = false
end
--
if self._bindedToggleKeys[input.KeyCode] and not touchingAnObject then
if self.isSelected then
self:deselect()
else
self:select()
end
end
--
end)
-- hoverStarted and hoverEnded triggers and actions
-- these are triggered when a mouse enters/leaves the icon with a mouse, is highlighted with
-- a controller selection box, or dragged over with a touchpad
self.hoverStarted:Connect(function(x, y)
self.hovering = true
if not self.locked then
self:_updateStateOverlay(0.9, Color3.fromRGB(255, 255, 255))
end
if not self.isSelected then
self:_displayTip(true)
self:_displayCaption(true)
end
end)
self.hoverEnded:Connect(function()
self.hovering = false
self:_updateStateOverlay(1)
self:_displayTip(false)
self:_displayCaption(false)
self._hoveringMaid:clean()
end)
instances.iconButton.MouseEnter:Connect(function(x, y) -- Mouse (started)
self.hoverStarted:Fire(x, y)
end)
instances.iconButton.MouseLeave:Connect(function() -- Mouse (ended)
self.hoverEnded:Fire()
end)
instances.iconButton.SelectionGained:Connect(function() -- Controller (started)
self.hoverStarted:Fire()
end)
instances.iconButton.SelectionLost:Connect(function() -- Controller (ended)
self.hoverEnded:Fire()
end)
instances.iconButton.MouseButton1Down:Connect(function() -- TouchPad (started)
if self._draggingFinger then
self.hoverStarted:Fire()
end
-- Long press check
local heartbeatConnection
local releaseConnection
local longPressTime = 0.7
local endTick = tick() + longPressTime
heartbeatConnection = runService.Heartbeat:Connect(function()
if tick() >= endTick then
releaseConnection:Disconnect()
heartbeatConnection:Disconnect()
self._longPressing = true
if self:get("dropdownToggleOnLongPress") == true then
self:_update("dropdownSize")
end
if self:get("menuToggleOnLongPress") == true then
self:_update("menuSize")
end
self._longPressing = false
end
end)
releaseConnection = instances.iconButton.MouseButton1Up:Connect(function()
releaseConnection:Disconnect()
heartbeatConnection:Disconnect()
end)
end)
instances.iconButton.MouseButton1Up:Connect(function() -- TouchPad (ended)
if self.hovering then
self.hoverEnded:Fire()
end
end)
if userInputService.TouchEnabled then
-- This is used to highlight when a mobile/touch device is dragging their finger accross the screen
-- this is important for determining the hoverStarted and hoverEnded events on mobile
local dragCount = 0
userInputService.TouchMoved:Connect(function(touch, touchingAnObject)
if touchingAnObject then
return
end
self._draggingFinger = true
end)
userInputService.TouchEnded:Connect(function()
self._draggingFinger = false
end)
end
-- Finish
self._updatingIconSize = false
self._orderWasSet = (order and true) or nil
self:_updateIconSize()
IconController.iconAdded:Fire(self)
return self
end
|
--- This will cause a brick to go in motion unanchored or not! --- |
while true do
wait()
for i= 1, 50 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,-0.3,0)
wait()
end
for i= 1, 50 do
script.Parent.CFrame = script.Parent.CFrame * CFrame.new(0,0.3,0)
wait()
end
end
|
-- Returns all objects under instance with Transparency |
local function GetTransparentsRecursive(instance, partsTable)
local partsTable = partsTable or {}
for _, child in pairs(instance:GetChildren()) do
if child:IsA('BasePart') or child:IsA('Decal') then
table.insert(partsTable, child)
end
GetTransparentsRecursive(child, partsTable)
end
return partsTable
end
local function SelectionBoxify(instance)
local selectionBox = Instance.new('SelectionBox')
selectionBox.Adornee = instance
selectionBox.Color = BrickColor.new('Plum')
selectionBox.Parent = instance
return selectionBox
end
local function Light(instance)
local light = PointLight:Clone()
light.Range = light.Range + 2
light.Parent = instance
end
local function FadeOutObjects(objectsWithTransparency, fadeIncrement)
repeat
local lastObject = nil
for _, object in pairs(objectsWithTransparency) do
object.Transparency = object.Transparency + fadeIncrement
lastObject = object
end
wait()
until lastObject.Transparency >= 1 or not lastObject
end
local function Dematerialize(character, humanoid, firstPart)
local debounceTag = Instance.new('Configuration')
debounceTag.Name = DEBOUNCE_TAG_NAME
debounceTag.Parent = character
humanoid.WalkSpeed = 0
local parts = {}
for _, child in pairs(character:GetChildren()) do
if child:IsA('BasePart') then
child.Anchored = true
table.insert(parts, child)
elseif child:IsA('LocalScript') or child:IsA('Script') then
child:Destroy()
end
end
local selectionBoxes = {}
local firstSelectionBox = SelectionBoxify(firstPart)
Light(firstPart)
wait(0.05)
for _, part in pairs(parts) do
if part ~= firstPart then
table.insert(selectionBoxes, SelectionBoxify(part))
Light(part)
end
end
local objectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(objectsWithTransparency, 0.1)
wait(0.5)
humanoid.Health = 0
DebrisService:AddItem(character, 2)
local fadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({firstSelectionBox}, fadeIncrement)
if character then
character:Destroy()
end
end)
FadeOutObjects(selectionBoxes, fadeIncrement)
end
local function OnTouched(shot, otherPart)
local character, humanoid = FindCharacterAncestor(otherPart)
if character and humanoid and character ~= Character and not character:FindFirstChild(DEBOUNCE_TAG_NAME) and not character:FindFirstChild'ForceField' then
local isTeammate = GLib.IsTeammate(GLib.GetPlayerFromPart(Tool), GLib.GetPlayerFromPart(Character))
if not isTeammate then
ApplyTags(humanoid)
if shot then
local hitFadeSound = shot:FindFirstChild(HitFadeSound.Name)
if hitFadeSound then
hitFadeSound.Parent = humanoid.Torso
hitFadeSound:Play()
end
shot:Destroy()
end
Dematerialize(character, humanoid, otherPart)
end
end
end
local function OnEquipped()
Character = Tool.Parent
Humanoid = Character:WaitForChild('Humanoid')
Player = PlayersService:GetPlayerFromCharacter(Character)
end
local function OnActivated(hit)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
for i = 1, 3 do
FireSound:Play()
local handleCFrame = Handle.CFrame
local firingPoint = handleCFrame.p + handleCFrame:vectorToWorldSpace(NOZZLE_OFFSET)
local shotCFrame = CFrame.new(firingPoint, hit)
local laserShotClone = BaseShot:Clone()
laserShotClone.CFrame = shotCFrame + (shotCFrame.lookVector * (BaseShot.Size.Z / 2))
local bodyVelocity = Instance.new('BodyVelocity')
bodyVelocity.velocity = shotCFrame.lookVector * SHOT_SPEED
bodyVelocity.Parent = laserShotClone
laserShotClone.Touched:connect(function(otherPart)
OnTouched(laserShotClone, otherPart)
end)
DebrisService:AddItem(laserShotClone, SHOT_TIME)
laserShotClone.Parent = workspace
wait(0.15)
end
wait(0.6) -- FireSound length
ReloadSound:Play()
wait(0.75) -- ReloadSound length
Tool.Enabled = true
end
end
local function OnUnequipped()
end
|
--- Returns a new ArgumentContext, an object that handles parsing and validating arguments |
function Argument.new (command, argumentObject, value)
local self = {
Command = command; -- The command that owns this argument
Type = nil; -- The type definition
Name = argumentObject.Name; -- The name for this specific argument
Object = argumentObject; -- The raw ArgumentObject (definition)
Required = argumentObject.Default == nil and argumentObject.Optional ~= true; -- If the argument is required or not.
Executor = command.Executor; -- The player who is running the command
RawValue = nil; -- The raw, unparsed value
RawSegments = {}; -- The raw, unparsed segments (if the raw value was comma-sep)
TransformedValues = {}; -- The transformed value (generated later)
Prefix = nil; -- The prefix for this command (%Team)
}
local parsedType, parsedRawValue, prefix = Util.ParsePrefixedUnionType(
TYPE_DEFAULTS[argumentObject.Type] or argumentObject.Type, value
)
self.Type = command.Dispatcher.Registry:GetType(parsedType)
self.RawValue = parsedRawValue
self.Prefix = prefix
if self.Type == nil then
error(string.format("%s has an unregistered type %q", self.Name or "<none>", parsedType or "<none>"))
end
setmetatable(self, Argument)
self:Transform()
return self
end
|
-- скрипт текущего выбора |
local Players = game:GetService("Players") -- берём ссылку на список игроков
local localPlayer = Players.LocalPlayer
plr = Players:FindFirstChild(localPlayer.Name)
me=script.Parent
item=me.Parent
|
--[[**
ensures all values in given table pass check
@param check The function to use to check the values
@returns A function that will return true iff the condition is passed
**--]] |
function t.values(check)
assert(t.callback(check))
return function(value)
local tableSuccess, tableErrMsg = t.table(value)
if tableSuccess == false then
return false, tableErrMsg or ""
end
for key, val in value do
local success, errMsg = check(val)
if success == false then
return false, string.format("bad value for key %s:\n\t%s", tostring(key), errMsg or "")
end
end
return true
end
end
|
--[[ The Module ]] | --
local BaseCamera = {}
BaseCamera.__index = BaseCamera
function BaseCamera.new()
local self = setmetatable({}, BaseCamera)
-- So that derived classes have access to this
self.FIRST_PERSON_DISTANCE_THRESHOLD = FIRST_PERSON_DISTANCE_THRESHOLD
self.cameraType = nil
self.cameraMovementMode = nil
local player = Players.LocalPlayer
self.lastCameraTransform = nil
self.rotateInput = ZERO_VECTOR2
self.userPanningCamera = false
self.lastUserPanCamera = tick()
self.humanoidRootPart = nil
self.humanoidCache = {}
-- Subject and position on last update call
self.lastSubject = nil
self.lastSubjectPosition = Vector3.new(0,5,0)
-- These subject distance members refer to the nominal camera-to-subject follow distance that the camera
-- is trying to maintain, not the actual measured value.
-- The default is updated when screen orientation or the min/max distances change,
-- to be sure the default is always in range and appropriate for the orientation.
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.currentSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
self.inFirstPerson = false
self.inMouseLockedMode = false
self.portraitMode = false
self.isSmallTouchScreen = false
-- Used by modules which want to reset the camera angle on respawn.
self.resetCameraAngle = true
self.enabled = false
-- Input Event Connections
self.inputBeganConn = nil
self.inputChangedConn = nil
self.inputEndedConn = nil
self.startPos = nil
self.lastPos = nil
self.panBeginLook = nil
self.panEnabled = true
self.keyPanEnabled = true
self.distanceChangeEnabled = true
self.PlayerGui = nil
self.cameraChangedConn = nil
self.viewportSizeChangedConn = nil
self.boundContextActions = {}
-- VR Support
self.shouldUseVRRotation = false
self.VRRotationIntensityAvailable = false
self.lastVRRotationIntensityCheckTime = 0
self.lastVRRotationTime = 0
self.vrRotateKeyCooldown = {}
self.cameraTranslationConstraints = Vector3.new(1, 1, 1)
self.humanoidJumpOrigin = nil
self.trackingHumanoid = nil
self.cameraFrozen = false
self.subjectStateChangedConn = nil
-- Gamepad support
self.activeGamepad = nil
self.gamepadPanningCamera = false
self.lastThumbstickRotate = nil
self.numOfSeconds = 0.7
self.currentSpeed = 0
self.maxSpeed = 6
self.vrMaxSpeed = 4
self.lastThumbstickPos = Vector2.new(0,0)
self.ySensitivity = 0.65
self.lastVelocity = nil
self.gamepadConnectedConn = nil
self.gamepadDisconnectedConn = nil
self.currentZoomSpeed = 1.0
self.L3ButtonDown = false
self.dpadLeftDown = false
self.dpadRightDown = false
-- Touch input support
self.isDynamicThumbstickEnabled = false
self.fingerTouches = {}
self.dynamicTouchInput = nil
self.numUnsunkTouches = 0
self.inputStartPositions = {}
self.inputStartTimes = {}
self.startingDiff = nil
self.pinchBeginZoom = nil
self.userPanningTheCamera = false
self.touchActivateConn = nil
-- Mouse locked formerly known as shift lock mode
self.mouseLockOffset = ZERO_VECTOR3
-- [[ NOTICE ]] --
-- Initialization things used to always execute at game load time, but now these camera modules are instantiated
-- when needed, so the code here may run well after the start of the game
if player.Character then
self:OnCharacterAdded(player.Character)
end
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char)
end)
if self.cameraChangedConn then self.cameraChangedConn:Disconnect() end
self.cameraChangedConn = workspace:GetPropertyChangedSignal("CurrentCamera"):Connect(function()
self:OnCurrentCameraChanged()
end)
self:OnCurrentCameraChanged()
if self.playerCameraModeChangeConn then self.playerCameraModeChangeConn:Disconnect() end
self.playerCameraModeChangeConn = player:GetPropertyChangedSignal("CameraMode"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.minDistanceChangeConn then self.minDistanceChangeConn:Disconnect() end
self.minDistanceChangeConn = player:GetPropertyChangedSignal("CameraMinZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.maxDistanceChangeConn then self.maxDistanceChangeConn:Disconnect() end
self.maxDistanceChangeConn = player:GetPropertyChangedSignal("CameraMaxZoomDistance"):Connect(function()
self:OnPlayerCameraPropertyChange()
end)
if self.playerDevTouchMoveModeChangeConn then self.playerDevTouchMoveModeChangeConn:Disconnect() end
self.playerDevTouchMoveModeChangeConn = player:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
self:OnDevTouchMovementModeChanged()
end)
self:OnDevTouchMovementModeChanged() -- Init
if self.gameSettingsTouchMoveMoveChangeConn then self.gameSettingsTouchMoveMoveChangeConn:Disconnect() end
self.gameSettingsTouchMoveMoveChangeConn = UserGameSettings:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
self:OnGameSettingsTouchMovementModeChanged()
end)
self:OnGameSettingsTouchMovementModeChanged() -- Init
UserGameSettings:SetCameraYInvertVisible()
UserGameSettings:SetGamepadCameraSensitivityVisible()
self.hasGameLoaded = game:IsLoaded()
if not self.hasGameLoaded then
self.gameLoadedConn = game.Loaded:Connect(function()
self.hasGameLoaded = true
self.gameLoadedConn:Disconnect()
self.gameLoadedConn = nil
end)
end
if FFlagUserFixZoomClampingIssues then
self:OnPlayerCameraPropertyChange()
end
return self
end
function BaseCamera:GetModuleName()
return "BaseCamera"
end
function BaseCamera:OnCharacterAdded(char)
self.resetCameraAngle = self.resetCameraAngle or self:GetEnabled()
self.humanoidRootPart = nil
if UserInputService.TouchEnabled then
self.PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
for _, child in ipairs(char:GetChildren()) do
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = true
end
end)
char.ChildRemoved:Connect(function(child)
if child:IsA("Tool") then
self.isAToolEquipped = false
end
end)
end
end
function BaseCamera:GetHumanoidRootPart()
if not self.humanoidRootPart then
local player = Players.LocalPlayer
if player.Character then
local humanoid = player.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
self.humanoidRootPart = humanoid.RootPart
end
end
end
return self.humanoidRootPart
end
function BaseCamera:GetBodyPartToFollow(humanoid, isDead)
-- If the humanoid is dead, prefer the head part if one still exists as a sibling of the humanoid
if humanoid:GetState() == Enum.HumanoidStateType.Dead then
local character = humanoid.Parent
if character and character:IsA("Model") then
return character:FindFirstChild("Head") or humanoid.RootPart
end
end
return humanoid.RootPart
end
function BaseCamera:GetSubjectPosition()
local result = self.lastSubjectPosition
local camera = game.Workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if VRService.VREnabled and humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
else
local bodyPartToFollow = humanoid.RootPart
-- If the humanoid is dead, prefer their head part as a follow target, if it exists
if humanoidIsDead then
if humanoid.Parent and humanoid.Parent:IsA("Model") then
bodyPartToFollow = humanoid.Parent:FindFirstChild("Head") or bodyPartToFollow
end
end
if bodyPartToFollow and bodyPartToFollow:IsA("BasePart") then
local heightOffset
if humanoid.RigType == Enum.HumanoidRigType.R15 then
if humanoid.AutomaticScalingEnabled then
heightOffset = R15_HEAD_OFFSET
if bodyPartToFollow == humanoid.RootPart then
local rootPartSizeOffset = (humanoid.RootPart.Size.Y/2) - (HUMANOID_ROOT_PART_SIZE.Y/2)
heightOffset = heightOffset + Vector3.new(0, rootPartSizeOffset, 0)
end
else
heightOffset = R15_HEAD_OFFSET_NO_SCALING
end
else
heightOffset = HEAD_OFFSET
end
if humanoidIsDead then
heightOffset = ZERO_VECTOR3
end
result = bodyPartToFollow.CFrame.p + bodyPartToFollow.CFrame:vectorToWorldSpace(heightOffset + humanoid.CameraOffset)
end
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = SEAT_OFFSET
if VRService.VREnabled then
offset = VR_SEAT_OFFSET
end
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
elseif cameraSubject:IsA("SkateboardPlatform") then
result = cameraSubject.CFrame.p + SEAT_OFFSET
elseif cameraSubject:IsA("BasePart") then
result = cameraSubject.CFrame.p
elseif cameraSubject:IsA("Model") then
if cameraSubject.PrimaryPart then
result = cameraSubject:GetPrimaryPartCFrame().p
else
result = cameraSubject:GetModelCFrame().p
end
end
else
-- cameraSubject is nil
-- Note: Previous RootCamera did not have this else case and let self.lastSubject and self.lastSubjectPosition
-- both get set to nil in the case of cameraSubject being nil. This function now exits here to preserve the
-- last set valid values for these, as nil values are not handled cases
return
end
self.lastSubject = cameraSubject
self.lastSubjectPosition = result
return result
end
function BaseCamera:UpdateDefaultSubjectDistance()
local player = Players.LocalPlayer
if self.portraitMode then
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, PORTRAIT_DEFAULT_DISTANCE)
else
self.defaultSubjectDistance = Util.Clamp(player.CameraMinZoomDistance, player.CameraMaxZoomDistance, DEFAULT_DISTANCE)
end
end
function BaseCamera:OnViewportSizeChanged()
local camera = game.Workspace.CurrentCamera
local size = camera.ViewportSize
self.portraitMode = size.X < size.Y
self.isSmallTouchScreen = UserInputService.TouchEnabled and (size.Y < 500 or size.X < 700)
self:UpdateDefaultSubjectDistance()
end
|
-- find player's head pos |
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
Tool.Handle.Fire:Play()
local launch = head.Position + 10 * v
local missile = Pellet:clone()
missile.Position = launch
missile.Velocity = v * 100
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,85,0)
force.Parent = missile
missile.SnowballScript.Disabled = false
missile.Parent = game.Workspace
end
function gunUp()
Tool.GripForward = Vector3.new(0,.981,-.196)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,.196,.981)
end
function gunOut()
Tool.GripForward = Vector3.new(0,1,0)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,0,1)
end
enabled = true
function onActivated()
if not enabled then
return
end
enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
local reload = .1
gunUp()
fire(lookAt)
wait(reload)
gunOut()
wait(reload)
enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-------------------------------------------------------------------------- |
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = true ,
--Friction and Wear
FWearSpeed = .4 ,
FTargetFriction = 1.2 ,
FMinFriction = .1 ,
RWearSpeed = .4 ,
RTargetFriction = 1.1 ,
RMinFriction = .1 ,
--Tire Slip
TCSOffRatio = 3.7/4 ,
WheelLockRatio = 1/2 , --SS6 Default = 1/4
WheelspinRatio = 1/1.1 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 10 , --SS6 Default = 1
RFrictionWeight = 10 , --SS6 Default = 1
FLgcyFrWeight = 10 ,
RLgcyFrWeight = 10 ,
FElasticity = 0 , --SS6 Default = .5
RElasticity = 0 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 0 , --SS6 Default = 1
RElastWeight = 0 , --SS6 Default = 1
FLgcyElWeight = 0 ,
RLgcyElWeight = 0 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
-- Initialize the tool |
local PaintTool = {
Name = 'Paint Tool';
Color = BrickColor.new 'Really red';
-- Default options
BrickColor = nil;
}
PaintTool.ManualText = [[<font face="GothamBlack" size="16">Paint Tool 🛠</font>
Lets you paint parts in different colors.<font size="6"><br /></font>
<b>TIP:</b> Press <b><i>R</i></b> while hovering over a part to copy its color.]]
function PaintTool:Equip()
-- Enables the tool's equipped functionality
-- Set up maid for cleanup
self.Maid = Maid.new()
-- Start up our interface
ShowUI();
self:BindShortcutKeys()
self:EnableClickPainting()
end;
function PaintTool:Unequip()
-- Disables the tool's equipped functionality
-- Hide UI
HideUI()
-- Clean up resources
self.Maid = self.Maid:Destroy()
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if PaintTool.UI then
-- Reveal the UI
PaintTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
PaintTool.UI = Core.Tool.Interfaces.BTPaintToolGUI:Clone();
PaintTool.UI.Parent = Core.UI;
PaintTool.UI.Visible = true;
-- Track palette buttons
PaletteButtons = {};
-- Enable the palette
for _, Column in pairs(PaintTool.UI.Palette:GetChildren()) do
for _, Button in pairs(Column:GetChildren()) do
if Button.ClassName == 'TextButton' then
-- Recolor the selection when the button is clicked
Button.MouseButton1Click:Connect(function ()
SetColor(BrickColor.new(Button.Name).Color);
end);
-- Register the button
PaletteButtons[Button.Name] = Button;
end;
end;
end;
-- Paint selection when current color indicator is clicked
PaintTool.UI.Controls.LastColorButton.MouseButton1Click:Connect(PaintParts);
-- Enable color picker button
local ColorPickerHandle = nil
PaintTool.UI.Controls.ColorPickerButton.MouseButton1Click:Connect(function ()
local CommonColor = Support.IdentifyCommonProperty(Selection.Parts, 'Color')
local ColorPickerElement = Roact.createElement(ColorPicker, {
InitialColor = CommonColor or Color3.fromRGB(255, 255, 255);
SetPreviewColor = PreviewColor;
OnConfirm = function (Color)
SetColor(Color)
ColorPickerHandle = Roact.unmount(ColorPickerHandle)
end;
OnCancel = function ()
ColorPickerHandle = Roact.unmount(ColorPickerHandle)
end;
})
ColorPickerHandle = ColorPickerHandle and
Roact.update(ColorPickerHandle, ColorPickerElement) or
Roact.mount(ColorPickerElement, Core.UI, 'ColorPicker')
end)
-- Hook up manual triggering
local SignatureButton = PaintTool.UI:WaitForChild('Title'):WaitForChild('Signature')
ListenForManualWindowTrigger(PaintTool.ManualText, PaintTool.Color.Color, SignatureButton)
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not PaintTool.UI then
return;
end;
-- Hide the UI
PaintTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function UpdateUI()
-- Updates information on the UI
-- Make sure the UI's on
if not PaintTool.UI then
return;
end;
-----------------------------------------
-- Update the color information indicator
-----------------------------------------
-- Clear old color indicators
for Color, Button in pairs(PaletteButtons) do
Button.Text = '';
end;
-- Indicate the variety of colors in the selection
for _, Part in pairs(Selection.Parts) do
if PaletteButtons[Part.BrickColor.Name] and Part.Color == Part.BrickColor.Color then
PaletteButtons[Part.BrickColor.Name].Text = '+';
end;
end;
-- Update the color picker button's background
local CommonColor = Support.IdentifyCommonProperty(Selection.Parts, 'Color');
PaintTool.UI.Controls.ColorPickerButton.ImageColor3 = CommonColor or PaintTool.BrickColor or Color3.new(1, 0, 0);
end;
function SetColor(Color)
-- Changes the color option to `Color`
-- Set the color option
PaintTool.BrickColor = Color;
-- Use BrickColor name if color matches one
local EquivalentBrickColor = BrickColor.new(Color);
local RGBText = ('(%d, %d, %d)'):format(Color.r * 255, Color.g * 255, Color.b * 255);
local ColorText = (EquivalentBrickColor.Color == Color) and EquivalentBrickColor.Name or RGBText;
-- Shortcuts to color indicators
local ColorLabel = PaintTool.UI.Controls.LastColorButton.ColorName;
local ColorSquare = ColorLabel.ColorSquare;
-- Update the indicators
ColorLabel.Visible = true;
ColorLabel.Text = ColorText;
ColorSquare.BackgroundColor3 = Color;
ColorSquare.Position = UDim2.new(1, -ColorLabel.TextBounds.X - 18, 0.2, 1);
-- Paint currently selected parts
PaintParts();
end;
function PaintParts()
-- Recolors the selection with the selected color
-- Make sure painting is possible
if (not PaintTool.BrickColor) or (#Selection.Parts == 0) then
return
end
-- Create history record
local Record = PaintHistoryRecord.new()
Record.TargetColor = PaintTool.BrickColor
-- Perform action
Record:Apply(true)
-- Register history record
Core.History.Add(Record)
end
function PreviewColor(Color)
-- Previews the given color on the selection
-- Reset colors to initial state if previewing is over
if not Color and InitialState then
for Part, State in pairs(InitialState) do
-- Reset part color
Part.Color = State.Color;
-- Update union coloring options
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = State.UsePartColor;
end;
end;
-- Clear initial state
InitialState = nil;
-- Skip rest of function
return;
-- Ensure valid color is given
elseif not Color then
return;
-- Save initial state if first time previewing
elseif not InitialState then
InitialState = {};
for _, Part in pairs(Selection.Parts) do
InitialState[Part] = { Color = Part.Color, UsePartColor = (Part.ClassName == 'UnionOperation') and Part.UsePartColor or nil };
end;
end;
-- Apply preview color
for _, Part in pairs(Selection.Parts) do
Part.Color = Color;
-- Enable union coloring
if Part.ClassName == 'UnionOperation' then
Part.UsePartColor = true;
end;
end;
end;
function PaintTool:BindShortcutKeys()
-- Enables useful shortcut keys for this tool
-- Track user input while this tool is equipped
self.Maid.Hotkeys = Support.AddUserInputListener('Began', 'Keyboard', false, function (Input)
-- Paint selection if Enter is pressed
if (Input.KeyCode.Name == 'Return') or (Input.KeyCode.Name == 'KeypadEnter') then
return PaintParts()
end
-- Check if the R key was pressed, and it wasn't the selection clearing hotkey
if (Input.KeyCode.Name == 'R') and (not Selection.Multiselecting) then
-- Set the current color to that of the current mouse target (if any)
if Core.Mouse.Target then
SetColor(Core.Mouse.Target.Color);
end;
end;
end)
end;
function PaintTool:EnableClickPainting()
-- Allows the player to paint parts by clicking on them
-- Watch out for clicks on selected parts
self.Maid.ClickPainting = Selection.FocusChanged:Connect(function (Focus)
local Target, ScopeTarget = Core.Targeting:UpdateTarget()
if Selection.IsSelected(ScopeTarget) then
-- Paint the selected parts
PaintParts();
end;
end);
end;
|
-- Create remote variable
-- Create remote instance |
local updateWalkspeedRemote = Instance.new("RemoteEvent", game.ReplicatedStorage)
updateWalkspeedRemote.Name = "UpdateWalkspeed"
|
-- Container for temporary connections (disconnected automatically) |
local Connections = {};
function SurfaceTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
EnableSurfaceSelection();
-- Set our current surface mode
SetSurface(SurfaceTool.Surface);
end;
function SurfaceTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
ClearConnections();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:Disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
local self = SurfaceTool
-- Reveal UI if already created
if SurfaceTool.UI then
-- Reveal the UI
SurfaceTool.UI.Visible = true;
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
-- Skip UI creation
return;
end;
-- Create the UI
SurfaceTool.UI = Core.Tool.Interfaces.BTSurfaceToolGUI:Clone();
SurfaceTool.UI.Parent = Core.UI;
SurfaceTool.UI.Visible = true;
-- Create type dropdown
local Surfaces = {
'All';
'Top';
'Bottom';
'Front';
'Back';
'Left';
'Right';
}
local function BuildSurfaceDropdown()
return Roact.createElement(Dropdown, {
Position = UDim2.new(0, 30, 0, 0);
Size = UDim2.new(0, 72, 0, 25);
Options = Surfaces;
MaxRows = 4;
CurrentOption = self.Surface;
OnOptionSelected = function (Option)
SetSurface(Option)
end;
})
end
-- Mount surface dropdown
local SurfaceDropdownHandle = Roact.mount(BuildSurfaceDropdown(), self.UI.SideOption, 'Dropdown')
self.OnSurfaceChanged:Connect(function ()
Roact.update(SurfaceDropdownHandle, BuildSurfaceDropdown())
end)
-- Create type dropdown
local SurfaceTypes = {
'Smooth';
'Studs';
'Inlet';
'Weld';
'Hinge';
'Motor';
'Universal';
'Glue';
}
local function BuildSurfaceTypeDropdown()
return Roact.createElement(Dropdown, {
Position = UDim2.new(0, 30, 0, 0);
Size = UDim2.new(0, 91, 0, 25);
Options = SurfaceTypes;
MaxRows = 4;
CurrentOption = self.CurrentSurfaceType and self.CurrentSurfaceType.Name;
OnOptionSelected = function (Option)
SetSurfaceType(Enum.SurfaceType[Option])
end;
})
end
-- Mount type dropdown
local TypeDropdownHandle = Roact.mount(BuildSurfaceTypeDropdown(), self.UI.TypeOption, 'Dropdown')
self.OnSurfaceTypeChanged:Connect(function ()
Roact.update(TypeDropdownHandle, BuildSurfaceTypeDropdown())
end)
-- Hook up manual triggering
local SignatureButton = SurfaceTool.UI:WaitForChild('Title'):WaitForChild('Signature')
ListenForManualWindowTrigger(SurfaceTool.ManualText, SurfaceTool.Color.Color, SignatureButton)
-- Update the UI every 0.1 seconds
UIUpdater = Support.ScheduleRecurringTask(UpdateUI, 0.1);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not SurfaceTool.UI then
return;
end;
-- Hide the UI
SurfaceTool.UI.Visible = false;
-- Stop updating the UI
UIUpdater:Stop();
end;
function GetSurfaceTypeDisplayName(SurfaceType)
-- Returns a more friendly name for the given `SurfaceType`
-- For stepping motors, add a space
if SurfaceType == Enum.SurfaceType.SteppingMotor then
return 'Stepping Motor';
-- For no outlines, simplify name
elseif SurfaceType == Enum.SurfaceType.SmoothNoOutlines then
return 'No Outline';
-- For other surface types, return their normal name
else
return SurfaceType.Name;
end;
end;
function UpdateUI()
-- Updates information on the UI
local self = SurfaceTool
-- Make sure the UI's on
if not SurfaceTool.UI then
return;
end;
-- Only show and identify current surface type if selection is not empty
if #Selection.Parts == 0 then
if self.CurrentSurfaceType ~= '' then
self.CurrentSurfaceType = ''
self.OnSurfaceTypeChanged:Fire('')
end
return;
end;
------------------------------------
-- Update the surface type indicator
------------------------------------
-- Collect all different surface types in selection
local SurfaceTypeVariations = {};
for _, Part in pairs(Selection.Parts) do
-- Search for variations on all surfaces if all surfaces are selected
if SurfaceTool.Surface == 'All' then
table.insert(SurfaceTypeVariations, Part.TopSurface);
table.insert(SurfaceTypeVariations, Part.BottomSurface);
table.insert(SurfaceTypeVariations, Part.FrontSurface);
table.insert(SurfaceTypeVariations, Part.BackSurface);
table.insert(SurfaceTypeVariations, Part.LeftSurface);
table.insert(SurfaceTypeVariations, Part.RightSurface);
-- Search for variations on single selected surface
else
table.insert(SurfaceTypeVariations, Part[SurfaceTool.Surface .. 'Surface']);
end;
end;
-- Identify common surface type in selection
local CommonSurfaceType = Support.IdentifyCommonItem(SurfaceTypeVariations);
-- Update the current surface type in the surface type dropdown
if self.CurrentSurfaceType ~= CommonSurfaceType then
self.CurrentSurfaceType = CommonSurfaceType
self.OnSurfaceTypeChanged:Fire(CommonSurfaceType)
end
end
function SetSurface(SurfaceName)
-- Changes the surface option to `Surface`
-- Set the surface option
SurfaceTool.Surface = SurfaceName;
SurfaceTool.OnSurfaceChanged:Fire(SurfaceName)
end;
function SetSurfaceType(SurfaceType)
-- Changes the selection's surface type on the currently selected surface
-- Make sure a surface has been selected
if not SurfaceTool.Surface then
return;
end;
-- Track changes
TrackChange();
-- Change the surface of the parts locally
for _, Part in pairs(Selection.Parts) do
-- Change all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Part.TopSurface = SurfaceType;
Part.BottomSurface = SurfaceType;
Part.FrontSurface = SurfaceType;
Part.BackSurface = SurfaceType;
Part.LeftSurface = SurfaceType;
Part.RightSurface = SurfaceType;
-- Change specific selected surface
else
Part[SurfaceTool.Surface .. 'Surface'] = SurfaceType;
end;
end;
-- Register changes
RegisterChange();
end;
function EnableSurfaceSelection()
-- Allows the player to select surfaces by clicking on them
-- Watch out for clicks on selected parts
Connections.SurfaceSelection = Core.Mouse.Button1Down:Connect(function ()
local _, ScopeTarget = Core.Targeting:UpdateTarget()
if Selection.IsSelected(ScopeTarget) then
-- Set the surface option to the target surface
SetSurface(Core.Mouse.TargetSurface.Name);
end;
end);
end;
function TrackChange()
-- Start the record
HistoryRecord = {
Parts = Support.CloneTable(Selection.Parts);
BeforeSurfaces = {};
AfterSurfaces = {};
Selection = Selection.Items;
Unapply = function (Record)
-- Reverts this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Surfaces = Record.BeforeSurfaces[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncSurface', Changes);
end;
Apply = function (Record)
-- Applies this change
-- Select the changed parts
Selection.Replace(Record.Selection)
-- Put together the change request
local Changes = {};
for _, Part in pairs(Record.Parts) do
table.insert(Changes, { Part = Part, Surfaces = Record.AfterSurfaces[Part] });
end;
-- Send the change request
Core.SyncAPI:Invoke('SyncSurface', Changes);
end;
};
-- Collect the selection's initial state
for _, Part in pairs(HistoryRecord.Parts) do
-- Begin to record surfaces
HistoryRecord.BeforeSurfaces[Part] = {};
local Surfaces = HistoryRecord.BeforeSurfaces[Part];
-- Record all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Surfaces.Top = Part.TopSurface;
Surfaces.Bottom = Part.BottomSurface;
Surfaces.Front = Part.FrontSurface;
Surfaces.Back = Part.BackSurface;
Surfaces.Left = Part.LeftSurface;
Surfaces.Right = Part.RightSurface;
-- Record specific selected surface
else
Surfaces[SurfaceTool.Surface] = Part[SurfaceTool.Surface .. 'Surface'];
end;
end;
end;
function RegisterChange()
-- Finishes creating the history record and registers it
-- Make sure there's an in-progress history record
if not HistoryRecord then
return;
end;
-- Collect the selection's final state
local Changes = {};
for _, Part in pairs(HistoryRecord.Parts) do
-- Begin to record surfaces
HistoryRecord.AfterSurfaces[Part] = {};
local Surfaces = HistoryRecord.AfterSurfaces[Part];
-- Record all surfaces if all selected
if SurfaceTool.Surface == 'All' then
Surfaces.Top = Part.TopSurface;
Surfaces.Bottom = Part.BottomSurface;
Surfaces.Front = Part.FrontSurface;
Surfaces.Back = Part.BackSurface;
Surfaces.Left = Part.LeftSurface;
Surfaces.Right = Part.RightSurface;
-- Record specific selected surface
else
Surfaces[SurfaceTool.Surface] = Part[SurfaceTool.Surface .. 'Surface'];
end;
-- Create the change request for this part
table.insert(Changes, { Part = Part, Surfaces = Surfaces });
end;
-- Send the changes to the server
Core.SyncAPI:Invoke('SyncSurface', Changes);
-- Register the record and clear the staging
Core.History.Add(HistoryRecord);
HistoryRecord = nil;
end;
|
--force.maxForce = Vector3.new(200,0,200) |
gyro.maxTorque = Vector3.new(50000,500000,500000)
gyro.cframe = CFrame.fromEulerAnglesXYZ(math.pi/2,math.pi,-math.pi/2+ math.random(-2*math.pi,2*math.pi))
current_look = math.random(-2*math.pi,2*math.pi)
math.randomseed(tick())
function idle()
wait(math.random(3,10))
end
function lookaround()
for i=1,math.random(2,5) do
wait(math.random(.5,1))
current_look = current_look + math.random(-math.pi/12,math.pi/12)
gyro.cframe = CFrame.fromEulerAnglesXYZ(math.pi/2,math.pi,-math.pi/2+ current_look)
end
end
function walk()
for i=1,math.random(2,10) do
current_look = current_look + math.random(-math.pi/4,math.pi/4)
gyro.cframe = CFrame.fromEulerAnglesXYZ(math.pi/2,math.pi,-math.pi/2+ current_look)
wait(math.random(.5,1))
force.velocity = (script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,-math.pi/2,0)).lookVector * 20
force.maxForce = Vector3.new(100,100,100)
wait(math.random(.5,1))
force.maxForce = Vector3.new(0,0,0)
wait(math.random(1,1.5))
end
end
while true do--math.random(0,2*math.pi)
wait()
local rand = math.random(1,4)
if rand == 1 then
walk()
elseif rand == 2 or rand == 4 then
lookaround()
else
idle()
end
end
|
--[[Weight and CG]] |
Tune.Weight = 1045 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6.5 ,
--[[Height]] 4.8 ,
--[[Length]] 17 }
Tune.WeightDist = 51 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .7 -- 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
|
--[[
Returns the window associated with specified model
]] |
function WindowManager.getWindowByPart(part)
return registry:get(part)
end
function WindowManager.getAll()
return registry:getAll()
end
return WindowManager
|
-- functions |
function onDied()
stopLoopedSounds()
for _,Child in pairs(Figure:FindFirstChild("Head"):GetChildren())do
if Child and Child.ClassName=="Sound"then
Child.Volume=0
Child:Stop()
end
end
sDied.Volume=1;
sDied:Play();
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
task.spawn( function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
task.wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end
function onStateNoStop(state, sound)
if state then
sound:Play()
end
end
function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning:Play()
sRunning.Pitch = speed / 8.0
else
sRunning:Stop()
end
prevState = "Run"
end
function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end
function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end |
--local Character = Player.Character or Player.CharacterAdded:Wait() | |
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,VRecoil = {35,45} --- Vertical Recoil
,HRecoil = {32,35} --- Horizontal Recoil
,AimRecover = .35 ---- Between 0 & 1
,RecoilPunch = .2
,VPunchBase = 30.75 --- Vertical Punch
,HPunchBase = 22.25 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 1 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.1
,MinRecoilPower = 1
,MaxRecoilPower = 1
,RecoilPowerStepAmount = 1
,MinSpread = 35 --- Min bullet spread value | Studs
,MaxSpread = 65 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 15
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 2 --- Max sway value based on player stamina | Studs |