prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
wait(.1)
|
shaft:remove()
end
t, s = r.Stepped:wait()
note = script.Parent.chord
note:play()
d = t + 10.0 - s
--connection = shaft.Touched:connect(blow)
while t < d do
for i = 1,10 do
fly()
t = r.Stepped:wait()
end
switchpos()
end
-- at max range
--script.Parent.Explosion.PlayOnRemove = false
note:stop()
shaft:remove()
|
--CoolDown 1/2 |
if CoolDown.Value == true then
CoolDown.Value = false
|
-- Functions |
function SPRING.Create(self, mass, force, damping, speed)
local spring = {
Target = Vector3.new();
Position = Vector3.new();
Velocity = Vector3.new();
Mass = mass or 1;
Force = force or 50;
Damping = damping or 2;
Speed = speed or 1;
}
function spring.Shove(self, force)
local x, y, z = force.X, force.Y, force.Z
if x ~= x or x == math.huge or x == -math.huge then
x = 0
end
if y ~= y or y == math.huge or y == -math.huge then
y = 0
end
if z ~= z or z == math.huge or z == -math.huge then
z = 0
end
self.Velocity = self.Velocity + Vector3.new(x, y, z)
end
function spring.Update(self, dt)
local scaledDeltaTime = math.min(dt * self.Speed, 0.1)
local force = self.Target - self.Position
local acceleration = (force * self.Force) / self.Mass
acceleration = acceleration - self.Velocity * self.Damping
self.Velocity = self.Velocity + acceleration * scaledDeltaTime
self.Position = self.Position + self.Velocity * scaledDeltaTime
return self.Position
end
return spring
end
|
--// WebPanel module uploaded as a group model due to there being multiple maintainers
--// Module source available at https://www.roblox.com/library/6289861017/WebPanel-Module |
return function(Vargs)
local server = Vargs.Server;
local service = Vargs.Service;
local settings = server.Settings;
--[[
settings.WebPanel_Enabled = true;
wait(1)
settings.WebPanel_ApiKey = _G.ADONIS_WEBPANEL_TESTING_APIKEY;
--]]
--// Note: This will only run/be required if the WebPanel_Enabled setting is true at server startup
if server.Settings.WebPanel_Enabled then
local WebModFunc = require(6289861017)
if WebModFunc then
WebModFunc(Vargs)
end
end
end
|
--Clutch: "RPM" mode |
Tune.ClutchRPMMult = 1.0 -- Clutch RPM multiplier, recommended to leave at 1.0
|
-- Disable the healthbar |
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health,false)
|
--[[ Public API ]] | --
function TouchJump:Enable()
JumpButton.Visible = true
end
function TouchJump:Disable()
JumpButton.Visible = false
OnInputEnded()
end
function TouchJump:Create(parentFrame)
if JumpButton then
JumpButton:Destroy()
JumpButton = nil
end
local isSmallScreen = parentFrame.AbsoluteSize.y <= 500
local jumpButtonSize = isSmallScreen and 70 or 90
JumpButton = Instance.new('ImageButton')
JumpButton.Name = "JumpButton"
JumpButton.Visible = false
JumpButton.BackgroundTransparency = 1
JumpButton.Image = TOUCH_CONTROL_SHEET
JumpButton.ImageRectOffset = Vector2.new(176, 222)
JumpButton.ImageRectSize = Vector2.new(174, 174)
JumpButton.Size = UDim2.new(0, jumpButtonSize, 0, jumpButtonSize)
JumpButton.Position = isSmallScreen and UDim2.new(1, jumpButtonSize * -2.25, 1, -jumpButtonSize - 20) or
UDim2.new(1, jumpButtonSize * -2.75, 1, -jumpButtonSize - 120)
local touchObject = nil
JumpButton.InputBegan:connect(function(inputObject)
if touchObject or inputObject.UserInputType ~= Enum.UserInputType.Touch then
return
end
touchObject = inputObject
JumpButton.ImageRectOffset = Vector2.new(0, 222)
if MasterControl then
MasterControl(true)
end
end)
OnInputEnded = function()
touchObject = nil
if MasterControl then
MasterControl(false)
end
JumpButton.ImageRectOffset = Vector2.new(176, 222)
end
JumpButton.InputEnded:connect(function(inputObject)
if inputObject == touchObject then
OnInputEnded()
end
end)
JumpButton.Parent = parentFrame
return function(func)
MasterControl = func
end
end
return TouchJump
|
--Miksu173-- |
r = game:service("RunService")
shaft = script.Parent
position = shaft.Position
script.Parent.Explosion.PlayOnRemove = true -- play explosion sound when projectile removed from game
function fly()
direction = shaft.CFrame.lookVector
position = position + direction * 5
error = position - shaft.Position
shaft.Velocity = 7*error
end
function blow()
swoosh:stop()
explosion = Instance.new("Explosion")
explosion.BlastRadius = 12
explosion.BlastPressure = 1000000 -- these are really wussy units
explosion.Position = shaft.Position
-- find instigator tag
local creator = script.Parent:findFirstChild("creator")
if creator ~= nil then
explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end)
end
explosion.Parent = game.Workspace
connection:disconnect()
wait(.1)
shaft:remove()
end
function onPlayerBlownUp(part, distance, creator)
if part.Name == "Head" then
local humanoid = part.Parent.Humanoid
tagHumanoid(humanoid, creator)
end
end
function tagHumanoid(humanoid, creator)
-- tag does not need to expire iff all explosions lethal
if creator ~= nil then
local new_tag = creator:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
t, s = r.Stepped:wait()
swoosh = script.Parent.Swoosh
swoosh:play()
d = t + 10.0 - s
connection = shaft.Touched:connect(blow)
while t < d do
fly()
t = r.Stepped:wait()
end
|
-- Requires |
local PartUtility = require(ReplicatedStorage.Common.PartUtility)
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]] |
function Promise:andThen(successHandler, failureHandler)
-- Even if we haven't specified a failure handler, the rejection will be automatically
-- passed on by the advancer; other promises in the chain may have unhandled rejections,
-- but this one is taken care of as soon as any andThen is connected
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise.new(function(resolve, reject)
-- Our default callbacks just pass values onto the next promise.
-- This lets success and failure cascade correctly!
local successCallback = resolve
if successHandler then
successCallback = createAdvancer(successHandler, resolve, reject)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(failureHandler, resolve, reject)
end
if self._status == Promise.Status.Started then
-- If we haven't resolved yet, put ourselves into the queue
table.insert(self._queuedResolve, successCallback)
table.insert(self._queuedReject, failureCallback)
elseif self._status == Promise.Status.Resolved then
-- This promise has already resolved! Trigger success immediately.
successCallback(unpack(self._value))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._value))
end
end)
end
|
-- This screenGui exists so that the billboardGui is not deleted when the PlayerGui is reset. |
local BubbleChatScreenGui = Instance.new("ScreenGui")
BubbleChatScreenGui.Name = "BubbleChat"
BubbleChatScreenGui.ResetOnSpawn = false
BubbleChatScreenGui.Parent = PlayerGui
local testLabel = Instance.new("TextLabel")
testLabel.Selectable = false
testLabel.TextWrapped = true
testLabel.Position = UDim2.new(1, 0, 1, 0)
testLabel.Parent = BubbleChatScreenGui
local TextSizeCache = {}
|
--Script |
feedbackMain.CharactersLeft.Text = maxCharacters - #feedbackMain.InputBox.Input.Text
feedbackMain.InputBox.Input.Changed:Connect(function()
feedbackMain.CharactersLeft.Text = maxCharacters - #feedbackMain.InputBox.Input.Text
if maxCharacters - #feedbackMain.InputBox.Input.Text < 0 then
feedbackMain.CharactersLeft.TextColor3 = Color3.fromRGB(255,50,50)
feedbackMain.SendButton.Style = Enum.ButtonStyle.RobloxRoundButton
else
feedbackMain.CharactersLeft.TextColor3 = Color3.fromRGB(255,255,255)
feedbackMain.SendButton.Style = Enum.ButtonStyle.RobloxRoundDefaultButton
end
end)
local db = false
feedbackMain.SendButton.MouseButton1Click:Connect(function()
if not db and maxCharacters - #feedbackMain.InputBox.Input.Text >= 0 then
db = true
local msg = feedbackMain.InputBox.Input.Text
if msg == "Type feedback/bug report here" then
db = false
return
end
feedbackMain.InputBox.Input.Text = "Sending Message..."
local response = game.ReplicatedStorage.FilteringFunction:InvokeServer(msg)
feedbackMain.InputBox.Input.Text = response
wait(5)
if feedbackMain.InputBox.Input.Text == response then
feedbackMain.InputBox.Input.Text = "Type feedback/bug report here"
end
db = false
end
end)
script.Parent.Button.MouseButton1Click:Connect(function()
open = not open
if open then
feedbackMain:TweenPosition(UDim2.new(0.477, 0, 0.438, 0),"Out","Quint",0.3,true)
else
feedbackMain:TweenPosition(UDim2.new(1,100,1,-300),"Out","Quint",0.3,true)
end
end)
|
-- This is were the magic happens! |
function splitbyte(input)
local byte,p,flags = string.byte(input),128,{false,false,false,false,false,false,false,false}
for i=1,8 do
if byte>=p then flags[i],byte = true,byte-p end
p=p/2
end
return flags
end
function formbyte(...)
local byte = 0
for p=1,8 do
local bit=select(p,...)
if bit then byte=byte+2^(8-p) end
end
return string.char(byte)
end
local valueType = "f"
function deflate(forceType,...)
return string.pack(string.rep(forceType or valueType,#{...}),...)
end
function flate(forceType,raw,n)
return string.unpack(string.rep(forceType or valueType,n),raw)
end
function getNativeSize(forceType)
return #string.pack(forceType or valueType ,1)
end |
--[[Weight and CG]] |
Tune.Weight = 3000 -- Total weight (in pounds)
Tune.WeightBSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 6 ,
--[[Height]] 3.5 ,
--[[Length]] 14 }
Tune.WeightDist = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = .8 -- Center of gravity height (studs relative to median of all wheels)
Tune.WBVisible = false -- Makes the weight brick visible
|
--[[
Change is used to generate special prop keys that can be used to connect to
GetPropertyChangedSignal.
Generally, Change is indexed by a Roblox property name:
Roact.createElement("TextBox", {
[Roact.Change.Text] = function(rbx)
print("The TextBox", rbx, "changed text to", rbx.Text)
end,
})
]] |
local Type = require(script.Parent.Parent["Type.roblox"])
local Change = {}
local changeMetatable = {
__tostring = function(self)
return string.format("RoactHostChangeEvent(%s)", self.name)
end,
}
setmetatable(Change, {
__index = function(self, propertyName)
local changeListener = {
[Type] = Type.HostChangeEvent,
name = propertyName,
}
setmetatable(changeListener, changeMetatable)
Change[propertyName] = changeListener
return changeListener
end,
})
return Change
|
--//Setup//-- |
local CutsceneGui = script.Parent
CutsceneGui.Enabled = true
local Camera = game.Workspace.CurrentCamera
|
-- Services |
local ReplicateStorage = game:GetService("ReplicatedStorage")
local PlayersService = game:GetService("Players")
|
-- Requires |
local GameManager = require(ReplicatedStorage.Common.GameManager)
|
--- Handles user input when the box is focused |
function Window:BeginInput(input, gameProcessed)
if GuiService.MenuIsOpen then
self:Hide()
end
if gameProcessed and not self:IsVisible() then
return
end
if self.Cmdr.ActivationKeys[input.KeyCode] then -- Activate the command bar
if self.Cmdr.MashToEnable and not self.Cmdr.Enabled then
if tick() - lastPressTime < 1 then
if pressCount >= 5 then
return self.Cmdr:SetEnabled(true)
else
pressCount = pressCount + 1
end
else
pressCount = 1
end
lastPressTime = tick()
elseif self.Cmdr.Enabled then
self:SetVisible(not self:IsVisible())
wait()
self:SetEntryText("")
if GuiService.MenuIsOpen then -- Special case for menu getting stuck open (roblox bug)
self:Hide()
end
end
return
end
if self.Cmdr.Enabled == false or not self:IsVisible() then
if self:IsVisible() then
self:Hide()
end
return
end
if self.Cmdr.HideOnLostFocus and table.find(MOUSE_TOUCH_ENUM, input.UserInputType) then
local ps = input.Position
local ap = Gui.AbsolutePosition
local as = Gui.AbsoluteSize
if ps.X < ap.X or ps.X > ap.X + as.X or ps.Y < ap.Y or ps.Y > ap.Y + as.Y then
self:Hide()
end
elseif input.KeyCode == Enum.KeyCode.Down then -- Auto Complete Down
self:SelectVertical(1)
elseif input.KeyCode == Enum.KeyCode.Up then -- Auto Complete Up
self:SelectVertical(-1)
elseif input.KeyCode == Enum.KeyCode.Return then -- Eat new lines
task.wait()
self:SetEntryText(string.gsub(string.gsub(self:GetEntryText(), '\n', ''), '\r', ''))
elseif input.KeyCode == Enum.KeyCode.Tab then -- Auto complete
local item = self.AutoComplete:GetSelectedItem()
local text = self:GetEntryText()
if item and not (text:sub(#text, #text):match("%s") and self.AutoComplete.LastItem) then
local replace = item[2]
local newText
local insertSpace = true
local command = self.AutoComplete.Command
if command then
local lastArg = self.AutoComplete.Arg
newText = command.Alias
insertSpace = self.AutoComplete.NumArgs ~= #command.ArgumentDefinitions
and self.AutoComplete.IsPartial == false
local args = command.Arguments
for i = 1, #args do
local arg = args[i]
local segments = arg.RawSegments
if arg == lastArg then
segments[#segments] = replace
end
local argText = arg.Prefix .. table.concat(segments, ",")
-- Put auto completion options in quotation marks if they have a space
if argText:find(" ") or argText == "" then
argText = ("%q"):format(argText)
end
newText = ("%s %s"):format(newText, argText)
if arg == lastArg then
break
end
end
else
newText = replace
end
-- need to wait a frame so we can eat the \t
wait()
-- Update the text box
self:SetEntryText(newText .. (insertSpace and " " or ""))
else
-- Still need to eat the \t even if there is no auto-complete to show
wait()
self:SetEntryText(self:GetEntryText())
end
else
self:ClearHistoryState()
end
end
|
---Controller |
local Controller=false
local UserInputService = game:GetService("UserInputService")
local LStickX = 0
local RStickX = 0
local RStickY = 0
local RTriggerValue = 0
local LTriggerValue = 0
local ButtonX = 0
local ButtonY = 0
local ButtonL1 = 0
local ButtonR1 = 0
local ButtonR3 = 0
local DPadUp = 0
function DealWithInput(input,IsRobloxFunction)
if Controller then
if input.KeyCode ==Enum.KeyCode.ButtonX then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonX=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonX=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonY then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonY=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonY=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonL1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonL1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonL1=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR1 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR1=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR1=0
end
elseif input.KeyCode ==Enum.KeyCode.DPadLeft then
if input.UserInputState == Enum.UserInputState.Begin then
DPadUp=1
elseif input.UserInputState == Enum.UserInputState.End then
DPadUp=0
end
elseif input.KeyCode ==Enum.KeyCode.ButtonR3 then
if input.UserInputState == Enum.UserInputState.Begin then
ButtonR3=1
elseif input.UserInputState == Enum.UserInputState.End then
ButtonR3=0
end
end
if input.UserInputType.Name:find("Gamepad") then --it's one of 4 gamepads
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
LStickX = input.Position.X
elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
RStickX = input.Position.X
RStickY = input.Position.Y
elseif input.KeyCode == Enum.KeyCode.ButtonR2 then--right shoulder
RTriggerValue = input.Position.Z
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then--left shoulder
LTriggerValue = input.Position.Z
end
end
end
end
UserInputService.InputBegan:connect(DealWithInput)
UserInputService.InputChanged:connect(DealWithInput)--keyboards don't activate with Changed, only Begin and Ended. idk if digital controller buttons do too
UserInputService.InputEnded:connect(DealWithInput)
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
for i,v in pairs(Binded) do
run:UnbindFromRenderStep(v)
end
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
workspace.CurrentCamera.FieldOfView=70
player.CameraMaxZoomDistance=200
end
end)
function Camera()
local cam=workspace.CurrentCamera
local intcam=false
local CRot=0
local CBack=0
local CUp=0
local mode=0
local look=0
local camChange = 0
local function CamUpdate()
if not pcall (function()
if camChange==0 and DPadUp==1 then
intcam = not intcam
end
camChange=DPadUp
if mode==1 then
if math.abs(RStickX)>.1 then
local sPos=1
if RStickX<0 then sPos=-1 end
if intcam then
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-80
else
CRot=sPos*math.abs(((math.abs(RStickX)-.1)/(.9)))*-90
end
else
CRot=0
end
if math.abs(RStickY)>.1 then
local sPos=1
if RStickY<0 then sPos=-1 end
if intcam then
CUp=sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*30
else
CUp=math.min(sPos*math.abs(((math.abs(RStickY)-.1)/(.9)))*-75,30)
end
else
CUp=0
end
else
if CRot>look then
CRot=math.max(look,CRot-20)
elseif CRot<look then
CRot=math.min(look,CRot+20)
end
CUp=0
end
if intcam then
CBack=0
else
CBack=-180*ButtonR3
end
if intcam then
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Scriptable
cam.FieldOfView=70 + car.DriveSeat.Velocity.Magnitude/40
player.CameraMaxZoomDistance=5
local cf=car.Body.Cam.CFrame
if ButtonR3==1 then
cf=car.Body.RCam.CFrame
end
cam.CoordinateFrame=cf*CFrame.Angles(0,math.rad(CRot+CBack),0)*CFrame.Angles(math.rad(CUp),0,0)
else
cam.CameraSubject=car.DriveSeat
cam.FieldOfView=70
if mode==0 then
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
else
cam.CameraType = "Scriptable"
local pspeed = math.min(1,car.DriveSeat.Velocity.Magnitude/500)
local cc = car.DriveSeat.Position+Vector3.new(0,8+(pspeed*2),0)-((car.DriveSeat.CFrame*CFrame.Angles(math.rad(CUp),math.rad(CRot+CBack),0)).lookVector*17)+(car.DriveSeat.Velocity.Unit*-7*pspeed)
cam.CoordinateFrame = CFrame.new(cc,car.DriveSeat.Position)
end
end
end) then
cam.FieldOfView=70
cam.CameraSubject=player.Character.Humanoid
cam.CameraType=Enum.CameraType.Custom
player.CameraMaxZoomDistance=400
run:UnbindFromRenderStep("CamUpdate")
end
end
local function ModeChange()
if GMode~=mode then
mode=GMode
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end
mouse.KeyDown:connect(function(key)
if key=="v" then
run:UnbindFromRenderStep("CamUpdate")
intcam=not intcam
run:BindToRenderStep("CamUpdate",Enum.RenderPriority.Camera.Value,CamUpdate)
end
end)
mouse.KeyUp:connect(function(key)
if key=="z" and look==50 then
look=0
elseif key=="x" and (look==-160 or look==-180) then
look=0
elseif key=="c" and look==-50 then
look=0
end
end)
run:BindToRenderStep("CMChange",Enum.RenderPriority.Camera.Value,ModeChange)
table.insert(Binded,"CamUpdate")
table.insert(Binded,"CMChange")
end
Camera()
mouse.KeyDown:connect(function(key)
if key=="b" then
if GMode>=1 then
GMode=0
else
GMode=GMode+1
end
if GMode==1 then
Controller=true
else
Controller=false
end
end
end)
|
-- Matches objects to their tree node representation. |
local NodeLookup = {}
local nodeWidth = 0
local QuickButtons = {}
function filteringWorkspace()
if explorerFilter.Text ~= "" and explorerFilter.Text ~= "Filter workspace..." then
return true
end
return false
end
function lookForAName(obj,name)
for i,v in pairs(obj:GetChildren()) do
if string.find(string.lower(v.Name),string.lower(name)) then nameScanned = true end
lookForAName(v,name)
end
end
function scanName(obj)
nameScanned = false
if string.find(string.lower(obj.Name),string.lower(explorerFilter.Text)) then
nameScanned = true
else
lookForAName(obj,explorerFilter.Text)
end
return nameScanned
end
function updateActions()
for i,v in pairs(QuickButtons) do
if v.Cond() then
v.Toggle(true)
else
v.Toggle(false)
end
end
end
local updateList,rawUpdateList,updateScroll,rawUpdateSize do
local function r(t)
for i = 1,#t do
if not filteringWorkspace() or scanName(t[i].Object) then
if t.Object == game then
if childrenGame[t[i].Object] then
TreeList[#TreeList+1] = t[i]
local w = (t[i].Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(t[i].Object.Name) + 4
if w > nodeWidth then
nodeWidth = w
end
if t[i].Expanded or filteringWorkspace() then
r(t[i])
end
end
else
TreeList[#TreeList+1] = t[i]
local w = (t[i].Depth)*(2+ENTRY_PADDING+GUI_SIZE) + 2 + ENTRY_SIZE + 4 + getTextWidth(t[i].Object.Name) + 4
if w > nodeWidth then
nodeWidth = w
end
if t[i].Expanded or filteringWorkspace() then
r(t[i])
end
end
end
end
end
function rawUpdateSize()
scrollBarH.TotalSpace = nodeWidth
scrollBarH.VisibleSpace = listFrame.AbsoluteSize.x
scrollBarH:Update()
local visible = scrollBarH:CanScrollDown() or scrollBarH:CanScrollUp()
scrollBarH.GUI.Visible = visible
listFrame.Size = UDim2_new(1,-GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
scrollBar.VisibleSpace = math.ceil(listFrame.AbsoluteSize.y/ENTRY_BOUND)
scrollBar.GUI.Size = UDim2_new(0,GUI_SIZE,1,-GUI_SIZE*(visible and 1 or 0) - HEADER_SIZE)
scrollBar.TotalSpace = #TreeList+1
scrollBar:Update()
end
function rawUpdateList()
-- Clear then repopulate the entire list. It appears to be fast enough.
TreeList = {}
nodeWidth = 0
r(NodeLookup[game])
r(NodeLookup[DexOutput])
r(NodeLookup[HiddenEntries])
r(NodeLookup[HiddenGame])
rawUpdateSize()
updateActions()
end
-- Adding or removing large models will cause many updates to occur. We
-- can reduce the number of updates by creating a delay, then dropping any
-- updates that occur during the delay.
local updatingList = false
function updateList()
if updatingList then return end
updatingList = true
wait(0.25)
updatingList = false
rawUpdateList()
end
local updatingScroll = false
function updateScroll()
if updatingScroll then return end
updatingScroll = true
wait(0.25)
updatingScroll = false
scrollBar:Update()
end
end
local Selection do
local bindGetSelection = explorerPanel:FindFirstChild("GetSelection")
if not bindGetSelection then
bindGetSelection = Create('BindableFunction',{Name = "GetSelection"})
bindGetSelection.Parent = explorerPanel
end
local bindSetSelection = explorerPanel:FindFirstChild("SetSelection")
if not bindSetSelection then
bindSetSelection = Create('BindableFunction',{Name = "SetSelection"})
bindSetSelection.Parent = explorerPanel
end
local bindSelectionChanged = explorerPanel:FindFirstChild("SelectionChanged")
if not bindSelectionChanged then
bindSelectionChanged = Create('BindableEvent',{Name = "SelectionChanged"})
bindSelectionChanged.Parent = explorerPanel
end
local SelectionList = {}
local SelectionSet = {}
local Updates = true
Selection = {
Selected = SelectionSet;
List = SelectionList;
}
local function addObject(object)
-- list update
local lupdate = false
-- scroll update
local supdate = false
if not SelectionSet[object] then
local node = NodeLookup[object]
if node then
table.insert(SelectionList,object)
SelectionSet[object] = true
node.Selected = true
-- expand all ancestors so that selected node becomes visible
node = node.Parent
while node do
if not node.Expanded then
node.Expanded = true
lupdate = true
end
node = node.Parent
end
supdate = true
end
end
return lupdate,supdate
end
Selection.Finding = false
Selection.Found = {}
function Selection:Set(objects)
if Selection.Finding then
Selection.Found = objects
end
local lupdate = false
local supdate = false
if #SelectionList > 0 then
for i = 1,#SelectionList do
local object = SelectionList[i]
local node = NodeLookup[object]
if node then
node.Selected = false
SelectionSet[object] = nil
end
end
SelectionList = {}
Selection.List = SelectionList
supdate = true
end
for i = 1,#objects do
local l,s = addObject(objects[i])
lupdate = l or lupdate
supdate = s or supdate
end
if lupdate then
rawUpdateList()
supdate = true
elseif supdate then
scrollBar:Update()
end
if supdate then
bindSelectionChanged:Fire()
updateActions()
end
end
function Selection:Add(object)
local l,s = addObject(object)
if l then
rawUpdateList()
if Updates then
bindSelectionChanged:Fire()
updateActions()
end
elseif s then
scrollBar:Update()
if Updates then
bindSelectionChanged:Fire()
updateActions()
end
end
end
function Selection:StopUpdates()
Updates = false
end
function Selection:ResumeUpdates()
Updates = true
bindSelectionChanged:Fire()
updateActions()
end
function Selection:Remove(object,noupdate)
if SelectionSet[object] then
local node = NodeLookup[object]
if node then
node.Selected = false
SelectionSet[object] = nil
for i = 1,#SelectionList do
if SelectionList[i] == object then
table.remove(SelectionList,i)
break
end
end
if not noupdate then
scrollBar:Update()
end
bindSelectionChanged:Fire()
updateActions()
end
end
end
function Selection:Get()
local list = {}
for i = 1,#SelectionList do
if SelectionList[i] ~= HiddenEntriesMain and SelectionList[i] ~= DexOutputMain then
table.insert(list, SelectionList[i])
end
end
return list
end
bindSetSelection.OnInvoke = function(...)
Selection:Set(...)
end
bindGetSelection.OnInvoke = function()
return Selection:Get()
end
end
function CreateCaution(title,msg)
local newCaution = CautionWindow
newCaution.Visible = true
newCaution.Title.Text = title
newCaution.MainWindow.Desc.Text = msg
newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
newCaution.Visible = false
end)
end
function CreateTableCaution(title,msg)
if type(msg) ~= "table" then return CreateCaution(title,tostring(msg)) end
local newCaution = TableCautionWindow:Clone()
newCaution.Title.Text = title
local TableList = newCaution.MainWindow.TableResults
local TableTemplate = newCaution.MainWindow.TableTemplate
for i,v in pairs(msg) do
local newResult = TableTemplate:Clone()
newResult.Type.Text = type(v)
newResult.Value.Text = tostring(v)
newResult.Position = UDim2_new(0,0,0,#TableList:GetChildren() * 20)
newResult.Parent = TableList
TableList.CanvasSize = UDim2_new(0,0,0,#TableList:GetChildren() * 20)
newResult.Visible = true
end
newCaution.Parent = explorerPanel.Parent
newCaution.Visible = true
newCaution.MainWindow.Ok.MouseButton1Up:connect(function()
newCaution:Destroy()
end)
end
local function Split(str, delimiter)
local start = 1
local t = {}
while true do
local pos = string.find (str, delimiter, start, true)
if not pos then
break
end
table.insert (t, string.sub (str, start, pos - 1))
start = pos + string.len (delimiter)
end
table.insert (t, string.sub (str, start))
return t
end
local function ToValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2_new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3_new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3_new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2_new(xScale, xOffset, yScale, yOffset)
elseif type == "Number" then
return tonumber(value)
elseif type == "String" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
elseif type == "Script" then
local success,err = pcall(function()
--return loadstring("return "..tostring(value), "?")()
end)
if err then
return nil
end
else
return nil
end
end
local function ToPropValue(value,type)
if type == "Vector2" then
local list = Split(value,",")
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return Vector2_new(x,y)
elseif type == "Vector3" then
local list = Split(value,",")
if #list < 3 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
local z = tonumber(list[3]) or 0
return Vector3_new(x,y,z)
elseif type == "Color3" then
local list = Split(value,",")
if #list < 3 then return nil end
local r = tonumber(list[1]) or 0
local g = tonumber(list[2]) or 0
local b = tonumber(list[3]) or 0
return Color3_new(r/255,g/255, b/255)
elseif type == "UDim2" then
local list = Split(string.gsub(string.gsub(value, "{", ""),"}",""),",")
if #list < 4 then return nil end
local xScale = tonumber(list[1]) or 0
local xOffset = tonumber(list[2]) or 0
local yScale = tonumber(list[3]) or 0
local yOffset = tonumber(list[4]) or 0
return UDim2_new(xScale, xOffset, yScale, yOffset)
elseif type == "Content" then
return value
elseif type == "float" or type == "int" or type == "double" then
return tonumber(value)
elseif type == "string" then
return value
elseif type == "NumberRange" then
local list = Split(value,",")
if #list == 1 then
if tonumber(list[1]) == nil then return nil end
local newVal = tonumber(list[1]) or 0
return NumberRange.new(newVal)
end
if #list < 2 then return nil end
local x = tonumber(list[1]) or 0
local y = tonumber(list[2]) or 0
return NumberRange.new(x,y)
elseif string.sub(value,1,4) == "Enum" then
local getEnum = value
while true do
local x,y = string.find(getEnum,".")
if y then
getEnum = string.sub(getEnum,y+1)
else
break
end
end
print(getEnum)
return getEnum
else
return nil
end
end
function PromptCaller(inst)
if CurrentRemoteWindow then
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
CurrentRemoteWindow = RemoteWindow:Clone()
CurrentRemoteWindow.Parent = explorerPanel.Parent
CurrentRemoteWindow.Visible = true
local displayValues = false
local ArgumentList = CurrentRemoteWindow.MainWindow.Arguments
local ArgumentTemplate = CurrentRemoteWindow.MainWindow.ArgumentTemplate
if inst:IsA("RemoteEvent") or inst:IsA("BindableEvent") then
CurrentRemoteWindow.Title.Text = "Fire Event"
CurrentRemoteWindow.MainWindow.Ok.Text = "Fire"
CurrentRemoteWindow.MainWindow.DisplayReturned.Visible = false
CurrentRemoteWindow.MainWindow.Desc2.Visible = false
end
if inst:IsA("RemoteEvent") or inst:IsA("RemoteFunction") then
local newArgument = ArgumentTemplate:Clone()
newArgument.Parent = ArgumentList
newArgument.Visible = true
newArgument.Type.Text = "UserNameToFire"
end
local newArgument = ArgumentTemplate:Clone()
if inst:IsA("RemoteEvent") or inst:IsA("RemoteFunction") then
newArgument.Position = UDim2_new(0,0,0,20)
ArgumentList.CanvasSize = UDim2_new(0,0,0,40)
end
newArgument.Parent = ArgumentList
newArgument.Visible = true
newArgument.Type.MouseButton1Down:connect(function()
createDDown(newArgument.Type,function(choice)
newArgument.Type.Text = choice
end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
end)
CurrentRemoteWindow.MainWindow.Ok.MouseButton1Up:connect(function()
if CurrentRemoteWindow and inst.Parent ~= nil then
local MyArguments = {}
for i,v in pairs(ArgumentList:GetChildren()) do
if inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent") and i == 1 then
local Players = game:GetService("Players")
if Players:FindFirstChild(v.Value.Text) then
table.insert(MyArguments,Players[v.Value.Text])
else
CreateCaution("Remote Caller","The username defined is not in-game.")
return
end
end
table.insert(MyArguments,ToValue(v.Value.Text,v.Type.Text))
end
if inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent") then
if displayValues then
spawn(function()
local myResults = RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
if myResults then
CreateTableCaution("Remote Caller",myResults)
else
CreateCaution("Remote Caller","This remote did not return anything.")
end
end)
else
spawn(function()
RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
end)
end
else
RemoteEvent:InvokeServer("CallRemote",inst,MyArguments)
end
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
end)
CurrentRemoteWindow.MainWindow.Add.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
local newArgument = ArgumentTemplate:Clone()
newArgument.Position = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
newArgument.Parent = ArgumentList
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
newArgument.Visible = true
newArgument.Type.MouseButton1Down:connect(function()
createDDown(newArgument.Type,function(choice)
newArgument.Type.Text = choice
end,"Script","Number","String","Color3","Vector3","Vector2","UDim2","NumberRange")
end)
end
end)
CurrentRemoteWindow.MainWindow.Subtract.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
if (inst:IsA("RemoteFunction") or inst:IsA("RemoteEvent")) and #ArgumentList:GetChildren() > 2 then
ArgumentList:GetChildren()[#ArgumentList:GetChildren()]:Destroy()
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
elseif inst:IsA("RemoteFunction") == false and inst:IsA("RemoteEvent") == false and #ArgumentList:GetChildren() > 1 then
ArgumentList:GetChildren()[#ArgumentList:GetChildren()]:Destroy()
ArgumentList.CanvasSize = UDim2_new(0,0,0,#ArgumentList:GetChildren() * 20)
end
end
end)
CurrentRemoteWindow.MainWindow.Cancel.MouseButton1Up:connect(function()
if CurrentRemoteWindow then
CurrentRemoteWindow:Destroy()
CurrentRemoteWindow = nil
end
end)
CurrentRemoteWindow.MainWindow.DisplayReturned.MouseButton1Up:connect(function()
if displayValues then
displayValues = false
CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = false
else
displayValues = true
CurrentRemoteWindow.MainWindow.DisplayReturned.enabled.Visible = true
end
end)
end
function DestroyRightClick()
if currentRightClickMenu then
currentRightClickMenu:Destroy()
currentRightClickMenu = nil
end
if CurrentInsertObjectWindow and CurrentInsertObjectWindow.Visible then
CurrentInsertObjectWindow.Visible = false
end
end
function rightClickMenu(sObj)
local mouse = game:GetService("Players").LocalPlayer:GetMouse()
currentRightClickMenu = CreateRightClickMenu(
{"Cut","Copy","Paste Into","Duplicate","Delete",false,"Group","Ungroup","Select Children",false,"Teleport To","Call Function","Call Remote/Bindable",false,"Insert Part","Insert Object",false},
"",
false,
function(option)
if option == "Cut" then
if not Option.Modifiable then return end
clipboard = {}
RemoteEvent:InvokeServer("ClearClipboard")
local list = Selection.List
local cut = {}
for i = 1,#list do
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
table.insert(clipboard,obj)
table.insert(cut,list[i])
RemoteEvent:InvokeServer("Copy", list[i])
end
end
for i = 1,#cut do
pcall(delete,cut[i])
end
updateActions()
elseif option == "Copy" then
if not Option.Modifiable then return end
clipboard = {}
RemoteEvent:InvokeServer("ClearClipboard")
local list = Selection.List
for i = 1,#list do
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
table.insert(clipboard,obj)
end
RemoteEvent:InvokeServer("Copy", list[i])
end
updateActions()
elseif option == "Paste Into" then
if not Option.Modifiable then return end
local parent = Selection.List[1] or workspace
if not RemoteEvent:InvokeServer("Paste", parent) then
for i = 1,#clipboard do
if (clipboard[i]) then
pcall(function()
clipboard[i]:Clone().Parent = parent
end)
end
end
end
elseif option == "Duplicate" then
if not Option.Modifiable then return end
local list = Selection:Get()
local parent = Selection.List[1].Parent or workspace;
for i = 1,#list do
if not RemoteEvent:InvokeServer("Duplicate", list[i], parent) then -- scel was here again hi
local _, obj = pcall(function() return list[i]:Clone() end)
if obj then
obj.Parent = parent;
end
end
end
elseif option == "Delete" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
pcall(delete,list[i])
end
Selection:Set({})
elseif option == "Group" then
if not Option.Modifiable then return end
local parent = Selection.List[1].Parent or workspace
local newModel = RemoteEvent:InvokeServer("InstanceNew", "Model", {Parent = parent}) or Instance_new("Model")
local list = Selection:Get()
newModel.Parent = parent
for i = 1,#list do
list[i].Parent = newModel
RemoteEvent:InvokeServer("SetProperty", list[i], "Parent", newModel)
end
Selection:Set({})
elseif option == "Ungroup" then
if not Option.Modifiable then return end
local ungrouped = {}
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("Model") then
for i2,v2 in pairs(list[i]:GetChildren()) do
v2.Parent = list[i].Parent or workspace
table.insert(ungrouped,v2)
RemoteEvent:InvokeServer("SetProperty", v2, "Parent", list[i].Parent or workspace)
end
pcall(delete,list[i])
end
end
Selection:Set({})
if SettingsRemote:Invoke("SelectUngrouped") then
for i,v in pairs(ungrouped) do
Selection:Add(v)
end
end
elseif option == "Select Children" then
if not Option.Modifiable then return end
local list = Selection:Get()
Selection:Set({})
Selection:StopUpdates()
for i = 1,#list do
for i2,v2 in pairs(list[i]:GetChildren()) do
Selection:Add(v2)
end
end
Selection:ResumeUpdates()
elseif option == "Teleport To" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("BasePart") then
pcall(function()
game:GetService("Players").LocalPlayer.Character.HumanoidRootPart.CFrame = list[i].CFrame
end)
break
end
end
elseif option == "Insert Part" then
if not Option.Modifiable then return end
local insertedParts = {}
local list = Selection:Get()
for i = 1,#list do
pcall(function()
local props = {}
props.Parent = list[i]
props.CFrame = CFrame_new(game:GetService("Players").LocalPlayer.Character.Head.Position) + Vector3_new(0,3,0)
local newPart = RemoteEvent:InvokeServer("InstanceNew", "Part", props) or Instance_new("Part")
newPart.Parent = props.Parent;
newPart.CFrame = props.CFrame;
table.insert(insertedParts,newPart)
end)
end
elseif option == "Call Remote/Bindable" then
if not Option.Modifiable then return end
local list = Selection:Get()
for i = 1,#list do
if list[i]:IsA("RemoteFunction") or list[i]:IsA("RemoteEvent") or list[i]:IsA("BindableFunction") or list[i]:IsA("BindableEvent") then
PromptCaller(list[i])
break
end
end
end
end)
currentRightClickMenu.Parent = explorerPanel.Parent
currentRightClickMenu.Position = UDim2_new(0,mouse.X,0,mouse.Y)
if currentRightClickMenu.AbsolutePosition.X + currentRightClickMenu.AbsoluteSize.X > explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X then
currentRightClickMenu.Position = UDim2_new(0, explorerPanel.AbsolutePosition.X + explorerPanel.AbsoluteSize.X - currentRightClickMenu.AbsoluteSize.X, 0, mouse.Y)
end
end
local function cancelReparentDrag()end
local function cancelSelectDrag()end
do
local listEntries = {}
local nameConnLookup = {}
local mouseDrag = Create('ImageButton',{
Name = "MouseDrag";
Position = UDim2_new(-0.25,0,-0.25,0);
Size = UDim2_new(1.5,0,1.5,0);
Transparency = 1;
AutoButtonColor = false;
Active = true;
ZIndex = 10;
})
local function dragSelect(last,add,button)
local connDrag
local conUp
conDrag = mouseDrag.MouseMoved:connect(function(x,y)
local pos = Vector2_new(x,y) - listFrame.AbsolutePosition
local size = listFrame.AbsoluteSize
if pos.x < 0 or pos.x > size.x or pos.y < 0 or pos.y > size.y then return end
local i = math.ceil(pos.y/ENTRY_BOUND) + scrollBar.ScrollIndex
-- Mouse may have made a large step, so interpolate between the
-- last index and the current.
for n = i<last and i or last, i>last and i or last do
local node = TreeList[n]
if node then
if add then
Selection:Add(node.Object)
else
Selection:Remove(node.Object)
end
end
end
last = i
end)
function cancelSelectDrag()
mouseDrag.Parent = nil
conDrag:disconnect()
conUp:disconnect()
function cancelSelectDrag()end
end
conUp = mouseDrag[button]:connect(cancelSelectDrag)
mouseDrag.Parent = GetScreen(listFrame)
end
local function dragReparent(object,dragGhost,clickPos,ghostOffset)
local connDrag
local conUp
local conUp2
local parentIndex = nil
local dragged = false
local parentHighlight = Create('Frame',{
Transparency = 1;
Visible = false;
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,0,1);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(1,0,0,0);
Size = UDim2_new(0,1,1,0);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,1,0);
Size = UDim2_new(1,0,0,1);
});
Create('Frame',{
BorderSizePixel = 0;
BackgroundColor3 = Color3_new(0,0,0);
BackgroundTransparency = 0.1;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(0,1,1,0);
});
})
SetZIndex(parentHighlight,9)
conDrag = mouseDrag.MouseMoved:connect(function(x,y)
local dragPos = Vector2_new(x,y)
if dragged then
local pos = dragPos - listFrame.AbsolutePosition
local size = listFrame.AbsoluteSize
parentIndex = nil
parentHighlight.Visible = false
if pos.x >= 0 and pos.x <= size.x and pos.y >= 0 and pos.y <= size.y + ENTRY_SIZE*2 then
local i = math.ceil(pos.y/ENTRY_BOUND-2)
local node = TreeList[i + scrollBar.ScrollIndex]
if node and node.Object ~= object and not object:IsAncestorOf(node.Object) then
parentIndex = i
local entry = listEntries[i]
if entry then
parentHighlight.Visible = true
parentHighlight.Position = UDim2_new(0,1,0,entry.AbsolutePosition.y-listFrame.AbsolutePosition.y)
parentHighlight.Size = UDim2_new(0,size.x-4,0,entry.AbsoluteSize.y)
end
end
end
dragGhost.Position = UDim2_new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
elseif (clickPos-dragPos).magnitude > 8 then
dragged = true
SetZIndex(dragGhost,9)
dragGhost.IndentFrame.Transparency = 0.25
dragGhost.IndentFrame.EntryText.TextColor3 = GuiColor.TextSelected
dragGhost.Position = UDim2_new(0,dragPos.x+ghostOffset.x,0,dragPos.y+ghostOffset.y)
dragGhost.Parent = GetScreen(listFrame)
parentHighlight.Parent = listFrame
end
end)
function cancelReparentDrag()
mouseDrag.Parent = nil
conDrag:disconnect()
conUp:disconnect()
conUp2:disconnect()
dragGhost:Destroy()
parentHighlight:Destroy()
function cancelReparentDrag()end
end
local wasSelected = Selection.Selected[object]
if not wasSelected and Option.Selectable then
Selection:Set({object})
end
conUp = mouseDrag.MouseButton1Up:connect(function()
cancelReparentDrag()
if dragged then
if parentIndex then
local parentNode = TreeList[parentIndex + scrollBar.ScrollIndex]
if parentNode then
parentNode.Expanded = true
local parentObj = parentNode.Object
local function parent(a,b)
a.Parent = b
end
if Option.Selectable then
local list = Selection.List
for i = 1,#list do
pcall(parent,list[i],parentObj)
end
else
pcall(parent,object,parentObj)
end
end
end
else
-- do selection click
if wasSelected and Option.Selectable then
Selection:Set({})
end
end
end)
conUp2 = mouseDrag.MouseButton2Down:connect(function()
cancelReparentDrag()
end)
mouseDrag.Parent = GetScreen(listFrame)
end
local entryTemplate = Create('ImageButton',{
Name = "Entry";
Transparency = 1;
AutoButtonColor = false;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,0,ENTRY_SIZE);
Create('Frame',{
Name = "IndentFrame";
BackgroundTransparency = 1;
BackgroundColor3 = GuiColor.Selected;
BorderColor3 = GuiColor.BorderSelected;
Position = UDim2_new(0,0,0,0);
Size = UDim2_new(1,0,1,0);
Create(Icon('ImageButton',0),{
Name = "Expand";
AutoButtonColor = false;
Position = UDim2_new(0,-GUI_SIZE,0.5,-GUI_SIZE/2);
Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE);
});
Create(ClassIcon(nil,0),{
Name = "ExplorerIcon";
Position = UDim2_new(0,2+ENTRY_PADDING,0.5,-GUI_SIZE/2);
Size = UDim2_new(0,GUI_SIZE,0,GUI_SIZE);
});
Create('TextLabel',{
Name = "EntryText";
BackgroundTransparency = 1;
TextColor3 = GuiColor.Text;
TextXAlignment = 'Left';
TextYAlignment = 'Center';
Font = FONT;
FontSize = FONT_SIZE;
Text = "";
Position = UDim2_new(0,2+ENTRY_SIZE+4,0,0);
Size = UDim2_new(1,-2,1,0);
});
});
})
function scrollBar.UpdateCallback(self)
for i = 1,self.VisibleSpace do
local node = TreeList[i + self.ScrollIndex]
if node then
local entry = listEntries[i]
if not entry then
entry = Create(entryTemplate:Clone(),{
Position = UDim2_new(0,2,0,ENTRY_BOUND*(i-1)+2);
Size = UDim2_new(0,nodeWidth,0,ENTRY_SIZE);
ZIndex = listFrame.ZIndex;
})
listEntries[i] = entry
local expand = entry.IndentFrame.Expand
expand.MouseEnter:connect(function()
local node = TreeList[i + self.ScrollIndex]
if #node > 0 then
if node.Object ~= HiddenEntriesMain then
if node.Expanded then
Icon(expand,NODE_EXPANDED_OVER)
else
Icon(expand,NODE_COLLAPSED_OVER)
end
else
if node.HiddenExpanded then
Icon(expand,NODE_EXPANDED_OVER)
else
Icon(expand,NODE_COLLAPSED_OVER)
end
end
end
end)
expand.MouseLeave:connect(function()
pcall(function()
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
if node.HiddenExpanded then
Icon(expand,NODE_EXPANDED)
else
Icon(expand,NODE_COLLAPSED)
end
return
end
if #node > 0 then
if node.Expanded then
Icon(expand,NODE_EXPANDED)
else
Icon(expand,NODE_COLLAPSED)
end
end
end)
end)
local function radd(o,refresh,parent)
addObject(o,refresh,parent)
local s,children = pcall(function() return o:GetChildren() end, o)
if s then
for i = 1,#children do
radd(children[i],refresh,o)
end
end
end
expand.MouseButton1Down:connect(function()
local node = TreeList[i + self.ScrollIndex]
if #node > 0 then
if node.Object ~= HiddenEntriesMain then
node.Expanded = not node.Expanded
else
if not MuteHiddenItems then
NodeLookup[HiddenGame] = {
Object = HiddenGame;
Parent = nil;
Index = 0;
Expanded = true;
}
else
for i,v in pairs(game:GetChildren()) do
if not childrenGame[v] then
radd(v, true, HiddenGame)
end
end
end
MuteHiddenItems = not MuteHiddenItems
node.HiddenExpanded = not node.HiddenExpanded
end
if node.Object == explorerPanel.Parent and node.Expanded then
CreateCaution("Warning", "Modifying the contents of this Instance could cause erratic or unstable behavior. Proceed with caution.")
end
-- use raw update so the list updates instantly
rawUpdateList()
end
end)
entry.MouseButton1Down:connect(function(x,y)
local node = TreeList[i + self.ScrollIndex]
DestroyRightClick()
if GetAwaitRemote:Invoke() then
bindSetAwaiting:Fire(node.Object)
return
end
if node.Object == HiddenEntriesMain then
return
end
if not HoldingShift then
lastSelectedNode = i + self.ScrollIndex
end
if HoldingShift and not filteringWorkspace() then
if lastSelectedNode then
if i + self.ScrollIndex - lastSelectedNode > 0 then
Selection:StopUpdates()
for i2 = 1, i + self.ScrollIndex - lastSelectedNode do
local newNode = TreeList[lastSelectedNode + i2]
if newNode then
Selection:Add(newNode.Object)
end
end
Selection:ResumeUpdates()
else
Selection:StopUpdates()
for i2 = i + self.ScrollIndex - lastSelectedNode, 1 do
local newNode = TreeList[lastSelectedNode + i2]
if newNode then
Selection:Add(newNode.Object)
end
end
Selection:ResumeUpdates()
end
end
return
end
if HoldingCtrl then
if Selection.Selected[node.Object] then
Selection:Remove(node.Object)
else
Selection:Add(node.Object)
end
return
end
if Option.Modifiable then
local pos = Vector2_new(x,y)
dragReparent(node.Object,entry:Clone(),pos,entry.AbsolutePosition-pos)
elseif Option.Selectable then
if Selection.Selected[node.Object] then
Selection:Set({})
else
Selection:Set({node.Object})
end
dragSelect(i+self.ScrollIndex,true,'MouseButton1Up')
end
end)
local curSelect
entry.MouseButton2Down:connect(function()
if not Option.Selectable then return end
DestroyRightClick()
curSelect = entry
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
return
end
if GetAwaitRemote:Invoke() then
bindSetAwaiting:Fire(node.Object)
return
end
if not Selection.Selected[node.Object] then
Selection:Set({node.Object})
end
end)
entry.MouseButton2Up:connect(function()
if not Option.Selectable then return end
local node = TreeList[i + self.ScrollIndex]
if node.Object == HiddenEntriesMain then
return
end
if checkMouseInGui(curSelect) then
rightClickMenu(node.Object)
end
end)
entry.Parent = listFrame
end
entry.Visible = true
local object = node.Object
-- update expand icon
if node.Object ~= HiddenEntriesMain then
if #node == 0 then
entry.IndentFrame.Expand.Visible = false
elseif node.Expanded then
Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
entry.IndentFrame.Expand.Visible = true
else
Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
entry.IndentFrame.Expand.Visible = true
end
else
if node.HiddenExpanded then
Icon(entry.IndentFrame.Expand,NODE_EXPANDED)
entry.IndentFrame.Expand.Visible = true
else
Icon(entry.IndentFrame.Expand,NODE_COLLAPSED)
entry.IndentFrame.Expand.Visible = true
end
end
-- update explorer icon
if object ~= HiddenEntriesMain then
entry.IndentFrame.EntryText.Position = UDim2_new(0,2+ENTRY_SIZE+4,0,0);
entry.IndentFrame.ExplorerIcon.Visible = true
ClassIcon(entry.IndentFrame.ExplorerIcon,ClassIndex[object.ClassName] or 0)
else
entry.IndentFrame.EntryText.Position = UDim2_new(0,0,0,0);
entry.IndentFrame.ExplorerIcon.Visible = false
end
-- update indentation
local w = (node.Depth)*(2+ENTRY_PADDING+GUI_SIZE)
entry.IndentFrame.Position = UDim2_new(0,w,0,0)
entry.IndentFrame.Size = UDim2_new(1,-w,1,0)
-- update hidden entries name
NameHiddenEntries()
-- update name change detection
if nameConnLookup[entry] then
nameConnLookup[entry]:disconnect()
end
local text = entry.IndentFrame.EntryText
text.Text = object.Name
nameConnLookup[entry] = node.Object.Changed:connect(function(p)
if p == 'Name' then
text.Text = object.Name
end
end)
-- update selection
entry.IndentFrame.Transparency = node.Selected and 0 or 1
text.TextColor3 = GuiColor[node.Selected and 'TextSelected' or 'Text']
entry.Size = UDim2_new(0,nodeWidth,0,ENTRY_SIZE)
elseif listEntries[i] then
listEntries[i].Visible = false
end
end
for i = self.VisibleSpace+1,self.TotalSpace do
local entry = listEntries[i]
if entry then
listEntries[i] = nil
entry:Destroy()
end
end
end
function scrollBarH.UpdateCallback(self)
for i = 1,scrollBar.VisibleSpace do
local node = TreeList[i + scrollBar.ScrollIndex]
if node then
local entry = listEntries[i]
if entry then
entry.Position = UDim2_new(0,2 - scrollBarH.ScrollIndex,0,ENTRY_BOUND*(i-1)+2)
end
end
end
end
Connect(listFrame.Changed,function(p)
if p == 'AbsoluteSize' then
rawUpdateSize()
end
end)
local wheelAmount = 6
explorerPanel.MouseWheelForward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex - wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex - scrollBar.VisibleSpace)
end
end)
explorerPanel.MouseWheelBackward:connect(function()
if scrollBar.VisibleSpace - 1 > wheelAmount then
scrollBar:ScrollTo(scrollBar.ScrollIndex + wheelAmount)
else
scrollBar:ScrollTo(scrollBar.ScrollIndex + scrollBar.VisibleSpace)
end
end)
end
|
-- WorldSize + ScreenSize -> Depth needed |
function ScreenSpace.GetDepthForWidth(screenWidth, worldWidth)
local aspectRatio = ScreenSpace.AspectRatio()
local hfactor = math.tan(math.rad(workspace.CurrentCamera.FieldOfView)/2)
local wfactor = aspectRatio*hfactor
local sx, sy = ScreenSpace.ViewSizeX(), ScreenSpace.ViewSizeY()
--
return -(sx * worldWidth) / (screenWidth * 2 * wfactor)
end
function ScreenSpace.GetDepthForHeight(screenHeight, worldHeight)
local hfactor = math.tan(math.rad(workspace.CurrentCamera.FieldOfView)/2)
local sy = ScreenSpace.ViewSizeY()
--
return -(sy * worldHeight) / (screenHeight * 2 * hfactor)
end
|
-- an awkward way to set a zero-indexed table... |
luaP.opmodes[0] =
opmode(0, 1, "OpArgR", "OpArgN", "iABC") -- OP_MOVE
return luaP
|
-- ROBLOX TODO: continue to implement prettyFormat plugins |
local prettyFormatPlugins = PrettyFormat.plugins
local PLUGINS = {
prettyFormatPlugins.AsymmetricMatcher,
-- ROBLOX deviation: Roblox Instance matchers
prettyFormatPlugins.RobloxInstance,
}
type MatcherHintColor = (string) -> string -- subset of Chalk type
export type MatcherHintOptions = {
comment: string?,
-- ROBLOX TODO? should be MatcherHintColor like in upstream, but requires modeling Chalk differently
expectedColor: MatcherHintColor?,
isDirectExpectCall: boolean?,
isNot: boolean?,
promise: string?,
-- ROBLOX TODO? should be MatcherHintColor like in upstream, but requires modeling Chalk differently
receivedColor: string?,
secondArgument: string?,
-- ROBLOX TODO? should be MatcherHintColor like in upstream, but requires modeling Chalk differently
secondArgumentColor: MatcherHintColor?,
}
export type DiffOptions = ImportDiffOptions
local EXPECTED_COLOR = chalk.green
local RECEIVED_COLOR = chalk.red
local INVERTED_COLOR = chalk.inverse
local BOLD_WEIGHT = chalk.bold
local DIM_COLOR = chalk.dim
local MULTILINE_REGEXP = "\n"
local SPACE_SYMBOL = utf8.char(183) -- middle dot
local NUMBERS = {
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"eleven",
"twelve",
"thirteen",
}
local SUGGEST_TO_CONTAIN_EQUAL =
"Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead."
local replaceTrailingSpaces, getCommonAndChangedSubstrings, isLineDiffable, shouldPrintDiff, replaceMatchedToAsymmetricMatcher, isAsymmetricMatcher
local matcherErrorMessage, matcherHint
local function stringify(object: any, maxDepth: number?): string
-- ROBLOX deviation: Added this if logic to deal with handling nil values in Lua tables
if object == Symbol.for_("$$nil") then
object = nil
end
maxDepth = maxDepth or 10
local MAX_LENGTH = 10000
local result
local ok = pcall(function()
result = prettyFormat(object, {
maxDepth = maxDepth,
min = true,
plugins = PLUGINS,
})
end)
if not ok then
result = prettyFormat(object, {
callToJSON = false,
maxDepth = maxDepth,
min = true,
plugins = PLUGINS,
})
end
if #result >= MAX_LENGTH and maxDepth > 1 then
--[[
ROBLOX TODO: Remove the "if maxDepth" check once it can pass through
Luau cleanly
]]
if maxDepth then
return stringify(object, math.floor(maxDepth / 2))
end
end
return result
end
local function highlightTrailingWhitespace(text: string): string
return text:gsub("%s+$", function(s)
return INVERTED_COLOR(s)
end)
end
|
---- Locales ----- |
local Event = game:GetService("ReplicatedStorage").Events.Cases.AdminCase
|
-- Choose current Touch control module based on settings (user, dev)
-- Returns module (possibly nil) and success code to differentiate returning nil due to error vs Scriptable |
function ControlModule:SelectTouchModule()
if not UserInputService.TouchEnabled then
return nil, false
end
local touchModule = nil
local DevMovementMode = Players.LocalPlayer.DevTouchMovementMode
if DevMovementMode == Enum.DevTouchMovementMode.UserChoice then
touchModule = movementEnumToModuleMap[UserGameSettings.TouchMovementMode]
elseif DevMovementMode == Enum.DevTouchMovementMode.Scriptable then
return nil, true
else
touchModule = movementEnumToModuleMap[DevMovementMode]
end
return touchModule, true
end
function ControlModule:OnRenderStepped(dt)
if self.activeController and self.activeController.enabled and self.humanoid then
local moveVector = self.activeController:GetMoveVector()
local vehicleConsumedInput = false
if self.vehicleController then
moveVector, vehicleConsumedInput = self.vehicleController:Update(moveVector, self.activeControlModule==Gamepad)
end
-- User of vehicleConsumedInput is commented out to preserve legacy behavior, in case some game relies on Humanoid.MoveDirection still being set while in a VehicleSeat
--if not vehicleConsumedInput then
self.moveFunction(Players.LocalPlayer, moveVector, self.cameraRelative)
--end
self.humanoid.Jump = self.activeController:GetIsJumping() or (self.touchJumpController and self.touchJumpController:GetIsJumping())
end
end
function ControlModule:OnHumanoidSeated(active, currentSeatPart)
if active then
if currentSeatPart and currentSeatPart:IsA("VehicleSeat") then
if not self.vehicleController then
self.vehicleController = self.vehicleController.new(CONTROL_ACTION_PRIORITY)
end
self.vehicleController:Enable(true, currentSeatPart)
end
else
if self.vehicleController then
self.vehicleController:Enable(false, currentSeatPart)
end
end
end
function ControlModule:OnCharacterAdded(char)
self.humanoid = char:FindFirstChildOfClass("Humanoid")
while not self.humanoid do
char.ChildAdded:wait()
self.humanoid = char:FindFirstChildOfClass("Humanoid")
end
if self.humanoidSeatedConn then
self.humanoidSeatedConn:Disconnect()
self.humanoidSeatedConn = nil
end
self.humanoidSeatedConn = self.humanoid.Seated:Connect(function(active, currentSeatPart) self:OnHumanoidSeated(active, currentSeatPart) end)
end
function ControlModule:OnCharacterRemoving(char)
self.humanoid = nil
end
|
-- local throtOff = script.Parent.Values.RPM.Value > 7500 and randomability <=1 and script.Parent.Values.Throttle.Value <= _Tune.IdleThrottle/100 |
local redline = script.Parent.Values.Throttle.Value > 0 and math.ceil(script.Parent.Values.RPM.Value) > _Tune.Redline-_Tune.RevBounce and script.Parent.Values.Gear.Value<#_Tune.Ratios-2
if redline then
if FE then
handler:FireServer("Backfire2")
wait (0.1)
else
car.Body.Exhaust.Backfire1.Backfire2:play()
car.Body.Exhaust.Backfire2.Backfire2:play()
car.Body.Exhaust.Backfire3.Backfire2:play()
car.Body.Exhaust.Backfire4.Backfire2:play()
car.Body.Exhaust.Backfire1.Fire.Enabled = true
car.Body.Exhaust.Backfire2.Fire.Enabled = true
car.Body.Exhaust.Backfire3.Fire.Enabled = true
car.Body.Exhaust.Backfire4.Fire.Enabled = true
car.Body.Exhaust.BFLight1.SpotLight.Enabled = true
car.Body.Exhaust.BFLight2.SpotLight.Enabled = true
car.Body.Exhaust.BFLight3.SpotLight.Enabled = true
car.Body.Exhaust.BFLight4.SpotLight.Enabled = true
wait (0.03)
car.Body.Exhaust.Backfire1.Fire.Enabled = false
car.Body.Exhaust.Backfire2.Fire.Enabled = false
car.Body.Exhaust.Backfire3.Fire.Enabled = false
car.Body.Exhaust.Backfire4.Fire.Enabled = false
car.Body.Exhaust.BFLight1.SpotLight.Enabled = false
car.Body.Exhaust.BFLight2.SpotLight.Enabled = false
car.Body.Exhaust.BFLight3.SpotLight.Enabled = false
car.Body.Exhaust.BFLight4.SpotLight.Enabled = false
wait (0.07)
end
end |
-- Simulate a raycast. |
local function SimulateCast(origin, direction, velocity, castFunction, lengthChangedEvent, rayHitEvent, rayExitedEvent, cosmeticBulletObject, listOrIgnoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, penetrationData)
PrintDebug("Cast simulation requested.")
if type(velocity) == "number" then
velocity = direction.Unit * velocity
end
local penetrationPower = penetrationData ~= nil and penetrationData.penetrationDepth or 0
local penetrationCount = penetrationData ~= nil and penetrationData.penetrationAmount or 0
local bulletAcceleration = bulletAcceleration or Vector3.new() -- Fix bug reported by Spooce: Failing to pass in the bulletAcceleration parameter throws an error, so add a fallback of Vector3.new()
local distance = direction.Magnitude -- This will be a unit vector multiplied by the maximum distance.
local normalizedDir = direction.Unit
local upgradedDir = (normalizedDir + velocity).Unit -- This rotates the direction of the bullet by the initial velocity, allowing 3D velocity to occur in the first place.
local initialVelocity = upgradedDir * velocity.Magnitude
local totalDelta = 0
local distanceTravelled = 0
local lastPoint = origin
local self = {}
local isRunningPenetration = false
local didHitHumanoid = false
local originalList = listOrIgnoreDescendantsInstance
local originalCastFunction = castFunction
local function Fire(delta, customAt)
PrintDebug("Casting for frame.")
totalDelta = totalDelta + delta
local at = customAt or GetPositionAtTime(totalDelta, origin, initialVelocity, bulletAcceleration)
local totalDisplacement = (at - lastPoint) -- This is the displacement from where the ray was on the last from to where the ray is now.
-- NEW BEHAVIOR:
-- Displacement needs to define velocity. The reason peoples' casts were going crazy was because on the line below I used to multiply by velocity.Magnitude
-- Okay, cool, so that's effectively the initial velocity. Now say we're at the top of an arc in a physics cast. Bullet sure isn't going the same speed!
-- We need to recalculate velocity based on displacement, NOT use the defined value.
-- How I missed this is beyond me.
-- Bonus ducks: This also allows me to implement GFink's request (see https://devforum.roblox.com/t/making-a-combat-game-with-ranged-weapons-fastcast-may-be-the-module-for-you/133474/282?u=etithespirit)
local segmentVelocity = GetVelocityAtTime(totalDelta, initialVelocity, bulletAcceleration)
-- local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta -- Direction of the ray is the direction from last to now * the velocity * deltaTime
local rayDir = totalDisplacement.Unit * segmentVelocity.Magnitude * delta
local hit, point, normal, material = castFunction(lastPoint, rayDir, listOrIgnoreDescendantsInstance, ignoreWater)
local rayDisplacement = (point - lastPoint).Magnitude
-- For clarity -- totalDisplacement is how far the ray would have traveled if it hit nothing,
-- and rayDisplacement is how far the ray really traveled (which will be identical to totalDisplacement if it did indeed hit nothing)
lengthChangedEvent:Fire(origin, lastPoint, rayDir.Unit, rayDisplacement, segmentVelocity, cosmeticBulletObject, bulletData, whizData, hitData)
local rayVisualization = nil
if (delta > 0) then
rayVisualization = DbgVisualizeSegment(CFrame.new(lastPoint, lastPoint + rayDir), rayDisplacement)
end
if hit and hit ~= cosmeticBulletObject then
local start = tick()
local unit = rayDir.Unit
local maxExtent = hit.Size.Magnitude * unit
local exitHit, exitPoint, exitNormal, exitMaterial = CastWithWhitelist(point + maxExtent, -maxExtent, {hit}, ignoreWater)
--local diff = exitPoint - point
--local dist = Vector3.new():Dot(unit, diff)
local dist = (exitPoint - point).Magnitude
-- SANITY CHECK: Don't allow the user to yield or run otherwise extensive code that takes longer than one frame/heartbeat to execute.
if (penetrationData ~= nil) and (penetrationData.penetrationType == "WallPenetration" and ((penetrationData.canPenetrateFunction ~= nil) and (penetrationPower > dist)) or (penetrationData.penetrationType == "HumanoidPenetration" and ((penetrationData.canPenetrateHumanoidFunction ~= nil) and (penetrationCount > 0)))) then
if (isRunningPenetration) then
error("ERROR: The latest call to canPenetrateFunction/canPenetrateHumanoidFunction took too long to complete! This cast is going to suffer desyncs which WILL cause unexpected behavior and errors.")
-- Use error. This should absolutely abort the cast.
end
isRunningPenetration = true
didHitHumanoid = false
end
if penetrationData == nil or (penetrationData ~= nil and ((penetrationData.penetrationType == "WallPenetration" and (penetrationPower < dist)) or (penetrationData.penetrationType == "HumanoidPenetration" and ((penetrationData.canPenetrateHumanoidFunction(origin, rayDir.Unit, hit, point, normal, material, segmentVelocity, penetrationCount, hitData) == false) or (penetrationCount <= 0))))) then
PrintDebug("Penetrating data is nil or penetrationPower is lower than dist/penetrationCount is at 0. Ending cast and firing RayHit.")
isRunningPenetration = false
-- Penetrate function is nil, or it's not nil and it returned false (we cannot penetrate this object).
-- Hit.
RemoveList[self] = true
rayHitEvent:Fire(origin, rayDir.Unit, hit, point, normal, material, segmentVelocity, cosmeticBulletObject, hitData)
DbgVisualizeHit(CFrame.new(point), Color3.new(0.2, 1, 0.5))
return
else
if rayVisualization ~= nil then
rayVisualization.Color3 = Color3.new(0.4, 0.05, 0.05) -- Turn it red to signify that the cast was scrapped.
end
DbgVisualizeHit(CFrame.new(point), Color3.new(1, 0.2, 0.2))
PrintDebug("Penetrating returned 'penetratedHumanoid' or 'penetratedObject'/TRUE to penetrate this hit. Processing...")
isRunningPenetration = false
-- Nope! We want to penetrate this part.
-- Now this is gonna be DISGUSTING.
-- We need to run this until we fufill that lost distance, so if some guy decides to layer up like 10 parts right next to eachother, we need to handle all of those in a single frame
-- The only way to do this isn't particularly pretty but it needs to be quick.
if penetrationData.penetrationType == "WallPenetration" then
local penetrationType = penetrationData ~= nil and penetrationData.canPenetrateFunction(origin, rayDir.Unit, hit, point, normal, material, segmentVelocity, hitData)
if (castFunction == CastWithWhitelist) then
-- User is using whitelist. We need to pull this from their list.
-- n.b. this function is offered by the sandboxed table system. It's not stock.
if penetrationType == "penetratedHumanoid" and (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.removeObject(listOrIgnoreDescendantsInstance, humanoid.Parent)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Whitelist cast detected, removed " .. tostring(humanoid.Parent) .. " from the whitelist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.removeObject(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Whitelist cast detected, removed " .. tostring(hit) .. " from the whitelist.")
end
elseif (castFunction == CastWithBlacklistAndNoHumPenetration) then
if penetrationType == "penetratedHumanoid" and (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.insert(listOrIgnoreDescendantsInstance, humanoid.Parent)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Blacklist cast detected, added " .. tostring(humanoid.Parent) .. " to the blacklist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Blacklist cast detected, added " .. tostring(hit) .. " to the blacklist.")
end
else
-- This is where things get finnicky.
-- We can't reparent the object. If we do this, we risk altering behavior of the developer's game which has undesirable effects.
-- We need to swap cast functions on the fly here. This is gonna get NASTY. Oh well. It should only happen once under this new behavior.
castFunction = CastWithBlacklistAndNoHumPenetration
listOrIgnoreDescendantsInstance = listOrIgnoreDescendantsInstance:GetDescendants()
if penetrationType == "penetratedHumanoid" and (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.insert(listOrIgnoreDescendantsInstance, humanoid.Parent)
--penetrationPower = penetrationPower
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(humanoid.Parent) .. " to the blacklist.")
elseif penetrationType == "penetratedObject" then
if exitHit and FastCast.RayExit then
rayExitedEvent:Fire(point + maxExtent, -maxExtent, exitHit, exitPoint, exitNormal, exitMaterial, segmentVelocity, hitData)
DbgVisualizeHit(CFrame.new(exitPoint), Color3.fromRGB(13, 105, 172))
end
table.insert(listOrIgnoreDescendantsInstance, hit)
--penetrationPower = penetrationPower - dist
local toReduce = 1-((dist/penetrationPower/1.1))
penetrationPower = penetrationPower * toReduce
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(hit) .. " to the blacklist.")
end
end
elseif penetrationData.penetrationType == "HumanoidPenetration" then
if (castFunction == CastWithWhitelist) then
-- User is using whitelist. We need to pull this from their list.
-- n.b. this function is offered by the sandboxed table system. It's not stock.
if (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
didHitHumanoid = true
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.removeObject(listOrIgnoreDescendantsInstance, humanoid.Parent)
PrintDebug("Whitelist cast detected, removed " .. tostring(humanoid.Parent) .. " from the whitelist.")
else
didHitHumanoid = false
table.removeObject(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Whitelist cast detected, removed " .. tostring(hit) .. " from the whitelist.")
end
elseif (castFunction == CastWithBlacklist) then
if (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
didHitHumanoid = true
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.insert(listOrIgnoreDescendantsInstance, humanoid.Parent)
PrintDebug("Blacklist cast detected, added " .. tostring(humanoid.Parent) .. " to the blacklist.")
else
didHitHumanoid = false
table.insert(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Blacklist cast detected, added " .. tostring(hit) .. " to the blacklist.")
end
else
-- This is where things get finnicky.
-- We can't reparent the object. If we do this, we risk altering behavior of the developer's game which has undesirable effects.
-- We need to swap cast functions on the fly here. This is gonna get NASTY. Oh well. It should only happen once under this new behavior.
castFunction = CastWithBlacklist
listOrIgnoreDescendantsInstance = listOrIgnoreDescendantsInstance:GetDescendants()
if (hit.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent:FindFirstChildOfClass("Humanoid").Health > 0) or (hit.Parent.Parent:FindFirstChildOfClass("Humanoid") and hit.Parent.Parent:FindFirstChildOfClass("Humanoid").Health > 0) then
didHitHumanoid = true
local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid") or hit.Parent.Parent:FindFirstChildOfClass("Humanoid")
table.insert(listOrIgnoreDescendantsInstance, humanoid.Parent)
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(humanoid.Parent) .. " to the blacklist.")
else
didHitHumanoid = false
table.insert(listOrIgnoreDescendantsInstance, hit)
PrintDebug("Stock cast detected, transformed cast into blacklist cast and added " .. tostring(hit) .. " to the blacklist.")
end
end
end
-- So now just cast again!
-- Cast with 0 deltaTime and from the prespecified point (this saves a smidge of performance since we don't need to try to recalculate a position value that will come out to be the same thing.)
PrintDebug("Recasting for penetration...")
Fire(0, at)
-- Then set lastPoint.
lastPoint = point
-- We used to do ^ above, but this caused undesired effects and zero-length casts. Oops.
if penetrationData ~= nil then
if penetrationData.penetrationType ~= "WallPenetration" then
if didHitHumanoid then
penetrationCount = hit and (penetrationCount - 1) or 0
PrintDebug("penetrationCount is reduced to... "..penetrationCount.." for hitting humanoid.")
else
PrintDebug("penetrationCount is not reduced for not hitting humanoid (or the humanoid died).")
end
else
PrintDebug("DISTANCE: "..dist.." studs")
PrintDebug("CURRENT PENETRATION DEPTH: "..penetrationPower.." studs")
end
end
-- And exit the function here too.
return
end
end
-- Then set lastPoint here as well.
lastPoint = point
distanceTravelled = distanceTravelled + rayDisplacement
if distanceTravelled > distance then
RemoveList[self] = true
rayHitEvent:Fire(origin, rayDir.Unit, nil, lastPoint, nil, nil, Vector3.new(), cosmeticBulletObject, hitData)
end
end
function self.Update(delta)
Fire(delta)
end
--[[Thread:Spawn(function()
Projectiles[self] = true
end)]]
-- Too fast?
if RunService:IsClient() then
spawn(function()
Projectiles[self] = true
end)
else
Thread:Spawn(function()
Projectiles[self] = true
end)
end
end
local function BaseFireMethod(self, origin, directionWithMagnitude, velocity, cosmeticBulletObject, ignoreDescendantsInstance, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, list, isWhitelist, penetrationData)
MandateType(origin, "Vector3", "origin")
MandateType(directionWithMagnitude, "Vector3", "directionWithMagnitude")
assert(typeof(velocity) == "Vector3" or typeof(velocity) == "number", ERR_INVALID_TYPE:format("velocity", "Variant<Vector3, number>", typeof(velocity))) -- This one's an odd one out.
MandateType(cosmeticBulletObject, "Instance", "cosmeticBulletObject", true)
MandateType(ignoreDescendantsInstance, "Instance", "ignoreDescendantsInstance", true)
MandateType(ignoreWater, "boolean", "ignoreWater", true)
MandateType(bulletAcceleration, "Vector3", "bulletAcceleration", true)
MandateType(list, "table", "list", true)
-- isWhitelist is strictly internal so it doesn't need to get sanity checked, because last I checked, I'm not insane c:
-- ... I hope
-- However, as of Version 9.0.0, a penetrate function can be specified
MandateType(penetrationData, "table", "penetrationData", true)
-- Now get into the guts of this.
local castFunction = Cast
local ignoreOrList = ignoreDescendantsInstance
if list ~= nil then
ignoreOrList = list
if isWhitelist then
castFunction = CastWithWhitelist
else
castFunction = (penetrationData and penetrationData.penetrationType ~= "WallPenetration" and CastWithBlacklist or CastWithBlacklistAndNoHumPenetration) or CastWithBlacklistAndNoHumPenetration
end
end
SimulateCast(origin, directionWithMagnitude, velocity, castFunction, self.LengthChanged, self.RayHit, self.RayExited, cosmeticBulletObject, ignoreOrList, ignoreWater, bulletAcceleration, bulletData, whizData, hitData, penetrationData)
end
|
--[[
Rejects the promise after `seconds` seconds.
]] |
function Promise.prototype:timeout(seconds, rejectionValue)
local traceback = debug.traceback(nil, 2)
return Promise.race({
Promise.delay(seconds):andThen(function()
return Promise.reject(rejectionValue == nil and Error.new({
kind = Error.Kind.TimedOut,
error = "Timed out",
context = string.format(
"Timeout of %d seconds exceeded.\n:timeout() called at:\n\n%s",
seconds,
traceback
),
}) or rejectionValue)
end),
self,
})
end
Promise.prototype.Timeout = Promise.prototype.timeout
function Promise.prototype:getStatus()
return self._status
end
Promise.prototype.GetStatus = Promise.prototype.getStatus
|
--BlowerSwitch |
function KeepBlowerActive()
repeat wait()
BlowerVal.Value = true
until BlowerSwch.Value == false or Power.Value == false
BlowerVal.Value = false
end
BlowerSwch.Changed:Connect(function()
if BlowerSwch.Value == true then
BlowerSwch.Parent.P1.Transparency = 1
BlowerSwch.Parent.P2.Transparency = 0
ClickSound:Play()
if Power.Value == true then
KeepBlowerActive()
end
else
BlowerSwch.Parent.P1.Transparency = 0
BlowerSwch.Parent.P2.Transparency = 1
ClickSound:Play()
BlowerVal.Value = false
end
end)
|
-- Put me in 'StarterGui' to hide the leaderboard. | |
-- if game.ReplicatedStorage.Tools:FindFirstChild(Object.Name) then |
if Object:FindFirstChild("Handle") and not Rotation then -- Soybeen added 7/29/2020
Rotation = Vector3.new(0,90,0)
end
local Cam = Instance.new("Camera",Viewport)
Cam.FieldOfView = 50
Object = Object:Clone()
Object.Parent = Viewport
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CameraSubject = Object
Viewport.CurrentCamera = Cam
-- Size viewport and adjust properties.
Viewport.Size = UDim2.new(1,0,1,0)
Viewport.Position = UDim2.new(0.5,0,0.5,0)
Viewport.AnchorPoint = Vector2.new(0.5,0.5)
Viewport.BackgroundTransparency = 1
Viewport.BackgroundColor3 = Color3.fromRGB(0,0,0)
local function GetLongestSide(VectorThree)
local LongestSide = VectorThree.X
if VectorThree.Y > LongestSide then
LongestSide = VectorThree.Y
end
if VectorThree.Z > LongestSide then
LongestSide = VectorThree.Z
end
return LongestSide
end
-- Position camera relative to object size average.
if Object:IsA("BasePart") then
local Offset = distanceOverride or GetLongestSide(Object.Size)
--local avgsize = (Object.Size.X + Object.Size.Y + Object.Size.Z) / 3
Object.CFrame = CFrame.new(0,0,0) * CFrame.Angles(math.rad(Rotation.X),math.rad(Rotation.Y),math.rad(Rotation.Z))
Cam.CFrame = CFrame.new(0,0,Offset + (1.5 * (Offset/4)))
Cam.CFrame = CFrame.new(Cam.CFrame.p,Object.Position)
elseif Object:IsA("Model") and Object.PrimaryPart then
local Extents = Object:GetExtentsSize()
local Offset = distanceOverride or GetLongestSide(Extents) --(Extents.X + Extents.Y + Extents.Z) / 3
local ModelMiddlePos = Vector3.new(Extents.X/2,Extents.Y/2,Extents.Z/2)
Object:SetPrimaryPartCFrame(CFrame.new(0,0,0) * CFrame.Angles(math.rad(Rotation.X),math.rad(Rotation.Y),math.rad(Rotation.Z)))
if Offset/4 >= 1 then
Cam.CFrame = CFrame.new(Object:GetModelCFrame().p) * CFrame.new(0,0,Offset + (1.5 * (Offset/4)))
else
Cam.CFrame = CFrame.new(Object:GetModelCFrame().p) * CFrame.new(0,0,Offset + 1.5)
end
Cam.CFrame = CFrame.new(Cam.CFrame.p,Object:GetModelCFrame().p)
else
Object:Destroy()
Viewport:Destroy()
return
end
if Viewport.Parent ~= parent then
Viewport.Parent = parent
end
Viewport.ZIndex = parent.ZIndex
if parent:IsA("ImageLabel") then
parent.Image = ""
end
return Viewport
end
return VC
|
-- Stats |
local stats = {
{
Name = "Wins",
Type = "IntValue",
DefaultValue = "0",
},
}
function LeaderboardManager.new(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
for i, stat in pairs(stats) do
local leaderstat = Instance.new(stat.Type)
leaderstat.Name = stat.Name
leaderstat.Value = stat.DefaultValue
leaderstat.Parent = leaderstats
end
end
function LeaderboardManager:getStat(player, stat)
local leaderstats = player:FindFirstChild("leaderstats")
if not leaderstats then return false end
if leaderstats then
return leaderstats:FindFirstChild(stat)
end
end
function LeaderboardManager:setStat(player, stat, value)
local stat = LeaderboardManager:getStat(player, stat)
if stat then
stat.Value = value
end
end
function LeaderboardManager:incrementStat(player, stat, value)
if not value then value = 1 end
local stat = LeaderboardManager:getStat(player, stat)
if stat then
stat.Value = stat.Value + value
end
end
function LeaderboardManager:decrementStat(player, stat, value)
if not value then value = 1 end
local stat = LeaderboardManager:getStat(player, stat)
if stat then
stat.Value = stat.Value - value
end
end
function LeaderboardManager:resetStat(player, stat)
local stat = LeaderboardManager:getStat(player, stat)
if stat then
for i, defaultStat in pairs(stats) do
if stat == defaultStat.Name then
stat.Value = defaultStat.DefaultValue
return
end
end
stat.Value = 0
end
end
function LeaderboardManager:resetStats(player)
local leaderstats = player:FindFirstChild("CustomLeaderstats")
if not leaderstats then return "No leaderstats found" end
for i, stat in pairs(leaderstats:GetChildren()) do
LeaderboardManager:resetState(player, stat)
end
end
return LeaderboardManager
|
--wl2.MaxVelocity = 0.007
--wl2.Part0 = script.Parent.Parent.Misc.RL.Door.WD
--wl2.Part1 = wl2.Parent | |
--[[
A method called by consumers of Roact to create a new component class.
Components can not be extended beyond this point, with the exception of
PureComponent.
]] |
function Component:extend(name)
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentClass, "Invalid `self` argument to `extend`.")
assert(typeof(name) == "string", "Component class name must be a string")
end
local class = {}
for key, value in pairs(self) do
-- Roact opts to make consumers use composition over inheritance, which
-- lines up with React.
-- https://reactjs.org/docs/composition-vs-inheritance.html
if key ~= "extend" then
class[key] = value
end
end
class[Type] = Type.StatefulComponentClass
class.__index = class
class.__componentName = name
setmetatable(class, componentClassMetatable)
return class
end
function Component:__getDerivedState(incomingProps, incomingState)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentInstance, "Invalid use of `__getDerivedState`")
end
local internalData = self[InternalData]
local componentClass = internalData.componentClass
if componentClass.getDerivedStateFromProps ~= nil then
local derivedState = componentClass.getDerivedStateFromProps(incomingProps, incomingState)
if derivedState ~= nil then
if config.typeChecks then
assert(typeof(derivedState) == "table", "getDerivedStateFromProps must return a table!")
end
return derivedState
end
end
return nil
end
function Component:setState(mapState)
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentInstance, "Invalid `self` argument to `extend`.")
end
local internalData = self[InternalData]
local lifecyclePhase = internalData.lifecyclePhase
--[[
When preparing to update, rendering, or unmounting, it is not safe
to call `setState` as it will interfere with in-flight updates. It's
also disallowed during unmounting
]]
if lifecyclePhase == ComponentLifecyclePhase.ShouldUpdate or
lifecyclePhase == ComponentLifecyclePhase.WillUpdate or
lifecyclePhase == ComponentLifecyclePhase.Render or
lifecyclePhase == ComponentLifecyclePhase.WillUnmount
then
local messageTemplate = invalidSetStateMessages[internalData.lifecyclePhase]
local message = messageTemplate:format(tostring(internalData.componentClass))
error(message, 2)
end
local pendingState = internalData.pendingState
local partialState
if typeof(mapState) == "function" then
partialState = mapState(pendingState or self.state, self.props)
-- Abort the state update if the given state updater function returns nil
if partialState == nil then
return
end
elseif typeof(mapState) == "table" then
partialState = mapState
else
error("Invalid argument to setState, expected function or table", 2)
end
local newState
if pendingState ~= nil then
newState = assign(pendingState, partialState)
else
newState = assign({}, self.state, partialState)
end
if lifecyclePhase == ComponentLifecyclePhase.Init then
-- If `setState` is called in `init`, we can skip triggering an update!
local derivedState = self:__getDerivedState(self.props, newState)
self.state = assign(newState, derivedState)
elseif lifecyclePhase == ComponentLifecyclePhase.DidMount or
lifecyclePhase == ComponentLifecyclePhase.DidUpdate or
lifecyclePhase == ComponentLifecyclePhase.ReconcileChildren
then
--[[
During certain phases of the component lifecycle, it's acceptable to
allow `setState` but defer the update until we're done with ones in flight.
We do this by collapsing it into any pending updates we have.
]]
local derivedState = self:__getDerivedState(self.props, newState)
internalData.pendingState = assign(newState, derivedState)
elseif lifecyclePhase == ComponentLifecyclePhase.Idle then
-- Outside of our lifecycle, the state update is safe to make immediately
self:__update(nil, newState)
else
local messageTemplate = invalidSetStateMessages.default
local message = messageTemplate:format(tostring(internalData.componentClass))
error(message, 2)
end
end
|
-- ReplicatedStorage -- |
function CircleClick(Button, X, Y)
coroutine.resume(coroutine.create(function()
Button.ClipsDescendants = true
local Circle = script:WaitForChild("Circle"):Clone()
Circle.Parent = Button
local NewX = X - Circle.AbsolutePosition.X
local NewY = Y - Circle.AbsolutePosition.Y
Circle.Position = UDim2.new(0, NewX, 0, NewY)
local Size = 0
if Button.AbsoluteSize.X > Button.AbsoluteSize.Y then
Size = Button.AbsoluteSize.X*1.5
elseif Button.AbsoluteSize.X < Button.AbsoluteSize.Y then
Size = Button.AbsoluteSize.Y*1.5
elseif Button.AbsoluteSize.X == Button.AbsoluteSize.Y then Size = Button.AbsoluteSize.X*1.5
end
local Time = 0.5
Circle:TweenSizeAndPosition(UDim2.new(0, Size, 0, Size), UDim2.new(0.5, -Size/2, 0.5, -Size/2), "Out", "Quad", Time, false, nil)
for i=1,10 do
Circle.ImageTransparency = Circle.ImageTransparency + 0.01
wait(Time/10)
end
Circle:Destroy()
end))
end
return CircleClick
|
-- Detect input to run or crawl |
UIS.InputBegan:Connect(function(input)
-- Detect input to run
if input.KeyCode==Enum.KeyCode.LeftShift then
-- Make sure not crawling or running already
if shiftDown==false and not cDown then
-- Run
shiftDown=true
hum.WalkSpeed=32
end
-- Detect input to crawl
else if input.KeyCode==Enum.KeyCode.C then
-- Make sure not running or crawling already
if cDown==false and not shiftDown then
-- Crawl
cDown=true
hum.WalkSpeed=5
--crawlAnm:Play()
end
end
end
end)
|
--Check if the player is holding down left click |
mouse.Button1Down:Connect(function()
down = true
end)
mouse.Button1Up:Connect(function()
down = false
end)
|
--while true do
-- local newpos = getnewposition()
-- Attachment.Orientation = newpos
-- print(newpos)
-- wait(0.2)
--end | |
--local Screen = carSeat.Parent.AudioPlayerScreen.SurfaceGui <-- soon |
local Song = script.Parent.AudioPlayerGui.Song
local Audio = carSeat.Audio
vol = 5
function changeSong()
local effect = carSeat.Audio.EqualizerSoundEffect
if effect.HighGain == 5 then
effect.HighGain = -80
effect.MidGain = -25
onOff.Text = "IN"
else
effect.HighGain = 5
effect.MidGain = 7
onOff.Text = "OUT"
end
end
function playSong()
local id = player.PlayerGui.AudioPlayer.AudioPlayerGui.TextBox.Text
Audio:Stop()
Audio.SoundId = "http://www.roblox.com/asset/?id="..id
Audio:Play()
--Screen.Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
--Screen.ID.Text = id
end
function stopSong()
Audio:Stop()
end
function volUp()
if vol + 0.1 <= 5 then
vol = vol + 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*1) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
function volDown()
if vol - 0.1 >= 0 then
vol = vol - 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*1) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
ChangeButton.MouseButton1Click:connect(function()
changeSong()
end)
VolUpButton.MouseButton1Click:connect(function()
volUp()
end)
VolDownButton.MouseButton1Click:connect(function()
volDown()
end)
PlayButton.MouseButton1Click:connect(function()
playSong()
end)
PauseButton.MouseButton1Click:connect(function()
stopSong()
end)
|
--///////////////// Internal-Use Methods
--//////////////////////////////////////
--DO NOT REMOVE THIS. Chat must be filtered or your game will face
--moderation. |
function methods:InternalApplyRobloxFilter(speakerName, message, toSpeakerName)
if (RunService:IsServer() and not RunService:IsStudio()) then
local fromSpeaker = self:GetSpeaker(speakerName)
local toSpeaker = self:GetSpeaker(toSpeakerName)
if (fromSpeaker and toSpeaker) then
local fromPlayerObj = fromSpeaker:GetPlayer()
local toPlayerObj = toSpeaker:GetPlayer()
if (fromPlayerObj and toPlayerObj) then
local filterStartTime = tick()
local filterRetries = 0
while true do
local success, message = pcall(function()
return Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
--[[ To uncensor the chat, turn the line above into the following:
Chat:FilterStringAsync(message, fromPlayerObj, toPlayerObj)
return message
--]]
end)
if success then
return message
else
warn("Error filtering message:", message)
end
filterRetries = filterRetries + 1
if filterRetries > MAX_FILTER_RETRIES or (tick() - filterStartTime) > MAX_FILTER_DURATION then
self:InternalNotifyFilterIssue()
return nil
end
end
end
end
else
--// Simulate filtering latency.
--// There is only latency the first time the message is filtered, all following calls will be instant.
if not StudioMessageFilteredCache[message] then
StudioMessageFilteredCache[message] = true
wait(0.2)
end
return message
end
return nil
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
assert(type(ret) == "boolean")
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
-- This is to store other things that may require our radar attention |
local Camera = workspace.CurrentCamera
local SaveList = {MinhaVisao = 1, RosaDosVentos = 1, UIAspectRatioConstraint = 1, FoeBlip = 1, FriendBlip = 1}
local SquadSave = {UIGridLayout = 1}
Character.Humanoid.Died:Connect(function()
script.Parent.Enabled = false
end)
game:GetService("RunService").RenderStepped:connect(function()
local Direction = (Vector2.new(Camera.Focus.x,Camera.Focus.z)-Vector2.new(Camera.CoordinateFrame.x,Camera.CoordinateFrame.z)).unit
local theta = (math.atan2(Direction.y,Direction.x))*(-180/math.pi) - 90
if Saude.FireTeam.SquadName.Value ~= "" then
MinhasVisao.ImageColor3 = Saude.FireTeam.SquadColor.Value
else
MinhasVisao.ImageColor3 = Color3.fromRGB(255,255,255)
end
local frame = Vector3.new(Camera.CoordinateFrame.x, 0, Camera.CoordinateFrame.z)
local focus = Vector3.new(Camera.Focus.x, 0, Camera.Focus.z)
local frame = CFrame.new(focus, frame)
script.Parent.Frame.RosaDosVentos.Rotation = theta
local players = game.Players:GetChildren()
if Saude.FireTeam.SquadName.Value ~= "" and Player then
script.Parent.Squad.Visible = true
script.Parent.Squad.Esquadrao.Text = Saude.FireTeam.SquadName.Value
else
script.Parent.Squad.Visible = false
end
local Nomes = script.Parent.Squad.Membros:GetChildren()
for i = 1, #Nomes do
if not SquadSave[Nomes[i].Name] then
Nomes[i]:Destroy()
end
end
for i = 1, #players do
if players[i] ~= Player and players[i].Character and Player and Player.Character then
local unit = script.Parent.Squad.Membros:FindFirstChild(players[i].Name)
if not unit then
if players[i].TeamColor == Player.TeamColor and players[i].Character.Saude.FireTeam.SquadName.Value == Player.Character.Saude.FireTeam.SquadName.Value and Player.Character.Saude.FireTeam.SquadName.Value ~= "" then
unit = script.Parent.Squad.Exemplo:Clone()
unit.Visible = true
unit.Text = players[i].Name
unit.Name = players[i].Name
unit.Parent = script.Parent.Squad.Membros
end
end
end
end
local labels = RadarFrame:GetChildren()
for i = 1, #labels do
if not SaveList[labels[i].Name] then
labels[i]:Destroy()
end
end
for i = 1, #players do
if players[i] ~= Player and players[i].Character and Player and Player.Character then
local unit = RadarFrame:FindFirstChild(players[i].Name)
if not unit then
if players[i].TeamColor == Player.TeamColor then
unit = FriendBlip:Clone()
else
unit = FoeBlip:Clone()
end
unit.Visible = false
unit.Name = players[i].Name
unit.Parent = RadarFrame
end
if players[i].Character:FindFirstChild('Humanoid') and players[i].Character:FindFirstChild('HumanoidRootPart') then
-- Get the relative position of the players
local pos = CFrame.new(players[i].Character.HumanoidRootPart.Position.X, 0, players[i].Character.HumanoidRootPart.Position.Z)
local relativeCFrame = frame:inverse() * pos
local distanceRatio = relativeCFrame.p.Magnitude/RANGE
if distanceRatio < 0.9 then
local xScale = 0.5 - ((relativeCFrame.x/RANGE)/2)
local yScale = 0.5 - ((relativeCFrame.z/RANGE)/2)
unit.Position = UDim2.new(xScale, 0, yScale, 0)
unit.Rotation = -players[i].Character.HumanoidRootPart.Orientation.Y + theta
if players[i].TeamColor == Player.TeamColor then
if players[i].Character.Saude.FireTeam.SquadName.Value ~= "" then
unit.ImageColor3 = players[i].Character.Saude.FireTeam.SquadColor.Value
else
unit.ImageColor3 = FriendBlip.ImageColor3
end
else
unit.ImageColor3 = FoeBlip.ImageColor3
end
unit.Visible = true
else
unit.Visible = false
end
else
unit.Visible = false
end
end
end
end)
|
-- special damage when the Ninja slash occurs |
local slash_damage = 10
local damage = nonslash_damage
|
--//Suspension//-- |
RideHeightFront = 2.3 --{This value will increase the ride height for front}
RideHeightRear = 2.9--{This value will increase the ride height for rear}
StiffnessFront = 5 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
StiffnessRear = 4 --[0-10]{This value will increase the stiffness for rear} (S/A)
AntiRollFront = 2 --[0-10]{HIGHER STIFFNESS DECREASES SPAWNING STABILITY}
AntiRollRear = 3 --[0-10]{This value will reduce roll on the rear} (S/A)
CamberFront = -0.2 --[0-10]{Camber to the front in degrees}
CamberRear = -1.3 --[0-10]{Camber to the rear in degrees}
|
--/ Initialization /-- |
require(script.MainModule).start(script,config)
|
-- ================================================================================
-- LOCAL FUNCTIONS
-- ================================================================================ |
local function CheckNAN(value, returnIfNan)
return (value == value and value or returnIfNan)
end -- CheckNAN
local function DeltaAngle(current, target)
local num = (target - current) % TAU
if num > PI then
num = (num - TAU)
end
return num
end -- DeltaAngle()
local function DeltaAngleV3(pos1, pos2)
local x = DeltaAngle(pos1.X, pos2.X)
local y = DeltaAngle(pos1.Y, pos2.Y)
local z = DeltaAngle(pos1.Z, pos2.Z)
return V3(x, y, z)
end -- DeltaAngleV3() |
-- carSeat.Parent.Body.Dash.Screen.G.Radio.VOLMENU.VolumeText.Text = "VOLUME: "..carSeat.Parent.Body.MP.Sound.Volume |
end
F.updateValue = function(Val, Value)
if Val then
Val.Value = Value
end
end
F.FMSwitch = function(FM)
if carSeat.Stations.mood.Value == 5 then
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = 2 |
-- Waits for the child of the specified parent |
local function WaitForChild(parent, childName)
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local Tool = script.Parent
local Animations = {}
local MyHumanoid
local MyCharacter
local function PlayAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Play()
end
end
local function StopAnimation(animationName)
if Animations[animationName] then
Animations[animationName]:Stop()
end
end
function OnEquipped(mouse)
MyCharacter = Tool.Parent
MyHumanoid = WaitForChild(MyCharacter, 'Humanoid')
if MyHumanoid then
Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'Idle'))
end
PlayAnimation('IdleAnim')
end
function OnUnequipped()
for animName, _ in pairs(Animations) do
StopAnimation(animName)
end
end
Tool.Equipped:connect(OnEquipped)
Tool.Unequipped:connect(OnUnequipped)
|
---////==========================================\\\---
--Controller for: Railroad Crossing Sounder |
Sounder = script.Parent.Parent.ControlBox.CrossingValues.Bell |
------------------
------------------ |
function waitForChild(parent, childName)
while true do
local child = parent:findFirstChild(childName)
if child then
return child
end
parent.ChildAdded:wait()
end
end
local Figure = script.Parent
local Torso = waitForChild(Figure, "Torso")
local RightShoulder = waitForChild(Torso, "Right Shoulder")
local LeftShoulder = waitForChild(Torso, "Left Shoulder")
local RightHip = waitForChild(Torso, "Right Hip")
local LeftHip = waitForChild(Torso, "Left Hip")
local Neck = waitForChild(Torso, "Neck")
local Humanoid = waitForChild(Figure, "Monster") -- Don't tutch.
local pose = "Standing"
local toolAnim = "None"
local toolAnimTime = 0
local isSeated = false
function onRunning(speed)
if isSeated then return end
if speed>10 then
pose = "Running"
else
pose = "Standing"
end
end
function onDied()
pose = "Dead"
wait(regentime)
wait(1)
model:remove()
model = backup:Clone()
wait(3)
model.Parent = game.Workspace
model:MakeJoints()
end
function onJumping()
isSeated = false
pose = "Jumping"
end
function onClimbing()
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onDancing()
pose = "Dancing"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
isSeated = true
pose = "Seated"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1
LeftShoulder.DesiredAngle = -1
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveFloat()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = -1.57
end
function moveBoogy()
while pose=="Boogy" do
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(.5)
RightShoulder.MaxVelocity = 1
LeftShoulder.MaxVelocity = 1
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 1.57
end
end
function moveZombie()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.57
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function movePunch()
script.Parent.Torso.Anchored=true
RightShoulder.MaxVelocity = 60
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
wait(1)
script.Parent.Torso.Anchored=false
pose="Standing"
end
function moveKick()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveFly()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
LeftShoulder.DesiredAngle = 0
RightHip.MaxVelocity = 40
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 0
wait(1)
pose="Standing"
end
function moveClimb()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -3.14
LeftShoulder.DesiredAngle = 3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = -3.14 /2
LeftShoulder.DesiredAngle = -3.14 /2
RightHip.DesiredAngle = 3.14 /2
LeftHip.DesiredAngle = -3.14 /2
end
function getTool()
kidTable = Figure:children()
if (kidTable ~= nil) then
numKids = #kidTable
for i=1,numKids do
if (kidTable[i].className == "Tool") then return kidTable[i] end
end
end
return nil
end
function getToolAnim(tool)
c = tool:children()
for i=1,#c do
if (c[i].Name == "toolanim" and c[i].className == "StringValue") then
return c[i]
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulder.DesiredAngle = -1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = -1.57
LeftShoulder.DesiredAngle = 1.0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "Zombie") then
moveZombie()
return
end
if (pose == "Boogy") then
moveBoogy()
return
end
if (pose == "Float") then
moveFloat()
return
end
if (pose == "Punch") then
movePunch()
return
end
if (pose == "Kick") then
moveKick()
return
end
if (pose == "Fly") then
moveFly()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Climbing") then
moveClimb()
return
end
if (pose == "Seated") then
moveSit()
return
end
amplitude = 0.1
frequency = 1
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
if (pose == "Running") then
amplitude = 1
frequency = 9
elseif (pose == "Dancing") then
amplitude = 2
frequency = 16
end
desiredAngle = amplitude * math.sin(time*frequency)
if pose~="Dancing" then
RightShoulder.DesiredAngle = -desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
else
RightShoulder.DesiredAngle = desiredAngle
LeftShoulder.DesiredAngle = desiredAngle
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
end
local tool = getTool()
if tool ~= nil then
animStringValueObject = getToolAnim(tool)
if animStringValueObject ~= nil then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
-- local dir = pos.CFrame.lookVector
-- local pos1 = pos.Position + (dir * 6)
-- rocket.CFrame = CFrame.new(pos1, pos1 + dir) |
scr.Disabled= false
rocket.Parent = game.Workspace
-- т.е. дальше он живёт сам по себе
end
return module
|
--// All global vars will be wiped/replaced except script
--// All guis are autonamed client.Variables.CodeName..gui.Name |
return function(data, env)
if env then
setfenv(1, env)
end
local gui = script.Parent.Parent
local playergui = service.PlayerGui
local str = data.Message
local time = data.Time or 15
local log = {
Type = "Hint";
Title = "Hint";
Message = str;
Icon = "rbxassetid://7501175708";
Time = os.date("%X");
Function = nil;
}
table.insert(client.Variables.CommunicationsHistory, log)
service.Events.CommsPanel:Fire(log)
--client.UI.Make("HintHolder")
local container = client.UI.Get("HintHolder",nil,true)
if not container then
local holder = service.New("ScreenGui")
holder.IgnoreGuiInset = not client.Variables.TopBarShift
holder.ClipToDeviceSafeArea = true
local hTable = client.UI.Register(holder)
local frame = service.New("ScrollingFrame", holder)
client.UI.Prepare(holder)
hTable.Name = "HintHolder"
frame.Name = "Frame"
frame.BackgroundTransparency = 1
frame.Size = UDim2.new(1, 0, 0,150)
frame.CanvasSize = UDim2.new(0, 0, 0, 0)
frame.ChildAdded:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
frame.ChildRemoved:Connect(function(c)
if #frame:GetChildren() == 0 then
frame.Visible = false
else
frame.Visible = true
end
end)
container = hTable
hTable:Ready()
end
container = container.Object.Frame
--// First things first account for notif :)
local notif = client.UI.Get("Notif")
if (container:IsA("ScreenGui")) then
container.IgnoreGuiInset, container.ClipToDeviceSafeArea = not client.Variables.TopBarShift, true
end
container.Position = UDim2.new(0, 0, 0, (notif and 30 or 0))
local children = container:GetChildren()
gui.Position = UDim2.new(0,0,0,-100)
gui.Frame.msg.Text = str
local bounds = gui.Frame.msg.TextBounds.X
local function moveGuis(m,ignore)
m = m or 0
local max = #container:GetChildren()
for i,v in pairs(container:GetChildren()) do
if v~=ignore then
local y = (i+m)*28
v.Position = UDim2.new(0,0,0,y)
if i~=max then v.Size = UDim2.new(1,0,0,28) end
end
end
end
local lom = -1
moveGuis(-1)
gui.Parent = container
if #container:GetChildren()>5 then lom = -2 end
UDim2.new(0,0,0,(#container:GetChildren()+lom)*28)
moveGuis(-1)
--gui:TweenPosition(UDim2.new(0,0,0,(#container:GetChildren()+lom)*28),nil,nil,0.3,true,function() if gui and gui.Parent then moveGuis(-1) end end)
if #container:GetChildren()>5 then
local gui = container:GetChildren()[1]
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
wait(data.Time or 5)
if gui and gui.Parent then
moveGuis(-2,gui)
gui:Destroy()
--gui:TweenPosition(UDim2.new(0,0,0,-100),nil,nil,0.2,true,function() if gui and gui.Parent then gui:Destroy() end end)
end
end
|
-- Initialize the tool |
local NewPartTool = {
Name = 'New Part Tool';
Color = BrickColor.new 'Really black';
-- Default options
Type = 'Normal';
};
|
--[[ The Module ]] | --
local BaseCharacterController = require(script.Parent:WaitForChild("BaseCharacterController"))
local Gamepad = setmetatable({}, BaseCharacterController)
Gamepad.__index = Gamepad
function Gamepad.new(CONTROL_ACTION_PRIORITY)
local self = setmetatable(BaseCharacterController.new(), Gamepad)
self.CONTROL_ACTION_PRIORITY = CONTROL_ACTION_PRIORITY
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.activeGamepad = NONE -- Enum.UserInputType.Gamepad1, 2, 3...
self.gamepadConnectedConn = nil
self.gamepadDisconnectedConn = nil
return self
end
function Gamepad:Enable(enable)
if not UserInputService.GamepadEnabled then
return false
end
if enable == self.enabled then
-- Module is already in the state being requested. True is returned here since the module will be in the state
-- expected by the code that follows the Enable() call. This makes more sense than returning false to indicate
-- no action was necessary. False indicates failure to be in requested/expected state.
return true
end
self.forwardValue = 0
self.backwardValue = 0
self.leftValue = 0
self.rightValue = 0
self.moveVector = ZERO_VECTOR3
self.isJumping = false
if enable then
self.activeGamepad = self:GetHighestPriorityGamepad()
if self.activeGamepad ~= NONE then
self:BindContextActions()
self:ConnectGamepadConnectionListeners()
else
-- No connected gamepads, failure to enable
return false
end
else
self:UnbindContextActions()
self:DisconnectGamepadConnectionListeners()
self.activeGamepad = NONE
end
self.enabled = enable
return true
end
|
--[=[
@within Shake
@prop TimeFunction () -> number
The function used to get the current time. This defaults to
`time` during runtime, and `os.clock` otherwise. Usually this
will not need to be set, but it can be optionally configured
if desired.
]=] | |
---@class Database |
local Database = {}
Database.__index = Database
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
---------------------------------------------------------------------------------------------------- |
,Distance = 10000
,BDrop = .25
,BSpeed = 2300
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = true
,BWEmitter = 25
,BWMaxDistance = 200
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = true
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 1
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = 100
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0 |
-- FUNCTIONS -- |
humanoid:SetStateEnabled(Enum.HumanoidStateType.FallingDown, false)
humanoid:SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
local head = char:WaitForChild("Head")
head.Shape = Enum.PartType.Ball
head.Size = Vector3.new(1,1,1)
CS:GetInstanceAddedSignal("Ragdoll"):Connect(function(v)
if v == char then
humanoid:ChangeState(Enum.HumanoidStateType.Physics)
hrp:ApplyAngularImpulse(Vector3.new(90, 0, 0))
end
end)
CS:GetInstanceRemovedSignal("Ragdoll"):Connect(function(v)
if v == char then
humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
end
end)
|
-- dayLength defines how long, in minutes, a day in your game is. Feel free to alter it. |
local dayLength = 15
local cycleTime = dayLength*60
local minutesInADay = 24*60
local lighting = game:GetService("Lighting")
local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime
local timeRatio = minutesInADay / cycleTime
if dayLength == 0 then
dayLength = 1
end
repeat
local currentTime = tick()
if currentTime > endTime then
startTime = endTime
endTime = startTime + cycleTime
end
lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
wait(1/15)
until false
|
-- carSeat.Parent.Body.Dash.Screen.G.Radio.Song.Text = "Music off" |
end
F.pitc = function(v)
carSeat.Parent.Body.MP.Sound.Pitch = v
end
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
--[[
CameraShakePresets.Bump
CameraShakePresets.Explosion
CameraShakePresets.Earthquake
CameraShakePresets.BadTrip
CameraShakePresets.HandheldCamera
CameraShakePresets.Vibration
CameraShakePresets.RoughDriving
--]] |
local CameraShakeInstance = require(script.Parent.CameraShakeInstance)
local CameraShakePresets = {
-- A high-magnitude, short, yet smooth shake.
-- Should happen once.
Bump = function()
local c = CameraShakeInstance.new(2.5, 4, 0.1, 0.75)
c.PositionInfluence = Vector3.new(0.15, 0.15, 0.15)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
-- An intense and rough shake.
-- Should happen once.
Explosion = function()
local c = CameraShakeInstance.new(5, 10, 0, 1.5)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(4, 1, 1)
return c
end;
-- A continuous, rough shake
-- Sustained.
Earthquake = function()
local c = CameraShakeInstance.new(0.6, 3.5, 2, 10)
c.PositionInfluence = Vector3.new(0.25, 0.25, 0.25)
c.RotationInfluence = Vector3.new(1, 1, 4)
return c
end;
-- A bizarre shake with a very high magnitude and low roughness.
-- Sustained.
BadTrip = function()
local c = CameraShakeInstance.new(10, 0.15, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0.15)
c.RotationInfluence = Vector3.new(2, 1, 4)
return c
end;
-- A subtle, slow shake.
-- Sustained.
HandheldCamera = function()
local c = CameraShakeInstance.new(1, 0.25, 5, 10)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 0.5, 0.5)
return c
end;
-- A very rough, yet low magnitude shake.
-- Sustained.
Vibration = function()
local c = CameraShakeInstance.new(0.4, 20, 2, 2)
c.PositionInfluence = Vector3.new(0, 0.15, 0)
c.RotationInfluence = Vector3.new(1.25, 0, 4)
return c
end;
-- A slightly rough, medium magnitude shake.
-- Sustained.
RoughDriving = function()
local c = CameraShakeInstance.new(1, 2, 1, 1)
c.PositionInfluence = Vector3.new(0, 0, 0)
c.RotationInfluence = Vector3.new(1, 1, 1)
return c
end;
}
return setmetatable({}, {
__index = function(t, i): (() -> ())?
local f = CameraShakePresets[i]
if (type(f) == "function") then
return f()
end
error("No preset found with index \"" .. i .. "\"")
end;
})
|
--------LEFT DOOR -------- |
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(106)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(1013)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(1023)
game.Workspace.doorleft.pillar.BrickColor = BrickColor.new(game.Workspace.Lighting.cyan.Value) |
--[[**
<description>
Run this once to combine all keys provided into one "main key".
Internally, this means that data will be stored in a table with the key mainKey.
This is used to get around the 2-DataStore2 reliability caveat.
</description>
<parameter name = "mainKey">
The key that will be used to house the table.
</parameter>
<parameter name = "...">
All the keys to combine under one table.
</parameter>
**--]] |
function DataStore2.Combine(mainKey, ...)
for _, name in ipairs({...}) do
combinedDataStoreInfo[name] = mainKey
end
end
function DataStore2.ClearCache()
DataStoreCache = {}
end
function DataStore2.SaveAll(player)
if DataStoreCache[player] then
for _, dataStore in pairs(DataStoreCache[player]) do
if dataStore.combinedStore == nil then
dataStore:Save()
end
end
end
end
DataStore2.SaveAllAsync = Promise.promisify(DataStore2.SaveAll)
function DataStore2.PatchGlobalSettings(patch)
for key, value in pairs(patch) do
assert(Settings[key] ~= nil, "No such key exists: " .. key)
-- TODO: Implement type checking with this when osyris' t is in
Settings[key] = value
end
end
function DataStore2.__call(_, dataStoreName, player)
assert(
typeof(dataStoreName) == "string" and IsPlayer.Check(player),
("DataStore2() API call expected {string dataStoreName, Player player}, got {%s, %s}")
:format(
typeof(dataStoreName),
typeof(player)
)
)
if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then
return DataStoreCache[player][dataStoreName]
elseif combinedDataStoreInfo[dataStoreName] then
local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player)
dataStore:BeforeSave(function(combinedData)
for key in pairs(combinedData) do
if combinedDataStoreInfo[key] then
local combinedStore = DataStore2(key, player)
local value = combinedStore:Get(nil, true)
if value ~= nil then
if combinedStore.combinedBeforeSave then
value = combinedStore.combinedBeforeSave(clone(value))
end
combinedData[key] = value
end
end
end
return combinedData
end)
local combinedStore = setmetatable({
combinedName = dataStoreName,
combinedStore = dataStore,
}, {
__index = function(_, key)
return CombinedDataStore[key] or dataStore[key]
end,
})
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = combinedStore
return combinedStore
end
local dataStore = {
Name = dataStoreName,
UserId = player.UserId,
callbacks = {},
beforeInitialGet = {},
afterSave = {},
bindToClose = {},
}
dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore)
setmetatable(dataStore, DataStoreMetatable)
local saveFinishedEvent, isSaveFinished = Instance.new("BindableEvent"), false
local bindToCloseEvent = Instance.new("BindableEvent")
local bindToCloseCallback = function()
if not isSaveFinished then
-- Defer to avoid a race between connecting and firing "saveFinishedEvent"
Promise.defer(function()
bindToCloseEvent:Fire() -- Resolves the Promise.race to save the data
end)
saveFinishedEvent.Event:Wait()
end
local value = dataStore:Get(nil, true)
for _, bindToClose in ipairs(dataStore.bindToClose) do
bindToClose(player, value)
end
end
local success, errorMessage = pcall(function()
game:BindToClose(function()
if bindToCloseCallback == nil then
return
end
bindToCloseCallback()
end)
end)
if not success then
warn("DataStore2 could not BindToClose", errorMessage)
end
Promise.race({
Promise.fromEvent(bindToCloseEvent.Event),
Promise.fromEvent(player.AncestryChanged, function()
return not player:IsDescendantOf(game)
end),
}):andThen(function()
dataStore:SaveAsync():andThen(function()
--print("player left, saved", dataStoreName)
end):catch(function(error)
-- TODO: Something more elegant
--warn("error when player left!", error)
end):finally(function()
isSaveFinished = true
saveFinishedEvent:Fire()
end)
--Give a long delay for people who haven't figured out the cache :^(
return Promise.delay(40):andThen(function()
DataStoreCache[player] = nil
bindToCloseCallback = nil
end)
end)
if not DataStoreCache[player] then
DataStoreCache[player] = {}
end
DataStoreCache[player][dataStoreName] = dataStore
return dataStore
end
DataStore2.Constants = Constants
return setmetatable(DataStore2, DataStore2)
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388 |
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,0.73,0.02) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
-- Get the character and humanoid |
local character = game.Players.LocalPlayer.Character
local humanoid = character:WaitForChild("Humanoid")
|
-- ROBLOX upstream: https://github.com/facebook/jest/tree/v27.4.7/packages/jest-util/src/isPromise.ts | |
-- Make signal strict |
setmetatable(Signal, {
__index = function(tb, key)
error(("Attempt to get Signal::%s (not a valid member)"):format(tostring(key)), 2)
end,
__newindex = function(tb, key, value)
error(("Attempt to set Signal::%s (not a valid member)"):format(tostring(key)), 2)
end
})
return Signal
|
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
_L.Services.MarketplaceService.ProcessReceipt = function(receiptInfo)
--- Reciept info
local playerId = receiptInfo.PlayerId
local productId, purchaseId = receiptInfo.ProductId, receiptInfo.PurchaseId
local currencySpent, currencyType = receiptInfo.CurrencySpent, receiptInfo.CurrencyType
local placeId = receiptInfo.PlaceIdWherePurchased
--- Find the player instance from playerId (scans several times just in case)
local function FindPlayer()
local player = game.Players:GetPlayerByUserId(playerId)
local attempts = 0
while (not player) and attempts < 20 do
wait(.2)
player = game.Players:GetPlayerByUserId(playerId)
attempts = attempts + 1
end
return player
end
--- Process product reciept
local player = FindPlayer()
if player then
local productDir = Products.GetDir(productId)
local playerStats = _L.Saving.Get(player)
if productDir and playerStats then
--- Reward the player for purchasing this product based on the callback!
local pass = false
local pass2 = pcall(function()
pass = productDir.Callback(player, receiptInfo)
end)
--- Success!
if pass and pass2 then
pcall(function()
_L.Network.Fire("Product Bought", player, receiptInfo)
_L.Signal.Fire("Product Bought", player, receiptInfo)
_L.Analytics.Purchase("product", player.Name, productId)
end)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end
--- Failed, for some reason. Attempt to let the player know (if they are in the server)
pcall(function()
if player then
_L.Network.Fire("Product Failed", player, receiptInfo)
_L.Print("[bold]HUGE ISSUE: Failed to process product purchase! (plr: " .. player.Name .. " | id: " .. productId .. ") [/bold]", true)
else
_L.Print("[bold]HUGE ISSUE: Failed to process product purchase, could not find player! (plr: " .. playerId .. " | id: " .. productId .. ") [/bold]", true)
end
end)
--
return Enum.ProductPurchaseDecision.NotProcessedYet
end
|
-- Declare a global variable to store the secret |
secret = nil |
--[[
Returns a single instance of the EmoteManager that is used throughout
the server side of the EmoteBar
]] |
local function getEmoteManager()
return emoteManager
end
return getEmoteManager
|
--[[Engine]] |
--Torque Curve
Tune.Horsepower = 510 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 6000 -- Use sliders to manipulate values
Tune.Redline = 6700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 5500
Tune.PeakSharpness = 7.5
Tune.CurveMult = 0.16
--Incline Compensation
Tune.InclineComp = 4.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
--[=[
@class UICornerUtils
]=] |
local UICornerUtils = {}
function UICornerUtils.fromScale(scale, parent)
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(scale, 0)
uiCorner.Parent = parent
return uiCorner
end
function UICornerUtils.fromOffset(offset, parent)
local uiCorner = Instance.new("UICorner")
uiCorner.CornerRadius = UDim.new(0, offset)
uiCorner.Parent = parent
return uiCorner
end
|
-- |
script.Parent.OnServerEvent:Connect(function(p)
local Character = p.Character
local Humanoid = Character.Humanoid
local RootPart = Character.HumanoidRootPart
local torso = Character.Torso
local RArm = Character["Right Arm"]
local LArm = Character["Left Arm"]
local anim = Humanoid:LoadAnimation(script.Punch)
local anim3 = Humanoid:LoadAnimation(script.BD)
local FX = Assets.Punch3:Clone()
anim:Play()
Humanoid.WalkSpeed = 10
Humanoid.JumpPower = 0
Humanoid.AutoRotate = false
RootPart.Anchored = true
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
FX.Parent = workspace.Effects
wait(0.2)
local dust = Assets.Dust.Attachment:Clone()
FX.CanCollide = false
FX.CastShadow = false
FX.Anchored = true
FX.Parent = workspace.Effects
FX.Transparency = 1
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
dust.Parent = RootPart
wait(0.05)
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(19.5, 22, 19.5))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local RootPart2 = v.Parent.HumanoidRootPart
script.Parent.Parent.Parent.Part1.Part2.Motor6D.Part1 = RootPart2
anim3:Play()
local vel = Instance.new("BodyVelocity", v.Parent.Torso)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.Torso
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,2)
for _,Particles in pairs(dust:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
wait(0.01)
wait(0.5)
local dust = Assets.Dust.Attachment:Clone()
FX.CanCollide = false
FX.CastShadow = false
FX.Anchored = true
FX.Parent = workspace.Effects
FX.Transparency = 1
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
dust.Parent = RootPart
wait(0.05)
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(19.5, 22, 19.5))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local HitCounterRemote = RS.Events.Remotes.HitCounter
HitCounterRemote:FireClient(p)
local anim2 = v.Parent.Humanoid:LoadAnimation(script.Hit)
anim2:Play()
local vel = Instance.new("BodyVelocity", v.Parent.Torso)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.Torso
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,2)
local HitFX = Assets.Headbutt.Attachment:Clone()
local Head = v.Parent.Head
HitFX.Parent = Head
HitFX.Hit:Play()
for _,Particles in pairs(HitFX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(dust:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX,3)
wait(0.01)
end
end
end
wait(0.45)
local dust = Assets.Dust.Attachment:Clone()
FX.CanCollide = false
FX.CastShadow = false
FX.Anchored = true
FX.Parent = workspace.Effects
FX.Transparency = 1
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
dust.Parent = RootPart
wait(0.05)
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(19.5, 22, 19.5))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local HitCounterRemote = RS.Events.Remotes.HitCounter
HitCounterRemote:FireClient(p)
local anim2 = v.Parent.Humanoid:LoadAnimation(script.Hit)
anim2:Play()
local vel = Instance.new("BodyVelocity", v.Parent.Torso)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.Torso
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,2)
local HitFX = Assets.Headbutt.Attachment:Clone()
local Head = v.Parent.Head
HitFX.Parent = Head
HitFX.Hit:Play()
for _,Particles in pairs(HitFX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(dust:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX,3)
wait(0.01)
end
end
end
wait(0.45)
local dust = Assets.Dust.Attachment:Clone()
FX.CanCollide = false
FX.CastShadow = false
FX.Anchored = true
FX.Parent = workspace.Effects
FX.Transparency = 1
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
dust.Parent = RootPart
wait(0.05)
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(19.5, 22, 19.5))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local HitCounterRemote = RS.Events.Remotes.HitCounter
HitCounterRemote:FireClient(p)
local anim2 = v.Parent.Humanoid:LoadAnimation(script.Hit)
anim2:Play()
local vel = Instance.new("BodyVelocity", v.Parent.Torso)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.Torso
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.LookVector * 0
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,2)
local HitFX = Assets.Headbutt.Attachment:Clone()
local Head = v.Parent.Head
HitFX.Parent = Head
HitFX.Hit:Play()
for _,Particles in pairs(HitFX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(dust:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX,3)
wait(0.01)
end
end
end
wait(0.3)
local dust = Assets.Dust.Attachment:Clone()
FX.CanCollide = false
FX.CastShadow = false
FX.Anchored = true
FX.Parent = workspace.Effects
FX.Transparency = 1
FX.CFrame = torso.CFrame * CFrame.new(0,-3,-2)
dust.Parent = RootPart
wait(0.05)
local hitcontent = workspace:GetPartBoundsInBox(FX.CFrame, Vector3.new(19.5, 22, 19.5))
local hitlist = {}
for _,v in pairs(hitcontent) do
if v.Parent:FindFirstChild("Humanoid") and v.Parent ~= Character then
if not hitlist[v.Parent.Humanoid] then
hitlist[v.Parent.Humanoid] = true
local HitCounterRemote = RS.Events.Remotes.HitCounter
HitCounterRemote:FireClient(p)
script.Parent.Parent.Parent.Part1.Part2.Motor6D.Part1 = nil
RootPart.Anchored = false
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
Humanoid.AutoRotate = true
v.Parent.Humanoid:TakeDamage(25)
local vel = Instance.new("BodyVelocity", v.Parent.Torso)
vel.MaxForce = Vector3.new(1,1,1) * 1000000;
vel.Parent = v.Parent.Torso
vel.Velocity = Vector3.new(1,1,1) * p.Character:WaitForChild("HumanoidRootPart").CFrame.RightVector * 70
vel.Name = "SmallMoveVel"
game.Debris:AddItem(vel,.2)
RagodllModule.RagDoll(v.Parent,1)
local HitFX = Assets.Headbutt.Attachment:Clone()
local Head = v.Parent.Head
HitFX.Parent = Head
HitFX.Hit2:Play()
for _,Particles in pairs(HitFX:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
for _,Particles in pairs(dust:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX,3)
local HitFX2 = Assets.HitFXbd.Attach2:Clone()
HitFX2.Parent = v.Parent.Torso
for _,Particles in pairs(HitFX2:GetDescendants()) do
if Particles:IsA("ParticleEmitter") then
Particles:Emit(Particles:GetAttribute("EmitCount"))
end
end
game.Debris:AddItem(HitFX2,3)
wait(0.01)
end
end
end
end
end
end
RootPart.Anchored = false
Humanoid.WalkSpeed = 16
Humanoid.JumpPower = 50
Humanoid.AutoRotate = true
wait(2)
FX:Destroy()
dust:Destroy()
end)
|
--Made by Stickmasterluke |
sp=script.Parent
assetId=67629734
function findcurrentzombie()
for i,v in ipairs(game.Workspace:GetChildren()) do
if v and v.Parent then
if v:FindFirstChild("LinkedSpawn") then
if v.LinkedSpawn.Value==sp then
zombie=v
end
end
end
end
end
findcurrentzombie()
function spawn()
zombie=game:GetService("InsertService"):LoadAsset(assetId):GetChildren()[1]--game.Lighting.Zombie:clone()
zombie.LinkedSpawn.Value=sp
zombie.Parent=game.Workspace
zombie:MoveTo(sp.ZombieSpawn.Position+Vector3.new(0,3.5,0))
end
while true do
wait(.25)
if zombie and zombie~=nil and zombie.Parent and zombie:FindFirstChild("LinkedSpawn") and zombie.LinkedSpawn.Value==sp then
else
wait(sp.Configuration["Respawn Time"].Value)
spawn()
end
end
|
--[[
Middleware for triggering events on action dispatch
Each key in the `events` object should be the type of an action. For
example:
local fooAction = { type = "foo" }
local events = {
[fooAction.type] = Instance.new("BindableEvent")
}
local store = Rodux.Store.new(reducer, nil, {
actionsAsEvents(events)
})
store:dispatch(fooAction)
If you use Rodux.makeActionCreator() then you can optionally use the `name`
field instead:
local fooAction = Rodux.makeActionCreator("foo", function()
return {}
end)
local events = {
[fooAction.name] = Instance.new("BindableEvent")
}
local store = Rodux.Store.new(reducer, nil, {
actionsAsEvents(events)
})
store:dispatch(fooAction())
]] |
export type Action = {
type: string,
eventArguments: { any }?,
}
export type Event = BindableEvent | {
Fire: (...any) -> (),
}
local function actionsAsEvents(events: { [string]: Event })
local function middleware(nextDispatch: (Action) -> ())
return function(action: Action)
local event = events[action.type]
if event then
if action.eventArguments then
-- FIXME Luau: Need to cast `event` to `any` to clear
-- "Cannot call non-function" error
(event :: any):Fire(table.unpack(action.eventArguments))
else
-- FIXME Luau: Need to cast `event` to `any` to clear
-- "Cannot call non-function" error
(event :: any):Fire()
end
end
return nextDispatch(action)
end
end
return middleware
end
return actionsAsEvents
|
--// Setup \\-- |
PartSetup(center,"Center")
PartSetup(left,"Left")
PartSetup(right,"Right")
WeldSetup(centerWeld,center,CFrame.new(0,1.5,-5))
WeldSetup(leftWeld,left,CFrame.new(0,1.5,-5)*CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0))
WeldSetup(rightWeld,right,CFrame.new(0,1.5,-5)*CFrame.fromEulerAnglesXYZ(0, math.rad(45), 0))
|
--[[
Hey, this script is all set up!
If you want you can modify it, if you know what your doing.
Contact me if you have any questions.
--qreet
UPDATE LOG
May 29|2018
--Added smoother loading
--Click noise
--]] |
script:WaitForChild("Intro"):Clone().Parent = game.StarterGui
script:Destroy()
|
--[[
* Determine the common prefix of two strings.
* @param {string} text1 First string.
* @param {string} text2 Second string.
* @return {number} The number of characters common to the start of each
* string.
--]] |
local function _diff_commonPrefix(text1: string, text2: string): number
-- Quick check for common null cases.
if #text1 == 0 or #text2 == 0 or strbyte(text1, 1, 1) ~= strbyte(text2, 1, 1) then
return 0
end
-- Binary search.
-- Performance analysis: https://neil.fraser.name/news/2007/10/09/
local pointermin = 1
local pointermax = min(#text1, #text2)
local pointermid = pointermax
local pointerstart = 1
while pointermin < pointermid do
if strsub(text1, pointerstart, pointermid) == strsub(text2, pointerstart, pointermid) then
pointermin = pointermid
pointerstart = pointermin
else
pointermax = pointermid
end
pointermid = floor(pointermin + (pointermax - pointermin) / 2)
end
return pointermid
end
|
-- debug.profilebegin("COLOR3_LERP_FUNCTION") |
local L = (1 - DeltaTime) * L0 + DeltaTime * L1
if L < 0.0197955 then |
--Please keep my name in there. ;) |
bannedlist = { "someoneyouhate","Someoneyouhate","someoneyouhate","someoneyouhate","someoneyouhate"}--Put a persones name here to ban them from your game! --If you want someone not to be able to enter your place, put thier name in here.
texture = ""--If you want someone wearing a certain t-shirt to be an admin, put the t-shirt's texture in here.
|
-- / Modules / -- |
local VictoryMessagesModule = require(script.VictoryMessagesModule)
local DeathMessagesModule = require(script.DeathMessagesModule)
|
--[[
rbxassetid://757425958 --midnight
rbxassetid://759830238 --early hours
rbxassetid://759820270 --morning
rbxassetid://759829474 --afternoon
rbxassetid://759821278 --evening
ai.Image =
bi.Image =
ci.Image =
di.Image =
ei.Image =
--]] |
local g = game.Lighting:GetMinutesAfterMidnight()/60
if (g >= 22 and g <= 0) or (g <= 0 and g < 2) then
--print("aaaaa")
ai.Image = a
bi.Image = a
ci.Image = a
di.Image = a
ei.Image = a
selected = "A"
elseif (g >= 2 and g < 6) then
--print("b")
ai.Image = b
bi.Image = b
ci.Image = b
di.Image = b
ei.Image = b
selected = "B"
elseif (g >= 6 and g < 11) then
--print("c")
ai.Image = c
bi.Image = c
ci.Image = c
di.Image = c
ei.Image = c
selected = "C"
elseif (g >= 11 and g < 17) then
--print("ddddd")
ai.Image = d
bi.Image = d
ci.Image = d
di.Image = d
ei.Image = d
selected = "D"
else
--print("e")
ai.Image = e
bi.Image = e
ci.Image = e
di.Image = e
ei.Image = e
selected = "E"
end
script.Parent.SplashFade.Disabled = false
if selected == "A" then
script.Parent.SplashLoopA.Disabled = false
elseif selected == "B" then
script.Parent.SplashLoopB.Disabled = false
elseif selected == "C" then
script.Parent.SplashLoopC.Disabled = false
elseif selected == "D" then
script.Parent.SplashLoopD.Disabled = false
else
script.Parent.SplashLoopE.Disabled = false
end
|
--[[
Main application logic, where the main business logic for server-client replication lives.
]] |
function App:init()
self.state = {
-- Maps a canvas ID to its spots UUID
--
-- Schema:
-- {
-- [canvasId] = {
-- spots = { <Spot UUID>, ... },
-- },
-- ...
-- }
canvases = {},
-- Maps spot UUID to its art metadata
--
-- Schema:
-- {
-- [spotId] = {
-- artId = "<art ID (NOT ASSET ID)>",
-- ownerUserId = "<UserId of player who placed this art>",
-- },
-- ...
-- }
spots = {},
-- Active spot index that the player is assigned to place the art in
activeSpotId = nil,
-- Canvas ID that we are showing proximity prompt for
activeCanvasId = nil,
-- Error message shown to user as a modal when something goes wrong
errorMessage = nil,
-- Flag to mark if a canvas has the initial spots information loaded
isLoaded = {},
}
-- Map between spot UUID and its corresponding ref for usage by CameraModule to animate
self.spotRefs = {}
-- Keep track of the SurfaceGui for each canvas for CameraModule to animate
self.canvasRefs = {}
-- Keeps track of selector GUI
self.selectorRef = Roact.createRef()
-- Keeps track of error message GUI
self.errorMessageRef = Roact.createRef()
-- Controls camera movement
self.cameraModule = CameraModule.new(workspace.CurrentCamera)
-- Controls user's input
self.userInputController = UserInputController.new()
-- Controls user's active GUI
self.guiController = GuiController.new({ self.selectorRef, self.errorMessageRef })
-- Controls user's (and potentially other Player's) Humanoid
-- Maps between UserId and their HumanoidController.
self.humanoidControllers = {}
for _, player in pairs(Players:GetPlayers()) do
self.humanoidControllers[player.UserId] = HumanoidController.new(player)
end
-- Set to true when we are transitioning between camera scenes
self.isAnimating = false
self.getTagged = modules.getTagged(self)
self.fetchArt = modules.fetchArt(self)
self.fetchAllArt = modules.fetchAllArt(self)
self.applyArt = modules.applyArt(self)
self.getRandomSpot = modules.getRandomSpot(self)
self.clearErrorMessage = modules.clearErrorMessage(self)
self.hideHumanoids = modules.hideHumanoids(self)
self.showHumanoids = modules.showHumanoids(self)
self.waitForHumanoidAnimations = modules.waitForHumanoidAnimations(self)
self.getModelFace = modules.getModelFace()
self.cleanup = modules.cleanup(self)
self.onSpotChanged = modules.onSpotChanged(self, events)
self.onPromptShown = modules.onPromptShown(self)
self.onPromptHidden = modules.onPromptHidden(self)
self.onCancel = modules.onCancel(self)
self.onPlayerAdded = function(player)
self.humanoidControllers[player.UserId] = HumanoidController.new(player)
end
self.onPlayerRemoving = function(player)
self.humanoidControllers[player.UserId] = nil
end
end
function App:render()
-- Render nothing if we turn off the dev module
if not self.props.configuration.enabled then
return nil
end
local surfaceGuis = self:_renderSurfaceGuis()
local proximityPrompts = self:_renderProximityPrompts()
local selector = self:_renderSelector()
local canvasAttributeListeners = self:_canvasAttributeListeners()
return Roact.createFragment(
Cryo.Dictionary.join(selector, surfaceGuis, proximityPrompts, canvasAttributeListeners, {
ErrorMessage = self.state.errorMessage and Roact.createElement("ScreenGui", {
IgnoreGuiInset = true,
ResetOnSpawn = false,
[Roact.Ref] = self.errorMessageRef,
}, {
Roact.createElement(ErrorMessage, {
errorCode = self.state.errorMessage,
onActivated = self.clearErrorMessage,
}),
}),
FetchAllEvent = Roact.createElement(ExternalEventConnection, {
event = self.props.SpotChanged.OnClientEvent,
callback = self.onSpotChanged,
}),
InitializeHumanoidController = Roact.createElement(ExternalEventConnection, {
event = Players.PlayerAdded,
callback = self.onPlayerAdded,
}),
CleanupHumanoidController = Roact.createElement(ExternalEventConnection, {
event = Players.PlayerRemoving,
callback = self.onPlayerRemoving,
}),
})
)
end
function App:didMount()
self.fetchAllArt()
end
function App:didUpdate(_, prevState)
if prevState.activeSpotId ~= self.state.activeSpotId then
if self.state.activeSpotId ~= nil then
events.selectorShown:Fire()
else
events.selectorHidden:Fire()
end
end
end
function App:_renderSurfaceGuis()
-- Surface GUIs for all canvases
local surfaceGuis = {}
for _, model in ipairs(self.getTagged()) do
local canvasId = model:GetAttribute(constants.Attributes.SurfaceCanvasId)
if not canvasId then
warn("[SurfaceArt] CanvasID does not exist for model")
continue
end
-- Future improvement support for dynamic loading of canvases possible by using a table instead of a single flag
-- e.g. only load artwork on canvas when users are within a threshold distance
if not self.state.isLoaded[canvasId] then
continue
end
if not self.canvasRefs[canvasId] then
self.canvasRefs[canvasId] = Roact.createRef()
end
local spots = self:_renderSpots(model)
local surfaceGui = Roact.createElement("SurfaceGui", {
Adornee = model,
SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud,
PixelsPerStud = 50,
Face = self.getModelFace(model),
ResetOnSpawn = false,
[Roact.Ref] = self.canvasRefs[canvasId],
}, {
SurfaceCanvas = Roact.createElement(SurfaceCanvas, {
numRows = self.props.configuration.rowsPerCanvas,
numCols = self.props.configuration.colsPerCanvas,
paddingLeft = self.props.configuration.canvasPaddingLeft,
paddingRight = self.props.configuration.canvasPaddingRight,
paddingTop = self.props.configuration.canvasPaddingTop,
paddingBottom = self.props.configuration.canvasPaddingBottom,
}, spots),
})
surfaceGuis["canvas_" .. canvasId] = surfaceGui
end
return surfaceGuis
end
function App:_renderSpots(model)
local spots = {}
local spotsPerCanvas = self.props.configuration.rowsPerCanvas * self.props.configuration.colsPerCanvas
for i = 1, spotsPerCanvas do
local spotId = model:GetAttribute(constants.Attributes.SpotIdPrefix .. i)
local spot = self.state.spots[spotId]
if not spot then
continue
end
local artId = spot.artId
-- We may have not loaded the asset ID yet
local asset = artId and self.props.configuration.assets[artId]
if not self.spotRefs[spotId] then
self.spotRefs[spotId] = Roact.createRef()
end
local surfaceSpot = Roact.createElement(SurfaceSpot, {
image = asset and asset.assetId,
[Roact.Ref] = self.spotRefs[spotId],
})
table.insert(spots, surfaceSpot)
end
return spots
end
function App:_renderProximityPrompts()
local proximityPrompts = {}
for _, model in ipairs(self.getTagged()) do
local canvasId = model:GetAttribute(constants.Attributes.SurfaceCanvasId)
if not canvasId then
warn("[SurfaceArt] CanvasID does not exist for model")
continue
end
local prompt = Roact.createFragment({
Roact.createElement(Roact.Portal, {
target = model,
}, {
ProximityPrompt = Roact.createElement("ProximityPrompt", {
Enabled = true,
KeyboardKeyCode = self.props.configuration.promptKeyCode,
RequiresLineOfSight = self.props.configuration.promptRequiresLineOfSight,
MaxActivationDistance = self.props.configuration.promptMaxActivationDistance,
Exclusivity = self.props.configuration.promptExclusivity,
Style = Enum.ProximityPromptStyle.Custom,
[Roact.Event.TriggerEnded] = function()
self.getRandomSpot(canvasId)
end,
[Roact.Event.PromptShown] = function()
self.onPromptShown(canvasId)
events.promptShown:Fire(model)
end,
[Roact.Event.PromptHidden] = function()
self.onPromptHidden()
events.promptHidden:Fire(model)
end,
}),
}),
SurfacePrompt = Roact.createElement("BillboardGui", {
Active = true,
Adornee = model,
Size = UDim2.fromOffset(60, 60),
AlwaysOnTop = true,
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
ResetOnSpawn = false,
}, {
Roact.createElement(SurfacePrompt, {
isShown = canvasId == self.state.activeCanvasId and not self.state.activeSpotId,
onClick = function()
self.getRandomSpot(canvasId)
end,
}),
}),
})
proximityPrompts["prompts_" .. canvasId] = prompt
end
return proximityPrompts
end
function App:_renderSelector()
local artIds = Cryo.Dictionary.keys(self.props.configuration.assets)
return {
Selector = self.state.activeSpotId ~= nil and Roact.createElement("ScreenGui", {
IgnoreGuiInset = true,
ResetOnSpawn = false,
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
[Roact.Ref] = self.selectorRef,
}, {
Roact.createElement(SurfaceArtSelector, {
images = Cryo.List.map(artIds, function(artId)
return self.props.configuration.assets[artId].assetId
end),
onApply = function(index)
local artId = artIds[index]
self.applyArt(artId)
end,
onCancel = self.onCancel,
}),
}),
}
end
function App:_canvasAttributeListeners()
local listeners = {}
for i, model in ipairs(self.getTagged()) do
listeners["listener_" .. i] = Roact.createElement(ExternalEventConnection, {
event = model.AttributeChanged,
callback = function(attributeName)
if attributeName == constants.Attributes.SurfaceCanvasId then
local canvasId = model:GetAttribute(constants.Attributes.SurfaceCanvasId)
self.fetchArt(canvasId)
end
end,
})
end
return listeners
end
return ConfigurationContext.withConfiguration(App)
|
-- Decompiled with the Synapse X Luau decompiler. |
local v1 = {};
local l__Chat__2 = game:GetService("Chat");
local l__ClientChatModules__3 = l__Chat__2:WaitForChild("ClientChatModules");
local l__MessageCreatorModules__4 = l__ClientChatModules__3:WaitForChild("MessageCreatorModules");
local l__Parent__5 = script.Parent;
local v6 = require(l__ClientChatModules__3:WaitForChild("ChatSettings"));
local v7 = require(l__Parent__5:WaitForChild("MessageSender"));
local v8 = {};
v8.__index = v8;
function mergeProps(p1, p2)
if not p1 then
return;
end;
local v9, v10, v11 = pairs(p1);
while true do
local v12, v13 = v9(v10, v11);
if v12 then
else
break;
end;
v11 = v12;
p2[v12] = v13;
end;
end;
function ReturnToObjectPoolRecursive(p3, p4)
local v14 = p3:GetChildren();
local v15 = #v14;
local v16 = 1 - 1;
while true do
ReturnToObjectPoolRecursive(v14[v16], p4);
if 0 <= 1 then
if v16 < v15 then
else
break;
end;
elseif v15 < v16 then
else
break;
end;
v16 = v16 + 1;
end;
p3.Parent = nil;
p4:ReturnInstance(p3);
end;
local u1 = require(l__MessageCreatorModules__4:WaitForChild("Util"));
function GetMessageCreators()
local v17 = {};
local v18 = l__MessageCreatorModules__4:GetChildren();
local v19 = #v18;
local v20 = 1 - 1;
while true do
if v18[v20]:IsA("ModuleScript") then
if v18[v20].Name ~= "Util" then
local v21 = require(v18[v20]);
v17[v21[u1.KEY_MESSAGE_TYPE]] = v21[u1.KEY_CREATOR_FUNCTION];
end;
end;
if 0 <= 1 then
if v20 < v19 then
else
break;
end;
elseif v19 < v20 then
else
break;
end;
v20 = v20 + 1;
end;
return v17;
end;
function v8.WrapIntoMessageObject(p5, p6, p7)
local v22 = nil;
if u1.KEY_BASE_MESSAGE then
v22 = p7[u1.KEY_BASE_MESSAGE];
end;
return {
ID = p6.ID,
BaseFrame = p7[u1.KEY_BASE_FRAME],
BaseMessage = v22,
UpdateTextFunction = p7[u1.KEY_UPDATE_TEXT_FUNC] or function()
warn("NO MESSAGE RESIZE FUNCTION");
end,
GetHeightFunction = p7[u1.KEY_GET_HEIGHT],
FadeInFunction = p7[u1.KEY_FADE_IN],
FadeOutFunction = p7[u1.KEY_FADE_OUT],
UpdateAnimFunction = p7[u1.KEY_UPDATE_ANIMATION],
ObjectPool = p5.ObjectPool,
Destroyed = false,
Destroy = function(p8)
ReturnToObjectPoolRecursive(p8.BaseFrame, p8.ObjectPool);
p8.Destroyed = true;
end
};
end;
function v8.CreateMessageLabel(p9, p10, p11)
local v23 = nil;
p10.Channel = p11;
local u2 = nil;
pcall(function()
u2 = l__Chat__2:InvokeChatCallback(Enum.ChatCallbackType.OnClientFormattingMessage, p10);
end);
p10.ExtraData = p10.ExtraData or {};
mergeProps(u2, p10.ExtraData);
local l__MessageType__24 = p10.MessageType;
if p9.MessageCreators[l__MessageType__24] then
local v25 = p9.MessageCreators[l__MessageType__24](p10, p11);
if v25 then
return p9:WrapIntoMessageObject(p10, v25);
else
return;
end;
elseif p9.DefaultCreatorType then
v23 = p9.MessageCreators[p9.DefaultCreatorType](p10, p11);
if not v23 then
return;
end;
else
error("No message creator available for message type: " .. l__MessageType__24);
return;
end;
return p9:WrapIntoMessageObject(p10, v23);
end;
local u3 = require(l__Parent__5:WaitForChild("ObjectPool"));
function v1.new()
local v26 = setmetatable({}, v8);
v26.ObjectPool = u3.new(50);
v26.MessageCreators = GetMessageCreators();
v26.DefaultCreatorType = u1.DEFAULT_MESSAGE_CREATOR;
u1:RegisterObjectPool(v26.ObjectPool);
return v26;
end;
function v1.GetStringTextBounds(p12, p13, p14, p15, p16)
return u1:GetStringTextBounds(p13, p14, p15, p16);
end;
return v1;
|
--// Return values: bool filterSuccess, bool resultIsFilterObject, variant result |
function methods:InternalApplyRobloxFilterNewAPI(speakerName, message, textFilterContext) --// USES FFLAG
local alwaysRunFilter = false
local runFilter = false
if (alwaysRunFilter or runFilter) then
local fromSpeaker = self:GetSpeaker(speakerName)
if fromSpeaker == nil then
return false, nil, nil
end
local fromPlayerObj = fromSpeaker:GetPlayer()
if fromPlayerObj == nil then
return true, false, message
end
if allSpaces(message) then
return true, false, message
end
local success, filterResult = pcall(function()
local ts = game:GetService("TextService")
local result = ts:FilterStringAsync(message, fromPlayerObj.UserId, textFilterContext)
return result
end)
if (success) then
return true, true, filterResult
else
warn("Error filtering message:", message, filterResult)
self:InternalNotifyFilterIssue()
return false, nil, nil
end
end
--// Simulate filtering latency.
wait()
return true, false, message
end
function methods:InternalDoMessageFilter(speakerName, messageObj, channel)
local filtersIterator = self.FilterMessageFunctions:GetIterator()
for funcId, func, priority in filtersIterator do
local success, errorMessage = pcall(function()
func(speakerName, messageObj, channel)
end)
if not success then
warn(string.format("DoMessageFilter Function '%s' failed for reason: %s", funcId, errorMessage))
end
end
end
function methods:InternalDoProcessCommands(speakerName, message, channel)
local commandsIterator = self.ProcessCommandsFunctions:GetIterator()
for funcId, func, priority in commandsIterator do
local success, returnValue = pcall(function()
local ret = func(speakerName, message, channel)
if type(ret) ~= "boolean" then
error("Process command functions must return a bool")
end
return ret
end)
if not success then
warn(string.format("DoProcessCommands Function '%s' failed for reason: %s", funcId, returnValue))
elseif returnValue then
return true
end
end
return false
end
function methods:InternalGetUniqueMessageId()
local id = self.MessageIdCounter
self.MessageIdCounter = id + 1
return id
end
function methods:InternalAddSpeakerWithPlayerObject(speakerName, playerObj, fireSpeakerAdded)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
speaker:InternalAssignPlayerObject(playerObj)
self.Speakers[speakerName:lower()] = speaker
if fireSpeakerAdded then
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
end
return speaker
end
function methods:InternalFireSpeakerAdded(speakerName)
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error firing speaker added: " ..err)
end
end
|
-- Streamable
-- Stephen Leitnick
-- November 08, 2021 |
return {
Streamable = require(script.Streamable);
StreamableUtil = require(script.StreamableUtil);
}
|
-- Really blue: [0,75,255] (Default)
-- Lime green: [23,255,90]
-- Institutional white: [255,255,255]
-- Tr. Flu. Yellow: [255,241,87]
-- Electric blue: [0,110,255]
-- Eggplant: [110,0,160]
-- Really red: [255,0,0] | |
-- RCM Settings V |
self.WeaponWeight = 4 -- Weapon weight must be enabled in the Config module
self.ShellEjectionMod = true
self.Holster = true
self.HolsterPoint = "Torso"
self.HolsterCFrame = CFrame.new(0.65,0.1,-0.8) * CFrame.Angles(math.rad(-90),math.rad(15),math.rad(75))
self.FlashChance = 0 -- 0 = no muzzle flash, 10 = Always muzzle flash
self.ADSEnabled = { -- Ignore this setting if not using an ADS Mesh
true, -- Enabled for primary sight
false} -- Enabled for secondary sight (T)
self.ExplosiveAmmo = false -- Enables explosive ammo
self.ExplosionRadius = 70 -- Radius of explosion damage in studs
self.ExplosionType = "Default" -- Which explosion effect is used from the HITFX Explosion folder
self.IsLauncher = true -- For RPG style rocket launchers
self.EjectionOverride = nil -- Don't touch unless you know what you're doing with Vector3s
return self
|
--[[
Manages batch updating of spring objects.
]] |
local RunService = game:GetService("RunService")
local updateAll = require(script.Parent.Parent.Parent.Dependencies).updateAll
local packType = require(script.Parent.packType)
local springCoefficients = require(script.springCoefficients)
type Set<T> = {[T]: any}
local SpringScheduler = {}
local EPSILON = 0.0001
local activeSprings = {}
local lastUpdateTime = os.clock()
function SpringScheduler.add(spring: any)
-- we don't necessarily want to use the most accurate time - here we snap to
-- the last update time so that springs started within the same frame have
-- identical time steps
spring._lastSchedule = lastUpdateTime
spring._startDisplacements = {}
spring._startVelocities = {}
for index, goal in ipairs(spring._springGoals) do
spring._startDisplacements[index] = spring._springPositions[index] - goal
spring._startVelocities[index] = spring._springVelocities[index]
end
activeSprings[spring] = true
end
function SpringScheduler.remove(spring)
activeSprings[spring] = nil
end
local function updateAllSprings()
local springsToSleep = {}
lastUpdateTime = os.clock()
for spring in activeSprings do
local posPos, posVel, velPos, velVel = springCoefficients(lastUpdateTime - spring._lastSchedule, spring._currentDamping, spring._currentSpeed)
local positions = spring._springPositions
local velocities = spring._springVelocities
local startDisplacements = spring._startDisplacements
local startVelocities = spring._startVelocities
local isMoving = false
for index, goal in ipairs(spring._springGoals) do
local oldDisplacement = startDisplacements[index]
local oldVelocity = startVelocities[index]
local newDisplacement = oldDisplacement * posPos + oldVelocity * posVel
local newVelocity = oldDisplacement * velPos + oldVelocity * velVel
if math.abs(newDisplacement) > EPSILON or math.abs(newVelocity) > EPSILON then
isMoving = true
end
positions[index] = newDisplacement + goal
velocities[index] = newVelocity
end
if not isMoving then
springsToSleep[spring] = true
end
end
for spring in pairs(activeSprings) do
spring._currentValue = packType(spring._springPositions, spring._currentType)
updateAll(spring)
end
for spring in pairs(springsToSleep) do
activeSprings[spring] = nil
end
end
RunService:BindToRenderStep(
"__FusionSpringScheduler",
Enum.RenderPriority.First.Value,
updateAllSprings
)
return SpringScheduler
|
--Left Leg |
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.Y,car.DriveSeat,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.Z,car.Misc.Anims.R15.LeftLeg.Foot.Y,"Motor6D").Name="M"
MakeWeld(car.Misc.Anims.R15.LeftLeg.Foot.X,car.Misc.Anims.R15.LeftLeg.Foot.Z,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.Foot.Parts,car.Misc.Anims.R15.LeftLeg.Foot.X)
MakeWeld(car.Misc.Anims.R15.LeftLeg.LowerLeg.X,car.Misc.Anims.R15.LeftLeg.Foot.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.LowerLeg.Parts,car.Misc.Anims.R15.LeftLeg.LowerLeg.X)
MakeWeld(car.Misc.Anims.R15.LeftLeg.UpperLeg.X,car.Misc.Anims.R15.LeftLeg.LowerLeg.X,"Motor6D").Name="M"
ModelWeld(car.Misc.Anims.R15.LeftLeg.UpperLeg.Parts,car.Misc.Anims.R15.LeftLeg.UpperLeg.X)
function animPose(seat,pose)
local C
local S=seat
local WS={}
local HW={}
local seatOffset = CFrame.new(0,0,0)
S.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") then
for i,v in pairs(WS) do
if v~=0 then
if v[4]~=nil then
v[4]:Destroy()
v[1].Part1=v[5]
else
if v[2]~=nil then
v[1].C0=v[2] v[1].C1=v[3]
else
v[1]:Destroy()
end
end
end
end
for i,v in pairs(HW) do
v[1]:Destroy()
v[2]:Destroy()
v[3].Transparency=0
end
C=nil
WS = {}
HW = {}
end
end)
S.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
C = child.Part1.Parent
S.SeatWeld.C0 = seatOffset
S.SeatWeld.C1 = CFrame.new()
local pkTor = false
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.Torso then
pkTor=true
break
end
end
local function MW(x,y)
local WW=Instance.new("Weld",x) WW.Part0=x WW.Part1=y return WW
end
if C:FindFirstChild("HumanoidRootPart")~=nil and C:FindFirstChild("Torso")~=nil then
S.SeatWeld.C0=seatOffset
S.SeatWeld.C1=CFrame.new()
C.HumanoidRootPart.RootJoint.Part1=nil
table.insert(WS,{C.HumanoidRootPart.RootJoint,C.HumanoidRootPart.RootJoint.C0,C.HumanoidRootPart.RootJoint.C1,MW(C.HumanoidRootPart,C.Torso),C.Torso})
if C.Torso:FindFirstChild("Neck")~=nil then
local H=C.Head:Clone()
H.Name="Part"
H.Parent=C
local WH=MW(C.Torso,H)
WH.C0=C.Torso.Neck.C0
WH.C1=C.Torso.Neck.C0
C.Head.Transparency=1
table.insert(HW,{H,WH,C.Head})
table.insert(WS,{WH,nil,nil,nil,nil})
for i,v in pairs(C.Head:GetChildren()) do
if v:IsA("Weld") then
local pp=v.Part1:Clone()
pp.Parent=C
v.Part1.Transparency=1
local ww=MW(H,pp)
ww.C0=v.C0
ww.C1=v.C1
table.insert(HW,{pp,ww,v.Part1})
end
end
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Left Shoulder")~=nil then
C.Torso:FindFirstChild("Left Shoulder").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Left Shoulder"),C.Torso:FindFirstChild("Left Shoulder").C0,C.Torso:FindFirstChild("Left Shoulder").C1,MW(C.Torso,C:FindFirstChild("Left Arm")),C:FindFirstChild("Left Arm")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Right Shoulder")~=nil then
C.Torso:FindFirstChild("Right Shoulder").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Right Shoulder"),C.Torso:FindFirstChild("Right Shoulder").C0,C.Torso:FindFirstChild("Right Shoulder").C1,MW(C.Torso,C:FindFirstChild("Right Arm")),C:FindFirstChild("Right Arm")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Left Hip")~=nil then
C.Torso:FindFirstChild("Left Hip").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Left Hip"),C.Torso:FindFirstChild("Left Hip").C0,C.Torso:FindFirstChild("Left Hip").C1,MW(C.Torso,C:FindFirstChild("Left Leg")),C:FindFirstChild("Left Leg")})
else
table.insert(WS,0)
end
if C.Torso:FindFirstChild("Right Hip")~=nil then
C.Torso:FindFirstChild("Right Hip").Part1=nil
table.insert(WS,{C.Torso:FindFirstChild("Right Hip"),C.Torso:FindFirstChild("Right Hip").C0,C.Torso:FindFirstChild("Right Hip").C1,MW(C.Torso,C:FindFirstChild("Right Leg")),C:FindFirstChild("Right Leg")})
else
table.insert(WS,0)
end
end
for i,v in pairs(WS) do
local cfp = pose[i]
if i==3 then
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.LeftArm then
cfp = pose[7]
break
end
end
elseif i==4 then
for i,v in pairs(C:GetChildren()) do
if v:IsA("CharacterMesh") and v.BodyPart == Enum.BodyPart.RightArm then
cfp = pose[8]
break
end
end
end
if v[4]~=nil then
v[4].C0=cfp
v[4].C1=CFrame.new()
else
v[1].C0=cfp
v[1].C1=CFrame.new()
end
end
end
end)
end
local Passenger={
CFrame.new(0.00701141357, 1.09911013, 0.0404243469, 1, 3.80970855e-09, -4.35450502e-08, 0, 0.996194661, 0.087155968, 4.37113883e-08, -0.087155968, 0.996194661), --Torso
CFrame.new(0, 1.50000381, 0, 1, 0, 0, 0, 0.996194661, -0.087155968, 0, 0.087155968, 0.996194661), --Head
CFrame.new(-0.876424789, -0.214377403, -0.478406906, 0.819151819, -0.573576868, 7.37368282e-07, 0.519837081, 0.742402971, -0.422619611, 0.242404267, 0.346189946, 0.906307161), --Larm
CFrame.new(0.876424789, -0.214377403, -0.478406906, 0.819151819, 0.573576868, -7.37368282e-07, -0.519837081, 0.742402971, -0.422619611, -0.242404267, 0.346189946, 0.906307161), --Rarm
CFrame.new(-1.27365112, -1.25288582, -1.13527107, 0.98480773, -0.173648179, 0, 0.171010077, 0.969846308, 0.173647881, -0.0301536396, -0.171009779, 0.984807789), --Lleg
CFrame.new(1.27365112, -1.25288582, -1.13527298, 0.98480773, 0.173648179, 0, -0.171010077, 0.969846308, 0.173647881, 0.0301536396, -0.171009779, 0.984807789) --Rleg
}
animPose(car.Body.Seat,Passenger)
|
-- If you want to know how to retexture a hat, read this: http://www.roblox.com/Forum/ShowPost.aspx?PostID=10502388 |
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-1)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0,-0.05,0.22) -- Change these to change the positiones of your hat, as I said earlier.
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--[=[
@within Gamepad
@prop DefaultDeadzone number
:::info Default
Defaults to `0.05`
:::
The default deadzone used for trigger and thumbstick
analog readings. It is usually best to set this to
a small value, or allow players to set this option
themselves in an in-game settings menu.
The `GetThumbstick` and `GetTrigger` methods also allow
a deadzone value to be passed in, which overrides this
value.
]=] | |
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data |
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Base.Smasher.Obtained.Value == true and plrData.Classes.Base.Smasher.HeavyWeaponTraining.Value == false
end
|
-- Events |
local Events = ReplicatedStorage:FindFirstChild("Events")
local LoadCharacter = Events:FindFirstChild("LoadCharacter")
local LoadSpeeder = Events:FindFirstChild("LoadSpeeder") |
-- DeltaRager & rdmpted
-- 26/05/2021 |
local leaderstats = require(script.Leaderstats)
wait(2)
local function playerJoin(player)
print("Player has joined")
leaderstats:CreateStats(player)
local teamColor = player.TeamColor
local function characterAdded(character)
local humanoid = character:WaitForChild("Humanoid", 60)
humanoid.Died:Connect(function()
end)
end
characterAdded(player.Character or player.CharacterAdded:Wait())
player.CharacterAdded:Connect(characterAdded)
end
game.Players.PlayerAdded:Connect(playerJoin)
for _,player in pairs(game.Players:GetPlayers()) do
spawn(function()
playerJoin(player)
end)
end
|
--Light off |
src.Parent.Strobe.Value.Value = 0
light.Value = false
else
src.Parent.Strobe.Value.Value = 1
light.Value = true
return
end
end
end)
src.Parent.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
src:Stop()
script.Parent:Destroy()
end
end)
|
--[=[
@within TableUtil
@function DecodeJSON
@param value any
@return string
Proxy for [`HttpService:JSONDecode`](https://developer.roblox.com/en-us/api-reference/function/HttpService/JSONDecode).
]=] |
local function DecodeJSON(str: string): any
return HttpService:JSONDecode(str)
end
TableUtil.Copy = Copy
TableUtil.Sync = Sync
TableUtil.Reconcile = Reconcile
TableUtil.SwapRemove = SwapRemove
TableUtil.SwapRemoveFirstValue = SwapRemoveFirstValue
TableUtil.Map = Map
TableUtil.Filter = Filter
TableUtil.Reduce = Reduce
TableUtil.Assign = Assign
TableUtil.Extend = Extend
TableUtil.Reverse = Reverse
TableUtil.Shuffle = Shuffle
TableUtil.Sample = Sample
TableUtil.Flat = Flat
TableUtil.FlatMap = FlatMap
TableUtil.Keys = Keys
TableUtil.Values = Values
TableUtil.Find = Find
TableUtil.Every = Every
TableUtil.Some = Some
TableUtil.Truncate = Truncate
TableUtil.Zip = Zip
TableUtil.Lock = Lock
TableUtil.IsEmpty = IsEmpty
TableUtil.EncodeJSON = EncodeJSON
TableUtil.DecodeJSON = DecodeJSON
return TableUtil
|
-- загрузка текста |
while game.Workspace.LogString.Value=="" do
wait(1)
end |
-- In radians the minimum accuracy penalty |
local MinSpread = 0.1 |
--[[Steering]] |
Tune.SteerInner = 45 -- Inner wheel steering angle (in degrees)
Tune.SteerOuter = 40 -- Outer wheel steering angle (in degrees)
Tune.SteerSpeed = .05 -- Steering increment per tick (in degrees)
Tune.ReturnSpeed = .1 -- Steering increment per tick (in degrees)
Tune.SteerDecay = 320 -- Speed of gradient cutoff (in SPS)
Tune.MinSteer = 10 -- Minimum steering at max steer decay (in percent)
Tune.MSteerExp = 1 -- Mouse steering exponential degree
--Steer Gyro Tuning
Tune.SteerD = 1000 -- Steering Dampening
Tune.SteerMaxTorque = 50000 -- Steering Force
Tune.SteerP = 100000 -- Steering Aggressiveness
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.