prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- reporters
|
local Src = script.Parent
local ReporterGoogleAnalytics = require(Src.Reporters.GoogleAnalytics)
local ReporterPlayFab = require(Src.Reporters.PlayFab)
|
----- Private functions -----
|
local function WaitForLiveAccessCheck() -- This function was created to prevent the ProfileService module yielding execution when required
while IsLiveCheckActive == true do
Madwork.HeartbeatWait()
end
end
local function WaitForPendingProfileStore(profile_store)
while profile_store._is_pending == true do
Madwork.HeartbeatWait()
end
end
local function RegisterIssue(error_message, profile_store_name, profile_key) -- Called when a DataStore API call errors
warn("[ProfileService]: DataStore API error (Store:\"" .. profile_store_name .. "\";Key:\"" .. profile_key .. "\") - \"" .. tostring(error_message) .. "\"")
table.insert(IssueQueue, os.clock()) -- Adding issue time to queue
ProfileService.IssueSignal:Fire(tostring(error_message), profile_store_name, profile_key)
end
local function RegisterCorruption(profile_store_name, profile_key) -- Called when a corrupted profile is loaded
warn("[ProfileService]: Profile corruption - ProfileStore = \"" .. profile_store_name .. "\", Key = \"" .. profile_key .. "\"")
ProfileService.CorruptionSignal:Fire(profile_store_name, profile_key)
end
local function MockUpdateAsync(mock_data_store, profile_store_name, key, transform_function)
local profile_store = mock_data_store[profile_store_name]
if profile_store == nil then
profile_store = {}
mock_data_store[profile_store_name] = profile_store
end
local transform = transform_function(profile_store[key])
if transform == nil then
return nil
else
profile_store[key] = DeepCopyTable(transform)
return DeepCopyTable(profile_store[key])
end
end
local function IsThisSession(session_tag)
return session_tag[1] == PlaceId and session_tag[2] == JobId
end
|
--[[
Exposes an interface to set global configuration values for Roact.
Configuration can only occur once, and should only be done by an application
using Roact, not a library.
Any keys that aren't recognized will cause errors. Configuration is only
intended for configuring Roact itself, not extensions or libraries.
Configuration is expected to be set immediately after loading Roact. Setting
configuration values after an application starts may produce unpredictable
behavior.
]]
| |
--[=[
@private
@class ScriptInfoUtils
]=]
|
local CollectionService = game:GetService("CollectionService")
local loader = script.Parent
local Utils = require(script.Parent.Utils)
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local ScriptInfoUtils = {}
ScriptInfoUtils.DEPENDENCY_FOLDER_NAME = "node_modules";
ScriptInfoUtils.ModuleReplicationTypes = Utils.readonly({
CLIENT = "client";
SERVER = "server";
SHARED = "shared";
IGNORE = "ignore";
PLUGIN = "plugin";
})
function ScriptInfoUtils.createScriptInfo(instance, name, replicationMode)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(name) == "string", "Bad name")
assert(type(replicationMode) == "string", "Bad replicationMode")
return Utils.readonly({
name = name;
replicationMode = replicationMode;
instance = instance;
})
end
function ScriptInfoUtils.createScriptInfoLookup()
-- Server/client also contain shared entries
return Utils.readonly({
[ScriptInfoUtils.ModuleReplicationTypes.SERVER] = {}; -- [string name] = scriptInfo
[ScriptInfoUtils.ModuleReplicationTypes.CLIENT] = {};
[ScriptInfoUtils.ModuleReplicationTypes.SHARED] = {};
[ScriptInfoUtils.ModuleReplicationTypes.PLUGIN] = {};
})
end
function ScriptInfoUtils.getScriptInfoLookupForMode(scriptInfoLookup, replicationMode)
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(replicationMode) == "string", "Bad replicationMode")
return scriptInfoLookup[replicationMode]
end
function ScriptInfoUtils.populateScriptInfoLookup(instance, scriptInfoLookup, lastReplicationMode)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(lastReplicationMode) == "string", "Bad lastReplicationMode")
if instance:IsA("Folder") then
local replicationMode = ScriptInfoUtils.getFolderReplicationMode(instance.Name, lastReplicationMode)
if replicationMode ~= ScriptInfoUtils.ModuleReplicationTypes.IGNORE then
for _, item in pairs(instance:GetChildren()) do
if not BounceTemplateUtils.isBounceTemplate(item) then
if item:IsA("Folder") then
ScriptInfoUtils.populateScriptInfoLookup(item, scriptInfoLookup, replicationMode)
elseif item:IsA("ModuleScript") then
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(item, item.Name, replicationMode))
end
end
end
end
elseif instance:IsA("ModuleScript") then
if not BounceTemplateUtils.isBounceTemplate(instance) then
if instance == loader then
-- STRICT hack to support this module script as "loader" over "Nevermore" in replicated scenario
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(instance, "loader", lastReplicationMode))
else
ScriptInfoUtils.addToInfoMap(scriptInfoLookup,
ScriptInfoUtils.createScriptInfo(instance, instance.Name, lastReplicationMode))
end
end
elseif instance:IsA("ObjectValue") then
error("ObjectValue links are not supported at this time for retrieving inline module scripts")
end
end
local AVAILABLE_IN_SHARED = {
["HoldingBindersServer"] = true;
["HoldingBindersClient"] = true;
["IKService"] = true;
["IKServiceClient"] = true;
}
function ScriptInfoUtils.isAvailableInShared(scriptInfo)
if CollectionService:HasTag(scriptInfo.instance, "LinkToShared") then
return true
end
-- Hack because we can't tag things in Rojo yet
return AVAILABLE_IN_SHARED[scriptInfo.name]
end
function ScriptInfoUtils.addToInfoMap(scriptInfoLookup, scriptInfo)
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(scriptInfo) == "table", "Bad scriptInfo")
local replicationMode = assert(scriptInfo.replicationMode, "Bad replicationMode")
local replicationMap = assert(scriptInfoLookup[replicationMode], "Bad replicationMode")
ScriptInfoUtils.addToInfoMapForMode(replicationMap, scriptInfo)
if replicationMode == ScriptInfoUtils.ModuleReplicationTypes.SHARED then
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.SERVER], scriptInfo)
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.CLIENT], scriptInfo)
elseif ScriptInfoUtils.isAvailableInShared(scriptInfo) then
ScriptInfoUtils.addToInfoMapForMode(
scriptInfoLookup[ScriptInfoUtils.ModuleReplicationTypes.SHARED], scriptInfo)
end
end
function ScriptInfoUtils.addToInfoMapForMode(replicationMap, scriptInfo)
if replicationMap[scriptInfo.name] then
warn(("Duplicate module %q in same package under same replication scope. Only using first one. \n- %q\n- %q")
:format(scriptInfo.name,
scriptInfo.instance:GetFullName(),
replicationMap[scriptInfo.name].instance:GetFullName()))
return
end
replicationMap[scriptInfo.name] = scriptInfo
end
function ScriptInfoUtils.getFolderReplicationMode(folderName, lastReplicationMode)
assert(type(folderName) == "string", "Bad folderName")
assert(type(lastReplicationMode) == "string", "Bad lastReplicationMode")
--Plugin always replicates further
if folderName == ScriptInfoUtils.DEPENDENCY_FOLDER_NAME then
return ScriptInfoUtils.ModuleReplicationTypes.IGNORE
elseif lastReplicationMode == ScriptInfoUtils.ModuleReplicationTypes.PLUGIN then
return lastReplicationMode
elseif folderName == "Shared" then
return ScriptInfoUtils.ModuleReplicationTypes.SHARED
elseif folderName == "Client" then
return ScriptInfoUtils.ModuleReplicationTypes.CLIENT
elseif folderName == "Server" then
return ScriptInfoUtils.ModuleReplicationTypes.SERVER
else
return lastReplicationMode
end
end
return ScriptInfoUtils
|
--[[
DEVELOPMENT HAS BEEN MOVED FROM DAVEY_BONES/SCELERATIS TO THE EPIX INCORPORATED GROUP
CURRENT LOADER:
https://www.roblox.com/library/7510622625/Adonis-Loader-Sceleratis-Davey-Bones-Epix
CURRENT MODULE:
https://www.roblox.com/library/7510592873/Adonis-MainModule
--]]
| |
--[[
Fired when Finished is entered, throwing out a player state update, as well as transitioning the player state
]]
|
function Transitions.onEnterFinished(stateMachine, event, from, to, playerComponent)
Logger.trace(playerComponent.player.Name, " state change: ", from, " -> ", to)
playerComponent:updateStatus("currentState", to)
PlayerFinished.enter(stateMachine, playerComponent)
end
|
-- delete the line above me if you already made this script's parent visible = false
|
uis = game:GetService("UserInputService") -- this line gets the service
ismobile = uis.TouchEnabled -- this line checks if the user is on mobile
script.Parent.Visible = ismobile -- this line makes the script's parent visible on mobile user screen
|
--[[
LOWGames Studios
Date: 27 October 2022
by Elder
]]
|
--
local u1 = nil;
coroutine.wrap(function()
u1 = require(game.ReplicatedStorage:WaitForChild("Framework"):WaitForChild("Library"));
end)();
return function(p1, p2)
for v1, v2 in pairs(p1) do
if v2 == p2 then
return v1;
end;
end;
end;
|
-----------------------------------
|
elseif script.Parent.Parent.Parent.TrafficControl.Value == "=" then
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.3)
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.35)
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.35)
script.Parent.Parent.A.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.B.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.C.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.D.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.E.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.F.BrickColor = BrickColor.new("New Yeller")
script.Parent.Parent.G.BrickColor = BrickColor.new("New Yeller")
wait(0.35)
script.Parent.Parent.A.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.B.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.C.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.D.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.E.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.F.BrickColor = BrickColor.new("Medium stone grey")
script.Parent.Parent.G.BrickColor = BrickColor.new("Medium stone grey")
wait(0.35)
end
end
|
-- Modules
|
Utils = require(SharedModules:WaitForChild("Utilities"))
|
-- add a leaderboard to the game
|
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = game.Players.LocalPlayer
|
--[[
Constructs a new ForKeys state object which maps keys of an array using
a `processor` function.
Optionally, a `destructor` function can be specified for cleaning up
calculated keys. If omitted, the default cleanup function will be used instead.
Optionally, a `meta` value can be returned in the processor function as the
second value to pass data from the processor to the destructor.
]]
|
local Dependencies = require(script.Parent.Parent.Dependencies)
local utility = Dependencies.utility
local class = {}
local CLASS_METATABLE = { __index = class }
|
-- << VARIABLES >>
|
local humanoidDescriptions = {}
local accessoryTypes = {
[8] = "HatAccessory",
[41] = "HairAccessory",
[42] = "FaceAccessory",
[43] = "NeckAccessory",
[44] = "ShouldersAccessory",
[45] = "FrontAccessory",
[46] = "BackAccessory",
[47] = "WaistAccessory",
}
local correspondingBodyParts = {
["Torso"] = {"UpperTorso","LowerTorso"};
["Left Arm"] = {"LeftHand","LeftLowerArm","LeftUpperArm"};
["Right Arm"] = {"RightHand","RightLowerArm","RightUpperArm"};
["Left Leg"] = {"LeftFoot","LeftLowerLeg","LeftUpperLeg"};
["Right Leg"] = {"RightFoot","RightLowerLeg","RightUpperLeg"};
}
|
--EEwwwwww gross
|
print("Made By OfficerVargas And FPSVision")
seat = script.Parent
s = script
|
-- Editable Values
|
local TurboId = 240323039
local SuperId = 404779487
local BovId = 3568930062
local TurboVol = .025 --Per Psi
local TurboRollOffMax = 1000
local TurboRollOffMin = 10
local SuperVol = .025 --Per Psi
local SuperRollOffMax = 1000
local SuperRollOffMin = 10
local BovVol = .025 --Per Psi
local BovRollOffMax = 1000
local BovRollOffMin = 10
local BovSensitivity = .5
local TurboSetPitch = 1 --Base Pitch
local SuperSetPitch = .8 --Base Pitch
local BovSetPitch = .7 --Base Pitch
local TurboPitchIncrease = .05 --Per Psi
local SuperPitchIncrease = .05 --Per Psi
local BovPitchIncrease = .05 --Per Psi
local FE=true
|
-- create beam
|
local beam = Instance.new("Beam")
beam.Segments = 1
beam.Width0 = 0.2
beam.Width1 = 0.2
beam.Color = ColorSequence.new(Color3.new(1, 0, 0))
beam.FaceCamera = true
|
--[=[
Nevermore loader utility library
@private
@class GroupInfoUtils
]=]
|
local Utils = require(script.Parent.Utils)
local Queue = require(script.Parent.Queue)
local LoaderConstants = require(script.Parent.LoaderConstants)
local GroupInfoUtils = {}
function GroupInfoUtils.createGroupInfo()
return Utils.readonly({
scriptInfoMap = {}; -- [name] = scriptInfo (required link packages)
packageScriptInfoMap = {};
packageSet = {}; -- [packageInfo] = true (actually included packages)
})
end
function GroupInfoUtils.groupPackageInfos(packageInfoList, replicationMode)
assert(type(packageInfoList) == "table", "Bad packageInfoList")
assert(type(replicationMode) == "string", "Bad replicationMode")
local queue = Queue.new()
local seen = {}
for _, packageInfo in pairs(packageInfoList) do
if not seen[packageInfo] then
seen[packageInfo] = true
queue:PushRight(packageInfo)
end
end
local built = {}
local current = GroupInfoUtils.createGroupInfo()
while not queue:IsEmpty() do
local packageInfo = queue:PopLeft()
if GroupInfoUtils.hasAnythingToReplicate(packageInfo, replicationMode) then
if GroupInfoUtils.canAddPackageInfoToGroup(current, packageInfo, replicationMode) then
GroupInfoUtils.addPackageInfoToGroup(current, packageInfo, replicationMode)
if LoaderConstants.GROUP_EACH_PACKAGE_INDIVIDUALLY then
table.insert(built, current)
current = GroupInfoUtils.createGroupInfo()
end
elseif LoaderConstants.ALLOW_MULTIPLE_GROUPS then
-- Create a new group
table.insert(built, current)
current = GroupInfoUtils.createGroupInfo()
GroupInfoUtils.addPackageInfoToGroup(current, packageInfo, replicationMode)
else
-- Force generate error
GroupInfoUtils.addPackageInfoToGroup(current, packageInfo, replicationMode)
error("Cannot add package to group")
end
end
for dependentPackageInfo, _ in pairs(packageInfo.dependencySet) do
if not seen[dependentPackageInfo] then
seen[dependentPackageInfo] = true
queue:PushRight(dependentPackageInfo)
end
end
end
if next(current.packageSet) then
table.insert(built, current)
end
return built
end
function GroupInfoUtils.hasAnythingToReplicate(packageInfo, replicationMode)
return next(packageInfo.scriptInfoLookup[replicationMode]) ~= nil
end
function GroupInfoUtils.canAddScriptInfoToGroup(groupInfo, scriptInfo, scriptName, tempScriptInfoMap)
assert(type(groupInfo) == "table", "Bad groupInfo")
assert(type(scriptInfo) == "table", "Bad scriptInfo")
assert(type(scriptName) == "string", "Bad scriptName")
assert(type(tempScriptInfoMap) == "table", "Bad tempScriptInfoMap")
local wouldHaveInfo = tempScriptInfoMap[scriptName]
if wouldHaveInfo and wouldHaveInfo ~= scriptInfo then
return false
end
local currentScriptInfo = groupInfo.scriptInfoMap[scriptName]
if currentScriptInfo and currentScriptInfo ~= scriptInfo then
return false
end
return true
end
function GroupInfoUtils.canAddPackageInfoToGroup(groupInfo, packageInfo, replicationMode)
assert(type(groupInfo) == "table", "Bad groupInfo")
assert(type(packageInfo) == "table", "Bad packageInfo")
assert(type(replicationMode) == "string", "Bad replicationMode")
local tempScriptInfoMap = {}
-- Existing scripts must be added
for scriptName, scriptInfo in pairs(packageInfo.scriptInfoLookup[replicationMode]) do
if GroupInfoUtils.canAddScriptInfoToGroup(groupInfo, scriptInfo, scriptName, tempScriptInfoMap) then
tempScriptInfoMap[scriptName] = scriptInfo
else
return false
end
end
-- Dependencies are expected at parent level
for dependencyPackageInfo, _ in pairs(packageInfo.dependencySet) do
if not groupInfo.packageSet[dependencyPackageInfo] then
-- Lookup dependencies and try to merge them
-- O(p*d*s)
for scriptName, scriptInfo in pairs(dependencyPackageInfo.scriptInfoLookup[replicationMode]) do
if GroupInfoUtils.canAddScriptInfoToGroup(groupInfo, scriptInfo, scriptName, tempScriptInfoMap) then
tempScriptInfoMap[scriptName] = scriptInfo
else
return false
end
end
end
end
return true
end
function GroupInfoUtils.addScriptToGroup(groupInfo, scriptName, scriptInfo)
assert(type(groupInfo) == "table", "Bad groupInfo")
assert(type(scriptInfo) == "table", "Bad scriptInfo")
assert(type(scriptName) == "string", "Bad scriptName")
local currentScriptInfo = groupInfo.scriptInfoMap[scriptName]
if currentScriptInfo and currentScriptInfo ~= scriptInfo then
error(("Cannot add to package group, conflicting scriptInfo for %q already there")
:format(scriptName))
end
groupInfo.scriptInfoMap[scriptName] = scriptInfo
end
function GroupInfoUtils.addPackageInfoToGroup(groupInfo, packageInfo, replicationMode)
groupInfo.packageSet[packageInfo] = true
-- Existing scripts must be added
for scriptName, scriptInfo in pairs(packageInfo.scriptInfoLookup[replicationMode]) do
GroupInfoUtils.addScriptToGroup(groupInfo, scriptName, scriptInfo)
groupInfo.packageScriptInfoMap[scriptName] = scriptInfo
end
-- Dependencies are expected at parent level
for dependencyPackageInfo, _ in pairs(packageInfo.dependencySet) do
if not groupInfo.packageSet[dependencyPackageInfo] then
-- Lookup dependencies and try to merge them
-- O(p*d*s)
for scriptName, scriptInfo in pairs(dependencyPackageInfo.scriptInfoLookup[replicationMode]) do
GroupInfoUtils.addScriptToGroup(groupInfo, scriptName, scriptInfo)
end
end
end
end
return GroupInfoUtils
|
-- Force attachment
|
EjectionForce.ForcePoint = Vector3.new(
0,0,0
)
return EjectionForce
|
-- OTHER VARIABLES --
|
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")
|
--Simple Control System, Developed by PixleStuff
--V. 1.0.0
| |
--if false then
-- local i, v = 1, 2
-- local Item = Items[i]
-- local NewItem = script.Parent.Gear.ItemsScrollingFrame.ItemTemplate1:Clone()
-- NewItem.Parent = script.Parent.Gear.ItemsScrollingFrame
-- NewItem.Visible = true
-- NewItem.Name = v.Name
-- NewItem.Price.Text = v.Price
-- NewItem.Icon.Image = v.Decal
-- NewItem.ItemName.Text = v.Name
-- NewItem.Buy.MouseButton1Click:Connect(function()
-- local f = script.Parent.Gear.Item
-- f.ItemName.Text = NewItem.Name
-- f.ItemImage.Image = v.Decal
-- f.Description.Text = v.Special
-- f.Add.MouseButton1Click:Connect(function()
-- table.insert(Cart,Item)
-- end)
-- end)
--end
| |
-- connect to RenderStepped (update every frame)
|
RunService.RenderStepped:Connect(function()
-- make sure the character exists
local character = localPlayer.Character
if not character then
-- disable the beam
beam.Enabled = false
return
end
-- make sure the head exists
local head = character:FindFirstChild("Head")
if not head then
-- disable the beam
beam.Enabled = false
return
end
-- enable the beam
beam.Enabled = true
-- define origin and finish
local origin = head.Position
local finish = mouse.Hit.p
-- move the attachments
attachment0.Position = origin
attachment1.Position = finish
end)
|
--[[
Expand a node by setting its callback environment and then calling it. Any
further it and describe calls within the callback will be added to the tree.
]]
|
function TestNode:expand()
local originalEnv = getfenv(self.callback)
local callbackEnv = setmetatable({}, { __index = originalEnv })
for key, value in pairs(self.environment) do
callbackEnv[key] = value
end
setfenv(self.callback, callbackEnv)
local success, result = xpcall(self.callback, debug.traceback)
if not success then
self.loadError = result
end
end
local TestPlan = {}
TestPlan.__index = TestPlan
|
--[[**
Returns a t.union of each key in the table as a t.literal
@param keyTable The table to get keys from
@returns True iff the condition is satisfied, false otherwise
**--]]
|
function t.keyOf(keyTable)
local keys = {}
local length = 0
for key in pairs(keyTable) do
length = length + 1
keys[length] = key
end
return t.literal(table.unpack(keys, 1, length))
end
|
--local Array = require(LuauPolyfill.Array)
|
local isArray = require(LuauPolyfill.Array.isArray)
local arrayFromString = require(LuauPolyfill.Array.from.fromString)
local arrayForEach = require(LuauPolyfill.Array.forEach)
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
type Object = types.Object
type setCallbackFn<T> = types.setCallbackFn<T>
type setCallbackFnWithThisArg<T> = types.setCallbackFnWithThisArg<T>
type Set<T> = types.Set<T>
local inspect = require(LuauPolyfill.util.inspect)
type Set_Statics = {
new: <T>(iterable: Array<T> | Set<T> | string | nil) -> Set<T>,
}
local Set: Set<any> & Set_Statics = (
{
__iter = function(self)
return next, self._array
end,
__tostring = function(self)
local result = "Set "
if #self._array > 0 then
result ..= "(" .. tostring(#self._array) .. ") "
end
result ..= inspect(self._array)
return result
end,
} :: any
) :: Set<any> & Set_Statics;
(Set :: any).__index = Set
function Set.new<T>(iterable: Array<T> | Set<T> | string | nil): Set<T>
local array
local map = {}
if iterable ~= nil then
local arrayIterable
if typeof(iterable) == "table" then
if isArray(iterable) then
arrayIterable = table.clone(iterable)
else
local mt = getmetatable(iterable :: any)
if mt and rawget(mt, "__iter") then
arrayIterable = iterable :: Set<T>
elseif _G.__DEV__ then
error("cannot create array from an object-like table")
end
end
elseif typeof(iterable) == "string" then
-- TODO Luau: need overloads for `from` to avoid needing the manual cast
arrayIterable = arrayFromString(iterable :: string) :: Array<string>
else
error(("cannot create array from value of type `%s`"):format(typeof(iterable)))
end
if arrayIterable then
array = table.create(#arrayIterable)
for _, element in arrayIterable do
if not map[element] then
map[element] = true
table.insert(array, element)
end
end
else
array = {}
end
else
array = {}
end
return (setmetatable({
size = #array,
_map = map,
_array = array,
}, Set) :: any) :: Set<T>
end
function Set:add(value)
if not self._map[value] then
-- Luau FIXME: analyze should know self is Set<T> which includes size as a number
self.size = self.size :: number + 1
self._map[value] = true
table.insert(self._array, value)
end
return self
end
function Set:clear()
self.size = 0
table.clear(self._map)
table.clear(self._array)
end
function Set:delete(value): boolean
if not self._map[value] then
return false
end
-- Luau FIXME: analyze should know self is Map<K, V> which includes size as a number
self.size = self.size :: number - 1
self._map[value] = nil
local index = table.find(self._array, value)
if index then
table.remove(self._array, index)
end
return true
end
|
-- functions
|
function onDied()
stopLoopedSounds()
end
local fallCount = 0
local fallSpeed = 0
function onStateFall(state, sound)
fallCount = fallCount + 1
if state then
sound.Volume = 0
sound:Play()
Spawn( function()
local t = 0
local thisFall = fallCount
while t < 1.5 and fallCount == thisFall do
local vol = math.max(t - 0.3 , 0)
sound.Volume = vol
wait(0.1)
t = t + 0.1
end
end)
else
sound:Stop()
end
fallSpeed = math.max(fallSpeed, math.abs(Head.Velocity.Y))
end
function onStateNoStop(state, sound)
if state then
sound:Play()
end
end
function onRunning(speed)
sClimbing:Stop()
sSwimming:Stop()
if (prevState == "FreeFall" and fallSpeed > 0.1) then
local vol = math.min(1.0, math.max(0.0, (fallSpeed - 50) / 110))
sLanding.Volume = vol
sLanding:Play()
fallSpeed = 0
end
if speed>0.5 then
sRunning:Play()
sRunning.Pitch = speed / 8.0
else
sRunning:Stop()
end
prevState = "Run"
end
function onSwimming(speed)
if (prevState ~= "Swim" and speed > 0.1) then
local volume = math.min(1.0, speed / 350)
sSplash.Volume = volume
sSplash:Play()
prevState = "Swim"
end
sClimbing:Stop()
sRunning:Stop()
sSwimming.Pitch = 1.6
sSwimming:Play()
end
function onClimbing(speed)
sRunning:Stop()
sSwimming:Stop()
if speed>0.01 then
sClimbing:Play()
sClimbing.Pitch = speed / 5.5
else
sClimbing:Stop()
end
prevState = "Climb"
end
|
-- Note: Overrides base class GetIsJumping with get-and-clear behavior to do a single jump
-- rather than sustained jumping. This is only to preserve the current behavior through the refactor.
|
function DynamicThumbstick:GetIsJumping()
local wasJumping = self.isJumping
self.isJumping = false
return wasJumping
end
function DynamicThumbstick:EnableAutoJump(enable) -- Remove on FFlagUserDTDoesNotForceAutoJump
if FFlagUserDTDoesNotForceAutoJump then
return
end
local humanoid = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
if humanoid then
if enable then
self.shouldRevertAutoJumpOnDisable = (humanoid.AutoJumpEnabled == false) and (LocalPlayer.DevTouchMovementMode == Enum.DevTouchMovementMode.UserChoice)
humanoid.AutoJumpEnabled = true
elseif self.shouldRevertAutoJumpOnDisable then
humanoid.AutoJumpEnabled = false
end
end
end
function DynamicThumbstick:Enable(enable, uiParentFrame)
if enable == nil then return false end -- If nil, return false (invalid argument)
enable = enable and true or false -- Force anything non-nil to boolean before comparison
if self.enabled == enable then return true end -- If no state change, return true indicating already in requested state
if enable then
-- Enable
if not self.thumbstickFrame then
self:Create(uiParentFrame)
end
self:BindContextActions()
if not FFlagUserDTDoesNotTrackTools then
if LocalPlayer.Character then
self:OnCharacterAdded(LocalPlayer.Character)
else
LocalPlayer.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char)
end)
end
end
else
ContextActionService:UnbindAction(DYNAMIC_THUMBSTICK_ACTION_NAME)
-- Disable
self:OnInputEnded() -- Cleanup
end
self.enabled = enable
self.thumbstickFrame.Visible = enable
end
function DynamicThumbstick:OnCharacterAdded(char) -- Remove on FFlagUserDTDoesNotTrackTools
assert(not FFlagUserDTDoesNotTrackTools)
for _, child in ipairs(char:GetChildren()) do
if child:IsA("Tool") then
self.toolEquipped = child
end
end
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") then
self.toolEquipped = child
elseif child:IsA("Humanoid") then
self:EnableAutoJump(true) -- Remove on FFlagUserDTDoesNotForceAutoJump
end
end)
char.ChildRemoved:Connect(function(child)
if child == self.toolEquipped then
self.toolEquipped = nil
end
end)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
if self.humanoid then
self:EnableAutoJump(true) -- Remove on FFlagUserDTDoesNotForceAutoJump
end
end
|
---------END RIGHT DOOR
|
game.Workspace.backdoorleft.p1.CFrame = game.Workspace.backdoorleft.p1.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p2.CFrame = game.Workspace.backdoorleft.p2.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p3.CFrame = game.Workspace.backdoorleft.p3.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p4.CFrame = game.Workspace.backdoorleft.p4.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p5.CFrame = game.Workspace.backdoorleft.p5.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p6.CFrame = game.Workspace.backdoorleft.p6.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p7.CFrame = game.Workspace.backdoorleft.p7.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p8.CFrame = game.Workspace.backdoorleft.p8.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p9.CFrame = game.Workspace.backdoorleft.p9.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p10.CFrame = game.Workspace.backdoorleft.p10.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p11.CFrame = game.Workspace.backdoorleft.p11.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p12.CFrame = game.Workspace.backdoorleft.p12.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p13.CFrame = game.Workspace.backdoorleft.p13.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p14.CFrame = game.Workspace.backdoorleft.p14.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p15.CFrame = game.Workspace.backdoorleft.p15.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p16.CFrame = game.Workspace.backdoorleft.p16.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p17.CFrame = game.Workspace.backdoorleft.p17.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p18.CFrame = game.Workspace.backdoorleft.p18.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p19.CFrame = game.Workspace.backdoorleft.p19.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
game.Workspace.backdoorleft.p20.CFrame = game.Workspace.backdoorleft.p20.CFrame * CFrame.new(0.5, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0, 0)
|
--Made by Stickmasterluke
|
local sp=script.Parent
local tauntcooldown=10
local originalgrip=CFrame.Angles(math.pi/2,0,0)+Vector3.new(0,-.25,-1.4)
local currentgrip=originalgrip
local debris=game:GetService("Debris")
local enabled=true
local taunting=false
local lasttaunt=0
function waitfor(parent,name)
while true do
local child=parent:FindFirstChild(name)
if child~=nil then
return child
end
wait()
end
end
waitfor(sp,"Handle")
function onButton1Down(mouse)
if not enabled then
return
end
enabled=false
mouse.Icon="rbxasset://textures\\GunWaitCursor.png"
wait(.75)
mouse.Icon="rbxasset://textures\\GunCursor.png"
enabled=true
end
function swordUp()
currentgrip=originalgrip
end
function swordOut()
currentgrip=originalgrip*CFrame.Angles(math.pi/4,.4,0)
end
function spinsword(spintime)
delay(0,function()
local startspin=tick()
local endspin=startspin+spintime
while tick()<endspin do
sp.Grip=currentgrip*CFrame.Angles(math.pi*2*((tick()-startspin)/spintime),0,0)
wait()
end
sp.Grip=currentgrip
end)
end
sp.Equipped:connect(function(mouse)
equipped=true
local currentlast=lastequipped
if mouse==nil then
print("Mouse not found")
return
end
mouse.Icon="rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function()
onButton1Down(mouse)
end)
waitfor(sp,"Taunting")
waitfor(sp,"Taunt")
--[[waitfor(sp,"Summon")
mouse.KeyDown:connect(function(key)
key=string.lower(key)
if key=="l" or key=="t" or key=="g" or key=="e" then
local h=sp.Parent:FindFirstChild("Humanoid")
if h~=nil and (not sp.Taunting.Value) and lasttaunt+tauntcooldown<tick() then
lasttaunt=tick()
sp.Taunting.Value=true
h.WalkSpeed=0
tauntanim=h:LoadAnimation(sp.Taunt)
tauntanim:Play()
wait(4)
sp.Summon.Value=not sp.Summon.Value
wait(1)
h.WalkSpeed=16
sp.Taunting.Value=false
end
end
end)
--]]
end)
sp.Unequipped:connect(function()
equipped=false
end)
waitfor(sp,"RunAnim")
sp.RunAnim.Changed:connect(function()
local h=sp.Parent:FindFirstChild("Humanoid")
local t=sp.Parent:FindFirstChild("Torso")
local anim=sp:FindFirstChild(sp.RunAnim.Value)
if anim and t and h then
theanim=h:LoadAnimation(anim)
if theanim and h.Health>0 then
theanim:Play()
if sp.RunAnim.Value=="RightSlash" or sp.RunAnim.Value=="LeftSlash" or sp.RunAnim.Value=="OverHeadSwing" then
spinsword(.5)
end
if sp.RunAnim.Value=="OverHeadSwing" then
wait(.25)
swordOut()
wait(.5)
swordUp()
sp.Grip=currentgrip
elseif sp.RunAnim.Value=="OverHeadSwingFast" then
wait(.125)
swordOut()
wait(.25)
swordUp()
sp.Grip=currentgrip
end
end
end
end)
function tagHumanoid(humanoid,player)
for i,v in ipairs(humanoid:GetChildren()) do
if v.Name=="creator" then
v:remove()
end
end
local creator_tag=Instance.new("ObjectValue")
creator_tag.Value=player
creator_tag.Name="creator"
creator_tag.Parent=humanoid
debris:AddItem(creator_tag,1)
end
|
--Made by Repressed_Memories
-- Edited by Truenus
|
local component = script.Parent.Parent
local car = script.Parent.Parent.Parent.Parent.Car.Value
local mouse = game.Players.LocalPlayer:GetMouse()
local leftsignal = "z"
local rightsignal = "c"
local hazards = "x"
local hazardson = false
local lefton = false
local righton = false
local leftlight = car.Body.Lights.Left.TurnSignal.TSL
local rightlight = car.Body.Lights.Right.TurnSignal.TSL
local leftfront = car.Body.Lights.Left.TurnSignal
local rightfront = car.Body.Lights.Right.TurnSignal
local signalblinktime = 0.32
local neonleft = car.Body.Lights.Left.TurnSignal2
local neonright = car.Body.Lights.Right.TurnSignal2
local off = BrickColor.New("Mid ray")
local on = BrickColor.New("New Yeller")
mouse.KeyDown:connect(function(lkey)
local key = string.lower(lkey)
if key == leftsignal then
if lefton == false then
lefton = true
repeat
neonleft.BrickColor = on
leftlight.Enabled = true
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonleft.BrickColor = off
component.TurnSignal:play()
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
leftlight.Enabled = false
wait(signalblinktime)
until
lefton == false or righton == true
elseif lefton == true or righton == true then
lefton = false
component.TurnSignal:stop()
leftlight.Enabled = false
end
elseif key == rightsignal then
if righton == false then
righton = true
repeat
neonright.BrickColor = on
rightlight.Enabled = true
neonright.Material = "Neon"
rightfront.Material = "Neon"
component.TurnSignal:play()
wait(signalblinktime)
neonright.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
rightlight.Enabled = false
wait(signalblinktime)
until
righton == false or lefton == true
elseif righton == true or lefton == true then
righton = false
component.TurnSignal:stop()
rightlight.Enabled = false
end
elseif key == hazards then
if hazardson == false then
hazardson = true
repeat
neonright.BrickColor = on
neonleft.BrickColor = on
neonright.Material = "Neon"
rightfront.Material = "Neon"
neonleft.Material = "Neon"
leftfront.Material = "Neon"
component.TurnSignal:play()
rightlight.Enabled = true
leftlight.Enabled = true
wait(signalblinktime)
neonright.BrickColor = off
neonleft.BrickColor = off
component.TurnSignal:play()
neonright.Material = "SmoothPlastic"
rightfront.Material = "SmoothPlastic"
neonleft.Material = "SmoothPlastic"
leftfront.Material = "SmoothPlastic"
rightlight.Enabled = false
leftlight.Enabled = false
wait(signalblinktime)
until
hazardson == false
elseif hazardson == true then
hazardson = false
component.TurnSignal:stop()
rightlight.Enabled = false
leftlight.Enabled = false
end
end
end)
|
--[=[
Returns an array of all enum items.
@return {EnumItem}
@since v2.0.0
]=]
|
function EnumList:GetEnumItems()
return self[LIST_KEY]
end
|
--Services--
|
local MS = game:GetService("MarketplaceService")
local P = game:GetService("Players")
|
-------------------------------------------------------------------
-----------------------[MEDSYSTEM]---------------------------------
-------------------------------------------------------------------
|
Evt.Ombro.OnServerEvent:Connect(function(Player,Vitima)
local Nombre
for SKP_001, SKP_002 in pairs(game.Players:GetChildren()) do
if SKP_002:IsA('Player') and SKP_002 ~= Player and SKP_002.Name == Vitima then
if SKP_002.Team == Player.Team then
Nombre = Player.Name
else
Nombre = "Someone"
end
Evt.Ombro:FireClient(SKP_002,Nombre)
end
end
end)
Evt.Target.OnServerEvent:Connect(function(Player,Vitima)
Player.Character.Saude.Variaveis.PlayerSelecionado.Value = Vitima
end)
Evt.Render.OnServerEvent:Connect(function(Player,Status,Vitima)
if Vitima == "N/A" then
Player.Character.Saude.Stances.Rendido.Value = Status
else
local VitimaTop = game.Players:FindFirstChild(Vitima)
if VitimaTop.Character.Saude.Stances.Algemado.Value == false then
VitimaTop.Character.Saude.Stances.Rendido.Value = Status
VitimaTop.Character.Saude.Variaveis.HitCount.Value = 0
end
end
end)
Evt.Drag.OnServerEvent:Connect(function(player)
local Human = player.Character.Humanoid
local enabled = Human.Parent.Saude.Variaveis.Doer
local MLs = Human.Parent.Saude.Variaveis.MLs
local Caido = Human.Parent.Saude.Stances.Caido
local Item = Human.Parent.Saude.Kit.Epinefrina
local target = Human.Parent.Saude.Variaveis.PlayerSelecionado
if Caido.Value == false and target.Value ~= "N/A" then
local player2 = game.Players:FindFirstChild(target.Value)
local PlHuman = player2.Character.Humanoid
local Sangrando = PlHuman.Parent.Saude.Stances.Sangrando
local MLs = PlHuman.Parent.Saude.Variaveis.MLs
local Dor = PlHuman.Parent.Saude.Variaveis.Dor
local Ferido = PlHuman.Parent.Saude.Stances.Ferido
local PlCaido = PlHuman.Parent.Saude.Stances.Caido
local Sang = PlHuman.Parent.Saude.Variaveis.Sangue
if enabled.Value == false then
if PlCaido.Value == true or PlCaido.Parent.Algemado.Value == true then
enabled.Value = true
coroutine.wrap(function()
while target.Value ~= "N/A" and PlCaido.Value == true and PlHuman.Health > 0 and Human.Health > 0 and Human.Parent.Saude.Stances.Caido.Value == false or target.Value ~= "N/A" and PlCaido.Parent.Algemado.Value == true do wait() pcall(function()
player2.Character.Torso.Anchored ,player2.Character.Torso.CFrame = true,Human.Parent.Torso.CFrame*CFrame.new(0,0.75,1.5)*CFrame.Angles(math.rad(0), math.rad(0), math.rad(90))
enabled.Value = true
end) end
pcall(function() player2.Character.Torso.Anchored=false
enabled.Value = false
end)
end)()
enabled.Value = false
end
end
end
end)
Evt.Squad.OnServerEvent:Connect(function(Player,SquadName,SquadColor)
Player.Character.Saude.FireTeam.SquadName.Value = SquadName
Player.Character.Saude.FireTeam.SquadColor.Value = SquadColor
end)
Evt.Afogar.OnServerEvent:Connect(function(Player)
Player.Character.Humanoid.Health = 0
end)
|
--Cboehme
|
function onclick()
script.Parent.ImageTransparency = 0.1
wait(.05)
script.Parent.ImageTransparency = 0
end
script.Parent.MouseButton1Click:connect(onclick)
|
--Button size
|
local ButtonSX = Button.Size.X.Scale
local ButtonSY = Button.Size.Y.Scale
Button.MouseEnter:Connect(function(x,y)
--HolaMousee
Button:TweenSize(
UDim2.new(ButtonSX + 0.021 , 0,ButtonSY + 0.018, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseLeave:Connect(function(x,y)
--AdiosMousee
Button:TweenSize(
UDim2.new(ButtonSX, 0,ButtonSY, 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.2,
true
)
end)
Button.MouseButton1Down:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX - 0.021 , 0,ButtonSY - 0.018 , 0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
Button.MouseButton1Up:Connect(function(x,y)
--Holding mouse
Button:TweenSize(
UDim2.new(ButtonSX + 0.021,0, ButtonSY + 0.018,0),
Enum.EasingDirection.Out,
Enum.EasingStyle.Back,
0.15,
true
)
end)
|
-- Set the callback; this can only be done once by one script on the server!
|
MarketplaceService.ProcessReceipt = processReceipt
|
-- 28-36
|
module.Subcategory.Bundles = 37
module.Subcategory.AnimationBundles = 38
module.Subcategory.EmoteAnimations = 39
module.Subcategory.CommunityCreations = 40
module.Subcategory.Melee = 41
module.Subcategory.Ranged = 42
module.Subcategory.Explosive = 43
module.Subcategory.PowerUp = 44
module.Subcategory.Navigation = 45
module.Subcategory.Musical = 46
module.Subcategory.Social = 47
module.Subcategory.Building = 48
module.Subcategory.Transport = 49
module.AssetType = {}
module.AssetType.None = 0
module.AssetType["T-Shirt"] = 2
module.AssetType.Hat = 8
module.AssetType.Shirt = 11
module.AssetType.Pants = 12
module.AssetType.Head = 17
module.AssetType.Face = 18
module.AssetType.Gear = 19
module.AssetType.Arms = 25
module.AssetType.Legs = 26
module.AssetType.Torso = 27
module.AssetType.RightArm = 28
module.AssetType.LeftArm = 29
module.AssetType.LeftLeg = 30
module.AssetType.RightLeg = 31
module.AssetType.HairAccessory = 41
module.AssetType.FaceAccessory = 42
module.AssetType.NeckAccessory = 43
module.AssetType.ShoulderAccessory = 44
module.AssetType.FrontAccessory = 45
module.AssetType.BackAccessory = 46
module.AssetType.WaistAccessory = 47
module.AssetType.ClimbAnimation = 48
module.AssetType.DeathAnimation = 49
module.AssetType.FallAnimation = 50
module.AssetType.IdleAnimation = 51
module.AssetType.JumpAnimation = 52
module.AssetType.RunAnimation = 53
module.AssetType.SwimAnimation = 54
module.AssetType.WalkAnimation = 55
module.AssetType.PoseAnimation = 56
module.AssetType.EmoteAnimation = 61
function module.GetOptionName(section, value)
for k, v in pairs(module[section]) do
if v == value then
return k
end
end
end
return module
|
--
-- Adapted from
-- Tweener's easing functions (Penner's Easing Equations)
-- and http://code.google.com/p/tweener/ (jstweener javascript version)
-- https://easings.net/ for visuals
| |
--[[Transmission]]
|
Tune.TransModes = {"Auto","Semi"} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "Speed" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
Tune.ShiftTime = .3 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 4.5 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.70 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 3.53 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 2.04 ,
--[[ 3 ]] 1.38 ,
--[[ 4 ]] 1.03 ,
--[[ 5 ]] 0.81 ,
--[[ 6 ]] 0.64 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
------------------------------------------------------------------------
-- decodes a 4-char little-endian string into an instruction struct
------------------------------------------------------------------------
|
function luaP:DecodeInst(x)
local byte = string.byte
local i = {}
local I = byte(x, 1)
local op = I % 64
i.OP = op
I = byte(x, 2) * 4 + (I - op) / 64 -- 2 bits of c0 left
local a = I % 256
i.A = a
I = byte(x, 3) * 4 + (I - a) / 256 -- 2 bits of c1 left
local c = I % 512
i.C = c
i.B = byte(x, 4) * 2 + (I - c) / 512 -- 1 bits of c2 left
local opmode = self.OpMode[tonumber(string.sub(self.opmodes[op + 1], 7, 7))]
if opmode ~= "iABC" then
i.Bx = i.B * 512 + i.C
end
return i
end
|
-- ROBLOX deviation: omitting prettyFormat import
|
local function serialize(val: string): string
-- Return the string itself, not escaped nor enclosed in double quote marks.
local ansiLookupTable = {
[chalk.inverse.open] = "<i>",
[chalk.inverse.close] = "</i>",
[chalk.bold.open] = "<b>",
[chalk.dim.open] = "<d>",
[chalk.green.open] = "<g>",
[chalk.red.open] = "<r>",
[chalk.yellow.open] = "<y>",
[chalk.bgYellow.open] = "<Y>",
[chalk.bold.close] = "</>",
[chalk.dim.close] = "</>",
[chalk.green.close] = "</>",
[chalk.red.close] = "</>",
[chalk.yellow.close] = "</>",
[chalk.bgYellow.close] = "</>",
}
return val:gsub(ansiRegex, function(match)
if ansiLookupTable[match] then
return ansiLookupTable[match]
else
return match
end
end)
end
local function test(val: any)
return typeof(val) == "string"
end
return {
serialize = serialize,
test = test,
}
|
---------------------------------------Function end here.
|
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
--Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit
if (check()) then
fire(lookAt)
wait(0.0003)
onActivated()
end
return
--Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- Gradually regenerates the Humanoid's Health over time.
|
local REGEN_RATE = .25/100 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = .25 -- Wait this long between each regeneration step.
|
--[=[
Observables are like an [signal](/api/Signal), except they do not execute code
until the observable is subscribed to. This follows the standard
Rx API surface for an observable.
Observables use a [Subscription](/api/Subscription) to emit values.
```lua
-- Constucts an observable which will emit a, b, c via a subscription
local observable = Observable.new(function(sub)
print("Connected")
sub:Fire("a")
sub:Fire("b")
sub:Fire("c")
sub:Complete() -- ends stream
end)
local sub1 = observable:Subscribe() --> Connected
local sub2 = observable:Subscribe() --> Connected
local sub3 = observable:Subscribe() --> Connected
sub1:Destroy()
sub2:Destroy()
sub3:Destroy()
```
Note that emitted values may be observed like this
```lua
observable:Subscribe(function(value)
print("Got ", value)
end)
--> Got a
--> Got b
--> Got c
```
Note that also, observables return a [MaidTask](/api/MaidTask) which
should be used to clean up the resulting subscription.
```lua
maid:GiveTask(observable:Subscribe(function(value)
-- do work here!
end))
```
Observables over signals are nice because observables may be chained and manipulated
via the Pipe operation.
:::tip
You should always clean up the subscription using a [Maid](/api/Maid), otherwise
you may memory leak.
:::
@class Observable
]=]
|
local require = require(script.Parent.loader).load(script)
local Subscription = require("Subscription")
local ENABLE_STACK_TRACING = false
local Observable = {}
Observable.ClassName = "Observable"
Observable.__index = Observable
|
--local doubleJumpMod = require(extraMods.DoubleJump)
|
local chestDisplayMod = require(extraMods.Chest.ChestDisplay)
local safeZoneMod = require(UIMods.SafeZone.SafeZoneMod)
local petMoveClient = require(modules.Pet.PetClientMovement)
local petClientMod = require(modules.Pet.PetClient)
local classBoostDisplay = require(UIMods.WeaponShop.ClassBoostDisplay)
local skillShopMod = require(UIMods.SkillsShop.SkillsShopHandler)
local settingsMod = require(UIMods.Settings.SettingsHandler)
local islandsMod = require(modules.Zones.ZoneUpdate)
local bossRewardsDisplayMod = require(extraMods.BossRewardDisplay)
local sellClientMod = require(UIMods.Sell.SellClient)
local statsUIMod = require(UIMods.Stats.StatsUIMod)
local indexUIMod = require(UIMods.Index.IndexUIMod)
local hoopClient = require(extraMods.HoopClient)
local dmgTextMod = require(extraMods.DamageText)
local colorChangeMod = require(extraMods.ColorChange)
local boostClientMod = require(UIMods.Boosts.BoostClient)
local shirtBuyMod = require(extraMods.Shirts.ShirtBuying)
local gemBoostMod = require(UIMods.Boosts.GemBoosts)
local mainUIMod = require(UIMods.UIMain)
petClientMod:Int(plr)
mainUIMod:Int()
deviceMod:Int(plr)
chestDisplayMod:Int()
boostClientMod:Int(plr)
displayStatsMod:Int(plr)
rotateObectsMod:Int()
showStatsMod:Int()
codeUIMod:Int()
weaponShop:Int(plr)
eggClientMod:Int(plr)
safeZoneMod:Int(plr)
settingsMod:Int(plr)
skillShopMod:Int(plr)
petMoveClient:Int(plr)
shirtBuyMod:Int(plr)
classBoostDisplay:Int(plr)
bossRewardsDisplayMod:Int(plr)
sellClientMod:Int(plr)
indexUIMod:Int(plr)
hoopClient:Int(plr)
dmgTextMod:Int()
rShopMod:Int(plr)
colorChangeMod:Int()
gemBoostMod:Int(plr)
islandsMod:Int(plr)
statsUIMod:Int(plr)
|
--[[
Notes:
Transparency Modifier is what is the end result when "zooming in", it can be changed to whatever you like.
Camera Offset is changed to allow the player to see at lower angles without clipping the view with the torso.
This may or maynot effect certian tools if they change the players camera position IE crouching or crawling.
Use:
Place into StarterPlayer.StarterChacterScripts
--]]
|
local character = (game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:wait())
game:GetService("RunService").RenderStepped:connect(function()
if (character:FindFirstChild("RightUpperArm") and character:FindFirstChild("LeftUpperArm")) then
character:FindFirstChild("RightUpperArm").LocalTransparencyModifier = 0
character:FindFirstChild("LeftUpperArm").LocalTransparencyModifier = 0
character:FindFirstChild("RightLowerArm").LocalTransparencyModifier = 0
character:FindFirstChild("LeftLowerArm").LocalTransparencyModifier = 0
character:FindFirstChild("RightHand").LocalTransparencyModifier = 0
character:FindFirstChild("LeftHand").LocalTransparencyModifier = 0
character:FindFirstChild("RightUpperLeg").LocalTransparencyModifier = 0
character:FindFirstChild("LeftUpperLeg").LocalTransparencyModifier = 0
character:FindFirstChild("RightLowerLeg").LocalTransparencyModifier = 0
character:FindFirstChild("LeftLowerLeg").LocalTransparencyModifier = 0
character:FindFirstChild("RightFoot").LocalTransparencyModifier = 0
character:FindFirstChild("LeftFoot").LocalTransparencyModifier = 0
--character:FindFirstChild("Humanoid").CameraOffset = Vector3.new(0,0,-1)
end
end)
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:CreateGuiObjects(targetParent)
self.ChatBarParentFrame = targetParent
local backgroundImagePixelOffset = 7
local textBoxPixelOffset = 5
local BaseFrame = Instance.new("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 1, 0)
BaseFrame.BackgroundTransparency = 0.6
BaseFrame.BorderSizePixel = 0
BaseFrame.BackgroundColor3 = ChatSettings.ChatBarBackGroundColor
BaseFrame.Parent = targetParent
local BoxFrame = Instance.new("Frame")
BoxFrame.Selectable = false
BoxFrame.Name = "BoxFrame"
BoxFrame.BackgroundTransparency = 0.6
BoxFrame.BorderSizePixel = 0
BoxFrame.BackgroundColor3 = ChatSettings.ChatBarBoxColor
BoxFrame.Size = UDim2.new(1, -backgroundImagePixelOffset * 2, 1, -backgroundImagePixelOffset * 2)
BoxFrame.Position = UDim2.new(0, backgroundImagePixelOffset, 0, backgroundImagePixelOffset)
BoxFrame.Parent = BaseFrame
local TextBoxHolderFrame = Instance.new("Frame")
TextBoxHolderFrame.BackgroundTransparency = 1
TextBoxHolderFrame.Size = UDim2.new(1, -textBoxPixelOffset * 2, 1, -textBoxPixelOffset * 2)
TextBoxHolderFrame.Position = UDim2.new(0, textBoxPixelOffset, 0, textBoxPixelOffset)
TextBoxHolderFrame.Parent = BoxFrame
local TextBox = Instance.new("TextBox")
TextBox.Selectable = ChatSettings.GamepadNavigationEnabled
TextBox.Name = "ChatBar"
TextBox.BackgroundTransparency = 1
TextBox.Size = UDim2.new(1, 0, 1, 0)
TextBox.Position = UDim2.new(0, 0, 0, 0)
TextBox.TextSize = ChatSettings.ChatBarTextSize
TextBox.Font = ChatSettings.ChatBarFont
TextBox.TextColor3 = ChatSettings.ChatBarTextColor
TextBox.TextTransparency = 0.4
TextBox.TextStrokeTransparency = 1
TextBox.ClearTextOnFocus = false
TextBox.TextXAlignment = Enum.TextXAlignment.Left
TextBox.TextYAlignment = Enum.TextYAlignment.Top
TextBox.TextWrapped = true
TextBox.Text = ""
TextBox.Parent = TextBoxHolderFrame
local MessageModeTextButton = Instance.new("TextButton")
MessageModeTextButton.Selectable = false
MessageModeTextButton.Name = "MessageMode"
MessageModeTextButton.BackgroundTransparency = 1
MessageModeTextButton.Position = UDim2.new(0, 0, 0, 0)
MessageModeTextButton.TextSize = ChatSettings.ChatBarTextSize
MessageModeTextButton.Font = ChatSettings.ChatBarFont
MessageModeTextButton.TextXAlignment = Enum.TextXAlignment.Left
MessageModeTextButton.TextWrapped = true
MessageModeTextButton.Text = ""
MessageModeTextButton.Size = UDim2.new(0, 0, 0, 0)
MessageModeTextButton.TextYAlignment = Enum.TextYAlignment.Center
MessageModeTextButton.TextColor3 = self:GetDefaultChannelNameColor()
MessageModeTextButton.Visible = true
MessageModeTextButton.Parent = TextBoxHolderFrame
local TextLabel = Instance.new("TextLabel")
TextLabel.Selectable = false
TextLabel.TextWrapped = true
TextLabel.BackgroundTransparency = 1
TextLabel.Size = TextBox.Size
TextLabel.Position = TextBox.Position
TextLabel.TextSize = TextBox.TextSize
TextLabel.Font = TextBox.Font
TextLabel.TextColor3 = TextBox.TextColor3
TextLabel.TextTransparency = TextBox.TextTransparency
TextLabel.TextStrokeTransparency = TextBox.TextStrokeTransparency
TextLabel.TextXAlignment = TextBox.TextXAlignment
TextLabel.TextYAlignment = TextBox.TextYAlignment
TextLabel.Text = "This value needs to be set with :SetTextLabelText()"
TextLabel.Parent = TextBoxHolderFrame
self.GuiObject = BaseFrame
self.TextBox = TextBox
self.TextLabel = TextLabel
self.GuiObjects.BaseFrame = BaseFrame
self.GuiObjects.TextBoxFrame = BoxFrame
self.GuiObjects.TextBox = TextBox
self.GuiObjects.TextLabel = TextLabel
self.GuiObjects.MessageModeTextButton = MessageModeTextButton
self:AnimGuiObjects()
self:SetUpTextBoxEvents(TextBox, TextLabel, MessageModeTextButton)
if self.UserHasChatOff then
self:DoLockChatBar()
end
self.eGuiObjectsChanged:Fire()
end
|
--local Torso = Figure:WaitForChild("Torso")
--local RightShoulder = Torso:WaitForChild("Right Shoulder")
--local LeftShoulder = Torso:WaitForChild("Left Shoulder")
--local RightHip = Torso:WaitForChild("Right Hip")
--local LeftHip = Torso:WaitForChild("Left Hip")
--local Neck = Torso:WaitForChild("Neck")
|
local Humanoid = Figure:WaitForChild("Humanoid")
local pose = "Standing"
local EMOTE_TRANSITION_TIME = 0.1
local userAnimateScaleRunSuccess, userAnimateScaleRunValue = pcall(function() return UserSettings():IsUserFeatureEnabled("UserAnimateScaleRun") end)
local userAnimateScaleRun = userAnimateScaleRunSuccess and userAnimateScaleRunValue
local function getRigScale()
if userAnimateScaleRun then
return Figure:GetScale()
else
return 1
end
end
local currentAnim = ""
local currentAnimInstance = nil
local currentAnimTrack = nil
local currentAnimKeyframeHandler = nil
local currentAnimSpeed = 1.0
local animTable = {}
local animNames = {
idle = {
{ id = "http://www.roblox.com/asset/?id=180435571", weight = 9 },
{ id = "http://www.roblox.com/asset/?id=180435792", weight = 1 }
},
walk = {
{ id = "http://www.roblox.com/asset/?id=180426354", weight = 10 }
},
run = {
{ id = "run.xml", weight = 10 }
},
jump = {
{ id = "http://www.roblox.com/asset/?id=125750702", weight = 10 }
},
fall = {
{ id = "http://www.roblox.com/asset/?id=180436148", weight = 10 }
},
climb = {
{ id = "http://www.roblox.com/asset/?id=180436334", weight = 10 }
},
sit = {
{ id = "http://www.roblox.com/asset/?id=178130996", weight = 10 }
},
toolnone = {
{ id = "http://www.roblox.com/asset/?id=182393478", weight = 10 }
},
toolslash = {
{ id = "http://www.roblox.com/asset/?id=129967390", weight = 10 }
|
-- BrailleGen 3D BETA
|
Align = true
This = script.Parent
Btn = This.Parent
Lift = Btn.Parent.Parent.Parent
Config = require(Lift.CustomLabel)
Characters = require(script.Characters)
CustomLabel = Config["CUSTOMFLOORLABEL"][tonumber(Btn.Name)]
function ChangeFloor(SF)
if Align == true then
if string.len(SF) == 1 then
SetLabel(1,SF,0.045)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0.03)
SetLabel(2,SF:sub(2,2),0.03)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0.015)
SetLabel(2,SF:sub(2,2),0.015)
SetLabel(3,SF:sub(3,3),0.015)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
else
if string.len(SF) == 1 then
SetLabel(1,SF,0)
SetLabel(2,"NIL",0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 2 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,"NIL",0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 3 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,"NIL",0)
elseif string.len(SF) == 4 then
SetLabel(1,SF:sub(1,1),0)
SetLabel(2,SF:sub(2,2),0)
SetLabel(3,SF:sub(3,3),0)
SetLabel(4,SF:sub(4,4),0)
end
end
end
function SetLabel(ID,CHAR,OFFSET)
if This:FindFirstChild("BR"..ID) and Characters[CHAR] ~= nil then
for i,l in pairs(Characters[CHAR]) do
This["BR"..ID].Mesh.MeshId = "rbxassetid://"..l
end
if CHAR == "A" or CHAR == "1" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.014)
elseif CHAR == "B" or CHAR == "2" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, -0.006)
elseif CHAR == "C" or CHAR == "3" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.014)
elseif CHAR == "D" or CHAR == "4" or CHAR == "E" or CHAR == "5" or CHAR == "F" or CHAR == "6" or CHAR == "G" or CHAR == "7" or CHAR == "H" or CHAR == "8" or CHAR == "I" or CHAR == "9" or CHAR == "J" or CHAR == "0" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, -0.006)
elseif CHAR == "K" or CHAR == "L" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET-0.006, 0, 0)
elseif CHAR == "." or CHAR == "+" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "-" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.014)
elseif CHAR == ";" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0.006)
elseif CHAR == "*" then
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET+0.006, 0, 0)
else
This["BR"..ID].Mesh.Offset = Vector3.new(OFFSET, 0, 0)
end
end
end
if CustomLabel then
if string.find(string.sub(CustomLabel,1,1), "%d") ~= nil then
if string.len(CustomLabel) == 1 then ChangeFloor("$"..CustomLabel)
elseif string.find(string.sub(CustomLabel,2,2), "%a") ~= nil then ChangeFloor("$"..string.sub(CustomLabel,1,1)..";"..string.sub(CustomLabel,2,2))
else ChangeFloor("$"..CustomLabel)
end
elseif string.find(CustomLabel, "%d") == nil then
if string.len(CustomLabel) == 1 then ChangeFloor(";"..CustomLabel)
elseif string.find(string.sub(CustomLabel,2,2), "%d") ~= nil then ChangeFloor(";"..string.sub(CustomLabel,1,1).."$"..string.sub(CustomLabel,2,2))
else ChangeFloor(";"..CustomLabel)
end
else
ChangeFloor(string.sub(CustomLabel,1,1).."$"..string.sub(CustomLabel,2,2))
end
else
ChangeFloor("$"..Btn.Name)
end
script:Destroy()
|
--!native
|
local CollisionModule = {}
local sin = math.sin
local cos = math.cos
local sqrt = math.sqrt
local tan = math.tan
local floor = math.floor
local rad = math.rad
local max = math.max
local min = math.min
local huge = math.huge
local abs = math.abs
local sign = math.sign
local pi = math.pi
local function GetBoundingBox(points, offset)
offset = offset or Vector3.zero
local minX, minY, minZ = huge, huge, huge
local maxX, maxY, maxZ = -huge, -huge, -huge
for _, point in pairs(points) do
local x, y, z = unpack(point)
x = x + offset.X
y = y + offset.Y
z = z + offset.Z
minX = min(minX, x)
minY = min(minY, y)
minZ = min(minZ, z)
maxX = max(maxX, x)
maxY = max(maxY, y)
maxZ = max(maxZ, z)
end
return {
Min = Vector3.new(minX, minY, minZ),
Max = Vector3.new(maxX, maxY, maxZ)
}
end
local function IsPointInsideModel(model, point)
local bounds = GetBoundingBox(model.points)
return point.X >= bounds.Min.X and point.X <= bounds.Max.X
and point.Y >= bounds.Min.Y and point.Y <= bounds.Max.Y
and point.Z >= bounds.Min.Z and point.Z <= bounds.Max.Z
end
local function DoesRayIntersectModel(ray, model)
local origin = ray.Origin
local direction = ray.Direction
local intersectionPoint = nil
-- Check if the ray's origin is inside the model
if IsPointInsideModel(model, origin) then
intersectionPoint = origin
return true, intersectionPoint
end
-- Check for intersections with each model point
local points = model.points
for _, vertex in pairs(points) do
local point = Vector3.new(vertex[1], vertex[2], vertex[3])
local hitDistance = (point - origin):Dot(direction)
if hitDistance >= 0 and IsPointInsideModel(model, origin + hitDistance * direction) then
intersectionPoint = origin + hitDistance * direction
return true, intersectionPoint
end
end
return false, nil
end
local function CalculateMouseRay(mouseX, mouseY, Camera, viewportWidth, viewportHeight)
local cameraCFrame = Camera:GetCFrame()
local cameraInverseCFrame = cameraCFrame:Inverse()
local mousePosition = Vector3.new(mouseX, mouseY, 0)
local mouseRayDirection = (mousePosition - Vector3.new(viewportWidth / 2, viewportHeight / 2, 0)) / sqrt(viewportWidth ^ 2 + viewportHeight ^ 2) * 2
local mouseRayWorldDirection = (cameraInverseCFrame * mouseRayDirection).unit
return Ray.new(Camera.Position, mouseRayWorldDirection)
end
local function GetIntersectionPoint(ray, model)
local origin = ray.Origin
local direction = ray.Direction
local closestDistance = huge
local intersectionPoint = nil
-- Check for intersections with each model point
local points = model.points
for _, vertex in pairs(points) do
local point = Vector3.new(vertex[1], vertex[2], vertex[3])
local hitDistance = (point - origin):Dot(direction)
if hitDistance >= 0 and IsPointInsideModel(model, origin + hitDistance * direction) then
-- Update the closest intersection point if this point is closer to the ray's origin
if hitDistance < closestDistance then
closestDistance = hitDistance
intersectionPoint = origin + hitDistance * direction
end
end
end
return intersectionPoint
end
local function CalculateSurfaceNormal(model, hitPoint)
local points = model.points
local normalsSum = Vector3.zero
local closestNormal = Vector3.zero
local closestDistance = huge
for _, triangle in pairs(model.triangles) do
local vertex1 = Vector3.new(points[triangle[1]][1], points[triangle[1]][2], points[triangle[1]][3])
local vertex2 = Vector3.new(points[triangle[2]][1], points[triangle[2]][2], points[triangle[2]][3])
local vertex3 = Vector3.new(points[triangle[3]][1], points[triangle[3]][2], points[triangle[3]][3])
local edge1 = vertex2 - vertex1
local edge2 = vertex3 - vertex1
local normal = edge1:Cross(edge2).unit
local distanceToPlane = normal:Dot(vertex1 - hitPoint)
if abs(distanceToPlane) < 0.001 then
normalsSum = normalsSum + normal
end
if distanceToPlane < closestDistance then
closestNormal = normal
closestDistance = distanceToPlane
end
end
if normalsSum.Magnitude == 0 then
return closestNormal.unit
else
return normalsSum.unit
end
end
function CollisionModule.Raycast(origin, direction, whitelist)
local ray = Ray.new(origin, direction)
-- Check for collisions with each model in the whitelist
for _, model in pairs(whitelist) do
local doesIntersect, intersectionPoint = DoesRayIntersectModel(ray, model)
if doesIntersect then
return model.Name, intersectionPoint
end
end
return nil, nil
end
function CollisionModule.RaycastWithNormals(origin, direction, blacklist, registry)
local ray = Ray.new(origin, direction)
local hitModel, hitPoint, surfaceNormal = nil, nil, nil
local closestDistance = huge
for i, model in pairs(registry) do
if table.find(blacklist, model.Name) == nil then
local doesIntersect, intersectionPoint = DoesRayIntersectModel(ray, model)
if doesIntersect then
local hitDistance = (intersectionPoint - origin).Magnitude
if hitDistance < closestDistance then
hitModel = model
hitPoint = intersectionPoint
surfaceNormal = CalculateSurfaceNormal(model, hitPoint)
closestDistance = hitDistance
end
end
end
end
return hitModel, hitPoint, surfaceNormal
end
function CollisionModule.AABBCollision(model1, model2, offset)
local bounds1 = GetBoundingBox(model1.points, offset)
local bounds2 = GetBoundingBox(model2.points)
-- Check for collision along each axis (X, Y, Z)
local collisionX = bounds1.Min.X <= bounds2.Max.X and bounds1.Max.X >= bounds2.Min.X
local collisionY = bounds1.Min.Y <= bounds2.Max.Y and bounds1.Max.Y >= bounds2.Min.Y
local collisionZ = bounds1.Min.Z <= bounds2.Max.Z and bounds1.Max.Z >= bounds2.Min.Z
-- If there's a collision along all three axes, there's a collision
if collisionX and collisionY and collisionZ then
-- Calculate the collision normal (direction of collision)
local collisionNormal = Vector3.new(0, 0, 0)
-- Determine which side was hit based on the minimum penetration depth along each axis
local minPenetrationX = min(bounds1.Max.X - bounds2.Min.X, bounds2.Max.X - bounds1.Min.X)
local minPenetrationY = min(bounds1.Max.Y - bounds2.Min.Y, bounds2.Max.Y - bounds1.Min.Y)
local minPenetrationZ = min(bounds1.Max.Z - bounds2.Min.Z, bounds2.Max.Z - bounds1.Min.Z)
-- Find the axis with the minimum penetration depth
local minPenetration = min(minPenetrationX, minPenetrationY, minPenetrationZ)
if minPenetration == minPenetrationX then
collisionNormal = Vector3.new(sign(bounds1.Max.X - bounds2.Min.X), 0, 0)
elseif minPenetration == minPenetrationY then
collisionNormal = Vector3.new(0, sign(bounds1.Max.Y - bounds2.Min.Y), 0)
else
collisionNormal = Vector3.new(0, 0, sign(bounds1.Max.Z - bounds2.Min.Z))
end
return true, collisionNormal
end
return false, nil, 0
end
function CollisionModule.IsModelInside(model1, model2)
local bounds1 = GetBoundingBox(model1.points)
local bounds2 = GetBoundingBox(model2.points)
return bounds1.Min.X >= bounds2.Min.X and bounds1.Min.Y >= bounds2.Min.Y and bounds1.Min.Z >= bounds2.Min.Z
and bounds1.Max.X <= bounds2.Max.X and bounds1.Max.Y <= bounds2.Max.Y and bounds1.Max.Z <= bounds2.Max.Z
end
return CollisionModule
|
--[[**
wraps a callback in an assert with checkArgs
@param callback The function to wrap
@param checkArgs The functon to use to check arguments in the assert
@returns A function that first asserts using checkArgs and then calls callback
**--]]
|
function t.wrap(callback, checkArgs)
assert(checkWrap(callback, checkArgs))
return function(...)
assert(checkArgs(...))
return callback(...)
end
end
end
|
--[[
TODO: Clone and toss the tool handle and display, putting them into a new model and into workspace.Debris. When the handle is touched by a descendant of workspace.Enemies, trap them
]]
| |
-- ================================================================================
-- SETTINGS
-- ================================================================================
|
GameSettings.intermissionDuration = 10 -- Duration of intermission in seconds
GameSettings.roundDuration = 60 -- Durationof race in seconds
GameSettings.countdownDuration = 3 -- Race countdown at starting line in seconds
GameSettings.minimumPlayers = 1 -- Minimum number of players for a race to start
GameSettings.transitionEnd = 3 -- Duration of time between end of race and beginning of
-- next intermission
|
--[=[
@param andThenFn (value: any) -> Option
@return value: Option
If the option holds a value, then the `andThenFn`
function is called with the held value of the option,
and then the resultant Option returned by the `andThenFn`
is returned. Otherwise, None is returned.
```lua
local optA = Option.Some(32)
local optB = optA:AndThen(function(num)
return Option.Some(num * 2)
end)
print(optB:Expect("Expected number")) --> 64
```
]=]
|
function Option:AndThen(andThenFn)
if self:IsSome() then
local result = andThenFn(self:Unwrap())
Option.Assert(result)
return result
else
return Option.None
end
end
|
--[=[
Returns a unique render name for every call, which can
be used with the `BindToRenderStep` method optionally.
```lua
shake:BindToRenderStep(Shake.NextRenderName(), ...)
```
]=]
|
function Shake.NextRenderName(): string
renderId += 1
return ("__shake_%.4i__"):format(renderId)
end
|
-- Adjust the movement of the firefly, allowing them to roam around.
|
local Fly = script.Parent
while true do -- Alter the flies movement direction every once a while to make it roam around
Fly.BodyVelocity.velocity = Vector3.new(math.random(-100,100)*0.5,math.random(-100,100)*0.1,math.random(-100,100)*0.5)
wait(math.random(10,25)*0.1)
end
|
--This module is for any client FX related to the Lab's door
|
local WoodenBarrierFX = {}
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
function WoodenBarrierFX.BREAK(plank)
if not plank then return end
plank.Transparency = 1
local plankClone = plank:Clone()
plankClone.Transparency = 0
plankClone.CanCollide = false
plankClone.CanTouch = false
plankClone.Massless = true
plankClone.Anchored = true
local smoke = script.Smoke:Clone()
smoke.Parent = plankClone
plankClone.Parent = workspace.Ignore
tweenService:Create(plankClone, TweenInfo.new(2, Enum.EasingStyle.Sine, Enum.EasingDirection.In), {Transparency = 1}):Play()
game.Debris:AddItem(plankClone, 2)
plankClone.CFrame = plank.CFrame
local velo = plank.CFrame.UpVector * (-25 - math.random() * 10)
plankClone.Anchored = false
plankClone.Velocity = velo + Vector3.new(0, 25 + math.random() * 10, 0)
plankClone.RotVelocity = Vector3.new(math.random() * 20 - 10, math.random() * 20 - 10, math.random() * 20 - 10)
smoke:Emit(60)
end
function WoodenBarrierFX.BUILD(plank)
if not plank then return end
plank.Transparency = 1
local plankClone = plank:Clone()
plankClone.Transparency = 1
plankClone.CanCollide = false
plankClone.CanTouch = false
plankClone.Massless = true
local smoke = script.Smoke:Clone()
smoke.Parent = plankClone
local sparks = script.Sparks:Clone()
sparks.Parent = plankClone
plankClone.Parent = workspace.Ignore
game.Debris:AddItem(plankClone, 3)
local midCf = plank.CFrame * CFrame.new(0, -5, 0)
local startCf = midCf - Vector3.new(0, 5, 0)
local endCf = plank.CFrame
plankClone.CFrame = startCf
tweenService:Create(plankClone, TweenInfo.new(0.4, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Position = midCf.Position}):Play()
tweenService:Create(plankClone, TweenInfo.new(0.2), {Transparency = 0}):Play()
local originOrientation = plankClone.Orientation
local start = tick()
while tick() - start <= 0.5 do
plankClone.Orientation = originOrientation + Vector3.new(math.random() * 6 - 3, math.random() * 6 - 3, math.random() * 6 - 3)
wait()
end
tweenService:Create(plankClone, TweenInfo.new(0.1, Enum.EasingStyle.Cubic, Enum.EasingDirection.In), {CFrame = endCf}):Play()
delay(0.1, function()
smoke:Emit(60)
sparks:Emit(30)
end)
wait(0.5)
plank.Transparency = 0
end
return WoodenBarrierFX
|
-- Disconnect all handlers. Since we use a linked list it suffices to clear the
-- reference to the head handler.
|
function Signal.DisconnectAll(self: ClassType)
self._handlerListHead = nil
end
|
--[[
To quickly get pre-generated tables for player status models
]]
|
local PlayerStatusModel = {}
function PlayerStatusModel.generate(currentState)
return {
currentState = currentState
}
end
function PlayerStatusModel.generateBot()
return {
isBot = true
}
end
return PlayerStatusModel
|
--Please keep my name in there. ;)
|
bannedlist = { "someoneyouhate","noob"}--If you want someone not to be able to enter your place, put thier name in here.
|
--[[
Ser is a serialization/deserialization utility module that is used
by Knit to automatically serialize/deserialize values passing
through remote functions and remote events.
Ser.Classes = {
[ClassName] = {
Serialize = (value) -> serializedValue
Deserialize = (value) => deserializedValue
}
}
Ser.SerializeArgs(...) -> table
Ser.SerializeArgsAndUnpack(...) -> Tuple
Ser.DeserializeArgs(...) -> table
Ser.DeserializeArgsAndUnpack(...) -> Tuple
Ser.Serialize(value: any) -> any
Ser.Deserialize(value: any) -> any
Ser.UnpackArgs(args: table) -> Tuple
--]]
|
type Args = {
n: number,
[any]: any,
}
local Option = require(script.Parent.Option)
local Ser = {}
Ser.Classes = {
Option = {
Serialize = function(opt) return opt:Serialize() end;
Deserialize = Option.Deserialize;
};
}
function Ser.SerializeArgs(...: any): Args
local args = table.pack(...)
for i,arg in ipairs(args) do
if type(arg) == "table" then
local ser = Ser.Classes[arg.ClassName]
if ser then
args[i] = ser.Serialize(arg)
end
end
end
return args
end
function Ser.SerializeArgsAndUnpack(...: any): ...any
local args = Ser.SerializeArgs(...)
return table.unpack(args, 1, args.n)
end
function Ser.DeserializeArgs(...: any): Args
local args = table.pack(...)
for i,arg in ipairs(args) do
if (type(arg) == "table") then
local ser = Ser.Classes[arg.ClassName]
if (ser) then
args[i] = ser.Deserialize(arg)
end
end
end
return args
end
function Ser.DeserializeArgsAndUnpack(...: any): ...any
local args = Ser.DeserializeArgs(...)
return table.unpack(args, 1, args.n)
end
function Ser.Serialize(value: any): any
if (type(value) == "table") then
local ser = Ser.Classes[value.ClassName]
if (ser) then
value = ser.Serialize(value)
end
end
return value
end
function Ser.Deserialize(value: any): any
if (type(value) == "table") then
local ser = Ser.Classes[value.ClassName]
if (ser) then
value = ser.Deserialize(value)
end
end
return value
end
function Ser.UnpackArgs(args: Args): ...any
return table.unpack(args, 1, args.n)
end
return Ser
|
--!strict
--[=[
@function push
@within Array
@param array {T} -- The array to push an element to.
@param ... ...T -- The elements to push.
@return {T} -- The array with the pushed elements.
Adds elements to the end of the array.
#### Aliases
`append`
```lua
local array = { 1, 2, 3 }
local new = Push(array, 4, 5, 6) -- { 1, 2, 3, 4, 5, 6 }
```
]=]
|
local function push<T>(array: { T }, ...: T): { T }
local result = {}
for index, value in ipairs(array) do
table.insert(result, value)
end
for _, value in ipairs({ ... }) do
table.insert(result, value)
end
return result
end
return push
|
-- originalEndWaypoint is optional, causes the waypoint to tween from that position.
|
function ClickToMoveDisplay.CreatePathDisplay(wayPoints, originalEndWaypoint)
createPathCount = createPathCount + 1
local trailDots = createTrailDots(wayPoints, originalEndWaypoint)
local function removePathBeforePoint(wayPointNumber)
-- kill all trailDots before and at wayPointNumber
for i = #trailDots, 1, -1 do
local trailDot = trailDots[i]
if trailDot.ClosestWayPoint <= wayPointNumber then
trailDot:Destroy()
trailDots[i] = nil
else
break
end
end
end
local reiszeTrailDotsUpdateName = "ClickToMoveResizeTrail" ..createPathCount
local function resizeTrailDots()
if #trailDots == 0 then
RunService:UnbindFromRenderStep(reiszeTrailDotsUpdateName)
return
end
local cameraPos = Workspace.CurrentCamera.CFrame.p
for i = 1, #trailDots do
local trailDotImage = trailDots[i].DisplayModel:FindFirstChild("TrailDotImage")
if trailDotImage then
local distanceToCamera = (trailDots[i].DisplayModel.Position - cameraPos).magnitude
trailDotImage.Size = getTrailDotScale(distanceToCamera, TrailDotSize)
end
end
end
RunService:BindToRenderStep(reiszeTrailDotsUpdateName, Enum.RenderPriority.Camera.Value - 1, resizeTrailDots)
local function removePath()
removePathBeforePoint(#wayPoints)
end
return removePath, removePathBeforePoint
end
local lastFailureWaypoint = nil
function ClickToMoveDisplay.DisplayFailureWaypoint(position)
if lastFailureWaypoint then
lastFailureWaypoint:Hide()
end
local failureWaypoint = FailureWaypoint.new(position)
lastFailureWaypoint = failureWaypoint
coroutine.wrap(function()
failureWaypoint:RunFailureTween()
failureWaypoint:Destroy()
failureWaypoint = nil
end)()
end
function ClickToMoveDisplay.CreateEndWaypoint(position)
return EndWaypoint.new(position)
end
function ClickToMoveDisplay.PlayFailureAnimation()
local myHumanoid = findPlayerHumanoid()
if myHumanoid then
local animationTrack = getFailureAnimationTrack(myHumanoid)
animationTrack:Play()
end
end
function ClickToMoveDisplay.CancelFailureAnimation()
if lastFailureAnimationTrack ~= nil and lastFailureAnimationTrack.IsPlaying then
lastFailureAnimationTrack:Stop()
end
end
function ClickToMoveDisplay.SetWaypointTexture(texture)
TrailDotIcon = texture
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointTexture()
return TrailDotIcon
end
function ClickToMoveDisplay.SetWaypointRadius(radius)
TrailDotSize = Vector2.new(radius, radius)
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointRadius()
return TrailDotSize.X
end
function ClickToMoveDisplay.SetEndWaypointTexture(texture)
EndWaypointIcon = texture
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetEndWaypointTexture()
return EndWaypointIcon
end
function ClickToMoveDisplay.SetWaypointsAlwaysOnTop(alwaysOnTop)
WaypointsAlwaysOnTop = alwaysOnTop
TrailDotTemplate, EndWaypointTemplate, FailureWaypointTemplate = CreateWaypointTemplates()
end
function ClickToMoveDisplay.GetWaypointsAlwaysOnTop()
return WaypointsAlwaysOnTop
end
return ClickToMoveDisplay
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
UserInputService = game:GetService("UserInputService")
RbxUtility = LoadLibrary("RbxUtility")
Create = RbxUtility.Create
Animations = {
Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
}
AnimationTracks = {}
Controls = {
Forward = {
Down = false,
Keys = {Key = "w", ByteKey = 17}
},
Backward = {
Down = false,
Keys = {Key = "s", ByteKey = 18}
},
Left = {
Down = false,
Keys = {Key = "a", ByteKey = 20}
},
Right = {
Down = false,
Keys = {Key = "d", ByteKey = 19}
}
}
Rate = (1 / 60)
Gravity = 196.20
Speed = {
Acceleration = 20,
Deceleration = 20,
MovementSpeed = {Min = 35, Max = 35},
TurnSpeed = {
Speed = {Min = 3, Max = 3},
TurnAlpha = 0.5,
AlphaDampening = 0.2
},
Pitch = {Min = 40, Max = 40}
}
MaxSpeed = { --Maximum speed which the vehicle can move and turn at.
Movement = Speed.MovementSpeed,
Turn = Speed.TurnSpeed.Speed,
Pitch = Speed.Pitch,
Acceleration = Speed.Acceleration,
Deceleration = Speed.Deceleration
}
CurrentSpeed = { --The speed which the vehicle is moving and turning at.
Movement = 0,
Turn = 0,
Pitch = 0
}
ToolEquipped = false
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(AnimationTracks) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(AnimationTracks, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(AnimationTracks) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop(value.FadeTime)
table.remove(Animations, i)
end
end
end
end
function ThrustUpdater()
Humanoid.WalkSpeed = 0
Humanoid.AutoRotate = false
Humanoid.PlatformStand = true
if Controls.Forward.Down then --Handle acceleration
CurrentSpeed.Pitch = math.min(MaxSpeed.Pitch.Max, (CurrentSpeed.Pitch + Speed.TurnSpeed.TurnAlpha))
end
if Controls.Backward.Down then --Handle deceleration, if speed is more than 0, decrease quicker.
CurrentSpeed.Pitch = math.min(MaxSpeed.Pitch.Min, (CurrentSpeed.Pitch - Speed.TurnSpeed.TurnAlpha))
end
if Controls.Left.Down then --Handle left turn speed
CurrentSpeed.Turn = math.min(MaxSpeed.Turn.Min, (CurrentSpeed.Turn + Speed.TurnSpeed.TurnAlpha))
end
if Controls.Right.Down then --Handle right turn speed
CurrentSpeed.Turn = math.max(-MaxSpeed.Turn.Max, (CurrentSpeed.Turn - Speed.TurnSpeed.TurnAlpha))
end
if math.abs(CurrentSpeed.Turn) > Speed.TurnSpeed.AlphaDampening then
CurrentSpeed.Turn = (CurrentSpeed.Turn - ((Speed.TurnSpeed.AlphaDampening) * (math.abs(CurrentSpeed.Turn) / CurrentSpeed.Turn)))
else
CurrentSpeed.Turn = 0
end
if math.abs(CurrentSpeed.Pitch) > Speed.TurnSpeed.AlphaDampening then
CurrentSpeed.Pitch = (CurrentSpeed.Pitch - (Speed.TurnSpeed.AlphaDampening * (math.abs(CurrentSpeed.Pitch) / CurrentSpeed.Pitch)))
else
CurrentSpeed.Pitch = 0
end
local LeanAmount = (-CurrentSpeed.Turn * (math.pi / 6) / 1.5)
local Direction = Torso.CFrame.lookVector
local XZDirection = Vector3.new(Direction.X, 0, Direction.Z).Unit
ThrustForce.velocity = (Direction * CurrentSpeed.Movement)
local XZNormal = (CFrame.Angles(0, (math.pi / 2), 0) * XZDirection)
if math.abs(Direction.Y) > 0.85 then
RotationForce.angularvelocity = (TurnGyro.cframe * Vector3.new(0, CurrentSpeed.Turn, 0))
CurrentSpeed.Pitch = 0
elseif not Controls.Forward.Down and not Controls.Backward.Down and not Controls.Left.Down and not Controls.Right.Down then
local TurnForce = (CurrentSpeed.Pitch + (math.sin(tick() * 4) * 3))
RotationForce.angularvelocity = (TurnGyro.cframe * Vector3.new((TurnForce * XZNormal.X), CurrentSpeed.Turn, (TurnForce * XZNormal.Z)))
else
RotationForce.angularvelocity = (TurnGyro.cframe * Vector3.new((CurrentSpeed.Pitch * XZNormal.X), CurrentSpeed.Turn, (CurrentSpeed.Pitch * XZNormal.Z)))
end
TurnGyro.cframe = CFrame.Angles((LeanAmount * XZDirection.X), 0, (LeanAmount * XZDirection.Z))
wait(Rate)
end
function SetUpMovement()
for i, v in pairs(CurrentSpeed) do
CurrentSpeed[i] = 0
end
CurrentSpeed.Movement = MaxSpeed.Movement.Max
for i, v in pairs(Controls) do
v.Down = false
end
SetAnimation("PlayAnimation", Animations.Sit)
TurnGyro = Create("BodyGyro"){
maxTorque = Vector3.new(math.huge, 0, math.huge),
Parent = Torso,
}
ThrustForce = Create("BodyVelocity"){
maxForce = Vector3.new(math.huge, math.huge, math.huge),
velocity = Vector3.new(0, 0, 0),
Parent = Torso,
}
RotationForce = Create("BodyAngularVelocity"){
maxTorque = Vector3.new(math.huge, math.huge, math.huge),
angularvelocity = Vector3.new(0, 0, 0),
Parent = Torso,
}
Spawn(function()
while CheckIfAlive() and TurnGyro.Parent and ThrustForce.Parent and RotationForce.Parent and ToolEquipped do
ThrustUpdater()
wait()
end
end)
end
function KeyPress(Key, Down)
local ByteKey = string.byte(Key)
for i, v in pairs(Controls) do
if v.Keys.Key == Key or v.Keys.ByteKey == ByteKey then
v.Down = Down
end
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
Torso = Character:FindFirstChild("Torso")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Mouse.KeyDown:connect(function(Key)
KeyPress(Key, true)
end)
Mouse.KeyUp:connect(function(Key)
KeyPress(Key, false)
end)
Spawn(SetUpMovement)
Humanoid:ChangeState(Enum.HumanoidStateType.None)
end
function Unequipped()
for i, v in pairs(Controls) do
v.Down = false
end
for i, v in pairs(AnimationTracks) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
for i, v in pairs({TurnGyro, ThrustForce, RotationForce}) do
if tostring(v) == "Connection" then
v:disconnect()
elseif type(v) == "userdata" and v.Parent then
Debris:AddItem(v, 0)
end
end
if CheckIfAlive() then
Humanoid.WalkSpeed = 16
Humanoid.AutoRotate = true
Humanoid.PlatformStand = false
Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
end
AnimationTracks = {}
ToolEquipped = false
end
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- initialize camera shaker object
|
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf
end)
camShake:Start()
local CameraShake = {}
function CameraShake.ShakeOnce()
if not tool:GetAttribute('CameraShake') then return end
-- CameraShaker:ShakeOnce(magnitude, roughness [, fadeInTime, fadeOutTime, posInfluence, rotInfluence])
camShake:ShakeOnce(5, 20 , 0, 1.5, Vector3.new(.5,.5,.5), Vector3.new())
end
function CameraShake.ShakeSustain()
if not tool:GetAttribute('CameraShake') then return end
camShake:ShakeSustain(CameraShaker.Presets.Earthquake)
end
function CameraShake.StopSustained()
if not tool:GetAttribute('CameraShake') then return end
camShake:StopSustained(1)
end
return CameraShake
|
-- Wait for tool to load completely
|
while not (Support.GetDescendantCount(Tool) >= TotalCount) do
wait(0.1);
end;
|
-- Instancing method caching
|
local vec3 = Vector3.new
local vec2 = Vector2.new
local cframe = CFrame.new
local angles = CFrame.Angles
|
--[[
Creates a new controller associated with the specified vehicle.
]]
|
function VehicleSoundComponent.new(model, controller)
local component = {
model = model,
controller = controller
}
setmetatable(component, {__index = VehicleSoundComponent})
component:setup()
return component
end
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
else
warn("qWeld - Unable to weld part")
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
--- Don't bother with local scripts
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
|
-- Helper function to lazily instantiate a controller if it does not yet exist,
-- disable the active controller if it is different from the on being switched to,
-- and then enable the requested controller. The argument to this function must be
-- a reference to one of the control modules, i.e. Keyboard, Gamepad, etc.
|
function ControlModule:SwitchToController(controlModule)
if not controlModule then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = nil
self.activeControlModule = nil
else
if not self.controllers[controlModule] then
self.controllers[controlModule] = controlModule.new(CONTROL_ACTION_PRIORITY)
end
if self.activeController ~= self.controllers[controlModule] then
if self.activeController then
self.activeController:Enable(false)
end
self.activeController = self.controllers[controlModule]
self.activeControlModule = controlModule -- Only used to check if controller switch is necessary
if self.touchControlFrame then
self.activeController:Enable(true, self.touchControlFrame)
else
if self.activeControlModule == ClickToMove then
-- For ClickToMove, when it is the player's choice, we also enable the full keyboard controls.
-- When the developer is forcing click to move, the most keyboard controls (WASD) are not available, only spacebar to jump.
self.activeController:Enable(true, Players.LocalPlayer.DevComputerMovementMode == Enum.DevComputerMovementMode.UserChoice)
else
self.activeController:Enable(true)
end
end
if self.touchControlFrame and (self.activeControlModule == TouchThumbpad
or self.activeControlModule == TouchThumbstick
or self.activeControlModule == ClickToMove
or self.activeControlModule == DynamicThumbstick) then
if not self.controllers[TouchJump] then
self.controllers[TouchJump] = TouchJump.new()
end
self.touchJumpController = self.controllers[TouchJump]
self.touchJumpController:Enable(true, self.touchControlFrame)
else
if self.touchJumpController then
self.touchJumpController:Enable(false)
end
end
end
end
end
function ControlModule:OnLastInputTypeChanged(newLastInputType)
if lastInputType == newLastInputType then
warn("LastInputType Change listener called with current type.")
end
lastInputType = newLastInputType
if lastInputType == Enum.UserInputType.Touch then
-- TODO: Check if touch module already active
local touchModule, success = self:SelectTouchModule()
if success then
while not self.touchControlFrame do
wait()
end
self:SwitchToController(touchModule)
end
elseif computerInputTypeToModuleMap[lastInputType] ~= nil then
local computerModule = self:SelectComputerMovementModule()
if computerModule then
self:SwitchToController(computerModule)
end
end
end
|
--[[
Given a Model in 3D space, this function figures out how far the camera
has to be pushed back to fit the model within the viewport.
Check out this great video demonstrating the implementation:
https://youtu.be/2J-2v_UqNDw
]]
|
local function getDepthToFitObject(fov: number, instance: Instance)
local size: Vector3
if instance:IsA("Model") then
local _, boxSize = instance:GetBoundingBox()
size = boxSize
elseif instance:IsA("BasePart") then
size = instance.Size
else
local part = instance:FindFirstChildWhichIsA("BasePart")
size = part.Size
end
local sizeY = math.abs(size.Y)
local sizeZ = math.abs(size.Z)
return (sizeY / (math.tan(math.rad(fov / 2)) * 2)) + (sizeZ / 2)
end
local defaultProps = {
size = UDim2.fromScale(1, 1),
previewRotationSpeed = 15,
rotation = 120,
zoomRange = NumberRange.new(-DEPTH_PADDING, 5), -- studs
zoomIncrement = 2.5, -- studs
-- Mocks
spring = Otter.spring,
UserInputService = UserInputService,
RunService = RunService,
}
export type Props = typeof(defaultProps) & {
itemInfo: types.ItemInfo,
previewMode: string,
size: UDim2?,
previewRotationSpeed: number?,
rotation: number?,
previewAvatar: Model?,
UserInputService: UserInputService,
RunService: RunService,
}
local ItemViewport = Roact.Component:extend("ItemViewport")
ItemViewport.defaultProps = defaultProps
function ItemViewport:init()
self.isUserRotating = false
self.isUserPinching = false
self.zoomOffset = 0
self.zoomMotor = Otter.createSingleMotor(self.zoomOffset)
self.zoomMotor:onStep(function(value: number)
self.zoomOffset = value
end)
self.rotation = self.props.rotation
self.viewportCamera = Instance.new("Camera")
self.lastViewportInputPosition = Vector3.new()
self.viewportRef = Roact.createRef()
self.heartbeatFunction = function(delta: number)
local viewport: ViewportFrame = self.viewportRef:getValue()
local viewportCamera: Camera = self.viewportCamera
local viewportObject = viewport and viewport:FindFirstChildWhichIsA("Instance")
if not viewportObject then
return
end
local rotationSpeed = self.props.previewRotationSpeed
if not self.isUserRotating then
rotationSpeed = rotationSpeed * 0.95 + rotationSpeed * 0.05
self.rotation = (self.rotation + delta * rotationSpeed) % 360
end
local props: Props = self.props
local rotation = CFrame.Angles(0, math.rad(self.rotation), 0)
local position = getInstanceCenter(viewportObject)
local depth = getDepthToFitObject(viewportCamera.FieldOfView, viewportObject)
depth = math.clamp(depth, props.zoomRange.Min, props.zoomRange.Max)
viewportCamera.CFrame = CFrame.new(position)
* rotation
* CFrame.new(0, 0, depth + DEPTH_PADDING + self.zoomOffset)
end
self.zoom = function(direction: number)
local props: Props = self.props
local goal =
math.clamp(self.zoomOffset - (props.zoomIncrement * direction), props.zoomRange.Min, props.zoomRange.Max)
self.zoomMotor:setGoal(props.spring(goal, constants.Springs.Zippy))
end
self.inputBegan = function(_, input: InputObject)
if input.UserInputType == Enum.UserInputType.MouseWheel then
self.zoom(input.Position.Z)
end
if self.isUserPinching then
return
end
if
input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
then
self.isUserRotating = true
self:setState({ viewportInput = true })
self.lastViewportInputPosition = input.Position
end
end
self.inputEnded = function(_rbx, input: InputObject)
if self.isUserRotating then
self.isUserRotating = false
if
input.UserInputType == Enum.UserInputType.MouseButton1
or input.UserInputType == Enum.UserInputType.Touch
then
self:setState({ viewportInput = false })
end
end
end
self.inputChanged = function(_rbx, input: InputObject)
if input.UserInputType == Enum.UserInputType.MouseWheel then
self.zoom(input.Position.Z)
end
if self.isUserRotating and not self.isUserPinching then
if
input.UserInputType == Enum.UserInputType.MouseMovement
or input.UserInputType == Enum.UserInputType.Touch
then
local delta = input.Position - self.lastViewportInputPosition -- input.Delta doesn't seem to work
self.lastViewportInputPosition = input.Position
self.rotation = self.rotation - delta.X
end
end
end
local lastPinchDistance: number
self.touchPinch = function(_rbx, touchPositions: { Vector2 }, _scale, _velocity, state: Enum.UserInputState)
if not touchPositions[2] or state == Enum.UserInputState.End then
self.isUserPinching = false
return
end
self.isUserPinching = true
local pinchDistance = (touchPositions[1] - touchPositions[2]).Magnitude
if state == Enum.UserInputState.Change then
local props: Props = self.props
local pinchDelta = pinchDistance - lastPinchDistance
local goal = self.zoomOffset - (props.zoomIncrement * pinchDelta * PINCH_DELTA_TO_ZOOM_DELTA)
self.zoomOffset = math.clamp(goal, props.zoomRange.Min, props.zoomRange.Max)
end
lastPinchDistance = pinchDistance
end
self.updateViewportItem = function()
local props: Props = self.props
local viewport: ViewportFrame = self.viewportRef:getValue()
viewport:ClearAllChildren()
if not props.itemInfo then
return
end
if props.previewMode == enums.PreviewModes.Object then
if props.itemInfo.viewportObject then
local clone = props.itemInfo.viewportObject:Clone()
clone.Parent = viewport
else
warn("Merch booth item preview: could not find item viewport object")
end
else
if props.previewAvatar then
local clone = props.previewAvatar:Clone()
clone.Parent = viewport
else
warn("Merch booth item preview: could not find preview avatar")
end
end
end
end
function ItemViewport:render()
return Roact.createElement("ViewportFrame", {
Active = true,
LayoutOrder = self.props.LayoutOrder,
Size = self.props.size,
BackgroundTransparency = 1,
CurrentCamera = self.viewportCamera,
[Roact.Event.InputBegan] = self.inputBegan,
[Roact.Event.InputEnded] = self.inputEnded,
[Roact.Event.InputChanged] = self.inputChanged,
[Roact.Event.TouchPinch] = self.touchPinch,
[Roact.Ref] = self.viewportRef,
}, {
HeartbeatEventConnection = Roact.createElement(ExternalEventConnection, {
event = self.props.RunService.Heartbeat,
callback = self.heartbeatFunction,
}),
})
end
function ItemViewport:didMount()
self.updateViewportItem()
end
function ItemViewport:didUpdate(previousProps: Props)
local props: Props = self.props
if
previousProps.itemInfo ~= props.itemInfo
or previousProps.previewMode ~= props.previewMode
or props.previewAvatar ~= previousProps.previewAvatar
then
self.updateViewportItem()
end
end
return ItemViewport
|
--[=[
Constructs a new ClassName.
```lua
```
@class ClassName
]=]
|
local class = {} do
end
|
--[[
Create a copy of a list doing a combination filter and map.
If callback returns nil for any item, it is considered filtered from the
list. Any other value is considered the result of the 'map' operation.
]]
|
function Functional.FilterMap(list, callback)
local new = {}
for key = 1, #list do
local value = list[key]
local result = callback(value, key)
if result ~= nil then
table.insert(new, result)
end
end
return new
end
|
--[[
___ __ _ _ _ __ __ _ _
|_ _| _ __ / _| (_) _ __ (_) | |_ ___ | \/ | (_) _ __ (_) _ __ __ _
| | | '_ \ | |_ | | | '_ \ | | | __| / _ \ | |\/| | | | | '_ \ | | | '_ \ / _` |
| | | | | | | _| | | | | | | | | | |_ | __/ | | | | | | | | | | | | | | | | | (_| |
|___| |_| |_| |_| |_| |_| |_| |_| \__| \___| |_| |_| |_| |_| |_| |_| |_| |_| \__, |
____ _ __ _ _
/ ___| __ _ _ __ ___ ___ | |/ / (_) | |_
| | _ / _` | | '_ ` _ \ / _ \ | ' / | | | __|
| |_| | | (_| | | | | | | | | __/ | . \ | | | |_
\____| \__,_| |_| |_| |_| \___| |_|\_\ |_| \__|
|___/
____ _ _ ____ ____ ____ ____ ____ __ __
( _ \( \/ ) ( _ \( ___)( _ \( ___)(_ ) /__\ /__\
) _ < \ / ) _ < )__) ) / )__) / /_ /(__)\ /(__)\
(____/ (__) (____/(____)(_)\_)(____)(____)(__)(__)(__)(__) V4
Based on the popular mining game Azure Mines
https://www.roblox.com/games/428114181/Azure-Mines/
GUIDED VIDEO TUTORIAL: 🎥 youtube.com/watch?v=_wBfwupqmt8
^ (Made for v2. The command step is slightly different. If you need help, check
the description of the video for resources. Make sure you read and follow the
set-up instructions below very carefully.)
Contained within this kit is everything you need to set up a fully-functional infinite
mining game within minutes. Follow these instructions and you'll be set to go in no time!
Watch out for new versions of the kit and join our Infinite Mining Games community for
announcements, news, help, and to share your creations.
If you enjoy the kit please consider leaving a 👍 Thumbs Up and ⭐ Favorite the model
to help others find it. If you are a developer, please consider releasing your own old
projects to the public domain as kits. It could make an enormous impact on the life of
a young creator who discovers it.
https://www.roblox.com/library/4920625917/Infinite-Mining-Game-Kit-by-berezaa
SET-UP INSTRUCTIONS
STEP #1:
The Infinite Mining Game Kit expects everything to be at a certain position. Enter the
following command in your "Run a command" output at the bottom of Roblox Studio:
-->
workspace["Infinite Mining Game Kit v4 by berezaa"]:SetPrimaryPartCFrame(
CFrame.new(86.3270645, 5013.8042, 74.279068, -0.258819073, 0, 0.965925813,
0, 1, 0, -0.965925813, 0, -0.258819073))
You'll notice that everything is now gone. Point your camera directly upwards and you'll
see the map. You can fly your camera towards it or teleport there directly using the command:
-->
workspace.CurrentCamera.CFrame = CFrame.new(85, 5030, 75)
STEP #2:
At this point, everything is positioned where it will be in the real game and all of the
ores and building components are laid out in the workspace. You may want to save a copy
of the place so you can easily edit the ores and building components before setting up
the game with the following steps.
STEP #3:
Re-parent the contents of each folder into the game service of the same name.
For example, open the kit, right-click the folder named ReplicatedStorage and
"Select Children". Then right-click again and "Cut". Find the real ReplicatedStorage
service in your Explorer, right-click and "Paste Into"
Be careful with the Workspace folder, as using "Cut" and "Paste Into" may cause
the parts to be re-positioned, which will break things. Instead, right-click the
Workspace folder and "Select Children". Then use your mouse to drag all of the
selected children into the real workspace (Planet earth icon). This should prevent
anything from being automatically displaced by Roblox. It may be a good idea to
do the Workspace folder last.
NOTE: For the StarterPlayer folder, you will need to follow the instructions above
for both of the StarterPlayerScripts and StarterCharacterScripts folders individually.
Roblox has special folders for this, so make sure you are moving the contents from
those folders into the correct Roblox folders. If the game is stuck on a dark screen
when you are trying to play, messing up this step is the most common reason why.
STEP #4:
Make sure your game is published. Go to "File -> Publish to Roblox" to confirm. If the
option is greyed out that means you are not published. Use "File -> Publish to Roblox as"
to create a new place for your mining game.
Next go to "Home -> Game Settings -> Options" and turn on "Enable Studio Access to API
Services." You may also go to "Game Settings -> Avatar" and set "Avatar Type" to "R6"
and "Collision" to "Inner Box". You should know that changing the avatar settings is
not required for the kit to work, but the kit is designed with classic avatars in mind.
NOTE: If you are not able to test in Studio, you may need to visit the "Create" tab on
the Roblox website and go to "Game Settings" of the new game you have created. Once you
are there, toggle the "Allow studio access to API" setting. Also note that "game settings"
are different from "place settings".
Finally, "File -> Publish to Roblox" one more time.
And you're done! Go to "Test -> Play" to try out the game in Roblox Studio, or go to
the Roblox website and play your game there. If you have any questions, feel free to PM
berezaa on Roblox. Please follow me @berezaagames for dev content
Once you've made sure everything works, you can extend the functionality of the game by
adding new levels of base machines, new pickaxes, new ores and more without any scripting
required. Have fun!
Want to try making a more advanced game? Miner's Haven's full source file is available for
use. Get it here:
devforum.roblox.com/t/miners-haven-open-sourced/350767
]]
|
return "the favor"
|
--//Shifting//-
|
if key == "1" then
carSeat.Wheels.FR.Spring.Stiffness = 8000
carSeat.Wheels.FL.Spring.Stiffness = 8000
carSeat.Wheels.RR.Spring.Stiffness = 8000
carSeat.Wheels.RL.Spring.Stiffness = 8000
carSeat.Wheels.FR.Spring.MinLength = 1.6
carSeat.Wheels.FL.Spring.MinLength = 1.6
carSeat.Wheels.RR.Spring.MinLength = 1.6
carSeat.Wheels.RL.Spring.MinLength = 1.6
car.DriveSeat.Air:Play()
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 7000
carSeat.Wheels.FL.Spring.Stiffness = 7000
carSeat.Wheels.RR.Spring.Stiffness = 7000
carSeat.Wheels.RL.Spring.Stiffness = 7000
carSeat.Wheels.FR.Spring.MinLength = 1.575
carSeat.Wheels.FL.Spring.MinLength = 1.575
carSeat.Wheels.RR.Spring.MinLength = 1.575
carSeat.Wheels.RL.Spring.MinLength = 1.575
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 6000
carSeat.Wheels.FL.Spring.Stiffness = 6000
carSeat.Wheels.RR.Spring.Stiffness = 6000
carSeat.Wheels.RL.Spring.Stiffness = 6000
carSeat.Wheels.FR.Spring.MinLength = 1.560
carSeat.Wheels.FL.Spring.MinLength = 1.560
carSeat.Wheels.RR.Spring.MinLength = 1.560
carSeat.Wheels.RL.Spring.MinLength = 1.560
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 5000
carSeat.Wheels.FL.Spring.Stiffness = 5000
carSeat.Wheels.RR.Spring.Stiffness = 5000
carSeat.Wheels.RL.Spring.Stiffness = 5000
carSeat.Wheels.FR.Spring.MinLength = 1.545
carSeat.Wheels.FL.Spring.MinLength = 1.545
carSeat.Wheels.RR.Spring.MinLength = 1.545
carSeat.Wheels.RL.Spring.MinLength = 1.545
car.DriveSeat.Air:Stop()
elseif key == "2" then
car.DriveSeat.Air:Play()
carSeat.Wheels.FR.Spring.Stiffness = 5000
carSeat.Wheels.FL.Spring.Stiffness = 5000
carSeat.Wheels.RR.Spring.Stiffness = 5000
carSeat.Wheels.RL.Spring.Stiffness = 5000
carSeat.Wheels.FR.Spring.MinLength = 1.545
carSeat.Wheels.FL.Spring.MinLength = 1.545
carSeat.Wheels.RR.Spring.MinLength = 1.545
carSeat.Wheels.RL.Spring.MinLength = 1.545
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 6000
carSeat.Wheels.FL.Spring.Stiffness = 6000
carSeat.Wheels.RR.Spring.Stiffness = 6000
carSeat.Wheels.RL.Spring.Stiffness = 6000
carSeat.Wheels.FR.Spring.MinLength = 1.560
carSeat.Wheels.FL.Spring.MinLength = 1.560
carSeat.Wheels.RR.Spring.MinLength = 1.560
carSeat.Wheels.RL.Spring.MinLength = 1.560
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 7000
carSeat.Wheels.FL.Spring.Stiffness = 7000
carSeat.Wheels.RR.Spring.Stiffness = 7000
carSeat.Wheels.RL.Spring.Stiffness = 7000
carSeat.Wheels.FR.Spring.MinLength = 1.575
carSeat.Wheels.FL.Spring.MinLength = 1.575
carSeat.Wheels.RR.Spring.MinLength = 1.575
carSeat.Wheels.RL.Spring.MinLength = 1.575
wait(0.1)
carSeat.Wheels.FR.Spring.Stiffness = 8000
carSeat.Wheels.FL.Spring.Stiffness = 8000
carSeat.Wheels.RR.Spring.Stiffness = 8000
carSeat.Wheels.RL.Spring.Stiffness = 8000
carSeat.Wheels.FR.Spring.MinLength = 1.6
carSeat.Wheels.FL.Spring.MinLength = 1.6
carSeat.Wheels.RR.Spring.MinLength = 1.6
carSeat.Wheels.RL.Spring.MinLength = 1.6
car.DriveSeat.Air:Stop()
end
end)
|
--------END DJ BACKLIGHT--------
|
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--Put in ServerScriptService
|
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
script.RagdollClient:Clone().Parent = character
character:WaitForChild("Humanoid").Died:connect(function()
character.UpperTorso:SetNetworkOwner(player)
end)
end)
end)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent.Parent.Parent._Index
local Package = require(PackageIndex["ExternalEventConnection"]["ExternalEventConnection"])
return Package
|
-- game.Workspace.Points:ClearAllChildren()
-- local ps = path:GetPointCoordinates()
-- for _, point in pairs(ps) do
-- local part = Instance.new("Part", game.Workspace.Points)
-- part.CanCollide = false
-- part.Anchored = true
-- part.FormFactor = Enum.FormFactor.Custom
-- part.Size = Vector3.new(1,1,1)
-- part.Position = point
-- end
|
currentPointIndex = 1
lastTargetPos = target
end
if path then
local points = path:GetPointCoordinates()
if currentPointIndex < #points then
local currentPoint = points[currentPointIndex]
if not character:FindFirstChild("HumanoidRootPart") then return end
local distance = (character.HumanoidRootPart.Position - currentPoint).magnitude
if distance < NextPointThreshold then
currentPointIndex = currentPointIndex + 1
end
character.Humanoid:MoveTo(points[currentPointIndex])
if points[currentPointIndex].Y - character.HumanoidRootPart.Position.Y > JumpThreshold then
character.Humanoid.Jump = true
end
else
character.Humanoid:MoveTo(target)
end
end
end
return this
end
return PathfindingUtility
|
-- Variables (best not to touch these!)
|
local button = script.Parent
local car = script.Parent.Parent.Car.Value
local sound = script.Parent.Start
sound.Parent = car.DriveSeat -- What brick the start sound is playing from.
button.MouseButton1Click:connect(function() -- Event when the button is clicked
if script.Parent.Text == "Engine: Off" then -- If the text says it's off then..
sound:Play() -- Startup sound plays..
wait(1.2) -- For realism. Okay?
script.Parent.Parent.IsOn.Value = true -- The car is is on, or in other words, start up the car.
button.Text = "Engine: On" -- You don't really need this, but I would keep it.
else -- If it's on then when you click the button,
script.Parent.Parent.IsOn.Value = false -- The car is turned off.
button.Text = "Engine: Off"
end -- Don't touch this.
end) -- And don't touch this either.
|
--[[
* Used to print values in error messages.
]]
|
local function inspect(value, options: InspectOptions?): string
local inspectOptions: InspectOptions = options or { depth = DEFAULT_RECURSIVE_DEPTH }
local depth = inspectOptions.depth or DEFAULT_RECURSIVE_DEPTH
inspectOptions.depth = if depth >= 0 then depth else DEFAULT_RECURSIVE_DEPTH
return formatValue(value, {}, inspectOptions :: FormatOptions)
end
local function isIndexKey(k, contiguousLength)
return type(k) == "number"
and k <= contiguousLength -- nothing out of bounds
and 1 <= k -- nothing illegal for array indices
and math.floor(k) == k -- no float keys
end
local function getTableLength(tbl)
local length = 1
local value = rawget(tbl, length)
while value ~= nil do
length += 1
value = rawget(tbl, length)
end
return length - 1
end
local function sortKeysForPrinting(a: any, b)
local typeofA = type(a)
local typeofB = type(b)
-- strings and numbers are sorted numerically/alphabetically
if typeofA == typeofB and (typeofA == "number" or typeofA == "string") then
return a < b
end
-- sort the rest by type name
return typeofA < typeofB
end
local function rawpairs(t)
return next, t, nil
end
local function getFragmentedKeys(tbl)
local keys = {}
local keysLength = 0
local tableLength = getTableLength(tbl)
for key, _ in rawpairs(tbl) do
if not isIndexKey(key, tableLength) then
keysLength = keysLength + 1
keys[keysLength] = key
end
end
table.sort(keys, sortKeysForPrinting)
return keys, keysLength, tableLength
end
function formatValue(value, seenValues, options: FormatOptions)
local valueType = typeof(value)
if valueType == "string" then
return HttpService:JSONEncode(value)
-- deviation: format numbers like in JS
elseif valueType == "number" then
if value ~= value then
return "NaN"
elseif value == math.huge then
return "Infinity"
elseif value == -math.huge then
return "-Infinity"
else
return tostring(value)
end
elseif valueType == "function" then
local result = "[function"
local functionName = debug.info(value :: (any) -> any, "n")
if functionName ~= nil and functionName ~= "" then
result ..= " " .. functionName
end
return result .. "]"
elseif valueType == "table" then
-- ROBLOX TODO: parameterize inspect with the library-specific NULL sentinel. maybe function generics?
-- if value == NULL then
-- return 'null'
-- end
return formatObjectValue(value, seenValues, options)
else
return tostring(value)
end
end
function formatObjectValue(value, previouslySeenValues, options: FormatOptions)
if table.find(previouslySeenValues, value) ~= nil then
return "[Circular]"
end
local seenValues = { unpack(previouslySeenValues) }
table.insert(seenValues, value)
if typeof(value.toJSON) == "function" then
local jsonValue = value:toJSON(value)
if jsonValue ~= value then
if typeof(jsonValue) == "string" then
return jsonValue
else
return formatValue(jsonValue, seenValues, options)
end
end
elseif Array.isArray(value) then
return formatArray(value, seenValues, options)
end
return formatObject(value, seenValues, options)
end
function formatObject(object, seenValues, options: FormatOptions)
local result = ""
local mt = getmetatable(object)
if mt and rawget(mt, "__tostring") then
return tostring(object)
end
local fragmentedKeys, fragmentedKeysLength, keysLength = getFragmentedKeys(object)
if keysLength == 0 and fragmentedKeysLength == 0 then
result ..= "{}"
return result
end
if #seenValues > options.depth then
result ..= "[" .. getObjectTag(object) .. "]"
return result
end
local properties = {}
for i = 1, keysLength do
local value = formatValue(object[i], seenValues, options)
table.insert(properties, value)
end
for i = 1, fragmentedKeysLength do
local key = fragmentedKeys[i]
local value = formatValue(object[key], seenValues, options)
table.insert(properties, key .. ": " .. value)
end
result ..= "{ " .. table.concat(properties, ", ") .. " }"
return result
end
function formatArray(array: Array<any>, seenValues: Array<any>, options: FormatOptions): string
local length = #array
if length == 0 then
return "[]"
end
if #seenValues > options.depth then
return "[Array]"
end
local len = math.min(MAX_ARRAY_LENGTH, length)
local remaining = length - len
local items = {}
for i = 1, len do
items[i] = (formatValue(array[i], seenValues, options))
end
if remaining == 1 then
table.insert(items, "... 1 more item")
elseif remaining > 1 then
table.insert(items, ("... %s more items"):format(tostring(remaining)))
end
return "[" .. table.concat(items, ", ") .. "]"
end
function getObjectTag(_object): string
-- local tag = Object.prototype.toString
-- .call(object)
-- .replace("")
-- .replace("")
-- if tag == "Object" and typeof(object.constructor) == "function" then
-- local name = object.constructor.name
-- if typeof(name) == "string" and name ~= "" then
-- return name
-- end
-- end
-- return tag
return "Object"
end
return inspect
|
-- 2
|
module.SortAggregation.PastWeek = 3
module.SortAggregation.PastMonth = 4
module.SortAggregation.AllTime = 5
module.SortType = {}
module.SortType.Relevance = 0
module.SortType.Favorited = 1
module.SortType.Sales = 2
module.SortType.Updated = 3
module.SortType.PriceAsc = 4
module.SortType.PriceDesc = 5
module.Subcategory = {}
module.Subcategory.Featured = 0
module.Subcategory.All = 1
module.Subcategory.Collectibles = 2
module.Subcategory.Clothing = 3
module.Subcategory.BodyParts = 4
module.Subcategory.Gear = 5
|
------------------------------------------------------------------------------------
|
local WaitTime = 1 -- Change this to the amount of time it takes for the button to re-enable.
local modelname = "Tren" -- If your model is not named this, then make the purple words the same name as the model!
|
--// This section of code waits until all of the necessary RemoteEvents are found in EventFolder.
--// I have to do some weird stuff since people could potentially already have pre-existing
--// things in a folder with the same name, and they may have different class types.
--// I do the useEvents thing and set EventFolder to useEvents so I can have a pseudo folder that
--// the rest of the code can interface with and have the guarantee that the RemoteEvents they want
--// exist with their desired names.
|
local FILTER_MESSAGE_TIMEOUT = 60
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Chat = game:GetService("Chat")
local StarterGui = game:GetService("StarterGui")
local DefaultChatSystemChatEvents = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local EventFolder = ReplicatedStorage:WaitForChild("DefaultChatSystemChatEvents")
local clientChatModules = Chat:WaitForChild("ClientChatModules")
local ChatConstants = require(clientChatModules:WaitForChild("ChatConstants"))
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local messageCreatorModules = clientChatModules:WaitForChild("MessageCreatorModules")
local MessageCreatorUtil = require(messageCreatorModules:WaitForChild("Util"))
local numChildrenRemaining = 10 -- #waitChildren returns 0 because it's a dictionary
local waitChildren =
{
OnNewMessage = "RemoteEvent",
OnMessageDoneFiltering = "RemoteEvent",
OnNewSystemMessage = "RemoteEvent",
OnChannelJoined = "RemoteEvent",
OnChannelLeft = "RemoteEvent",
OnMuted = "RemoteEvent",
OnUnmuted = "RemoteEvent",
OnMainChannelSet = "RemoteEvent",
SayMessageRequest = "RemoteEvent",
GetInitDataRequest = "RemoteFunction",
}
|
--// wonuf
|
wait()
local WeldHoldPart = script.Parent.Parent.Part
function weld(c1,c2)
local w = Instance.new("Weld")
w.Part0 = c1
w.Part1 = c2
w.C1 = c2.CFrame:inverse() * c1.CFrame
w.Parent = c1
c2.Anchored = false
end
function scan(obj)
for _,v in pairs(obj:GetChildren()) do
if v:IsA('BasePart') then
weld(WeldHoldPart, v)
scan(v)
elseif v:IsA('Model') then
scan(v)
end
end
end
scan(script.Parent)
|
-- byte stm_byte(Stream S)
-- @S - Stream object to read from
|
local function stm_byte(S)
local idx = S.index
local bt = S.source:byte(idx, idx)
S.index = idx + 1
return bt
end
|
-- Define the function to open or close the window with gene-alike effect
|
local function toggleWindow()
if window.Visible then
window.Visible = false
opened.Visible = false
-- Close the window by tweening back to the button position and size
window:TweenSizeAndPosition(
UDim2.new(0, 0, 0, 0),
UDim2.new(0, aFinderButton.AbsolutePosition.X, 0, aFinderButton.AbsolutePosition.Y),
'Out',
'Quad',
0.5,
false,
function()
window.Visible = false
end
)
end
end
|
-- Gradually regenerates the Humanoid's Health over time.
|
local REGEN_RATE = 1000/1000 -- Regenerate this fraction of MaxHealth per second.
local REGEN_STEP = 0.1 -- Wait this long between each regeneration step.
|
--Public developer facing functions
|
function ClickToMove:SetShowPath(value)
ShowPath = value
end
function ClickToMove:GetShowPath()
return ShowPath
end
function ClickToMove:SetWaypointTexture(texture)
ClickToMoveDisplay.SetWaypointTexture(texture)
end
function ClickToMove:GetWaypointTexture()
return ClickToMoveDisplay.GetWaypointTexture()
end
function ClickToMove:SetWaypointRadius(radius)
ClickToMoveDisplay.SetWaypointRadius(radius)
end
function ClickToMove:GetWaypointRadius()
return ClickToMoveDisplay.GetWaypointRadius()
end
function ClickToMove:SetEndWaypointTexture(texture)
ClickToMoveDisplay.SetEndWaypointTexture(texture)
end
function ClickToMove:GetEndWaypointTexture()
return ClickToMoveDisplay.GetEndWaypointTexture()
end
function ClickToMove:SetWaypointsAlwaysOnTop(alwaysOnTop)
ClickToMoveDisplay.SetWaypointsAlwaysOnTop(alwaysOnTop)
end
function ClickToMove:GetWaypointsAlwaysOnTop()
return ClickToMoveDisplay.GetWaypointsAlwaysOnTop()
end
function ClickToMove:SetFailureAnimationEnabled(enabled)
PlayFailureAnimation = enabled
end
function ClickToMove:GetFailureAnimationEnabled()
return PlayFailureAnimation
end
function ClickToMove:SetIgnoredPartsTag(tag)
UpdateIgnoreTag(tag)
end
function ClickToMove:GetIgnoredPartsTag()
return CurrentIgnoreTag
end
function ClickToMove:SetUseDirectPath(directPath)
UseDirectPath = directPath
end
function ClickToMove:GetUseDirectPath()
return UseDirectPath
end
function ClickToMove:SetAgentSizeIncreaseFactor(increaseFactorPercent)
AgentSizeIncreaseFactor = 1.0 + (increaseFactorPercent / 100.0)
end
function ClickToMove:GetAgentSizeIncreaseFactor()
return (AgentSizeIncreaseFactor - 1.0) * 100.0
end
function ClickToMove:SetUnreachableWaypointTimeout(timeoutInSec)
UnreachableWaypointTimeout = timeoutInSec
end
function ClickToMove:GetUnreachableWaypointTimeout()
return UnreachableWaypointTimeout
end
function ClickToMove:SetUserJumpEnabled(jumpEnabled)
self.jumpEnabled = jumpEnabled
if self.touchJumpController then
self.touchJumpController:Enable(jumpEnabled)
end
end
function ClickToMove:GetUserJumpEnabled()
return self.jumpEnabled
end
function ClickToMove:MoveTo(position, showPath, useDirectPath)
local character = Player.Character
if character == nil then
return false
end
local thisPather = Pather(position, Vector3.new(0, 1, 0), useDirectPath)
if thisPather and thisPather:IsValidPath() then
if FFlagUserClickToMoveFollowPathRefactor then
-- Clean up previous path
CleanupPath()
end
HandleMoveTo(thisPather, position, nil, character, showPath)
return true
end
return false
end
return ClickToMove
|
---[[ Chat Behaviour Settings ]]
|
module.WindowDraggable = true
module.WindowResizable = true
module.ShowChannelsBar = false
module.GamepadNavigationEnabled = false
module.AllowMeCommand = false -- Me Command will only be effective when this set to true
module.ShowUserOwnFilteredMessage = true --Show a user the filtered version of their message rather than the original.
|
-----------------------------------
|
elseif script.Parent.Parent.Parent.TrafficControl.Value == "" then
for i = 1,#grp1 do
grp1[i].Lighto.Enabled = false
end
for i = 1,#grp1 do
grp1[i].Transparency = 1
end
for i = 1,#grp2 do
grp2[i].Lighto.Enabled = false
end
for i = 1,#grp2 do
grp2[i].Transparency = 1
end
for i = 1,#grp3 do
grp3[i].Lighto.Enabled = false
end
for i = 1,#grp3 do
grp3[i].Transparency = 1
end
for i = 1,#grp4 do
grp4[i].Transparency = 0
end
for i = 1,#grp4 do
grp4[i].Lighto.Enabled = true
end
end
end
|
-- Arms
|
character.LeftUpperArm.Material = Material
character.RightUpperArm.Material = Material
character.LeftLowerArm.Material = Material
character.RightLowerArm.Material = Material
|
--[[**
Adds an `Object` to Janitor for later cleanup, where `MethodName` is the key of the method within `Object` which should be called at cleanup time. If the `MethodName` is `true` the `Object` itself will be called instead. If passed an index it will occupy a namespace which can be `Remove()`d or overwritten. Returns the `Object`.
@param [t:any] Object The object you want to clean up.
@param [t:string|true?] MethodName The name of the method that will be used to clean up. If not passed, it will first check if the object's type exists in TypeDefaults, and if that doesn't exist, it assumes `Destroy`.
@param [t:any?] Index The index that can be used to clean up the object manually.
@returns [t:any] The object that was passed.
**--]]
|
function Janitor.__index:Add(Object, MethodName, Index)
if Index then
self:Remove(Index)
local This = self[IndicesReference]
if not This then
This = {}
self[IndicesReference] = This
end
This[Index] = Object
end
MethodName = MethodName or TypeDefaults[typeof(Object)] or "Destroy"
if type(Object) ~= "function" and not Object[MethodName] then
warn(string.format(METHOD_NOT_FOUND_ERROR, tostring(Object), tostring(MethodName), debug.traceback(nil, 2)))
end
self[Object] = MethodName
return Object
end
|
----------------------------------------------------------------------
--------------------[ TWEENJOINT HANDLING ]---------------------------
----------------------------------------------------------------------
|
local createTweenIndicator = script:WaitForChild("createTweenIndicator")
function createTweenIndicator.OnServerInvoke(_, Joint, newCode)
local tweenIndicator = nil
if (not Joint:findFirstChild("tweenCode")) then --If the joint isn't being tweened, then
tweenIndicator = Instance.new("IntValue")
tweenIndicator.Name = "tweenCode"
tweenIndicator.Value = newCode
tweenIndicator.Parent = Joint
else
tweenIndicator = Joint.tweenCode
tweenIndicator.Value = newCode --If the joint is already being tweened, this will change the code, and the tween loop will stop
end
return tweenIndicator
end
local lerpCF = script:WaitForChild("lerpCF")
function lerpCF.OnServerInvoke(_, Joint, Prop, startCF, endCF, Alpha)
spawn(function()
Joint[Prop] = startCF:lerp(endCF, Alpha)
end)
end
local deleteTweenIndicator = script:WaitForChild("deleteTweenIndicator")
function deleteTweenIndicator.OnServerInvoke(_, tweenIndicator, newCode)
if tweenIndicator.Value == newCode then --If this tween functions was the last one called on a joint then it will remove the code
tweenIndicator:Destroy()
end
end
|
-- list of account names allowed to go through the door.
|
permission = { "Februar92", "Lumpizerstoerer" } --Put your friends name's here. You can add more.
function checkOkToLetIn(name)
for i = 1,#permission do
-- convert strings to all upper case, otherwise we will let in,
-- "Telamon," but not, "tELAMON," or, "telamon."
-- Why? Because, "Telamon," is how it is spelled in the permissions.
if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end
local Door = script.Parent
function onTouched(hit)
print("Door Hit")
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil ) then
-- a human has touched this door!
print("Human touched door")
-- test the human's name against the permission list
if (checkOkToLetIn(human.Parent.Name)) then
print("Human passed test")
Door.Transparency = 0.5
Door.CanCollide = false
wait(1.5) -- this is how long the door is open
Door.CanCollide = true
Door.Transparency = 0
else human.Health= 0 -- delete this line of you want a non-killing VIP door
end
end
end
script.Parent.Touched:connect(onTouched)
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Lilac",Paint)
end)
|
-- Darken Functions
|
local function darkenScreen()
darken.Visible = true
TweenService:Create(darken, Bar_Button_TweenInfo, {BackgroundTransparency = 0.3}):Play()
end
local function lightenScreen()
TweenService:Create(darken, Bar_Button_TweenInfo, {BackgroundTransparency = 1}):Play()
task.wait(0.3)
darken.Visible = false
end
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 670 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 800 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 8000 -- Use sliders to manipulate values
Tune.Redline = 9000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 6100
Tune.PeakSharpness = 3.8
Tune.CurveMult = 0.07
--Incline Compensation
Tune.InclineComp = 1.5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 450 -- RPM acceleration when clutch is off
Tune.RevDecay = 150 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
-- Game services
|
local Configurations = require(game.ServerStorage.Configurations)
local DisplayManager = require(script.Parent.DisplayManager)
|
--[[ alexnewtron 2014 ]]
|
--
local c = {
p = game.Players.LocalPlayer,
h = game.Players.LocalPlayer.Character:findFirstChild("Humanoid"),
debris=game:GetService("Debris"),
c = script:WaitForChild("creator")
};
function c.r()
for i,v in ipairs(c.h:GetChildren()) do
if v.Name=="creator" then
v:Destroy()
end
end
local creator_tag=Instance.new("ObjectValue");
creator_tag.Value=c.c.Value;
creator_tag.Name="creator";
creator_tag.Parent=c.h;
end
if (c.h ~= nil) then
for i=1, 5 do
c.r();
c.h:TakeDamage(13);
wait(1.5);
end
end
script:Destroy();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.