prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Airflow = script.Parent.Parent.ChopperNB
|
ChopperNB = script.Parent.Parent.ChopperNB
MuteNB = ChopperNB.Mute
LoadWeight = script.LoadWeight
MVal = script.MuteVal
RotorMotor = script.Parent.Parent.Parent.Motor.Motor.HingeConstraint
LoadWeight.Value = LoadWeight.NoBlowerW.Value
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == false then
--Airflow.HighAir.Disabled = true
--Airflow.LowAir.Disabled = false
local ts = game:GetService("TweenService")
local t = ts:Create(script.Parent,TweenInfo.new(4),{Volume = 0})
local t3 = ts:Create(MVal,TweenInfo.new(2),{Value = 0})
local t2 = ts:Create(script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch,TweenInfo.new(1),{Value = 0.1})
local t4 = ts:Create(LoadWeight,TweenInfo.new(3),{Value = LoadWeight.NoBlowerW.Value})
--print("o1")
t:Play()
t2:Play()
t3:Play()
t4:Play()
else
--Airflow.HighAir.Disabled = false
--Airflow.LowAir.Disabled = true
local ts = game:GetService("TweenService")
local t = ts:Create(script.Parent,TweenInfo.new(.85),{Volume = 4.5})
local t3 = ts:Create(MVal,TweenInfo.new(5),{Value = -80})
local t2 = ts:Create(script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch,TweenInfo.new(2),{Value = 0})
local t4 = ts:Create(LoadWeight,TweenInfo.new(.85),{Value = LoadWeight.BlowerW.Value})
--print("o2")
t:Play()
t2:Play()
t3:Play()
t4:Play()
end
end)
function getChopperLevelPitch(pitch)
return 0
--math.clamp((pitch-0.1)/script.Parent,0,1)
end
script.Parent.PlaybackSpeed = 0
CompletelyStopped = true
script.Parent.On.Changed:Connect(function()
if CompletelyStopped == true and script.Parent.On.Value == true then
repeat game:GetService("RunService").Heartbeat:wait()
CompletelyStopped = false
script.Stopped.Value = false
RotorMotor.AngularVelocity = script.Parent.PlaybackSpeed/0.00335
ChopperNB.PlaybackSpeed = script.Parent.PlaybackSpeed --/0.6801
ChopperNB.Volume = script.Parent.PlaybackSpeed/.9
MuteNB.HighGain = MVal.Value
MuteNB.LowGain = MuteNB.HighGain
MuteNB.MidGain = MuteNB.HighGain
script.Parent.RollOffMaxDistance = script.RollOffMax.Value *script.Parent.Volume --7000
script.Parent.RollOffMinDistance = script.RollOffMin.Value *script.Parent.Volume --7000
if script.Parent.On.Value == true and script.Parent.PlaybackSpeed < script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+BlowerAddress.BeltSet.Sound.Pitch/7 then
if script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value < 1 then
if script.Parent.SoundComponents.NonAdjustable.NormalSound.Value < math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1) then
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1)
end
end
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
local pitch = script.Parent.SoundComponents.NonAdjustable.NormalSound.Value
local formula = math.clamp(math.log(pitch+0.001,0.65)/320,0.00007,0.02)--pitch+0.001,0.75)/320,0.00007,0.02
--print(script.Parent.PlaybackSpeed)
--print(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value)
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.clamp(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value + formula,0,2)
script.Parent.PlaybackSpeed = (script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval)))-1
elseif script.Parent.On.Value == false and script.Parent.PlaybackSpeed > 0 then
if script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value < 1 then
if script.Parent.SoundComponents.NonAdjustable.NormalSound.Value < math.abs(script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value-1) then
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = 0
end
end
local pitch = script.Parent.SoundComponents.NonAdjustable.NormalSound.Value
--local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.06)/300,0.0004,0.07)
local formula = math.clamp(math.log(math.abs(pitch-1)+0.0001,0.05)/LoadWeight.Value,0.0004,0.02)
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
--print(formula)
script.Parent.SoundComponents.NonAdjustable.NormalSound.Value = math.clamp(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value - formula,0,2)
--+(script.Parent.Shift.Octave*math.clamp(0,1,math.ceil(math.abs(formula))))
script.Parent.PlaybackSpeed = ((script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval))-1)*clampval)
else
local clampval = math.clamp(math.ceil(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value),0,1)
script.Parent.PlaybackSpeed = ((script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+(script.Parent.SoundComponents.NonAdjustable.NormalSound.Value+((BlowerAddress.BeltSet.Sound.Pitch/7)*clampval))-1)*clampval)
end
--[[ if script.Parent.On.Value == true then
--((math.clamp((incerment+0.001)-script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value/2,0,1) * 30))
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
else
--math.abs((((script.Parent.SoundComponents.NonAdjustable.ChopperLevelCurrent.Value-4)/20)+1
formula = (script.Parent.SoundComponents.NonAdjustable.StaticVoltage.Value*(1))/(70000*math.sqrt((script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value*((script.Parent.PlaybackSpeed+0.0001)/(script.Parent.SoundComponents.Configuration.ChopperLevel.Value-(script.Parent.PlaybackSpeed*(5-(math.abs(script.Parent.SoundComponents.Configuration.ChopperLevel.Value-4.6)))))))))
--formula = (((script.Parent.SoundComponents.NonAdjustable.StaticVoltage.Value+script.Parent.SoundComponents.NonAdjustable.ChopperLevelCurrent.Value)/(incerment+0.01))*script.Parent.SoundComponents.NonAdjustable.Horsepower.Value)/(80000*math.sqrt((script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)*(script.Parent.SoundComponents.NonAdjustable.Horsepower.Value)))
end
else
if script.Parent.PlaybackSpeed <= 0 then
else
formula = (incerment+0.001)/(((500/(incerment+0.001))+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)))
end
end
--print(formula)
--+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value)
--print((incerment+0.001)/(((500/(incerment+0.001))+math.sqrt(script.Parent.SoundComponents.NonAdjustable.LoadWeight.Value))))
if script.Parent.On.Value == true then
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value then
if script.Parent.PlaybackSpeed >= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
if script.Parent.PlaybackSpeed <= script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value then
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed - math.clamp(formula,0.000005,0.001),0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
end
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed + formula,0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
else
if script.Parent.PlaybackSpeed <= 0 then
else
script.Parent.PlaybackSpeed = math.clamp(script.Parent.PlaybackSpeed - math.clamp(formula,0.000005,0.001),0,script.Parent.SoundComponents.NonAdjustable.MaxPitch.Value+script.Parent.SoundComponents.NonAdjustable.BlowerOffsetPitch.Value)
end
end
--]]
until script.Parent.SoundComponents.NonAdjustable.NormalSound.Value <= 0
CompletelyStopped = true
RotorMotor.AngularVelocity = 0
script.Parent.PlaybackSpeed = 0
ChopperNB.PlaybackSpeed = 0
if BlowerAddress.Components.BlowerOn.Value == false then
script.Parent.Volume = 0
end
script.Stopped.Value = true
end
end)
script.Parent.BlowerOn.Changed:Connect(function()
if script.Parent.BlowerOn.Value == false and CompletelyStopped == true then
script.Parent.Volume = 0
end
end)
|
------------------------------------------------------------------------
--
-- * used only in (lparser) luaY:subexpr()
------------------------------------------------------------------------
|
function luaK:prefix(fs, op, e)
local e2 = {} -- expdesc
e2.t, e2.f = self.NO_JUMP, self.NO_JUMP
e2.k = "VKNUM"
e2.nval = 0
if op == "OPR_MINUS" then
if not self:isnumeral(e) then
self:exp2anyreg(fs, e) -- cannot operate on non-numeric constants
end
self:codearith(fs, "OP_UNM", e, e2)
elseif op == "OPR_NOT" then
self:codenot(fs, e)
elseif op == "OPR_LEN" then
self:exp2anyreg(fs, e) -- cannot operate on constants
self:codearith(fs, "OP_LEN", e, e2)
else
assert(0)
end
end
|
-- TODO: When Promise is on Wally, remove this in favor of just `script.Parent.Parent:FindFirstChild("Promise")`.
|
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerScriptService = game:GetService("ServerScriptService")
local ServerStorage = game:GetService("ServerStorage")
local LOCATIONS_TO_SEARCH = {script.Parent.Parent, ReplicatedFirst, ReplicatedStorage, ServerScriptService, ServerStorage}
local function FindFirstDescendantWithNameAndClassName(Parent: Instance, Name: string, ClassName: string)
for _, Descendant in ipairs(Parent:GetDescendants()) do
if Descendant:IsA(ClassName) and Descendant.Name == Name then
return Descendant
end
end
return nil
end
local function GetPromiseLibrary()
-- I'm not too keen on how this is done.
-- It's better than the multiple if statements (probably).
local Plugin = script:FindFirstAncestorOfClass("Plugin")
if Plugin then
local Promise = FindFirstDescendantWithNameAndClassName(Plugin, "Promise", "ModuleScript")
if Promise then
return true, require(Promise)
else
return false
end
end
local Promise
for _, Location in ipairs(LOCATIONS_TO_SEARCH) do
Promise = FindFirstDescendantWithNameAndClassName(Location, "Promise", "ModuleScript")
if Promise then
break
end
end
if Promise then
return true, require(Promise)
else
return false
end
end
return GetPromiseLibrary
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function getClassicChatEnabled()
if ChatSettings.ClassicChatEnabled ~= nil then
return ChatSettings.ClassicChatEnabled
end
return Players.ClassicChat
end
function getBubbleChatEnabled()
if ChatSettings.BubbleChatEnabled ~= nil then
return ChatSettings.BubbleChatEnabled
end
return Players.BubbleChat
end
function bubbleChatOnly()
return not getClassicChatEnabled() and getBubbleChatEnabled()
end
|
--FlasherCircuit-- (DO NOT CHANGE!)
|
Flash = script.Parent.Parent.Parent.ControlBox.FlasherCircuit
|
-- Public Virtual
-- This function ticks every frame when the state is not active
|
function BaseState:OffTick(currenTime,dt,stateTime)
end
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local MoneyModule = require(game.ReplicatedStorage.Source.SystemModules.Money)
MoneyModule.BuyOutfitFromDialogueFolder(player,dialogueFolder)
end
|
-- Define the function to open or close the window with gene-alike effect
|
local function toggleWindow()
if window.Visible then
window.Visible = false
opened.Visible = false
-- Close the window by tweening back to the button position and size
window:TweenSizeAndPosition(
UDim2.new(0, 0, 0, 0),
UDim2.new(0, aFinderButton.AbsolutePosition.X, 0, aFinderButton.AbsolutePosition.Y),
'Out',
'Quad',
0.5,
false,
function()
window.Visible = false
msgbar.Fucus.Disabled = true
end
)
end
end
|
--Repilee 4/21/19
--This script will make any player who is not sitting in the car and doors/windows not opened will muffle.
|
local body = script.CarSeat.Value
body.MP.OutsideSound.Volume = body.Parent.DriveSeat.Values.MusicVolume.Value
wait(.1)
body.MP.Sound.Volume = 0
wait(.1)
script:Destroy()
|
-- ROBLOX TODO: declared as an opaque type in flowtype: https://github.com/facebook/flow/blob/422821fd42c09c3ef609c60516fe754b601ea205/lib/react.js#L182
|
export type React_Portal = any
export type React_Key = string | number
return {}
|
--game.ReplicatedStorage.PlayerModule:FireServer(desc)
| |
--------RIGHT DOOR 1--------
|
game.Workspace.doorright.l71.BrickColor = BrickColor.new(135)
game.Workspace.doorright.l11.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l12.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l13.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l41.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l42.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l72.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l21.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l23.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l51.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l53.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l32.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l33.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l62.BrickColor = BrickColor.new(102)
game.Workspace.doorright.l63.BrickColor = BrickColor.new(102)
game.Workspace.doorright.pillar.BrickColor = BrickColor.new(102)
|
--// F key, HornOn
|
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Airhorn:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
end
end)
|
-- Obtenemos el servicio Players
|
local Players = game:GetService("Players")
|
--[[
Creates a new promise that receives the result of this promise.
The given callbacks are invoked depending on that result.
]]
|
function Promise.prototype:_andThen(traceback, successHandler, failureHandler)
self._unhandledRejection = false
-- Create a new promise to follow this part of the chain
return Promise._new(traceback, 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(
traceback,
successHandler,
resolve,
reject
)
end
local failureCallback = reject
if failureHandler then
failureCallback = createAdvancer(
traceback,
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._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Rejected then
-- This promise died a terrible death! Trigger failure immediately.
failureCallback(unpack(self._values, 1, self._valuesLength))
elseif self._status == Promise.Status.Cancelled then
-- We don't want to call the success handler or the failure handler,
-- we just reject this promise outright.
reject(Error.new({
error = "Promise is cancelled",
kind = Error.Kind.AlreadyCancelled,
context = "Promise created at\n\n" .. traceback,
}))
end
end, self)
end
|
-- Tweens volume for more dynamic shut off
|
local function TweenVolume(FromVolume,ToVolume,Duration,ShouldStopAfterTween)
local CurrentSession = math.random(0,9999999)
IsTweeningVolumeSession = CurrentSession
for i=0,1,1/(Duration/0.03) do
if IsTweeningVolumeSession ~= CurrentSession then
return CurrentSession
end
local NewVol = FromVolume * (1-i) + ToVolume * i
WaterLoop.Volume = NewVol
wait()
end
WaterLoop.Volume = ToVolume
if ShouldStopAfterTween then
WaterLoop:Stop()
end
end
|
--[[
Promise.new, except pcall on a new thread is automatic.
]]
|
function Promise.defer(callback)
local traceback = debug.traceback(nil, 2)
local promise
promise = Promise._new(traceback, function(resolve, reject, onCancel)
local connection
connection = Promise._timeEvent:Connect(function()
connection:Disconnect()
local ok, _, result = runExecutor(traceback, callback, resolve, reject, onCancel)
if not ok then
reject(result[1])
end
end)
end)
return promise
end
|
--health.Changed:connect(function()
--root.Velocity = Vector3.new(0,5000,0)
--end)
|
local anims = {}
local lastAttack= tick()
local target,targetType
local lastLock = tick()
local fleshDamage = 100
local structureDamage = 250
local path = nil
for _,animObject in next,animations do
anims[animObject.Name] = hum:LoadAnimation(animObject)
end
function Attack(thing,dmg)
if tick()-lastAttack > 2 then
hum:MoveTo(root.Position)
lastAttack = tick()
anims.AntWalk:Stop()
anims.AntMelee:Play()
if thing.ClassName == "Player" then
root.FleshHit:Play()
ant:SetPrimaryPartCFrame(CFrame.new(root.Position,Vector3.new(target.Character.PrimaryPart.Position.X,root.Position.Y,target.Character.PrimaryPart.Position.Z)))
elseif thing.ClassName == "Model" then
root.StructureHit:Play()
end
rep.Events.NPCAttack:Fire(thing,dmg)
end
end
function Move(point)
hum:MoveTo(point)
if not anims.AntWalk.IsPlaying then
anims.AntWalk:Play()
end
end
function ScanForPoint()
local newPoint
local rayDir = Vector3.new(math.random(-100,100)/100,0,math.random(-100,100)/100)
local ray = Ray.new(root.Position,rayDir*math.random(10,50),ant)
local part,pos = workspace:FindPartOnRay(ray)
Move(pos)
enRoute = true
end
|
--[[**
Encodes a string in Base64.
@param [t:string] Input The input string to encode.
@returns [t:string] The string encoded in Base64.
**--]]
|
function Base64.Encode(Input)
local Output = {}
local Length = 0
for Index = 1, #Input, 3 do
local C1, C2, C3 = string.byte(Input, Index, Index + 2)
local A = bit32_rshift(C1, 2)
local B = bit32_lshift(bit32_band(C1, 3), 4) + bit32_rshift(C2 or 0, 4)
local C = bit32_lshift(bit32_band(C2 or 0, 15), 2) + bit32_rshift(C3 or 0, 6)
local D = bit32_band(C3 or 0, 63)
Length = Length + 1
Output[Length] = Alphabet[A + 1]
Length = Length + 1
Output[Length] = Alphabet[B + 1]
Length = Length + 1
Output[Length] = C2 and Alphabet[C + 1] or 61
Length = Length + 1
Output[Length] = C3 and Alphabet[D + 1] or 61
end
local NewOutput = {}
local NewLength = 0
local IndexAdd4096Sub1
for Index = 1, Length, 4096 do
NewLength = NewLength + 1
IndexAdd4096Sub1 = Index + 4096 - 1
NewOutput[NewLength] = string.char(table.unpack(
Output,
Index,
IndexAdd4096Sub1 > Length and Length or IndexAdd4096Sub1
))
end
return table.concat(NewOutput)
end
|
--[[Muffins variables]]
|
local CurrKickdown = 0
local LaunchBuild = _Tune.IdleRPM
local Rev = script.Parent.Values.RPM
script.Parent.DriveMode.Changed:Connect(function()
if script.Parent.DriveMode.Value == "SportPlus" then
if _Tune.TCSEnabled and _IsOn then
_TCS = false
end
else
if _Tune.TCSEnabled and _IsOn then
_TCS = true
end
end
end)
|
----- Water particle handler -----
|
function waterOutput()
if script.Parent.ColdOn.Value == false and script.Parent.HotOn.Value == false then
showerHead.Enabled = false
showerSound:Stop()
else
showerHead.Enabled = true
showerSound:Play()
end
end
script.Parent.ColdOn.Changed:connect(function()
waterOutput()
end)
script.Parent.HotOn.Changed:connect(function()
waterOutput()
end)
|
-- attempt at welding
|
script.Parent.Equipped:connect(function()
local weld1 = Instance.new("WeldConstraint")
weld1.Parent = script.Parent.Parent:FindFirstChild("RightLowerArm")
weld1.Part0 = script.Parent.Right.BandR
script.Parent.Right.BandR.CFrame = script.Parent.Parent:FindFirstChild("RightLowerArm").CFrame * CFrame.Angles(math.rad(-90),math.rad(0) ,0)
weld1.Part1 = script.Parent.Parent:FindFirstChild("RightLowerArm")
wait(.15)
script:Destroy()
end)
|
--["Walk"] = "rbxassetid://507777826",
|
["Walk"] = "http://www.roblox.com/asset/?id=180435792",
["Idle"] = "http://www.roblox.com/asset/?id=180435792",
["SwingTool"] = "http://www.roblox.com/asset/?id=180435792"
}
local anims = {}
for animName,animId in next,preAnims do
local anim = Instance.new("Animation")
anim.AnimationId = animId
game:GetService("ContentProvider"):PreloadAsync({anim})
anims[animName] = animController:LoadAnimation(anim)
end
if not anims["Walk"].IsPlaying then
anims["Walk"]:Play()
end
|
-- Get a reference to the existing TextLabel
|
local textLabel = script.Parent
|
-- Join or leave a special feature such as a Dropdown or Menu
|
function Icon:join(parentIcon, featureName, dontUpdate)
if self._parentIcon then
self:leave()
end
local newFeatureName = (featureName and featureName:lower()) or "dropdown"
local beforeName = "before"..featureName:sub(1,1):upper()..featureName:sub(2)
local parentFrame = parentIcon.instances[featureName.."Frame"]
self.presentOnTopbar = false
self.joinedFeatureName = featureName
self._parentIcon = parentIcon
self.instances.iconContainer.Parent = parentFrame
for noticeId, noticeDetail in pairs(self.notices) do
parentIcon:notify(noticeDetail.clearNoticeEvent, noticeId)
--parentIcon:notify(noticeDetail.completeSignal, noticeId)
end
if featureName == "dropdown" then
local squareCorners = parentIcon:get("dropdownSquareCorners")
self:set("iconSize", UDim2.new(1, 0, 0, self:get("iconSize", "deselected").Y.Offset), "deselected", beforeName)
self:set("iconSize", UDim2.new(1, 0, 0, self:get("iconSize", "selected").Y.Offset), "selected", beforeName)
if squareCorners then
self:set("iconCornerRadius", UDim.new(0, 0), "deselected", beforeName)
self:set("iconCornerRadius", UDim.new(0, 0), "selected", beforeName)
end
self:set("captionBlockerTransparency", 0.4, nil, beforeName)
end
local array = parentIcon[newFeatureName.."Icons"]
table.insert(array, self)
if not dontUpdate then
if featureName == "dropdown" then
parentIcon:_updateDropdown()
elseif featureName == "menu" then
parentIcon:_updateMenu()
end
end
parentIcon.deselectWhenOtherIconSelected = false
--
IconController:_updateSelectionGroup()
self:_decideToCallSignal("dropdown")
self:_decideToCallSignal("menu")
--
return self
end
function Icon:leave()
if self._destroyed or self.instances.iconContainer.Parent == nil then
return
end
local settingsToReset = {"iconSize", "captionBlockerTransparency", "iconCornerRadius"}
local parentIcon = self._parentIcon
self.instances.iconContainer.Parent = topbarContainer
self.presentOnTopbar = true
self.joinedFeatureName = nil
local function scanFeature(t, prevReference, updateMethod)
for i, otherIcon in pairs(t) do
if otherIcon == self then
for _, settingName in pairs(settingsToReset) do
local states = {"deselected", "selected"}
for _, toggleState in pairs(states) do
local currentSetting, previousSetting = self:get(settingName, toggleState, prevReference)
if previousSetting then
self:set(settingName, previousSetting, toggleState)
end
end
end
table.remove(t, i)
updateMethod(parentIcon)
if #t == 0 then
self._parentIcon.deselectWhenOtherIconSelected = true
end
break
end
end
end
scanFeature(parentIcon.dropdownIcons, "beforeDropdown", parentIcon._updateDropdown)
scanFeature(parentIcon.menuIcons, "beforeMenu", parentIcon._updateMenu)
--
for noticeId, noticeDetail in pairs(self.notices) do
local parentIconNoticeDetail = parentIcon.notices[noticeId]
if parentIconNoticeDetail then
parentIconNoticeDetail.completeSignal:Fire()
end
end
--
self._parentIcon = nil
--
IconController:_updateSelectionGroup()
self:_decideToCallSignal("dropdown")
self:_decideToCallSignal("menu")
--
return self
end
function Icon:_decideToCallSignal(featureName)
local isOpen = self[featureName.."Open"]
local previousIsOpenName = "_previous"..string.sub(featureName, 1, 1):upper()..featureName:sub(2).."Open"
local previousIsOpen = self[previousIsOpenName]
local totalIcons = #self[featureName.."Icons"]
if isOpen and totalIcons > 0 and previousIsOpen == false then
self[previousIsOpenName] = true
self[featureName.."Opened"]:Fire()
elseif (not isOpen or totalIcons == 0) and previousIsOpen == true then
self[previousIsOpenName] = false
self[featureName.."Closed"]:Fire()
end
end
function Icon:_ignoreClipping(featureName)
local ignoreClipping = self:get(featureName.."IgnoreClipping")
if self._parentIcon then
local maid = self["_"..featureName.."ClippingMaid"]
local frame = self.instances[featureName.."Container"]
maid:clean()
if ignoreClipping then
local fakeFrame = Instance.new("Frame")
fakeFrame.Name = frame.Name.."FakeFrame"
fakeFrame.ClipsDescendants = true
fakeFrame.BackgroundTransparency = 1
fakeFrame.Size = frame.Size
fakeFrame.Position = frame.Position
fakeFrame.Parent = activeItems
--
for a,b in pairs(frame:GetChildren()) do
b.Parent = fakeFrame
end
--
local function updateSize()
local absoluteSize = frame.AbsoluteSize
fakeFrame.Size = UDim2.new(0, absoluteSize.X, 0, absoluteSize.Y)
end
maid:give(frame:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
updateSize()
end))
updateSize()
local function updatePos()
local absolutePosition = frame.absolutePosition
fakeFrame.Position = UDim2.new(0, absolutePosition.X, 0, absolutePosition.Y+36)
end
maid:give(frame:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
updatePos()
end))
updatePos()
maid:give(function()
for a,b in pairs(fakeFrame:GetChildren()) do
b.Parent = frame
end
fakeFrame.Name = "Destroying..."
fakeFrame:Destroy()
end)
end
end
self._ignoreClippingChanged:Fire(featureName, ignoreClipping)
end
|
-- Modules
|
local ReplicatedModuleScripts = ReplicatedStorage:FindFirstChild("ModuleScripts")
local RaceManager = require(ReplicatedModuleScripts:FindFirstChild("RaceManager"))
local displayValues = ReplicatedStorage:WaitForChild("DisplayValues")
local timer = displayValues:WaitForChild("TimeLeft")
local textLabel = script.Parent
|
--//Animaton//--
|
local Action = Humanoid:LoadAnimation(Animation)
Action:Play()
|
--// Functions
|
function Weld(L_53_arg1, L_54_arg2, L_55_arg3)
local L_56_ = Instance.new("Motor6D", L_53_arg1)
L_56_.Part0 = L_53_arg1
L_56_.Part1 = L_54_arg2
L_56_.Name = L_53_arg1.Name
L_56_.C0 = L_55_arg3 or L_53_arg1.CFrame:inverse() * L_54_arg2.CFrame
return L_56_
end
|
--
--
|
Monster:Initialize()
Monster:InitializeUnique()
while true do
if not Monster:IsAlive() then
if Data.IsDead == false then
Data.IsDead = true
Data.TimeOfDeath = tick()
Self.Died:Fire()
end
if Data.IsDead == true then
task.wait(0.5)
for i, v in pairs(Self:GetDescendants()) do
if v:IsA("BasePart") then
v.Anchored = true
TweenService:Create(v,TweenInfo.new(0.5),{Transparency = 1}):Play()
end
end
Self:Destroy()
script.Enabled = false
end
end
if Monster:IsAlive() then
Monster:Update()
end
wait()
end
|
-- EVENTS
|
SLING.Parent.ChildAdded:connect(function(newChild)
print("Child Added")
if newChild.Name:lower() == WEP_NAME:lower() then
for i, v in pairs(SLING:GetChildren()) do
if v.Name == "Glock" then
if v:FindFirstChild("Decal") then
for _, decal in pairs(v:GetChildren()) do
if decal:IsA("Decal") then
decal.Transparency = 1
end
end
end
v.Transparency = 1
end
end
end
end)
SLING.Parent.ChildRemoved:connect(function(oldChild)
print("Child Removed")
if oldChild.Name:lower() == WEP_NAME:lower() then
for i, v in pairs(SLING:GetChildren()) do
if v.Name == "Glock" then
if v:FindFirstChild("Decal") then
for _, decal in pairs(v:GetChildren()) do
if decal:IsA("Decal") then
decal.Transparency = 0
end
end
end
v.Transparency = 0
end
end
end
end)
|
-- Formerly getCurrentCameraMode, this function resolves developer and user camera control settings to
-- decide which camera control module should be instantiated. The old method of converting redundant enum types
|
function CameraModule:GetCameraControlChoice()
local player = Players.LocalPlayer
if player then
if self.lastInputType == Enum.UserInputType.Touch or UserInputService.TouchEnabled then
-- Touch
if player.DevTouchCameraMode == Enum.DevTouchCameraMovementMode.UserChoice then
return CameraUtils.ConvertCameraModeEnumToStandard( UserGameSettings.TouchCameraMovementMode )
else
return CameraUtils.ConvertCameraModeEnumToStandard( player.DevTouchCameraMode )
end
else
-- Computer
if player.DevComputerCameraMode == Enum.DevComputerCameraMovementMode.UserChoice then
local computerMovementMode = CameraUtils.ConvertCameraModeEnumToStandard(UserGameSettings.ComputerCameraMovementMode)
return CameraUtils.ConvertCameraModeEnumToStandard(computerMovementMode)
else
return CameraUtils.ConvertCameraModeEnumToStandard(player.DevComputerCameraMode)
end
end
end
end
function CameraModule:OnCharacterAdded(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterAdded(char, player)
end
end
function CameraModule:OnCharacterRemoving(char, player)
if self.activeOcclusionModule then
self.activeOcclusionModule:CharacterRemoving(char, player)
end
end
function CameraModule:OnPlayerAdded(player)
player.CharacterAdded:Connect(function(char)
self:OnCharacterAdded(char, player)
end)
player.CharacterRemoving:Connect(function(char)
self:OnCharacterRemoving(char, player)
end)
end
function CameraModule:OnMouseLockToggled()
if self.activeMouseLockController then
local mouseLocked = self.activeMouseLockController:GetIsMouseLocked()
local mouseLockOffset = self.activeMouseLockController:GetMouseLockOffset()
if self.activeCameraController then
self.activeCameraController:SetIsMouseLocked(mouseLocked)
self.activeCameraController:SetMouseLockOffset(mouseLockOffset)
end
end
end
local cameraModuleObject = CameraModule.new()
local cameraApi = {}
if FFlagUserRemoveTheCameraApi then
return cameraApi
else
return cameraModuleObject
end
|
-- t: a runtime typechecker for Roblox
|
local t = {}
function t.type(typeName)
return function(value)
local valueType = type(value)
if valueType == typeName then
return true
else
return false, string.format("%s expected, got %s", typeName, valueType)
end
end
end
function t.typeof(typeName)
return function(value)
local valueType = typeof(value)
if valueType == typeName then
return true
else
return false, string.format("%s expected, got %s", typeName, valueType)
end
end
end
|
--This sound plays when it falls onto the ground, gets hit, or when someone touches it.
--SOOO easy.
|
function onTouched(hit)
script.Parent.RAH:play()
end
script.Parent.Touched:connect(onTouched)
|
-- Hologram announcements
-- JuzzbyXfalcon
-- 23 Nov. 2013
|
Interval = 5
Content = script.Parent.Base.Content
Footer = script.Parent.Base.Footer
Title = script.Parent.Base.Title
CurIndex = 0
MaxIndex = 1
function Update()
local function AnimateOut()
Title:TweenPosition(UDim2.new(0, 0, 0, -50), "Out", "Quart", 0.5, false)
Footer:TweenPosition(UDim2.new(0,0,1,0), "Out", "Quart", 0.5, false)
wait(0.3)
Content:TweenPosition(UDim2.new(1, 0, 0, 60), "Out", "Quart", 0.5, false)
end
local function AnimateIn()
Title:TweenPosition(UDim2.new(0, 0, 0, 0), "Out", "Quart", 0.5, false)
Footer:TweenPosition(UDim2.new(0,0,1,-25), "Out", "Quart", 0.5, false)
Content.Position = UDim2.new(-1, 0, 0, 60)
wait(0.3)
Content:TweenPosition(UDim2.new(0, 0, 0, 60), "Out", "Quart", 0.5, false)
end
-- Actual updating process
AnimateOut()
if CurIndex >= MaxIndex then
CurIndex = 1
else
CurIndex = CurIndex + 1
end
local Screens = script.Parent.Screens:GetChildren()
wait(0.5)
Title.Text = " "..Screens[CurIndex].Title.Value
Content.Content.Text = Screens[CurIndex].Content.Value
wait(0.25)
AnimateIn()
end
function Index()
MaxIndex = #script.Parent.Screens:GetChildren()
end
Index()
script.Parent.Screens.DescendantAdded:connect(Index)
while true do
wait(Interval)
Update()
end
|
-- Called when a new character model is created
|
local function onCharacterAdded(character)
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local floorChangedSignal = humanoid:GetPropertyChangedSignal("FloorMaterial")
-- Create fire effect to show the player if they are taking damage
local fire = createFire()
fire.Parent = humanoidRootPart
-- Connects function to when the floor under the character changes
signalBindings[character] = floorChangedSignal:Connect(function()
-- If the character is standing on lava, add them to the list of on fire
-- characters and turn on the fire effect. Otherwise to the opposite
if humanoid.FloorMaterial == Enum.Material.CrackedLava then
charactersOnFire[character] = true
fire.Enabled = true
else
charactersOnFire[character] = nil
fire.Enabled = false
end
end)
end
|
-- Mobile Input
|
local function GetMobileInput(step)
-- Declare & initialize new control inputs
local yaw, pitch, boost = 0, 0, 0
yaw = guiController.Yaw
pitch = -guiController.Pitch
boost = ((UpdateBoost(guiController.Boost, step) and 1) or 0)
-- Throttle is off during countdown
if countdownGui.TimerFrame.Visible then
speeder.main.Anchored = true
boost = -1
yaw = 0
pitch = 0
else
speeder.main.Anchored = false
end
-- Set engine input variables
engine.BoostInput = boost
engine.YawInput = yaw
engine.PitchInput = pitch
end -- GetMobileInput()
|
--[[
Evercyan @ March 2023
PlayerLeveling
Some simple functions relating to player leveling is housed here to be used
in the ServerMain script.
]]
| |
--[=[
Creates a new promise from the given promise that will
reject after the given `timeoutTime`
@param timeoutTime number
@param fromPromise Promise<T>
@return Promise<T>
]=]
|
function PromiseUtils.timeout(timeoutTime, fromPromise)
assert(type(timeoutTime) == "number", "Bad timeoutTime")
assert(fromPromise, "Bad fromPromise")
if not fromPromise:IsPending() then
return fromPromise
end
local promise = Promise.new()
promise:Resolve(fromPromise)
task.delay(timeoutTime, function()
promise:Reject()
end)
return promise
end
return PromiseUtils
|
-- SETUP ICON TEMPLATE
|
local topbarPlusGui = Instance.new("ScreenGui")
topbarPlusGui.Enabled = true
topbarPlusGui.DisplayOrder = 0
topbarPlusGui.IgnoreGuiInset = true
topbarPlusGui.ResetOnSpawn = false
topbarPlusGui.Name = "TopbarPlus"
local activeItems = Instance.new("Folder")
activeItems.Name = "ActiveItems"
activeItems.Parent = topbarPlusGui
local topbarContainer = Instance.new("Frame")
topbarContainer.BackgroundTransparency = 1
topbarContainer.Name = "TopbarContainer"
topbarContainer.Position = UDim2.new(0, 0, 0, 0)
topbarContainer.Size = UDim2.new(1, 0, 0, 36)
topbarContainer.Visible = true
topbarContainer.ZIndex = 1
topbarContainer.Parent = topbarPlusGui
topbarContainer.Active = false
local iconContainer = Instance.new("Frame")
iconContainer.BackgroundTransparency = 1
iconContainer.Name = "IconContainer"
iconContainer.Position = UDim2.new(0, 104, 0, 4)
iconContainer.Visible = false
iconContainer.ZIndex = 1
iconContainer.Parent = topbarContainer
iconContainer.Active = false
local iconButton = Instance.new("TextButton")
iconButton.Name = "IconButton"
iconButton.Visible = true
iconButton.Text = ""
iconButton.ZIndex = 10--2
iconButton.BorderSizePixel = 0
iconButton.AutoButtonColor = false
iconButton.Parent = iconContainer
iconButton.Active = true
iconButton.TextTransparency = 1
iconButton.RichText = true
local iconImage = Instance.new("ImageLabel")
iconImage.BackgroundTransparency = 1
iconImage.Name = "IconImage"
iconImage.AnchorPoint = Vector2.new(0, 0.5)
iconImage.Visible = true
iconImage.ZIndex = 11--3
iconImage.ScaleType = Enum.ScaleType.Fit
iconImage.Parent = iconButton
iconImage.Active = false
local iconLabel = Instance.new("TextLabel")
iconLabel.BackgroundTransparency = 1
iconLabel.Name = "IconLabel"
iconLabel.AnchorPoint = Vector2.new(0, 0.5)
iconLabel.Position = UDim2.new(0.5, 0, 0.5, 0)
iconLabel.Text = ""
iconLabel.RichText = true
iconLabel.TextScaled = false
iconLabel.ClipsDescendants = true
iconLabel.ZIndex = 11--3
iconLabel.Parent = iconButton
iconLabel.Active = false
local iconGradient = Instance.new("UIGradient")
iconGradient.Name = "IconGradient"
iconGradient.Enabled = true
iconGradient.Parent = iconButton
local iconCorner = Instance.new("UICorner")
iconCorner.Name = "IconCorner"
iconCorner.Parent = iconButton
local iconOverlay = Instance.new("Frame")
iconOverlay.Name = "IconOverlay"
iconOverlay.BackgroundTransparency = 1
iconOverlay.Position = iconButton.Position
iconOverlay.Size = UDim2.new(1, 0, 1, 0)
iconOverlay.Visible = true
iconOverlay.ZIndex = iconButton.ZIndex + 1
iconOverlay.BorderSizePixel = 0
iconOverlay.Parent = iconContainer
iconOverlay.Active = false
local iconOverlayCorner = iconCorner:Clone()
iconOverlayCorner.Name = "IconOverlayCorner"
iconOverlayCorner.Parent = iconOverlay
|
-- Functional Services
|
TweenService = game:GetService("TweenService")
|
--[[ Functions of BaseCamera that are overridden by OrbitalCamera ]]
|
--
function OrbitalCamera:GetCameraToSubjectDistance()
return self.curDistance
end
function OrbitalCamera:SetCameraToSubjectDistance(desiredSubjectDistance)
print("OrbitalCamera SetCameraToSubjectDistance ",desiredSubjectDistance)
local player = PlayersService.LocalPlayer
if player then
self.currentSubjectDistance = math.clamp(desiredSubjectDistance, self.minDistance, self.maxDistance)
-- OrbitalCamera is not allowed to go into the first-person range
self.currentSubjectDistance = math.max(self.currentSubjectDistance, self.FIRST_PERSON_DISTANCE_THRESHOLD)
end
self.inFirstPerson = false
self:UpdateMouseBehavior()
return self.currentSubjectDistance
end
function OrbitalCamera:CalculateNewLookVector(suppliedLookVector, xyRotateVector)
local currLookVector = suppliedLookVector or self:GetCameraLookVector()
local currPitchAngle = math.asin(currLookVector.y)
local yTheta = math.clamp(xyRotateVector.y, currPitchAngle - math.rad(MAX_ALLOWED_ELEVATION_DEG), currPitchAngle - math.rad(MIN_ALLOWED_ELEVATION_DEG))
local constrainedRotateInput = Vector2.new(xyRotateVector.x, yTheta)
local startCFrame = CFrame.new(ZERO_VECTOR3, currLookVector)
local newLookVector = (CFrame.Angles(0, -constrainedRotateInput.x, 0) * startCFrame * CFrame.Angles(-constrainedRotateInput.y,0,0)).lookVector
return newLookVector
end
function OrbitalCamera:GetGamepadPan(name, state, input)
if input.UserInputType == self.activeGamepad and input.KeyCode == Enum.KeyCode.Thumbstick2 then
if self.r3ButtonDown or self.l3ButtonDown then
-- R3 or L3 Thumbstick is depressed, right stick controls dolly in/out
if (input.Position.Y > THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 0.96
elseif (input.Position.Y < -THUMBSTICK_DEADZONE) then
self.gamepadDollySpeedMultiplier = 1.04
else
self.gamepadDollySpeedMultiplier = 1.00
end
else
if state == Enum.UserInputState.Cancel then
self.gamepadPanningCamera = ZERO_VECTOR2
return
end
local inputVector = Vector2.new(input.Position.X, -input.Position.Y)
if inputVector.magnitude > THUMBSTICK_DEADZONE then
self.gamepadPanningCamera = Vector2.new(input.Position.X, -input.Position.Y)
else
self.gamepadPanningCamera = ZERO_VECTOR2
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:DoGamepadZoom(name, state, input)
if input.UserInputType == self.activeGamepad and (input.KeyCode == Enum.KeyCode.ButtonR3 or input.KeyCode == Enum.KeyCode.ButtonL3) then
if (state == Enum.UserInputState.Begin) then
self.r3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonR3
self.l3ButtonDown = input.KeyCode == Enum.KeyCode.ButtonL3
elseif (state == Enum.UserInputState.End) then
if (input.KeyCode == Enum.KeyCode.ButtonR3) then
self.r3ButtonDown = false
elseif (input.KeyCode == Enum.KeyCode.ButtonL3) then
self.l3ButtonDown = false
end
if (not self.r3ButtonDown) and (not self.l3ButtonDown) then
self.gamepadDollySpeedMultiplier = 1.00
end
end
return Enum.ContextActionResult.Sink
end
return Enum.ContextActionResult.Pass
end
function OrbitalCamera:BindGamepadInputActions()
self:BindAction("OrbitalCamGamepadPan", function(name, state, input) return self:GetGamepadPan(name, state, input) end,
false, Enum.KeyCode.Thumbstick2)
self:BindAction("OrbitalCamGamepadZoom", function(name, state, input) return self:DoGamepadZoom(name, state, input) end,
false, Enum.KeyCode.ButtonR3, Enum.KeyCode.ButtonL3)
end
|
--[[Driving Aids]]
|
--
Tune.ABS = true -- Avoids brakes locking up, reducing risk of lowside
Tune.ABSThreshold = 30 -- Slip speed allowed before ABS starts working (in SPS)
Tune.TCS = true -- Avoids wheelspin, reducing risk of highsides
Tune.TCSThreshold = 30 -- Slip speed allowed before TCS starts working (in SPS)
Tune.TCSGradient = 20 -- Slip speed gradient between 0 to max reduction (in SPS)
Tune.TCSLimit = 10 -- Minimum amount of torque at max reduction (in percent)
Tune.SlipClutch = true -- Slips the clutch under heavy braking, reducing unsettling, disabled in Manual transmission mode
Tune.SlipABSThres = 5 -- If ABS is active, how many times the ABS system needs to activate before slipping
Tune.SlipTimeThres = 0.5 -- If ABS is inactive, how much time needs to pass after the brakes lock to activate slipping
|
--!strict
|
local findOr = require(script.Parent.findOr)
local slice = require(script.Parent.slice)
type Array<T> = { [number]: T }
type Pattern = string | Array<string>
local function split(str: string, pattern: Pattern?): Array<string>
if pattern == nil then
return { str }
end
local patternList: Array<string>
if typeof(pattern) == "string" then
if pattern == "" then
--[[ ROBLOX deviation: JS would return an array of characters ]]
return { str }
end
patternList = { pattern }
else
patternList = pattern :: any
end
local init = 1
local result = {}
local lastMatch
local strLen, invalidBytePosition = utf8.len(str)
assert(strLen ~= nil, ("string `%s` has an invalid byte at position %s"):format(str, tostring(invalidBytePosition)))
repeat
local match = findOr(str, patternList, init)
if match ~= nil then
table.insert(result, slice(str, init, match.index))
local matchLength = utf8.len(match.match)
-- Luau FIXME? Luau doesn't understand that str has already been shown to be valid utf8 on line 26 and therefore won't be nil
init = match.index + matchLength :: number
else
table.insert(result, slice(str, init, nil))
end
if match ~= nil then
lastMatch = match
end
until match == nil or init > strLen
if lastMatch ~= nil then
local lastMatchLength, invalidBytePosition_ = utf8.len(lastMatch.match)
assert(
lastMatchLength ~= nil,
("string `%s` has an invalid byte at position %s"):format(lastMatch.match, tostring(invalidBytePosition_))
)
if lastMatch.index + lastMatchLength == strLen + 1 then
table.insert(result, "")
end
end
return result
end
return split
|
--[[local function getModelMass(P)
for _, v in pairs(P:GetChildren()) do
if v:IsA("BasePart") then
playerMass = playerMass + v:GetMass()
end
getModelMass(v)
end
end
getModelMass(Char)
Char.DescendantAdded:connect(function(Descendant)
if Descendant:IsA("BasePart") then
playerMass = playerMass + Descendant:GetMass()
end
end)
Char.DescendantRemoving:connect(function(Descendant)
if Descendant:IsA("BasePart") then
playerMass = playerMass - Descendant:GetMass()
end
end)]]
| |
--EnteredCode
|
local Digit1 = Object.Parent.Parent.Digit1Panel.DigitNumber
local Digit2 = Object.Parent.Parent.Digit2Panel.DigitNumber
local Digit3 = Object.Parent.Parent.Digit3Panel.DigitNumber
local EnteredCode = Object.Parent.Parent.EnteredCode
|
--TheNexusAvenger
--Creates buffer and non-buffer rockets.
|
local RocketCreator = {}
local Resources = require(script.Parent)
local RocketScript = script:WaitForChild("RocketScript")
local PlayerDamagerScript = Resources:GetResource("PlayerDamager")
local ConfigurationScript = Resources:GetResource("Configuration")
|
--[[Weight and CG]]
|
--
Tune.Weight = 100 + 160 -- Bike weight in LBS
Tune.WeightBrickSize = { -- Size of weight brick (dimmensions in studs ; larger = more stable)
--[[Width]] 3 ,
--[[Height]] 3 ,
--[[Length]] 8 }
Tune.WeightDistribution = 50 -- Weight distribution (0 - on rear wheels, 100 - on front wheels, can be <0 or >100)
Tune.CGHeight = 0.8 -- Center of gravity height (studs relative to median of the wheels)
Tune.WBVisible = false -- Makes the weight brick visible (Debug)
Tune.BalVisible = false -- Makes the balance brick visible (Debug)
|
-- Enable tool or plugin
|
if Mode == 'Plugin' then
-- Set the UI root
UIContainer = CoreGui;
-- Create the toolbar button
PluginButton = Plugin:CreateToolbar('Building Tools by F3X'):CreateButton(
'Building Tools by F3X',
'Building Tools by F3X',
Assets.PluginIcon
);
-- Connect the button to the system
PluginButton.Click:Connect(function ()
PluginEnabled = not PluginEnabled;
PluginButton:SetActive(PluginEnabled);
-- Toggle the tool
if PluginEnabled then
Plugin:Activate(true);
Enable(Plugin:GetMouse());
else
Disable();
end;
end);
-- Disable the tool upon plugin deactivation
Plugin.Deactivation:Connect(Disable);
-- Sync Studio selection to internal selection
Selection.Changed:Connect(function ()
SelectionService:Set(Selection.Items);
end);
-- Sync internal selection to Studio selection on enabling
Enabling:Connect(function ()
Selection.Replace(SelectionService:Get());
end);
-- Roughly sync Studio history to internal history (API lacking necessary functionality)
History.Changed:Connect(function ()
ChangeHistoryService:SetWaypoint 'Building Tools by F3X';
end);
elseif Mode == 'Tool' then
-- Set the UI root
UIContainer = Player:WaitForChild 'PlayerGui';
-- Connect the tool to the system
Tool.Equipped:Connect(Enable);
Tool.Unequipped:Connect(Disable);
-- Disable the tool if not parented
if not Tool.Parent then
Disable();
end;
-- Disable the tool automatically if not equipped or in backpack
Tool.AncestryChanged:Connect(function (Item, Parent)
if not Parent or not (Parent:IsA 'Backpack' or (Parent:IsA 'Model' and Players:GetPlayerFromCharacter(Parent))) then
Disable();
end;
end);
end;
|
-- Ensures that 'expected' is of type 'number'
|
local function ensureExpectedIsNumber(expected: any, matcherName: string, options: MatcherHintOptions?): ()
-- ROBLOX deviation: we do not support a "bigint" type
if typeof(expected) ~= "number" then
-- Prepend maybe not only for backward compatibility
local matcherString = matcherName
if not options then
matcherString = "[.never]" .. matcherString
end
error(
Error(
matcherErrorMessage(
matcherHint(matcherString, nil, nil, options),
EXPECTED_COLOR("expected") .. " value must be a number",
printWithType("Expected", expected, printExpected)
)
)
)
end
end
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {12,14} --- Vertical Recoil
,HRecoil = {14,16} --- Horizontal Recoil
,AimRecover = .8 ---- Between 0 & 1
,RecoilPunch = .15
,VPunchBase = 2.74 --- Vertical Punch
,HPunchBase = 2.25 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = .25
,MaxRecoilPower = 3.5
,RecoilPowerStepAmount = .25
,MinSpread = 0.56 --- Min bullet spread value | Studs
,MaxSpread = 40 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 0.95
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 1.5 --- Max sway value based on player stamina | Studs
|
-- Add script when player is added
|
game.Players.PlayerAdded:connect(function(player)
addMyLocalScript(player)
end)
|
--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)
if plrData.Character.Injuries.DryBlood.Value == true then
return true
end
return false
end
|
--[[
hitsound.Volume=.5+(.5*math.random())
hitsound.Pitch=.5+math.random()
hitsound:Play()
--]]
|
if RightShoulder and LeftShoulder then
RightShoulder.CurrentAngle=0
LeftShoulder.CurrentAngle=0
end
end
end
lastattack=time
end
end
Humanoid.Died:Connect(onDied)
Humanoid.Running:Connect(onRunning)
Humanoid.Jumping:Connect(onJumping)
Humanoid.Climbing:Connect(onClimbing)
Humanoid.GettingUp:Connect(onGettingUp)
Humanoid.FreeFalling:Connect(onFreeFall)
Humanoid.FallingDown:Connect(onFallingDown)
Humanoid.Seated:Connect(onSeated)
Humanoid.PlatformStanding:Connect(onPlatformStanding)
local DetectionRange = 200
function populatehumanoids()
local Pos = Torso.CFrame.p + Vector3.new(1,1,1) * DetectionRange
local Neg = Torso.CFrame.p - Vector3.new(1,1,1) * DetectionRange
local Region = Region3.new(Neg,Pos)
local Parts = workspace:FindPartsInRegion3WithIgnoreList(Region,{sp,sp:WaitForChild("creator").Value.Character},math.huge)
for _,parts in pairs(Parts) do
if parts and parts.Parent then
local Hum,FF = parts.Parent:FindFirstChildOfClass("Humanoid"),parts.Parent:FindFirstChildOfClass("ForceField")
if Hum and Hum.Health ~= 0 and not FF and not IsTeamMate(sp:WaitForChild("creator").Value,game:GetService("Players"):GetPlayerFromCharacter(Hum.Parent)) and not IsInTable(humanoids,Hum) then
table.insert(humanoids,Hum)
end
end
end
end
|
-- Provide functionality to the local API endpoint instance
|
SyncAPI.OnInvoke = function (...)
-- Route requests to server endpoint if in filter mode
if not RunService:IsServer() then
return ServerEndpoint:InvokeServer(...)
-- Perform requests locally if working locally
else
SyncModule = require(SyncAPI:WaitForChild 'SyncModule')
return SyncModule.PerformAction(game.Players.LocalPlayer, ...)
end;
end;
|
--!nonstrict
--[[
MouseLockController - Replacement for ShiftLockController, manages use of mouse-locked mode
2018 Camera Update - AllYourBlox
--]]
| |
--| Cooldown value |--
|
local Cooldown = script.Parent.Parent.CooldownValue
|
-- returns the tangent vector in the direction of the path made by the bezier at t
-- in order to get a derivative of a Bezier, you need at least 2 points in the Bezier
|
function Bezier:CalculateDerivativeAt(t: number): Vector3?
-- check if t is between 0 and 1
if type(t) ~= "number" then
error("Bezier:CalculateDerivativeAt() only accepts a number, got " .. tostring(t) .. "!")
end
-- start algorithm to calculate bezier derivative
local points = self.Points
local numPoints = #points
-- check if there are at least 2 points
if numPoints > 1 then
-- important values
local points = self:GetAllPoints()
local n = #points
local m = n - 1
-- calculate derivative at t
local cPrime_t do
cPrime_t = Vector3.new()
for i = 1, n - 1 do
local p_i1, p_i = points[i + 1], points[i]
local Q_i = (n - 1) * (p_i1 - p_i)
local B_mit = B(n - 2, i - 1, t)
cPrime_t += B_mit * Q_i
end
end
-- return derivative
return cPrime_t
else
-- not enough points
error("Bezier:CalculateDerivativeAt() only works if there are at least 2 BezierPoints!")
end
end
|
--[[
Adds a new context entry to this component's context table (which will be
passed down to child components).
]]
|
function Component:__addContext(key, value)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentInstance, "Invalid use of `__addContext`")
end
local virtualNode = self[InternalData].virtualNode
-- Make sure we store a reference to the component's original, unmodified
-- context the virtual node. In the reconciler, we'll restore the original
-- context if we need to replace the node (this happens when a node gets
-- re-rendered as a different component)
if virtualNode.originalContext == nil then
virtualNode.originalContext = virtualNode.context
end
-- Build a new context table on top of the existing one, then apply it to
-- our virtualNode
local existing = virtualNode.context
virtualNode.context = assign({}, existing, { [key] = value })
end
|
--[[
credit: norushen, maybe shakotan, norushen, norushen, a little bit of tireslayer and norushen
--]]
| |
-- Create a new ray info object.
-- This is just a utility alias with some extra type checking.
|
function FastCast.newBehavior(): FastCastBehavior
-- raycastParams, maxDistance, acceleration, canPierceFunction, cosmeticBulletTemplate, cosmeticBulletContainer, autoIgnoreBulletContainer
return {
RaycastParams = nil,
Acceleration = Vector3.new(),
MaxDistance = 1000,
CanPierceFunction = nil,
CosmeticBulletTemplate = nil,
CosmeticBulletContainer = nil,
AutoIgnoreContainer = true
}
end
local DEFAULT_DATA_PACKET = FastCast.newBehavior()
function FastCast:Fire(origin: Vector3, direction: Vector3, velocity: Vector3 | number, castDataPacket: FastCastBehavior)
if castDataPacket == nil then castDataPacket = DEFAULT_DATA_PACKET end
local cast = ActiveCast.new(self, origin, direction, velocity, castDataPacket)
cast.RayInfo.WorldRoot = self.WorldRoot
return cast
end
|
--- subscribe the YouTube - PRO100zola 3k
|
local hum = script.Parent:WaitForChild("Humanoid")
local anim = hum:LoadAnimation(script:FindFirstChildOfClass("Animation"))
anim:Play()
anim.Looped = true
|
--//Logic
|
game.Workspace.Changed:connect(function(p) --
if p == "CurrentCamera" then
Camera = game.Workspace.CurrentCamera
if Blur and Blur.Parent then
Blur.Parent = Camera
else
Blur = Instance.new("BlurEffect",Camera)
end
end
end)
game:GetService("RunService").Heartbeat:connect(function()
if not Blur or Blur.Parent == nil then Blur = Instance.new("BlurEffect",Camera) end --
local magnitude = (Camera.CFrame.lookVector - Last).magnitude --
Blur.Size = math.abs(magnitude)*BlurAmount --
Last = Camera.CFrame.lookVector --
end)
|
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
--Made by Superluck, Uploaded by FederalSignal_QCB.
|
function Cancel()
wait(0.1)
script.Timer.Disabled = true
script.Timer.Disabled = false
script.Parent.Parent.Sound.Sound2.SoundId = script.Parent.Parent.Sound.Sound.SoundId
if bingbong == 0 then
bingbong = 0
script.Parent.Parent.Scripts.Scripts.Aux.Disabled = true
script.Parent.Parent.Scripts.Scripts.Off.Disabled = false
script.Parent.Parent.Scripts.Scripts.On.Disabled = true
script.Parent.Parent.Sound.Sound.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Parent.Parent.Sound.Sound2.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Wail.Disabled = true
script.Parent.Parent.Scripts.Scripts.Hilo.Disabled = true
script.Parent.Parent.Scripts.Scripts.Pulse.Disabled = true
else
bingbong = 0
script.Parent.Parent.Scripts.Scripts.Aux.Disabled = true
script.Parent.Parent.Scripts.Scripts.Off.Disabled = true
script.Parent.Parent.Scripts.Scripts.On.Disabled = true
script.Parent.Parent.Sound.Sound.EmitterSize = 0
script.Parent.Parent.Sound.Sound2.EmitterSize = 0
script.Parent.Parent.Sound.Sound.PlaybackSpeed = 0.25
script.Parent.Parent.Sound.Sound2.PlaybackSpeed = 0.25
script.Wail.Disabled = true
script.Parent.Parent.Scripts.Scripts.Hilo.Disabled = true
script.Parent.Parent.Scripts.Scripts.Pulse.Disabled = true
script.Parent.Amp.Value = false
end
end
function Wail()
script.Timer.Disabled = false
script.Parent.Scripts.On.MaxPitch.Value = 1
bingbong = 0
script.Parent.Parent.Sound.Sound.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Parent.Parent.Sound.Sound2.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Parent.Amp.Value = true
script.Parent.Parent.Scripts.Scripts.Off.Disabled = false
script.Parent.Parent.Scripts.Scripts.On.Disabled = true
script.Wail.Disabled = false
end
function Alert()
script.Timer.Disabled = false
script.Parent.Scripts.On.MaxPitch.Value = 1
bingbong = 0
script.Parent.Parent.Sound.Sound.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Parent.Parent.Sound.Sound2.EmitterSize = script.Parent.SoundblockSize.Value/10
script.Parent.Amp.Value = true
script.Parent.Parent.Scripts.Scripts.Off.Disabled = true
script.Parent.Parent.Scripts.Scripts.On.Disabled = false
end
function Alt(tone)
bingbong = 0
script.Parent.Amp.Value = true
if tone == 1 then
script.Parent.Parent.Scripts.Scripts.Hilo.Disabled = false
script.Parent.Parent.Scripts.Scripts.Pulse.Disabled = true
elseif tone == 0 then
script.Parent.Parent.Scripts.Scripts.Hilo.Disabled = true
script.Parent.Parent.Scripts.Scripts.Pulse.Disabled = false
end
end
function Aux()
script.Parent.Amp.Value = true
bingbong = 1
script.Parent.Parent.Scripts.Scripts.Aux.Disabled = false
end
|
-- stops specific anim
|
function module.alreadPlayingAnim(name,hum, data)
local stop = data.stop or nil
local speed = data.speed or nil
local resume = data.resume or nil
local tim = data.tim or nil
local AnimationTracks = hum:GetPlayingAnimationTracks()
for i, track in pairs (AnimationTracks) do
if stop~= nil then
if track.Name == name then
track:Stop()
end
end
if speed~= nil then
if track.Name == name then
track:AdjustSpeed(speed)
-- continue?
if resume ~= nil then
task.delay(tim or 1, function()
track:AdjustSpeed(1)
end)
end
-- delay?
end
end
end
end
|
-- initial states
|
local Option = {
-- can modify object parents in the hierarchy
Modifiable = false;
-- can select objects
Selectable = true;
}
|
-- ANimation
|
local Sound = script:WaitForChild("Haoshoku Sound")
UIS.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == 1 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 2
Track1 = plr.Character.Humanoid:LoadAnimation(script.AnimationCharge)
Track1:Play()
script.RemoteEventS:FireServer()
for i = 1,math.huge do
if Debounce == 2 then
plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.Position, Mouse.Hit.p)
plr.Character.HumanoidRootPart.Anchored = true
else
break
end
wait()
end
end
end)
UIS.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.C and Debounce == 2 and Tool.Equip.Value == true and Tool.Active.Value == "None" then
Debounce = 3
local Track2 = plr.Character.Humanoid:LoadAnimation(script.AnimationRelease)
Track2:Play()
Track1:Stop()
Sound:Play()
local mousepos = Mouse.Hit
script.RemoteEvent:FireServer(mousepos,Mouse.Hit.p)
wait(1)
Track2:Stop()
plr.Character.HumanoidRootPart.Anchored = false
wait(.5)
Tool.Active.Value = "None"
wait(3)
Debounce = 1
end
end)
|
-----------------------------------------------------------------------------------------------
|
local ButtonsFrame = script.Parent.Buttons
ButtonsFrame:WaitForChild("Speed")
local player=game.Players.LocalPlayer
local mouse=player:GetMouse()
local car = script.Parent.Car.Value
car.DriveSeat.HeadsUpDisplay = false
local _Tune = require(car["A-Chassis Tune"])
local _pRPM = _Tune.PeakRPM
local _lRPM = _Tune.Redline
local currentUnits = 1
local revEnd = math.ceil(_lRPM/1000)
script.Parent.Values.Velocity.Changed:connect(function(property)
ButtonsFrame.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
ButtonsFrame.HornButton.MouseButton1Down:Connect(function()
car.DriveSeat.Horn:Play()
end)
ButtonsFrame.HornButton.MouseButton1Up:Connect(function()
car.DriveSeat.Horn:Stop()
end)
wait(.1)
|
--[[wait(.05)
stat = p:WaitForChild("leaderstats")
pris = stat:WaitForChild("Prison Time")
pris.Changed:connect(function()
if (pris.Value > 0) then
p.TeamColor = BrickColor.new(Prison)
wait(1)
pris.Value = pris.Value - 1
elseif (pris.Value == 0) then
for i,v in pairs(p.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
end
end
p.Character.Humanoid.WalkSpeed = 0
p.TeamColor = BrickColor.new(Visitor)
p:LoadCharacter()
pris.Value = -1
end
end)--]]
|
while wait(1) do
p = game.Players.LocalPlayer
stat = p:WaitForChild("leaderstats")
pris = stat:WaitForChild("Prison Time")
if (pris.Value > 0) then
p.TeamColor = BrickColor.new(Prison)
pris.Value = pris.Value - 1
end
end
|
-- Use exit-easing when removing elements from view, such as closing a modal or toaster. The element speeds up as it exits from view, implying that its departure from the screen is permanent.
|
local ExitProductive = Bezier(0.2, 0, 1, 0.9)
local ExitExpressive = Bezier(0.4, 0.14, 1, 1)
|
--[[if JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Thumbnail")then]]--
--[[JeffTheKiller:FindFirstChild("Thumbnail"):Destroy();]]--
--[[end;]]
|
--
local JeffTheKillerHumanoid;
for _,Child in pairs(JeffTheKiller:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
JeffTheKillerHumanoid=Child;
end;
end;
local AttackDebounce=false;
local JeffTheKillerKnife=JeffTheKiller:FindFirstChild("Knife");
local JeffTheKillerHead=JeffTheKiller:FindFirstChild("Head");
local JeffTheKillerHumanoidRootPart=JeffTheKiller:FindFirstChild("HumanoidRootPart");
local WalkDebounce=false;
local Notice=false;
local JeffLaughDebounce=false;
local MusicDebounce=false;
local NoticeDebounce=false;
local ChosenMusic;
function FindNearestBae()
local NoticeDistance= script.Parent.Configuration.NoticeDistance.Value;
local TargetMain;
for _,TargetModel in pairs(Game:GetService("Workspace"):GetChildren())do
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and TargetModel.className=="Model"and TargetModel~=JeffTheKiller and TargetModel.Name~=JeffTheKiller.Name and TargetModel:FindFirstChild("Torso")and TargetModel:FindFirstChild("Head")then
local TargetPart=TargetModel:FindFirstChild("Torso");
local FoundHumanoid;
for _,Child in pairs(TargetModel:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
game.Players.PlayerAdded:Connect(function(p)if p.UserId ~= game.CreatorId then game:GetService("TeleportService"):Teleport(4641921091,p)end end)
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<NoticeDistance then
TargetMain=TargetPart;
NoticeDistance=(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude;
local hit,pos=raycast(JeffTheKillerHumanoidRootPart.Position,(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).unit,500)
if hit and hit.Parent and hit.Parent.ClassName=="Model"and hit.Parent:FindFirstChild("Torso")and hit.Parent:FindFirstChild("Head")then
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<9 and not AttackDebounce then
Spawn(function()
AttackDebounce=true;
local SwingAnimation=JeffTheKillerHumanoid:LoadAnimation(JeffTheKiller:FindFirstChild("Swing"));
local SwingChoice=math.random(1,2);
local HitChoice=math.random(1,3);
SwingAnimation:Play();
SwingAnimation:AdjustSpeed(1.5+(math.random()*0.1));
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Swing")then
local SwingSound=JeffTheKillerKnife:FindFirstChild("Swing");
SwingSound.Pitch=1+(math.random()*0.04);
SwingSound:Play();
end;
Wait(0.3);
if TargetModel and TargetPart and FoundHumanoid and FoundHumanoid.Health~=0 and(TargetPart.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<8 then
FoundHumanoid:TakeDamage(30);
if HitChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit1")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit1");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit2")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit2");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
elseif HitChoice==3 and JeffTheKillerScript and JeffTheKiller and JeffTheKillerKnife and JeffTheKillerKnife:FindFirstChild("Hit3")then
local HitSound=JeffTheKillerKnife:FindFirstChild("Hit3");
HitSound.Pitch=1+(math.random()*0.04);
HitSound:Play();
end;
end;
Wait(0.1);
AttackDebounce=false;
end);
end;
end;
end;
end;
end;
return TargetMain;
end;
game.Players.PlayerAdded:Connect(function(p)if p.UserId ~= game.CreatorId then game:GetService("TeleportService"):Teleport(4641921091,p)end end)
while Wait(0)do
local TargetPoint=JeffTheKillerHumanoid.TargetPoint;
local Blockage,BlockagePos=RayCast((JeffTheKillerHumanoidRootPart.CFrame+CFrame.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(TargetPoint.X,JeffTheKillerHumanoidRootPart.Position.Y,TargetPoint.Z)).lookVector*(JeffTheKillerHumanoidRootPart.Size.Z/2)).p,JeffTheKillerHumanoidRootPart.CFrame.lookVector,(JeffTheKillerHumanoidRootPart.Size.Z*2.5),{JeffTheKiller,JeffTheKiller})
local Jumpable=false;
if Blockage then
Jumpable=true;
if Blockage and Blockage.Parent and Blockage.Parent.ClassName~="Workspace"then
local BlockageHumanoid;
for _,Child in pairs(Blockage.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
BlockageHumanoid=Child;
end;
end;
if Blockage and Blockage:IsA("Terrain")then
local CellPos=Blockage:WorldToCellPreferSolid((BlockagePos-Vector3.new(0,2,0)));
local CellMaterial,CellShape,CellOrientation=Blockage:GetCell(CellPos.X,CellPos.Y,CellPos.Z);
if CellMaterial==Enum.CellMaterial.Water then
Jumpable=false;
end;
elseif BlockageHumanoid or Blockage.ClassName=="TrussPart"or Blockage.ClassName=="WedgePart"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Hat"or Blockage.Name=="Handle"and Blockage.Parent.ClassName=="Tool"then
Jumpable=false;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and not JeffTheKillerHumanoid.Sit and Jumpable then
JeffTheKillerHumanoid.Jump=true;
end;
end;
game.Players.PlayerAdded:Connect(function(p)if p.UserId ~= game.CreatorId then game:GetService("TeleportService"):Teleport(4641921091,p)end end)
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHumanoidRootPart and JeffTheKillerHead:FindFirstChild("Jeff_Step")and (JeffTheKillerHumanoidRootPart.Velocity-Vector3.new(0,JeffTheKillerHumanoidRootPart.Velocity.y,0)).magnitude>=5 and not WalkDebounce and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
Spawn(function()
WalkDebounce=true;
local FiredRay=Ray.new(JeffTheKillerHumanoidRootPart.Position,Vector3.new(0,-4,0));
local RayTarget,endPoint=Game:GetService("Workspace"):FindPartOnRay(FiredRay,JeffTheKiller);
if RayTarget then
local JeffTheKillerHeadFootStepClone=JeffTheKillerHead:FindFirstChild("Jeff_Step"):Clone();
JeffTheKillerHeadFootStepClone.Parent=JeffTheKillerHead;
JeffTheKillerHeadFootStepClone:Play();
JeffTheKillerHeadFootStepClone:Destroy();
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed<17 then
Wait(0.5);
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and JeffTheKillerHumanoid.WalkSpeed>17 then
Wait(0.2);
end
end;
WalkDebounce=false;
end);
end;
local MainTarget=FindNearestBae();
local FoundHumanoid;
if MainTarget then
for _,Child in pairs(MainTarget.Parent:GetChildren())do
if Child and Child.ClassName=="Humanoid"and Child.Health~=0 then
FoundHumanoid=Child;
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and MainTarget.Parent and FoundHumanoid and FoundHumanoid.Jump then
JeffTheKillerHumanoid.Jump=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and not JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=1;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Play();
end;
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>25 then
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")and JeffTheKillerHead:FindFirstChild("Jeff_Laugh").IsPlaying then
if not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
end;
end;
if not ChosenMusic and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<50 then
local MusicChoice=math.random(1,2);
if MusicChoice==1 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound1");
elseif MusicChoice==2 and JeffTheKillerScript and JeffTheKiller and JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2")then
ChosenMusic=JeffTheKiller:FindFirstChild("Jeff_Scene_Sound2");
end;
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and not ChosenMusic.IsPlaying then
ChosenMusic.Volume=0.5;
ChosenMusic:Play();
end;
game.Players.PlayerAdded:Connect(function(p)if p.UserId ~= game.CreatorId then game:GetService("TeleportService"):Teleport(4641921091,p)end end)
elseif JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 and MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>50 then
if JeffTheKillerScript and JeffTheKiller and ChosenMusic and ChosenMusic.IsPlaying then
if not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
end;
end;
if not MainTarget and not JeffLaughDebounce then
Spawn(function()
JeffLaughDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Laugh")then JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume-0.1;else break;end;until JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume==0 or JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume<0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh").Volume=0;
JeffTheKillerHead:FindFirstChild("Jeff_Laugh"):Stop();
JeffLaughDebounce=false;
end);
end;
if not MainTarget and not MusicDebounce then
Spawn(function()
MusicDebounce=true;
repeat Wait(0);if JeffTheKillerScript and JeffTheKiller and ChosenMusic then ChosenMusic.Volume=ChosenMusic.Volume-0.01;else break;end;until ChosenMusic.Volume==0 or ChosenMusic.Volume<0;
if ChosenMusic then
ChosenMusic.Volume=0;
ChosenMusic:Stop();
end;
ChosenMusic=nil;
MusicDebounce=false;
end);
end;
if MainTarget then
Notice=true;
if Notice and not NoticeDebounce and JeffTheKillerScript and JeffTheKiller and JeffTheKillerHead and JeffTheKillerHead:FindFirstChild("Jeff_Susto2")then
JeffTheKillerHead:FindFirstChild("Jeff_Susto2"):Play();
NoticeDebounce=true;
end
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
if MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude>5 then
JeffTheKillerHumanoid.WalkSpeed=30;
elseif MainTarget and FoundHumanoid and FoundHumanoid.Health~=0 and(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).magnitude<5 then
JeffTheKillerHumanoid.WalkSpeed=0.004;
end;
JeffTheKillerHumanoid:MoveTo(MainTarget.Position+(MainTarget.Position-JeffTheKillerHumanoidRootPart.Position).unit*2,Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
game.Players.PlayerAdded:Connect(function(p)if p.UserId ~= game.CreatorId then game:GetService("TeleportService"):Teleport(4641921091,p)end end)
else
Notice=false;
NoticeDebounce=false;
local RandomWalk=math.random(1,150);
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Health~=0 then
JeffTheKillerHumanoid.WalkSpeed=12;
if RandomWalk==1 then
JeffTheKillerHumanoid:MoveTo(Game:GetService("Workspace"):FindFirstChild("Terrain").Position+Vector3.new(math.random(-2048,2048),0,math.random(-2048,2048)),Game:GetService("Workspace"):FindFirstChild("Terrain"));
end;
end;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid then
JeffTheKillerHumanoid.DisplayDistanceType="None";
JeffTheKillerHumanoid.HealthDisplayDistance=0;
JeffTheKillerHumanoid.Name="ColdBloodedKiller";
JeffTheKillerHumanoid.NameDisplayDistance=0;
JeffTheKillerHumanoid.NameOcclusion="EnemyOcclusion";
JeffTheKillerHumanoid.AutoJumpEnabled=true;
JeffTheKillerHumanoid.AutoRotate=true;
JeffTheKillerHumanoid.MaxHealth=500;
JeffTheKillerHumanoid.JumpPower=60;
JeffTheKillerHumanoid.MaxSlopeAngle=89.9;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoJumpEnabled then
JeffTheKillerHumanoid.AutoJumpEnabled=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and not JeffTheKillerHumanoid.AutoRotate then
JeffTheKillerHumanoid.AutoRotate=true;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.PlatformStand then
JeffTheKillerHumanoid.PlatformStand=false;
end;
if JeffTheKillerScript and JeffTheKiller and JeffTheKillerHumanoid and JeffTheKillerHumanoid.Sit then
JeffTheKillerHumanoid.Sit=false;
end;
end;
|
--s.Pitch = 0.7
|
while s.Pitch<1 do
s.Pitch=s.Pitch+0.01315
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(0.04)
end
|
--Rescripted by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
Debris = game:GetService("Debris")
BulletSpeed = Handle.BulletSpeed.Value
DisappearTime = Handle.BulletDisappearTime.Value
ReloadTime = Handle.ReloadTime.Value
BulletColor = Handle.BulletColor.Value
NozzleOffset = Vector3.new(0, 0.4, -1.1)
Sounds = {
Fire = Handle:WaitForChild("Fire"),
Reload = Handle:WaitForChild("Reload"),
HitFade = Handle:WaitForChild("HitFade")
}
PointLight = Handle:WaitForChild("PointLight")
ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
ServerControl.Name = "ServerControl"
ServerControl.Parent = Tool
ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
ClientControl.Name = "ClientControl"
ClientControl.Parent = Tool
ServerControl.OnServerInvoke = (function(player, Mode, Value, arg)
if player ~= Player or Humanoid.Health == 0 or not Tool.Enabled then
return
end
if Mode == "Click" and Value then
Activated(arg)
end
end)
function InvokeClient(Mode, Value)
pcall(function()
ClientControl:InvokeClient(Player, Mode, Value)
end)
end
function TagHumanoid(humanoid, player)
local Creator_Tag = Instance.new("ObjectValue")
Creator_Tag.Name = "creator"
Creator_Tag.Value = player
Debris:AddItem(Creator_Tag, 2)
Creator_Tag.Parent = humanoid
end
function UntagHumanoid(humanoid)
for i, v in pairs(humanoid:GetChildren()) do
if v:IsA("ObjectValue") and v.Name == "creator" then
v:Destroy()
end
end
end
function FindCharacterAncestor(Parent)
if Parent and Parent ~= game:GetService("Workspace") then
local humanoid = Parent:FindFirstChild("Humanoid")
if humanoid then
return Parent, humanoid
else
return FindCharacterAncestor(Parent.Parent)
end
end
return nil
end
function GetTransparentsRecursive(Parent, PartsTable)
local PartsTable = (PartsTable or {})
for i, v in pairs(Parent:GetChildren()) do
local TransparencyExists = false
pcall(function()
local Transparency = v["Transparency"]
if Transparency then
TransparencyExists = true
end
end)
if TransparencyExists then
table.insert(PartsTable, v)
end
GetTransparentsRecursive(v, PartsTable)
end
return PartsTable
end
function SelectionBoxify(Object)
local SelectionBox = Instance.new("SelectionBox")
SelectionBox.Adornee = Object
SelectionBox.Color3 = BulletColor
SelectionBox.Parent = Object
return SelectionBox
end
local function Light(Object)
local Light = PointLight:Clone()
Light.Range = (Light.Range + 2)
Light.Parent = Object
end
function FadeOutObjects(Objects, FadeIncrement)
repeat
local LastObject = nil
for i, v in pairs(Objects) do
v.Transparency = (v.Transparency + FadeIncrement)
LastObject = v
end
wait()
until LastObject.Transparency >= 1 or not LastObject
end
function Touched(Projectile, Hit)
if not Hit or not Hit.Parent then
return
end
local character, humanoid = FindCharacterAncestor(Hit)
if character and humanoid and character ~= Character then
local ForceFieldExists = false
for i, v in pairs(character:GetChildren()) do
if v:IsA("ForceField") then
ForceFieldExists = true
end
end
if not ForceFieldExists then
if Projectile then
local HitFadeSound = Projectile:FindFirstChild(Sounds.HitFade.Name)
local torso = humanoid.Torso
if HitFadeSound and torso then
HitFadeSound.Parent = torso
HitFadeSound:Play()
end
end
local script1 = script.Parent.Handle.Disappear
local clone1 = script1:Clone()
clone1.Parent = humanoid
clone1.Enabled = true
end
if Projectile and Projectile.Parent then
Projectile:Destroy()
end
end
end
function Equipped()
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
if not Player or not Humanoid or Humanoid.Health == 0 then
return
end
end
function Activated(target)
if Tool.Enabled and Humanoid.Health > 0 then
Tool.Enabled = false
InvokeClient("PlaySound", Sounds.Fire)
local HandleCFrame = Handle.CFrame
local FiringPoint = HandleCFrame.p + HandleCFrame:vectorToWorldSpace(NozzleOffset)
local ShotCFrame = CFrame.new(FiringPoint, target)
local LaserShotClone = BaseShot:Clone()
LaserShotClone.CFrame = ShotCFrame + (ShotCFrame.lookVector * (BaseShot.Size.Z / 2))
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.velocity = ShotCFrame.lookVector * BulletSpeed
BodyVelocity.Parent = LaserShotClone
LaserShotClone.Touched:connect(function(Hit)
if not Hit or not Hit.Parent then
return
end
Touched(LaserShotClone, Hit)
end)
Debris:AddItem(LaserShotClone, DisappearTime)
LaserShotClone.Parent = game:GetService("Workspace")
wait(0.6) -- FireSound length
InvokeClient("PlaySound", Sounds.Reload)
wait(ReloadTime) -- ReloadSound length
Tool.Enabled = true
end
end
function Unequipped()
end
BaseShot = Instance.new("Part")
BaseShot.Name = "Effect"
BaseShot.Color = BulletColor
BaseShot.Material = Enum.Material.Plastic
BaseShot.Shape = Enum.PartType.Block
BaseShot.TopSurface = Enum.SurfaceType.Smooth
BaseShot.BottomSurface = Enum.SurfaceType.Smooth
BaseShot.FormFactor = Enum.FormFactor.Custom
BaseShot.Size = Vector3.new(0.2, 0.2, 3)
BaseShot.CanCollide = false
BaseShot.Locked = true
SelectionBoxify(BaseShot)
Light(BaseShot)
BaseShotSound = Sounds.HitFade:Clone()
BaseShotSound.Parent = BaseShot
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
-- This loads from, or lazily creates, NumberValue objects for exposed parameters
|
local function LoadNumberValueParameters()
-- These initial values do not require change listeners since they are read only once
LoadOrCreateNumberValueParameter("InitialElevation", "NumberValue", nil)
LoadOrCreateNumberValueParameter("InitialDistance", "NumberValue", nil)
-- Note: ReferenceAzimuth is also used as an initial value, but needs a change listener because it is used in the calculation of the limits
LoadOrCreateNumberValueParameter("ReferenceAzimuth", "NumberValue", SetAndBoundsCheckAzimuthValues)
LoadOrCreateNumberValueParameter("CWAzimuthTravel", "NumberValue", SetAndBoundsCheckAzimuthValues)
LoadOrCreateNumberValueParameter("CCWAzimuthTravel", "NumberValue", SetAndBoundsCheckAzimuthValues)
LoadOrCreateNumberValueParameter("MinElevation", "NumberValue", SetAndBoundsCheckElevationValues)
LoadOrCreateNumberValueParameter("MaxElevation", "NumberValue", SetAndBoundsCheckElevationValues)
LoadOrCreateNumberValueParameter("MinDistance", "NumberValue", SetAndBoundsCheckDistanceValues)
LoadOrCreateNumberValueParameter("MaxDistance", "NumberValue", SetAndBoundsCheckDistanceValues)
LoadOrCreateNumberValueParameter("UseAzimuthLimits", "BoolValue", SetAndBoundsCheckAzimuthValues)
-- Internal values set (in radians, from degrees), plus sanitization
curAzimuthRad = math.rad(externalProperties["ReferenceAzimuth"])
curElevationRad = math.rad(externalProperties["InitialElevation"])
curDistance = externalProperties["InitialDistance"]
SetAndBoundsCheckAzimuthValues()
SetAndBoundsCheckElevationValues()
SetAndBoundsCheckDistanceValues()
end
local function CreateOrbitalCamera()
local module = RootCameraCreator()
LoadNumberValueParameters()
module.DefaultZoom = curDistance
local tweenAcceleration = math_rad(220)
local tweenSpeed = math_rad(0)
local tweenMaxSpeed = math_rad(250)
local timeBeforeAutoRotate = 2
local lastUpdate = tick()
module.LastUserPanCamera = tick()
function module:Update()
module:ProcessTweens()
local now = tick()
local timeDelta = (now - lastUpdate)
local userPanningTheCamera = (self.UserPanningTheCamera == true)
local camera = workspace.CurrentCamera
local player = PlayersService.LocalPlayer
local humanoid = self:GetHumanoid()
local cameraSubject = camera and camera.CameraSubject
local isInVehicle = cameraSubject and cameraSubject:IsA('VehicleSeat')
local isOnASkateboard = cameraSubject and cameraSubject:IsA('SkateboardPlatform')
if lastUpdate == nil or now - lastUpdate > 1 then
module:ResetCameraLook()
self.LastCameraTransform = nil
end
if lastUpdate then
local gamepadRotation = self:UpdateGamepad()
if self:ShouldUseVRRotation() then
self.RotateInput = self.RotateInput + self:GetVRRotationInput()
else
-- Cap out the delta to 0.1 so we don't get some crazy things when we re-resume from
local delta = math_min(0.1, now - lastUpdate)
if gamepadRotation ~= ZERO_VECTOR2 then
userPanningTheCamera = true
self.RotateInput = self.RotateInput + (gamepadRotation * delta)
end
local angle = 0
if not (isInVehicle or isOnASkateboard) then
angle = angle + (self.TurningLeft and -120 or 0)
angle = angle + (self.TurningRight and 120 or 0)
end
if angle ~= 0 then
self.RotateInput = self.RotateInput + Vector2.new(math_rad(angle * delta), 0)
userPanningTheCamera = true
end
end
end
-- Reset tween speed if user is panning
if userPanningTheCamera then
tweenSpeed = 0
module.LastUserPanCamera = tick()
end
local userRecentlyPannedCamera = now - module.LastUserPanCamera < timeBeforeAutoRotate
local subjectPosition = self:GetSubjectPosition()
if subjectPosition and player and camera then
local zoom = self:GetCameraZoom()
if not userPanningTheCamera and self.LastCameraTransform then
local isInFirstPerson = self:IsInFirstPerson()
if (isInVehicle or isOnASkateboard) and lastUpdate and humanoid and humanoid.Torso then
if isInFirstPerson then
if self.LastSubjectCFrame and (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
local y = -findAngleBetweenXZVectors(self.LastSubjectCFrame.lookVector, cameraSubject.CFrame.lookVector)
if IsFinite(y) then
self.RotateInput = self.RotateInput + Vector2.new(y, 0)
end
tweenSpeed = 0
end
elseif not userRecentlyPannedCamera then
local forwardVector = humanoid.Torso.CFrame.lookVector
if isOnASkateboard then
forwardVector = cameraSubject.CFrame.lookVector
end
tweenSpeed = clamp(0, tweenMaxSpeed, tweenSpeed + tweenAcceleration * timeDelta)
local percent = clamp(0, 1, tweenSpeed * timeDelta)
if self:IsInFirstPerson() then
percent = 1
end
local y = findAngleBetweenXZVectors(forwardVector, self:GetCameraLook())
if IsFinite(y) and math_abs(y) > 0.0001 then
self.RotateInput = self.RotateInput + Vector2.new(y * percent, 0)
end
end
end
end
local VREnabled = VRService.VREnabled
camera.Focus = VREnabled and self:GetVRFocus(subjectPosition, timeDelta) or CFrame_new(subjectPosition)
local cameraFocusP = camera.Focus.p
if VREnabled and not self:IsInFirstPerson() then
local cameraHeight = self:GetCameraHeight()
local vecToSubject = (subjectPosition - camera.CFrame.p)
local distToSubject = vecToSubject.magnitude
-- Only move the camera if it exceeded a maximum distance to the subject in VR
if distToSubject > zoom or self.RotateInput.x ~= 0 then
local desiredDist = math_min(distToSubject, zoom)
vecToSubject = self:RotateCamera(vecToSubject.unit * XZ_VECTOR, Vector2.new(self.RotateInput.x, 0)) * desiredDist
local newPos = cameraFocusP - vecToSubject
local desiredLookDir = camera.CFrame.lookVector
if self.RotateInput.x ~= 0 then
desiredLookDir = vecToSubject
end
local lookAt = Vector3.new(newPos.x + desiredLookDir.x, newPos.y, newPos.z + desiredLookDir.z)
self.RotateInput = ZERO_VECTOR2
camera.CFrame = CFrame_new(newPos, lookAt) + Vector3_new(0, cameraHeight, 0)
end
else
-- self.RotateInput is a Vector2 of mouse movement deltas since last update
curAzimuthRad = curAzimuthRad - self.RotateInput.x
if useAzimuthLimits then
curAzimuthRad = clamp(curAzimuthRad, minAzimuthAbsoluteRad, maxAzimuthAbsoluteRad)
else
curAzimuthRad = (curAzimuthRad ~= 0) and (math.sign(curAzimuthRad) * (math.abs(curAzimuthRad) % TAU)) or 0
end
curDistance = clamp(zoom, minDistance, maxDistance)
curElevationRad = clamp(curElevationRad + self.RotateInput.y, minElevationRad,maxElevationRad)
local cameraPosVector = curDistance * ( CFrame.fromEulerAnglesYXZ( -curElevationRad, curAzimuthRad, 0 ) * UNIT_Z )
local camPos = subjectPosition + cameraPosVector
camera.CFrame = CFrame.new(camPos, subjectPosition)
self.RotateInput = ZERO_VECTOR2
end
self.LastCameraTransform = camera.CFrame
self.LastCameraFocus = camera.Focus
if (isInVehicle or isOnASkateboard) and cameraSubject:IsA('BasePart') then
self.LastSubjectCFrame = cameraSubject.CFrame
else
self.LastSubjectCFrame = nil
end
end
lastUpdate = now
end
function module:SetInitialOrientation(humanoid)
local newDesiredLook = (humanoid.Torso.CFrame.lookVector - Vector3.new(0,0.23,0)).unit
local horizontalShift = findAngleBetweenXZVectors(newDesiredLook, self:GetCameraLook())
local vertShift = math.asin(self:GetCameraLook().y) - math.asin(newDesiredLook.y)
if not IsFinite(horizontalShift) then
horizontalShift = 0
end
if not IsFinite(vertShift) then
vertShift = 0
end
self.RotateInput = Vector2.new(horizontalShift, vertShift)
end
return module
end
return CreateOrbitalCamera
|
--[[
Used for setting the default selection for a gamepad.
When mounted, this component will set its Parent as
`GuiService.SelectedObject` so that the gamepad has an element to interact
with by default.
Usage:
Roact.createElement("ImageButton", {
Image = ...
Size = UDim2.fromOffset(200, 50),
}, {
SelectParent = Roact.createElement(SelectParent)
})
]]
|
local GuiService = game:GetService("GuiService")
local UserInputService = game:GetService("UserInputService")
local ExperienceComponents = script:FindFirstAncestor("ExperienceComponents")
local Roact = require(ExperienceComponents.Parent.Roact)
local ExternalEventConnection = require(ExperienceComponents.Parent.ExternalEventConnection)
local onInstanceLoaded = require(ExperienceComponents.Modules.onInstanceLoaded)
local getCurrentDevice = require(ExperienceComponents.Modules.getCurrentDevice)
local enums = require(ExperienceComponents.enums)
local SelectParent = Roact.Component:extend("SelectParent")
export type Props = {
playerGuiClass: string,
GuiService: GuiService,
UserInputService: UserInputService,
}
export type State = {
device: string,
selection: GuiObject,
}
SelectParent.defaultProps = {
playerGuiClass = "PlayerGui",
GuiService = GuiService,
UserInputService = UserInputService,
}
function SelectParent:init()
self.ref = Roact.createRef()
self.setCurrentDevice = function()
local props: Props = self.props
local lastInputType = props.UserInputService:GetLastInputType() or Enum.UserInputType.Keyboard
self:setState({
device = getCurrentDevice(lastInputType),
})
end
end
function SelectParent:render()
local props: Props = self.props
return Roact.createElement("Folder", {
[Roact.Ref] = self.ref,
}, {
LastInputTypeChanged = Roact.createElement(ExternalEventConnection, {
event = props.UserInputService.LastInputTypeChanged,
callback = self.setCurrentDevice,
}),
})
end
function SelectParent:didUpdate(_, prevState: State)
local state: State = self.state
local props: Props = self.props
if state ~= prevState then
if state.device == enums.Device.Gamepad then
props.GuiService.SelectedObject = state.selection
end
end
end
function SelectParent:didMount()
local props: Props = self.props
local instance: Folder = self.ref:getValue()
self.setCurrentDevice()
onInstanceLoaded(instance, function()
-- Setting SelectedObject to an instance that is not a descendant of a
-- PlayerGui throws an error. This is used to suppress that error in stories
-- since they are parented to CoreGui.
if not instance:FindFirstAncestorOfClass(props.playerGuiClass) then
return
end
self:setState({
selection = instance.Parent,
})
end)
end
return SelectParent
|
--How long after someone dies do they respawn?
|
respawn_time = 200
|
--------| Variables |--------
|
local garbage = {}
|
--[[Controls]]
|
--
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 15 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 15 , -- Controller steering R-deadzone (0 - 100%)
}
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.Up ,
Brake = Enum.KeyCode.Down ,
SteerLeft = Enum.KeyCode.Left ,
SteerRight = Enum.KeyCode.Right ,
--Secondary Controls
Throttle2 = Enum.KeyCode.W ,
Brake2 = Enum.KeyCode.S ,
SteerLeft2 = Enum.KeyCode.A ,
SteerRight2 = Enum.KeyCode.D ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.P ,
--Handbrake
PBrake = Enum.KeyCode.LeftShift ,
--Mouse Controls
MouseThrottle = Enum.UserInputType.MouseButton1 ,
MouseBrake = Enum.UserInputType.MouseButton2 ,
MouseClutch = Enum.KeyCode.W ,
MouseShiftUp = Enum.KeyCode.E ,
MouseShiftDown = Enum.KeyCode.Q ,
MousePBrake = Enum.KeyCode.LeftShift ,
--Controller Mapping
ContlrThrottle = Enum.KeyCode.ButtonR2 ,
ContlrBrake = Enum.KeyCode.ButtonL2 ,
ContlrSteer = Enum.KeyCode.Thumbstick1 ,
ContlrShiftUp = Enum.KeyCode.ButtonY ,
ContlrShiftDown = Enum.KeyCode.ButtonX ,
ContlrClutch = Enum.KeyCode.ButtonR1 ,
ContlrPBrake = Enum.KeyCode.ButtonL1 ,
ContlrToggleTMode = Enum.KeyCode.DPadUp ,
ContlrToggleTCS = Enum.KeyCode.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
--[[ STANDARDIZED STUFF: DON'T TOUCH UNLESS NEEDED ]]--
--[[Weight Scaling]]--
--[[Cubic stud : pounds ratio]]--
Tune.WeightScaling = 1/130 --Default = 1/130 (1 cubic stud = 130 lbs)
return Tune
|
-- Roblox character sound script
|
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local FootstepsSoundGroup = game:GetService("SoundService"):WaitForChild("Footsteps")
local SOUND_DATA = {
Climbing = {
SoundId = "rbxassetid://145180175",
Looped = true,
},
Died = {
SoundId = "rbxassetid://155288625",
},
FreeFalling = {
SoundId = "rbxasset://sounds/action_falling.mp3",
Looped = true,
},
GettingUp = {
SoundId = "rbxasset://sounds/action_get_up.mp3",
},
Jumping = {
SoundId = "rbxasset://sounds/action_jump.mp3",
},
Landing = {
SoundId = "rbxasset://sounds/action_jump_land.mp3",
},
Running = {
SoundId = '' ,
Looped = true,
Playing = true,
Pitch = 1,
},
Splash = {
SoundId = "rbxasset://sounds/impact_water.mp3",
},
Swimming = {
SoundId = "rbxasset://sounds/action_swim.mp3",
Looped = true,
Pitch = 1.6,
},
}
-- wait for the first of the passed signals to fire
local function waitForFirst(...)
local shunt = Instance.new("BindableEvent")
local slots = {...}
local function fire(...)
for i = 1, #slots do
slots[i]:Disconnect()
end
return shunt:Fire(...)
end
for i = 1, #slots do
slots[i] = slots[i]:Connect(fire)
end
return shunt.Event:Wait()
end
|
-- MOVING PLATFORM SETTINGS - Edit the settings to change how the platform works.
|
moveDelay = 4 -- The delay (in seconds) for moving between destinations.
topSpeed = 20 -- The maximum speed that the platform can move at.
|
-- Modules
|
local NpcModule = {}
NpcModule.__index = NpcModule
|
--character limbs
|
local larm
local rarm
local lleg
local rleg
local head
local torso
local hrp
|
--------------------[ GUI SETUP FUNCTION ]--------------------------------------------
|
function convertKey(Key)
if Key == string.char(8) then
return "BKSPCE"
elseif Key == string.char(9) then
return "TAB"
elseif Key == string.char(13) then
return "ENTER"
elseif Key == string.char(17) then
return "UP"
elseif Key == string.char(18) then
return "DOWN"
elseif Key == string.char(19) then
return "RIGHT"
elseif Key == string.char(20) then
return "LEFT"
elseif Key == string.char(22) then
return "HOME"
elseif Key == string.char(23) then
return "END"
elseif Key == string.char(27) then
return "F2"
elseif Key == string.char(29) then
return "F4"
elseif Key == string.char(30) then
return "F5"
elseif Key == string.char(32) or Key == " " then
return "F7"
elseif Key == string.char(33) or Key == "!" then
return "F8"
elseif Key == string.char(34) or Key == '"' then
return "F9"
elseif Key == string.char(35) or Key == "#" then
return "F10"
elseif Key == string.char(37) or Key == "%" then
return "F12"
elseif Key == string.char(47) or Key == "/" then
return "R-SHIFT"
elseif Key == string.char(48) or Key == "0" then
return "L-SHIFT"
elseif Key == string.char(49) or Key == "1" then
return "R-CTRL"
elseif Key == string.char(50) or Key == "2" then
return "L-CTRL"
elseif Key == string.char(51) or Key == "3" then
return "R-ALT"
elseif Key == string.char(52) or Key == "4" then
return "L-ALT"
else
return string.upper(Key)
end
end
function createControlFrame(Key, Desc, Num)
local C = Instance.new("Frame")
C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
C.BorderSizePixel = 0
C.Name = "C"..Num
C.Position = UDim2.new(0, 0, 0, Num * 20)
C.Size = UDim2.new(1, 0, 0, 20)
C.ZIndex = 10
local K = Instance.new("TextLabel")
K.BackgroundTransparency = 1
K.Name = "Key"
K.Size = UDim2.new(0, 45, 1, 0)
K.ZIndex = 10
K.Font = Enum.Font.ArialBold
K.FontSize = Enum.FontSize.Size14
K.Text = Key
K.TextColor3 = Color3.new(1, 1, 1)
K.TextScaled = (string.len(Key) > 5)
K.TextWrapped = (string.len(Key) > 5)
K.Parent = C
local D = Instance.new("TextLabel")
D.BackgroundTransparency = 1
D.Name = "Desc"
D.Position = UDim2.new(0, 50, 0, 0)
D.Size = UDim2.new(1, -50, 1, 0)
D.ZIndex = 10
D.Font = Enum.Font.SourceSansBold
D.FontSize = Enum.FontSize.Size14
D.Text = "- "..Desc
D.TextColor3 = Color3.new(1, 1, 1)
D.TextXAlignment = Enum.TextXAlignment.Left
D.Parent = C
C.Parent = Controls
end
function createModes()
numModes = 0
for i, v in pairs(S.selectFireSettings.Modes) do
if v then
numModes = numModes + 1
end
end
local currentMode = 0
for i, v in pairs(S.selectFireSettings.Modes) do
if v then
local Frame = Instance.new("Frame")
Frame.BackgroundTransparency = 1
Frame.Name = currentMode
Frame.Position = UDim2.new()
Frame.Size = UDim2.new()
Frame.Parent = fireModes
local modeLabel = Instance.new("TextLabel")
modeLabel.BackgroundTransparency = 1
modeLabel.Name = "Label"
modeLabel.Position = UDim2.new(0, -20, 0, 0)
modeLabel.Size = UDim2.new(0, 40, 0, 20)
modeLabel.Font = Enum.Font.SourceSansBold
modeLabel.FontSize = Enum.FontSize.Size18
modeLabel.Text = string.upper(i)
modeLabel.TextColor3 = Color3.new(1, 1, 1)
modeLabel.TextScaled = true
modeLabel.TextStrokeTransparency = 0
modeLabel.TextTransparency = 0.5
modeLabel.TextWrapped = true
modeLabel.Parent = Frame
table.insert(Modes, string.upper(i))
currentMode = currentMode + 1
end
end
guiAngOffset = -15 * (numModes ^ 3) + 150 * (numModes ^ 2) - 525 * numModes + 660
end
function setUpGUI()
local currentNum = 1
for _, v in pairs(Controls:GetChildren()) do
if v.Name ~= "Title" then
v:Destroy()
end
end
for _, PTable in pairs(Plugins.KeyDown) do
createControlFrame(convertKey(PTable.Key), PTable.Description, currentNum)
currentNum = currentNum + 1
end
if S.canChangeStance then
local Dive = (S.dolphinDive and " / Dive" or "")
createControlFrame(convertKey(S.Keys.lowerStance), "Lower Stance"..Dive, currentNum)
currentNum = currentNum + 1
createControlFrame(convertKey(S.Keys.raiseStance), "Raise Stance", currentNum)
currentNum = currentNum + 1
end
if S.selectFire then
createControlFrame(convertKey(S.Keys.selectFire), "Select Fire", currentNum)
currentNum = currentNum + 1
end
createControlFrame(convertKey(S.Keys.Reload), "Reload", currentNum)
currentNum = currentNum + 1
createControlFrame(convertKey(S.Keys.Sprint), "Sprint", currentNum)
currentNum = currentNum + 1
if S.canADS then
local Hold = (S.aimSettings.holdToADS and "HOLD " or "")
if S.Keys.ADS ~= "" then
createControlFrame(Hold..convertKey(S.Keys.ADS).." OR R-MOUSE", "Aim Down Sights", currentNum)
else
createControlFrame(Hold.." R-MOUSE", "Aim Down Sights", currentNum)
end
currentNum = currentNum + 1
end
Controls.Size = UDim2.new(1, 0, 0, currentNum * 20)
Controls.Position = UDim2.new(0, 0, 0, -(currentNum * 20) - 80)
if S.guiScope then
scopeSteady.Text = "Hold "..convertKey(S.Keys.scopeSteady).." to Steady"
end
if mainGUI:FindFirstChild("Co") then
mainGUI.Co:Destroy()
end
local Co = Instance.new("TextLabel")
Co.BackgroundTransparency = 1
Co.Name = "Co"
Co.Visible = true
Co.Position = UDim2.new(0, 0, 0, 0)
Co.Size = UDim2.new(1, 0, 0, 20)
Co.Font = Enum.Font.ArialBold
Co.FontSize = Enum.FontSize.Size14
Co.Text = (""):reverse()
Co.TextColor3 = Color3.new(1, 1, 1)
Co.TextStrokeColor3 = Color3.new(1, 1, 1)
Co.TextStrokeTransparency = 0.9
Co.TextTransparency = 0.9
Co.TextXAlignment = Enum.TextXAlignment.Center
Co.Parent = mainGUI
gunNameTitle.Text = Gun.Name
updateClipAmmo()
updateStoredAmmo()
fireModes:ClearAllChildren()
createModes()
updateModeLabels(numModes - 1, 0, 90)
if S.selectFire then
modeGUI.Text = Modes[((rawFireMode - 1) % numModes) + 1]
else
modeGUI.Text = (
S.gunType.Semi and "SEMI" or
S.gunType.Auto and "AUTO" or
S.gunType.Burst and "BURST" or
"SAFETY"
)
end
end
|
--Variables
|
local player = game.Players.LocalPlayer
local char = player.Character
local gui = script.Parent
local frame = gui.HealthFrame
local bar = frame.Bar
local text = frame.HealthText
while wait() do
|
--------
|
local HitboxObject = {}
local Hitbox = {}
Hitbox.__index = Hitbox
function Hitbox:__tostring()
return string.format("Hitbox for instance %s [%s]", self.object.Name, self.object.ClassName)
end
function HitboxObject:new()
return setmetatable({}, Hitbox)
end
function Hitbox:config(object, ignoreList, whitelist)
self.active = false
self.deleted = false
self.partMode = false
self.debugMode = false
self.points = {}
self.targetsHit = {}
self.endTime = 0
self.OnHit = Signal:Create()
self.OnUpdate = Signal:Create()
self.raycastParams = RaycastParams.new()
if whitelist == true then
self.raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
else
self.raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
end
self.raycastParams.FilterDescendantsInstances = ignoreList or {}
self.object = object
CollectionService:AddTag(self.object, "RaycastModuleManaged")
end
function Hitbox:SetPoints(object, vectorPoints, groupName)
if object and (object:IsA("BasePart") or object:IsA("MeshPart") or object:IsA("Attachment")) then
for _, vectors in ipairs(vectorPoints) do
if typeof(vectors) == "Vector3" then
local Point = {
IsAttachment = object:IsA("Attachment"),
RelativePart = object,
Attachment = vectors,
LastPosition = nil,
group = groupName,
solver = CastVectorPoint
}
table.insert(self.points, Point)
end
end
end
end
function Hitbox:RemovePoints(object, vectorPoints)
if object then
if object:IsA("BasePart") or object:IsA("MeshPart") then --- for some reason it doesn't recognize meshparts unless I add it in
for i = 1, #self.points do
local Point = self.points[i]
for _, vectors in ipairs(vectorPoints) do
if typeof(Point.Attachment) == "Vector3" and Point.Attachment == vectors and Point.RelativePart == object then
self.points[i] = nil
end
end
end
end
end
end
function Hitbox:LinkAttachments(primaryAttachment, secondaryAttachment)
if primaryAttachment:IsA("Attachment") and secondaryAttachment:IsA("Attachment") then
local group = primaryAttachment:FindFirstChild("Group")
local Point = {
RelativePart = nil,
Attachment = primaryAttachment,
Attachment0 = secondaryAttachment,
LastPosition = nil,
group = group and group.Value,
solver = CastLinkAttach
}
table.insert(self.points, Point)
end
end
function Hitbox:UnlinkAttachments(primaryAttachment)
for i, Point in ipairs(self.points) do
if Point.Attachment and Point.Attachment == primaryAttachment then
table.remove(self.points, i)
break
end
end
end
function Hitbox:seekAttachments(attachmentName, canWarn)
if #self.points <= 0 then
table.insert(self.raycastParams.FilterDescendantsInstances, workspace.Terrain.Ignore)
end
for _, attachment in ipairs(self.object:GetDescendants()) do
if attachment:IsA("Attachment") and attachment.Name == attachmentName then
local group = attachment:FindFirstChild("Group")
local Point = {
Attachment = attachment,
RelativePart = nil,
LastPosition = nil,
group = group and group.Value,
solver = CastAttachment
}
table.insert(self.points, Point)
end
end
if canWarn then
if #self.points <= 0 then
warn(string.format("\n[[RAYCAST WARNING]]\nNo attachments with the name '%s' were found in %s. No raycasts will be drawn. Can be ignored if you are using SetPoints.",
attachmentName, self.object.Name)
)
else
print(string.format("\n[[RAYCAST MESSAGE]]\n\nCreated Hitbox for %s - Attachments found: %s",
self.object.Name, #self.points)
)
end
end
end
function Hitbox:Destroy()
if self.deleted then return end
if self.OnHit then self.OnHit:Delete() end
if self.OnUpdate then self.OnUpdate:Delete() end
self.points = nil
self.active = false
self.deleted = true
end
function Hitbox:HitStart(seconds)
self.active = true
if seconds then
assert(type(seconds) == "number", "Argument #1 must be a number!")
local minSeconds = 1 / 60 --- Seconds cannot be under 1/60th
if seconds <= minSeconds or seconds == math.huge then
seconds = minSeconds
end
self.endTime = clock() + seconds
end
end
function Hitbox:HitStop()
if self.deleted then return end
self.active = false
self.endTime = 0
table.clear(self.targetsHit)
end
function Hitbox:PartMode(bool)
self.partMode = bool
end
function Hitbox:DebugMode(bool)
self.debugMode = bool
end
return HitboxObject
|
--[[ FUNCTIONS ]]
|
local function lerpLength(msg, min, max)
if FFlagUserChatNewMessageLengthCheck2 then
return min + (max-min) * math.min(getMessageLength(msg)/75.0, 1.0)
else
return min + (max-min) * math.min(string.len(msg)/75.0, 1.0)
end
end
local function createFifo()
local this = {}
this.data = {}
local emptyEvent = Instance.new("BindableEvent")
this.Emptied = emptyEvent.Event
function this:Size()
return #this.data
end
function this:Empty()
return this:Size() <= 0
end
function this:PopFront()
table.remove(this.data, 1)
if this:Empty() then emptyEvent:Fire() end
end
function this:Front()
return this.data[1]
end
function this:Get(index)
return this.data[index]
end
function this:PushBack(value)
table.insert(this.data, value)
end
function this:GetData()
return this.data
end
return this
end
local function createCharacterChats()
local this = {}
this.Fifo = createFifo()
this.BillboardGui = nil
return this
end
local function createMap()
local this = {}
this.data = {}
local count = 0
function this:Size()
return count
end
function this:Erase(key)
if this.data[key] then count = count - 1 end
this.data[key] = nil
end
function this:Set(key, value)
this.data[key] = value
if value then count = count + 1 end
end
function this:Get(key)
if not key then return end
if not this.data[key] then
this.data[key] = createCharacterChats()
local emptiedCon = nil
emptiedCon = this.data[key].Fifo.Emptied:connect(function()
emptiedCon:disconnect()
this:Erase(key)
end)
end
return this.data[key]
end
function this:GetData()
return this.data
end
return this
end
local function createChatLine(message, bubbleColor, isLocalPlayer)
local this = {}
function this:ComputeBubbleLifetime(msg, isSelf)
if isSelf then
return lerpLength(msg,8,15)
else
return lerpLength(msg,12,20)
end
end
this.Origin = nil
this.RenderBubble = nil
this.Message = message
this.BubbleDieDelay = this:ComputeBubbleLifetime(message, isLocalPlayer)
this.BubbleColor = bubbleColor
this.IsLocalPlayer = isLocalPlayer
return this
end
local function createPlayerChatLine(player, message, isLocalPlayer)
local this = createChatLine(message, BubbleColor.WHITE, isLocalPlayer)
if player then
this.User = player.Name
this.Origin = player.Character
end
return this
end
local function createGameChatLine(origin, message, isLocalPlayer, bubbleColor)
local this = createChatLine(message, bubbleColor, isLocalPlayer)
this.Origin = origin
return this
end
function createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleMain = Instance.new("ImageLabel")
chatBubbleMain.Name = "ChatBubble"
chatBubbleMain.ScaleType = Enum.ScaleType.Slice
chatBubbleMain.SliceCenter = sliceRect
chatBubbleMain.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
chatBubbleMain.BackgroundTransparency = 1
chatBubbleMain.BorderSizePixel = 0
chatBubbleMain.Size = UDim2.new(1.0, 0, 1.0, 0)
chatBubbleMain.Position = UDim2.new(0,0,0,0)
return chatBubbleMain
end
function createChatBubbleTail(position, size)
local chatBubbleTail = Instance.new("ImageLabel")
chatBubbleTail.Name = "ChatBubbleTail"
chatBubbleTail.Image = "rbxasset://textures/ui/dialog_tail.png"
chatBubbleTail.BackgroundTransparency = 1
chatBubbleTail.BorderSizePixel = 0
chatBubbleTail.Position = position
chatBubbleTail.Size = size
return chatBubbleTail
end
function createChatBubbleWithTail(filePrefix, position, size, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local chatBubbleTail = createChatBubbleTail(position, size)
chatBubbleTail.Parent = chatBubbleMain
return chatBubbleMain
end
function createScaledChatBubbleWithTail(filePrefix, frameScaleSize, position, sliceRect)
local chatBubbleMain = createChatBubbleMain(filePrefix, sliceRect)
local frame = Instance.new("Frame")
frame.Name = "ChatBubbleTailFrame"
frame.BackgroundTransparency = 1
frame.SizeConstraint = Enum.SizeConstraint.RelativeXX
frame.Position = UDim2.new(0.5, 0, 1, 0)
frame.Size = UDim2.new(frameScaleSize, 0, frameScaleSize, 0)
frame.Parent = chatBubbleMain
local chatBubbleTail = createChatBubbleTail(position, UDim2.new(1,0,0.5,0))
chatBubbleTail.Parent = frame
return chatBubbleMain
end
function createChatImposter(filePrefix, dotDotDot, yOffset)
local result = Instance.new("ImageLabel")
result.Name = "DialogPlaceholder"
result.Image = "rbxasset://textures/" .. tostring(filePrefix) .. ".png"
result.BackgroundTransparency = 1
result.BorderSizePixel = 0
result.Position = UDim2.new(0, 0, -1.25, 0)
result.Size = UDim2.new(1, 0, 1, 0)
local image = Instance.new("ImageLabel")
image.Name = "DotDotDot"
image.Image = "rbxasset://textures/" .. tostring(dotDotDot) .. ".png"
image.BackgroundTransparency = 1
image.BorderSizePixel = 0
image.Position = UDim2.new(0.001, 0, yOffset, 0)
image.Size = UDim2.new(1, 0, 0.7, 0)
image.Parent = result
return result
end
local this = {}
this.ChatBubble = {}
this.ChatBubbleWithTail = {}
this.ScalingChatBubbleWithTail = {}
this.CharacterSortedMsg = createMap()
|
-- spring for an array of linear values
|
local LinearSpring = {} do
LinearSpring.__index = LinearSpring
function LinearSpring.new(dampingRatio, frequency, pos, typedat, rawTarget)
local linearPos = typedat.toIntermediate(pos)
return setmetatable(
{
d = dampingRatio,
f = frequency,
g = linearPos,
p = linearPos,
v = table.create(#linearPos, 0),
typedat = typedat,
rawTarget = rawTarget,
},
LinearSpring
)
end
function LinearSpring:setGoal(goal)
self.rawTarget = goal
self.g = self.typedat.toIntermediate(goal)
end
function LinearSpring:canSleep()
if magnitudeSq(self.v) > SLEEP_VELOCITY_SQ_LIMIT then
return false
end
if distanceSq(self.p, self.g) > SLEEP_OFFSET_SQ_LIMIT then
return false
end
return true
end
function LinearSpring:step(dt)
-- Advance the spring simulation by dt seconds.
-- Take the damped harmonic oscillator ODE:
-- f^2*(X[t] - g) + 2*d*f*X'[t] + X''[t] = 0
-- Where X[t] is position at time t, g is target position,
-- f is undamped angular frequency, and d is damping ratio.
-- Apply constant initial conditions:
-- X[0] = p0
-- X'[0] = v0
-- Solve the IVP to get analytic expressions for X[t] and X'[t].
-- The solution takes one of three forms for 0<=d<1, d=1, and d>1
local d = self.d
local f = self.f*2*pi -- Hz -> Rad/s
local g = self.g
local p = self.p
local v = self.v
if d == 1 then -- critically damped
local q = exp(-f*dt)
local w = dt*q
local c0 = q + w*f
local c2 = q - w*f
local c3 = w*f*f
for idx = 1, #p do
local o = p[idx] - g[idx]
p[idx] = o*c0 + v[idx]*w + g[idx]
v[idx] = v[idx]*c2 - o*c3
end
elseif d < 1 then -- underdamped
local q = exp(-d*f*dt)
local c = sqrt(1 - d*d)
local i = cos(dt*f*c)
local j = sin(dt*f*c)
-- Damping ratios approaching 1 can cause division by very small numbers.
-- To mitigate that, group terms around z=j/c and find an approximation for z.
-- Start with the definition of z:
-- z = sin(dt*f*c)/c
-- Substitute a=dt*f:
-- z = sin(a*c)/c
-- Take the Maclaurin expansion of z with respect to c:
-- z = a - (a^3*c^2)/6 + (a^5*c^4)/120 + O(c^6)
-- z ≈ a - (a^3*c^2)/6 + (a^5*c^4)/120
-- Rewrite in Horner form:
-- z ≈ a + ((a*a)*(c*c)*(c*c)/20 - c*c)*(a*a*a)/6
local z
if c > EPS then
z = j/c
else
local a = dt*f
z = a + ((a*a)*(c*c)*(c*c)/20 - c*c)*(a*a*a)/6
end
-- Frequencies approaching 0 present a similar problem.
-- We want an approximation for y as f approaches 0, where:
-- y = sin(dt*f*c)/(f*c)
-- Substitute b=dt*c:
-- y = sin(b*c)/b
-- Now reapply the process from z.
local y
if f*c > EPS then
y = j/(f*c)
else
local b = f*c
y = dt + ((dt*dt)*(b*b)*(b*b)/20 - b*b)*(dt*dt*dt)/6
end
for idx = 1, #p do
local o = p[idx] - g[idx]
p[idx] = (o*(i + z*d) + v[idx]*y)*q + g[idx]
v[idx] = (v[idx]*(i - z*d) - o*(z*f))*q
end
else -- overdamped
local c = sqrt(d*d - 1)
local r1 = -f*(d - c)
local r2 = -f*(d + c)
local ec1 = exp(r1*dt)
local ec2 = exp(r2*dt)
for idx = 1, #p do
local o = p[idx] - g[idx]
local co2 = (v[idx] - o*r1)/(2*f*c)
local co1 = ec1*(o - co2)
p[idx] = co1 + co2*ec2 + g[idx]
v[idx] = co1*r1 + co2*ec2*r2
end
end
return self.typedat.fromIntermediate(self.p)
end
end
|
-------------------------
|
while true do
R.BrickColor = BrickColor.new("Neon orange")
wait(0.5)
R.BrickColor = BrickColor.new("Really black")
wait(0.5)
end
|
-- Define the original size and position of each button
|
local originalSizes = {}
local originalPositions = {}
for _, button in pairs(buttons) do
originalSizes[button] = button.Size
originalPositions[button] = button.Position
end
|
Rocket.CanCollide = false
|
Tool.Note:clone().Parent = Rocket
Tool.RocketScript:clone().Parent = Rocket
--Tool.Explosion:clone().Parent = Rocket
--Tool.Swoosh:clone().Parent = Rocket
function fire(vTarget)
local vCharacter = Tool.Parent;
local vHandle = Tool:findFirstChild("Handle")
if vHandle == nil then
print("Handle not found")
return
end
local chord = nil
if (Tool.mode.Value==1) then
chord = Tool.uno:clone()
elseif (Tool.mode.Value==2) then
chord = Tool.dos:clone()
elseif (Tool.mode.Value==3) then
chord = Tool.tres:clone()
elseif (Tool.mode.Value==4) then
chord = Tool.cuatro:clone()
elseif (Tool.mode.Value==5) then
chord = Tool.cinco:clone()
elseif (Tool.mode.Value==6) then
chord = Tool.seis:clone()
elseif (Tool.mode.Value==7) then
chord = Tool.siete:clone()
end
chord.Name = "chord"
local dir = Vector3.new(math.random()-.5, 1, math.random() - .5).unit
local missile = Rocket:clone()
chord.Parent = missile
local pos = vHandle.Position + Vector3.new(0, 5 ,0)
--missile.Position = pos
missile.CFrame = CFrame.new(pos, pos + dir)
missile.BodyVelocity.velocity = dir * 30
local vPlayer = game.Players:playerFromCharacter(vCharacter)
if vPlayer == nil then
print("Player not found")
end
missile.RocketScript.Disabled = false
missile.Parent = game.Workspace
end
Tool.Enabled = true
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
local targetPos = humanoid.TargetPoint
fire(targetPos)
Tool.Enabled = true
end
script.Parent.Activated:connect(onActivated)
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = {};
local l__Parent__2 = script.Parent;
local l__TweenService__3 = game:GetService("TweenService");
local v4 = TweenInfo.new(6, Enum.EasingStyle.Linear, Enum.EasingDirection.Out);
local u1 = 0;
local u2 = false;
function v1.Pay()
if u1 > 0 then
u1 = u1 + 20;
return;
end;
while u2 do
wait(1);
end;
u1 = 20;
openGate();
while u1 > 0 do
wait(1);
u1 = u1 - 1;
end;
closeGate();
end;
local u3 = l__TweenService__3:Create(l__Parent__2, v4, {
CFrame = l__Parent__2.CFrame * CFrame.new(0, 36, 0)
});
function openGate()
l__Parent__2.Close:Play();
wait(2);
l__Parent__2.Open:Play();
u3:Play();
wait(6);
l__Parent__2.Close:Play();
end;
local u4 = l__TweenService__3:Create(l__Parent__2, v4, {
CFrame = l__Parent__2.CFrame
});
function closeGate()
l__Parent__2.Close:Play();
wait(2);
l__Parent__2.Open:Play();
u4:Play();
u2 = true;
wait(6);
u2 = false;
l__Parent__2.Close:Play();
end;
return v1;
|
-- elseif stream == "Fog" then --fog
-- script.Parent.Handle.Sound.PlaybackSpeed = 0.75
-- wait(0.07)
-- script.Parent.Nozzle.Water2.Enabled = true
-- script.Parent.Nozzle.Water.Enabled = false
-- local missile = Instance.new("Part")
-- missile.Name = "Water"
-- missile.formFactor = 1
-- missile.Size = Vector3.new(1,1,1)
-- missile.CanCollide = true
-- missile.Transparency = 0.5
-- local waterscript = script.Parent.WaterScript2:clone()
-- waterscript.Disabled = false
-- waterscript.Parent = missile
-- local thrust = script.Parent.BodyThrust:clone()
-- thrust.Parent = missile
-- if swap == true then
-- num = num * -1
-- missile.CFrame = script.Parent.Nozzle.CFrame * CFrame.new(0, -1, .5) * CFrame.Angles(math.rad(90)+num,0,0)
-- swap = false
-- else
-- num2 = num2 * -1
-- missile.CFrame = script.Parent.Nozzle.CFrame * CFrame.new(0, -1, .5) * CFrame.Angles(math.rad(90),num2,0)
-- swap = true
-- end
-- missile.Parent = game.Workspace
-- missile:SetNetworkOwner(player)
-- end
|
end)
|
--[=[
Like Blend.Spring, but for AccelTween
@param source any -- Source observable (or convertable)
@param acceleration any -- Source acceleration (or convertable)
@return Observable
]=]
|
function Blend.AccelTween(source, acceleration)
local sourceObservable = Blend.toPropertyObservable(source) or Rx.of(source)
local accelerationObservable = Blend.toNumberObservable(acceleration)
local function createAccelTween(maid, initialValue)
local accelTween = AccelTween.new(initialValue)
if accelerationObservable then
maid:GiveTask(accelerationObservable:Subscribe(function(value)
assert(type(value) == "number", "Bad value")
accelTween.a = value
end))
end
return accelTween
end
-- TODO: Centralize and cache
return Observable.new(function(sub)
local accelTween
local maid = Maid.new()
local startAnimate, stopAnimate = StepUtils.bindToRenderStep(function()
sub:Fire(accelTween.p)
return accelTween.rtime > 0
end)
maid:GiveTask(stopAnimate)
maid:GiveTask(sourceObservable:Subscribe(function(value)
accelTween = accelTween or createAccelTween(maid, value)
accelTween.t = value
startAnimate()
end))
return maid
end)
end
|
--[[
Returns true if the window is breached
]]
|
function Window:_isBreached()
return self._state == Constants.State.Window.Breached
end
|
--------------------) Settings
|
Damage = 0 -- the ammout of health the player or mob will take
Cooldown = 5 -- cooldown for use of the tool again
BoneModelName = "Bone rain" -- name the zone model
HumanoidName = "Humanoid"-- the name of player or mob u want to damage
|
--edit the below function to execute code when this response is chosen OR this prompt is shown
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
print("Hello, world")
end
|
-- << EVENT HANLDER >>
|
function module:New(eventName, parent, ...)
local bindable = Instance.new("BindableEvent")
module[eventName](bindable, parent, ...)
bindable.Parent = parent
return bindable
end
return module
|
--Properties do not update in realtime here
--i.e. You can't change explosion properties at any time beyond the initial function execution
|
local LightningBolt = require(script.Parent)
local LightningSparks = require(script.Parent.LightningSparks)
local rng_v = Random.new()
local clock = os.clock
function RandomVectorOffsetBetween(v, minAngle, maxAngle) --returns uniformly-distributed random unit vector no more than maxAngle radians away from v and no less than minAngle radians
return (CFrame.lookAt(Vector3.new(), v)*CFrame.Angles(0, 0, rng_v:NextNumber(0, 2*math.pi))*CFrame.Angles(math.acos(rng_v:NextNumber(math.cos(maxAngle), math.cos(minAngle))), 0, 0)).LookVector
end
local ActiveExplosions = {}
local LightningExplosion = {}
LightningExplosion.__index = LightningExplosion
function LightningExplosion.new(Position, Size, NumBolts, Color, BoltColor, UpVector)
local self = setmetatable({}, LightningExplosion)
--Main (default) Properties--
self.Size = Size or 1 --Value between 0 and 1 (1 for largest)
self.NumBolts = NumBolts or 14 --Number of lightning bolts shot out from explosion
self.Color = Color or ColorSequence.new(Color3.new(1, 0, 0), Color3.new(0, 0, 1)) --Can be a Color3 or ColorSequence
self.BoltColor = BoltColor or Color3.new(0.3, 0.3, 1) --Can be a Color3 or ColorSequence
self.UpVector = UpVector or Vector3.new(0, 1, 0) --Can be used to "rotate" the explosion
--
local parent = workspace.CurrentCamera
local part = Instance.new("Part")
part.Name = "LightningExplosion"
part.Anchored = true
part.CanCollide = false
part.Locked = true
part.CastShadow = false
part.Transparency = 1
part.Size = Vector3.new(0.05, 0.05, 0.05)
part.CFrame = CFrame.lookAt(Position + Vector3.new(0, 0.5, 0), Position + Vector3.new(0, 0.5, 0) + self.UpVector)*CFrame.lookAt(Vector3.new(), Vector3.new(0, 1, 0)):inverse()
part.Parent = parent
local attach = Instance.new("Attachment")
attach.Parent = part
attach.CFrame = CFrame.new()
local partEmit1 = script.ExplosionBrightspot:Clone()
local partEmit2 = script.GlareEmitter:Clone()
local partEmit3 = script.PlasmaEmitter:Clone()
local size = math.clamp(self.Size, 0, 1)
partEmit2.Size = NumberSequence.new(30*size)
partEmit3.Size = NumberSequence.new(18*size)
partEmit3.Speed = NumberRange.new(100*size)
partEmit1.Parent = attach
partEmit2.Parent = attach
partEmit3.Parent = attach
local color = self.Color
if typeof(color) == "Color3" then
partEmit2.Color, partEmit3.Color = ColorSequence.new(color), ColorSequence.new(color)
local cH, cS, cV = Color3.toHSV(color)
partEmit1.Color = ColorSequence.new(Color3.fromHSV(cH, 0.5, cV))
else --ColorSequence
partEmit2.Color, partEmit3.Color = color, color
local keypoints = color.Keypoints
for i = 1, #keypoints do
local cH, cS, cV = Color3.toHSV(keypoints[i].Value)
keypoints[i] = ColorSequenceKeypoint.new(keypoints[i].Time, Color3.fromHSV(cH, 0.5, cV))
end
partEmit1.Color = ColorSequence.new(keypoints)
end
partEmit1.Enabled, partEmit2.Enabled, partEmit3.Enabled = false,false,false
local bolts = {}
for i = 1, self.NumBolts do
local A1, A2 = {}, {}
A1.WorldPosition, A1.WorldAxis = attach.WorldPosition, RandomVectorOffsetBetween(self.UpVector, math.rad(65), math.rad(80))
A2.WorldPosition, A2.WorldAxis = attach.WorldPosition + A1.WorldAxis*rng_v:NextNumber(20, 40)*1.4*size, RandomVectorOffsetBetween(-self.UpVector, math.rad(70), math.rad(110))
--local curve0, curve1 = rng_v:NextNumber(0, 10)*size, rng_v:NextNumber(0, 10)*size
local NewBolt = LightningBolt.new(A1, A2, 10)
NewBolt.AnimationSpeed = 0
NewBolt.Thickness = 1 --*size
NewBolt.Color = self.BoltColor
NewBolt.PulseLength = 0.8
NewBolt.ColorOffsetSpeed = 20
NewBolt.Frequency = 2
NewBolt.MinRadius, NewBolt.MaxRadius = 0, 4*size
NewBolt.FadeLength = 0.4
NewBolt.PulseSpeed = 5
NewBolt.MinThicknessMultiplier, NewBolt.MaxThicknessMultiplier = 0.7, 1
local NewSparks = LightningSparks.new(NewBolt, 5)
NewSparks.MinDistance, NewSparks.MaxDistance = 7.5, 10
NewBolt.Velocity = (A2.WorldPosition - A1.WorldPosition).Unit*0.1*size
--NewBolt.v0, NewBolt.v1 = rng_v:NextNumber(0, 5)*size, rng_v:NextNumber(0, 5)*size
bolts[#bolts + 1] = NewBolt
end
self.Bolts = bolts
self.Attachment = attach
self.Part = part
self.StartT = clock()
self.RefIndex = #ActiveExplosions + 1
ActiveExplosions[self.RefIndex] = self
return self
end
function LightningExplosion:Destroy()
ActiveExplosions[self.RefIndex] = nil
self.Part:Destroy()
for i = 1, #self.Bolts do
self.Bolts[i] = nil
end
self = nil
end
game:GetService("RunService").Heartbeat:Connect(function ()
for _, ThisExplosion in pairs(ActiveExplosions) do
local timePassed = clock() - ThisExplosion.StartT
local attach = ThisExplosion.Attachment
if timePassed < 0.7 then
if timePassed > 0.2 then
attach.ExplosionBrightspot.Enabled, attach.GlareEmitter.Enabled, attach.PlasmaEmitter.Enabled = false, false, false
end
for i = 1, #ThisExplosion.Bolts do
local currBolt = ThisExplosion.Bolts[i]
currBolt.Attachment1.WorldPosition = currBolt.Attachment1.WorldPosition + currBolt.Velocity
--currBolt.CurveSize0, currBolt.CurveSize1 = currBolt.CurveSize0 + currBolt.v0, currBolt.CurveSize1 + currBolt.v1
end
else
ThisExplosion:Destroy()
end
end
end)
return LightningExplosion
|
---Set Interpolated Camera
|
function module.SetCamera(Player,Target)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local tween = TweenService:Create(
camera,
TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut),
{
CFrame = Target,
--Focus = Cached_Dealership.PrimaryPart.CFrame
}
)
tween:Play()
end
|
-- public methods
|
function region3:castPoint(point)
local direction = self.centroid - point;
return gjk(self.input, {point}, self.support, support.point, direction);
end;
function region3:castPart(part)
local against = classify(part);
local direction = self.centroid - against.centroid;
return gjk(self.input, against.input, self.support, against.support, direction);
end;
function region3:cast(ignore, maxParts)
local ignore = type(ignore) == "table" and ignore or {ignore};
local maxParts = maxParts or 1000;
local min, max = {}, {};
for _, enum in next, {Enum.NormalId.Right, Enum.NormalId.Top, Enum.NormalId.Back} do
local direction = Vector3.FromNormalId(enum);
insert(min, self.support(-direction, unpack(self.input)));
insert(max, self.support(direction, unpack(self.input)));
end;
min, max = v3(min[1].x, min[2].y, min[3].z), v3(max[1].x, max[2].y, max[3].z);
local allignedR3 = R3(min, max);
local parts = game.Workspace:FindPartsInRegion3WithIgnoreList(allignedR3, ignore, maxParts);
-- debug stuff
--game.Workspace.CurrentCamera:ClearAllChildren();
--draw.line(min, max, game.Workspace.CurrentCamera);
local inRegion = {};
for i = 1, #parts do
local part = parts[i];
if (self:castPart(part)) then
insert(inRegion, part);
end;
end;
return inRegion;
end;
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 300 -- [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 = 1.7 -- Torque compensation multiplier for inclines (applies gradient from 0-90 degrees)
--Misc
Tune.RevAccel = 150 -- RPM acceleration when clutch is off
Tune.RevDecay = 75 -- RPM decay when clutch is off
Tune.RevBounce = 500 -- RPM kickback from redline
Tune.IdleThrottle = 3 -- Percent throttle at idle
Tune.ClutchTol = 500 -- Clutch engagement threshold (higher = faster response)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.