prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--[[ Constants ]]
|
--
local movementKeys = {
[Enum.KeyCode.W] = true;
[Enum.KeyCode.A] = true;
[Enum.KeyCode.S] = true;
[Enum.KeyCode.D] = true;
[Enum.KeyCode.Up] = true;
[Enum.KeyCode.Down] = true;
}
local Player = Players.LocalPlayer
local ClickToMoveDisplay = require(script.Parent:WaitForChild("ClickToMoveDisplay"))
local ZERO_VECTOR3 = Vector3.new(0,0,0)
local ALMOST_ZERO = 0.000001
|
-- // Chat Icon Amendment by ChipioIndustries.
-- // Based on latest chat version as of 10/10/2019
-- // Edits on lines 42, 80, 207
| |
--==========BEGIN FUNCTIONS:
--a total of 0 functions have been replaced with local variables
--==========END FUNCTIONS
| |
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 100 -- Spring Dampening
Tune.FSusStiffness = 5000 -- Spring Force
Tune.FSusLength = 3 -- Suspension length (in studs)
Tune.FSusMaxExt = .4 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .3 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 100 -- Spring Dampening
Tune.RSusStiffness = 5000 -- Spring Force
Tune.RSusLength = 3 -- Suspension length (in studs)
Tune.RSusMaxExt = .4 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .3 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
-- goro7
|
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y - 5) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
--!strict
|
return function (system, particleInstance)
warn("Particle Created, Info Follows")
warn("CFrame:", particleInstance.CFrame)
warn("Color:", particleInstance.Color)
warn("Instance:", particleInstance)
end
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "k" then --Camera controls
if cam == ("car") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Custom")
cam = ("freeplr")
Camera.FieldOfView = 70
elseif cam == ("freeplr") then
Camera.CameraSubject = player.Character.Humanoid
Camera.CameraType = ("Attach")
cam = ("lockplr")
Camera.FieldOfView = 45
elseif cam == ("lockplr") then
Camera.CameraSubject = carSeat
Camera.CameraType = ("Custom")
cam = ("car")
Camera.FieldOfView = 70
end
elseif key == "g" then --Window controls
if carSeat.Wipers.Value == false then
carSeat.Wipers.Value = true
else carSeat.Wipers.Value = false
end
elseif key == "[" then -- volume down
if carSeat.Parent.MP.Volume.Value > 0 then
carSeat.Parent.MP.Volume.Value = carSeat.Parent.MP.Volume.Value - 2
end
elseif key == "]" then -- volume up
if carSeat.Parent.MP.Volume.Value < 500000 then
carSeat.Parent.MP.Volume.Value = carSeat.Parent.MP.Volume.Value + 2
end
elseif key == "u" then --Window controls
if windows == false then
winfob.Visible = true
windows = true
else windows = false
winfob.Visible = false
end
end
end)
winfob.FL.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowFL.Value == false then
carSeat.WindowFL.Value = true
carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle - 0.20
else carSeat.WindowFL.Value = false
carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FL.Window.SS.Motor.DesiredAngle + 0.20
end
end)
winfob.FR.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowFR.Value == false then
carSeat.WindowFR.Value = true
carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle + 0.20
else carSeat.WindowFR.Value = false
carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.FR.Window.SS.Motor.DesiredAngle - 0.20
end
end)
winfob.RL.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowRL.Value == false then
carSeat.WindowRL.Value = true
carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle - 0.20
else carSeat.WindowRL.Value = false
carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RL.Window.SS.Motor.DesiredAngle + 0.20
end
end)
winfob.RR.Lock.MouseButton1Click:connect(function() --Window
if carSeat.WindowRR.Value == false then
carSeat.WindowRR.Value = true
carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle + 0.20
else carSeat.WindowRR.Value = false
carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle = carSeat.Parent.Misc.RR.Window.SS.Motor.DesiredAngle - 0.20
end
end)
HUB.Limiter.MouseButton1Click:connect(function() --Ignition
if carSeat.IsOn.Value == false then
carSeat.IsOn.Value = true
carSeat.Startup:Play()
carSeat.Parent.Body.Lights.Int.Material = "SmoothPlastic"
carSeat.Parent.Body.SmokeA.ParticleEmitter.Enabled = true
carSeat.Parent.Body.Dash.Screen.G.Enabled = true
carSeat.Parent.Body.Dash.DashSc.G.Enabled = true
carSeat.Parent.Body.Lights.Runner.Material = "Neon"
else
carSeat.IsOn.Value = false
carSeat.Parent.Body.SmokeA.ParticleEmitter.Enabled = false
carSeat.Parent.Body.Dash.Screen.G.Enabled = false
carSeat.Parent.Body.Dash.DashSc.G.Enabled = false
carSeat.Parent.Body.Lights.Runner.Material = "SmoothPlastic"
end
end)
TR.SN.MouseButton1Click:connect(function() --Show tracker names
script.Parent.Names.Value = true
end)
TR.HN.MouseButton1Click:connect(function() --Hide tracker names
script.Parent.Names.Value = false
end)
carSeat.Indicator.Changed:connect(function()
if carSeat.Indicator.Value == true then
script.Parent.Indicator:Play()
else
script.Parent.Indicator2:Play()
end
end)
--raycasting BMS
local snsrs = carSeat.Parent.Body.Sensors
local rel = snsrs.BMSL.RayEnd
local rl = snsrs.BMSL.RayStart
local rer = snsrs.BMSR.RayEnd
local rrr = snsrs.BMSR.RayStart
if workspace:FindPartOnRay(Ray.new(rel.CFrame.p,(rel.CFrame.p-rl.CFrame.p).unit * 18)) then
carSeat.Parent.Misc.FL.Door.Mirror.Light.G.Enabled = true
else carSeat.Parent.Misc.FL.Door.Mirror.Light.G.Enabled = false
end
if workspace:FindPartOnRay(Ray.new(rer.CFrame.p,(rer.CFrame.p-rrr.CFrame.p).unit * 18)) then
carSeat.Parent.Misc.FR.Door.Mirror.Light.G.Enabled = true
else carSeat.Parent.Misc.FR.Door.Mirror.Light.G.Enabled = false
end
carSeat.LI.Changed:connect(function()
if carSeat.LI.Value == true then
carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = true
script.Parent.HUB.Left.Visible = true
else
carSeat.Parent.Body.Dash.DashSc.G.Left.Visible = false
script.Parent.HUB.Left.Visible = false
end
end)
carSeat.RI.Changed:connect(function()
if carSeat.RI.Value == true then
carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = true
script.Parent.HUB.Right.Visible = true
else
carSeat.Parent.Body.Dash.DashSc.G.Right.Visible = false
script.Parent.HUB.Right.Visible = false
end
end)
while wait() do
carSeat.Parent.Body.Dash.Screen.G.Time.Text = game.Lighting.TimeOfDay
carSeat.Parent.Body.Dash.DashSc.G.Time.Text = game.Lighting.TimeOfDay
carSeat.Parent.Body.Dash.DashSc.G.Speed.Text = math.floor(carSeat.Velocity.magnitude*((10/12) * (60/88)))
script.Parent.HUB.Time.Text = game.Lighting.TimeOfDay
end
|
--[=[
@param instance Instance
@param componentClass ComponentClass
@return Component?
Gets an instance of a component class given the Roblox instance
and the component class. Returns `nil` if not found.
```lua
local MyComponent = require(somewhere.MyComponent)
local myComponentInstance = Component.FromInstance(workspace.SomeInstance, MyComponent)
```
]=]
|
function Component.FromInstance(instance: Instance, componentClass)
return componentClass._instancesToComponents[instance]
end
function Component:_instantiate(instance: Instance)
local component = setmetatable({}, self)
component.Instance = instance
component._activeExtensions = GetActiveExtensions(component, self._extensions)
if not ShouldConstruct(component) then
return nil
end
InvokeExtensionFn(component, "Constructing")
if type(component.Construct) == "function" then
component:Construct()
end
InvokeExtensionFn(component, "Constructed")
return component
end
function Component:_setup()
local watchingInstances = {}
local function StartComponent(component)
InvokeExtensionFn(component, "Starting")
component:Start()
InvokeExtensionFn(component, "Started")
local hasHeartbeatUpdate = typeof(component.HeartbeatUpdate) == "function"
local hasSteppedUpdate = typeof(component.SteppedUpdate) == "function"
local hasRenderSteppedUpdate = typeof(component.RenderSteppedUpdate) == "function"
if hasHeartbeatUpdate then
component._heartbeatUpdate = RunService.Heartbeat:Connect(function(dt)
component:HeartbeatUpdate(dt)
end)
end
if hasSteppedUpdate then
component._steppedUpdate = RunService.Stepped:Connect(function(_, dt)
component:SteppedUpdate(dt)
end)
end
if hasRenderSteppedUpdate and not IS_SERVER then
if component.RenderPriority then
self._renderName = NextRenderName()
RunService:BindToRenderStep(self._renderName, component.RenderPriority, function(dt)
component:RenderSteppedUpdate(dt)
end)
else
component._renderSteppedUpdate = RunService.RenderStepped:Connect(function(dt)
component:RenderSteppedUpdate(dt)
end)
end
end
component._started = true
self.Started:Fire(component)
end
local function StopComponent(component)
if component._heartbeatUpdate then
component._heartbeatUpdate:Disconnect()
end
if component._steppedUpdate then
component._steppedUpdate:Disconnect()
end
if component._renderSteppedUpdate then
component._renderSteppedUpdate:Disconnect()
elseif component._renderName then
RunService:UnbindFromRenderStep(self._renderName)
end
InvokeExtensionFn(component, "Stopping")
component:Stop()
InvokeExtensionFn(component, "Stopped")
self.Stopped:Fire(component)
end
local function TryConstructComponent(instance)
if self._instancesToComponents[instance] then return end
local component = self:_instantiate(instance)
if not component then
return
end
self._instancesToComponents[instance] = component
table.insert(self._components, component)
task.defer(function()
if self._instancesToComponents[instance] == component then
StartComponent(component)
end
end)
end
local function TryDeconstructComponent(instance)
local component = self._instancesToComponents[instance]
if not component then return end
self._instancesToComponents[instance] = nil
local index = table.find(self._components, component)
if index then
local n = #self._components
self._components[index] = self._components[n]
self._components[n] = nil
end
if component._started then
task.spawn(StopComponent, component)
end
end
local function StartWatchingInstance(instance)
if watchingInstances[instance] then return end
local function IsInAncestorList(): boolean
for _,parent in ipairs(self._ancestors) do
if instance:IsDescendantOf(parent) then
return true
end
end
return false
end
local ancestryChangedHandle = self._trove:Connect(instance.AncestryChanged, function(_, parent)
if parent and IsInAncestorList() then
TryConstructComponent(instance)
else
TryDeconstructComponent(instance)
end
end)
watchingInstances[instance] = ancestryChangedHandle
if IsInAncestorList() then
TryConstructComponent(instance)
end
end
local function InstanceTagged(instance: Instance)
StartWatchingInstance(instance)
end
local function InstanceUntagged(instance: Instance)
local watchHandle = watchingInstances[instance]
if watchHandle then
watchHandle:Disconnect()
watchingInstances[instance] = nil
end
TryDeconstructComponent(instance)
end
self._trove:Connect(CollectionService:GetInstanceAddedSignal(self.Tag), InstanceTagged)
self._trove:Connect(CollectionService:GetInstanceRemovedSignal(self.Tag), InstanceUntagged)
local tagged = CollectionService:GetTagged(self.Tag)
for _,instance in ipairs(tagged) do
task.defer(InstanceTagged, instance)
end
end
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringArms,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
| |
--[=[
@return RBXScriptConnection
Creates a simplified timer which just fires off a callback function at the given interval.
```lua
-- Basic:
Timer.Simple(1, function()
print("Tick")
end)
-- Using other arguments:
Timer.Simple(1, function()
print("Tick")
end, true, RunService.Heartbeat, os.clock)
```
]=]
|
function Timer.Simple(interval: number, callback: CallbackFn, startNow: boolean?, updateSignal: RBXScriptSignal?, timeFn: TimeFn?)
local update = updateSignal or RunService.Heartbeat
local t = timeFn or time
local nextTick = t() + interval
if startNow then
task.defer(callback)
end
return update:Connect(function()
local now = t()
if now >= nextTick then
nextTick = now + interval
task.defer(callback)
end
end)
end
|
-- Connect events to appropriate functions
|
eventsFolder.DamageCharacter.OnServerEvent:Connect(damageCharacter)
eventsFolder.LaserFired.OnServerEvent:Connect(playerFiredLaser)
|
--MOBILE CONTROLS--
|
local Buttons = script.Parent:WaitForChild("Buttons")
local Left = Buttons:WaitForChild("Left")
local Right = Buttons:WaitForChild("Right")
local Brake = Buttons:WaitForChild("Brake")
local Gas = Buttons:WaitForChild("Gas")
local Handbrake = Buttons:WaitForChild("Handbrake")
if UserInputService.TouchEnabled then
Buttons.Visible = true
end
local function LeftTurn(Touch, GPE)
if Touch.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
Left.InputBegan:Connect(LeftTurn)
Left.InputEnded:Connect(LeftTurn)
|
-- Click Detection --
|
local clickDetector = workspace.GoldGrabber.ClickDetector
function onMouseClick(player)
local leaderstats = player.leaderstats
local goldStat = leaderstats and leaderstats:FindFirstChild("Gold")
if goldStat then
goldStat.Value += 1
end
end
clickDetector.MouseClick:Connect(onMouseClick)
|
--[=[
Cleans up the translator and deletes the localization table if it exists.
]=]
|
function JSONTranslator:Destroy()
self._localizationTable:Destroy()
self._localizationTable = nil
self._englishTranslator = nil
self._promiseTranslator = nil
setmetatable(self, nil)
end
return JSONTranslator
|
-- services
|
local Players = game:GetService("Players")
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local GlobalModifier = Instance.new("NumberValue") -- modifier for rain visibility for disabling/enabling over time span
GlobalModifier.Value = 1 -- 0 = fully visible, 1 = invisible
local connections = {} -- Stores connections to RunService signals when enabled
local disabled = true -- Value to figure out whether we are moving towards a disabled state (useful during tweens)
local rainDirection = RAIN_DEFAULT_DIRECTION -- Direction that rain falls into
local currentCeiling = nil -- Y coordinate of ceiling (if present)
local collisionMode = CollisionMode.None -- Collision mode (from Rain.CollisionMode) for raycasting
local collisionList = nil -- Blacklist/whitelist for raycasting
local collisionFunc = nil -- Raycasting test function for when collisionMode == Rain.CollisionMode.Function
local straightLowAlpha = 1 -- Current transparency for straight rain particles
local topdownLowAlpha = 1 -- Current transparency for top-down rain particles
local intensityOccludedRain = 0 -- Current intensity of occluded rain particles
local numSplashes = 0 -- Current number of generated splashes per frame
local volumeTarget = 0 -- Current (target of tween for) sound volume
|
--[[
Contains the logic to run a test plan and gather test results from it.
TestRunner accepts a TestPlan object, executes the planned tests, and
produces a TestResults object. While the tests are running, the system's
state is contained inside a TestSession object.
]]
|
local TestEnum = require(script.Parent.TestEnum)
local TestSession = require(script.Parent.TestSession)
local LifecycleHooks = require(script.Parent.LifecycleHooks)
local RUNNING_GLOBAL = "__TESTEZ_RUNNING_TEST__"
local TestRunner = {
environment = {}
}
local function wrapExpectContextWithPublicApi(expectationContext)
return setmetatable({
extend = function(...)
expectationContext:extend(...)
end,
}, {
__call = function(_self, ...)
return expectationContext:startExpectationChain(...)
end,
})
end
|
-- Finds a visible player at a certain position relative to the camera, otherwise returns nil
|
local function findSelectedPlayer(objectPosition, camera, playersService, maxClickDistance)
if camera then
local ray = camera:ScreenPointToRay(objectPosition.X, objectPosition.Y)
local raycastResult = workspace:Raycast(ray.Origin, ray.Direction * maxClickDistance) -- sets the max click distance relative to camera
if raycastResult then
local hitPart = raycastResult.Instance
local character = hitPart:FindFirstAncestorOfClass("Model")
if character then
-- Prevents selection of an invisible character
local isVisible = false
local transparencyValues = {}
for _, descendant in pairs(character:GetDescendants()) do
if descendant:IsA("BasePart") or descendant:IsA("Decal") then
table.insert(transparencyValues, descendant.Transparency)
end
end
-- Check that all character parts are invisible (Transparency = 1)
for _, value in ipairs(transparencyValues) do
if value == 0 then
isVisible = true
end
end
if isVisible then
local targetPlayer = playersService:GetPlayerFromCharacter(character)
if targetPlayer then
return targetPlayer
end
end
end
end
end
return nil
end
ProfileCard.defaultProps = {
Players = game:GetService("Players"),
MainFrame = MainFrame,
Camera = workspace.CurrentCamera,
UpdateProfileRemoteFunction = script.Parent.Parent.RemoteEvents.UpdateProfileRemoteFunction,
PulsePrompt = require(script.Parent.PulsePrompt),
}
local ViewTypes = {
KeyboardView = Vector3.new(0, 6, 0),
CenterView = Vector3.new(0, 1, 0),
OriginalView = Vector3.new(0, 0, 0),
}
local gamepadInputs = {
Enum.UserInputType.Gamepad1,
Enum.UserInputType.Gamepad2,
Enum.UserInputType.Gamepad3,
Enum.UserInputType.Gamepad4,
Enum.UserInputType.Gamepad5,
Enum.UserInputType.Gamepad6,
Enum.UserInputType.Gamepad7,
Enum.UserInputType.Gamepad8,
}
function ProfileCard:init()
self.state = {
userId = self.props.userId,
isEditing = false,
showStatusError = false,
showPrompt = true,
viewType = ViewTypes.OriginalView,
activeGamepad = false,
}
self.setHumanoidMovementEnabled = function(canMoveBool)
-- Prevents character movement
local LocalPlayer = self.props.Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
if HumanoidRootPart then
HumanoidRootPart.Anchored = not canMoveBool
end
end
self.setKeyboardMovementEnabled = function(enabledBool)
-- Prevents character movement and camera rotation
if enabledBool then
self.props.controls:Enable()
ContextActionService:BindActionAtPriority("RightMouseDisable", function()
return Enum.ContextActionResult.Pass
end, false, Enum.ContextActionPriority.Medium.Value, Enum.UserInputType.MouseButton2)
else
self.props.controls:Disable()
ContextActionService:BindActionAtPriority("RightMouseDisable", function()
return Enum.ContextActionResult.Sink
end, false, Enum.ContextActionPriority.Medium.Value, Enum.UserInputType.MouseButton2)
end
end
self.getOtherGuis = function()
local res = {}
local playerGui = self.props.Players.LocalPlayer:FindFirstChild("PlayerGui")
if playerGui then
for _, instance in pairs(playerGui:GetDescendants()) do
if
(instance:IsA("ScreenGui") or instance:IsA("BillboardGui"))
and not instance:GetAttribute("ShowInProfileCard")
and instance.Enabled
then
table.insert(res, instance)
end
end
end
return res
end
self.getShownCoreGuis = function()
local shownCoreGuis = Cryo.List.filter(Enum.CoreGuiType:GetEnumItems(), function(coreGuiType)
-- The inclusion of these GUIs will cause the entire screen to flash after an edit to the ProfileCard is saved. Filtering out for now.
if Enum.CoreGuiType.PlayerList == coreGuiType or Enum.CoreGuiType.All == coreGuiType then
return false
end
return StarterGui:GetCoreGuiEnabled(coreGuiType)
end)
return shownCoreGuis
end
self.hideGuis = function()
if callbacks.hideOtherGuis.isCallbackSet() then
callbacks.hideOtherGuis.fireCallback()
return
end
-- Hide ScreenGuis
self.disabledGuis = self.getOtherGuis()
for _, gui in ipairs(self.disabledGuis) do
gui.Enabled = false
end
-- Hide CoreGuis
self.disabledCoreGuis = self.getShownCoreGuis()
for _, gui in ipairs(self.disabledCoreGuis) do
StarterGui:SetCoreGuiEnabled(gui, false)
end
-- Hide mobile controls
self.modalEnabled = UserInputService.ModalEnabled
UserInputService.ModalEnabled = true
end
self.showGuis = function()
if callbacks.showOtherGuis.isCallbackSet() then
callbacks.showOtherGuis.fireCallback()
return
end
-- Show guis that were hidden by hideGuis()
for _, gui in ipairs(self.disabledGuis) do
gui.Enabled = true
end
self.disabledGuis = {}
for _, gui in ipairs(self.disabledCoreGuis) do
StarterGui:SetCoreGuiEnabled(gui, true)
end
self.disabledCoreGuis = {}
UserInputService.ModalEnabled = self.modalEabled
end
self.toggleEdit = function(object)
if not self.state.isEditing then
self:setState({ isEditing = true })
self.props.Camera.CameraType = Enum.CameraType.Scriptable
self.hideGuis()
if UserInputService.TouchEnabled then
self:setState({ viewType = ViewTypes.CenterView })
end
-- Prevent character movement
self.setHumanoidMovementEnabled(false)
if UserInputService.KeyboardEnabled then
self.setKeyboardMovementEnabled(false)
end
else
local filteredTextTable = self.props.UpdateProfileRemoteFunction:InvokeServer(
self.props.Players.LocalPlayer,
object.Parent.Status.Text
)
if filteredTextTable.success then
self.showGuis()
self:setState({ isEditing = false, showStatusError = false, viewType = ViewTypes.OriginalView })
self.props.Camera.CameraType = Enum.CameraType.Custom
-- Restore movement
self.setHumanoidMovementEnabled(true)
if UserInputService.KeyboardEnabled then
self.setKeyboardMovementEnabled(true)
end
else
self:setState({ showStatusError = true })
if UserInputService.TouchEnabled then
self:setState({ viewType = ViewTypes.CenterView })
end
end
end
end
self.updateViewToKeyboard = function()
self:setState({ viewType = ViewTypes.KeyboardView })
end
self.unmount = function()
self:setState({ userId = Roact.None, isEditing = false })
end
self.onInputBegan = function(input, gameProcessedEvent)
local isValidInput = input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
if isValidInput and not self.state.isEditing and not gameProcessedEvent then
-- Prevents opening a new profile card while editing; also prevents profile card from closing when interacting with engine related UI (eg. chat button)
local inputPos = input.Position
local playerGui = self.props.Players.LocalPlayer:WaitForChild("PlayerGui")
local profileCard = playerGui:FindFirstChild("ProfileCard")
local shouldUnmount = true
if profileCard then
local guis = playerGui:GetGuiObjectsAtPosition(inputPos.X, inputPos.Y)
for _, g in ipairs(guis) do
local billboard = g:FindFirstAncestorOfClass("BillboardGui")
if billboard and billboard == profileCard then
shouldUnmount = false
end
end
end
if shouldUnmount then
local player = findSelectedPlayer(
inputPos,
self.props.Camera,
self.props.Players,
self.props.configuration.maxClickDistance
)
if player then
-- Opens a new profile card with the relevant player details
self:setState({ userId = player.UserId, showPrompt = false, viewType = ViewTypes.OriginalView })
else
-- Hide an open profile card if input is not on the card itself
self.unmount()
end
end
end
end
self.checkViewport = function(testPos)
local _, inViewport = self.props.Camera:WorldToViewportPoint(testPos)
return inViewport
end
self.determineStudOffset = function(object)
if not object then
return Vector3.new(0, 0, 0)
elseif self.state.viewType == ViewTypes.KeyboardView or self.state.viewType == ViewTypes.CenterView then
return self.state.viewType
end
local copyCFrame = object.CFrame
local rightCFrame = copyCFrame + Vector3.new(Constants.STUD_OFFSET_X, 1, 0)
local leftCFrame = copyCFrame + Vector3.new(-Constants.STUD_OFFSET_X, 1, 0)
local studsOffsetVector = Vector3.new(0, 0, 0)
if self.checkViewport(rightCFrame.Position) then
studsOffsetVector = Vector3.new(Constants.STUD_OFFSET_X, 1, 0)
elseif self.checkViewport(leftCFrame.Position) then
studsOffsetVector = Vector3.new(-Constants.STUD_OFFSET_X, 1, 0)
end
if self.state.viewType == ViewTypes.OriginalView then
ViewTypes.OriginalView = studsOffsetVector
end
return studsOffsetVector
end
self.getAdornee = function(player)
local adornee = player == self.props.Players.LocalPlayer and player.Character:FindFirstChild("HumanoidRootPart")
or Anchor.createAnchor(player)
return adornee
end
self.profileCard = Roact.createRef()
end
function ProfileCard:render()
-- Prevent gamepad interaction
if table.find(gamepadInputs, UserInputService:GetLastInputType()) ~= nil or self.state.activeGamepad then
return
end
local Players = self.props.Players
local player
if self.state.userId then
player = Players:GetPlayerByUserId(self.state.userId)
end
return Roact.createFragment({
Roact.createElement(ProfileCardContext.Provider, { userId = self.state.userId }, {
ProfileCard = player and Roact.createElement("BillboardGui", {
Active = true,
Size = UDim2.new(0, Constants.GUI_SIZE_X, 0, Constants.GUI_SIZE_Y),
AlwaysOnTop = self.props.configuration.alwaysOnTop,
Adornee = self.getAdornee(player),
StudsOffset = self.determineStudOffset(player.Character:FindFirstChild("HumanoidRootPart")),
[Roact.Ref] = self.profileCard,
}, {
MainFrame = Roact.createElement(self.props.MainFrame, {
controls = self.props.controls,
isEditing = self.state.isEditing,
toggleEdit = self.toggleEdit,
showStatusError = self.state.showStatusError,
updateViewToKeyboard = self.updateViewToKeyboard,
}),
}),
ExternalEventConnection = Roact.createElement(ExternalEventConnection, {
event = UserInputService.InputBegan, -- Maybe use Touch/Tap in world, specifically for mobile
callback = self.onInputBegan,
}),
-- Creates a blur effect when editing
BlurEffectPortal = self.state.isEditing and self.props.configuration.showBlur and Roact.createElement(
Roact.Portal,
{ target = self.props.Camera },
{ BlurEffect = Roact.createElement("BlurEffect") }
),
}),
PersonalIndicator = Roact.createElement(self.props.PulsePrompt, {
Players = Players,
adornee = self.props.adornee,
isEnabled = self.state.showPrompt,
userId = Players.LocalPlayer.UserId,
}),
})
end
function ProfileCard:didMount()
UserInputService.LastInputTypeChanged:Connect(function(lastInputType)
if table.find(gamepadInputs, lastInputType) ~= nil then
self:setState({
activeGamepad = true,
isEditing = false,
showStatusError = false,
viewType = ViewTypes.OriginalView,
})
self.setHumanoidMovementEnabled(true)
self.props.Camera.CameraType = Enum.CameraType.Custom
return
end
if self.state.activeGamepad then
self:setState({ activeGamepad = false })
end
end)
end
function ProfileCard:didUpdate()
if self.state.userId then
self.profileCard:getValue():SetAttribute("ShowInProfileCard", true)
-- Hide the Profile Card from view once it leaves the screen
local adornee = self.getAdornee(self.props.Players:GetPlayerByUserId(self.state.userId))
local adorneeOffset = self.determineStudOffset(adornee)
coroutine.wrap(function(object)
local inViewport = self.checkViewport(object.Position)
while inViewport and object do
wait(1)
local newCFrame = object.CFrame
newCFrame = newCFrame * CFrame.new(adorneeOffset)
inViewport = self.checkViewport(object.Position)
end
self.unmount()
end)(adornee)
end
end
return withConfiguration(ProfileCard)
|
--[[
if hasModel then
script.Parent.Text = "ON"
button.BackgroundColor3 = Color3.new(0, 255, 0)
elseif not hasModel then
button.Text = "OFF"
button.BackgroundColor3 = Color3.new(255, 0, 0)
end
--]]
|
button.MouseButton1Click:Connect(function()
if RS.Models:FindFirstChild("Mesh") then
button.Text = "ON"
button.BackgroundColor3 = Color3.new(0, 255, 0)
event:FireServer("on")
elseif not RS.Models:FindFirstChild("Mesh") then
button.Text = "OFF"
button.BackgroundColor3 = Color3.new(255, 0, 0)
event:FireServer("off")
end
end)
|
-- constants
|
local PLAYER_DATA = ReplicatedStorage.PlayerData
local CUSTOMIZATION = ReplicatedStorage.Customization
|
-- Container for temporary connections (disconnected automatically)
|
local Connections = {};
function WeldTool.Equip()
-- Enables the tool's equipped functionality
-- Start up our interface
ShowUI();
EnableFocusHighlighting();
end;
function WeldTool.Unequip()
-- Disables the tool's equipped functionality
-- Clear unnecessary resources
HideUI();
ClearConnections();
end;
function ClearConnections()
-- Clears out temporary connections
for ConnectionKey, Connection in pairs(Connections) do
Connection:disconnect();
Connections[ConnectionKey] = nil;
end;
end;
function ShowUI()
-- Creates and reveals the UI
-- Reveal UI if already created
if UI then
-- Reveal the UI
UI.Visible = true;
-- Skip UI creation
return;
end;
-- Create the UI
UI = Core.Tool.Interfaces.BTWeldToolGUI:Clone();
UI.Parent = Core.UI;
UI.Visible = true;
-- Hook up the buttons
UI.Interface.WeldButton.MouseButton1Click:connect(CreateWelds);
UI.Interface.BreakWeldsButton.MouseButton1Click:connect(BreakWelds);
end;
function HideUI()
-- Hides the tool UI
-- Make sure there's a UI
if not UI then
return;
end;
-- Hide the UI
UI.Visible = false;
end;
|
--[=[
Requires all the modules that are descendants of the given parent.
]=]
|
function KnitClient.AddControllersDeep(parent: Instance): {Controller}
local addedControllers = {}
for _,v in ipairs(parent:GetDescendants()) do
if not v:IsA("ModuleScript") then continue end
table.insert(addedControllers, require(v))
end
return addedControllers
end
|
-- Get reference to the Dock frame
|
local dock = script.Parent.Parent.AdmDockShelf
|
-- RANK, RANK NAMES & SPECIFIC USERS
|
Ranks = {
{5, "Owner", {"Februar92",0}, };
{4, "HeadAdmin", {"",0}, };
{3, "Admin", {"",0}, };
{2, "Mod", {"",0}, };
{1, "VIP", {"",0}, };
{0, "NonAdmin", };
};
|
--Made by Luckymaxer
|
Character = script.Parent
Humanoid = Character:FindFirstChild("Humanoid")
Debris = game:GetService("Debris")
WindDirection = script:FindFirstChild("WindDirection")
Force = script:FindFirstChild("Force")
Parts = {}
BaseColor = BrickColor.new("Lime green")
Color = BaseColor.Color
Gravity = 196.20
Duration = 3
Classes = {
BasePart = {
BrickColor = BaseColor,
Material = Enum.Material.Plastic,
Reflectance = 0,
Transparency = 0.75,
},
FileMesh = {
TextureId = "",
},
DataModelMesh = {
VertexColor = Vector3.new(Color.r, Color.g, Color.b),
},
CharacterMesh = {
BaseTextureId = 0,
OverlayTextureId = 0,
},
Shirt = {
ShirtTemplate = "",
},
Pants = {
PantsTemplate = "",
},
FaceInstance = {
Texture = "",
},
Sparkles = {
SparkleColor = Color,
Enabled = false,
},
Fire = {
Color = Color,
SecondaryColor = Color,
Enabled = false,
},
Smoke = {
Color = Color,
Enabled = false,
},
Light = {
Color = Color,
Enabled = false,
},
ParticleEmitter = {
Color = ColorSequence.new(Color, Color),
Enabled = false,
}
}
Fire = script:FindFirstChild("Fire")
Objects = {}
RemovedObjects = {}
FakeParts = {}
Hats = {}
Tools = {}
Particles = {}
function DestroyScript()
Debris:AddItem(script, 0.5)
end
function TweenNumber(Start, Goal, Time)
return ((Goal - Start) / Time)
end
function Decorate(Object)
local ObjectData = {
Object = nil,
Properties = {},
}
for i, v in pairs(Classes) do
if Object:IsA(i) then
if Object:IsA("CharacterMesh") then
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.MeshId = ("http://www.roblox.com/asset/?id=" .. Object.MeshId)
for ii, vv in pairs(Character:GetChildren()) do
if vv:IsA("BasePart") and Object.BodyPart.Name == string.gsub(vv.Name, " ", "") then
Mesh.Parent = vv
table.insert(RemovedObjects, {Object = Object, NewObject = Mesh, Parent = Object.Parent})
Object.Parent = nil
end
end
elseif Object:IsA("BasePart") and Object.Transparency >= 1 then
else
ObjectData.Object = Object
for ii, vv in pairs(v) do
local PropertyValue = nil
local PropertyValueSet = false
pcall(function()
PropertyValue = Object[ii]
PropertyValueSet = true
Object[ii] = vv
end)
if PropertyValueSet then
ObjectData.Properties[ii] = PropertyValue
end
end
end
end
end
table.insert(Objects, ObjectData)
end
function Redesign(Parent)
for i, v in pairs(Parent:GetChildren()) do
if v ~= script then
Decorate(v)
Redesign(v)
end
end
end
if not Humanoid or not WindDirection then
DestroyScript()
return
end
for i, v in pairs(Character:GetChildren()) do
if v:IsA("Accoutrement") or v:IsA("Tool") then
local FakeObject = v:Clone()
Decorate(FakeObject)
table.insert(((v:IsA("Accoutrement") and Hats) or Tools), v)
for ii, vv in pairs(FakeObject:GetChildren()) do
if vv:IsA("BasePart") then
local FakePart = vv:Clone()
FakePart.Name = v.Name
for iii, vvv in pairs(FakePart:GetChildren()) do
if vvv:IsA("JointInstance") then
vvv:Destroy()
end
end
table.insert(FakeParts, FakePart)
FakePart.Parent = Character
FakePart.CFrame = vv.CFrame
end
end
end
end
Humanoid:UnequipTools()
for i, v in pairs({Hats, Tools}) do
for ii, vv in pairs(v) do
vv.Parent = nil
end
end
Redesign(Character)
local GhostModel = Instance.new("Model")
GhostModel.Name = "GhostModel"
for i, v in pairs(Character:GetChildren()) do
if v:IsA("BasePart") then
if v.Name ~= "HumanoidRootPart" then
local FakePart = v:Clone()
FakePart.Name = "Part"
FakePart.CanCollide = false
for ii, vv in pairs(FakePart:GetChildren()) do
if not vv:IsA("DataModelMesh") then
vv:Destroy()
end
end
table.insert(FakeParts, FakePart)
local Mass = (v:GetMass() * Gravity ^ 2)
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.maxForce = Vector3.new(Mass, Mass, Mass)
BodyVelocity.velocity = (WindDirection.Value * Force.Value)
BodyVelocity.Parent = FakePart
FakePart.Parent = GhostModel
local FireParticle = Fire:Clone()
FireParticle.Color = ColorSequence.new(Color, Color)
FireParticle.Enabled = true
table.insert(Particles, FireParticle)
FireParticle.Parent = FakePart
end
v:Destroy()
end
end
Spawn(function()
local Start = Classes.BasePart.Transparency
local End = 1
local Time = 0.4
local Rate = (1 / 30)
local Frames = (Time / Rate)
for i = 1, Frames do
local Transparency = (Start + TweenNumber(Start, End, (Frames / (i + 1))))
for ii, vv in pairs(FakeParts) do
if vv and vv.Parent then
vv.Transparency = Transparency
end
end
wait(Rate)
end
for i, v in pairs(Particles) do
v.Enabled = false
end
end)
Debris:AddItem(GhostModel, 5)
GhostModel.Parent = game:GetService("Workspace")
|
-- connect events
|
Humanoid.Died:Connect(onDied)
Humanoid.Running:Connect(onRunning)
Humanoid.Jumping:Connect(onJumping)
Humanoid.Climbing:Connect(onClimbing)
Humanoid.GettingUp:Connect(onGettingUp)
Humanoid.FreeFalling:Connect(onFreeFall)
Humanoid.FallingDown:Connect(onFallingDown)
Humanoid.Seated:Connect(onSeated)
Humanoid.PlatformStanding:Connect(onPlatformStanding)
Humanoid.Swimming:Connect(onSwimming)
local runService = game:GetService("RunService");
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
while wait(0)do
local _,time=wait(0)
move(time)
end
|
--- Internal __newindex metamethod
|
function Maid:__newindex(i, v)
local Tasks = self._Tasks
local Task = Tasks[i]
if Task or v == nil then -- Clear previous Task
local Type = typeof(Task)
local IsTable = Type == "table"
if Type == "RBXScriptConnection" or IsTable and Task.Disconnect then
Task:Disconnect()
elseif Type == "Instance" or IsTable and Task.Destroy then
Task:Destroy()
end
end
Tasks[i] = v
end
return Maid
|
--Save data to DataStore
|
local function saveSystemData(key)
local sdata = main.sd[key]
return main:GetModule("DataStores"):DataStoreRetry(datastoreRetries, function()
return systemDataStore:UpdateAsync(key, function(oldValue)
local newValue = oldValue or dataTemplate(key)
if sdata then
if sdata.DataKey == newValue.DataKey then
newValue.DataToUpdate = false
newValue.DataKey = newValue.DataKey + 1
for statName, statValue in pairs(sdata) do
if statName == "RecordsToAdd" and #statValue > 0 then
for i,record in pairs(statValue) do
--print("Datastore: "..key.." | AddRecord | "..record.UserId)
table.insert(newValue.Records, record)
end
elseif (statName == "RecordsToRemove" or statName == "RecordsToModify") and #statValue > 0 then
for i,record in pairs(statValue) do
local recordToRemovePos = main:GetModule("cf"):FindUserIdInRecord(newValue.Records, record.UserId)
if recordToRemovePos then
table.remove(newValue.Records, recordToRemovePos)
if statName == "RecordsToModify" then
--print("Datastore: "..key.." | ModifyRecord | "..record.UserId)
table.insert(newValue.Records, record)
else
--print("Datastore: "..key.." | RemoveRecord | "..record.UserId)
end
end
end
elseif statName ~= "Records" and statName ~= "DataKey" and statName ~= "DataToUpdate" then
newValue[statName] = statValue
end
end
main.sd[key] = newValue
else
newValue = nil
end
end
return newValue
end)
end)
end
|
--makes the button colors when touch like a button--
| |
--[[
Gathers all of the errors reported by tests and puts them at the top level
of the TestResults object.
]]
|
function TestSession:gatherErrors()
local results = self.results
results.errors = {}
results:visitAllNodes(function(node)
if #node.errors > 0 then
for _, message in ipairs(node.errors) do
table.insert(results.errors, message)
end
end
end)
end
|
--Part:Destroy()
|
Lbl.Value.Parent:Destroy()
wait()
script:Destroy()
|
--[[
Converts an event into a Promise with an optional predicate
]]
|
function Promise.fromEvent(event, predicate)
predicate = predicate or function()
return true
end
return Promise._new(debug.traceback(nil, 2), function(resolve, _, onCancel)
local connection
local shouldDisconnect = false
local function disconnect()
connection:Disconnect()
connection = nil
end
-- We use shouldDisconnect because if the callback given to Connect is called before
-- Connect returns, connection will still be nil. This happens with events that queue up
-- events when there's nothing connected, such as RemoteEvents
connection = event:Connect(function(...)
local callbackValue = predicate(...)
if callbackValue == true then
resolve(...)
if connection then
disconnect()
else
shouldDisconnect = true
end
elseif type(callbackValue) ~= "boolean" then
error("Promise.fromEvent predicate should always return a boolean")
end
end)
if shouldDisconnect and connection then
return disconnect()
end
onCancel(disconnect)
end)
end
|
--[[ @brief Reshuffles the heap if a given index is smaller than its parent.
--]]
|
function Heap:_HeapifyBottomUp(i)
local parent = math.floor(i / 2);
while self[parent] and self.Comparator(self[i], self[parent]) do
self[parent], self[i] = self[i], self[parent];
i = parent;
parent = math.floor(i / 2);
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
v1.__index = v1;
local l__Players__2 = game:GetService("Players");
local l__RunService__3 = game:GetService("RunService");
local l__UserInputService__4 = game:GetService("UserInputService");
local l__GuiService__5 = game:GetService("GuiService");
local l__Workspace__6 = game:GetService("Workspace");
local l__UserGameSettings__7 = UserSettings():GetService("UserGameSettings");
local l__VRService__8 = game:GetService("VRService");
local v9 = require(script:WaitForChild("Keyboard"));
local v10 = require(script:WaitForChild("Gamepad"));
local v11 = require(script:WaitForChild("DynamicThumbstick"));
local v12, v13 = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserHideControlsWhenMenuOpen");
end);
local v14 = require(script:WaitForChild("TouchThumbstick"));
local v15 = require(script:WaitForChild("ClickToMoveController"));
local u1 = v12 or v13;
local u2 = require(script:WaitForChild("VehicleController"));
local l__Value__3 = Enum.ContextActionPriority.Default.Value;
function v1.new()
local v16 = setmetatable({}, v1);
v16.controllers = {};
v16.activeControlModule = nil;
v16.activeController = nil;
v16.touchJumpController = nil;
v16.moveFunction = l__Players__2.LocalPlayer.Move;
v16.humanoid = nil;
v16.lastInputType = Enum.UserInputType.None;
v16.controlsEnabled = true;
v16.humanoidSeatedConn = nil;
v16.vehicleController = nil;
v16.touchControlFrame = nil;
if u1 then
l__GuiService__5.MenuOpened:Connect(function()
if v16.touchControlFrame and v16.touchControlFrame.Visible then
v16.touchControlFrame.Visible = false;
end;
end);
l__GuiService__5.MenuClosed:Connect(function()
if v16.touchControlFrame then
v16.touchControlFrame.Visible = true;
end;
end);
end;
v16.vehicleController = u2.new(l__Value__3);
l__Players__2.LocalPlayer.CharacterAdded:Connect(function(p1)
v16:OnCharacterAdded(p1);
end);
l__Players__2.LocalPlayer.CharacterRemoving:Connect(function(p2)
v16:OnCharacterRemoving(p2);
end);
if l__Players__2.LocalPlayer.Character then
v16:OnCharacterAdded(l__Players__2.LocalPlayer.Character);
end;
l__RunService__3:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.Input.Value, function(p3)
v16:OnRenderStepped(p3);
end);
l__UserInputService__4.LastInputTypeChanged:Connect(function(p4)
v16:OnLastInputTypeChanged(p4);
end);
l__UserGameSettings__7:GetPropertyChangedSignal("TouchMovementMode"):Connect(function()
v16:OnTouchMovementModeChange();
end);
l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevTouchMovementMode"):Connect(function()
v16:OnTouchMovementModeChange();
end);
l__UserGameSettings__7:GetPropertyChangedSignal("ComputerMovementMode"):Connect(function()
v16:OnComputerMovementModeChange();
end);
l__Players__2.LocalPlayer:GetPropertyChangedSignal("DevComputerMovementMode"):Connect(function()
v16:OnComputerMovementModeChange();
end);
v16.playerGui = nil;
v16.touchGui = nil;
v16.playerGuiAddedConn = nil;
l__GuiService__5:GetPropertyChangedSignal("TouchControlsEnabled"):Connect(function()
v16:UpdateTouchGuiVisibility();
v16:UpdateActiveControlModuleEnabled();
end);
if not l__UserInputService__4.TouchEnabled then
v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
return v16;
end;
v16.playerGui = l__Players__2.LocalPlayer:FindFirstChildOfClass("PlayerGui");
if not v16.playerGui then
v16.playerGuiAddedConn = l__Players__2.LocalPlayer.ChildAdded:Connect(function(p5)
if p5:IsA("PlayerGui") then
v16.playerGui = p5;
v16:CreateTouchGuiContainer();
v16.playerGuiAddedConn:Disconnect();
v16.playerGuiAddedConn = nil;
v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
end;
end);
return v16;
end;
v16:CreateTouchGuiContainer();
v16:OnLastInputTypeChanged(l__UserInputService__4:GetLastInputType());
return v16;
end;
function v1.GetMoveVector(p6)
if not p6.activeController then
return Vector3.new(0, 0, 0);
end;
return p6.activeController:GetMoveVector();
end;
function v1.GetActiveController(p7)
return p7.activeController;
end;
function v1.UpdateActiveControlModuleEnabled(p8)
if not p8.activeController then
return;
end;
if not p8.controlsEnabled then
p8.activeController:Enable(false);
if p8.moveFunction then
p8.moveFunction(l__Players__2.LocalPlayer, Vector3.new(0, 0, 0), true);
end;
return;
end;
if not (not l__GuiService__5.TouchControlsEnabled) or not l__UserInputService__4.TouchEnabled or p8.activeControlModule ~= v15 and p8.activeControlModule ~= v14 and p8.activeControlModule ~= v11 then
(function()
if p8.activeControlModule == v15 then
p8.activeController:Enable(true, l__Players__2.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice, p8.touchJumpController);
return;
end;
if not p8.touchControlFrame then
p8.activeController:Enable(true);
return;
end;
p8.activeController:Enable(true, p8.touchControlFrame);
end)();
return;
end;
p8.activeController:Enable(false);
if p8.moveFunction then
p8.moveFunction(l__Players__2.LocalPlayer, Vector3.new(0, 0, 0), true);
end;
end;
function v1.Enable(p9, p10)
if p10 == nil then
p10 = true;
end;
p9.controlsEnabled = p10;
if not p9.activeController then
return;
end;
p9:UpdateActiveControlModuleEnabled();
end;
function v1.Disable(p11)
p11.controlsEnabled = false;
p11:UpdateActiveControlModuleEnabled();
end;
local u4 = {
[Enum.UserInputType.Keyboard] = v9,
[Enum.UserInputType.MouseButton1] = v9,
[Enum.UserInputType.MouseButton2] = v9,
[Enum.UserInputType.MouseButton3] = v9,
[Enum.UserInputType.MouseWheel] = v9,
[Enum.UserInputType.MouseMovement] = v9,
[Enum.UserInputType.Gamepad1] = v10,
[Enum.UserInputType.Gamepad2] = v10,
[Enum.UserInputType.Gamepad3] = v10,
[Enum.UserInputType.Gamepad4] = v10
};
local u5 = nil;
local u6 = {
[Enum.TouchMovementMode.DPad] = v11,
[Enum.DevTouchMovementMode.DPad] = v11,
[Enum.TouchMovementMode.Thumbpad] = v11,
[Enum.DevTouchMovementMode.Thumbpad] = v11,
[Enum.TouchMovementMode.Thumbstick] = v14,
[Enum.DevTouchMovementMode.Thumbstick] = v14,
[Enum.TouchMovementMode.DynamicThumbstick] = v11,
[Enum.DevTouchMovementMode.DynamicThumbstick] = v11,
[Enum.TouchMovementMode.ClickToMove] = v15,
[Enum.DevTouchMovementMode.ClickToMove] = v15,
[Enum.TouchMovementMode.Default] = v11,
[Enum.ComputerMovementMode.Default] = v9,
[Enum.ComputerMovementMode.KeyboardMouse] = v9,
[Enum.DevComputerMovementMode.KeyboardMouse] = v9,
[Enum.DevComputerMovementMode.Scriptable] = nil,
[Enum.ComputerMovementMode.ClickToMove] = v15,
[Enum.DevComputerMovementMode.ClickToMove] = v15
};
function v1.SelectComputerMovementModule(p12)
if not l__UserInputService__4.KeyboardEnabled and not l__UserInputService__4.GamepadEnabled then
return nil, false;
end;
local l__DevComputerMovementMode__17 = l__Players__2.LocalPlayer.DevComputerMovementMode;
if l__DevComputerMovementMode__17 == Enum.DevComputerMovementMode.UserChoice then
local v18 = u4[u5];
if l__UserGameSettings__7.ComputerMovementMode == Enum.ComputerMovementMode.ClickToMove and v18 == v9 then
v18 = v15;
end;
else
v18 = u6[l__DevComputerMovementMode__17];
if not v18 and l__DevComputerMovementMode__17 ~= Enum.DevComputerMovementMode.Scriptable then
warn("No character control module is associated with DevComputerMovementMode ", l__DevComputerMovementMode__17);
end;
end;
if v18 then
return v18, true;
end;
if l__DevComputerMovementMode__17 == Enum.DevComputerMovementMode.Scriptable then
return nil, true;
end;
return nil, false;
end;
function v1.SelectTouchModule(p13)
if not l__UserInputService__4.TouchEnabled then
return nil, false;
end;
local l__DevTouchMovementMode__19 = l__Players__2.LocalPlayer.DevTouchMovementMode;
if l__DevTouchMovementMode__19 == Enum.DevTouchMovementMode.UserChoice then
local v20 = u6[l__UserGameSettings__7.TouchMovementMode];
else
if l__DevTouchMovementMode__19 == Enum.DevTouchMovementMode.Scriptable then
return nil, true;
end;
v20 = u6[l__DevTouchMovementMode__19];
end;
return v20, true;
end;
local function u7(p14, p15)
local l__CurrentCamera__21 = l__Workspace__6.CurrentCamera;
if not l__CurrentCamera__21 then
return p15;
end;
if p14:GetState() == Enum.HumanoidStateType.Swimming then
return l__CurrentCamera__21.CFrame:VectorToWorldSpace(p15);
end;
local v22 = l__CurrentCamera__21.CFrame;
if l__VRService__8.VREnabled and p14.RootPart and (p14.RootPart.CFrame.Position - v22.Position).Magnitude < 3 then
v22 = v22 * l__VRService__8:GetUserCFrame(Enum.UserCFrame.Head);
end;
local v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34 = v22:GetComponents();
if v31 < 1 and v31 > -1 then
local v35 = v34;
local v36 = v28;
else
v35 = v26;
v36 = -v27 * math.sign(v31);
end;
local v37 = math.sqrt(v35 * v35 + v36 * v36);
return Vector3.new((v35 * p15.X + v36 * p15.Z) / v37, 0, (v35 * p15.Z - v36 * p15.X) / v37);
end;
function v1.OnRenderStepped(p16, p17)
if p16.activeController and p16.activeController.enabled and p16.humanoid then
p16.activeController:OnRenderStepped(p17);
local v38 = p16.activeController:GetMoveVector();
local v39 = p16.activeController:IsMoveVectorCameraRelative();
local v40 = p16:GetClickToMoveController();
if p16.activeController ~= v40 then
if v38.magnitude > 0 then
v40:CleanupPath();
else
v40:OnRenderStepped(p17);
v38 = v40:GetMoveVector();
v39 = v40:IsMoveVectorCameraRelative();
end;
end;
if p16.vehicleController then
local v41, v42 = p16.vehicleController:Update(v38, v39, p16.activeControlModule == v10);
v38 = v41;
end;
if v39 then
v38 = u7(p16.humanoid, v38);
end;
p16.moveFunction(l__Players__2.LocalPlayer, v38, false);
p16.humanoid.Jump = p16.activeController:GetIsJumping() or p16.touchJumpController and p16.touchJumpController:GetIsJumping();
end;
end;
function v1.OnHumanoidSeated(p18, p19, p20)
if p19 then
if p20 and p20:IsA("VehicleSeat") then
if not p18.vehicleController then
p18.vehicleController = p18.vehicleController.new(l__Value__3);
end;
p18.vehicleController:Enable(true, p20);
return;
end;
elseif p18.vehicleController then
p18.vehicleController:Enable(false, p20);
end;
end;
function v1.OnCharacterAdded(p21, p22)
p21.humanoid = p22:FindFirstChildOfClass("Humanoid");
while not p21.humanoid do
p22.ChildAdded:wait();
p21.humanoid = p22:FindFirstChildOfClass("Humanoid");
end;
p21:UpdateTouchGuiVisibility();
if p21.humanoidSeatedConn then
p21.humanoidSeatedConn:Disconnect();
p21.humanoidSeatedConn = nil;
end;
p21.humanoidSeatedConn = p21.humanoid.Seated:Connect(function(p23, p24)
p21:OnHumanoidSeated(p23, p24);
end);
end;
function v1.OnCharacterRemoving(p25, p26)
p25.humanoid = nil;
p25:UpdateTouchGuiVisibility();
end;
function v1.UpdateTouchGuiVisibility(p27)
if p27.touchGui then
p27.touchGui.Enabled = not (not p27.humanoid) and not (not l__GuiService__5.TouchControlsEnabled);
end;
end;
local u8 = require(script:WaitForChild("TouchJump"));
function v1.SwitchToController(p28, p29)
if not p29 then
if p28.activeController then
p28.activeController:Enable(false);
end;
p28.activeController = nil;
p28.activeControlModule = nil;
return;
end;
if not p28.controllers[p29] then
p28.controllers[p29] = p29.new(l__Value__3);
end;
if p28.activeController ~= p28.controllers[p29] then
if p28.activeController then
p28.activeController:Enable(false);
end;
p28.activeController = p28.controllers[p29];
p28.activeControlModule = p29;
if p28.touchControlFrame and (p28.activeControlModule == v15 or p28.activeControlModule == v14 or p28.activeControlModule == v11) then
if not p28.controllers[u8] then
p28.controllers[u8] = u8.new();
end;
p28.touchJumpController = p28.controllers[u8];
p28.touchJumpController:Enable(true, p28.touchControlFrame);
elseif p28.touchJumpController then
p28.touchJumpController:Enable(false);
end;
p28:UpdateActiveControlModuleEnabled();
end;
end;
function v1.OnLastInputTypeChanged(p30, p31)
if u5 == p31 then
warn("LastInputType Change listener called with current type.");
end;
u5 = p31;
if u5 == Enum.UserInputType.Touch then
local v43, v44 = p30:SelectTouchModule();
if v44 then
while not p30.touchControlFrame do
wait();
end;
p30:SwitchToController(v43);
end;
elseif u4[u5] ~= nil then
local v45 = p30:SelectComputerMovementModule();
if v45 then
p30:SwitchToController(v45);
end;
end;
p30:UpdateTouchGuiVisibility();
end;
function v1.OnComputerMovementModeChange(p32)
local v46, v47 = p32:SelectComputerMovementModule();
if v47 then
p32:SwitchToController(v46);
end;
end;
function v1.OnTouchMovementModeChange(p33)
local v48, v49 = p33:SelectTouchModule();
if v49 then
while not p33.touchControlFrame do
wait();
end;
p33:SwitchToController(v48);
end;
end;
function v1.CreateTouchGuiContainer(p34)
if p34.touchGui then
p34.touchGui:Destroy();
end;
p34.touchGui = Instance.new("ScreenGui");
p34.touchGui.Name = "TouchGui";
p34.touchGui.ResetOnSpawn = false;
p34.touchGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling;
p34:UpdateTouchGuiVisibility();
p34.touchControlFrame = Instance.new("Frame");
p34.touchControlFrame.Name = "TouchControlFrame";
p34.touchControlFrame.Size = UDim2.new(1, 0, 1, 0);
p34.touchControlFrame.BackgroundTransparency = 1;
p34.touchControlFrame.Parent = p34.touchGui;
p34.touchGui.Parent = p34.playerGui;
end;
function v1.GetClickToMoveController(p35)
if not p35.controllers[v15] then
p35.controllers[v15] = v15.new(l__Value__3);
end;
return p35.controllers[v15];
end;
return v1.new();
|
-- Runs when a round finishes. Reloads all players back into the lobby, removing tools and listeners.
|
function PlayerManager:ResetPlayers()
for _, player in ipairs(PlayerManager.ActivePlayers) do
print(player.Name)
CheckpointEvent:FireClient(player, {{"raceFinished"}})
CheckpointEvent:FireClient(player, {{"reset"}})
PlayerConverter:SpeederToPlayerServer(player)
end
PlayerManager.ActivePlayers = {}
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local FE = workspace.FilteringEnabled
local car = script.Parent.Car.Value
local handler = car:WaitForChild("AC6_FE_Sounds")
local _Tune = require(car["A-Chassis Tune"])
local on = 0
local throt=0
local redline=0
script:WaitForChild("Super")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
handler:FireServer("newSound","Super",car.DriveSeat,script.Super.SoundId,0,script.Super.Volume,true)
handler:FireServer("playSound","Super")
car.DriveSeat:WaitForChild("Super")
while wait() do
local _RPM = script.Parent.Values.RPM.Value
if script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 then
throt = math.max(.3,throt-.2)
else
throt = math.min(1,throt+.1)
end
if script.Parent.Values.RPM.Value > _Tune.Redline-_Tune.RevBounce/4 and script.Parent.Values.Throttle.Value > _Tune.IdleThrottle/100 then
redline=.5
else
redline=1
end
if not script.Parent.IsOn.Value then on=math.max(on-.015,0) else on=1 end
local Pitch = math.max((((script.Super.SetPitch.Value + script.Super.SetSuper.Value*_RPM/_Tune.Redline))*on^2),script.Super.SetPitch.Value)
if FE then
handler:FireServer("updateSound","Super",script.Super.SoundId,Pitch,script.Super.Volume)
else
car.DriveSeat.Super.Pitch = Pitch
end
end
|
--[[
Remove all art placed by a player.
]]
|
function PlayerSpots:cleanup(player)
self:_removeUnusedSpots(player)
for _, placed in ipairs(self.placedSpots) do
placed.spot:removeArt()
end
self.placedSpots = {}
end
function PlayerSpots:_hasArtOnCanvas(canvas)
for _, placed in ipairs(self.placedSpots) do
if placed.canvas == canvas then
return true
end
end
return false
end
function PlayerSpots:_assignRandomSpot(canvas)
local isSuccess, spot = canvas:getEmptySpot()
if not isSuccess then
warn("Cannot find an empty slot in canvas")
return false, constants.Errors.SpotNotAvailable
end
table.insert(self.placedSpots, {
canvas = canvas,
spot = spot,
createdAt = DateTime.now().UnixTimestamp,
})
return true, spot
end
function PlayerSpots:_removeOldestArt()
self.toRemove = 1
end
function PlayerSpots:_removeOldestArtFromCanvas(canvas)
local toRemove = nil
for i, placed in ipairs(self.placedSpots) do
if placed.canvas == canvas then
-- A spot previously placed by the user has to be freed immediately
toRemove = i
placed.spot:removeArt()
break
end
end
table.remove(self.placedSpots, toRemove)
end
function PlayerSpots:_removeOldestArtFromOtherCanvas(currentCanvas)
for i, placed in ipairs(self.placedSpots) do
if placed.canvas ~= currentCanvas then
self.toRemove = i
break
end
end
end
function PlayerSpots:_removeUnusedSpots(player)
self.placedSpots = Cryo.List.filter(self.placedSpots, function(placedSpot)
return placedSpot.spot:hasArt() and placedSpot.spot.ownerUserId == player.UserId
end)
end
return PlayerSpots
|
--[=[
Clears the custom value for the given players. This
just loops through the list of players and calls
the `ClearFor` method for each player.
]=]
|
function RemoteProperty:ClearForList(players: { Player })
for _, player in ipairs(players) do
self:ClearFor(player)
end
end
|
-- when a spring has displacement and velocity below +/- epsilon, the spring
-- won't send updates
|
local MOVEMENT_EPSILON = 0.0001
|
-- Dark was here.
|
local nearplayer
local Players = game:GetService("Players")
function MoveShelly()
nearplayer = false
for _,Player in next, Players:GetPlayers() do
if Player.Character and Player.Character.PrimaryPart then
local dis = (Player.Character.PrimaryPart.CFrame.Position - shelly.PrimaryPart.CFrame.Position).Magnitude
if dis >= 500 then
nearplayer = true
break
end
end
end
if nearplayer then
task.wait(math.random(8, 8 + 8/2))
return
end
bp.Parent = shelly.PrimaryPart
local goal
repeat
local ray = Ray.new(Vector3.new(origin.p.x+math.random(-tether,tether), shelly.PrimaryPart.Position.Y+100, origin.p.z+math.random(-tether,tether)),Vector3.new(0,-130,0))
local part,pos,norm,mat = workspace:FindPartOnRay(ray, shelly)
if part == workspace.Terrain and mat ~= Enum.Material.Water then
goal = pos+Vector3.new(0,.35,0)
end
task.wait()
until goal
--Set new goal for banto to MoveTo :)
local pos = shelly.PrimaryPart.Position
local cf = CFrame.new(Vector3.new(pos.X, 0, pos.Z), Vector3.new(goal.X, 0, goal.Z))
bg.CFrame = cf
bp.Position = (cf*CFrame.new(0,0,-100)).p
local start = tick()
repeat task.wait(.5)
local ray = Ray.new(shelly.PrimaryPart.Position, Vector3.new(0,-140,0))
until (shelly.PrimaryPart.Position-goal).magnitude < 10 or tick()-start >15 or not shellyGood
if not shellyGood then bp.Parent,bg.Parent= nil,nil return end
bp.Parent = nil
task.wait(math.random(3,8))
end
local soundBank = game.ServerStorage.Sounds.NPC.Shelly:GetChildren()
shelly.Health.Changed:connect(function()
if shellyGood then
bp.Parent,bg.Parent= nil,nil
shelly.PrimaryPart.Transparency =1
shelly.PrimaryPart.CanCollide = false
shelly.Shell.Transparency = 1
shelly.HitShell.Transparency = 0
shelly.HitShell.CanCollide = true
shellyGood = false
ostrich = os.clock()
shelly:SetPrimaryPartCFrame(shelly.PrimaryPart.CFrame*CFrame.new(0,2,0))
local hitSound = soundBank[math.random(1,#soundBank)]:Clone()
hitSound.PlayOnRemove = true
hitSound.Parent = shelly.PrimaryPart
task.wait()
hitSound:Destroy()
repeat task.wait() until os.clock()-ostrich > 10
shelly.PrimaryPart.Transparency = 0
shelly.PrimaryPart.CanCollide = true
shelly.Shell.Transparency = 0
shelly.HitShell.Transparency = 1
shelly.HitShell.CanCollide = false
bp.Parent,bg.Parent = shelly.PrimaryPart,shelly.PrimaryPart
shellyGood = true
end
end)
while true do
if shellyGood then
MoveShelly()
else
task.wait(1)
end
end
|
--[[
Configuration
]]
|
local MAX_CUTTOFF_DISTANCE = 12
local ACTIVATE_KEYBOARD = Enum.KeyCode.E
local ACTIVATE_CONSOLE = Enum.KeyCode.ButtonX
local ACTION_BUTTON_OFFSET = Vector2.new(0, 0)
local ACTION_PRIORITY = 10000
|
--Modules--
|
local modules = script.Parent.Modules
local core = require(modules.Core)
local combat = require(modules.Combat)
local flight = require(modules.Flight)
local pathing = require(modules.Pathing)
local troubleshoot = require(modules.Troubleshoot)
|
-- Reference
|
local soundService = game:GetService("SoundService")
local chat = game:GetService("Chat")
local players = game:GetService("Players")
local lighting = game:GetService("Lighting")
|
--[=[
Based on the given [UserInputType], a cooresponding enum representing the
current device is returned.
```lua
getCurrentDevice(Enum.UserInputType.KeyCode) -- "Computer"
getCurrentDevice(Enum.UserInputType.Touch) -- "Mobile"
getCurrentDevice(Enum.UserInputType.Gamepad1) -- "Gamepad"
```
@within Modules
]=]
|
local function getCurrentDevice(inputType: Enum.UserInputType)
for group, patterns in pairs(constants.DeviceInputTypePatterns) do
for _, pattern in ipairs(patterns) do
if inputType.Name:match(pattern) then
return enums.Device[group]
end
end
end
return enums.Device.Unknown
end
return getCurrentDevice
|
--[=[
Debounce a existing function by timeout
@class throttle
]=]
|
local require = require(script.Parent.loader).load(script)
local ThrottledFunction = require("ThrottledFunction")
|
--[[
Returns the current value of this Tween object.
The object will be registered as a dependency unless `asDependency` is false.
]]
|
function class:get(asDependency: boolean?): any
if asDependency ~= false then
Dependencies.useDependency(self)
end
return self._currentValue
end
|
--//ENGINE//--
|
Horsepower = 1500 --{This is how much power your engine block makes ALONE, this does not represent to total horsepower output [IF you have a turbo/SC]}
EngineDisplacement = 2200 --{Engine size in CC's}
EngineType = "Petrol" --{Petrol, Diesel, Electric]
EngineLocation = "Front" --{Front, Mid, Rear}
ForcedInduction = "Supercharger" --{Natural, Single, Twin, Supercharger}
InductionPartSize = 1 --{0-5, 1 being small, 5 being large (Decimals accepted, e.g 2.64 turbo size, this is the size of the turbo}
ElectronicallyLimited = false --{Electronically Limit the top speed of your vehicle}
LimitSpeedValue = 236.121 --{Limits top speed of the vehicle [In MPH]}
|
-- This is for commands which continue on respawn
|
local module = {}
|
--- Skill
|
local UIS = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Debounce = true
Player = game.Players.LocalPlayer
Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://4835590095"
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.Z and Debounce == true and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = false
Tool.Active.Value = "SunaTornado"
wait(0.1)
Track1 = Player.Character.Humanoid:LoadAnimation(Animation)
Track1:Play()
wait(0.15)
script.Fire:FireServer(plr)
local hum = Player.Character.Humanoid
for i = 1,30 do
wait()
hum.CameraOffset = Vector3.new(
math.random(-1,1),
math.random(-1,1),
math.random(-1,1)
)
end
hum.CameraOffset = Vector3.new(0,0,0)
wait(0.15)
Tool.Active.Value = "None"
wait(2)
Debounce = true
end
end)
|
--[[Susupension]]
|
Tune.SusEnabled = false -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FPreCompress = .4 -- Pre-compression adds resting length force
Tune.FExtensionLim = .4 -- Max Extension Travel (in studs)
Tune.FCompressLim = .4 -- Max Compression Travel (in studs)
Tune.FSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.FWsBoneLen = 5 -- Wishbone Length
Tune.FWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.FAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Rear Suspension
Tune.RSusDamping = 500 -- Spring Dampening
Tune.RSusStiffness = 9000 -- Spring Force
Tune.FAntiRoll = 50 -- Anti-Roll (Gyro Dampening)
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RPreCompress = .4 -- Pre-compression adds resting length force
Tune.RExtensionLim = .4 -- Max Extension Travel (in studs)
Tune.RCompressLim = .4 -- Max Compression Travel (in studs)
Tune.RSusAngle = 80 -- Suspension Angle (degrees from horizontal)
Tune.RWsBoneLen = 5 -- Wishbone Length
Tune.RWsBoneAngle = 0 -- Wishbone angle (degrees from horizontal)
Tune.RAnchorOffset = { -- Suspension anchor point offset (relative to center of wheel)
--[[Lateral]] -.4 , -- positive = outward
--[[Vertical]] -.5 , -- positive = upward
--[[Forward]] 0 } -- positive = forward
--Aesthetics
Tune.SusVisible = true -- Spring Visible
Tune.WsBVisible = false -- Wishbone Visible
Tune.SusRadius = .2 -- Suspension Coil Radius
Tune.SusThickness = .1 -- Suspension Coil Thickness
Tune.SusColor = "Really black" -- Suspension Color [BrickColor]
Tune.SusCoilCount = 6 -- Suspension Coil Count
Tune.WsColor = "Black" -- Wishbone Color [BrickColor]
Tune.WsThickness = .1 -- Wishbone Rod Thickness
|
--Both
|
local Loudness = .75 --volume of the boost supplier (not exact volume so you kinda have to experiment with it also)
script:WaitForChild("Whistle")
script:WaitForChild("Whine")
script:WaitForChild("BOV")
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(car.DriveSeat:GetChildren()) do
for _,a in pairs(script:GetChildren()) do
if v.Name==a.Name then v:Stop() wait() v:Destroy() end
end
end
end
end)
if not _Tune.Engine then return end
handler:FireServer("newSound","Whistle",car.DriveSeat,script.Whistle.SoundId,0,script.Whistle.Volume,true)
handler:FireServer("newSound","Whine",car.DriveSeat,script.Whine.SoundId,0,script.Whine.Volume,true)
handler:FireServer("newSound","BOV",car.DriveSeat,script.BOV.SoundId,0,script.BOV.Volume,true)
handler:FireServer("playSound","Whistle")
handler:FireServer("playSound","Whine")
car.DriveSeat:WaitForChild("Whistle")
car.DriveSeat:WaitForChild("Whine")
car.DriveSeat:WaitForChild("BOV")
local ticc = tick()
local _TCount = 0
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then _TCount = 1 elseif _Tune.Aspiration == "Double" then _TCount = 2 end
while wait() do
local psi = (((script.Parent.Values.Boost.Value)/(_Tune.Boost*_TCount))*2)
--(script.Parent.Values.RPM.Value/_Tune.Redline)
local WP,WV,BP,BV,HP,HV = 0
BOVact = math.floor(psi*20)
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Double" then
WP = (psi)
WV = (psi/4)*Loudness
BP = (1-(-psi/20))*BOV_Pitch
BV = (((-0.5+((psi/2)*BOV_Loudness)))*(1 - script.Parent.Values.Throttle.Value))
if BOVact < BOVact2 then if car.DriveSeat.BOV.IsPaused then if FE then handler:FireServer("playSound","BOV") else car.DriveSeat.BOV:Play() end end end
if BOVact >= BOVact2 then if FE then handler:FireServer("stopSound","BOV") else car.DriveSeat.BOV:Stop() end end
elseif _Tune.Aspiration == "Super" then
psi = psi/2
HP = (script.Parent.Values.RPM.Value/_Tune.Redline)*Whine_Pitch
HV = (psi/4)*Loudness
end
handler:FireServer("updateSound","Whistle",script.Whistle.SoundId,WP,WV)
handler:FireServer("updateSound","Whine",script.Whine.SoundId,HP,HV)
handler:FireServer("updateSound","BOV",script.BOV.SoundId,BP,BV)
if (tick()-ticc) >= 0.1 then
BOVact2 = math.floor(psi*20)
ticc = tick()
end
end
|
-- if version < SNAPSHOT_VERSION then
-- return Error(
-- chalk.red(
-- chalk.red.bold('Outdated snapshot') .. ": The version of the snapshot " ..
-- "file associated with this test is outdated. The snapshot file " ..
-- "version ensures that all developers on a project are using " ..
-- "the same version of Jest. " ..
-- "Please update all snapshots during this upgrade of Jest.\n\n"
-- ) ..
-- "Expected: v" .. SNAPSHOT_VERSION .. "\n" ..
-- "Received: v" .. version .. "\n\n" ..
-- SNAPSHOT_VERSION_WARNING
-- )
-- end
| |
-- modules
|
local module = {}
function module.Create(self, item)
local itemModule = {
Item = item;
Equipped = false;
Connections = {};
}
-- variables
local animations = {}
local character = item.Parent.Parent
local handle = item:WaitForChild("Handle")
local muzzle = handle:WaitForChild("Muzzle")
local config = CONFIG:GetConfig(item)
local canShoot = true
local clicking = false
local reloading = false
local rCancelled = false
local equipTime = 0
local ammo = item:WaitForChild("Ammo").Value
local aiming = false
-- functions
local function CanShoot()
return itemModule.Equipped and canShoot and ammo > 0
end
local function Reload()
if (not reloading) and itemModule.Equipped and ammo < config.Magazine then
reloading = true
rCancelled = false
local storedAmmo = character.Ammo[config.Size].Value
if storedAmmo > 0 then
MOUSE.Reticle = "Reloading"
REMOTES.Reload:FireServer(item)
EFFECTS:Effect("Reload", item)
animations.Reload:Play(0.1, 1, 1/config.ReloadTime)
local start = tick()
local elapsed = 0
repeat
elapsed = tick() - start
RunService.Stepped:wait()
until elapsed >= config.ReloadTime or rCancelled or (not itemModule.Equipped)
animations.Reload:Stop()
if itemModule.Equipped then
if elapsed >= config.ReloadTime then
local magazine = config.Magazine
local needed = magazine - ammo
if storedAmmo >= needed then
ammo = ammo + needed
else
ammo = ammo + storedAmmo
end
end
MOUSE.Reticle = config.Reticle or "Gun"
EVENTS.Gun:Fire("Update", ammo)
end
end
reloading = false
end
end
local function Shoot()
ammo = ammo - 1
local position = muzzle.WorldPosition
local directions = {}
for i = 1, config.ShotSize do
local spread = config.Spread * 10
local cframe = CFrame.new(position, MOUSE.WorldPosition)
if config.SpreadPattern then
local x, y = config.SpreadPattern[i][1], config.SpreadPattern[i][2]
cframe = cframe * CFrame.Angles(math.rad(spread * y / 50), math.rad(spread * x / 50), 0)
else
cframe = cframe * CFrame.Angles(math.rad(math.random(-spread, spread) / 50), math.rad(math.random(-spread, spread) / 50), 0)
end
local direction = cframe.lookVector
table.insert(directions, direction)
local hit, pos, normal, humanoid = Raycast(position, direction * config.Range, {character})
if hit and humanoid then
if DAMAGE:PlayerCanDamage(PLAYER, humanoid) then
local damage = DAMAGE:Calculate(item, hit, position)
local armor = (humanoid:FindFirstChild("Armor") and humanoid.Armor.Value > 0)
EVENTS.Hitmarker:Fire(pos, damage, armor, hit.Name == "Head")
REMOTES.Hit:FireServer(hit, i)
end
end
end
if aiming then
animations.AimShoot:Play(0, math.random(5, 10) / 10, 1)
else
animations.Shoot:Play(0, math.random(5, 10) / 10, 1)
end
EVENTS.Gun:Fire("Update", ammo)
EFFECTS:Effect("Shoot", item, position, directions, ammo)
REMOTES.Shoot:FireServer(item, position, directions)
EVENTS.Recoil:Fire(Vector3.new(math.random(-config.Recoil, config.Recoil) / 4, 0, math.random(config.Recoil / 2, config.Recoil)))
end
-- module functions
function itemModule.Connect(self)
local character = PLAYER.Character
local humanoid = character:WaitForChild("Humanoid")
for _, animation in pairs(self.Item:WaitForChild("Animations"):GetChildren()) do
animations[animation.Name] = humanoid:LoadAnimation(animation)
end
table.insert(self.Connections, INPUT.ActionBegan:connect(function(action, processed)
if self.Equipped and (not processed) then
if action == "Reload" then
Reload()
end
end
end))
table.insert(self.Connections, item.Attachments.ChildAdded:connect(function()
config = CONFIG:GetConfig(item)
if self.Equipped then
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
end
end))
table.insert(self.Connections, item.Attachments.ChildRemoved:connect(function()
config = CONFIG:GetConfig(item)
if self.Equipped then
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
end
end))
table.insert(self.Connections, EVENTS.Aim.Event:connect(function(a)
aiming = a
if self.Equipped then
if aiming then
animations.Idle:Stop()
animations.Aim:Play()
else
animations.Aim:Stop()
animations.Idle:Play()
end
end
end))
end
function itemModule.Disconnect(self)
for _, connection in pairs(self.Connections) do
connection:Disconnect()
end
self.Connections = {}
end
function itemModule.Equip(self)
EVENTS.Zoom:Fire(config.Zoom)
EVENTS.Scope:Fire(config.Scope)
MOUSE.Reticle = config.Reticle or "Gun"
if aiming then
animations.Aim:Play()
else
animations.Idle:Play()
end
animations.Equip:Play(0, 1, 1)
ammo = item.Ammo.Value
EVENTS.Gun:Fire("Enable", config.Size, ammo)
self.Equipped = true
equipTime = tick()
if ammo == 0 then
spawn(function()
Reload()
end)
end
end
function itemModule.Unequip(self)
EVENTS.Zoom:Fire()
EVENTS.Scope:Fire(false)
MOUSE.Reticle = "Default"
for _, animation in pairs(animations) do
animation:Stop()
end
EVENTS.Gun:Fire("Disable", config.Size, ammo)
self.Equipped = false
end
function itemModule.Activate(self)
clicking = true
if tick() - equipTime >= EQUIP_COOLDOWN then
if config.FireMode == "Semi" then
if CanShoot() then
rCancelled = true
canShoot = false
Shoot()
wait(1 / config.FireRate)
canShoot = true
end
elseif config.FireMode == "Auto" then
while clicking and CanShoot() do
rCancelled = true
canShoot = false
Shoot()
wait(1 / config.FireRate)
canShoot = true
end
elseif config.FireMode == "Burst" then
while clicking and CanShoot() do
canShoot = false
for i = 1, config.BurstAmount do
if clicking and ammo > 0 then
rCancelled = true
Shoot()
wait(1 / config.BurstRate)
else
break
end
end
wait(1 / config.FireRate)
canShoot = true
end
end
if ammo == 0 then
Reload()
end
end
end
function itemModule.Deactivate(self)
clicking = false
end
return itemModule
end
return module
|
--- Add sounds when interacting with a gui element
|
return function(element, interactType, interactSoundId, interactSoundVolume, enableRandomPitch)
--- Variables
interactType = string.lower(interactType)
interactSoundVolume = interactSoundVolume or 0.15
enableRandomPitch = enableRandomPitch or false
--
local events = {}
--- Events
if interactType == "mousedown" then
--- Mouse down
events[#events + 1] = element.MouseButton1Down:Connect(function()
_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
end)
elseif interactType == "mouseup" then
--- Mouse up
events[#events + 1] = element.MouseButton1Up:Connect(function()
_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume * 2)
end)
elseif interactType == "mouseenter" then
--- Mouse hover over
events[#events + 1] = element.MouseEnter:Connect(function()
_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
end)
elseif interactType == "mouseleave" then
--- Mouse hover leave
events[#events + 1] = element.MouseLeave:Connect(function()
_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
end)
elseif interactType == "mouseclick" then
--- Mouse click
events[#events + 1] = element.MouseButton1Click:Connect(function()
_L.Audio.Play(interactSoundId, script, (enableRandomPitch and math.random(95, 105) / 100 or 1), interactSoundVolume)
end)
end
--- Return function to cancel this behavior
return function()
for _, event in ipairs(events) do
event:disconnect()
end
events = nil
end
end
|
--Place this INSIDE the model. Don't replace the model name or anything.
|
------------------------------------------------------------------------------------------
object = script.Parent
if (object ~= nil) and (object ~= game.Workspace) then
model = object
backup = model:clone() -- Make the backup
waitTime = 60 --Time to wait between regenerations
|
-- / UIs / --
|
local CutsceneFrame = CutsceneGui.CutsceneFrame
|
--Put the used services into variables
|
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
|
-- @Context Server
-- Given a weapon definition, position, and direction. A projectile will be simulated on all clients.
-- @param WeaponDefinition weaponDefinition
-- @param Vector3 position
-- @param Vector3 direction
-- @param Player _owner
|
function ProjectileReplication.ReplicateProjectile(weaponDefinition, position, direction, _owner)
if RunService:IsServer() then
--print("Sending visual to all clients",weaponDefinition, position, direction, _owner)
-- If the server makes the request to replicate a projectile then then this is sent to everyone besides the sender
RE_CreateProjectile:FireAllClients(weaponDefinition:GetIDName(), position, direction, _owner)
end
end
|
-- Parses all folders and their child. Folders will be recursively searched.
---@param folder instance
|
function Database.ParseFolder(folder)
local dataRoot = {}
Database._Parse_R(dataRoot,folder,dataRoot)
-- Store the data onto the database.
Database[folder.name] = dataRoot
end
|
-- print(AnimName .. " * " .. Index .. " [" .. OrigRoll .. "]")
|
local Anim = AnimTable[AnimName][Index].Anim
-- load it to the humanoid; get AnimationTrack
ToolAnimTrack = Humanoid:LoadAnimation(Anim)
-- play the animation
ToolAnimTrack:Play(TransitionTime)
ToolAnimName = AnimName
CurrentToolAnimKeyframeHandler = ToolAnimTrack.KeyframeReached:connect(ToolKeyframeReachedFunc)
end
end
function StopToolAnimations()
local OldAnim = ToolAnimName
if CurrentToolAnimKeyframeHandler then
CurrentToolAnimKeyframeHandler:disconnect()
end
ToolAnimName = ""
if ToolAnimTrack then
ToolAnimTrack:Stop()
ToolAnimTrack:Destroy()
ToolAnimTrack = nil
end
return OldAnim
end
|
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player.
|
function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
local messageObj = ShallowCopy(inMessageObj)
local oldFilterResult = messageObj.FilterResult
local player = self:GetPlayer()
local msg = ""
pcall(function()
if (messageObj.IsFilterResult) then
if (player) then
msg = oldFilterResult:GetChatForUserAsync(player.UserId)
else
msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
end
else
msg = oldFilterResult
end
end)
--// Messages of 0 length are the result of two users not being allowed
--// to chat, or GetChatForUserAsync() failing. In both of these situations,
--// messages with length of 0 should not be sent.
if UserFlagRemoveMessageOnTextFilterFailures then
messageObj.Message = msg
messageObj.FilterResult = nil
self:InternalSendFilteredMessage(messageObj, channelName)
else
if (#msg > 0) then
messageObj.Message = msg
messageObj.FilterResult = nil
self:InternalSendFilteredMessage(messageObj, channelName)
end
end
end
function methods:InternalSendSystemMessage(messageObj, channelName)
local success, err = pcall(function()
self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
if self.PlayerObj then
self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
end
end)
if not success and err then
print("Error sending internal system message: " ..err)
end
end
function methods:UpdateChannelNameColor(channelName, channelNameColor)
self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
if self.PlayerObj then
self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
end
end
|
-- please do not distribute this plugin and pass it as yours
|
WheelModel = script.Parent:WaitForChild("Wheels")
rainEffect = script:WaitForChild("RainEffect")
wheels = {}
touchingparts = {}
for i, v in pairs(WheelModel:GetChildren()) do
if v:IsA("BasePart") then
table.insert(wheels, v)
rainEffect:Clone().Parent = v
table.insert(touchingparts, nil)
end
end
for i, v in pairs(wheels) do
v.Touched:connect(function(part)
touchingparts[i] = part
end)
end
RunService = game:GetService("RunService")
RunService.Heartbeat:connect(function()
for i, v in pairs(wheels) do
local speed = v.Velocity.magnitude
if speed > 20 then
if touchingparts[i].Material == Enum.Material.Glass or touchingparts[i].Material == Enum.Material.Ice then
v.RainEffect.Rate = 5/100 * speed * 10
else
v.RainEffect.Rate = 0
end
else
v.RainEffect.Rate = 0
end
end
end)
|
-- Signal types
|
export type Connection = {
Disconnect: (self: Connection) -> (),
Destroy: (self: Connection) -> (),
Connected: boolean,
}
export type Signal<T...> = {
Fire: (self: Signal<T...>, T...) -> (),
FireDeferred: (self: Signal<T...>, T...) -> (),
Connect: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
Once: (self: Signal<T...>, fn: (T...) -> ()) -> Connection,
DisconnectAll: (self: Signal<T...>) -> (),
GetConnections: (self: Signal<T...>) -> { Connection },
Destroy: (self: Signal<T...>) -> (),
Wait: (self: Signal<T...>) -> T...,
}
|
--------END STAGE--------
--------CREW--------
|
game.Workspace.crewview1.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew2.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
game.Workspace.crew3.Decal.Texture = "http://www.roblox.com/asset/?id="..(game.Workspace.CustomScreen.Value)..""
|
--------------------------------------------------
|
script.Parent.Values.RPM.Changed:connect(function()
intach.Rotation = -65 + script.Parent.Values.RPM.Value * 250 / 8000
end)
script.Parent.Values.Velocity.Changed:connect(function(property)
inspd.Rotation = -30 + (440 / 160) * (math.abs(script.Parent.Values.Velocity.Value.Magnitude*((10/12) * (50/88))))
end)
script.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Values.Gear.Value
if gearText == 0 then
gearText = "N"
car.Body.Dash.DashSc.G.Gear.Text = "N"
car.DriveSeat.Filter:FireServer('reverse',false)
elseif gearText == -1 then
gearText = "R"
car.Body.Dash.DashSc.G.Gear.Text = "R"
car.DriveSeat.Filter:FireServer('reverse',true)
end
car.Body.Dash.DashSc.G.Gear.Text = gearText
end)
script.Parent.Values.PBrake.Changed:connect(function()
dash.PBrake.Visible = script.Parent.Values.PBrake.Value
end)
local car = script.Parent.Car.Value
local Values = script.Parent.Values
local _Tune = require(car["A-Chassis Tune"])
game["Run Service"].Stepped:connect(function()
local rev = (Values.RPM.Value/_Tune.Redline)
local MPHScale = (10/12) * (60/88)
local KPHScale = (10/12) * 1.09728
local Speed = Values.Velocity.Value.Magnitude
car.Body.Gauges.Screen.FPGauges.Gauge.RPMFrame.Fill.Size = UDim2.new(rev,0,1,0)
car.Body.Gauges.Screen.FPGauges.Gauge.Gear.Gear.Text = Values.Gear.Value
car.Body.Gauges.Screen.FPGauges.Gauge.Speed.MPH.Text = " ".. math.floor(Speed*MPHScale)
car.Body.Gauges.Screen.FPGauges.Gauge.Speed.KPH.Text = " ".. math.floor(Speed*KPHScale)
end)
|
--- Setting Fire ---
|
local fire = script.Fire
fire.Parent = pellet
fire.Enabled = true
damage = 10
local DebrisService = game:GetService('Debris')
function TagHumanoid(humanoid, vPlayer)
-- Add more tags here to customize what tags are available.
local creatorTag = Instance.new("ObjectValue")
creatorTag.Value = vPlayer
creatorTag.Name = "creator"
creatorTag.Parent = humanoid
DebrisService:AddItem(creatorTag, 1.5)
end
function FireScript(human)
if human.Parent.Torso:FindFirstChild("FIRE")~= nil then
else
local FireBurn = script.FIRE:Clone()
FireBurn.Parent = human.Parent.Torso
FireBurn.FireDamage.Disabled = false
end
end
function onTouched(hit)
if hit and hit.Parent then
if HitPeople[hit.Parent.Name] then
|
--use this to determine if you want this human to be harmed or not, returns boolean
|
function checkTeams(otherHuman)
return not (sameTeam(otherHuman) and not FriendlyFire==true)
end
function boom()
wait(1.5)
Used = true
Object.Anchored = true
Object.CanCollide = false
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Transparency = 1
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist:Play()
Object.Explosion:Emit(30)
Object.Smoke1:Emit(30)
Object.Smoke2:Emit(30)
Object.Debris:Emit(10)
Object.exlight:Emit(2)
Object.dust:Emit(50)
Beps.Transparency = 1
Explode()
end
Object.Touched:Connect(function(part)
if Used == true or part.Name == "Handle" then return end
if part:IsDescendantOf(Tag.Value.Character) then return end
if part.Parent then
if part.Parent:FindFirstChild("Humanoid") then
local human = part.Parent.Humanoid
if checkTeams(human) then
tagHuman(human)
human:TakeDamage(Damage)
end
end
Used = true
Object.Impact:Play()
Object.Velocity = Vector3.new(Object.Velocity.x/10,Object.Velocity.y/10,Object.Velocity.z/10)
Object.RotVelocity = Vector3.new(Object.RotVelocity.x/10,Object.RotVelocity.y/10,Object.RotVelocity.z/10)
game:GetService("Debris"):AddItem(Object, 10)
end
end)
boom()
|
--Made by Luckymaxer
|
Debris = game:GetService("Debris")
Creator = script:FindFirstChild("Creator")
Tool = script:FindFirstChild("Tool")
Model = script:WaitForChild("Model")
function DestroyModel()
if Model and Model.Parent then
Debris:AddItem(Model, 2)
end
Debris:AddItem(script, 2)
end
if not Creator or not Creator.Value or not Creator.Value:IsA("Player") or not Creator.Value.Parent or not Tool or not Tool.Value or not Tool.Value.Parent or not Model or not Model.Value then
DestroyModel()
return
end
Creator = Creator.Value
Tool = Tool.Value
Model = Model.Value
Character = Creator.Character
if not Character then
DestroyModel()
return
end
Creator.Changed:connect(function(Property)
if Property == "Parent" and not Creator.Parent then
DestroyModel()
end
end)
Character.Changed:connect(function(Property)
if Property == "Parent" and not Character.Parent then
DestroyModel()
end
end)
Tool.Changed:connect(function(Property)
if Property == "Parent" then
DestroyModel()
end
end)
Model.Changed:connect(function(Property)
if Property == "Parent" and not Model.Parent then
DestroyModel()
end
end)
|
-- See if I have a tool
|
local spawner = script.Parent
local tool = nil
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 5)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
print("removed spin")
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle then
print("removed spinning")
end
wait()
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
|
-- This decides what to do if detection is 'Automatic'
-- This is placed in ZoneController instead of the Zone object due to the ZoneControllers all-knowing group-minded logic
|
function ZoneController.updateDetection(zone)
local detectionTypes = {
["enterDetection"] = "_currentEnterDetection",
["exitDetection"] = "_currentExitDetection",
}
for detectionType, currentDetectionName in pairs(detectionTypes) do
local detection = zone[detectionType]
if detection == enum.Detection.Automatic then
if charactersTotalVolume > WHOLE_BODY_DETECTION_LIMIT then
detection = enum.Detection.Centre
else
detection = enum.Detection.WholeBody
end
end
zone[currentDetectionName] = detection
end
end
function ZoneController._formHeartbeat(registeredTriggerType)
local heartbeatConnection = heartbeatConnections[registeredTriggerType]
if heartbeatConnection then return end
-- This will only ever connect once per triggerType per server
-- This means instead of initiating a loop per-zone we can handle everything within
-- a singular connection. This is particularly beneficial for player-orinetated
-- raycasting, where a raycast only needs to be cast once per interval, as apposed
-- to every zone per interval
-- I utilise heartbeat with os.clock() to provide precision (where needed) and flexibility
local nextCheck = 0
heartbeatConnection = heartbeat:Connect(function()
local clockTime = os.clock()
if clockTime >= nextCheck then
local lowestAccuracy
local lowestDetection
for zone, _ in pairs(activeZones) do
if zone.activeTriggers[registeredTriggerType] then
local zAccuracy = zone.accuracy
if lowestAccuracy == nil or zAccuracy < lowestAccuracy then
lowestAccuracy = zAccuracy
end
ZoneController.updateDetection(zone)
local zDetection = zone._currentEnterDetection
if lowestDetection == nil or zDetection < lowestDetection then
lowestDetection = zDetection
end
end
end
local highestAccuracy = lowestAccuracy
local zonesAndOccupants = heartbeatActions[registeredTriggerType](lowestDetection)
for zone, _ in pairs(activeZones) do
if zone.activeTriggers[registeredTriggerType] then
local zAccuracy = zone.accuracy
local occupantsDict = zonesAndOccupants[zone] or {}
local occupantsPresent = false
for k,v in pairs(occupantsDict) do
occupantsPresent = true
break
end
if occupantsPresent and zAccuracy > highestAccuracy then
highestAccuracy = zAccuracy
end
zone:_updateOccupants(registeredTriggerType, occupantsDict)
end
end
----
local cooldown = enum.Accuracy.getProperty(highestAccuracy)
nextCheck = clockTime + cooldown
----
end
end)
heartbeatConnections[registeredTriggerType] = heartbeatConnection
end
function ZoneController._deregisterConnection(registeredZone, registeredTriggerType)
activeConnections -= 1
if activeTriggers[registeredTriggerType] == 1 then
activeTriggers[registeredTriggerType] = nil
local heartbeatConnection = heartbeatConnections[registeredTriggerType]
if heartbeatConnection then
heartbeatConnections[registeredTriggerType] = nil
heartbeatConnection:Disconnect()
end
else
activeTriggers[registeredTriggerType] -= 1
end
registeredZone.activeTriggers[registeredTriggerType] = nil
if dictLength(registeredZone.activeTriggers) == 0 then
activeZones[registeredZone] = nil
ZoneController._updateZoneDetails()
end
if registeredZone.touchedConnectionActions[registeredTriggerType] then
registeredZone:_disconnectTouchedConnection(registeredTriggerType)
end
end
function ZoneController._updateZoneDetails()
activeParts = {}
activePartToZone = {}
allParts = {}
allPartToZone = {}
activeZonesTotalVolume = 0
for zone, _ in pairs(registeredZones) do
local isActive = activeZones[zone]
if isActive then
activeZonesTotalVolume += zone.volume
end
for _, zonePart in pairs(zone.groupParts) do
if isActive then
table.insert(activeParts, zonePart)
activePartToZone[zonePart] = zone
end
table.insert(allParts, zonePart)
allPartToZone[zonePart] = zone
end
end
end
function ZoneController._getZonesAndPlayers(zonesDictToCheck, zoneCustomVolume, onlyActiveZones, recommendedDetection)
local totalZoneVolume = zoneCustomVolume
if not totalZoneVolume then
for zone, _ in pairs(zonesDictToCheck) do
totalZoneVolume += zone.volume
end
end
local zonesAndOccupants = {}
if charactersTotalVolume < totalZoneVolume then
-- If the volume of all *characters* within the server is *less than* the total
-- volume of all active zones (i.e. zones which listen for .playerEntered)
-- then it's more efficient cast regions and rays within each character and
-- then determine the zones they belong to
for _, plr in pairs(players:GetPlayers()) do
local touchingZones = ZoneController.getTouchingZones(plr, onlyActiveZones, recommendedDetection)
for _, zone in pairs(touchingZones) do
if not onlyActiveZones or zone.activeTriggers["player"] then
fillOccupants(zonesAndOccupants, zone, plr)
end
end
end
else
-- If the volume of all *active zones* within the server is *less than* the total
-- volume of all characters, then it's more efficient to perform the region and raycast
-- checks directly within each zone to determine players inside
for zone, _ in pairs(zonesDictToCheck) do
if not onlyActiveZones or zone.activeTriggers["player"] then
local result = workspace:FindPartsInRegion3WithWhiteList(zone.region, bodyParts, #bodyParts)
local playersDict = {}
for _, bodyPart in pairs(result) do
local parentName = bodyPart.Parent.Name
if not playersDict[parentName] then
playersDict[parentName] = players:GetPlayerFromCharacter(bodyPart.Parent)
end
end
for _, plr in pairs(playersDict) do
if plr and zone:findPlayer(plr) then
fillOccupants(zonesAndOccupants, zone, plr)
end
end
end
end
end
return zonesAndOccupants
end
|
--!strict
|
local Array = script.Parent
local isArray = require(Array.isArray)
type Array<T> = { [number]: T }
return function(array: Array<any>, ...): number
if _G.__DEV__ then
if not isArray(array) then
error(string.format("Array.unshift called on non-array %s", typeof(array)))
end
end
local numberOfItems = select("#", ...)
if numberOfItems > 0 then
for i = numberOfItems, 1, -1 do
local toInsert = select(i, ...)
table.insert(array, 1, toInsert)
end
end
return #array
end
|
--[[Run]]
|
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("//INSPARE: AC6 Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--RPM
RPM()
--Update External Values
_IsOn = car.DriveSeat.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
if car.DriveSeat.ABS.Value == true and car.DriveSeat.AS.Value == false then
if car.DriveSeat.Velocity.Magnitude > 100 then
if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.12)*(10/12) * (60/88)))) then
local p = workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.1)*(10/12) * (60/88))))
local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
if aa > 35 and (p.CanCollide or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels") and (p.Name ~= "Baseplate") then
if (p.Velocity.Magnitude < 5 or p.Anchored) then
car.DriveSeat.AS.Value = true
_GBrake = 1
repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
car.DriveSeat.AS.Value = false
end
end
end
else
if workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.05)*(10/12) * (60/88)))) then
local p = workspace:FindPartOnRay(Ray.new(snsrs.FS.RayEnd.CFrame.p,(snsrs.FS.RayEnd.CFrame.p-snsrs.FS.RayStart.CFrame.p).unit * ((car.DriveSeat.Velocity.Magnitude^1.1)*(10/12) * (60/88))))
local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
if aa > 35 and (p.CanCollide or p.Parent.Name == "Body" or p.Parent.Parent.Name == "Body" or p.Parent.Name == "Wheels") and (p.Name ~= "Baseplate") then
if (p.Velocity.Magnitude < 5 or p.Anchored) then
car.DriveSeat.AS.Value = true
_GBrake = 1
repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
car.DriveSeat.AS.Value = false
end
end
end
end
if workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
local p = workspace:FindPartOnRay(Ray.new(snsrs.BMSL.RayEnd.CFrame.p,(snsrs.BMSL.RayEnd.CFrame.p-snsrs.BMSL.RayStart.CFrame.p).unit * 6))
local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
if aa > 5 and (p.CanCollide) then
if (p.Velocity.Magnitude < 5 or p.Anchored) then
car.DriveSeat.AS.Value = true
_GBrake = 1
repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
car.DriveSeat.AS.Value = false
end
end
end
if workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
local p = workspace:FindPartOnRay(Ray.new(snsrs.BMSR.RayEnd.CFrame.p,(snsrs.BMSR.RayEnd.CFrame.p-snsrs.BMSR.RayStart.CFrame.p).unit * 6))
local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
if aa > 5 and (p.CanCollide) then
if (p.Velocity.Magnitude < 5 or p.Anchored) then
car.DriveSeat.AS.Value = true
_GBrake = 1
repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
car.DriveSeat.AS.Value = false
end
end
end
if workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit * 6)) and (_CGear == -1) then
local p = workspace:FindPartOnRay(Ray.new(snsrs.RS.RayEnd.CFrame.p,(snsrs.RS.RayEnd.CFrame.p-snsrs.RS.RayStart.CFrame.p).unit * 6))
local aa = math.abs(p.Velocity.Magnitude - car.DriveSeat.Velocity.Magnitude)
if aa > 5 and (p.CanCollide) then
if (p.Velocity.Magnitude < 5 or p.Anchored) then
car.DriveSeat.AS.Value = true
_GBrake = 1
repeat wait() until car.DriveSeat.Velocity.Magnitude < 2
car.DriveSeat.AS.Value = false
end
end
end
end
end)
script.Parent.Values.Brake.Changed:connect(function()
if math.ceil(_GBrake) > 0 then
car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', true)
else
car.DriveSeat.FE_Lights:FireServer('updateLights', 'brake', false)
end
end)
script.Parent.Values.Throttle.Changed:Connect(function()
if math.ceil(_GThrot) > 0 then
if car.DriveSeat.AS.Value == true then
car.DriveSeat.AS.Value = false
_GBrake = 0
end
end
end)
-- ~15 c/s
while wait(.0667) do
--Power
Engine()
--Flip
if _Tune.AutoFlip then Flip() end
end
|
--fetching effectlib
|
local common_modules = game.ReplicatedStorage.CommonModules
EFFECT_LIB = require(common_modules.EffectLib)
local function GenColor(t, rate)
local get_t = ((t - math.floor(t / rate) * rate) / rate) * math.pi * 2
local red = math.sin(get_t + 0) * 0.5 + 0.5
local green = math.sin(get_t + math.pi / 2) * 0.5 + 0.5
local blue = math.sin(get_t + math.pi) * 0.5 + 0.5
return Color3.new(red, green, blue)
end
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Copper",Paint)
end)
|
--Rescripted by Luckymaxer
--Made by Stickmasterluke
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Sparkles = Handle:WaitForChild("Sparkles")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
WeaponHud = Tool:WaitForChild("WeaponHud")
WeaponNameTag = WeaponHud:WaitForChild("WeaponName")
GuiBar = WeaponHud:WaitForChild("Bar")
GuiBarFill = GuiBar:WaitForChild("Fill")
WeaponNameTag.Text = Tool:WaitForChild("ToolName").Value
BasePart = Instance.new("Part")
BasePart.Shape = Enum.PartType.Block
BasePart.Material = Enum.Material.Plastic
BasePart.TopSurface = Enum.SurfaceType.Smooth
BasePart.BottomSurface = Enum.SurfaceType.Smooth
BasePart.FormFactor = Enum.FormFactor.Custom
BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
BasePart.CanCollide = true
BasePart.Locked = true
BasePart.Anchored = false
Animations = {
Equip = {Animation = Tool:WaitForChild("Equip"), FadeTime = nil, Weight = nil, Speed = 1.5, Duration = nil},
Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
LeftSlash = {Animation = Tool:WaitForChild("LeftSlash"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
RightSlash = {Animation = Tool:WaitForChild("RightSlash"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
Stab1 = {Animation = Tool:WaitForChild("Stab1"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
Stab2 = {Animation = Tool:WaitForChild("Stab2"), FadeTime = nil, Weight = nil, Speed = 1.2, Duration = nil},
}
Sounds = {
Swoosh1 = Handle:WaitForChild("Swoosh1"),
Swoosh2 = Handle:WaitForChild("Swoosh2"),
Hit1 = Handle:WaitForChild("Hit1"),
Hit2 = Handle:WaitForChild("Hit2"),
Hit3 = Handle:WaitForChild("Hit3"),
Clash1 = Handle:WaitForChild("Clash1"),
Clash2 = Handle:WaitForChild("Clash2"),
Clash3 = Handle:WaitForChild("Clash3"),
Clash4 = Handle:WaitForChild("Clash4"),
Clash5 = Handle:WaitForChild("Clash5"),
}
Damage = 22 -- +/- 10%
DamageWindow = 1 --How long the player has to hit opponent to deal damage after click
SwingRate = 0.75
BloodEffects = false
Ready = false
ToolEquipped = false
Rate = (1 / 30)
LastSwing = 0
MouseDown = false
CurrentAnimation = nil
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
Tool.Enabled = true
ServerControl.OnServerInvoke = (function(player, Mode, Value)
if player == Player then
if Mode == "MouseClick" then
MouseDown = Value.Down
if MouseDown then
Activated()
end
elseif Mode == "KeyPress" then
local Key = Value.Key
local Down = Value.Down
end
end
end)
function InvokeClient(Mode, Value)
local ClientReturn = nil
pcall(function()
ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
end)
return ClientReturn
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 Billboard(Pos, Text, Time, Color)
local Pos = (Pos or Vector3.new(0, 0, 0))
local Text = (Text or "Hello World!")
local Time = (Time or 2)
local Color = (Color or Color3.new(1, 0, 0))
local Pos = (Pos + Vector3.new(0, 5, 0))
local EffectPart = BasePart:Clone()
EffectPart.Name = "Effect"
EffectPart.Size = Vector3.new(0, 0, 0)
EffectPart.CFrame=CFrame.new(Pos)
EffectPart.Anchored = true
EffectPart.CanCollide = false
EffectPart.Transparency = 1
local BillboardGui = Instance.new("BillboardGui")
BillboardGui.Size = UDim2.new(3, 0, 3, 0)
BillboardGui.Adornee = EffectPart
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = UDim2.new(1, 0, 1, 0)
TextLabel.Text = Text
TextLabel.TextColor3 = Color
TextLabel.TextScaled = true
TextLabel.Font = Enum.Font.ArialBold
TextLabel.Parent = BillboardGui
BillboardGui.Parent = EffectPart
Debris:AddItem(EffectPart, (Time + 0.1))
EffectPart.Parent = game:GetService("Workspace")
Delay(0, function()
local Frames = (Time / Rate)
for Frame = 1, Frames do
wait(Rate)
local Percent = (Frame / Frames)
EffectPart.CFrame=CFrame.new(Pos) + Vector3.new(0, (5 * Percent), 0)
TextLabel.TextTransparency = Percent
end
if EffectPart and EffectPart.Parent then
EffectPart:Destroy()
end
end)
end
function MakeBlood(Part)
if not Part then
return
end
local Blood = BasePart:Clone()
Blood.BrickColor = BrickColor.new("Bright red")
Blood.Transparency = (math.random(0, 1) * 0.5)
Blood.CanCollide = ((math.random() < 0.5 and false) or true)
Blood.Size = Vector3.new((0.2 * math.random(1, 5)), (0.2 * math.random(1, 5)), (0.2 * math.random(1, 5)))
Blood.Velocity= Part.Velocity + (Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 30)
Blood.RotVelocity = Part.RotVelocity + (Vector3.new((math.random() - 0.5), (math.random() - 0.5), (math.random() - 0.5)) * 20)
Blood.CFrame= Part.CFrame * CFrame.new(((math.random() - 0.5) * 3), ((math.random() - 0.5) * 3), ((math.random() - 0.5) * 3)) * CFrame.Angles((math.pi * 2 * math.random()), (math.pi * 2 * math.random()), (math.pi * 2 * math.random()))
Debris:AddItem(Blood, (math.random() * 4))
Blood.Parent = game:GetService("Workspace")
end
function Blow(Hit)
if not Hit or not Hit.Parent or not CheckIfAlive() or not Ready or not ToolEquipped or (tick() - LastSwing) > DamageWindow then
return
end
local character = Hit.Parent
if character == Character then
return
end
if Hit:FindFirstChild("CanBlock") and Handle:FindFirstChild("Blockable") then
local Ready = false
local PossibleSounds = {Sounds.Clash1, Sounds.Clash2, Sounds.Clash3, Sounds.Clash4, Sounds.Clash5}
local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
Sound:Play()
Sparkles.Enabled = true
Delay(0.2, function()
Sparkles.Enabled = false
end)
Billboard(Handle.Position, "Block", 2, Color3.new(1, 1, 0))
end
local humanoid = character:FindFirstChild("Humanoid")
local player = Players:GetPlayerFromCharacter(character)
local RightArm = Character:FindFirstChild("Right Arm")
if humanoid and humanoid.Health > 0 and humanoid ~= Humanoid and RightArm then
local RightGrip = RightArm:FindFirstChild("RightGrip")
if RightGrip and (RightGrip.Part0 == Handle or RightGrip.Part1 == Handle) then
if player and player ~= Player and not Player.Neutral and not player.Neutral and Player.TeamColor == player.TeamColor then
return --No team killing
end
Ready = false
UntagHumanoid(humanoid)
TagHumanoid(humanoid)
local LocalDamage= math.floor(Damage * (0.9 + (math.random() * 0.2)) + 0.5)
humanoid:TakeDamage(LocalDamage)
Billboard(Hit.Position, ("-" .. tostring(LocalDamage)))
local PossibleSounds = {Sounds.Hit1, Sounds.Hit2, Sounds.Hit3}
local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
Sound:Play()
if BloodEffects then
local NumBloodEffects = math.ceil(LocalDamage / 10)
for i = 1, math.random((NumBloodEffects - 1), (NumBloodEffects + 1)) do
MakeBlood(Hit)
end
end
end
end
end
function Activated()
if ToolEquipped and (tick() - LastSwing) >= SwingRate then
Tool.Enabled = false
Ready = true
local PossibleSounds = {Sounds.Swoosh1, Sounds.Swoosh2}
local Sound = PossibleSounds[math.random(1, #PossibleSounds)]
Sound:Play()
local AttackAnimations = {Animations.LeftSlash, Animations.RightSlash, Animations.Stab1, Animations.Stab2}
local NewAnimation = AttackAnimations[math.random(1, #AttackAnimations)]
while NewAnimation == CurrentAnimation do
NewAnimation = AttackAnimations[math.random(1, #AttackAnimations)]
end
CurrentAnimation = NewAnimation
InvokeClient("PlayAnimation", CurrentAnimation)
LastSwing = tick()
wait(SwingRate)
if MouseDown then
Activated()
end
Tool.Enabled = true
end
end
function UpdateGui()
local SwingPercent = math.min(((tick() - LastSwing) / SwingRate), 1)
if SwingPercent < 0.5 then --fade from red to yellow then to green
GuiBarFill.BackgroundColor3 = Color3.new(1, (SwingPercent * 2), 0)
else
GuiBarFill.BackgroundColor3 = Color3.new((1 - ((SwingPercent - 0.5 ) / 0.5)), 1, 0)
end
GuiBarFill.Size = UDim2.new(SwingPercent, 0, 1, 0)
end
function CheckIfAlive()
return (Player and Player.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0)
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
PlayerGui = Player:FindFirstChild("PlayerGui")
Humanoid = Character:FindFirstChild("Humanoid")
if not CheckIfAlive() then
return
end
if PlayerGui then
WeaponHud.Parent = PlayerGui
end
InvokeClient("PlayAnimation", Animations.Equip)
LastSwing = tick()
Ready = false
ToolEquipped = true
for i, v in pairs(Animations) do
if v and v.Animation then
InvokeClient("Preload", v.Animation.AnimationId)
end
end
ToolEquipped = true
end
function Unequipped()
for i, v in pairs(Animations) do
InvokeClient("StopAnimation", v)
end
WeaponHud.Parent = Tool
ToolEquipped = false
Ready = false
end
Handle.Touched:connect(Blow)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
Spawn(function()
while true do
UpdateGui()
wait(Rate)
end
end)
|
-------------------------
|
mouse.KeyDown:connect(function (key)
key = string.lower(key)
if key == "a" then
a = true
elseif key == "d" then
d = true
elseif key == "w" then
w = true
rwd.Throttle = 1
rwd.Torque = tq
lwd.Throttle = 1
lwd.Torque = ftq
rrwd.Throttle = 1
rrwd.Torque = ftq
rwd.MaxSpeed = 305
lwd.MaxSpeed = 305
rrwd.MaxSpeed = 305
carSeat.Throttle = 1
carSeat.Torque = 0
elseif key == "s" then
s = true
carSeat.Throttle = 0
carSeat.Torque = 0
rwd.Throttle = -1
rwd.Torque = brk
lwd.Throttle = -1
lwd.Torque = brk
rrwd.Throttle = -1
rrwd.Torque = brk
rwd.MaxSpeed = 25
lwd.MaxSpeed = 25
rrwd.MaxSpeed = 25
end
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "a" then
print("a up")
if d == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
elseif key == "d" then
print("d up")
if a == false then
m.DesiredAngle = 0
n.DesiredAngle = m.DesiredAngle
end
end
a = false
d = false
end)
mouse.KeyUp:connect(function (key)
key = string.lower(key)
if key == "w" or key == "s" then
rwd.Throttle = 0
rwd.Torque = 0
lwd.Throttle = 0
lwd.Torque = 0
rrwd.Throttle = 0
rrwd.Torque = 0
carSeat.Throttle = 0
carSeat.Torque = cst
end
end)
limitButton.MouseButton1Click:connect(function()
|
--// 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
local function RippleEffect(element)
spawn(function()
element.ClipsDescendants = true
local effect = create("ImageLabel", {
Parent = element,
AnchorPoint = Vector2.new(0.5, 0.5),
BorderSizePixel = 0,
ZIndex = element.ZIndex + 1,
BackgroundTransparency = 0.5,
ImageTransparency = 0.8,
Image = "rbxasset://textures/whiteCircle.png",
Position = UDim2.new(0.5, 0, 0.5, 0),
})
effect:TweenSize(UDim2.new(0, element.AbsoluteSize.X * 2.5, 0, element.AbsoluteSize.X * 2.5), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.2)
wait(0.2)
effect:Destroy()
end)
end
local clickSound = service.New("Sound")
clickSound.Parent = GUI.Drag
clickSound.Volume = 0.4
clickSound.SoundId = "rbxassetid://6706935653"
Main.DescendantAdded:Connect(function(child)
if child:IsA("TextButton") and not child:FindFirstChildOfClass("UIGradient") then
local gradient = Instance.new("UIGradient", child)
gradient.Color = ColorSequence.new{ColorSequenceKeypoint.new(0,Color3.new(1,1,1)),ColorSequenceKeypoint.new(1,Color3.fromRGB(80,80,80))}
--[[create("ImageLabel", {
BackgroundTransparency = 1;
ImageTransparency = 0.5;
Image = "rbxassetid://456420746"; -- For dusty Aero :]
Size = UDim2.new(1, 0, 1, 0);
Parent = child;
ZIndex = 2
})]]
end
end)
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, 3)
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
local newTitleButton = create("TextButton", data)
create("UICorner", {CornerRadius = UDim.new(0,4);Parent = newTitleButton})
newTitleButton.MouseButton1Down:Connect(function() RippleEffect(newTitleButton) end)
return newTitleButton
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
RippleEffect(new)
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(function()
clickSound:Play()
RippleEffect(new)
new.DoClick()
end)
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
clickSound:Play()
RippleEffect(new)
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
local function showMenu()
menu.Position = UDim2.new(0, new.AbsolutePosition.X, 0, new.AbsolutePosition.Y+new.AbsoluteSize.Y)
menu.Visible = not menu.Visible
end
selected.MouseButton1Down:Connect(function() clickSound:Play() RippleEffect(selected) showMenu() end)
downImg.MouseButton1Down:Connect(function() RippleEffect(selected) showMenu() end)
end
end
if class == "TabFrame" then
local buttonsTab = {};
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 dSecondaryBackground;
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 dSecondaryBackground;
BorderSizePixel = 0;
})
tabFrame:SetSpecial("FocusTab",function()
for i,v in next,buttonsTab do
if isGui(v) then
v.BackgroundTransparency = (v:IsDisabled() and 0.9) or 0.7
v.TextTransparency = (v:IsDisabled() and 0.9) or 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)
tabButton:SetSpecial("IsDisabled", function()
return disabled;
end)
table.insert(buttonsTab, tabButton);
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 = "SourceSans";
TextSize = 18;
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
for _, thing in pairs(Drag:GetChildren()) do
if thing ~= Main then
thing:Destroy()
end
end
Drag:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
Main.ClipsDescendants = true
Main:TweenSize(UDim2.new(0,0,0,0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
wait(0.12)
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
Main.Glass.Parent = Drag
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.Icon.Image = "rbxassetid://3523249191"
else
Hide.Icon.Image = "rbxassetid://3523249191"
end
Hide.LineHeight = origLH
gTable.Minimized = true
elseif doHide == false or (doHide == nil and not Main.Visible) then
Main.Visible = true
Drag.Glass.Parent = Main
Drag.BackgroundTransparency = 1
Drag.Size = dragSize or Drag.Size
if hideLabel then
hideLabel.Icon.Image = "rbxassetid://3523250728"
else
Hide.Icon.Image = "rbxassetid://3523250728"
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()
clickSound:Play()
RippleEffect(Refresh)
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()
clickSound:Play()
RippleEffect(Iconf)
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.MouseButton1Click:Connect(function() clickSound:Play() doClose() end)
Hide.MouseButton1Click:Connect(function() clickSound:Play() doHide() end)
Close.MouseButton1Down:Connect(function() RippleEffect(Close) end)
Hide.MouseButton1Down:Connect(function() RippleEffect(Hide) 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
|
-- loop through all the arm parts and make them visible in first person
|
local function setArmVisibility(bool)
local castshadow = not bool
for i, part in ipairs(ArmPartsTable) do
part.LocalTransparencyModifier = armTransparency
part.CastShadow = castshadow
end
end
local function toggleViewmodel(toggle)
isFirstPerson = toggle --// Update the first person state
Viewmodel.Parent = toggle and workspace.CurrentCamera or nil --// Put the Viewmodel in the camera, or take it out
RightShoulderClone.Enabled = toggle --// Update joints
LeftShoulderClone.Enabled = toggle
LeftShoulder.Enabled = (not toggle) --// Update the original joints (to prevent :fling incidents)
RightShoulder.Enabled = (not toggle)
if toggle then
RightShoulderClone.Part1 = RightArm
RightShoulderClone.Part0 = FakeTorso
RightShoulderClone.Parent = FakeTorso
--// I'm not sure what the point of doing this here is. I'm too scared to change it though because this code is AWFUL.
--// God knows what would happen.
LeftShoulderClone.Part1 = LeftArm
LeftShoulderClone.Part0 = FakeTorso
LeftShoulderClone.Parent = FakeTorso
end
end
|
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/installCommonGlobals.ts
| |
-- only 2 locals,yeah...
|
local player = game.Players.LocalPlayer
local char = player.Character
char:WaitForChild("Humanoid").Died:Connect(function() --check if player got oofed
wait()
script.Parent.BackgroundTransparency = 0 -- make it not transparent(just to be 100% sure it will be visible after)
player.CameraMode = 0 -- set third person
player.CameraMaxZoomDistance = 3 -- lock the camera zoom
player.CameraMinZoomDistance = 3
wait(1)
script.Parent.Deathsound:Play() -- play the sound
wait(1)
script.Parent.Visible = true -- make screen go black xd
player.CameraMaxZoomDistance = 0.5 --reset the zoom
player.CameraMinZoomDistance = 0.5
player.CameraMode = 1 -- set first person
wait(3) -- screen fade out UwU
script.Parent.BackgroundTransparency = 0.1
wait(0.3)
script.Parent.BackgroundTransparency = 0.2
wait(0.3)
script.Parent.BackgroundTransparency = 0.3
wait(0.2)
script.Parent.BackgroundTransparency = 0.4
wait(0.2)
script.Parent.BackgroundTransparency = 0.6
wait(0.1)
script.Parent.BackgroundTransparency = 0.8
wait(0.1)
script.Parent.BackgroundTransparency = 1
script.Parent.Visible = false -- make it invisible(just to be sure again)
end)
|
--create tables:
|
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "c" then
table.insert(c, 1, part)
end
end
for i,part in pairs(model:GetChildren()) do
if string.sub(part.Name, 1,1) == "d" then
table.insert(d, 1, part)
end
end
function lightOn(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = true
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = true
end
end
end
function lightOff(T)
for i, part in pairs (T) do
if part:FindFirstChild("SurfaceLight") then
part.SurfaceLight.Enabled = false
end
if part:FindFirstChild("SpotLight") then
part.SpotLight.Enabled = false
end
end
end
while true do
local w2 = (math.random(2,7))/17
lightOn(c)
wait(0.12)
lightOff(c)
wait(w2)
lightOn(d)
wait(0.12)
lightOff(d)
wait(w2)
end
|
-- Services
|
local ContextActionSerice = game:GetService("ContextActionService")
local ServerStorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")
local DebrisService = game:GetService("Debris")
local RunService = game:GetService("RunService")
local PhysicsService = game:GetService("PhysicsService")
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Toothpaste",Paint)
end)
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 20
local slash_damage = 0
sword = script.Parent.Handle
Tool = script.Parent
function attack()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
return
end
attack()
wait(1)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
--[=[
Observes all children of a specific class
@param parent Instance
@param className string
@return Observable<Instance>
]=]
|
function RxInstanceUtils.observeChildrenOfClassBrio(parent, className)
assert(typeof(parent) == "Instance", "Bad parent")
assert(type(className) == "string", "Bad className")
return RxInstanceUtils.observeChildrenBrio(parent, function(child)
return child:IsA(className)
end)
end
|
--[[
Quicker (and limited) way to use TweenService since the default synax takes up a paragraph. Supports tuple of instances.
Functions.FastTween(
instance, <-- |REQ| Instance that will be tweened
{property = 300}, <-- |REQ| Dictionary of properties and their values
{speed, style, dir} <-- |REQ| Array: Speed (sec), Style (str), Direction (str) [defaults to: {1, "Sine", "InOut"}]
)
--]]
|
return function(_entity, tweenGoals, tweenInfoRaw)
--- Allow for multipule instances
if type(_entity) ~= "table" then _entity = {_entity} end
--- Variables
local tweens = {}
--- iterate through each instance
for _, entity in ipairs(_entity) do
if tweenInfoRaw == nil then
--- No tweenInfo provided. Use the default one!
tweenInfoRaw = {
1,
Enum.EasingStyle.Linear,
Enum.EasingDirection.Out,
}
else
--- Check (2nd) tween arguments and fix/fill them
if tweenInfoRaw[2] == nil then
--- No easing style provided. Use default one!
tweenInfoRaw[2] = Enum.EasingStyle.Sine
elseif type(tweenInfoRaw[2]) == "string" then
--- Easing style provided string not enum. Convert!
tweenInfoRaw[2] = Enum.EasingStyle[tweenInfoRaw[2]]
end
--- Check (3rd) tween arguments and fix/fill them
if tweenInfoRaw[3] == nil then
--- No easing direction provided. Use default one!
tweenInfoRaw[3] = Enum.EasingDirection.InOut
elseif type(tweenInfoRaw[3]) == "string" then
--- Easing direction provided string not enum. Convert!
tweenInfoRaw[3] = Enum.EasingDirection[tweenInfoRaw[3]]
end
end
--- Create tween
local tweenInfo = TweenInfo.new(unpack(tweenInfoRaw))
local tweenGoals = tweenGoals
local tween = _L.Services.TweenService:Create(entity, tweenInfo, tweenGoals)
--- Play tween
tween:Play()
--- Add tween to list of tweens that will be returned
table.insert(tweens, tween)
end
--
return unpack(tweens)
end
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance=script.Parent.Configuration.NoticeDistance.Value;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=30;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 0, 0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 0, 0)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
---
|
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.Parent.IsOn.Value then
script.Parent.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.MouseButton1Click:connect(function()
if lhinge.DesiredAngle == 0 then
sound.SoundId = "rbxassetid://278329638"
sound:Play()
for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
child.Material = Enum.Material.Neon
end
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.Neon
if child.Name == V then --TESTING
child.Transparency = 0 --TESTING
end
end
car.Misc.Popups.left.Parts.L.L.L.Enabled = true
car.Misc.Popups.right.Parts.L.L.L.Enabled = true
wait(.05)
lhinge.DesiredAngle = 0.6
rhinge.DesiredAngle = 0.6
else
for index, child in pairs(car.Misc.Popups.left.Parts.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Misc.Popups.right.Parts.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
end
for index, child in pairs(car.Body.Lights.L:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
if child.Name == V then --TESTING
child.Transparency = 1 --TESTING
end
end
car.Misc.Popups.left.Parts.L.L.L.Enabled = false
car.Misc.Popups.right.Parts.L.L.L.Enabled = false
lhinge.DesiredAngle = 0
rhinge.DesiredAngle = 0
sound.SoundId = "rbxassetid://278329638"
sound:Play()
end
end)
script.Parent.Parent.Parent.Values.Brake.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Brake.Value ~= 1 then
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
child.Transparency = 1
end
car.Body.Lights.B.L.L.Enabled = false
else
for index, child in pairs(car.Body.Lights.B:GetChildren()) do
child.Material = Enum.Material.Neon
child.Transparency = 0
end
car.Body.Lights.B.L.L.Enabled = true
end
end)
script.Parent.Parent.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Parent.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Lights.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .5
end
end
|
-- Backwards compatibility
|
Promise.prototype.awaitValue = Promise.prototype.expect
Promise.prototype.AwaitValue = Promise.prototype.expect
|
--//Limits//--
|
if InductionPartSize < 0 then
InductionPartSize = 0
elseif InductionPartSize > 5 then
InductionPartSize = 5
end
if WeightDistribution < 0 then
WeightDistribution = 0
elseif WeightDistribution > 100 then
WeightDistribution = 100
end
if SteeringAngle > 120 then
SteeringAngle = 120
elseif SteeringAngle < 20 then
SteeringAngle = 20
end
if TiresFront > 3 then
TiresFront = 3
elseif TiresFront < 1 then
TiresFront = 1
end
if TiresRear > 3 then
TiresRear = 3
elseif TiresRear < 1 then
TiresRear = 1
end
if DownforceF < 0 then
DownforceF = 0
elseif DownforceF > 5 then
DownforceF = 5
end
if DownforceR < 0 then
DownforceR = 0
elseif DownforceR > 5 then
DownforceR = 5
end
if EngineType == "Electric" then
TransmissionType = "Automatic"
InductionPartSize = 0
end
if BrakeBias > 100 then
BrakeBias = 100
elseif BrakeBias < 0 then
BrakeBias = 0
end
if BrakePower > 100 then
BrakePower = 100
elseif BrakePower < 0 then
BrakePower = 0
end
if AmountOfGears > 8 then
AmountOfGears = 8
elseif AmountOfGears < 1 then
AmountOfGears = 1
end
if TransmissionType ~= "HPattern" and TransmissionType ~= "Automatic" and TransmissionType ~= "DualClutch" and TransmissionType ~= "CVT" then
TransmissionType = "Automatic"
end
if Drivetrain ~= "AWD" and Drivetrain ~= "FWD" and Drivetrain ~= "RWD" then
Drivetrain = "FWD"
end
if TorqueSplit > 100 then
TorqueSplit = 100
elseif TorqueSplit < 0 then
TorqueSplit = 0
end
if Drivetrain == "RWD" then
TorqueSplit = 100
DifferentialF = 0
elseif Drivetrain == "FWD" then
TorqueSplit = 0
DifferentialR = 0
end
if DifferentialF > 1 then
DifferentialF = 1
elseif DifferentialF < 0 then
DifferentialF = 0
end
if DifferentialR > 1 then
DifferentialR = 1
elseif DifferentialR < 0 then
DifferentialR = 0
end
if Gear1 > 5 then
Gear1 = 5
elseif Gear1 < 0.1 then
Gear1 = 0.1
end
if Gear2 > 5 then
Gear2 = 5
elseif Gear2 < 0.1 then
Gear2 = 0.1
end
if Gear3 > 5 then
Gear3 = 5
elseif Gear3 < 0.1 then
Gear3 = 0.1
end
if Gear4 > 5 then
Gear4 = 5
elseif Gear4 < 0.1 then
Gear4 = 0.1
end
if Gear5 > 5 then
Gear5 = 5
elseif Gear5 < 0.1 then
Gear5 = 0.1
end
if Gear6 > 5 then
Gear6 = 5
elseif Gear6 < 0.1 then
Gear6 = 0.1
end
if Gear7 > 5 then
Gear7 = 5
elseif Gear7 < 0.1 then
Gear7 = 0.1
end
if Gear8 > 5 then
Gear8 = 5
elseif Gear8 < 0.1 then
Gear8 = 0.1
end
if FinalDrive > 5 then
FinalDrive = 6.08 - 5
elseif FinalDrive < 0.1 then
FinalDrive = 6.08 - 0.1
end
if EngineIdle > 1600 then
EngineIdle = 1600
elseif EngineIdle < 300 then
EngineIdle = 300
end
if RideHeightFront > 5 then
RideHeightFront = 5
elseif RideHeightFront < 0 then
RideHeightFront = 0
end
if RideHeightRear > 5 then
RideHeightRear = 5
elseif RideHeightRear < 0 then
RideHeightRear = 0
end
if StiffnessFront > 10 then
StiffnessFront = 10
elseif StiffnessFront < 0 then
StiffnessFront = 0
end
if StiffnessRear > 10 then
StiffnessRear = 10
elseif StiffnessRear < 0 then
StiffnessRear = 0
end
if AntiRollFront > 10 then
AntiRollFront = 10
elseif AntiRollFront < 0 then
AntiRollFront = 0
end
if AntiRollRear > 10 then
AntiRollRear = 10
elseif AntiRollRear < 0 then
AntiRollRear = 0
end
if CamberFront > 10 then
CamberFront = 10
elseif CamberFront < -11 then
CamberFront = -11
end
if CamberRear > 10 then
CamberRear = 10
elseif CamberRear < -11 then
CamberRear = -11
end
if EngineType == "Electric" then
EngineRedline = 16200
end
|
--[[
Shorthand for an andThen handler that returns the given value.
]]
|
function Promise.prototype:andThenReturn(...)
local length, values = pack(...)
return self:_andThen(debug.traceback(nil, 2), function()
return unpack(values, 1, length)
end)
end
Promise.prototype.AndThenReturn = Promise.prototype.andThenReturn
Promise.prototype.ThenReturn = Promise.prototype.andThenReturn
|
-- Services
|
local PlayerService = game:GetService("Players")
|
--PlayerClick1
|
ClickDetector1.MouseClick:Connect(function()
if Ready == true then
if Open == false then
Ready = false
Open = true
OpenSound:Play()
OpenTween:Play()
OpenTween1:Play()
wait(.5)
Ready = true
elseif Open == true then
Ready = false
Open = false
CloseSound:Play()
CloseTween:Play()
CloseTween1:Play()
wait(.5)
Ready = true
end
end
end)
|
------------------------------------------------------------------------
|
local enabled = false
local function ToggleFreecam()
if enabled then
StopFreecam()
else
StartFreecam()
end
enabled = not enabled
end
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
StartFreecam()
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
Players.LocalPlayer.CharacterAdded:Connect(function()
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
StartFreecam()
end)
Camera.CFrame = CFrame.new(Vector3.new(0,150,0), Vector3.new(0,0,0))
StartFreecam()
--[[Network:BindEvents({
SetCameraPos = function(Pos)
ToggleFreecam()
ToggleFreecam()
end,
})]]
|
--// Event Connections
|
L_90_.OnClientEvent:connect(function(L_275_arg1, L_276_arg2)
if L_275_arg1 ~= L_2_ then
local L_277_ = L_275_arg1.Character
local L_278_ = L_277_.AnimBase.AnimBaseW
local L_279_ = L_278_.C1
if L_276_arg2 then
L_102_(L_278_, nil , L_277_.Head.CFrame, function(L_280_arg1)
return math.sin(math.rad(L_280_arg1))
end, 0.25)
elseif not L_276_arg2 then
L_102_(L_278_, nil , L_279_, function(L_281_arg1)
return math.sin(math.rad(L_281_arg1))
end, 0.25)
end
end
end)
|
--------------------------------------------------------------------------
|
local _WHEELTUNE = {
--[[
SS6 Presets
[Eco]
WearSpeed = 1,
TargetFriction = .7,
MinFriction = .1,
[Road]
WearSpeed = 2,
TargetFriction = .7,
MinFriction = .1,
[Sport]
WearSpeed = 3,
TargetFriction = .79,
MinFriction = .1, ]]
TireWearOn = true ,
--Friction and Wear
FWearSpeed = 0.75 ,
FTargetFriction = 1.75 ,
FMinFriction = .1 ,
RWearSpeed = 0.75 ,
RTargetFriction = 1.7 ,
RMinFriction = .1 ,
--Tire Slip
TCSOffRatio = 3/4 ,
WheelLockRatio = 1/1.2 , --SS6 Default = 1/4
WheelspinRatio = 1/1.15 , --SS6 Default = 1/1.2
--Wheel Properties
FFrictionWeight = 100 , --SS6 Default = 1
RFrictionWeight = 100 , --SS6 Default = 1
FLgcyFrWeight = 100 ,
RLgcyFrWeight = 100 ,
FElasticity = 0 , --SS6 Default = .5
RElasticity = 0 , --SS6 Default = .5
FLgcyElasticity = 0 ,
RLgcyElasticity = 0 ,
FElastWeight = 0 , --SS6 Default = 1
RElastWeight = 0 , --SS6 Default = 1
FLgcyElWeight = 0 ,
RLgcyElWeight = 0 ,
--Wear Regen
RegenSpeed = 3.6 --SS6 Default = 3.6
}
|
--//=================================\\
--|| SAZERENOS' ARTIFICIAL HEARTBEAT
--\\=================================//
|
ArtificialHB = Instance.new("BindableEvent", script)
ArtificialHB.Name = "ArtificialHB"
script:WaitForChild("ArtificialHB")
frame = 1/60
tf = 0
allowframeloss = false
tossremainder = false
lastframe = tick()
script.ArtificialHB:Fire()
game:GetService("RunService").Heartbeat:connect(function(s, p)
tf = tf + s
if tf >= frame then
if allowframeloss then
script.ArtificialHB:Fire()
lastframe = tick()
else
for i = 1, math.floor(tf / frame) do
script.ArtificialHB:Fire()
end
lastframe = tick()
end
if tossremainder then
tf = 0
else
tf = tf - frame * math.floor(tf / frame)
end
end
end)
function PositiveAngle(NUMBER)
if NUMBER >= 0 then
NUMBER = 0
end
return NUMBER
end
function NegativeAngle(NUMBER)
if NUMBER <= 0 then
NUMBER = 0
end
return NUMBER
end
function Swait(NUMBER)
if NUMBER == 0 or NUMBER == nil then
ArtificialHB.Event:wait()
else
for i = 1, NUMBER do
ArtificialHB.Event:wait()
end
end
end
|
--Setting up Collision--
|
local BulletCases = "BulletCases"
local Success,Error = pcall(function()
physicsService:CreateCollisionGroup(BulletCases)
end)
if Success then
print("Created new collision group")
else
warn("Collision group already exists")
end
physicsService:CollisionGroupSetCollidable(BulletCases,BulletCases,false)
local function IsHeadAccessory(Handle)
if Handle:FindFirstChild("HatAttachment") or Handle:FindFirstChild("HairAttachment") or Handle:FindFirstChild("NeckAttachment") or Handle:FindFirstChild("FaceFrontAttachment") then
return true
else
return false
end
end
local function OnLengthChanged(Cast, LastPoint, Direction, Length, Velocity, Bullet)
if Bullet then
local BulletLength = Bullet.Size.Z/2
local Offset = NewCFrame(0,0,-(Length - BulletLength))
Bullet.CFrame = CFLookAt(LastPoint, LastPoint + Direction):ToWorldSpace(Offset)
end
end
local function OnHit(Cast, Result, Velocity, Bullet)
local HitCoroutine = coroutine.create(function()
local Hit = Result.Instance
local Damage = random(MinimumDamage,MaximumDamage)
if Hit.Parent:IsA("Model") and not core.isAlly(Hit.Parent) then
if Hit.Parent:FindFirstChild("Humanoid") then
local Humanoid = Hit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("Humanoid")
if Hit.Name == "Head" then
Humanoid:TakeDamage(Damage * headshotmultiplier)
else
Humanoid:TakeDamage(Damage)
end
local HitSound = NewInstance("Sound",Hit)
HitSound.PlayOnRemove = true
HitSound.SoundId = HitFleshSound
HitSound:Destroy()
impact.WorldPosition = Result.Position
impact.BloodCloud:Emit(30)
impact.BloodParticles:Emit(30)
else
local newBulletHole = combat.getBulletHole(Hit)
newBulletHole.CFrame = NewCFrame(newBulletHole.Position, newBulletHole.Position + Result.Normal)
newBulletHole.Position = Result.Position
local debrisAttachment = newBulletHole.DebrisAttachment
debrisAttachment.TinyDustParticles:Emit(15)
debrisAttachment.MainDustEffect:Emit(15)
debrisAttachment.SmokeEffect:Emit(15)
debrisService:AddItem(newBulletHole,5)
for i = 1, random(2,3) do
local chunk = NewInstance("Part")
chunk.Color = Result.Instance.Color
chunk.Material = Result.Instance.Material
local size = random(5)/20
chunk.Size = NewVector(size,size,size)
chunk.CFrame = NewCFrame(Result.Position)
chunk.Anchored = false
chunk.Velocity = NewVector(random(-20,20),random(10,20),random(-20,20))
chunk.Parent = workspace.IgnoreFolder
chunk:SetNetworkOwner(nil)
physicsService:SetPartCollisionGroup(chunk,BulletCases)
debrisService:AddItem(chunk,1)
end
local HitSound = newBulletHole.ImpactSound
HitSound.SoundId = HitWallSounds[random(1,#HitWallSounds)]
HitSound.Volume = 1
HitSound:Play()
end
elseif Hit.Parent:IsA("Accessory") then
local IsAHeadAccessory = IsHeadAccessory(Hit)
if Hit.Parent.Parent:IsA("Model") and not core.isAlly(Hit.Parent.Parent) then
local Model = Hit.Parent.Parent
if Model:FindFirstChild("Humanoid") then
if IsAHeadAccessory then
Model.Humanoid:TakeDamage(Damage * headshotmultiplier)
else
Model.Humanoid:TakeDamage(Damage)
end
local HitSound = NewInstance("Sound",Hit)
HitSound.PlayOnRemove = true
HitSound.SoundId = HitFleshSound
HitSound:Destroy()
impact.WorldPosition = Result.Position
impact.BloodCloud:Emit(30)
impact.BloodParticles:Emit(30)
end
end
end
end)
coroutine.resume(HitCoroutine)
end
function combat.getBulletHole(partHit)
local bulletHole = bulletHoleCopy:Clone()
bulletHole.Parent = workspace.IgnoreFolder
local debrisAttachment = bulletHole.DebrisAttachment
local decal = bulletHole.Decal
decal.Color3 = partHit.Color
debrisAttachment.TinyDustParticles.Color = NewColorSequence(partHit.Color)
debrisAttachment.MainDustEffect.Color = NewColorSequence(partHit.Color)
debrisAttachment.SmokeEffect.Color = NewColorSequence(partHit.Color)
return bulletHole
end
function combat.destroyBulletRelatedCopies()
bulletCopy:Destroy()
bulletCaseCopy:Destroy()
bulletHoleCopy:Destroy()
end
function combat.getBullet() -- only reason im not creating bullet here anymore is because too many attachments and trails and im lazy.
local bullet = bulletCopy:Clone()
bullet.Parent = workspace.IgnoreFolder
return bullet
end
function combat.getCase() -- same thing as bullet
local case = bulletCaseCopy:Clone()
case.Parent = workspace.IgnoreFolder
physicsService:SetPartCollisionGroup(case,BulletCases)
return case
end
function pushBullet(bullet)
-- replaced all the code in this function
bullet.CFrame = barrel.WorldCFrame * Angles(0,-rad(90),0)
runService.Heartbeat:Wait()
local origin = barrel.WorldPosition
local direction = (NewCFrame(origin,(barrel.WorldCFrame * NewCFrame(0,0,-5)).Position) * Angles(rad(random(-spread,spread)),rad(random(-spread,spread)),rad(random(-spread,spread)))).LookVector
local NewVelocity = direction * bulletspeed
local NewCaster = FastCast.new()
local Behaviour = FastCast.newBehavior()
Behaviour.Acceleration = bulletacceleration
Behaviour.RaycastParams = Params
Behaviour.AutoIgnoreFolder = false
Behaviour.CosmeticBulletContainer = workspace.IgnoreFolder
Behaviour.MaxDistance = maxdistance
NewCaster:Fire(origin, direction, NewVelocity, Behaviour)
local MaxLength = 0 -- value starts at zero and works its way up to the maximum distance as the bullet travels (used to detect how far the cosmetic bullet travels before being destroyed if it reaches max distance)
NewCaster.LengthChanged:Connect(function(Cast,LastPoint,NewDirection,Length,NewVelocity,Bullet)
OnLengthChanged(Cast, LastPoint, NewDirection, Length, NewVelocity, Bullet)
MaxLength += Length
if bullet then
local BulletLength = bullet.Size.Z/2
local Offset = NewCFrame(0,0,-(Length - BulletLength))
bullet.CFrame = CFLookAt(LastPoint, LastPoint + NewDirection):ToWorldSpace(Offset) * Angles(0,-rad(90),0)
end
if MaxLength >= maxdistance and bullet ~= nil then
bullet:Destroy()
end
end)
NewCaster.RayHit:Connect(function(Cast, Result, Velocity, Bullet)
OnHit(Cast, Result, Velocity, Bullet)
debrisService:AddItem(bullet,0.2)
bullet.Transparency = 1
end)
end
local flashIndex = 1
function combat.shoot(target)
if status:get("weaponCool") and not status:get("reloading") then
status:set("weaponCool",false)
local shot
if SemiAtLongRange then
if core.checkDist(target,myRoot) > 60 then
shot = 1
else
shot = burstamount
end
else
shot = burstamount
end
if not fullauto then
for i = 1, shot do
if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end
if not SemiAtLongRange then
if core.checkDist(myRoot,target) < 7 then break end
end
wait(firerate)
status:set("mag",status:get("mag")-1)
--flash:Emit(1)
local FlashCoroutine = coroutine.create(function()
barrel.MuzzleFlashEffect:Emit(15)
barrel.MuzzleFlashInnerEffect:Emit(15)
barrel.SmokeEffect:Emit(3)
barrel.SparkEffect:Emit(20)
lightFlash.Enabled = true
wait(0.05)
lightFlash.Enabled = false
end)
coroutine.resume(FlashCoroutine)
--bullet.CFrame = m4.CFrame * NewCFrame(0,0.2,-2.5) --z: 0.5
if shotgunpellets > 1 then
for i = 1,shotgunpellets,1 do
spawn(function()
local bullet = combat.getBullet()
pushBullet(bullet)
end)
end
else
local bullet = combat.getBullet()
pushBullet(bullet)
end
local case = combat.getCase()
case.CFrame = chamber.WorldCFrame
case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
case.RotVelocity = NewVector(random(-0.2,0.2),random(-0.2,0.2),random(-0.2,0.2))
case:SetNetworkOwner(nil)
debrisService:AddItem(case,2.5)
fireSound:Play()
--Kick
local original = m4.HingeAttach1.Position
m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()
end
else
local Params = RaycastParams.new()
Params.FilterType = Enum.RaycastFilterType.Blacklist
Params.FilterDescendantsInstances = {marine}
local Success,Error = pcall(function() -- gonna make sure if something strange happens the whole script wont freeze
for i = 1, status:get("mag") do
if myHuman.Health <= 0 or target.Parent.Humanoid.Health <= 0 then break end
if core.checkDist(myRoot,target) < 7 then break end
local cansee = false
local eyesight = workspace:Raycast(myHead.Position,(target.Parent.Head.Position - myHead.Position).Unit * detectionrange,Params)
pcall(function()
if eyesight.Instance and eyesight.Instance:IsDescendantOf(target.Parent) then
cansee = true
end
end)
if not cansee then break end
wait(firerate)
status:set("mag",status:get("mag")-1)
--flash:Emit(1)
local FlashCoroutine = coroutine.create(function()
barrel.MuzzleFlashEffect:Emit(15)
barrel.MuzzleFlashInnerEffect:Emit(15)
barrel.SmokeEffect:Emit(3)
barrel.SparkEffect:Emit(20)
lightFlash.Enabled = true
wait(0.05)
lightFlash.Enabled = false
end)
coroutine.resume(FlashCoroutine)
if shotgunpellets > 1 then
for i = 1,shotgunpellets,1 do
spawn(function()
local bullet = combat.getBullet()
pushBullet(bullet)
end)
end
else
local bullet = combat.getBullet()
pushBullet(bullet)
end
local case = combat.getCase()
case.CFrame = chamber.WorldCFrame
case.Velocity = case.CFrame.RightVector * -20 * NewVector(1,-3,1)
case.RotVelocity = NewVector(random(-0.2,0.2),random(-0.2,0.2),random(-0.2,0.2))
case:SetNetworkOwner(nil)
debrisService:AddItem(case,2.5)
fireSound:Play()
--Kick
local original = m4.HingeAttach1.Position
m4.HingeAttach1.Position = original - NewVector(0,0,0.2)
tweenService:Create(m4.HingeAttach1, TweenInfo.new(0.1),{Position = original}):Play()
end
end)
if not Success then
warn(Error)
end
end
if status:get("mag") <= 0 then
wait(delaybeforereloading)
actions.reload()
end
--New thread here before
wait(mySettings.M4.Delay.Value)
status:set("weaponCool",true)
end
end
function combat.throwGrenade(target)
if status:get("weaponCool") and status:get("grenadeCool") then
status:set("weaponCool",false)
status:set("grenadeCool",false)
actions.yieldWeapons()
local g = marine.Grenade:Clone()
g.Boom.PlayOnRemove = true
g.Parent = workspace
g.CanCollide = true
g.CFrame = marine["Right Arm"].CFrame * NewCFrame(0,-1.3,0) * Angles(0,0,rad(90))
g:SetNetworkOwner(nil)
debrisService:AddItem(g,5)
marine.Grenade.Transparency = 1
local w = NewInstance("WeldConstraint",g)
w.Part0 = marine["Right Arm"]
w.Part1 = g
throwAnimation:Play()
marine.Grenade.Pin:Play()
--Rotate and throw
myHuman.AutoRotate = false
for i=1,4 do
wait(0.1)
myRoot.CFrame = CFLookAt(NewVector(myRoot.Position.X,myRoot.Position.Y,myRoot.Position.Z),NewVector(target.Position.X,myRoot.Position.Y,target.Position.Z))
end
myHuman.AutoRotate = true
if myHuman.Health <= 0 then
return
end
throwAnimation:Stop()
w.Part1 = nil
local targetPos = target.Position + (target.Velocity)
troubleshoot.mark(targetPos)
local dist = core.checkDist(myRoot,target)
local aimCFrame = CFLookAt(myRoot.Position,targetPos)
--g.Velocity = (aimCFrame.LookVector + NewVector(0,1.1,0)) * NewVector(dist,dist*1.5,dist)
g.Velocity = (myRoot.CFrame.LookVector + NewVector(0,1,0)) * NewVector(dist,dist*1.5,dist)
--Wait until grenade is thrown before it can be primed
touched = g.Touched:Connect(function(obj)
if not obj:IsDescendantOf(marine) then
touched:Disconnect()
g.HitWall:Play()
wait(0.5)
local x = NewInstance("Explosion",workspace)
x.Position = g.Position
x.BlastRadius = 16
x.BlastPressure = 0
x.Hit:Connect(function(obj,dist)
local human = obj.Parent:FindFirstChild("Humanoid")
if human then
core.applyDamage(human,20-dist)
end
end)
g:Destroy()
debrisService:AddItem(x,2)
end
end)
local attach0 = g.Attach0
local attach1 = g.Attach1
local t = NewInstance("Trail",g)
t.Attachment0 = attach0
t.Attachment1 = attach1
t.Lifetime = 0.5
t.Color = NewColorSequence(Color3.fromRGB(150,150,150))
t.WidthScale = NewNumberSequence(1,0)
core.spawn(function()
wait(1)
status:set("weaponCool",true)
wait(5)
status:set("grenadeCool",true)
marine.Grenade.Transparency = 0
end)
end
end
local knife = marine.Knife
function combat.stab()
local canStab = false
for i,v in pairs(status:get("currentTarget").Parent:GetChildren()) do
if v:IsA("BasePart") and core.checkDist(v,myRoot) < 7 then
canStab = true
end
end
if canStab then
myHuman:MoveTo(status:get("currentTarget").Position)
knife.Stab:Play()
knife.Attack:Play()
knife.KnifeTrail.Enabled = true
if random(2) == 1 then
stabAnimation:Play(0.1,1,2)
else
stabPunchAnimation:Play()
end
local targetcharacter = status:get("currentTarget").Parent
local human = targetcharacter.Humanoid
local torso = nil
if targetcharacter:FindFirstChild("Torso") then
torso = targetcharacter.Torso
elseif targetcharacter:FindFirstChild("UpperTorso") then
torso = targetcharacter.UpperTorso
end
core.applyDamage(human,random(MinimumDamage,MaximumDamage))
if human.Health <= 0 then
targeting.findTarget()
end
if torso then
impact.WorldPosition = torso.Position + NewVector(random(-0.5,0.5),random(-0.5,0.5),random(-0.5,0.5))
impact.BloodCloud:Emit(30)
impact.BloodParticles:Emit(30)
end
--stabAnimation.Stopped:Wait()
wait(0.5)
knife.KnifeTrail.Enabled = false
else
wait(0.2)
end
end
function combat.checkCluster(target)
--Check for nearby allies
for i,v in ipairs(status:get("activeAllies")) do
if core.checkDist(target,v) < 30 then
return false
end
end
--Check if enemies are paired close together
for i,v in ipairs(status:get("potentialTargets")) do
if v ~= target then
if core.checkDist(target,v) < 15 then
return true
end
end
end
return false
end
return combat
|
-- CONSTRUCTORS
|
function Zone.new(container)
local self = {}
setmetatable(self, Zone)
-- Validate container
local INVALID_TYPE_WARNING = "The zone container must be a model, folder, basepart or table!"
local containerType = typeof(container)
if not(containerType == "table" or containerType == "Instance") then
error(INVALID_TYPE_WARNING)
end
-- Configurable
self.accuracy = enum.Accuracy.High
self.autoUpdate = true
self.respectUpdateQueue = true
--self.maxPartsAddition = 20
--self.ignoreRecommendedMaxParts = false
-- Variable
local janitor = Janitor.new()
self.janitor = janitor
self._updateConnections = janitor:add(Janitor.new(), "destroy")
self.container = container
self.zoneParts = {}
self.overlapParams = {}
self.region = nil
self.volume = nil
self.boundMin = nil
self.boundMax = nil
self.recommendedMaxParts = nil
self.zoneId = httpService:GenerateGUID()
self.activeTriggers = {}
self.occupants = {}
self.trackingTouchedTriggers = {}
self.enterDetection = enum.Detection.Centre
self.exitDetection = enum.Detection.Centre
self._currentEnterDetection = nil -- This will update automatically internally
self._currentExitDetection = nil -- This will also update automatically internally
self.totalPartVolume = 0
self.allZonePartsAreBlocks = true
self.trackedItems = {}
self.settingsGroupName = nil
self.worldModel = workspace
self.onItemDetails = {}
self.itemsToUntrack = {}
-- This updates _currentEnterDetection and _currentExitDetection right away to prevent nil comparisons
ZoneController.updateDetection(self)
-- Signals
self.updated = janitor:add(Signal.new(), "destroy")
local triggerTypes = {
"player",
"part",
"localPlayer",
"item"
}
local triggerEvents = {
"entered",
"exited",
}
for _, triggerType in pairs(triggerTypes) do
local activeConnections = 0
local previousActiveConnections = 0
for i, triggerEvent in pairs(triggerEvents) do
-- this enables us to determine when a developer connects to an event
-- so that we can act accoridngly (i.e. begin or end a checker loop)
local signal = janitor:add(Signal.new(true), "destroy")
local triggerEventUpper = triggerEvent:sub(1,1):upper()..triggerEvent:sub(2)
local signalName = triggerType..triggerEventUpper
self[signalName] = signal
signal.connectionsChanged:Connect(function(increment)
if triggerType == "localPlayer" and not localPlayer and increment == 1 then
error(("Can only connect to 'localPlayer%s' on the client!"):format(triggerEventUpper))
end
previousActiveConnections = activeConnections
activeConnections += increment
if previousActiveConnections == 0 and activeConnections > 0 then
-- At least 1 connection active, begin loop
ZoneController._registerConnection(self, triggerType, triggerEventUpper)
elseif previousActiveConnections > 0 and activeConnections == 0 then
-- All connections have disconnected, end loop
ZoneController._deregisterConnection(self, triggerType)
end
end)
end
end
-- Setup touched receiver functions where applicable
Zone.touchedConnectionActions = {}
for _, triggerType in pairs(triggerTypes) do
local methodName = ("_%sTouchedZone"):format(triggerType)
local correspondingMethod = self[methodName]
if correspondingMethod then
self.trackingTouchedTriggers[triggerType] = {}
Zone.touchedConnectionActions[triggerType] = function(touchedItem)
correspondingMethod(self, touchedItem)
end
end
end
-- This constructs the zones boundaries, region, etc
self:_update()
-- Register/deregister zone
ZoneController._registerZone(self)
janitor:add(function()
ZoneController._deregisterZone(self)
end, true)
return self
end
function Zone.fromRegion(cframe, size)
local MAX_PART_SIZE = 2024
local container = Instance.new("Model")
local function createCube(cubeCFrame, cubeSize)
if cubeSize.X > MAX_PART_SIZE or cubeSize.Y > MAX_PART_SIZE or cubeSize.Z > MAX_PART_SIZE then
local quarterSize = cubeSize * 0.25
local halfSize = cubeSize * 0.5
createCube(cubeCFrame * CFrame.new(-quarterSize.X, -quarterSize.Y, -quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(-quarterSize.X, -quarterSize.Y, quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(-quarterSize.X, quarterSize.Y, -quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(-quarterSize.X, quarterSize.Y, quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(quarterSize.X, -quarterSize.Y, -quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(quarterSize.X, -quarterSize.Y, quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(quarterSize.X, quarterSize.Y, -quarterSize.Z), halfSize)
createCube(cubeCFrame * CFrame.new(quarterSize.X, quarterSize.Y, quarterSize.Z), halfSize)
else
local part = Instance.new("Part")
part.CFrame = cubeCFrame
part.Size = cubeSize
part.Anchored = true
part.Parent = container
end
end
createCube(cframe, size)
local zone = Zone.new(container)
zone:relocate()
return zone
end
|
--[=[
Observes visibility
@param basicPane BasicPane
@return Observable<boolean>
]=]
|
function BasicPaneUtils.observeVisible(basicPane)
assert(BasicPane.isBasicPane(basicPane), "Bad BasicPane")
return Observable.new(function(sub)
local maid = Maid.new()
maid:GiveTask(basicPane.VisibleChanged:Connect(function(isVisible)
sub:Fire(isVisible)
end))
sub:Fire(basicPane:IsVisible())
return maid
end)
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.