prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
-- { id = "slash.xml", weight = 10 }
|
},
toollunge = {
{ id = "http://www.roblox.com/asset/?id=129967478", weight = 10 }
},
wave = {
{ id = "http://www.roblox.com/asset/?id=128777973", weight = 10 }
},
point = {
{ id = "http://www.roblox.com/asset/?id=128853357", weight = 10 }
},
dance = {
{ id = "http://www.roblox.com/asset/?id=182435998", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491037", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491065", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=182436842", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491248", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491277", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=182436935", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491368", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=182491423", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=129423131", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=129423030", weight = 10 }
},
}
|
--[=[
Destroys the RemoteSignal object.
]=]
|
function RemoteSignal:Destroy()
self._re:Destroy()
if self._signal then
self._signal:Destroy()
end
end
|
--F.reverseLights = function(Tog)
-- for i,v in pairs(script.Parent.Parent.Parent:getChildren()) do
-- if v:FindFirstChild('Reverse') then
-- v.Braking.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
-- v.Lights.Enabled = (carSeat.Ignition.Value == 1 and Tog or false)
-- end
-- end
--end
| |
-- Etc
|
local DESTROY_ON_DEATH = getValueFromConfig("DestroyOnDeath")
local RAGDOLL_ENABLED = getValueFromConfig("RagdollEnabled")
local DEATH_DESTROY_DELAY = 1
local PATROL_WALKSPEED = 16
local MIN_REPOSITION_TIME = 1
local MAX_REPOSITION_TIME = 5
local MAX_PARTS_PER_HEARTBEAT = 50
local ATTACK_STAND_TIME = 1
local HITBOX_SIZE = Vector3.new(5, 3, 5)
local SEARCH_DELAY = 1
local ATTACK_RANGE = 5
local ATTACK_DELAY = 1
local ATTACK_MIN_WALKSPEED = 16
local ATTACK_MAX_WALKSPEED = 36
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames: { [string]: boolean } =
{ }
function configureAnimationSet(name: string, fileList: { { id: string, weight: number } })
if animTable[name] ~= nil then
for _, connection in ipairs(animTable[name].connections) do
connection:Disconnect()
end
end
animTable[name] = {} :: any
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
-- check for config values
local config = script:FindFirstChild(name)
if config ~= nil then
-- print("Loading anims " .. name)
table.insert(
animTable[name].connections,
config.ChildAdded:Connect(function(child)
configureAnimationSet(name, fileList)
end)
)
table.insert(
animTable[name].connections,
config.ChildRemoved:Connect(function(child)
configureAnimationSet(name, fileList)
end)
)
local idx = 1
for _, childPart in ipairs(config:GetChildren()) do
if childPart:IsA("Animation") then
table.insert(
animTable[name].connections,
childPart.Changed:Connect(function(property)
configureAnimationSet(name, fileList)
end)
)
animTable[name][idx] = {} :: any
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if weightObject == nil then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
-- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
idx = idx + 1
end
end
end
-- fallback to defaults
if animTable[name].count <= 0 then
for idx, anim in ipairs(fileList) do
animTable[name][idx] = {} :: any
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
end
end
end
|
-- string stm_string(Stream S, int len)
-- @S - Stream object to read from
-- @len - Length of string being read
|
local function stm_string(S, len)
local pos = S.index + len
local str = string.sub(S.source, S.index, pos - 1)
S.index = pos
return str
end
|
--followPath(destination)
-------------------------------------------------------------------
-------------------------------------------------------------------
-------------------------------------------------------------------
|
function AI()
if Mode == 0 then
--waypoint = nil
--print("Patrol mode")
wait(math.random(5,15)/10)
followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))
--human:MoveTo(zombie.Torso.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)), CurrentPart)
elseif Mode == 1 then
target = findNearestTorso(hroot.Position)
if target ~= nil then
if CanSee == true and (hroot.Position - target.Position).Magnitude <= MinDistance then
waypoint = nil
else
path:ComputeAsync(hroot.Position, target.Position)
waypoint = path:GetWaypoints()
local connection;
local function checkw(t)
local ci = 3
if ci > #t then
ci = 3
end
if t[ci] == nil and ci < #t then
repeat ci = ci + 1 wait() until t[ci] ~= nil
return Vector3.new(1,0,0) + t[ci]
else
ci = 3
return t[ci]
end
end
if path.Status == Enum.PathStatus.Success then
--print("Chasing "..target.Parent.Name)
human.WalkToPart = nil
if waypoint or checkw(waypoint) then
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
human:MoveTo( checkw(waypoint).Position)
end
if connection then
connection:Disconnect()
end
else
for i = 3, #waypoint do
human:MoveTo( waypoint[i].Position )
end
end
else
--print("No Path,Patrolling")
wait(math.random(5,15)/10)
followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))
end
end
end
elseif Mode == 2 then
target = findNearestTorso(hroot.Position)
if target ~= nil then
if CanSee == true and (hroot.Position - target.Position).Magnitude <= MinDistance then
waypoint = {}
waypoint = nil
else
path:ComputeAsync(hroot.Position, target.Position)
waypoint = path:GetWaypoints()
local connection;
local function checkw(t)
local ci = 3
if ci > #t then
ci = 3
end
if t[ci] == nil and ci < #t then
repeat ci = ci + 1 wait() until t[ci] ~= nil
return Vector3.new(1,0,0) + t[ci]
else
ci = 3
return t[ci]
end
end
if path.Status == Enum.PathStatus.Success and Memory > 0 then
--print("Chasing "..target.Parent.Name)
human.WalkToPart = nil
if waypoint or checkw(waypoint) then
if checkw(waypoint) ~= nil and checkw(waypoint).Action == Enum.PathWaypointAction.Walk then
human:MoveTo( checkw(waypoint).Position )
end
if connection then
connection:Disconnect()
end
else
for i = 3, #waypoint do
human:MoveTo( waypoint[i].Position )
end
end
else
waypoint = nil
--print("No Path,Patrolling")
wait(math.random(5,15)/10)
followPath(hroot.Position + Vector3.new(math.random(-MaxInc, MaxInc), 0, math.random(-MaxInc, MaxInc)))
end
end
end
elseif Mode == 3 then
-- print("Guarding")
end
end
|
--[=[
Saves all stored data.
@return Promise
]=]
|
function DataStore:Save()
if self:DidLoadFail() then
warn("[DataStore] - Not saving, failed to load")
return Promise.rejected("Load not successful, not saving")
end
if DEBUG_WRITING then
print("[DataStore.Save] - Starting save routine")
end
-- Avoid constructing promises for every callback down the datastore
-- upon save.
return (self:_promiseInvokeSavingCallbacks() or Promise.resolved())
:Then(function()
if not self:HasWritableData() then
-- Nothing to save, don't update anything
if DEBUG_WRITING then
print("[DataStore.Save] - Not saving, nothing staged")
end
return nil
else
return self:_saveData(self:GetNewWriter())
end
end)
end
|
--[[--------------------------------------------------------------------
-- Notes:
-- * some unused C code that were not converted are kept as comments
-- * LUA_COMPAT_VARARG option changed into a comment block
-- * for value/size specific code added, look for 'NOTE: '
--
-- Not implemented:
-- * luaX_newstring not needed by this Lua implementation
-- * luaG_checkcode() in assert is not currently implemented
--
-- Added:
-- * some constants added from various header files
-- * luaY.LUA_QS used in error_expected, check_match (from luaconf.h)
-- * luaY:LUA_QL needed for error messages (from luaconf.h)
-- * luaY:growvector (from lmem.h) -- skeleton only, limit checking
-- * luaY.SHRT_MAX (from <limits.h>) for registerlocalvar
-- * luaY:newproto (from lfunc.c)
-- * luaY:int2fb (from lobject.c)
-- * NOTE: HASARG_MASK, for implementing a VARARG_HASARG bit operation
-- * NOTE: value-specific code for VARARG_NEEDSARG to replace a bitop
--
-- Changed in 5.1.x:
-- * various code changes are not detailed...
-- * names of constants may have changed, e.g. added a LUAI_ prefix
-- * struct expkind: added VKNUM, VVARARG; VCALL's info changed?
-- * struct expdesc: added nval
-- * struct FuncState: upvalues data type changed to upvaldesc
-- * macro hasmultret is new
-- * function checklimit moved to parser from lexer
-- * functions anchor_token, errorlimit, checknext are new
-- * checknext is new, equivalent to 5.0.x's check, see check too
-- * luaY:next and luaY:lookahead moved to lexer
-- * break keyword no longer skipped in luaY:breakstat
-- * function new_localvarstr replaced by new_localvarliteral
-- * registerlocalvar limits local variables to SHRT_MAX
-- * create_local deleted, new_localvarliteral used instead
-- * constant LUAI_MAXUPVALUES increased to 60
-- * constants MAXPARAMS, LUA_MAXPARSERLEVEL, MAXSTACK removed
-- * function interface changed: singlevaraux, singlevar
-- * enterlevel and leavelevel uses nCcalls to track call depth
-- * added a name argument to main entry function, luaY:parser
-- * function luaY_index changed to yindex
-- * luaY:int2fb()'s table size encoding format has been changed
-- * luaY:log2() no longer needed for table constructors
-- * function code_params deleted, functionality folded in parlist
-- * vararg flags handling (is_vararg) changes; also see VARARG_*
-- * LUA_COMPATUPSYNTAX section for old-style upvalues removed
-- * repeatstat() calls chunk() instead of block()
-- * function interface changed: cond, test_then_block
-- * while statement implementation considerably simplified; MAXEXPWHILE
-- and EXTRAEXP no longer required, no limits to the complexity of a
-- while condition
-- * repeat, forbody statement implementation has major changes,
-- mostly due to new scoping behaviour of local variables
-- * OPR_MULT renamed to OPR_MUL
----------------------------------------------------------------------]]
| |
--if i.KeyCode == Enum.KeyCode.G then REvent:FireServer("G",true) end
|
end
end)
UIS.InputEnded:connect(function(i,GP)
if not GP then
if i.KeyCode == Enum.KeyCode.H then REvent:FireServer("H",false) end
end
end)
|
--[[
ROBLOX deviation START chalk_supportsColor: chalk.supportsColor isn't defined so we'll assume
it supports colors unless it is explicitly set to false
]]
|
local FAIL = if chalk.supportsColor == nil or chalk.supportsColor == true
then chalk.reset(chalk.inverse(chalk.bold(chalk.red(string.format(" %s ", FAIL_TEXT)))))
else FAIL_TEXT
local PASS = if chalk.supportsColor == nil or chalk.supportsColor == true
then chalk.reset(chalk.inverse(chalk.bold(chalk.green(string.format(" %s ", PASS_TEXT)))))
else PASS_TEXT
|
--------LEFT DOOR --------
|
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value)
game.Workspace.Lighting.flashcurrent.Value = "11"
|
--[=[
Returns the packed values from table.pack() format
@since 3.6.0
@return { n: number, ... T }
]=]
|
function Brio:GetPackedValues()
assert(self._values, "Brio is dead")
return self._values
end
|
--[=[
@param msg string
@return value: any
Unwraps the value in the option, otherwise throws an error with `msg` as the error message.
```lua
local opt = Option.Some(10)
print(opt:Expect("No number")) -> 10
print(Option.None:Expect("No number")) -- Throws an error "No number"
```
]=]
|
function Option:Expect(msg)
assert(self:IsSome(), msg)
return self._v
end
|
--[[
MessageCreator:DisplayFullScreenMessage(Message)
Displays a message on the center of the screen
--]]
|
local MessageCreator = {}
local LogoURL = "http://www.roblox.com/asset/?id=1499731139"
local MessageHeightRelative = 0.15
local MessageDisplayTime = 3
function MessageCreator:DisplayFullScreenMessage(Message)
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Parent = game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")
local Logo = Instance.new("ImageLabel")
Logo.SizeConstraint = "RelativeYY"
Logo.Position = UDim2.new(0.5,0,0.5,0)
Logo.AnchorPoint = Vector2.new(0.5,0.5)
Logo.BackgroundTransparency = 1
Logo.Size = UDim2.new(0,0,0,0)
Logo.Image = LogoURL
Logo.Parent = ScreenGui
local TextClips = Instance.new("Frame")
TextClips.Size = UDim2.new(0,0,MessageHeightRelative,0)
TextClips.Position = UDim2.new(0.5,0,0.8,0)
TextClips.AnchorPoint = Vector2.new(0.5,0)
TextClips.BackgroundTransparency = 1
TextClips.ClipsDescendants = true
TextClips.Parent = Logo
local Text = Instance.new("TextLabel")
Text.Size = UDim2.new(14 * (0.1 / MessageHeightRelative),0,1,0)
Text.Position = UDim2.new(0.5,0,0,0)
Text.AnchorPoint = Vector2.new(0.5,0)
Text.SizeConstraint = "RelativeYY"
Text.BackgroundTransparency = 1
Text.Font = "SourceSansBold"
Text.TextColor3 = Color3.new(1,1,1)
Text.TextStrokeColor3 = Color3.new(0,0,0)
Text.TextStrokeTransparency = 0
Text.TextScaled = true
Text.Text = Message
Text.Parent = TextClips
Logo:TweenSize(UDim2.new(0.6,0,0.6,0),"InOut","Quad",0.5,true,function()
TextClips:TweenSize(UDim2.new(1.4,0,MessageHeightRelative,0),"InOut","Quad",0.5,true,function()
wait(MessageDisplayTime)
TextClips:TweenSize(UDim2.new(0,0,MessageHeightRelative,0),"InOut","Quad",0.5,true,function()
Logo:TweenSize(UDim2.new(0,0,0,0),"InOut","Quad",0.5,true,function()
ScreenGui:Destroy()
end)
end)
end)
end)
end
return MessageCreator
|
--[[Drivetrain]]
|
Tune.Config = "AWD" --"FWD" , "RWD" , "AWD"
--Differential Settings
Tune.FDiffSlipThres = 50 -- 1 - 100% (Max threshold of applying full lock determined by deviation from avg speed)
Tune.FDiffLockThres = 50 -- 0 - 100% (0 - Bias toward slower wheel, 100 - Bias toward faster wheel)
Tune.RDiffSlipThres = 50 -- 1 - 100%
Tune.RDiffLockThres = 50 -- 0 - 100%
Tune.CDiffSlipThres = 50 -- 1 - 100% [AWD Only]
Tune.CDiffLockThres = 50 -- 0 - 100% [AWD Only]
--Traction Control Settings
Tune.TCSEnabled = true -- Implements TCS
Tune.TCSThreshold = 10 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
|
-- Initialize move tool
|
local MoveTool = require(CoreTools:WaitForChild 'Move');
Core.AssignHotkey('Z', Core.Support.Call(Core.EquipTool, MoveTool));
Core.Dock.AddToolButton(Core.Assets.MoveIcon, 'Z', MoveTool, 'MoveInfo');
|
----- Initialize -----
|
if IsStudio == true then
IsLiveCheckActive = true
coroutine.wrap(function()
local status, message = pcall(function()
-- This will error if current instance has no Studio API access:
DataStoreService:GetDataStore("____PS"):SetAsync("____PS", os.time())
end)
local no_internet_access = status == false and string.find(message, "ConnectFail", 1, true) ~= nil
if no_internet_access == true then
warn("[ProfileService]: No internet access - check your network connection")
end
if status == false and
(string.find(message, "403", 1, true) ~= nil or -- Cannot write to DataStore from studio if API access is not enabled
string.find(message, "must publish", 1, true) ~= nil or -- Game must be published to access live keys
no_internet_access == true) then -- No internet access
UseMockDataStore = true
ProfileService._use_mock_data_store = true
print("[ProfileService]: Roblox API services unavailable - data will not be saved")
else
print("[ProfileService]: Roblox API services available - data will be saved")
end
IsLiveCheckActive = false
end)()
end
|
-- Sound variables
|
local RunSoundVol = 0.5
local RunSoundPitchLimit = 1.25
|
-- This has to be done so that camera occlusion ignores the vehcile.
|
local function updateCameraSubject()
local humanoid = getLocalHumanoid()
if humanoid and humanoid.SeatPart then
Workspace.CurrentCamera.CameraSubject = humanoid.SeatPart
end
end
updateCameraSubject()
ProximityPromptService.Enabled = false
|
-- поиск себя
|
function waitForChild(parent, childName)
local child = parent:findFirstChild(childName)
if child then
return child
end
while true do
print(childName)
child = parent.ChildAdded:wait()
if child.Name==childName then
return child
end
end
end
|
--[[
if not service.UserInputService.KeyboardEnabled then
warn("User is on mobile :: CustomChat Disabled")
chatenabled = true
drag.Visible = false
service.StarterGui:SetCoreGuiEnabled('Chat',true)
end
--]]
|
client.Handlers.RemoveCustomChat = function()
local chat = gui
if chat then
chat:Destroy()
client.Variables.ChatEnabled = true
service.StarterGui:SetCoreGuiEnabled('Chat', true)
end
end
client.Handlers.ChatHandler = function(plr, message, mode)
if not message then
return
end
if string.sub(message, 1, 2) == '/e' then
return
end
if gui then
local player
if plr and type(plr) == "userdata" then
player = plr
else
player = {
Name = tostring(plr or "System"),
TeamColor = BrickColor.White()
}
end
if #message > 150 then
message = `{string.sub(message, 1, 150)}...`
end
if mode then
if mode == "Private" or mode == "System" then
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = player.Name,
Message = message,
Mode = "Global",
Private = true
})
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = player.Name,
Message = message,
Mode = "Team",
Private = true
})
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = player.Name,
Message = message,
Mode = "Local",
Private = true
})
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = player.Name,
Message = message,
Mode = "Admins",
Private = true
})
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = player.Name,
Message = message,
Mode = "Cross",
Private = true
})
else
local plr = player.Name
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = plr,
Message = message,
Mode = mode
})
end
else
local plr = player.Name
table.insert(storedChats, {
Color = player.TeamColor or BrickColor.White(),
Player = plr,
Message = message,
Mode = "Global"
})
end
if mode == "Local" then
if not localTab.Visible then
localb.Text = "Local*"
end
elseif mode == "Team" then
if not teamTab.Visible then
team.Text = "Team*"
end
elseif mode == "Admins" then
if not adminsTab.Visible then
admins.Text = "Admins*"
end
elseif mode == "Cross" then
if not crossTab.Visible then
cross.Text = "Cross*"
end
else
if not globalTab.Visible then
global.Text = "Global*"
end
end
if #storedChats >= 50 then
table.remove(storedChats, 1)
end
UpdateChat()
if not nohide then
if player and type(player) == "userdata" then
local char = player.Character
local head = char:FindFirstChild("Head")
if head then
local cont = service.LocalContainer():FindFirstChild(`{player.Name}Bubbles`)
if not cont then
cont = Instance.new("BillboardGui", service.LocalContainer())
cont.Name = `{player.Name}Bubbles`
cont.StudsOffset = Vector3.new(0, 2, 0)
cont.SizeOffset = Vector2.new(0, 0.5)
cont.Size = UDim2.new(0, 200, 0, 150)
end
cont.Adornee = head
local clone = bubble:Clone()
clone.TextLabel.Text = message
clone.Parent = cont
local xsize = clone.TextLabel.TextBounds.X + 40
if xsize > 400 then
xsize = 400
end
clone.Size = UDim2.new(0, xsize, 0, 50)
if #cont:GetChildren() > 3 then
cont:GetChildren()[1]:Destroy()
end
for i, v in cont:GetChildren() do
local xsize = v.TextLabel.TextBounds.X + 40
if xsize > 400 then
xsize = 400
end
v.Position = UDim2.new(0.5, -xsize / 2, 1, -(math.abs((i - 1) - #cont:GetChildren()) * 50))
end
local cam = workspace.CurrentCamera
local char = player.Character
local head = char:FindFirstChild("Head")
Routine(function()
repeat
if not head then
break
end
local dist = (head.Position - cam.CFrame.p).Magnitude
if dist <= 50 then
clone.Visible = true
else
clone.Visible = false
end
task.wait(0.1)
until not clone.Parent or not clone or not head or not head.Parent or not char
end)
task.wait(10)
if clone then
clone:Destroy()
end
end
end
end
end
end
local textbox = service.UserInputService:GetFocusedTextBox()
if textbox then
textbox:ReleaseFocus()
end
end
|
--!nonstrict
|
local Slider = {
Sliders = {}
}
local RunService = game:GetService("RunService")
if not RunService:IsClient() then
error("Slider module can only be used on the Client!", 2)
return nil
end
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local Clamp = math.clamp
local Floor = math.floor
local Min = math.min
local Max = math.max
local Round = math.round
local Lower = string.lower
local Upper = string.upper
local Sub = string.sub
local Format = string.format
local Signal = require(script.Parent.Signal)
Slider.__index = function(object, indexed)
local deprecated = {
{".OnChange", ".Changed", object.Changed}
}
for _, tbl in ipairs(deprecated) do
local deprecatedStr = Sub(tbl[1], 2)
if deprecatedStr == indexed then
warn(Format("%s is deprecated, please use %s instead", tbl[1], tbl[2]))
return tbl[3]
end
end
return Slider[indexed]
end
export type sliderConfigDictionary = {[string]: number}
function snapToScale(val, step)
return Clamp(Floor(val / step) * step, 0, 1)
end
function lerp(start, finish, percent)
return (1 - percent) * start + percent * finish
end
function map(value, start, stop, newStart, newEnd, constrain)
local newVal = lerp(newStart, newEnd, getAlphaBetween(start, stop, value))
if not constrain then
return newVal
end
if newStart < newEnd then
newStart, newEnd = newEnd, newStart
end
return Max(Min(newVal, newStart), newEnd)
end
function getNewPosition(self, percent)
local absoluteSize = self._button.AbsoluteSize[self._axis]
local holderSize = self._holder.AbsoluteSize[self._axis]
local anchorPoint = self._button.AnchorPoint[self._axis]
local paddingScale = (self._padding / holderSize)
local minScale = (
(anchorPoint * absoluteSize) / holderSize +
paddingScale
)
local decrement = ((2 * absoluteSize) * anchorPoint) - absoluteSize
local maxScale = (1 - minScale) + (decrement / holderSize)
local newPercent = map(percent or self._percent, 0, 1, minScale, maxScale, true)
if self._axis == "X" then
return UDim2.new(newPercent, self._button.Position.X.Offset, self._button.Position.Y.Scale, self._button.Position.Y.Offset)
elseif self._axis == "Y" then
return UDim2.fromScale(self._button.Position.X.Scale, newPercent)
end
end
function getScaleIncrement(self)
return 1 / ((self._config.End - self._config.Start) / self._config.Increment)
end
function getAlphaBetween(a, b, c)
return (c - a) / (b - a)
end
function getNewValue(self)
local newValue = lerp(self._config.Start, self._config.End, self._percent)
local incrementScale = (1 / self._config.Increment)
newValue = Floor(newValue * incrementScale) / incrementScale
return newValue
end
function Slider.new(holder: any, configuration: sliderConfigDictionary, moveTweenInfo: TweenInfo, axis: string, padding: number)
assert(pcall(function()
return holder.AbsoluteSize, holder.AbsolutePosition
end), "Holder argument does not have an AbsoluteSize/AbsolutePosition")
local sliderBtn = holder:FindFirstChild("Slider")
assert(sliderBtn ~= nil, "Failed to find slider button.")
assert(sliderBtn:IsA("GuiButton"), "Slider is not a GuiButton")
local duplicate = false
for _, slider in ipairs(Slider.Sliders) do
if slider._holder == holder then
duplicate = true
break
end
end
assert(not duplicate, "Cannot set two sliders with same frame!")
assert(configuration.Increment ~= nil, "Failed to find Increment in configuration table")
assert(configuration.Start ~= nil, "Failed to find Start in configuration table")
assert(configuration.End ~= nil, "Failed to find End in configuration table")
assert(configuration.Increment > 0, "Increment must be greater than 0")
assert(configuration.End > configuration.Start, `Config.End must be greater than Config.Start ({configuration.End} <= {configuration.Start})`)
axis = axis or "x"
axis = Lower(axis)
assert(axis == "x" or axis == "y", "Axis must be X or Y!")
assert(typeof(moveTweenInfo) == "TweenInfo", "MoveTweenInfo must be a TweenInfo object!")
padding = padding or 5
assert(type(padding) == "number", "Padding variable must be a number!")
local self = setmetatable({}, Slider)
self._holder = holder
self._button = sliderBtn
self._config = configuration
self._axis = Upper(axis)
self._padding = padding
self.IsHeld = false
self._mainConnection = nil
self._buttonConnections = {}
self._inputPos = nil
self._percent = 0
if configuration.DefaultValue then
configuration.DefaultValue = Clamp(configuration.DefaultValue, configuration.Start, configuration.End)
self._percent = getAlphaBetween(configuration.Start, configuration.End, configuration.DefaultValue)
end
self._percent = Clamp(self._percent, 0, 1)
self._value = getNewValue(self)
self._scaleIncrement = getScaleIncrement(self)
self._currentTween = nil
self._tweenInfo = moveTweenInfo or TweenInfo.new(1)
self.Changed = Signal.new()
self.Dragged = Signal.new()
self.Released = Signal.new()
self:Move()
table.insert(Slider.Sliders, self)
return self
end
function Slider:Track()
for _, connection in ipairs(self._buttonConnections) do
connection:Disconnect()
end
table.insert(self._buttonConnections, self._button.MouseButton1Down:Connect(function()
self.IsHeld = true
end))
table.insert(self._buttonConnections, self._button.MouseButton1Up:Connect(function()
if self.IsHeld then
self.Released:Fire(self._value)
end
self.IsHeld = false
end))
if self.Changed then
self.Changed:Fire(self._value)
end
if self._mainConnection then
self._mainConnection:Disconnect()
end
self._mainConnection = UserInputService.InputChanged:Connect(function(inputObject, gameProcessed)
if inputObject.UserInputType == Enum.UserInputType.MouseMovement or inputObject.UserInputType == Enum.UserInputType.Touch then
self._inputPos = inputObject.Position
self:Update()
end
end)
end
function Slider:Update()
if self.IsHeld and self._inputPos then
local mousePos = self._inputPos[self._axis]
local sliderSize = self._holder.AbsoluteSize[self._axis]
local sliderPos = self._holder.AbsolutePosition[self._axis]
local newPos = snapToScale((mousePos - sliderPos) / sliderSize, self._scaleIncrement)
local percent = Clamp(newPos, 0, 1)
self._percent = percent
self:Move()
self.Dragged:Fire(self._value)
end
end
function Slider:Untrack()
for _, connection in ipairs(self._buttonConnections) do
connection:Disconnect()
end
if self._mainConnection then
self._mainConnection:Disconnect()
end
self.IsHeld = false
end
function Slider:Reset()
for _, connection in ipairs(self._buttonConnections) do
connection:Disconnect()
end
if self._mainConnection then
self._mainConnection:Disconnect()
end
self.IsHeld = false
self._percent = 0
if self._config.DefaultValue then
self._percent = getAlphaBetween(self._config.Start, self._config.End, self._config.DefaultValue)
end
self._percent = Clamp(self._percent, 0, 1)
self:Move()
end
function Slider:OverrideValue(newValue: number)
self.IsHeld = false
self._percent = getAlphaBetween(self._config.Start, self._config.End, newValue)
self._percent = Clamp(self._percent, 0, 1)
self._percent = snapToScale(self._percent, self._scaleIncrement)
self:Move()
end
function Slider:Move()
self._value = getNewValue(self)
if self._currentTween then
self._currentTween:Cancel()
end
self._currentTween = TweenService:Create(self._button, self._tweenInfo, {
Position = getNewPosition(self)
})
self._currentTween:Play()
self.Changed:Fire(self._value)
end
function Slider:OverrideVisualValue(newValue: number)
if self.IsHeld then
return false
end
local percent = getAlphaBetween(self._config.Start, self._config.End, newValue)
percent = Clamp(percent, 0, 1)
percent = snapToScale(percent, self._scaleIncrement)
if self._currentTween then
self._currentTween:Cancel()
end
self._currentTween = TweenService:Create(self._button, self._tweenInfo, {
Position = getNewPosition(self, percent)
})
self._currentTween:Play()
end
function Slider:OverrideIncrement(newIncrement: number)
self._config.Increment = newIncrement
self._scaleIncrement = getScaleIncrement(self)
self._percent = Clamp(self._percent, 0, 1)
self._percent = snapToScale(self._percent, self._scaleIncrement)
self:Move()
end
function Slider:GetValue()
return self._value
end
function Slider:GetIncrement()
return self._increment
end
function Slider:Destroy()
for _, connection in ipairs(self._buttonConnections) do
connection:Disconnect()
end
if self._mainConnection then
self._mainConnection:Disconnect()
end
self.Changed:Destroy()
self.Dragged:Destroy()
self.Released:Destroy()
for index = 1, #Slider.Sliders do
if Slider.Sliders[index] == self then
table.remove(Slider.Sliders, index)
end
end
setmetatable(self, nil)
self = nil
end
UserInputService.InputEnded:Connect(function(inputObject, internallyProcessed)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Touch then
for _, slider in ipairs(Slider.Sliders) do
if slider.IsHeld then
slider.Released:Fire(slider._value)
end
slider.IsHeld = false
end
end
end)
return Slider
|
-------------------------
|
function onClicked()
R.Function1.Disabled = true
FX.ROLL.BrickColor = BrickColor.new("CGA brown")
FX.ROLL.loop.Disabled = true
FX.REVERB.BrickColor = BrickColor.new("CGA brown")
FX.REVERB.loop.Disabled = true
FX.GATE.BrickColor = BrickColor.new("CGA brown")
FX.GATE.loop.Disabled = true
FX.PHASER.BrickColor = BrickColor.new("CGA brown")
FX.PHASER.loop.Disabled = true
FX.ECHO.BrickColor = BrickColor.new("CGA brown")
FX.ECHO.loop.Disabled = true
FX.FILTER.BrickColor = BrickColor.new("CGA brown")
FX.FILTER.loop.Disabled = true
FX.SENDRETURN.BrickColor = BrickColor.new("Really red")
FX.SENDRETURN.loop.Disabled = true
FX.TRANS.BrickColor = BrickColor.new("CGA brown")
FX.TRANS.loop.Disabled = true
FX.MultiTapDelay.BrickColor = BrickColor.new("CGA brown")
FX.MultiTapDelay.loop.Disabled = true
FX.DELAY.BrickColor = BrickColor.new("CGA brown")
FX.DELAY.loop.Disabled = true
FX.REVROLL.BrickColor = BrickColor.new("CGA brown")
FX.REVROLL.loop.Disabled = true
R.loop.Disabled = false
R.Function2.Disabled = false
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--[[Steering]]
|
Tune.SteerInner = 21 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 19 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .12 -- 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 = 1 -- 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 = 20000 -- Steering Aggressiveness
|
--Tune
|
local WheelieButton = "T"
local DeadZone = 70
|
-- definetly not a good idea loading thousands of items at once; use infinite scrolling methods if possible
|
local function loadAccessories(category)
local list = Catalog[currentCategory][category]
if list then
currentSubCategory = category
for i, v in ipairs(list) do
if v ~= nil then
local button = makeButton(v)
activeButtons[i] = button
end
end
updateScrollingFrameCanvasSize()
end
end
local function loadWearing()
currentSubCategory = nil
resetScrollingFrame()
scrollingFrame.Visible = true
for i, asset in ipairs(wearingAssets.assets) do
local v = {Id = asset.id, Name = asset.name}
local button = makeButton(v)
activeButtons[i] = button
end
updateScrollingFrameCanvasSize()
end
local function loadSkinTones()
local list = Catalog.Appearance.SkinTone
if list then
for name, color in next, list do
local button; button = Button.new({
Name = name,
Icon = "rbxasset://textures/whiteCircle.png",
ActivatedCallback = function(inputObject)
remoteEvent:FireServer("skintone", name)
end,
})
button.guiButton.Icon.ImageColor3 = color
button:Parent(scrollingFrame)
activeButtons[name] = button
end
updateScrollingFrameCanvasSize()
end
end
local function loadScales()
-- uhh? i forgot what I wanted to do here.
end
local function getCameraOffsetCFrame()
local ViewSizeX = ScreenSpace.ViewSizeX()
local ViewSizeY = ScreenSpace.ViewSizeY()
local offset = ScreenSpace.ScreenToWorld(numberValue.Value * ViewSizeX, ViewSizeY/2, -DEPTH)
local cameraCFrame = rootPart.CFrame * offset
local lookCFrame = rootPart.CFrame * Vector3.new(offset.X, offset.Y, DEPTH)
return CFrame.new(cameraCFrame, lookCFrame)
end
local function updateCamera(delta)
camera.CFrame = getCameraOffsetCFrame()
end
local function openSequence()
controlModule:Disable()
avatarEditorFrame.Visible = true
catalogFrameOpenTween:Play()
viewerFrameOpenTween:Play()
--cameraModule:ActivateOcclusionModule(Enum.DevCameraOcclusionMode.Invisicam)
originalCamCFrame = camera.CFrame
local cameraCFrame = getCameraOffsetCFrame()
local cameraTween = Tween:Create(camera, tweenInfo, {CFrame = cameraCFrame})
activeConnections[CAMERA_BIND] = cameraTween.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed then
Run:BindToRenderStep(CAMERA_BIND, Enum.RenderPriority.Camera.Value, updateCamera)
end
end)
cameraTween:Play()
isOpen = true
end
local function closeSequence()
Run:UnbindFromRenderStep(CAMERA_BIND)
catalogFrameCloseTween:Play()
viewerFrameCloseTween:Play()
local cameraTween = Tween:Create(camera, tweenInfo, {CFrame = originalCamCFrame})
activeConnections[CAMERA_BIND] = cameraTween.Completed:Connect(function(playbackState)
if playbackState == Enum.PlaybackState.Completed then
avatarEditorFrame.Visible = false
camera.CameraSubject = humanoid
--cameraModule:ActivateOcclusionModule(Enum.DevCameraOcclusionMode.Zoom)
controlModule:Enable()
end
end)
cameraTween:Play()
numberValue.Value = CAMERA_OFFSET
fullView = false
isOpen = false
end
local function toggle()
if isOpen then
closeSequence()
else
openSequence()
end
end
local function toggleView()
if fullView then
catalogFrameOpenTween:Play()
viewerFrameOpenTween:Play()
fullViewCloseTween:Play()
else
catalogFrameCloseTween:Play()
viewFramePartialOpenTween:Play()
fullViewOpenTween:Play()
end
fullView = not fullView
end
local function onClientEvent(characterAppearanceInfo)
wearingAssets = characterAppearanceInfo
updateSelected()
--TableUtil.Print(wearingAssets, "avatar", true)
end
for i, button in ipairs(categoryButtons) do
local function activated(inputObject)
local subCategoryTabFrame = subCategoryTabsFrame:FindFirstChild(button.Name)
if subCategoryTabFrame then
hideAllSubCategoryFrames()
currentCategory = button.Name
setSelectedCategory(button)
subCategoryTabFrame.Visible = true
elseif button.Name == "Wearing" then
hideAllSubCategoryFrames()
currentCategory = button.Name
setSelectedCategory(button)
loadWearing()
setSelectedSubCategory(nil)
scaleFrame.Visible = false
end
end
local categoryButton = Button.new({
guiButton = button,
ActivatedCallback = activated,
})
categoryButton:SetSelected(button.Name == currentCategory)
activeCategoryButtons[button] = categoryButton
end
for i, frame in ipairs(subCategoryFrames) do
local subCategoryButtons = TableUtil.Filter(frame:GetChildren(), function(item)
return item:IsA("GuiButton")
end)
for ii, button in ipairs(subCategoryButtons) do
local function activated(inputObject)
resetScrollingFrame()
setSelectedSubCategory(button)
if button.Name == "SkinTone" then
loadSkinTones()
scrollingFrame.Visible = true
scaleFrame.Visible = false
searchFrame.Visible = true
elseif button.Name == "Scale" then
loadScales()
scrollingFrame.Visible = false
scaleFrame.Visible = true
searchFrame.Visible = false
else
loadAccessories(button.Name)
scrollingFrame.Visible = true
scaleFrame.Visible = false
searchFrame.Visible = true
end
end
local subCategoryButton = Button.new({
guiButton = button,
ActivatedCallback = activated,
})
subCategoryButton:SetSelected(button.Name == currentSubCategory)
activeSubCategoryButtons[button] = subCategoryButton
end
end
|
---
|
local Livery = true
script.Parent.MouseButton1Click:connect(function()
Livery = not Livery
if Livery == true then
script.Parent.BackgroundColor3 = car.Colors.YES.Value
script.Parent.Parent.Livery1.BackgroundColor3 = car.Colors.NO.Value
script.Parent.Parent.Livery2.BackgroundColor3 = car.Colors.NO.Value
script.Parent.Parent.Livery3.BackgroundColor3 = car.Colors.NO.Value
script.Parent.Parent.Livery4.BackgroundColor3 = car.Colors.NO.Value
end
handler:FireServer("None",Livery)
end)
|
--- Sets whether or not the console is enabled
|
function Cmdr:SetEnabled (enabled: boolean)
self.Enabled = enabled
end
|
--!nonstrict
|
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserGameSettings = UserSettings():GetService("UserGameSettings")
local VRService = game:GetService("VRService")
local StarterGui = game:GetService("StarterGui")
local player = Players.LocalPlayer
local CAMERA_INPUT_PRIORITY = Enum.ContextActionPriority.Medium.Value
local MB_TAP_LENGTH = 0.3 -- (s) length of time for a short mouse button tap to be registered
local ROTATION_SPEED_KEYS = math.rad(120) -- (rad/s)
local ROTATION_SPEED_MOUSE = Vector2.new(1, 0.77)*math.rad(0.5) -- (rad/s)
local ROTATION_SPEED_POINTERACTION = Vector2.new(1, 0.77)*math.rad(7) -- (rad/s)
local ROTATION_SPEED_TOUCH = Vector2.new(1, 0.66)*math.rad(1) -- (rad/s)
local ROTATION_SPEED_GAMEPAD = Vector2.new(1, 0.77)*math.rad(4) -- (rad/s)
local ZOOM_SPEED_MOUSE = 1 -- (scaled studs/wheel click)
local ZOOM_SPEED_KEYS = 0.1 -- (studs/s)
local ZOOM_SPEED_TOUCH = 0.04 -- (scaled studs/DIP %)
local MIN_TOUCH_SENSITIVITY_FRACTION = 0.25 -- 25% sensitivity at 90°
local FFlagUserResetTouchStateOnMenuOpen
do
local success, result = pcall(function()
return UserSettings():IsUserFeatureEnabled("UserResetTouchStateOnMenuOpen")
end)
FFlagUserResetTouchStateOnMenuOpen = success and result
end
|
--- Replace with true/false to force the chat type. Otherwise this will default to the setting on the website.
| |
--[[**
ensures value is a number where value < max
@param max The maximum to use
@returns A function that will return true iff the condition is passed
**--]]
|
function t.numberMaxExclusive(max)
return function(value)
local success = t.number(value)
if not success then
return false
end
if value < max then
return true
else
return false
end
end
end
|
--[[Run]]
|
local build=require(bike.Tuner.README)
local ver=script.Parent.Version.Value
--Runtime Loops
-- ~60 c/s
game["Run Service"].Heartbeat:connect(function(dt)
_IsOn = script.Parent.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
--Steering
Steering(dt)
--Gear
Gear()
--Power
Engine(dt)
--Update External Values
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = ((_TBoost/2)*_TPsi)+((_SBoost/2)*_SPsi)
script.Parent.Values.BoostTurbo.Value = (_TBoost/2)*_TPsi
script.Parent.Values.BoostSuper.Value = (_SBoost/2)*_SPsi
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpElectric.Value = _EH
script.Parent.Values.HpTurbo.Value = _TH
script.Parent.Values.HpSuper.Value = _SH
script.Parent.Values.HpBoosted.Value = _BH
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.TqNatural.Value = _NT/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqElectric.Value = _ET/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqTurbo.Value = _TT/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqSuper.Value = _ST/_Tune.Ratios[_CGear+1]/fFD/hpScaling
script.Parent.Values.TqBoosted.Value = script.Parent.Values.TqTurbo.Value+script.Parent.Values.TqSuper.Value
script.Parent.Values.Torque.Value = script.Parent.Values.TqNatural.Value+script.Parent.Values.TqElectric.Value+script.Parent.Values.TqBoosted.Value
script.Parent.Values.TransmissionMode.Value = _TMode
script.Parent.Values.Throttle.Value = _GThrot
script.Parent.Values.Brake.Value = _GBrake
if script.Parent.Values.AutoClutch.Value then
script.Parent.Values.Clutch.Value = _Clutch
end
script.Parent.Values.SteerC.Value = _GSteerC
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _fABSActive or _rABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = bike.DriveSeat.Velocity
end)
while wait(.0667) do
if _TMode == "Auto" then Auto() end
end
|
--// Loccalllsssss
|
local _G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, delay, spawn, task, tick, assert =
_G, game, script, getfenv, setfenv, workspace,
getmetatable, setmetatable, loadstring, coroutine,
rawequal, typeof, print, math, warn, error, pcall,
xpcall, select, rawset, rawget, ipairs, pairs,
next, Rect, Axes, os, time, Faces, table.unpack, string, Color3,
newproxy, tostring, tonumber, Instance, TweenInfo, BrickColor,
NumberRange, ColorSequence, NumberSequence, ColorSequenceKeypoint,
NumberSequenceKeypoint, PhysicalProperties, Region3int16,
Vector3int16, require, table, type, task.wait,
Enum, UDim, UDim2, Vector2, Vector3, Region3, CFrame, Ray, task.delay, task.defer, task, tick, function(cond, errMsg) return cond or error(errMsg or "assertion failed!", 2) end;
local ServicesWeUse = {
"Workspace";
"Players";
"Lighting";
"ReplicatedStorage";
"ReplicatedFirst";
"ScriptContext";
"JointsService";
"LogService";
"Teams";
"SoundService";
"StarterGui";
"StarterPack";
"StarterPlayer";
"GroupService";
"MarketplaceService";
"HttpService";
"TestService";
"RunService";
"NetworkClient";
};
|
-- Length of an input to be considered a tap
|
local SINGLE_TAP_THRESHOLD = 0.2
local VehicleGui = {}
VehicleGui.__index = VehicleGui
local MAX_SPEED = 130
function VehicleGui.new(car, seat)
local self = setmetatable({}, VehicleGui)
self.connections = {}
self.car = car
self.localSeatModule = require(ScriptsFolder.LocalVehicleSeating)
self.chassis = car:WaitForChild("Chassis")
self.seat = self.chassis:WaitForChild("VehicleSeat")
self.gui = Gui:Clone()
self.gui.Name = "ActiveGui"
self.gui.Parent = script
self.touchFrame = self.gui:WaitForChild("TouchControlFrame")
self.accelButton = self.touchFrame:WaitForChild("AccelerateButton")
self.brakeButton = self.touchFrame:WaitForChild("BrakeButton")
self.exitButton = self.touchFrame:WaitForChild("ExitButton")
self.speedoFrame = self.gui:WaitForChild("SpeedoFrame")
self.speedoFrameOff = self.speedoFrame:WaitForChild("OffFrame")
self.speedoOff = self.speedoFrameOff:WaitForChild("Speedo")
self.speedoFrameOn = self.speedoFrame:WaitForChild("OnFrame")
self.speedoOn = self.speedoFrameOn:WaitForChild("Speedo")
self.speedText = self.speedoFrame:WaitForChild("SpeedText")
self.unitText = self.speedoFrame:WaitForChild("UnitText")
return self
end
|
------------------------------------------------
|
UIS.InputBegan:Connect(function(input, processed)
if not processed then
if input.KeyCode == Enum.KeyCode.P then
if UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
if freeCamEnabled then
ExitFreecam()
else
EnterFreecam()
end
end
elseif input.KeyCode == Enum.KeyCode.L and freeCamEnabled and UIS:IsKeyDown(Enum.KeyCode.LeftShift) then
letterBoxEnabled = not letterBoxEnabled
letterbox.Enabled = letterBoxEnabled
end
end
end)
|
-- returns the ascendant ScreenGui of an object
|
function GetScreen(screen)
if screen == nil then return nil end
while not screen:IsA("ScreenGui") do
screen = screen.Parent
if screen == nil then return nil end
end
return screen
end
do
local ZIndexLock = {}
-- Sets the ZIndex of an object and its descendants. Objects are locked so
-- that SetZIndexOnChanged doesn't spawn multiple threads that set the
-- ZIndex of the same object.
function SetZIndex(object,z)
if not ZIndexLock[object] then
ZIndexLock[object] = true
if object:IsA'GuiObject' then
object.ZIndex = z
end
local children = object:GetChildren()
for i = 1,#children do
SetZIndex(children[i],z)
end
ZIndexLock[object] = nil
end
end
function SetZIndexOnChanged(object)
return object.Changed:connect(function(p)
if p == "ZIndex" then
SetZIndex(object,object.ZIndex)
end
end)
end
end
|
--Creates a display Gui for the soft shutdown.
|
return function()
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SoftShutdownGui"
ScreenGui.DisplayOrder = 100
--Create background to cover behind top bar.
local Frame = Instance.new("Frame")
Frame.BackgroundColor3 = Color3.new(0.164706, 0.164706, 0.164706)
Frame.Position = UDim2.new(-0.5,0,-0.5,0)
Frame.Size = UDim2.new(2,0,2,0)
Frame.ZIndex = 10
Frame.Parent = ScreenGui
local function CreateTextLabel(Size,Position,Text)
local TextLabel = Instance.new("TextLabel")
TextLabel.BackgroundTransparency = 1
TextLabel.Size = Size
TextLabel.Position = Position
TextLabel.Text = Text
TextLabel.ZIndex = 10
TextLabel.Font = "SourceSansBold"
TextLabel.TextScaled = true
TextLabel.TextColor3 = Color3.new(1,1,1)
TextLabel.TextStrokeColor3 = Color3.new(1, 1, 1)
TextLabel.TextStrokeTransparency = 0
TextLabel.Parent = Frame
end
--Create text.
CreateTextLabel(UDim2.new(0.5,0,0.1,0),UDim2.new(0.25,0,0.4,0),"ATTENTION")
CreateTextLabel(UDim2.new(0.5,0,0.05,0),UDim2.new(0.25,0,0.475,0),"This server is being updated")
CreateTextLabel(UDim2.new(0.5,0,0.03,0),UDim2.new(0.25,0,0.55,0),"Your SCP Site Roleplay Area 46 Team")
--Return the ScreenGui and the background.
return ScreenGui,Frame
end
|
--[[
Returns a list of indexes of self.props.images to render. This is to support the circular list effect.
]]
|
modules.getRenderedIndexes = function(self)
return function()
local res = {}
for i = -(2 * #self.props.images + self.state.offset), (2 * #self.props.images + self.state.offset) do
local index = self.state.selectedIndex + i
-- NOTE: Really dislike this modulo pattern for circular indexes.
-- Taken from: https://stackoverflow.com/questions/52103713/alternative-to-modulus-in-lua
index = (index + #self.props.images - 1) % #self.props.images + 1
table.insert(res, index)
end
return res
end
end
|
-- how many bullets are fired at a time
|
local BulletCount = 60
|
-- Decompiled with the Synapse X Luau decompiler.
|
client = nil;
service = nil;
return function(p1)
local v1 = {
Name = p1.Name and "Prompt",
Title = p1.Title and "Prompt",
Size = p1.Size or { 225, 150 },
SizeLocked = true
};
local u1 = nil;
function v1.OnClose()
if not u1 then
u1 = p1.DefaultAnswer and "";
end;
end;
local v2 = client.UI.Make("Window", v1);
local v3 = v2:Add("TextLabel", {
Text = p1.Question,
Font = "SourceSans",
TextScaled = true,
BackgroundTransparency = 1,
TextWrapped = true,
Size = UDim2.new(1, -10, 1, -35)
});
local v4 = v2:Add("TextBox", {
Text = "",
TextSize = 18,
PlaceholderText = p1.PlaceholderText and "",
ClearTextOnFocus = p1.ClearTextOnFocus and false,
Size = UDim2.new(1, -40, 0, 25),
Position = UDim2.new(0, 5, 1, -30)
});
v4.FocusLost:Connect(function(p2)
if p2 then
u1 = v4.Text;
v2:Close();
end;
end);
local v5 = v2:Add("TextButton", {
Text = ">",
Font = "Arial",
TextSize = 22,
Size = UDim2.new(0, 25, 0, 25),
Position = UDim2.new(1, -30, 1, -30),
OnClick = function()
u1 = v4.Text;
v2:Close();
end
});
local l__gTable__6 = v2.gTable;
v2:Ready();
while true do
wait();
if u1 then
break;
end;
end;
return nil;
end;
|
--> Connections
|
camPart.Changed:Connect(function(newValue)
if newValue ~= nil then
MoveCamera(newValue)
end
end)
|
--Connections
|
PointsGiver.Touched:Connect(onTouched)
|
--[=[
@return ... any
@yields
Yields the current thread until the signal is fired, and returns the arguments fired from the signal.
```lua
task.spawn(function()
local msg, num = signal:Wait()
print(msg, num) --> "Hello", 32
end)
signal:Fire("Hello", 32)
```
]=]
|
function Signal:Wait()
local waitingCoroutine = coroutine.running()
local cn
cn = self:Connect(function(...)
cn:Disconnect()
task.spawn(waitingCoroutine, ...)
end)
return coroutine.yield()
end
|
-- Return either empty string or one line per indexed result,
-- so additional empty line can separate from `Number of returns` which follows.
|
function printReceivedResults(
label: string,
expected: any,
indexedResults: Array<IndexedResult>,
isOnlyCall: boolean,
iExpectedCall: number?
)
if #indexedResults == 0 then
return ""
end
if isOnlyCall and (iExpectedCall == 1 or iExpectedCall == nil) then
return label .. printResult(indexedResults[1][2], expected) .. "\n"
end
local printAligned = getRightAlignedPrinter(label)
-- ROBLOX TODO: the following (label:find(':') or 1) can be changed to label:find(':') if
-- roblox-cli eventually won't complain?
local colonIndex = label:find(":") or 1
return String.trim(label:sub(1, colonIndex - 1) .. label:sub(colonIndex + 1, #label))
.. "\n"
.. Array.reduce(indexedResults, function(printed: string, indexedResult: IndexedResult)
local i = indexedResult[1]
local result = indexedResult[2]
return printed .. printAligned(tostring(i), i == iExpectedCall) .. printResult(result, expected) .. "\n"
end, "")
end
local function createToBeCalledMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: any)
local expectedArgument = ""
local options: MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureNoExpected(expected, matcherName, options)
ensureMockOrSpy(received, matcherName, expectedArgument, options)
local receivedIsSpy = isSpy(received)
local receivedName
if receivedIsSpy then
receivedName = "spy"
else
receivedName = received.getMockName()
end
local count
if receivedIsSpy then
count = received.calls.count()
else
count = #received.mock.calls
end
local calls
if receivedIsSpy then
calls = Array.map(received.calls.all(), function(x: any)
return x.args
end)
else
calls = received.mock.calls
end
local pass = count > 0
local message
if pass then
message = function()
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of calls: %s\n"):format(printExpected(0))
.. ("Received number of calls: %s\n\n"):format(printReceived(count))
.. Array.join(
Array.reduce(calls, function(lines: Array<string>, args: any, i: number)
if #lines < PRINT_LIMIT then
table.insert(lines, ("%s: %s"):format(tostring(i), printReceivedArgs(args)))
end
return lines
end, {}),
"\n"
)
end
else
message = function()
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of calls: >= %s\n"):format(printExpected(1))
.. ("Received number of calls: %s"):format(printReceived(count))
end
end
return { message = message, pass = pass }
end
end
local function createToReturnMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: any)
local expectedArgument = ""
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureNoExpected(expected, matcherName, options)
ensureMock(received, matcherName, expectedArgument, options)
local receivedName = received.getMockName()
-- Count return values that correspond only to calls that returned
local count = Array.reduce(received.mock.results, function(n: number, result: any)
if result.type == "return" then
return n + 1
else
return n
end
end, 0)
local pass = count > 0
local message
if pass then
message = function()
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of returns: %s\n"):format(printExpected(0))
.. ("Received number of returns: %s\n\n"):format(printReceived(count))
.. Array.join(
Array.reduce(received.mock.results, function(lines: Array<string>, result: any, i: number)
if result.type == "return" and #lines < PRINT_LIMIT then
table.insert(lines, ("%s: %s"):format(tostring(i), printReceived(result.value)))
end
return lines
end, {}),
"\n"
)
if #received.mock.calls ~= count then
retval = retval .. "\n\nReceived number of calls: " .. printReceived(#received.mock.calls)
end
return retval
end
else
message = function()
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of returns: >= %s\n"):format(printExpected(1))
.. ("Received number of returns: %s"):format(printReceived(count))
if #received.mock.calls ~= count then
retval = retval
.. ("\nReceived number of calls: %s"):format(printReceived(#received.mock.calls))
end
return retval
end
end
return { message = message, pass = pass }
end
end
local function createToBeCalledTimesMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: number)
local expectedArgument = "expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureExpectedIsNonNegativeInteger(expected, matcherName, options)
ensureMockOrSpy(received, matcherName, expectedArgument, options)
local receivedIsSpy = isSpy(received)
local receivedName
if receivedIsSpy then
receivedName = "spy"
else
receivedName = received.getMockName()
end
local count
if receivedIsSpy then
count = received.calls.count()
else
count = #received.mock.calls
end
local pass = count == expected
local message
if pass then
message = function()
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of calls: never %s"):format(printExpected(expected))
end
else
message = function()
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of calls: %s\n"):format(printExpected(expected))
.. ("Received number of calls: %s"):format(printReceived(count))
end
end
return { message = message, pass = pass }
end
end
local function createToReturnTimesMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: number)
local expectedArgument = "expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureExpectedIsNonNegativeInteger(expected, matcherName, options)
ensureMock(received, matcherName, expectedArgument, options)
local receivedName = received.getMockName()
-- Count return values that correspond only to calls that returned
local count = Array.reduce(received.mock.results, function(n: number, result: any)
if result.type == "return" then
return n + 1
else
return n
end
end, 0)
local pass = count == expected
local message
if pass then
message = function()
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of returns: never %s"):format(printExpected(expected))
if #received.mock.calls ~= count then
retval = retval
.. ("\n\nReceived number of calls: %s"):format(printReceived(#received.mock.calls))
end
return retval
end
else
message = function()
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected number of returns: %s\n"):format(printExpected(expected))
.. ("Received number of returns: %s"):format(printReceived(count))
if #received.mock.calls ~= count then
retval = retval .. ("\nReceived number of calls: %s"):format(printReceived(#received.mock.calls))
end
return retval
end
end
return { message = message, pass = pass }
end
end
local function createToBeCalledWithMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, ...)
local expected = { ... }
local expectedLength = select("#", ...)
for i = 1, expectedLength do
-- ROBLOX deviation: We add this if statement to deal with our internal symbol
-- that represents nil
if expected[i] == nil then
expected[i] = Symbol.for_("$$nil")
end
end
local expectedArgument = "...expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureMockOrSpy(received, matcherName, expectedArgument, options)
local receivedIsSpy = isSpy(received)
local receivedName
if receivedIsSpy then
receivedName = "spy"
else
receivedName = received.getMockName()
end
local calls
if receivedIsSpy then
calls = Array.map(received.calls.all(), function(x: any)
return x.args
end)
else
calls = received.mock.calls
end
local pass = Array.some(calls, function(call)
return isEqualCall(expected, call)
end)
local message
if pass then
message = function()
-- Some examples of calls that are equal to expected value.
local indexedCalls: Array<IndexedCall> = {}
local i = 1
while i <= #calls and #indexedCalls < PRINT_LIMIT do
if isEqualCall(expected, calls[i]) then
table.insert(indexedCalls, { i, calls[i] })
end
i = i + 1
end
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: never %s\n"):format(printExpectedArgs(expected))
if not (#calls == 1 and stringify(calls[1]) == stringify(expected)) then
retval = retval .. printReceivedCallsNegative(expected, indexedCalls, #calls == 1)
end
retval = retval .. ("\nNumber of calls: %s"):format(printReceived(#calls))
return retval
end
else
message = function()
-- Some examples of calls that are not equal to expected value.
local indexedCalls: Array<IndexedCall> = {}
local i = 1
while i <= #calls and #indexedCalls < PRINT_LIMIT do
table.insert(indexedCalls, { i, calls[i] })
i = i + 1
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(this.expand), #calls == 1)
.. ("\nNumber of calls: %s"):format(printReceived(#calls))
end
end
return { message = message, pass = pass }
end
end
local function createToReturnWithMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: any)
local expectedArgument = "expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureMock(received, matcherName, expectedArgument, options)
local receivedName = received.getMockName()
local receivedMock = received.mock
local calls = receivedMock.calls
local results = receivedMock.results
local pass = Array.some(results, function(result: any)
return isEqualReturn(expected, result)
end)
local message
if pass then
message = function()
-- Some examples of results that are equal to expected value.
local indexedResults: Array<IndexedResult> = {}
local i = 1
while i <= #results and #indexedResults < PRINT_LIMIT do
if isEqualReturn(expected, results[i]) then
table.insert(indexedResults, { i, results[i] })
end
i = i + 1
end
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: never %s\n"):format(printExpected(expected))
if
not (
#results == 1
and results[1].type == "return"
and stringify(results[1].value) == stringify(expected)
)
then
retval = retval .. printReceivedResults("Received: ", expected, indexedResults, #results == 1)
end
retval = retval .. printNumberOfReturns(countReturns(results), #calls)
return retval
end
else
message = function()
-- Some examples of results that are not equal to expected value.
local indexedResults: Array<IndexedResult> = {}
local i = 1
while i <= #results and #indexedResults < PRINT_LIMIT do
table.insert(indexedResults, { i, results[i] })
i = i + 1
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: %s\n"):format(printExpected(expected))
.. printReceivedResults("Received: ", expected, indexedResults, #results == 1)
.. printNumberOfReturns(countReturns(results), #calls)
end
end
return { message = message, pass = pass }
end
end
local function createLastCalledWithMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, ...)
local expected: Array<any> = { ... }
local expectedLength = select("#", ...)
for i = 1, expectedLength do
-- ROBLOX deviation: We add this if statement to deal with our internal symbol
-- that represents nil
if expected[i] == nil then
expected[i] = Symbol.for_("$$nil")
end
end
local expectedArgument = "...expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureMockOrSpy(received, matcherName, expectedArgument, options)
local receivedIsSpy = isSpy(received)
local receivedName
if receivedIsSpy then
receivedName = "spy"
else
receivedName = received.getMockName()
end
local calls
if receivedIsSpy then
calls = Array.map(received.calls.all(), function(x: any)
return x.args
end)
else
calls = received.mock.calls
end
local iLast = #calls
local pass = iLast >= 1 and isEqualCall(expected, calls[iLast])
local message
if pass then
message = function()
local indexedCalls: Array<IndexedCall> = {}
if iLast > 1 then
-- Display preceding call as context.
table.insert(indexedCalls, { iLast - 1, calls[iLast - 1] })
end
table.insert(indexedCalls, { iLast, calls[iLast] })
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: never %s\n"):format(printExpectedArgs(expected))
if not (#calls == 1 and stringify(calls[1]) == stringify(expected)) then
retval = retval .. printReceivedCallsNegative(expected, indexedCalls, #calls == 1, iLast)
end
retval = retval .. ("\nNumber of calls: %s"):format(printReceived(#calls))
return retval
end
else
message = function()
local indexedCalls: Array<IndexedCall> = {}
if iLast >= 1 then
if iLast > 1 then
local i = iLast - 1
-- Is there a preceding call that is equal to expected args?
while i >= 1 and not isEqualCall(expected, calls[i]) do
i = i - 1
end
if i < 1 then
i = iLast - 1 -- otherwise, preceding call
end
table.insert(indexedCalls, { i, calls[i] })
end
table.insert(indexedCalls, { iLast, calls[iLast] })
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. printExpectedReceivedCallsPositive(
expected,
indexedCalls,
isExpand(this.expand),
#calls == 1,
iLast
)
.. ("\nNumber of calls: %s"):format(printReceived(#calls))
end
end
return { message = message, pass = pass }
end
end
local function createLastReturnedMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, expected: any)
local expectedArgument = "expected"
local options: JestMatcherUtils.MatcherHintOptions = {
isNot = this.isNot,
promise = this.promise,
}
ensureMock(received, matcherName, expectedArgument, options)
local receivedName = received.getMockName()
local receivedMock = received.mock
local calls = receivedMock.calls
local results = receivedMock.results
local iLast = #results
local pass = iLast >= 1 and isEqualReturn(expected, results[iLast])
local message
if pass then
message = function()
local indexedResults: Array<IndexedResult> = {}
if iLast > 1 then
-- Display preceding result as context.
table.insert(indexedResults, { iLast - 1, results[iLast - 1] })
end
table.insert(indexedResults, { iLast, results[iLast] })
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: never %s\n"):format(printExpected(expected))
if
not (
#results == 1
and results[1].type == "return"
and stringify(results[1].value) == stringify(expected)
)
then
retval = retval
.. printReceivedResults("Received: ", expected, indexedResults, #results == 1, iLast)
end
retval = retval .. printNumberOfReturns(countReturns(results), #calls)
return retval
end
else
message = function()
local indexedResults: Array<IndexedResult> = {}
if iLast >= 1 then
if iLast > 1 then
local i = iLast - 1
-- Is there a preceding result that is equal to expected value?
while i >= 1 and not isEqualReturn(expected, results[i]) do
i = i - 1
end
if i < 1 then
i = iLast - 1 -- otherwise, preceding result
end
table.insert(indexedResults, { i, results[i] })
end
table.insert(indexedResults, { iLast, results[iLast] })
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("Expected: %s\n"):format(printExpected(expected))
.. printReceivedResults("Received: ", expected, indexedResults, #results == 1, iLast)
.. printNumberOfReturns(countReturns(results), #calls)
end
end
return { message = message, pass = pass }
end
end
local function createNthCalledWithMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, nth: number, ...)
local expected = { ... }
local expectedLength = select("#", ...)
for i = 1, expectedLength do
-- ROBLOX deviation: We add this if statement to deal with our internal symbol
-- that represents nil
if expected[i] == nil then
expected[i] = Symbol.for_("$$nil")
end
end
local expectedArgument = "n"
local options: JestMatcherUtils.MatcherHintOptions = {
expectedColor = function(arg)
return arg
end,
isNot = this.isNot,
promise = this.promise,
secondArgument = "...expected",
}
ensureMockOrSpy(received, matcherName, expectedArgument, options)
if not Number.isSafeInteger(nth) or nth < 1 then
-- ROBLOX deviation: we don't use the Error polyfill because we encounter an error with TestEZ
error(
Error(
matcherErrorMessage(
matcherHint(matcherName, nil, expectedArgument, options),
("%s must be a positive integer"):format(expectedArgument),
printWithType(expectedArgument, nth, stringify)
)
)
)
end
local receivedIsSpy = isSpy(received)
local receivedName
if receivedIsSpy then
receivedName = "spy"
else
receivedName = received.getMockName()
end
local calls
if receivedIsSpy then
calls = Array.map(received.calls.all(), function(x: any)
return x.args
end)
else
calls = received.mock.calls
end
local length = #calls
local iNth = nth
local pass = iNth <= length and isEqualCall(expected, calls[iNth])
local message
if pass then
message = function()
-- Display preceding and following calls,
-- in case assertions fails because index is off by one.
local indexedCalls: Array<IndexedCall> = {}
if iNth - 1 >= 1 then
table.insert(indexedCalls, { iNth - 1, calls[iNth - 1] })
end
table.insert(indexedCalls, { iNth, calls[iNth] })
if iNth + 1 <= length then
table.insert(indexedCalls, { iNth + 1, calls[iNth + 1] })
end
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("n: %s\n"):format(tostring(nth))
.. ("Expected: never %s\n"):format(printExpectedArgs(expected))
if not (#calls == 1 and stringify(calls[1]) == stringify(expected)) then
retval = retval .. printReceivedCallsNegative(expected, indexedCalls, #calls == 1, iNth)
end
retval = retval .. ("\nNumber of calls: %s"):format(printReceived(#calls))
return retval
end
else
message = function()
-- Display preceding and following calls:
-- * nearest call that is equal to expected args
-- * otherwise, adjacent call
-- in case assertions fails because of index, especially off by one.
local indexedCalls: Array<IndexedCall> = {}
if iNth <= length then
if iNth - 1 >= 1 then
local i = iNth - 1
-- Is there a preceding call that is equal to expected args?
while i >= 1 and not isEqualCall(expected, calls[i]) do
i = i - 1
end
if i < 1 then
i = iNth - 1 -- otherwise, adjacent call
end
table.insert(indexedCalls, { i, calls[i] })
end
table.insert(indexedCalls, { iNth, calls[iNth] })
if iNth + 1 <= length then
local i = iNth + 1
-- Is there a following call that is equal to expected args?
while i <= length and not isEqualCall(expected, calls[i]) do
i = i + 1
end
if i >= length then
i = iNth + 1 -- otherwise, adjacent call
end
table.insert(indexedCalls, { i, calls[i] })
end
elseif length > 1 then
-- Is there a call that is equal to expected args?
local i = length - 1
-- Is there a call that is equal to expected args?
while i >= 1 and not isEqualCall(expected, calls[i]) do
i = i - 1
end
if i < 1 then
i = length - 1
end
table.insert(indexedCalls, { i, calls[i] })
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("n: %s\n"):format(tostring(nth))
.. printExpectedReceivedCallsPositive(
expected,
indexedCalls,
isExpand(this.expand),
#calls == 1,
iNth
)
.. ("\nNumber of calls: %s"):format(printReceived(#calls))
end
end
return { message = message, pass = pass }
end
end
local function createNthReturnedWithMatcher(matcherName: string): SyncExpectationResult
return function(this: MatcherState, received: any, nth: number, expected: any)
local expectedArgument = "n"
local options: JestMatcherUtils.MatcherHintOptions = {
expectedColor = function(arg)
return arg
end,
isNot = this.isNot,
promise = this.promise,
secondArgument = "expected",
}
ensureMock(received, matcherName, expectedArgument, options)
if not Number.isSafeInteger(nth) or nth < 1 then
-- ROBLOX deviation: we don't use the Error polyfill because we encounter an error with TestEZ
error(
Error(
matcherErrorMessage(
matcherHint(matcherName, nil, expectedArgument, options),
("%s must be a positive integer"):format(expectedArgument),
printWithType(expectedArgument, nth, stringify)
)
)
)
end
local receivedName = received.getMockName()
local receivedMock = received.mock
local calls = receivedMock.calls
local results = receivedMock.results
local length = #results
local iNth = nth
local pass = iNth <= length and isEqualReturn(expected, results[iNth])
local message
if pass then
message = function()
-- Display preceding and following results,
-- in case assertions fails because index is off by one.
local indexedResults: Array<IndexedResult> = {}
if iNth - 1 >= 1 then
table.insert(indexedResults, { iNth - 1, results[iNth - 1] })
end
table.insert(indexedResults, { iNth, results[iNth] })
if iNth + 1 <= length then
table.insert(indexedResults, { iNth + 1, results[iNth + 1] })
end
local retval = matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("n: %s\n"):format(tostring(nth))
.. ("Expected: never %s\n"):format(printExpected(expected))
if
not (
#results == 1
and results[1].type == "return"
and stringify(results[1].value) == stringify(expected)
)
then
retval = retval
.. printReceivedResults("Received: ", expected, indexedResults, #results == 1, iNth)
end
retval = retval .. printNumberOfReturns(countReturns(results), #calls)
return retval
end
else
message = function()
-- Display preceding and following results:
-- * nearest result that is equal to expected value
-- * otherwise, adjacent result
-- in case assertions fails because of index, especially off by one.
local indexedResults: Array<IndexedResult> = {}
if iNth <= length then
if iNth - 1 >= 1 then
local i = iNth - 1
-- Is there a preceding result that is equal to expected value?
while i >= 1 and not isEqualReturn(expected, results[i]) do
i = i - 1
end
if i < 1 then
i = iNth - 1
end
table.insert(indexedResults, { i, results[i] })
end
table.insert(indexedResults, { iNth, results[iNth] })
if iNth + 1 <= length then
local i = iNth + 1
-- Is there a following result that is equal to expected value?
while i <= length and not isEqualReturn(expected, results[i]) do
i = i + 1
end
if i > length then
i = iNth + 1
end
table.insert(indexedResults, { i, results[i] })
end
elseif length > 0 then
-- The number of received calls is fewer than the expected number.
local i = length
-- Is there a result that is equal to expected value?
while i >= 1 and not isEqualReturn(expected, results[i]) do
i = i - 1
end
if i < 1 then
i = length - 1 -- otherwise, last result
end
table.insert(indexedResults, { i, results[i] })
end
return matcherHint(matcherName, receivedName, expectedArgument, options)
.. "\n\n"
.. ("n: %s\n"):format(tostring(nth))
.. ("Expected: %s\n"):format(printExpected(expected))
.. printReceivedResults("Received: ", expected, indexedResults, #results == 1, iNth)
.. printNumberOfReturns(countReturns(results), #calls)
end
end
return { message = message, pass = pass }
end
end
|
--The Would-Be Credits
--I, Maelstronomer, did not make these scripts, but only took bits and pieces from other scripts and put them together.
--I have no idea who were the original makers of these scripts, as everyone seems to have taken credit from them.
--So yeah, that's the creditless credits for you. Just don't take this as your own, because, well, it isn't.
--If you do, then whatever helps you sleep at night...
|
permission = {"tryzombie505","theorangeportal","MasterBuilder221","spaggy","Firox11"}
function explode(div,str)
if (div=='') then return false end
local pos,arr = 0,{}
-- for each divider found
for st,sp in function() return string.find(str,div,pos,true) end do
table.insert(arr,string.sub(str,pos,st-1)) -- Attach chars left of current divider
pos = sp + 1 -- Jump past current divider
end
table.insert(arr,string.sub(str,pos)) -- Attach chars right of last divider
return arr
end
function checkIfAdmin(name)
for i = 1,#permission do
if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end
function onChatted(msg, recipient, speaker)
print("Chatted")
source = speaker.Name
if (checkIfAdmin(source)) then
local c = (explode("/",msg))
if(c[1] == "shout") then
print("Shouted")
local mess = c[2]
local hn = Instance.new("")
if c[2] ~= nil then
hn.Parent = game.Workspace
hn.Text = mess
wait(5)
hn:remove()
end
elseif(c[1] == "kill") then
print("Killed")
local killed = c[2]
print(killed)
if c[2] ~= nil then
if game.Players:findFirstChild(killed) ~= nil then
game.Players:findFirstChild(killed).Character.Torso:remove()
end
end
elseif(c[1] == "ban") then
print("Banned")
local banz0red = c[2]
print(banz0red)
local reason = c[3]
print(reason)
if c[2] or c[3] ~= nil then
if game.Players:findFirstChild(banz0red) ~= nil then
local bm = Instance.new("Message")
bm.Parent = game.Workspace
bm.Text = "Now banning ".. banz0red .."".. reason
wait(0)
if bm ~= nil then
bm:remove()
end
if game.Players:findFirstChild(banz0red) ~= nil then
game.Players:findFirstChild(banz0red):remove()
end
end
end
elseif(c[1] == "teleport") then
print("teled")
local teled = c[2]
local teled2 = c[3]
print(teled)
print(teled2)
if c[2] or c[3] ~= nil then
if game.Players:findFirstChild(teled) and game.Players:findFirstChild(teled2) and game.Players:findFirstChild(teled).Character.Torso and game.Players:findFirstChild(teled2).Character.Torso ~= nil then
game.Players:findFirstChild(teled).Character.Torso.CFrame = CFrame.new(game.Players:findFirstChild(teled2).Character.Torso.Position.x,game.Players:findFirstChild(teled2).Character.Torso.Position.y + 10, game.Players:findFirstChild(teled2).Character.Torso.Position.z)
end
end
elseif(c[1] == "anchor") then
print("anchored")
local anchored = c[2]
print(anchored)
local state = c[3]
print(state)
if c[2] or c[3] ~= nil then
if game.Players:findFirstChild(anchored).Character.Torso ~= nil then
if state == "on" then
game.Players:findFirstChild(anchored).Character.Torso.Anchored = true
elseif state == "off" then
game.Players:findFirstChild(anchored).Character.Torso.Anchored = false
else return end
end
end
elseif(c[1] == "up") then
print("upping")
local upped = c[2]
print(upped)
if c[2] ~= nil then
if game.Players:findFirstChild(upped).Character.Torso ~= nil then
b=Instance.new("BodyForce")
b.Parent = game.Players:findFirstChild(upped).Character.Torso
b.force = Vector3.new(0,10000,0)
end
end
elseif(c[1] == "give") then
print("giving")
local playerg = c[2]
print(playerg)
local wepg = c[3]
print(wepg)
if c[2] or c[3] ~= nil then
if game.Players:findFirstChild(playerg) and game.Lighting:findFirstChild(wepg) ~= nil then
if game.Lighting:findFirstChild(wepg).className == "Tool" or "HopperBin" then
g=game.Lighting:findFirstChild(wepg):clone()
g.Parent = game.Players:findFirstChild(playerg).Backpack
end
end
end
elseif(c[1] == "explode") then
print("exploding")
local playere = c[2]
print(playere)
if c[2] ~= nil then
if game.Players:findFirstChild(playere) and game.Players:findFirstChild(playere).Character.Torso ~= nil then
m=Instance.new("Explosion")
m.Position = game.Players:findFirstChild(playere).Character.Torso.Position
m.Parent = game.Players:findFirstChild(playere).Character.Torso
wait(0.5)
m:remove()
end
end
elseif(c[1] == "Control ") then
print("merging")
local host = c[2]
print(host)
local hosted = c[3]
print(hosted)
if c[2] and c[3] ~= nil then
if game.Players:findFirstChild(host) and game.Players:findFirstChild(hosted) ~= nil then
game.Players:findFirstChild(hosted).Character = game.Players:findFirstChild(host).Character
end
end
if string.match(msg, "2d") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil and speaker.Character:findFirstChild("Torso") ~= nil) then
if (speaker.Character.Torso:findFirstChild("BodyPosition") == nil) then putInPos(speaker) end
speaker.Character.Torso.BodyPosition.position = Vector3.new(0,0,0)
speaker.Character.Torso.BodyPosition.maxForce = Vector3.new(0,0,1e+006)
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
if (c[i].Character.Torso:findFirstChild("BodyPosition") == nil) then putInPos(c[i]) end
c[i].Character.Torso.BodyPosition.position = Vector3.new(0,0,0)
c[i].Character.Torso.BodyPosition.maxForce = Vector3.new(0,0,1e+006)
end
end
end
local c = game.Players:GetChildren()
for i = 1, #c do
if (string.match(msg, string.lower(c[i].Name))) then
if (c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
if (c[i].Character.Torso:findFirstChild("BodyPosition") == nil) then putInPos(c[i]) end
c[i].Character.Torso.BodyPosition.position = Vector3.new(0,0,0)
c[i].Character.Torso.BodyPosition.maxForce = Vector3.new(0,0,1e+006)
end
end
end
end
if (msg == "gleeg snag zip") then
local m = Instance.new("Message") --Change the position of the explosion for mass destruction!
m.Text = "Great, we're all gonna die!"
m.Parent = game.Workspace
wait(4)
local ex1 = Instance.new("Explosion")
ex1.Position = Vector3.new(0,0,0)
ex1.BlastRadius = 100
ex1.Parent = game.Workspace
local ex2 = Instance.new("Explosion")
ex2.Position = Vector3.new(0,0,150)
ex2.BlastRadius = 100
ex2.Parent = game.Workspace
local ex3 = Instance.new("Explosion")
ex3.Position = Vector3.new(0,0,-150)
ex3.BlastRadius = 100
ex3.Parent = game.Workspace
local ex4 = Instance.new("Explosion")
ex4.Position = Vector3.new(150,0,0)
ex4.BlastRadius = 100
ex4.Parent = game.Workspace
local ex5 = Instance.new("Explosion")
ex5.Position = Vector3.new(-150,0,0)
ex5.BlastRadius = 100
ex5.Parent = game.Workspace
local ex6 = Instance.new("Explosion")
ex6.Position = Vector3.new(150,0,150)
ex6.BlastRadius = 100
ex6.Parent = game.Workspace
local ex7 = Instance.new("Explosion")
ex7.Position = Vector3.new(-150,0,-150)
ex7.BlastRadius = 100
ex7.Parent = game.Workspace
local ex8 = Instance.new("Explosion")
ex8.Position = Vector3.new(-150,0,150)
ex8.BlastRadius = 100
ex8.Parent = game.Workspace
local ex9 = Instance.new("Explosion")
ex9.Position = Vector3.new(150,0,-150)
ex9.BlastRadius = 100
ex9.Parent = game.Workspace
m.Parent = nil
end
if string.match(msg, "jumpy") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil and speaker.Character:findFirstChild("Torso") ~= nil) then
speaker.Character.Torso.Velocity = Vector3.new(0,500,0)
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
c[i].Character.Torso.Velocity = Vector3.new(0,500,0)
end
end
end
local c = game.Players:GetChildren()
for i = 1, #c do
if (string.match(msg, string.lower(c[i].Name))) then
if (c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
c[i].Character.Torso.Velocity = Vector3.new(0,500,0)
end
end
end
end
if string.match(msg, "trip") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil and speaker.Character:findFirstChild("Torso") ~= nil) then
speaker.Character.Torso.RotVelocity = Vector3.new(100,100,100)
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
c[i].Character.Torso.RotVelocity = Vector3.new(100,100,100)
end
end
end
local c = game.Players:GetChildren()
for i = 1, #c do
if (string.match(msg, string.lower(c[i].Name))) then
if (c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
c[i].Character.Torso.RotVelocity = Vector3.new(100,100,100)
end
end
end
end
if string.match(msg, "kill") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil and speaker.Character:findFirstChild("Humanoid") ~= nil) then
speaker.Character.Humanoid.Health = 0
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil and c[i].Character:findFirstChild("Humanoid") ~= nil) then
c[i].Character.Humanoid.Health = 0
end
end
end
local c = game.Players:GetChildren()
for i = 1, #c do
if (string.match(msg, string.lower(c[i].Name))) then
if (c[i].Character ~= nil and c[i].Character:findFirstChild("Humanoid") ~= nil) then
c[i].Character.Humanoid.Health = 0
end
end
end
end
if string.match(msg, "explode") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil and speaker.Character:findFirstChild("Torso") ~= nil) then
local e = Instance.new("Explosion")
e.Position = speaker.Character.Torso.Position
e.Parent = game.Workspace
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil and c[i].Character:findFirstChild("Torso") ~= nil) then
local e = Instance.new("Explosion")
e.Position = c[i].Character.Torso.Position
e.Parent = game.Workspace
end
end
end
if string.match(msg, "immortal") then
if (string.match(msg, "me")) then
if (speaker.Character ~= nil) then
local f = Instance.new("ForceField")
f.Name = "ForceField"
f.Parent = speaker.Character
if (speaker.Character:findFirstChild("Health") ~= nil) then speaker.Character.Health:remove()end
local health = Instance.new("Script")
health.Source = [[
function onChanged()
script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
end
script.Parent.Humanoid.Changed:connect(onChanged)
]]
health.Parent = speaker.Character
health.Disabled = false
end
end
if (string.match(msg, "all")) then
local c = game.Players:GetChildren()
for i = 1, #c do
if (c[i] ~= speaker and c[i].Character ~= nil) then
local f = Instance.new("ForceField")
f.Name = "ForceField"
f.Parent = c[i].Character
if (c[i].Character:findFirstChild("Health") ~= nil) then c[i].Character.Health:remove()end
local health = Instance.new("Script")
health.Source = [[
function onChanged()
script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
end
script.Parent.Humanoid.Changed:connect(onChanged)
]]
health.Parent = c[i].Character
health.Disabled = false
end
end
end
local c = game.Players:GetChildren()
for i = 1, #c do
if (string.match(msg, string.lower(c[i].Name))) then
if (c[i].Character ~= nil) then
local f = Instance.new("ForceField")
f.Name = "ForceField"
f.Parent = c[i].Character
if (c[i].Character:findFirstChild("Health") ~= nil) then c[i].Character.Health:remove()end
local health = Instance.new("Script")
health.Source = [[
function onChanged()
script.Parent.Humanoid.Health = script.Parent.Humanoid.MaxHealth
end
script.Parent.Humanoid.Changed:connect(onChanged)
]]
health.Parent = c[i].Character
health.Disabled = false
end
end
end
end
elseif(c[1] == "shield") then
print("shielding")
local target = c[2]
print(target)
local state = c[3]
print(state)
if c[2] or c[3] ~= nil then
if game.Players:findFirstChild(target) and game.Players:findFirstChild(target).Character ~= nil then
if state == "on" then
print("FFon")
g=Instance.new("ForceField")
print("FFmade")
g.Name = "FFadmin"
print("FFnamed")
g.Parent = game.Players:findFirstChild(target).Character
print("FFparented")
elseif state == "off" then
if game.Players:findFirstChild(target) and game.Players:findFirstChild(target).Character.FFadmin ~= nil then
game.Players:findFirstChild(target).Character.FFadmin:remove()
end
end
end
end
end
end
end
function onPlayerEntered(newPlayer)
newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end)
end
game.Players.ChildAdded:connect(onPlayerEntered)
|
-------------------
---[[Variables]]---
-------------------
|
local CameraShaker = require(game.ReplicatedStorage.Modules.CameraShaker)
local RunService = game:GetService("RunService")
local Gui = script.Parent.Parent
local Board = script.Parent.Parent.Board
local Pointer = Board.Pointer
local Player = game.Players.LocalPlayer
local camera = workspace.Camera
repeat wait(0.1) until Player.Character ~= nil
local Char = Player.Character
local Humanoid = Char:WaitForChild("Humanoid")
local Old_Magnitude = nil
local camShake = CameraShaker.new(Enum.RenderPriority.Camera.Value, function(shakeCf)
camera.CFrame = camera.CFrame * shakeCf * CFrame.new(0.2,0.2,0.2)
end)
|
--|| SERVICES ||--
|
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
|
--A simple function to check if the car is grounded
|
local function IsGrounded()
local hit, position = Raycast.new((car.Chassis.CFrame * CFrame.new(0, 0, (car.Chassis.Size.Z / 2) - 1)).p, car.Chassis.CFrame:vectorToWorldSpace(Vector3.new(0, -1, 0)) * (stats.Height.Value + 0.2))
if hit and hit.CanCollide then
return(true)
end
return(false)
end
local oldCameraType = camera.CameraType
camera.CameraType = cameraType
spawn(function()
while character.Humanoid.SeatPart == car.DriveSeat do
game:GetService("RunService").RenderStepped:wait()
--Broken gyro input
--[[if userInputService.GyroscopeEnabled then
local inputObject, cframe = userInputService:GetDeviceRotation()
local up = cframe:vectorToWorldSpace(Vector3.new(0, 1, 0))
local angle = (1 - up.Y) * (math.abs(up.X) / up.X)
movement = Vector2.new(angle, movement.Y)
end]]
if IsGrounded() then
if movement.Y ~= 0 then
local velocity = car.Chassis.CFrame.lookVector * movement.Y * stats.Speed.Value
car.Chassis.Velocity = car.Chassis.Velocity:Lerp(velocity, 0.1)
bodyVelocity.maxForce = Vector3.new(0, 0, 0)
else
bodyVelocity.maxForce = Vector3.new(mass / 2, mass / 4, mass / 2)
end
local rotVelocity = car.Chassis.CFrame:vectorToWorldSpace(Vector3.new(movement.Y * stats.Speed.Value / 50, 0, -car.Chassis.RotVelocity.Y * 5 * movement.Y))
local speed = -car.Chassis.CFrame:vectorToObjectSpace(car.Chassis.Velocity).unit.Z
rotation = rotation + math.rad((-stats.Speed.Value / 5) * movement.Y)
if math.abs(speed) > 0.1 then
rotVelocity = rotVelocity + car.Chassis.CFrame:vectorToWorldSpace((Vector3.new(0, -movement.X * speed * stats.TurnSpeed.Value, 0)))
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
else
bodyAngularVelocity.maxTorque = Vector3.new(mass / 4, mass / 2, mass / 4)
end
car.Chassis.RotVelocity = car.Chassis.RotVelocity:Lerp(rotVelocity, 0.1)
--bodyVelocity.maxForce = Vector3.new(mass / 3, mass / 6, mass / 3)
--bodyAngularVelocity.maxTorque = Vector3.new(mass / 6, mass / 3, mass / 6)
else
bodyVelocity.maxForce = Vector3.new(0, 0, 0)
bodyAngularVelocity.maxTorque = Vector3.new(0, 0, 0)
end
for i, part in pairs(car:GetChildren()) do
if part.Name == "Thruster" then
UpdateThruster(part)
end
end
end
for i, v in pairs(car:GetChildren()) do
if v:FindFirstChild("BodyThrust") then
v.BodyThrust:Destroy()
end
end
bodyVelocity:Destroy()
bodyAngularVelocity:Destroy()
camera.CameraType = oldCameraType
userInputService.ModalEnabled = false
if mobileGui then
mobileGui:Destroy()
end
script:Destroy()
end)
|
----------------------------------------------------------------
-----------------------SCROLLBAR STUFF--------------------------
----------------------------------------------------------------
----------------------------------------------------------------
|
local ScrollBarWidth = 16
local ScrollStyles = {
Background = Color3.fromRGB(37, 37, 42),
Border = Color3.fromRGB(20, 20, 25),
Selected = Color3.fromRGB(5, 100, 140),
BorderSelected = Color3.fromRGB(2, 130, 145),
Text = Color3.fromRGB(245, 245, 250),
TextDisabled = Color3.fromRGB(188, 188, 193),
TextSelected = Color3.fromRGB(255, 255, 255),
Button = Color3.fromRGB(31, 31, 36),
ButtonBorder = Color3.fromRGB(133, 133, 138),
ButtonSelected = Color3.fromRGB(0, 168, 155),
Field = Color3.fromRGB(37, 37, 42),
FieldBorder = Color3.fromRGB(50, 50, 55),
TitleBackground = Color3.fromRGB(11, 11, 16)
}
do
local ZIndexLock = {}
function SetZIndex(object,z)
if not ZIndexLock[object] then
ZIndexLock[object] = true
if object:IsA'GuiObject' then
object.ZIndex = z
end
local children = object:GetChildren()
for i = 1,#children do
SetZIndex(children[i],z)
end
ZIndexLock[object] = nil
end
end
end
function SetZIndexOnChanged(object)
return object.Changed:connect(function(p)
if p == "ZIndex" then
SetZIndex(object,object.ZIndex)
end
end)
end
|
----------//Render Functions\\----------
|
Run.RenderStepped:Connect(function(step)
HeadMovement()
renderGunRecoil()
renderCam()
if ViewModel and LArm and RArm and WeaponInHand then --Check if the weapon and arms are loaded
local mouseDelta = User:GetMouseDelta()
SwaySpring:accelerate(Vector3.new(mouseDelta.x/60, mouseDelta.y/60, 0))
local swayVec = SwaySpring.p
local TSWAY = swayVec.z
local XSSWY = swayVec.X
local YSSWY = swayVec.Y
local Sway = CFrame.Angles(YSSWY,XSSWY,XSSWY)
if BipodAtt then
local BipodRay = Ray.new(UnderBarrelAtt.Main.Position, Vector3.new(0,-1.75,0))
local BipodHit, BipodPos, BipodNorm = workspace:FindPartOnRayWithIgnoreList(BipodRay, Ignore_Model, false, true)
if BipodHit then
CanBipod = true
if CanBipod and BipodActive and not runKeyDown and (GunStance == 0 or GunStance == 2) then
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,255), ImageTransparency = .123}):Play()
if not aimming then
BipodCF = BipodCF:Lerp(CFrame.new(0,(((UnderBarrelAtt.Main.Position - BipodPos).magnitude)-1) * (-1.5), 0),.2)
else
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
end
else
BipodActive = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,255,0), ImageTransparency = .5}):Play()
end
else
BipodActive = false
CanBipod = false
BipodCF = BipodCF:Lerp(CFrame.new(),.2)
TS:Create(SE_GUI.GunHUD.Att.Bipod, TweenInfo.new(.1,Enum.EasingStyle.Linear), {ImageColor3 = Color3.fromRGB(255,0,0), ImageTransparency = .5}):Play()
end
end
AnimPart.CFrame = cam.CFrame * NearZ * BipodCF * maincf * gunbobcf * aimcf
if not AnimData.GunModelFixed then
WeaponInHand:SetPrimaryPartCFrame(
ViewModel.PrimaryPart.CFrame
* guncf
)
end
if running then
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.025 * (charspeed/10) * math.sin(tick() * 8),
0.025 * (charspeed/10) * math.cos(tick() * 16),
0
) * CFrame.Angles(
math.rad( 1 * (charspeed/10) * math.sin(tick() * 16) ),
math.rad( 1 * (charspeed/10) * math.cos(tick() * 8) ),
math.rad(0)
), 0.1)
else
gunbobcf = gunbobcf:Lerp(CFrame.new(
0.005 * math.sin(tick() * 1.5),
0.005 * math.cos(tick() * 2.5),
0
), 0.1)
end
if CurAimpart and aimming and AnimDebounce and not CheckingMag then
if not NVG or WeaponInHand.AimPart:FindFirstChild("NVAim") == nil then
if AimPartMode == 1 then
TS:Create(cam,AimTween,{FieldOfView = ModTable.ZoomValue}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), 0.2)
else
TS:Create(cam,AimTween,{FieldOfView = ModTable.Zoom2Value}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * CurAimpart.CFrame:toObjectSpace(cam.CFrame), 0.2)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(maincf * CFrame.new(0,0,-.5) * recoilcf * Sway:inverse() * (WeaponInHand.AimPart.CFrame * WeaponInHand.AimPart.NVAim.CFrame):toObjectSpace(cam.CFrame), 0.2)
end
else
TS:Create(cam,AimTween,{FieldOfView = 70}):Play()
maincf = maincf:Lerp(AnimData.MainCFrame * recoilcf * Sway:inverse(), 0.2)
end
for index, Part in pairs(WeaponInHand:GetDescendants()) do
if Part:IsA("BasePart") and Part.Name == "SightMark" then
local dist_scale = Part.CFrame:pointToObjectSpace(cam.CFrame.Position)/Part.Size
local reticle = Part.SurfaceGui.Border.Scope
reticle.Position=UDim2.new(.5+dist_scale.x,0,.5-dist_scale.y,0)
end
end
recoilcf = recoilcf:Lerp(CFrame.new() * CFrame.Angles( math.rad(RecoilSpring.p.X), math.rad(RecoilSpring.p.Y), math.rad(RecoilSpring.p.z)), 0.2)
if WeaponData.CrossHair then
if aimming then
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),0.2)
else
local Normalized = ((WeaponData.CrosshairOffset + BSpread + (charspeed * WeaponData.WalkMult * ModTable.WalkMult) ) / 50)/10
CHup = CHup:Lerp(UDim2.new(0.5, 0, 0.5 - Normalized,0),0.5)
CHdown = CHdown:Lerp(UDim2.new(.5, 0, 0.5 + Normalized,0),0.5)
CHleft = CHleft:Lerp(UDim2.new(.5 - Normalized, 0, 0.5, 0),0.5)
CHright = CHright:Lerp(UDim2.new(.5 + Normalized, 0, 0.5, 0),0.5)
end
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
else
CHup = CHup:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHdown = CHdown:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHleft = CHleft:Lerp(UDim2.new(.5,0,.5,0),0.2)
CHright = CHright:Lerp(UDim2.new(.5,0,.5,0),0.2)
Crosshair.Position = UDim2.new(0,mouse.X,0,mouse.Y)
Crosshair.Up.Position = CHup
Crosshair.Down.Position = CHdown
Crosshair.Left.Position = CHleft
Crosshair.Right.Position = CHright
end
if BSpread then
local currTime = time()
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 2 and not shooting and BSpread > WeaponData.MinSpread * ModTable.MinSpread then
BSpread = math.max(WeaponData.MinSpread * ModTable.MinSpread, BSpread - WeaponData.AimInaccuracyDecrease * ModTable.AimInaccuracyDecrease)
end
if currTime - LastSpreadUpdate > (60/WeaponData.ShootRate) * 1.5 and not shooting and RecoilPower > WeaponData.MinRecoilPower * ModTable.MinRecoilPower then
RecoilPower = math.max(WeaponData.MinRecoilPower * ModTable.MinRecoilPower, RecoilPower - WeaponData.RecoilPowerStepAmount * ModTable.RecoilPowerStepAmount)
end
end
if LaserActive and Pointer ~= nil then
if NVG then
Pointer.Transparency = 0
Pointer.Beam.Enabled = true
else
if not gameRules.RealisticLaser then
Pointer.Beam.Enabled = true
else
Pointer.Beam.Enabled = false
end
if IRmode then
Pointer.Transparency = 1
else
Pointer.Transparency = 0
end
end
for index, Key in pairs(WeaponInHand:GetDescendants()) do
if Key:IsA("BasePart") and Key.Name == "LaserPoint" then
local L_361_ = Ray.new(Key.CFrame.Position, Key.CFrame.LookVector * 1000)
local Hit, Pos, Normal = workspace:FindPartOnRayWithIgnoreList(L_361_, Ignore_Model, false, true)
if Hit then
Pointer.CFrame = CFrame.new(Pos, Pos + Normal)
else
Pointer.CFrame = CFrame.new(cam.CFrame.Position + Key.CFrame.LookVector * 2000, Key.CFrame.LookVector)
end
if HalfStep and gameRules.ReplicatedLaser then
Evt.SVLaser:FireServer(Pos,1,Pointer.Color,IRmode,WeaponTool)
end
break
end
end
end
end
end)
|
---------------------------
|
ModelWeld(car.Misc.VisionSLR.Weld,car.Misc.VisionSLR.Weld.Base)
MakeWeld(car.Misc.VisionSLR.Weld.Base,car.DriveSeat)
MakeWeld(car.Misc.VisionSLR.Motors.A,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.B,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.C,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.D,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.E,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.F,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Motors.G,car.DriveSeat,"Motor",5).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.A,car.Misc.VisionSLR.Motors.A).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.B,car.Misc.VisionSLR.Motors.B).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.C,car.Misc.VisionSLR.Motors.C).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.D,car.Misc.VisionSLR.Motors.D).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.E,car.Misc.VisionSLR.Motors.E).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.F,car.Misc.VisionSLR.Motors.F).Name="W"
MakeWeld(car.Misc.VisionSLR.Rotating.G,car.Misc.VisionSLR.Motors.G).Name="W"
return MiscWeld
|
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
-- Place this into StarterGui or StarterPack, then your done!
---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ----
|
repeat wait() until game:GetService("Players").LocalPlayer.Character ~= nil
local runService = game:GetService("RunService")
local input = game:GetService("UserInputService")
local players = game:GetService("Players")
CanToggleMouse = {allowed = true; activationkey = Enum.KeyCode.F;} -- lets you move your mouse around in firstperson
CanViewBody = true -- whether you see your body
Sensitivity = 0.6 -- anything higher would make looking up and down harder; recommend anything between 0~1
Smoothness = 0.05 -- recommend anything between 0~1
FieldOfView = 90 -- fov
local cam = game.Workspace.CurrentCamera
local player = players.LocalPlayer
local m = player:GetMouse()
m.Icon = "http://www.roblox.com/asset/?id=569021388" -- replaces mouse icon
local character = player.Character or player.CharacterAdded:wait()
local humanoidpart = character.HumanoidRootPart
local head = character:WaitForChild("Head")
local CamPos,TargetCamPos = cam.CoordinateFrame.p,cam.CoordinateFrame.p
local AngleX,TargetAngleX = 0,0
local AngleY,TargetAngleY = 0,0
local running = true
local freemouse = false
|
--[[
function newSound(id)
local sound = Instance.new("Sound")
sound.SoundId = id
sound.Parent = script.Parent.Head
return sound
end
local sDied = newSound("rbxasset://sounds/uuhhh.wav")
local sFallingDown = newSound("rbxasset://sounds/splat.wav")
local sFreeFalling = newSound("rbxasset://sounds/swoosh.wav")
local sGettingUp = newSound("rbxasset://sounds/hit.wav")
local sJumping = newSound("rbxasset://sounds/button.wav")
local sRunning = newSound("rbxasset://sounds/bfsl-minifigfoots1.mp3")
sRunning.Looped = true
local Figure = script.Parent
local Head = waitForChild(Figure, "Head")
local Humanoid = waitForChild(Figure, "Humanoid")
function onDied()
sDied:play()
end
function onState(state, sound)
if state then
sound:play()
else
sound:pause()
end
end
function onRunning(speed)
if speed>0 then
sRunning:play()
else
sRunning:pause()
end
end
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(function(state) onState(state, sJumping) end)
Humanoid.GettingUp:connect(function(state) onState(state, sGettingUp) end)
Humanoid.FreeFalling:connect(function(state) onState(state, sFreeFalling) end)
Humanoid.FallingDown:connect(function(state) onState(state, sFallingDown) end)
--]]
|
local nextTime = 0
local runService = game:service("RunService");
while Figure.Parent~=nil do
time = runService.Stepped:wait()
if time > nextTime then
move(time)
nextTime = time + 0.1
end
end
|
-- berenstein polynomial (used in position and derivative functions)
|
function B(n: number, i: number, t: number)
-- factorial function
local function fact(n: number): number
if n == 0 then
return 1
else
return n * fact(n - 1)
end
end
-- return
return (fact(n) / (fact(i) * fact(n - i))) * t^(i) * (1 - t)^(n - i)
end
|
--------------| MODIFY COMMANDS |--------------
|
SetCommandRankByName = {
--["jump"] = "VIP";
["loadmap"] = "Owner";
["savemap"] = "Owner";
};
SetCommandRankByTag = {
--["abusive"] = "Admin";
};
};
|
--[=[
A physical model of a spring, useful in many applications.
A spring is an object that will compute based upon Hooke's law. Properties only evaluate
upon index making this model good for lazy applications.
```lua
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local spring = Spring.new(Vector3.new(0, 0, 0))
RunService.RenderStepped:Connect(function()
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
spring.Target = Vector3.new(0, 0, 1)
else
spring.Target = Vector3.new(0, 0, 0)
end
print(spring.Position) -- A smoothed out version of the input keycode W
end)
```
A good visualization can be found here, provided by Defaultio:
https://www.desmos.com/calculator/hn2i9shxbz
@class Spring
]=]
|
local Spring = {}
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 10 -- cooldown for use of the tool again
ZoneModelName = "Big brain void" -- name the zone model
MobHumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
---------------------------------dont you dare change the speed without editing the sound to match
|
local closed = false
local cooldown = false
local function checkClearance(plr, requiredClearance)
local char = plr.Character
if char then
local inventory = plr.Backpack:GetChildren()
local heldTool = char:FindFirstChildOfClass("Tool")
if heldTool then
table.insert(inventory, heldTool)
end
for i,tool in pairs(inventory) do
if tool and game.ServerStorage.CLEARANCE_TREE:FindFirstChild(tostring(requiredClearance)):FindFirstChild(tool.Name) then
return true
end
end
end
return false
end
local function onPromptTriggered(plr)
if cooldown == true then return end
local char = plr.Character
if char then
local hum = char:FindFirstChildOfClass("Humanoid")
if hum and hum.Health > 0 then
cooldown = true
prompt.MaxActivationDistance = 0
if checkClearance(plr, 2) == true then
reader.Light.Color = Color3.new(0, 1, 0)
readerPrimary.ReaderAccept:Play()
task.wait(.1)
reader.Light.Color = Color3.new(1, 1, 1)
------------------
doorPrimary.Part.SlidingDoor:Play()
closed = not closed
if closed == true then
prompt.ActionText = "Open"
alarmPart.Alarm:Play()
doorCloseTween:Play()
else
prompt.ActionText = "Close"
doorPrimary.Part.Start:Play()
doorOpenTween:Play()
end
task.wait(4)
alarmPart.Alarm:Stop()
else
reader.Light.Color = Color3.new(1, 0, 0)
readerPrimary.ReaderDeny:Play()
task.wait(.1)
reader.Light.Color = Color3.new(1, 1, 1)
end
prompt.MaxActivationDistance = 5
cooldown = false
end
end
end
prompt.Triggered:Connect(onPromptTriggered)
|
--make all the buttons for all the tools
|
for _, tool in pairs(tools:GetChildren()) do
table.insert(toollist, tool)
local b = proto:Clone();
b.Name = "Button"
b.Text = tool.Name
b.Tool.Value = #toollist
b.Parent = script.SpawnGui.Frame.Scroll
end
|
--[[**
ensures Roblox EnumItem type
@param value The value to check against
@returns True iff the condition is satisfied, false otherwise
**--]]
|
t.EnumItem = primitive("EnumItem")
|
-- Create component
|
local ItemList = Roact.Component:extend 'ItemList'
ItemList.defaultProps = {
MaxHeight = 300
}
function ItemList:init(props)
self:setState {
Min = 0,
Max = props.MaxHeight,
CanvasPosition = Vector2.new()
}
-- Create callback for updating canvas boundaries
self.UpdateBoundaries = function (rbx)
if self.Mounted then
self:setState {
CanvasPosition = rbx.CanvasPosition,
Min = rbx.CanvasPosition.Y - rbx.AbsoluteSize.Y,
Max = rbx.CanvasPosition.Y + rbx.AbsoluteSize.Y
}
end
end
end
function ItemList:didMount()
self.Mounted = true
end
function ItemList:willUnmount()
self.Mounted = false
end
function ItemList:didUpdate(previousProps, previousState)
local IsScrollTargetSet = self.props.ScrollTo and
(previousProps.ScrollTo ~= self.props.ScrollTo)
-- Reset canvas position whenever scope updates (unless a scrolling target is set)
if (previousProps.Scope ~= self.props.Scope) and (not IsScrollTargetSet) then
self:setState({
CanvasPosition = Vector2.new(0, 0);
Min = 0;
Max = self.props.MaxHeight;
})
end
end
function ItemList:render()
local props = self.props
local state = self.state
-- Keep track of how many items are out of view
local SkippedAbove = 0
local SkippedBelow = 0
local TargetCanvasPosition
-- Declare a button for each item
local ItemList = {}
local VisibleItemCount = 0
local ItemHeight = props.RowHeight
-- Go through each item in order
local OrderedItems = Support.Values(props.Items)
table.sort(OrderedItems, function (A, B)
return A.Order < B.Order
end)
for i = 1, #OrderedItems do
local Item = OrderedItems[i]
-- Get item parent state
local ParentId = Item.Parent and props.IdMap[Item.Parent]
local ParentState = ParentId and props.Items[ParentId]
-- Determine visibility and depth from ancestors
local Visible = true
local Depth = 0
if ParentId then
local ParentState = ParentState
while ParentState do
-- Stop if ancestor not visible
if not ParentState.Expanded then
Visible = nil
break
-- Count visible ancestors
else
Depth = Depth + 1
end
-- Check next ancestor
local ParentId = props.IdMap[ParentState.Parent]
ParentState = props.Items[ParentId]
end
end
-- Set canvas position to begin at item if requested and out-of-view
if (Item.Id == props.ScrollTo) and (self.ScrolledTo ~= props.ScrollTo) then
local ItemPosition = VisibleItemCount * props.RowHeight
if ItemPosition < state.CanvasPosition.Y or
ItemPosition > (state.CanvasPosition.Y + props.MaxHeight) then
TargetCanvasPosition = Vector2.new(0, ItemPosition)
self.ScrolledTo = Item.Id
end
end
-- Calculate whether item is in view
if Visible then
VisibleItemCount = VisibleItemCount + 1
local ItemTop = (VisibleItemCount - 1) * props.RowHeight
if ItemTop < state.Min then
SkippedAbove = SkippedAbove + 1
Visible = nil
elseif ItemTop > state.Max then
SkippedBelow = SkippedBelow + 1
Visible = nil
end
end
-- Declare component for item
ItemList[Item.Id] = Visible and new(ItemRow, Support.Merge({}, Item, {
Depth = Depth,
Core = props.Core,
ToggleExpand = props.ToggleExpand,
Height = props.RowHeight
}))
end
return new(ScrollingFrame, {
Layout = 'List',
LayoutDirection = 'Vertical',
CanvasSize = UDim2.new(1, -2, 0, VisibleItemCount * props.RowHeight),
Size = UDim2.new(1, 0, 0, VisibleItemCount * props.RowHeight),
CanvasPosition = TargetCanvasPosition or state.CanvasPosition,
ScrollBarThickness = 4,
ScrollBarImageTransparency = 0.6,
VerticalScrollBarInset = 'ScrollBar',
[Roact.Change.CanvasPosition] = self.UpdateBoundaries,
[Roact.Children] = Support.Merge(ItemList, {
TopSpacer = new(Frame, {
Size = UDim2.new(0, 0, 0, SkippedAbove * props.RowHeight),
LayoutOrder = 0
}),
BottomSpacer = new(Frame, {
Size = UDim2.new(0, 0, 0, SkippedBelow * props.RowHeight),
LayoutOrder = #OrderedItems + 1
}),
SizeConstraint = new('UISizeConstraint', {
MinSize = Vector2.new(0, 20),
MaxSize = Vector2.new(math.huge, props.MaxHeight)
})
})
})
end
return ItemList
|
--Every 40 seconds, the bell has a 35% chance to ring 6 times.
|
while true do
wait(20)
ring = math.random(1,10)
if ring == 1 then
for i = 1,1 do
wait(.3)
script.Parent.RadioSystem3:play()
wait(1.2)
end
elseif ring == 5 then
for i = 1,1 do
wait(.3)
script.Parent.RadioSystem2:play()
wait(1.2)
end
elseif ring == 10 then
for i = 1,1 do
wait(.3)
script.Parent.RadioSystem:play()
wait(1.2)
end
end
end
|
--local cameraType = Enum.CameraType.Follow
|
local movement = Vector2.new()
local gamepadDeadzone = 0.14
car.DriveSeat.Changed:connect(function(property)
if property == "Steer" then
movement = Vector2.new(car.DriveSeat.Steer, movement.Y)
elseif property == "Throttle" then
movement = Vector2.new(movement.X, car.DriveSeat.Throttle)
end
end)
|
--[=[
Accepts an array of Promises and returns a new promise that is resolved or rejected as soon as any Promise in the array resolves or rejects.
:::warning
If the first Promise to settle from the array settles with a rejection, the resulting Promise from `race` will reject.
If you instead want to tolerate rejections, and only care about at least one Promise resolving, you should use [Promise.any](#any) or [Promise.some](#some) instead.
:::
All other Promises that don't win the race will be cancelled if they have no other consumers.
```lua
local promises = {
returnsAPromise("example 1"),
returnsAPromise("example 2"),
returnsAPromise("example 3"),
}
return Promise.race(promises) -- Only returns 1st value to resolve or reject
```
@param promises: {Promise<T>}
@return Promise<T>
]=]
|
function Promise.race(promises)
assert(type(promises) == "table", string.format(ERROR_NON_LIST, "Promise.race"))
for i, promise in pairs(promises) do
assert(Promise.is(promise), string.format(ERROR_NON_PROMISE_IN_LIST, "Promise.race", tostring(i)))
end
return Promise._new(debug.traceback(nil, 2), function(resolve, reject, onCancel)
local newPromises = {}
local finished = false
local function cancel()
for _, promise in ipairs(newPromises) do
promise:cancel()
end
end
local function finalize(callback)
return function (...)
cancel()
finished = true
return callback(...)
end
end
if onCancel(finalize(reject)) then
return
end
for i, promise in ipairs(promises) do
newPromises[i] = promise:andThen(finalize(resolve), finalize(reject))
end
if finished then
cancel()
end
end)
end
|
--TweenParts
|
local Hinge = script.Parent.Parent.Hinge
local OpenHinge = script.Parent.Parent.Open
local ClosedHinge = script.Parent.Parent.Closed
|
--use this to determine if you want this human to be harmed or not, returns boolean
|
local function boom()
wait(1)
Used = true
Object.Anchored = false
Object.Transparency = 1
Object.CanCollide = true
Object.Sparks.Enabled = false
Object.Orientation = Vector3.new(0,0,0)
Object.Fuse:Stop()
Object.Explode:Play()
Object.Dist:Play()
Object.Explosion:Emit(100)
Explode()
end
boom()
|
-- functions
|
function onSoundDied()
sDied:Play()
end
function onState(state, sound)
if state then
sound:Play()
else
sound:Pause()
end
end
function onSoundRunning(speed)
if speed>0 then
sRunning:Play()
else
sRunning:Pause()
end
end
|
--[[Transmission]]
|
Tune.TransModes = {"Semi",} --[[
[Modes]
"Auto" : Automatic shifting
"Semi" : Clutchless manual shifting, dual clutch transmission
"Manual" : Manual shifting with clutch
>Include within brackets
eg: {"Semi"} or {"Auto", "Manual"}
>First mode is default mode ]]
--Automatic Settings
Tune.AutoShiftMode = "RPM" --[[
[Modes]
"Speed" : Shifts based on wheel speed
"RPM" : Shifts based on RPM ]]
Tune.AutoUpThresh = -200 -- Automatic upshift point (relative to peak RPM, positive = Over-rev)
Tune.AutoDownThresh = 1400 -- Automatic downshift point (relative to peak RPM, positive = Under-rev)
Tune.ShiftTime = .3 -- The time delay in which you initiate a shift and the car changes gear
--Gear Ratios
Tune.FinalDrive = 3.21 -- [TRANSMISSION CALCULATIONS FOR NERDS]
Tune.Ratios = { -- SPEED [SPS] = (Wheel diameter(studs) * pi(3.14) * RPM) / (60 * Gear Ratio * Final Drive * Multiplier)
--[[Reverse]] 5.000 ,-- WHEEL TORQUE = Engine Torque * Gear Ratio * Final Drive * Multiplier
--[[Neutral]] 0 ,
--[[ 1 ]] 3.519 ,
--[[ 2 ]] 2.320 ,
--[[ 3 ]] 1.700 ,
--[[ 4 ]] 1.400 ,
--[[ 5 ]] 0.907 ,
}
Tune.FDMult = 1.5 -- Ratio multiplier (keep this at 1 if car is not struggling with torque)
|
--[=[
Same as `andThenCall`, except for `done`.
Attaches a `done` handler to this Promise that calls the given callback with the predefined arguments.
@param callback (...: any) -> any
@param ...? any -- Additional arguments which will be passed to `callback`
@return Promise
]=]
|
function Promise.prototype:doneCall(callback, ...)
assert(type(callback) == "function", string.format(ERROR_NON_FUNCTION, "Promise:doneCall"))
local length, values = pack(...)
return self:_finally(debug.traceback(nil, 2), function()
return callback(unpack(values, 1, length))
end, true)
end
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.CandyBasket
|
--[[Steering]]
|
function Steering(dt)
local deltaTime = (60/(1/dt))
--Mouse Steer
if _MSteer then
local msWidth = math.max(1,mouse.ViewSizeX*_Tune.Peripherals.MSteerWidth/200)
local mdZone = _Tune.Peripherals.MSteerDZone/100
local mST = ((mouse.X-mouse.ViewSizeX/2)/msWidth)
if math.abs(mST)<=mdZone then
_GSteerT = 0
else
_GSteerT = (math.max(math.min((math.abs(mST)-mdZone),(1-mdZone)),0)/(1-mdZone))^_Tune.MSteerExp * (mST / math.abs(mST))
end
end
_GSteerC = (_GSteerC+((_GSteerT-_GSteerC)*(_Tune.LeanSpeed*deltaTime)))
--Apply Steering
bike.Body.bal.LeanGyro.cframe = CFrame.new(bike.Body.bal.CFrame.p,bike.Body.bal.CFrame.p+bike.Body.bal.CFrame.lookVector)*CFrame.Angles(0,0,((_GSteerC*_Tune.LeanProgressiveness)*(math.rad(_Tune.MaxLean)/(bike.DriveSeat.Velocity.Magnitude+_Tune.LeanProgressiveness))-(_GSteerC*math.rad(_Tune.MaxLean))))
--Apply Low Speed Steering
bike.FrontSection.TripleTreeHinge.SteeringGyro.CFrame=bike.Body.SteeringHinge.CFrame*CFrame.Angles(math.rad(_GSteerT*_Tune.SteerAngle),0,0)
bike.FrontSection.TripleTreeHinge.SteeringGyro.MaxTorque = Vector3.new(_Tune.SteerMaxTorque*((math.max((_Tune.LowSpeedCut-bike.DriveSeat.Velocity.Magnitude)/_Tune.LowSpeedCut,0))^2),0,0)
end
if UserInputService.TouchEnabled then
local Buttons = script.Parent:WaitForChild("Buttons")
local Left = Buttons:WaitForChild("Left")
local Right = Buttons:WaitForChild("Right")
local Brake = Buttons:WaitForChild("Brake")
local Gas = Buttons:WaitForChild("Gas")
local Downshift = Buttons.Downshift
local Upshift = Buttons.Upshift
local Handbrake = Buttons:WaitForChild("Handbrake")
local Thread = coroutine.wrap(function()
while true do
wait(0.5)
if _TMode == "Manual" or _TMode == "DCT" then
Downshift.Visible = true
Upshift.Visible = true
else
Downshift.Visible = false
Upshift.Visible = false
end
end
end)
Thread()
Buttons.Visible = true
local function LeftTurn(Touch, GPE)
if Touch.UserInputState == Enum.UserInputState.Begin then
_GSteerT = -1
_SteerL = true
else
if _SteerR then
_GSteerT = 1
else
_GSteerT = 0
end
_SteerL = false
end
end
Left.InputBegan:Connect(LeftTurn)
Left.InputEnded:Connect(LeftTurn)
--Left.InputChanged:Connect(LeftTurn)
local function RightTurn(Touch, GPE)
if Touch.UserInputState == Enum.UserInputState.Begin then
_GSteerT = 1
_SteerR = true
else
if _SteerL then
_GSteerT = -1
else
_GSteerT = 0
end
_SteerR = false
end
end
Right.InputBegan:Connect(RightTurn)
Right.InputEnded:Connect(RightTurn)
--Right.InputChanged:Connect(RightTurn)
local function TouchThrottle(input, GPE)
if input.UserInputState == Enum.UserInputState.Begin then
_InThrot = 1
_TTick = tick()
else
_InThrot = _Tune.IdleThrottle/100
_BTick = tick()
end
end
Gas.InputBegan:Connect(TouchThrottle)
Gas.InputEnded:Connect(TouchThrottle)
--Gas.InputChanged:Connect(TouchThrottle)
local function TouchBrake(input, GPE)
if input.UserInputState == Enum.UserInputState.Begin then
_InBrake = 1
else
_InBrake = 0
end
end
Brake.InputBegan:Connect(TouchBrake)
Brake.InputEnded:Connect(TouchBrake)
--Brake.InputChanged:Connect(TouchBrake)
local function TouchHandbrake(input, GPE)
if input.UserInputState == Enum.UserInputState.Begin then
_PBrake = not _PBrake
elseif input.UserInputState == Enum.UserInputState.End then
if bike.DriveSeat.Velocity.Magnitude > 5 then
_PBrake = false
end
end
end
Handbrake.InputBegan:Connect(TouchHandbrake)
Handbrake.InputEnded:Connect(TouchHandbrake)
local function TouchDownshift(input, GPE)
if ((_IsOn and ((_TMode == "Auto" and _CGear <= 1) and _Tune.AutoShiftVers == "New") or _TMode == "DCT") or _TMode == "Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftDn then
_ShiftDn = true
end
end
end
Downshift.InputBegan:Connect(TouchDownshift)
local function TouchUpshift(input, GPE)
if ((_IsOn and ((_TMode == "Auto" and _CGear < 1) and _Tune.AutoShiftVers == "New") or _TMode == "DCT") or _TMode == "Manual") and input.UserInputState == Enum.UserInputState.Begin then
if not _ShiftUp then
_ShiftUp = true
end
end
end
Upshift.InputBegan:Connect(TouchUpshift)
end
|
---- DISCORD WEBHOOK CONFIG IS IN SERVERSCRIPTSERVICE (report)
|
sendbtn.MouseButton1Click:Connect(function()
if sendcheck == false then -- checks if it was sent recently
sendcheck = true
send:FireServer(message.Text, testage.Text, titlage.Text, addlage.Text, sendcheck) -- sends it to server from client (serverscriptservice)
sendbtn.Text = "Sent!" -- Customize if you want
wait(0.7)-- Customize if you want
sendbtn.Text = "Check Your Channel!"-- Customize if you want
wait(1.5)-- Customize if you want
sendbtn.Text = "Send"-- Customize if you want
cooldowntxt.Visible = true
wait(30)-- Customize if you want
sendcheck = false
cooldowntxt.Visible = false
end
end)
print("Config loaded")
|
--StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
|
StarterGui.ResetPlayerGuiOnSpawn = false
StarterGui:SetCore("ResetButtonCallback", false)
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 18
local slash_damage = 18
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "http://www.roblox.com/asset/?id=10730819"
SlashSound.Parent = sword
SlashSound.Volume = 1
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "http://www.roblox.com/asset/?id=12722518"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
tagHumanoid(humanoid, vPlayer)
humanoid:TakeDamage(damage)
wait(1)
untagHumanoid(humanoid)
end
end
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
attack()
wait(1)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
|
--Returns whether the given position is under cover
|
local function UnderObject(pos, l)
l = l or 120
local hit, position = Workspace:FindPartOnRayWithIgnoreList(Ray.new(pos, UpVec * l), ignoreList)
if hit then
return hit.Transparency ~= 1 and true or UnderObject(position + UpVec, l - (pos - position).Magnitude)
else
return false
end
end
|
-- if not gameRules.SpawnStacking then
-- if not spawner.CurrentGun.Value then
-- spawner.Config.WaitTime.Value = spawner.Config.WaitTime.Value - 1
-- end
-- else
-- spawner.Config.WaitTime.Value = spawner.Config.WaitTime.Value - 1
-- end
| |
--//Setup//--
|
local SpawnEvent = game.ReplicatedStorage:WaitForChild("SpawnEvent")
|
--[[Remove Character Weight]]
|
--Get Seats
local Seats = {}
function getSeats(p)
for i,v in pairs(p:GetChildren()) do
if v:IsA("VehicleSeat") or v:IsA("Seat") then
local seat = {}
seat.Seat = v
seat.Parts = {}
table.insert(Seats,seat)
end
getSeats(v)
end
end
getSeats(bike)
--Store Physical Properties/Remove Mass Function
function getPProperties(mod,t)
for i,v in pairs(mod:GetChildren()) do
if v:IsA("BasePart") then
if v.CustomPhysicalProperties == nil then v.CustomPhysicalProperties = PhysicalProperties.new(v.Material) end
table.insert(t,{v,v.CustomPhysicalProperties})
v.CustomPhysicalProperties = PhysicalProperties.new(
0,
v.CustomPhysicalProperties.Friction,
v.CustomPhysicalProperties.Elasticity,
v.CustomPhysicalProperties.FrictionWeight,
v.CustomPhysicalProperties.ElasticityWeight
)
end
getPProperties(v,t)
end
end
--Apply Seat Handler
for i,v in pairs(Seats) do
--Sit Handler
v.Seat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and child.Part1~=nil and child.Part1.Parent ~= workspace and not child.Part1.Parent:IsDescendantOf(bike) then
v.Parts = {}
getPProperties(child.Part1.Parent,v.Parts)
end
end)
--Leave Handler
v.Seat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(v.Parts) do
if v[1]~=nil and v[2]~=nil and v[1]:IsDescendantOf(workspace) then
v[1].CustomPhysicalProperties = v[2]
end
end
v.Parts = {}
end
end)
end
|
--[[
TEMPLATE FOR CUSTOM DESPAWN EFFECT:
[INT] = function(Model, DespawnTime)
-- // YOUR CODE HERE
return true
end;
--]]
|
local DespawnTypes = {
[1] = function(Model, DespawnTime)
wait(DespawnTime)
for i, v in pairs(Model:GetDescendants()) do
if v:IsA("BasePart") then
local TweenInfo_ = TweenInfo.new(1)
TweenService:Create(v, TweenInfo_, {Transparency = 1}):Play()
end
end
Model:Destroy()
return true
end;
[2] = function(Model, DespawnTime)
wait(DespawnTime)
Model:Destroy()
end;
}
function module.GetInfo(Type)
if Type ~= "Random" then
return DespawnTypes[Type]
elseif Type == "Random" then
local RandomDespawn = DespawnTypes[math.random(1, #DespawnTypes)]
repeat RandomDespawn = DespawnTypes[math.random(1, #DespawnTypes)] wait() until RandomDespawn ~= "Random"
return RandomDespawn
end
end
return module
|
--// Probabilities
|
JamChance = 0; -- This is percent scaled. For 100% Chance of jamming, put 100, for 0%, 0; and everything inbetween
TracerChance = 0; -- This is the percen scaled. For 100% Chance of showing tracer, put 100, for 0%, 0; and everything inbetween
|
-- Services
|
local PathfindingService = game:GetService("PathfindingService")
local TweenService = game:GetService("TweenService")
|
--// J key, Stages
|
mouse.KeyDown:connect(function(key)
if key=="j" then
veh.Lightbar.middle.Beep:Play()
veh.Lightbar.Remotes.RemoteEvent:FireServer(true)
end
end)
|
--[[Steering]]
|
Tune.SteerInner = 30 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 30 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .07 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 330 -- 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
|
---[[ Fade Out and In Settings ]]
|
module.ChatWindowBackgroundFadeOutTime = 5 --Chat background will fade out after this many seconds.
module.ChatWindowTextFadeOutTime = 45 --Chat text will fade out after this many seconds.
module.ChatDefaultFadeDuration = 1.6
module.ChatShouldFadeInFromNewInformation = false
module.ChatAnimationFPS = 60.0
|
--[[Weight Scaling]]
--[Cubic stud : pounds ratio]
--[STANDARDIZED: Don't touch unless needed]
|
Tune.WeightScaling = 1/50 --Default = 1/50 (1 cubic stud = 50 lbs)
Tune.LegacyScaling = 1/10 --Default = 1/10 (1 cubic stud = 10 lbs) [PGS OFF]
return Tune
|
-- Existance in this list signifies that it is an emote, the value indicates if it is a looping emote
|
local emoteNames = { wave = false, point = false, dance1 = true, dance2 = true, dance3 = true, laugh = false, cheer = false}
function configureAnimationSet(name, fileList)
if (animTable[name] ~= nil) then
for _, connection in pairs(animTable[name].connections) do
connection:disconnect()
end
end
animTable[name] = {}
animTable[name].count = 0
animTable[name].totalWeight = 0
animTable[name].connections = {}
-- check for config values
local config = script:FindFirstChild(name)
if (config ~= nil) then
-- print("Loading anims " .. name)
table.insert(animTable[name].connections, config.ChildAdded:connect(function(child) configureAnimationSet(name, fileList) end))
table.insert(animTable[name].connections, config.ChildRemoved:connect(function(child) configureAnimationSet(name, fileList) end))
local idx = 1
for _, childPart in pairs(config:GetChildren()) do
if (childPart:IsA("Animation")) then
table.insert(animTable[name].connections, childPart.Changed:connect(function(property) configureAnimationSet(name, fileList) end))
animTable[name][idx] = {}
animTable[name][idx].anim = childPart
local weightObject = childPart:FindFirstChild("Weight")
if (weightObject == nil) then
animTable[name][idx].weight = 1
else
animTable[name][idx].weight = weightObject.Value
end
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + animTable[name][idx].weight
-- print(name .. " [" .. idx .. "] " .. animTable[name][idx].anim.AnimationId .. " (" .. animTable[name][idx].weight .. ")")
idx = idx + 1
end
end
end
-- fallback to defaults
if (animTable[name].count <= 0) then
for idx, anim in pairs(fileList) do
animTable[name][idx] = {}
animTable[name][idx].anim = Instance.new("Animation")
animTable[name][idx].anim.Name = name
animTable[name][idx].anim.AnimationId = anim.id
animTable[name][idx].weight = anim.weight
animTable[name].count = animTable[name].count + 1
animTable[name].totalWeight = animTable[name].totalWeight + anim.weight
-- print(name .. " [" .. idx .. "] " .. anim.id .. " (" .. anim.weight .. ")")
end
end
end
|
-- find player's head pos
|
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local head = vCharacter:findFirstChild("Head")
if head == nil then return end
local dir = mouse_pos - head.Position
dir = computeDirection(dir)
local launch = head.Position + 5 * dir
local delta = mouse_pos - launch
local dy = delta.y
local new_delta = Vector3.new(delta.x, 0, delta.z)
delta = new_delta
local dx = delta.magnitude
local unit_delta = delta.unit
-- acceleration due to gravity in RBX units
local g = (-9.81 * 20)
local theta = computeLaunchAngle( dx, dy, g)
local vy = math.sin(theta)
local xz = math.cos(theta)
local vx = unit_delta.x * xz
local vz = unit_delta.z * xz
local missile = Pellet:clone()
missile.Position = launch
missile.Velocity = Vector3.new(vx,vy,vz) * VELOCITY
missile.PelletScript.Disabled = false
missile.Explosives.Disabled = false
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = vPlayer
creator_tag.Name = "creator"
creator_tag.Parent = missile
missile.Parent = game.Workspace
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
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
fire(targetPos)
wait(0)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
--[[ Derived classes are required to override and implement all of the following functions ]]
|
--
function GetOcclusionMode()
-- Must be overridden in derived classes to return an Enum.DevCameraOcclusionMode value
warn("BaseOcclusion GetOcclusionMode must be overridden by derived classes")
return nil
end
function BaseOcclusion:Enable(enabled)
warn("BaseOcclusion Enable must be overridden by derived classes")
end
function BaseOcclusion:Update(dt, desiredCameraCFrame, desiredCameraFocus)
warn("BaseOcclusion Update must be overridden by derived classes")
return desiredCameraCFrame, desiredCameraFocus
end
return BaseOcclusion
|
--KEEP THIS SCIRPT!, THIS HOLDS THE PARTS TOGETHER!!!!!
| |
--[=[
Like start, but also from (list!)
@param callback () -> { T }
@return (source: Observable) -> Observable
]=]
|
function Rx.startFrom(callback)
assert(type(callback) == "function", "Bad callback")
return function(source)
assert(Observable.isObservable(source), "Bad observable")
return Observable.new(function(sub)
for _, value in pairs(callback()) do
sub:Fire(value)
end
return source:Subscribe(sub:GetFireFailComplete())
end)
end
end
|
--Gear Ratios
|
Tune.FinalDrive = 2.93 -- Gearing determines top speed and wheel torque
Tune.Ratios = { -- Higher ratio = more torque, Lower ratio = higher top speed
--[[Reverse]] 3.460 , -- Copy and paste a ratio to add a gear
--[[Neutral]] 0 , -- Ratios can also be deleted
--[[ 1 ]] 5.00 , -- Reverse, Neutral, and 1st gear are required
--[[ 2 ]] 3.20 ,
--[[ 3 ]] 2.14 ,
--[[ 4 ]] 1.72 ,
--[[ 5 ]] 1.31 ,
--[[ 6 ]] 1.00 ,
--[[ 7 ]] 0.82 ,
--[[ 8 ]] 0.64 ,
}
Tune.FDMult = 1.6 -- Ratio multiplier (Change this value instead of FinalDrive if car is struggling with torque ; Default = 1)
|
-- Watch for blacklisted additions to PlayerGui
|
plr:WaitForChild("PlayerGui").ChildAdded:connect(function(child)
-- Kick if blacklisted
wait()
local okay = true
for _, i in pairs(playerGuiBlacklist) do
if child.Name == i then
okay = false
break
end
end
if not okay then
kick()
end
end)
|
-- booooriiiiing
|
local p1 = script.Parent.Pivot1
local p2 = script.Parent.Pivot2
local TS = game:GetService("TweenService")
local deb = false
local toggled = false
local cd1 = Instance.new("ClickDetector",script.Parent.L)
local cd2 = Instance.new("ClickDetector",script.Parent.R)
cd1.MaxActivationDistance = 5
cd2.MaxActivationDistance = 5
local cf1 = p1.CFrame
local cf2 = p2.CFrame
local function box() -- full of chickenpox! ☻☻☻☻
if not deb then
local anim1
local anim2
if not toggled then
anim1 = TS:Create(p1,TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = cf1*CFrame.Angles(math.rad(150),0,0)})
anim2 = TS:Create(p2,TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = cf2*CFrame.Angles(-math.rad(160),0,0)})
else
anim1 = TS:Create(p1,TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = cf1})
anim2 = TS:Create(p2,TweenInfo.new(1.5,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut,0,false,0),{CFrame = cf2})
end
anim1.Completed:Connect(function()
toggled = not toggled
deb = false
end)
anim1:Play()
anim2:Play()
end
end
cd1.MouseClick:Connect(function()
box()
end)
cd2.MouseClick:Connect(function()
box()
end)
|
--[=[
Requires all the modules that are children of the given parent. This is an easy
way to quickly load all services that might be in a folder.
```lua
Knit.AddServices(somewhere.Services)
```
]=]
|
function KnitServer.AddServices(parent: Instance): { Service }
local addedServices = {}
for _, v in parent:GetChildren() do
if not v:IsA("ModuleScript") then
continue
end
table.insert(addedServices, require(v))
end
return addedServices
end
|
-- Local Functions
|
local function OnScoreChange(team, score)
ScoreFrame[tostring(team.TeamColor)].Text = score
end
local function OnDisplayVictory(winningTeam)
if winningTeam then
VictoryFrame.Visible = true
if winningTeam == 'Tie' then
VictoryFrame.Tie.Visible = true
else
VictoryFrame.Win.Visible = true
local WinningFrame = VictoryFrame.Win.TeamDisplay
WinningFrame.Size = UDim2.new(0, string.len(winningTeam.TeamColor.Name) * 19, 0, 50)
WinningFrame.Position = UDim2.new(0, -WinningFrame.Size.X.Offset, 0, 0)
WinningFrame.TextColor3 = winningTeam.TeamColor.Color
WinningFrame.Text = winningTeam.TeamColor.Name
WinningFrame.Visible = true
end
else
VictoryFrame.Visible = false
VictoryFrame.Win.Visible = false
VictoryFrame.Win.TeamDisplay.Visible = false
VictoryFrame.Tie.Visible = false
end
end
local function OnResetMouseIcon()
Mouse.Icon = MouseIcon
end
|
--[=[
@within TableUtil
@function Flat
@param tbl table
@param depth number?
@return table
Returns a new table where all sub-arrays have been
bubbled up to the top. The depth at which the scan
is performed is dictated by the `depth` parameter,
which is set to `1` by default.
```lua
local t = {{10, 20}, {90, 100}, {30, 15}}
local flat = TableUtil.Flat(t)
print(flat) --> {10, 20, 90, 100, 30, 15}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=]
|
local function Flat<T>(tbl: { T }, depth: number?): { T }
local maxDepth: number = if type(depth) == "number" then depth else 1
local flatTbl = table.create(#tbl)
local function Scan(t: { any }, d: number)
for _, v in t do
if type(v) == "table" and d < maxDepth then
Scan(v, d + 1)
else
table.insert(flatTbl, v)
end
end
end
Scan(tbl, 0)
return flatTbl
end
|
---------Main Events--------------
|
local Events = Tool:WaitForChild("Events")
local ShootRE = Events:WaitForChild("ShootRE")
local bulletRE = Events:WaitForChild("CreateBullet")
local LeftButtonDown
local Reloading = false
local IsShooting = false
local Pitch = script.Parent.Handle.FireSound
|
-- goro7
|
local plr = game.Players.LocalPlayer
function update()
-- Calculate scale
local scale = (plr.PlayerGui.MainGui.AbsoluteSize.Y + 30) / script.Parent.Parent.Size.Y.Offset
if scale > 1.5 then
scale = 1.5
end
if scale > 0 then
script.Parent.Scale = scale
end
end
plr.PlayerGui:WaitForChild("MainGui"):GetPropertyChangedSignal("AbsoluteSize"):connect(update)
update()
|
-- Check if character is there
|
if script.Owner.Value.Character ~= nil then
-- Find knife
local knife = nil
if script.Owner.Value.Backpack:FindFirstChild("Knife") then
knife = script.Owner.Value.Backpack.Knife
elseif script.Owner.Value.Character:FindFirstChild("Knife") then
knife = script.Owner.Value.Character.Knife
end
if knife ~= nil then
-- Make sounds volume of 0
knife.KnifeScript.KnifeProjectileScript.Thud.Volume = 0
knife.KnifeScript.KnifeProjectileScript.Woosh.Volume = 0
knife.Handle.Draw.Volume = 0
knife.Handle.Hit.Volume = 0
knife.Handle.Swing.Volume = 0
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.